must supply account
to estimateGas
_even_ when walletClient
is supplied
#546
firnprotocol
started this conversation in
General
Replies: 2 comments 8 replies
-
@tmm FYI? thoughts? thanks in advance for your attention and sorry for the spam. |
Beta Was this translation helpful? Give feedback.
2 replies
-
hi all, i appear to be still seeing the same behavior in viem partial error dump below: > gas = await contract.estimateGas.mint([69420]);
Uncaught:
ContractFunctionExecutionError: Could not find an Account to execute with this Action.
Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient.
Contract Call:
address: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
function: mint(uint256 tokenId)
args: (69420)
Docs: https://viem.sh/docs/actions/public/estimateGas.html
Version: viem@0.3.36
at getContractError (/Users/firnprotocol/relay/node_modules/viem/dist/cjs/utils/errors/getContractError.js:27:12)
at estimateContractGas (/Users/firnprotocol/relay/node_modules/viem/dist/cjs/actions/public/estimateContractGas.js:24:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async REPL27:1:39 {
details: undefined,
docsPath: '/docs/actions/public/estimateGas',
metaMessages: [
'Contract Call:',
' address: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2\n' +
' function: mint(uint256 tokenId)\n' +
' args: (69420)'
],
shortMessage: 'Could not find an Account to execute with this Action.\n' +
'Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient.',
version: 'viem@0.3.36',
cause: AccountNotFoundError: Could not find an Account to execute with this Action.
Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient. no clue if i'm doing something wrong... |
Beta Was this translation helpful? Give feedback.
6 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
viem (
0.3.31
is requiring that i explicitly supply anaccount
into a contract's instance'sestimateGas
action. moreover, the suppliedaccount
must have enough funds to pay the gas. finally, this is true even when a (funded)walletClient
has been supplied to the contract. the reason appears to be thatestimateGas
is attached to thepublicClient
supplied, not to thewalletClient
.after initializing:
compare the following code snippets:
the above one works, but only when
account
is sufficiently funded.the above one never works, and throws:
this error is misleading, since it throws the same error even when an
account
has been supplied to the awalletClient
, and thewalletClient
itself supplied to thecontract
.this all seems contrary to the behavior described here.
as a separate point, not sure if it's intended behavior to require that
account
have enough funds to pay the gas, but it seems slightly contrary to the intention ofestimateGas
, which is that we don't know it yet.not sure that any change is needed, just surfacing a bit of confusing behavior.
Beta Was this translation helpful? Give feedback.
All reactions