From ab873c57c4df3403bee8d5de36c3ed7d7147e468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Sarquella=20Farr=C3=A9s?= Date: Thu, 10 Mar 2022 01:02:47 +0100 Subject: [PATCH] Fix tokenURI method name for ERC721 and ERC721x tokens --- Sources/web3swift/Tokens/ERC721/Web3+ERC721.swift | 2 +- Sources/web3swift/Tokens/ERC721x/Web3+ERC721x.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/web3swift/Tokens/ERC721/Web3+ERC721.swift b/Sources/web3swift/Tokens/ERC721/Web3+ERC721.swift index 08dba2cd5..d93ba1ceb 100644 --- a/Sources/web3swift/Tokens/ERC721/Web3+ERC721.swift +++ b/Sources/web3swift/Tokens/ERC721/Web3+ERC721.swift @@ -272,7 +272,7 @@ extension ERC721: IERC721Metadata { let contract = self.contract var transactionOptions = TransactionOptions() transactionOptions.callOnBlock = .latest - let result = try contract.read("tokenId", parameters: [tokenId] as [AnyObject], extraData: Data(), transactionOptions: self.transactionOptions)!.call(transactionOptions: transactionOptions) + let result = try contract.read("tokenURI", parameters: [tokenId] as [AnyObject], extraData: Data(), transactionOptions: self.transactionOptions)!.call(transactionOptions: transactionOptions) guard let res = result["0"] as? String else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")} return res } diff --git a/Sources/web3swift/Tokens/ERC721x/Web3+ERC721x.swift b/Sources/web3swift/Tokens/ERC721x/Web3+ERC721x.swift index 94e9f5713..bef71d491 100644 --- a/Sources/web3swift/Tokens/ERC721x/Web3+ERC721x.swift +++ b/Sources/web3swift/Tokens/ERC721x/Web3+ERC721x.swift @@ -248,7 +248,7 @@ public class ERC721x: IERC721x { let contract = self.contract var transactionOptions = TransactionOptions() transactionOptions.callOnBlock = .latest - let result = try contract.read("tokenId", parameters: [tokenId] as [AnyObject], extraData: Data(), transactionOptions: self.transactionOptions)!.call(transactionOptions: transactionOptions) + let result = try contract.read("tokenURI", parameters: [tokenId] as [AnyObject], extraData: Data(), transactionOptions: self.transactionOptions)!.call(transactionOptions: transactionOptions) guard let res = result["0"] as? String else {throw Web3Error.processingError(desc: "Failed to get result of expected type from the Ethereum node")} return res }