Skip to content

Commit 963f3c8

Browse files
Merge pull request #395 from battlmonstr/ot2
Fix ENS.getContentHash to return Data
2 parents c703b4e + b1f936a commit 963f3c8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/web3swift/Utils/ENS/ENS.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public class ENS {
148148
return result
149149
}
150150

151-
public func getContent(forNode node: String) throws -> String {
151+
public func getContent(forNode node: String) throws -> Data {
152152
guard let resolver = try? self.registry.getResolver(forDomain: node) else {
153153
throw Web3Error.processingError(desc: "Failed to get resolver for domain")
154154
}

Sources/web3swift/Utils/ENS/ENSResolver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ public extension ENS {
117117
return result
118118
}
119119

120-
func getContentHash(forNode node: String) throws -> String {
120+
func getContentHash(forNode node: String) throws -> Data {
121121
guard let nameHash = NameHash.nameHash(node) else {throw Web3Error.processingError(desc: "Failed to get name hash")}
122122
guard let transaction = self.resolverContract.read("contenthash", parameters: [nameHash] as [AnyObject], extraData: Data(), transactionOptions: defaultOptions) else {throw Web3Error.transactionSerializationError}
123123
guard let result = try? transaction.call(transactionOptions: defaultOptions) else {throw Web3Error.processingError(desc: "Can't call transaction")}
124-
guard let content = result["0"] as? String else {throw Web3Error.processingError(desc: "Can't get content")}
124+
guard let content = result["0"] as? Data else {throw Web3Error.processingError(desc: "Can't get content")}
125125
return content
126126
}
127127

0 commit comments

Comments
 (0)