@@ -23,11 +23,7 @@ class ENSTests: XCTestCase {
2323 }
2424
2525 func testResolverAddress( ) async throws {
26- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
27- else {
28- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
29- return
30- }
26+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
3127 let ens = ENS ( web3: web3)
3228 let domain = " somename.eth "
3329 let address = try await ens? . registry. getResolver ( forDomain: domain) . resolverContractAddress
@@ -36,23 +32,15 @@ class ENSTests: XCTestCase {
3632 }
3733
3834 func testResolver( ) async throws {
39- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
40- else {
41- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
42- return
43- }
35+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
4436 let ens = ENS ( web3: web3)
4537 let domain = " somename.eth "
4638 let address = try await ens? . getAddress ( forNode: domain)
4739 XCTAssertEqual ( address? . address. lowercased ( ) , " 0xc1ccfb5fc589b83b9e849c6f9b26efc71419898d " )
4840 }
4941
5042 func testSupportsInterface( ) async throws {
51- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
52- else {
53- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
54- return
55- }
43+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
5644 let ens = ENS ( web3: web3)
5745 let domain = " somename.eth "
5846 let resolver = try await ens? . registry. getResolver ( forDomain: domain)
@@ -67,11 +55,7 @@ class ENSTests: XCTestCase {
6755 }
6856
6957 func testABI( ) async throws {
70- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
71- else {
72- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
73- return
74- }
58+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
7559 let ens = ENS ( web3: web3)
7660 let domain = " somename.eth "
7761 let resolver = try await ens? . registry. getResolver ( forDomain: domain)
@@ -86,35 +70,23 @@ class ENSTests: XCTestCase {
8670 }
8771
8872 func testOwner( ) async throws {
89- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
90- else {
91- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
92- return
93- }
73+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
9474 let ens = ENS ( web3: web3)
9575 let domain = " somename.eth "
9676 let owner = try await ens? . registry. getOwner ( node: domain)
9777 XCTAssertEqual ( " 0xc1ccfb5fc589b83b9e849c6f9b26efc71419898d " , owner? . address. lowercased ( ) )
9878 }
9979
10080 func testTTL( ) async throws {
101- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
102- else {
103- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
104- return
105- }
81+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
10682 let ens = try XCTUnwrap ( ENS ( web3: web3) )
10783 let domain = " somename.eth "
10884 let ttl = try await ens. registry. getTTL ( node: domain)
10985 XCTAssertGreaterThanOrEqual ( ttl, 0 )
11086 }
11187
11288 func testGetAddress( ) async throws {
113- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
114- else {
115- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
116- return
117- }
89+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
11890 let ens = ENS ( web3: web3)
11991 let domain = " somename.eth "
12092 let resolver = try await ens? . registry. getResolver ( forDomain: domain)
@@ -123,11 +95,7 @@ class ENSTests: XCTestCase {
12395 }
12496
12597 func testGetPubkey( ) async throws {
126- guard let web3 = await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
127- else {
128- XCTFail ( " Failed to connect to InfuraMainnet using token \( Constants . infuraToken) " )
129- return
130- }
98+ let web3 = try await Web3 . InfuraMainnetWeb3 ( accessToken: Constants . infuraToken)
13199 let ens = ENS ( web3: web3)
132100 let domain = " somename.eth "
133101 let resolver = try await ens? . registry. getResolver ( forDomain: domain)
0 commit comments