makerdao / multicall

Multicall: Aggregate multiple constant function call results into one
MIT License
854 stars 461 forks source link

Is withSigner required when calling aggregate method? #36

Closed golden-bull closed 2 years ago

golden-bull commented 2 years ago

When I call the “aggregate” function to query the balance of a token, it always prompts “sending a transaction requires a signer (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=contracts/5.4.0)”.

Any one help? Thanks!

golden-bull commented 2 years ago

Fine, fine, fine, I know how to solve my problem..

The “aggregate” function is compiled into a "nonpayable" type by default, which requires wallet signature operations. But if your dapp only uses it to do some view and pure query operations, you can change the "stateMutability" of "aggregate" to "view" in the abi of the multicall contract. then the problem solved...

goodwasif commented 2 years ago

Thanks @SixBull <3 You saved my day