simulateContract should take account hoisting into consideration #1097
Unanswered
Sz0x
asked this question in
Idea / Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When initializing a wallet client, there is an option to hoist the account into the client itself and to extend the functionality of the client with
publicActions. When doing both, the assumption is that any functionality executed on the client should use the account hoisted on the client.When performing a
writeContractcall, the recommended pattern is to callsimulateContractfirst and thenwriteContract. The issue is thatsimulateContractdoesn't take into consideration the hoisted account, thus causing errors for transactions that expect thefromfield to be present in the param.After further inspection,
simulateContractusescallandwriteContractusessendTransaction, but insendTransactionit takes the hoisted account into consideration and thecalldoes not.https://github.com/wagmi-dev/viem/blob/0cbf0b881785c41834fce5e214868bfe3200dc1e/src/actions/public/call.ts#L92
https://github.com/wagmi-dev/viem/blob/0cbf0b881785c41834fce5e214868bfe3200dc1e/src/actions/wallet/sendTransaction.ts#L100
A suggestion for a solution would be to have
calltake the hoisted account into considerationBeta Was this translation helpful? Give feedback.
All reactions