Git Product home page Git Product logo

Comments (1)

ImDuong avatar ImDuong commented on August 13, 2024 1

I find a work around is calling getEthBalance function from the multicall contract.

const multicallContractAddress = "0xcA11bde05977b3631167028862bE2a173976CA11"
const contractCallContext: ContractCallContext[] = tokenAddresses.map((it) => ({
        reference: `${it}`,
        contractAddress: multicallContractAddress,
        abi: MULTICALL_ABI,
        calls: [{ reference: `callBalanceOf:${it}`, methodName: 'getEthBalance', methodParameters: [walletAddress] }],
    }))

My questions now are:

  1. Can I still use null address for ERC20 ABI like in the topic? If yes, how would I need to adjust the code?
  2. If the original way does not work, could I not specify particular contractAddress and multicall contract's abi? Like the package already support these and I can reuse them?
    • I find out that there is public static ABI field of Multicall class, but it only has write functions, but not getEthBalance function
    • And there is function getContractBasedOnNetwork suits my needs but it is not published unfortunately. Hence, the work around would be duplicated that function into my own code.

from ethereum-multicall.

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.