Skip to content

Commit e44757d

Browse files
fixed support interface methods in ercs, refactored and changed architecture for ens namespace, updated ens resolver and registry methods, made convenient method getComponentsWithoutPrefix for publickey
1 parent f3353c1 commit e44757d

File tree

16 files changed

+744
-442
lines changed

16 files changed

+744
-442
lines changed

web3swift.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
3A52CCB82264B712001C8D7A /* BaseRegistrar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A52CCB62264B712001C8D7A /* BaseRegistrar.swift */; };
2525
3A52CCBA2264B728001C8D7A /* ETHRegistrarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A52CCB92264B728001C8D7A /* ETHRegistrarController.swift */; };
2626
3A52CCBB2264B728001C8D7A /* ETHRegistrarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A52CCB92264B728001C8D7A /* ETHRegistrarController.swift */; };
27+
3A52CCBD226747EB001C8D7A /* PublicKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A52CCBC226747EB001C8D7A /* PublicKey.swift */; };
28+
3A52CCBE226747EB001C8D7A /* PublicKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A52CCBC226747EB001C8D7A /* PublicKey.swift */; };
29+
3A52CCC022675CFC001C8D7A /* ENSRegistry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A52CCBF22675CFC001C8D7A /* ENSRegistry.swift */; };
30+
3A52CCC122675CFC001C8D7A /* ENSRegistry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A52CCBF22675CFC001C8D7A /* ENSRegistry.swift */; };
2731
3AE8913C2256286C00D08E99 /* Web3+ERC1155.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AE8911C2256286B00D08E99 /* Web3+ERC1155.swift */; };
2832
3AE8913D2256286C00D08E99 /* Web3+ERC1155.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AE8911C2256286B00D08E99 /* Web3+ERC1155.swift */; };
2933
3AE8913E2256286C00D08E99 /* Web3+ERC1376.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AE8911E2256286B00D08E99 /* Web3+ERC1376.swift */; };
@@ -266,6 +270,8 @@
266270
391A0D2EF42488E5C8AB2F71 /* Pods_web3swift_osx_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_osx_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
267271
3A52CCB62264B712001C8D7A /* BaseRegistrar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseRegistrar.swift; sourceTree = "<group>"; };
268272
3A52CCB92264B728001C8D7A /* ETHRegistrarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ETHRegistrarController.swift; sourceTree = "<group>"; };
273+
3A52CCBC226747EB001C8D7A /* PublicKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicKey.swift; sourceTree = "<group>"; };
274+
3A52CCBF22675CFC001C8D7A /* ENSRegistry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ENSRegistry.swift; sourceTree = "<group>"; };
269275
3AE8911C2256286B00D08E99 /* Web3+ERC1155.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+ERC1155.swift"; sourceTree = "<group>"; };
270276
3AE8911E2256286B00D08E99 /* Web3+ERC1376.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+ERC1376.swift"; sourceTree = "<group>"; };
271277
3AE891202256286B00D08E99 /* Web3+ERC888.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+ERC888.swift"; sourceTree = "<group>"; };
@@ -528,7 +534,9 @@
528534
children = (
529535
81A7B2502143C3A8004CD2C7 /* NameHash.swift */,
530536
B2E668CD214F8A7B00C3CC2D /* ENS.swift */,
537+
3A52CCBC226747EB001C8D7A /* PublicKey.swift */,
531538
B219DC162154F3EE0035BF94 /* ENSResolver.swift */,
539+
3A52CCBF22675CFC001C8D7A /* ENSRegistry.swift */,
532540
3A52CCB62264B712001C8D7A /* BaseRegistrar.swift */,
533541
3A52CCB92264B728001C8D7A /* ETHRegistrarController.swift */,
534542
);
@@ -1184,6 +1192,7 @@
11841192
810B0F9A1FEC446B00CF0DA2 /* Web3+JSONRPC.swift in Sources */,
11851193
3AE891642256620200D08E99 /* Web3+WebsocketProvider.swift in Sources */,
11861194
81195AB020D7FF8500ABC6B1 /* Promise+Web3+Contract+GetIndexedEvents.swift in Sources */,
1195+
3A52CCBD226747EB001C8D7A /* PublicKey.swift in Sources */,
11871196
81EB1E4B208173D7003BD47F /* Web3+Personal.swift in Sources */,
11881197
81909D1821862D5A007D2AE5 /* Web3+Eventloop.swift in Sources */,
11891198
81A1824B20D7DF1B0016741F /* Promise+Web3+Personal+UnlockAccount.swift in Sources */,
@@ -1247,6 +1256,7 @@
12471256
8103BBCC2077B84400499769 /* PlainKeystore.swift in Sources */,
12481257
81DFB3FF210775320011DC85 /* Web3+InfuraProviders.swift in Sources */,
12491258
81909D4A218864A8007D2AE5 /* EIP681.swift in Sources */,
1259+
3A52CCC022675CFC001C8D7A /* ENSRegistry.swift in Sources */,
12501260
3AE891542256286C00D08E99 /* Web3+ERC1400.swift in Sources */,
12511261
3AE891522256286C00D08E99 /* Web3+ERC721x.swift in Sources */,
12521262
81C0FCF220440EB500D82FAF /* Web3+Protocols.swift in Sources */,
@@ -1311,6 +1321,7 @@
13111321
41948121203630530065A83B /* Web3+Utils.swift in Sources */,
13121322
3AE891652256620200D08E99 /* Web3+WebsocketProvider.swift in Sources */,
13131323
81909D1921862D5A007D2AE5 /* Web3+Eventloop.swift in Sources */,
1324+
3A52CCBE226747EB001C8D7A /* PublicKey.swift in Sources */,
13141325
8125F06A20499AC300A0F2FE /* BloomFilter.swift in Sources */,
13151326
81C0FD062044A8D100D82FAF /* TransactionSigner.swift in Sources */,
13161327
41948123203630530065A83B /* Web3+JSONRPC.swift in Sources */,
@@ -1374,6 +1385,7 @@
13741385
81A1823220D68A110016741F /* Promise+Batching.swift in Sources */,
13751386
4194813C203630530065A83B /* Base58.swift in Sources */,
13761387
81909D4B218864A9007D2AE5 /* EIP681.swift in Sources */,
1388+
3A52CCC122675CFC001C8D7A /* ENSRegistry.swift in Sources */,
13771389
3AE891552256286C00D08E99 /* Web3+ERC1400.swift in Sources */,
13781390
3AE891532256286C00D08E99 /* Web3+ERC721x.swift in Sources */,
13791391
8103BBCD2077B84400499769 /* PlainKeystore.swift in Sources */,

