Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multicall doesn't return result with same type like BigNumber from "ether" when using singlecall !!! #33

Open
nguy3nds opened this issue Apr 24, 2022 · 5 comments

Comments

@nguy3nds
Copy link

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?

@joshstevens19
Copy link
Owner

joshstevens19 commented Apr 24, 2022

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

@jsertx
Copy link
Contributor

jsertx commented Jul 2, 2022

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?

@joshstevens19
Copy link
Owner

For sure great idea!! be my guest to do a PR @jsertx

@jsertx
Copy link
Contributor

jsertx commented Jul 6, 2022

I have seen that the issue is on the Utils.deepClone when building returnObjectResult pushing to callsReturnContext array in the following lines:

originalContractCallContext: Utils.deepClone(

Utils.deepClone<CallReturnContext>({

Utils.deepClone<CallReturnContext>({

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.

@joshstevens19
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants