ethereum-multicall
ethereum-multicall copied to clipboard
Multicall doesn't return result with same type like BigNumber from "ether" when using singlecall !!!
Mulltilcall returns CallValueResult with type: { type: "BigNumber", hex: "0x0176b344f2a78c0000" },
It doesn't the same type as I call single. This case type is likely { BigNumber } from "ether." It's { _isBigNumber: true, _hex: "0x0176b344f2a78c0000" },
Could anyone tell me if I missed anything?
You can use BigNumber.From to parse it on the response in your code. right now in the lib it just returns the nine class version.. would be nicer if it parsed for you for sure on cases where _isBigNumber = true
Will look at doing that but for now parse it yourself once result comes back
You can use BigNumber.From to parse it on the response in your code. right now in the lib it just returns the nine class version.. would be nicer if it parsed for you for sure on cases where _isBigNumber = true
Will look at doing that but for now parse it yourself once result comes back
Hi! As we have introduced an options parameter into the call method, we could add a new parameter to return bignumbers instead of strings?
For sure great idea!! be my guest to do a PR @jsertx
I have seen that the issue is on the Utils.deepClone when building returnObjectResult pushing to callsReturnContext array in the following lines:
https://github.com/joshstevens19/ethereum-multicall/blob/80ae156f2672fe154c79fc09183790282134dfb5/src/multicall.ts#L165 https://github.com/joshstevens19/ethereum-multicall/blob/80ae156f2672fe154c79fc09183790282134dfb5/src/multicall.ts#L209 https://github.com/joshstevens19/ethereum-multicall/blob/80ae156f2672fe154c79fc09183790282134dfb5/src/multicall.ts#L237
We could release a new minor version: adding the extra options parameter returnBigNumber to parse it with false as default to not break current implementations.
And maybe, in a major version add that parsing option default to true, so removes friction for first time users.
Nice find yeah that will nuke the big number class! And now it’s in the wild we can’t really break it! I would say yes do the returnBigNumber option and make it parse stuff back and then as you say we can bring in a breaking change on the major! We can guide the docs to this as well! PR welcome!