web3swift/Tokens/ERC1155/Web3+ERC1155.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public class ERC1155: IERC1155 {
135135
return res
136136
}
137137

138-
func supportsInterface(interfaceID: [UInt8]) throws -> Bool {
138+
func supportsInterface(interfaceID: String) throws -> Bool {
139139
let contract = self.contract
140140
var transactionOptions = TransactionOptions()
141141
transactionOptions.callOnBlock = .latest

web3swift/Tokens/ERC1400/Web3+ERC1400.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ extension ERC1400: IERC777 {
782782
return tx
783783
}
784784

785-
public func supportsInterface(interfaceID: [UInt8]) throws -> Bool {
785+
public func supportsInterface(interfaceID: String) throws -> Bool {
786786
let contract = self.contract
787787
var transactionOptions = TransactionOptions()
788788
transactionOptions.callOnBlock = .latest

web3swift/Tokens/ERC1410/Web3+ERC1410.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ extension ERC1410: IERC777 {
517517
return tx
518518
}
519519

520-
public func supportsInterface(interfaceID: [UInt8]) throws -> Bool {
520+
public func supportsInterface(interfaceID: String) throws -> Bool {
521521
let contract = self.contract
522522
var transactionOptions = TransactionOptions()
523523
transactionOptions.callOnBlock = .latest

web3swift/Tokens/ERC1633/Web3+ERC1633.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public class ERC1633: IERC1633 {
241241
return res
242242
}
243243

244-
public func supportsInterface(interfaceID: [UInt8]) throws -> Bool {
244+
public func supportsInterface(interfaceID: String) throws -> Bool {
245245
let contract = self.contract
246246
var transactionOptions = TransactionOptions()
247247
transactionOptions.callOnBlock = .latest

web3swift/Tokens/ERC165/Web3+ERC165.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import Foundation
1111
//Standard Interface Detection
1212
protocol IERC165 {
1313

14-
func supportsInterface(interfaceID: [UInt8]) throws -> Bool
14+
func supportsInterface(interfaceID: String) throws -> Bool
1515

1616
}

web3swift/Tokens/ERC721/Web3+ERC721.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public class ERC721: IERC721 {
205205
return res
206206
}
207207

208-
public func supportsInterface(interfaceID: [UInt8]) throws -> Bool {
208+
public func supportsInterface(interfaceID: String) throws -> Bool {
209209
let contract = self.contract
210210
var transactionOptions = TransactionOptions()
211211
transactionOptions.callOnBlock = .latest

web3swift/Tokens/ERC721x/Web3+ERC721x.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public class ERC721x: IERC721x {
189189
return res
190190
}
191191

192-
public func supportsInterface(interfaceID: [UInt8]) throws -> Bool {
192+
public func supportsInterface(interfaceID: String) throws -> Bool {
193193
let contract = self.contract
194194
var transactionOptions = TransactionOptions()
195195
transactionOptions.callOnBlock = .latest

web3swift/Tokens/ERC777/Web3+ERC777.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public class ERC777: IERC777 {
431431
return tx
432432
}
433433

434-
public func supportsInterface(interfaceID: [UInt8]) throws -> Bool {
434+
public func supportsInterface(interfaceID: String) throws -> Bool {
435435
let contract = self.contract
436436
var transactionOptions = TransactionOptions()
437437
transactionOptions.callOnBlock = .latest

web3swift/Utils/EIP/EIP681.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ extension Web3 {
126126
do {
127127
let web = web3(provider: InfuraProvider(Networks.fromInt(Int(code.chainID ?? 1)) ?? Networks.Mainnet)!)
128128
let ensModel = ENS(web3: web)
129-
var resolver = try ensModel.resolver(forDomain: ens)
130-
let address = try resolver.addr(forDomain: ens)
129+
guard let address = try ensModel?.useENSResolver(withDomain: ens)
130+
.getAddress(forNode: ens) else {
131+
return nil
132+
}
131133
nativeValue = address as AnyObject
132134
} catch {
133135
return nil

0 commit comments

Comments
 (0)