Giter Site home page Giter Site logo

NFT(ERC721) estimateGas? about web3dart HOT 7 CLOSED

ttb-inc avatar ttb-inc commented on August 31, 2024
NFT(ERC721) estimateGas?

from web3dart.

Comments (7)

ttb-inc avatar ttb-inc commented on August 31, 2024 3

@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.

from web3dart.

mrtnetwork avatar mrtnetwork commented on August 31, 2024

your code is ok. change your rpc url

from web3dart.

TheGreatAxios avatar TheGreatAxios commented on August 31, 2024

@ttb-inc Is it working? if not, what network are you using?

from web3dart.

ttb-inc avatar ttb-inc commented on August 31, 2024

@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.

  1. https://rpc-mumbai.matic.today/
  2. Supported by Moralis. (https://speedy-nodes-nyc.moralis.io/[API_KEY]/polygon/mumbai)
    Both of the above result in the same result.

Thank you.

from web3dart.

TheGreatAxios avatar TheGreatAxios commented on August 31, 2024

@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

from web3dart.

ttb-inc avatar ttb-inc commented on August 31, 2024

@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.

from web3dart.

TheGreatAxios avatar TheGreatAxios commented on August 31, 2024

@ttb-inc Is this for an ERC-1155 or an ERC-721?
Also, can you please provide the error.

Thanks

from web3dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.