@@ -13,41 +13,44 @@ import BigInt
13
13
// MARK: Works only with network connection
14
14
class web3swiftST20AndSecurityTokenTests : XCTestCase {
15
15
16
- func testERC20TokenCreation( ) throws {
17
- let web3 = Web3 . GanacheWeb3 ( network: . Kovan)
16
+ func testERC20TokenCreation( ) async throws {
17
+ let web3 = await Web3 . GanacheWeb3 ( network: . Kovan)
18
18
let w3sTokenAddress = EthereumAddress ( " 0x2dD33957C90880bE4Ee9fd5F703110BDA2E579EC " ) !
19
19
let st20token = ST20 . init ( web3: web3, provider: web3. provider, address: w3sTokenAddress)
20
- st20token. readProperties ( )
21
- XCTAssert ( st20token. symbol == " MIMI " )
22
- XCTAssert ( st20token. name == " Mimi " )
23
- XCTAssert ( st20token. decimals == 18 )
20
+ try await st20token. readProperties ( )
21
+ let symbol = try await st20token. symbol ( )
22
+ let name = try await st20token. name ( )
23
+ let decimals = try await st20token. decimals ( )
24
+ XCTAssert ( symbol == " MIMI " )
25
+ XCTAssert ( name == " Mimi " )
26
+ XCTAssert ( decimals == 18 )
24
27
}
25
28
26
- func testST20tokenBalanceAndAllowance( ) throws {
27
- let web3 = Web3 . GanacheWeb3 ( network: . Kovan)
29
+ func testST20tokenBalanceAndAllowance( ) async throws {
30
+ let web3 = await Web3 . GanacheWeb3 ( network: . Kovan)
28
31
let w3sTokenAddress = EthereumAddress ( " 0x2dD33957C90880bE4Ee9fd5F703110BDA2E579EC " ) !
29
32
let st20token = ST20 . init ( web3: web3, provider: web3. provider, address: w3sTokenAddress)
30
33
let userAddress = EthereumAddress ( " 0xe22b8979739D724343bd002F9f432F5990879901 " ) !
31
- let balance = try st20token. getBalance ( account: userAddress)
32
- let allowance = try st20token. getAllowance ( originalOwner: userAddress, delegate: userAddress)
34
+ let balance = try await st20token. getBalance ( account: userAddress)
35
+ let allowance = try await st20token. getAllowance ( originalOwner: userAddress, delegate: userAddress)
33
36
XCTAssert ( String ( balance) == " 0 " )
34
37
XCTAssert ( allowance == 0 )
35
38
}
36
39
37
- func testSecurityTokenInvestors( ) throws {
38
- let web3 = Web3 . GanacheWeb3 ( network: . Kovan)
40
+ func testSecurityTokenInvestors( ) async throws {
41
+ let web3 = await Web3 . GanacheWeb3 ( network: . Kovan)
39
42
let w3sTokenAddress = EthereumAddress ( " 0x2dD33957C90880bE4Ee9fd5F703110BDA2E579EC " ) !
40
43
let stoken = SecurityToken . init ( web3: web3, provider: web3. provider, address: w3sTokenAddress)
41
- let investorsCount = try stoken. investorCount ( )
44
+ let investorsCount = try await stoken. investorCount ( )
42
45
let stringInvestorsCount = String ( investorsCount)
43
46
XCTAssert ( stringInvestorsCount == " 0 " )
44
47
}
45
48
46
- func testSecurityTokenGranularity( ) throws {
47
- let web3 = Web3 . GanacheWeb3 ( network: . Kovan)
49
+ func testSecurityTokenGranularity( ) async throws {
50
+ let web3 = await Web3 . GanacheWeb3 ( network: . Kovan)
48
51
let w3sTokenAddress = EthereumAddress ( " 0x2dD33957C90880bE4Ee9fd5F703110BDA2E579EC " ) !
49
52
let stoken = SecurityToken . init ( web3: web3, provider: web3. provider, address: w3sTokenAddress)
50
- let granularity = try stoken. getGranularity ( )
53
+ let granularity = try await stoken. getGranularity ( )
51
54
let stringGranularity = String ( granularity)
52
55
XCTAssert ( stringGranularity == " 1000000000000000000 " )
53
56
}
0 commit comments