Skip to content

Commit 08fe344

Browse files
committed
resolve confilct
1 parent ee7e3d9 commit 08fe344

File tree

4 files changed

+51
-51
lines changed

4 files changed

+51
-51
lines changed

Tests/web3swiftTests/remoteTests/ENSTests.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ class ENSTests: XCTestCase {
2222
XCTAssertEqual(NameHash.nameHash("foo.eth"), Data.fromHex("0xde9b09fd7c5f901e23a3f19fecc54828e9c848539801e86591bd9801b019f84f"))
2323
}
2424

25-
func testResolverAddress() throws {
26-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
25+
func testResolverAddress() async throws {
26+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
2727
let ens = ENS(web3: web3)
2828
let domain = "somename.eth"
2929
let address = try await ens?.registry.getResolver(forDomain: domain).resolverContractAddress
3030
print(address as Any)
3131
XCTAssertEqual(address?.address.lowercased(), "0x5ffc014343cd971b7eb70732021e26c35b744cc4")
3232
}
3333

34-
func testResolver() throws {
35-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
34+
func testResolver() async throws {
35+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
3636
let ens = ENS(web3: web3)
3737
let domain = "somename.eth"
3838
let address = try await ens?.getAddress(forNode: domain)
3939
XCTAssertEqual(address?.address.lowercased(), "0x3487acfb1479ad1df6c0eb56ae743d34897798ac")
4040
}
4141

42-
func testSupportsInterface() throws {
43-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
42+
func testSupportsInterface() async throws {
43+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
4444
let ens = ENS(web3: web3)
4545
let domain = "somename.eth"
4646
let resolver = try await ens?.registry.getResolver(forDomain: domain)
@@ -54,8 +54,8 @@ class ENSTests: XCTestCase {
5454
XCTAssertEqual(isPubkeySupports, true)
5555
}
5656

57-
func testABI() throws {
58-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
57+
func testABI() async throws {
58+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
5959
let ens = ENS(web3: web3)
6060
let domain = "somename.eth"
6161
let resolver = try await ens?.registry.getResolver(forDomain: domain)
@@ -69,33 +69,33 @@ class ENSTests: XCTestCase {
6969
}
7070
}
7171

72-
func testOwner() throws {
73-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
72+
func testOwner() async throws {
73+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
7474
let ens = ENS(web3: web3)
7575
let domain = "somename.eth"
7676
let owner = try await ens?.registry.getOwner(node: domain)
7777
XCTAssertEqual("0xc67247454e720328714c4e17bec7640572657bee", owner?.address.lowercased())
7878
}
7979

80-
func testTTL() throws {
81-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
80+
func testTTL() async throws {
81+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
8282
let ens = ENS(web3: web3)
8383
let domain = "somename.eth"
8484
let ttl = try await ens?.registry.getTTL(node: domain)
8585
print(ttl!.description)
8686
}
8787

88-
func testGetAddress() throws {
89-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
88+
func testGetAddress() async throws {
89+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
9090
let ens = ENS(web3: web3)
9191
let domain = "somename.eth"
9292
let resolver = try await ens?.registry.getResolver(forDomain: domain)
9393
let address = try await resolver?.getAddress(forNode: domain)
9494
XCTAssertEqual(address?.address.lowercased(), "0x3487acfb1479ad1df6c0eb56ae743d34897798ac")
9595
}
9696

97-
func testGetPubkey() throws {
98-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
97+
func testGetPubkey() async throws {
98+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
9999
let ens = ENS(web3: web3)
100100
let domain = "somename.eth"
101101
let resolver = try await ens?.registry.getResolver(forDomain: domain)

Tests/web3swiftTests/remoteTests/InfuraTests.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@ import XCTest
1111
// MARK: Works only with network connection
1212
class InfuraTests: XCTestCase {
1313

14-
func testGetBalance() throws {
14+
func testGetBalance() async throws {
1515
do {
16-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
16+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
1717
let address = EthereumAddress("0xd61b5ca425F8C8775882d4defefC68A6979DBbce")!
18-
let balance = try web3.eth.getBalance(address: address)
18+
let balance = try await web3.eth.getBalance(address: address)
1919
let balString = Web3.Utils.formatToEthereumUnits(balance, toUnits: .eth, decimals: 3)
2020
print(balString!)
2121
} catch {
2222
XCTFail()
2323
}
2424
}
2525

26-
func testGetBlockByHash() throws {
27-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
28-
let result = try web3.eth.getBlockByHash("0x6d05ba24da6b7a1af22dc6cc2a1fe42f58b2a5ea4c406b19c8cf672ed8ec0695", fullTransactions: false)
26+
func testGetBlockByHash() async throws {
27+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
28+
let result = try await web3.eth.getBlockByHash("0x6d05ba24da6b7a1af22dc6cc2a1fe42f58b2a5ea4c406b19c8cf672ed8ec0695", fullTransactions: false)
2929

3030
print(result)
3131
}
3232

33-
func testGetBlockByNumber1() throws {
34-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
35-
let result = try web3.eth.getBlockByNumber("latest", fullTransactions: false)
33+
func testGetBlockByNumber1() async throws {
34+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
35+
let result = try await web3.eth.getBlockByNumber("latest", fullTransactions: false)
3636
print(result)
3737
}
3838

39-
func testGetBlockByNumber2() throws {
40-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
41-
let result = try web3.eth.getBlockByNumber(UInt64(5184323), fullTransactions: true)
39+
func testGetBlockByNumber2() async throws {
40+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
41+
let result = try await web3.eth.getBlockByNumber(UInt64(5184323), fullTransactions: true)
4242
print(result)
4343
let transactions = result.transactions
4444
for transaction in transactions {
@@ -51,32 +51,32 @@ class InfuraTests: XCTestCase {
5151
}
5252
}
5353

54-
func testGetBlockByNumber3() throws {
54+
func testGetBlockByNumber3() async throws {
5555
do {
56-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
57-
let _ = try web3.eth.getBlockByNumber(UInt64(1000000000), fullTransactions: true)
56+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
57+
let _ = try await web3.eth.getBlockByNumber(UInt64(1000000000), fullTransactions: true)
5858
XCTFail()
5959
} catch {
6060

6161
}
6262
}
6363

64-
func testGasPrice() throws {
65-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
66-
let response = try web3.eth.getGasPrice()
64+
func testGasPrice() async throws {
65+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
66+
let response = try await web3.eth.getGasPrice()
6767
print(response)
6868
}
6969

70-
func testGetIndexedEventsPromise() throws {
70+
func testGetIndexedEventsPromise() async throws {
7171
let jsonString = "[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"},{\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"approveAndCall\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"remaining\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"_initialAmount\",\"type\":\"uint256\"},{\"name\":\"_tokenName\",\"type\":\"string\"},{\"name\":\"_decimalUnits\",\"type\":\"uint8\"},{\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"type\":\"constructor\"},{\"payable\":false,\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},]"
72-
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
72+
let web3 = await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
7373
let contract = web3.contract(jsonString, at: nil, abiVersion: 2)
7474
var filter = EventFilter()
7575
filter.fromBlock = .blockNumber(UInt64(5200120))
7676
filter.toBlock = .blockNumber(UInt64(5200120))
7777
filter.addresses = [EthereumAddress("0x53066cddbc0099eb6c96785d9b3df2aaeede5da3")!]
7878
filter.parameterFilters = [([EthereumAddress("0xefdcf2c36f3756ce7247628afdb632fa4ee12ec5")!] as [EventFilterable]), (nil as [EventFilterable]?)]
79-
let eventParserResult = try contract!.getIndexedEventsPromise(eventName: "Transfer", filter: filter, joinWithReceipts: true).wait()
79+
let eventParserResult = try await contract!.getIndexedEventsPromise(eventName: "Transfer", filter: filter, joinWithReceipts: true)
8080
print(eventParserResult)
8181
XCTAssert(eventParserResult.count == 2)
8282
XCTAssert(eventParserResult.first?.transactionReceipt != nil)

0 commit comments

Comments
 (0)