We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
estimateContractGas
2.21.24
Calling estimateContractGas on linea chain results in an infinite loop
This method is expected to end in a finite amount of time and return the estimated contract gas
Reproduction code:
import { createPublicClient, http } from 'viem' import { linea } from 'viem/chains' import { toAccount } from 'viem/accounts'; const WETHABI = [ { constant: true, inputs: [{ name: '', type: 'address' }], name: 'balanceOf', outputs: [{ name: '', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function', }, { constant: false, inputs: [{ name: 'wad', type: 'uint256' }], name: 'withdraw', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function', }, ] as const; const publicClient = createPublicClient({ chain: linea, transport: http(undefined, { onFetchRequest: async request => { const content = await request.clone().text(); console.log({ msg: 'rpc.http: request', data: content }); }, onFetchResponse: async response => { const content = await response.clone().text(); console.log({ msg: 'rpc.http: response', data: content }); }, }) }); const main = async () => { const account = toAccount({ address: '0x03d9964f4D93a24B58c0Fc3a8Df3474b59Ba8557', signMessage: async (message) => { throw new Error('signMessage not implemented'); }, signTransaction: async (transaction) => { throw new Error('signTransaction not implemented'); }, signTypedData: async (typedData) => { throw new Error('signTypedData not implemented'); } }); const wnative = "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"; const balance = await publicClient.readContract({ abi: WETHABI, address: wnative, functionName: 'balanceOf', args: [account.address], }); // this call loops for some reason const rawGasEstimation = await publicClient.estimateContractGas({ abi: WETHABI, address: wnative, functionName: 'withdraw', args: [balance], account: account, }); console.log(rawGasEstimation); } main()
https://stackblitz.com/edit/viem-getting-started-uc1w5e
No response
The text was updated successfully, but these errors were encountered:
can i take on this ?
Sorry, something went wrong.
No branches or pull requests
Check existing issues
Viem Version
2.21.24
Current Behavior
Calling
estimateContractGas
on linea chain results in an infinite loopExpected Behavior
This method is expected to end in a finite amount of time and return the estimated contract gas
Steps To Reproduce
Reproduction code:
Link to Minimal Reproducible Example
https://stackblitz.com/edit/viem-getting-started-uc1w5e
Anything else?
No response
The text was updated successfully, but these errors were encountered: