Closed ttb-inc closed 2 years ago
your code is ok. change your rpc url
@ttb-inc Is it working? if not, what network are you using?
@ttb-inc Is it working? if not, what network are you using?
@TheGreatAxios It still doesn't work.
[Network] 80001 (Polygon Testnet(Mumbai)) (https://docs.polygon.technology/docs/develop/network-details/network/)
[RPC Endpoint] RPC Endpoint tested two things.
Thank you.
@ttb-inc Please send your code here, I will take a look. Currently, I am having no issues estimated gas on Mumbai; so it may be something related to your setup/config.
NOTE: DO NOT UPLOAD ANY API KEYS when you upload your code (Just a reminder :)) I see you commended the one out above
@ttb-inc Please send your code here, I will take a look. Currently, I am having no issues estimated gas on Mumbai; so it may be something related to your setup/config.
NOTE: DO NOT UPLOAD ANY API KEYS when you upload your code (Just a reminder :)) I see you commended the one out above
@TheGreatAxios Thank you for answer.
...
final contractFunction = contract.function('safeTransferFrom');
return await client.estimateGas(
sender: EthereumAddress.fromHex(from),
to: EthereumAddress.fromHex(to),
data: contractFunction.encodeCall([EthereumAddress.fromHex(from), EthereumAddress.fromHex(to), tokenId, Uint8List.fromList([])]),
gasPrice: EtherAmount.inWei(gasPrice),
amountOfGas: gasPrice,
value: EtherAmount.inWei(BigInt.from(1)),
);
...
If there is no problem with the above code, I will check it again.
Let me create testable code. Thank you.
@ttb-inc Is this for an ERC-1155 or an ERC-721? Also, can you please provide the error.
Thanks
@TheGreatAxios Thank you for answer.
This is my fault. The same to: address was used. I separated the to: address, and it works fine. (contract address, wallet address)
...
final contractFunction = contract.function('safeTransferFrom');
return await client.estimateGas(
sender: EthereumAddress.fromHex(from),
to: EthereumAddress.fromHex(contract address),
data: contractFunction.encodeCall([EthereumAddress.fromHex(from), EthereumAddress.fromHex(wallet address), tokenId, Uint8List.fromList([])]),
gasPrice: EtherAmount.inWei(gasPrice),
amountOfGas: gasPrice,
value: EtherAmount.inWei(BigInt.from(1)),
);
...
The gasLimit is similar to 90,000. (real 87,933)
Thank you very much. Have a good day.
Hi,
To calculate gasLimit in real time, we are going to use estimateGas. However, the returned gasLimit value is too small. (ex, early 20,000, not 21,000 ^^) If you actually send it, you will get over 50,000. Is the method I used correct? How can I get estimateGas for ERC721? thank you