Giter Site home page Giter Site logo

ethcall's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ethcall's Issues

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • Update dependency minimist to 1.2.6 [SECURITY]

  • Check this box to trigger a request for Renovate to run again on this repository

Allow to use different networks like Sepolia.

Need to refresh the list of multicall contracts to keep it up to date.

Also would be nice to have some API to add more contracts an runtime, would also make testing easier and allow users to use custom contracts.

provider.setMultiCall3({
  address: "",
  block: 0
})

The result returned is un-named

For example, when calling Pair.getReserves() in uniswap.
The typechain result is

getReserves(
    overrides?: CallOverrides
  ): Promise<
    [BigNumber, BigNumber, number] & {
      reserve0: BigNumber;
      reserve1: BigNumber;
      blockTimestampLast: number;
    }
  >;

However the returned object form this library is just [BigNumber, BigNumber, number], the named object is missing

Multicall1 address on 1337

Hello!

While playing with getEthBalance, I noticed that this function is using the multicall1 contract (even with tryAll) which is set to address 0x77dCa2C955b15e9dE4dbBCf1246B4B85b651e50e on the multicall addresses file.

This contract is not deployed on mainnet but only on testsnets.
Wondering if this should be moved to 0xeefba1e63905ef1d7acba5a8513c70307c1ce441 (mainnet multicall1) or if getEthBalance should respect all, tryAll or tryEach!

Thank you for your work!

getting importAssertions error

As ethcall is using assert keyword inside lib/call.js and lib/calls.js to import ABI's. Using ethcall in typescript project giving importAssertions error. It's a CRA which is customized using react-app-rewired

image
The solution is suggested in the error itself, which is adding a Babel plugin called @babel/plugin-syntax-import-assertions

Or are there any other solutions for this?

Error: invalid signer or provider

Hello!

I've tried to run the example and a custom code of mine but in both cases I got an Error: invalid signer or provider. The provider works fine by itself though, I was able to query data, like the block number for example.

Feature request: add support for 'pending' blockTag

Current multicall calls accept a block number as optional parameter, otherwise they use the default 'latest' block number.
The issue is that metamask has a 20 seconds cache on 'latest' block, so for fast EVM blockchains it's sometimes useful to be able to make calls with 'pending' block number to bypass the metamask cache and get up-to-date results.

Doesn't work with Web3 provider in browser

I'm getting this error:

Unhandled Rejection (Error): call revert exception (method="aggregate((address,bytes)[])", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.1.0)

image

Add example directory

Create a directory with usage samples covering most use cases (eth balance, token balance, multiple token balance, fetch AMM pools, fetch lending rates).

Remove "using deployless version" warning

Deployless Multicall has been used for months now without any known issues. It's also documented in README.

Assuming no issues with deployless Multicall will be found, the warning will be removed in the next major release.

Remove init step

Currently, init is required before making any calls. The reason behind init is to get chain id from the passed provider.
Instead, ask for provider and chain id in constructor and remove the need for init.

Supporting ethers human-readable ABIs

Hello. Great work on this library. It's very simple and easy to use.

I'm currently in the process of switching one of the projects I work on to using ethers' Human Readable ABI format, as opposed to the standard ABI format, particularly because of the readability, as well as the (minimal) bundle size savings we can get from doing that (we have a lot of ABI's in the frontend code). However, since ethcall (to my understanding) does not support this, we still have to keep the regular ABIs around for the contracts we use ethcall on.

I was wondering if adding support for this was on the roadmap. If so, I would love to open a PR that does this.

That said, I completely understand if you would like to keep this library as-is, and not introduce more complexity.

Allow custom multicall addresses in Init

image

As of now the multicall deployment addresses must be specified in multicall.ts based on the CHAIN_ID. Which is fine as defaults.
But for example if one wants to deploy to a local blockchain (Ganache, Hardhat) or any other non public listed private blockchain it cant really be used.

Would you guys consider making this an option in the future?

Allow manually setting gasLimit

afik, ethcall relies on the user's wallet to infer gasLimit for rpc calls. In some cases, this gas limit cannot be deduced by the wallet (for example when you're building a list of multicall from a dynamic array, even if you know its max size). I'd like to either be able to set the gasLimit manually, or have ethcall set it to a high value since it's read-only anyway.

edit: I was probably doing something wrong somewhere else in my code.

[Clarification] Signed / write transactions

Hi.
I'd like to send multiple signed (write) transactions using ethcall. Is that something possible or is this library focused on read contract information and not mutating txs ?

Thanks

Use ethers 6

Once ethers v6 becomes more stable, we should switch to it.

Use v3 for "all"/"tryAll" when possible

Currently, Multicall V1 is used for all calls, V2 is used for tryAll, and V3 is used for tryEach. However, V3 brings some gas optimisations, and it makes sense to use it for all calls.

One gotcha to keep in mind is that V3 may be not available for a given chain (not deployed) or a given block (block < multicall3DeploymentBlock). In those cases, we need to fallback to V1/V2.

Cannot find package

I'm getting the following error when I try to import the "ethcall" library:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/path/to/my/project/node_modules/ethcall/' imported from /path/to/my/project/index.js

Steps to replicate

  1. npm install ethcall
  2. Add import { Contract, Provider } from "ethcall"; to the top of an index.js file.
  3. Try running node index.js

Encountering RejectCallerWithCode error when using Anvil

Forked mainnet using anvil 0.1.0 (28312e7 2022-10-13T00:10:13.586314Z)

Turned on the logs by setting RUST_LOG env variable

RUST_LOG=backend,api anvil -f $RPC_URL

Then using latest ethcall and ethers.js, create a Provider() and call all() or tryAll()

Emits error like below

2022-10-13T02:20:01.419714Z TRACE backendhandler: received request basic address=0xca11bde05977b3631167028862be2a173976ca11
2022-10-13T02:20:01.419745Z TRACE backend: call return RejectCallerWithCode out: None gas 0 on block 15736119

This is probably due to overriding the from to the multicall address

https://github.com/Destiner/ethcall/blob/master/src/call.ts#L63

Since some EVM implementations have limitations like this, I think from should be changed to a non-contract address.
https://eips.ethereum.org/EIPS/eip-3607

Switch to Pure ESM

Update module and target in tsconfig.json. Include type, exports, engines in package.json.

This requires a major bump.

Add arbitrum testnet 421611

I would like to add a multicall config for Arbitrum testnet:
chainId: 421611
Contract: 0x96DB1F8055074aB62161B6Ad66Ab6B8679513DeF

I tried to do a fork and tried to compile on my project but had problems building
If someone could try and merge, would be awesome !

If needed i can do a pull request but i don't know if it only needs to be added in multicall.ts

Thanks !

Multicall2 support

Makerdao has updated their multicall repo with a newer version of multicall contract called Multicall2
https://github.com/makerdao/multicall/blob/master/src/Multicall2.sol

The newer multicall contract adds various new functions but the most important feature is that there is a tryAggregate function which allows ignoring any reverted calls.

Ideally, ethcall should move towards supporting the new contract without changing any of the user facing functions. I've kicked off the PR to do so here. #5

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.