wevm / viem

TypeScript Interface for Ethereum
https://viem.sh
Other
2.51k stars 797 forks source link

使用viem+wagmi,获取手续费,发起参数不全,导致不准确 #2507

Closed gxtgh closed 3 months ago

gxtgh commented 3 months ago

Check existing issues

Viem Version

2.17.5

Current Behavior

import { createPublicClient } from 'viem' import { http } from 'wagmi';

let writeParam = { abi: VOTE_POOL_ABI, account: ‘0xdDbdaEb812E6090961bb87f983368502FCD902D3’, address: ‘0x7F5418C0BB00d4CfB1c7C628B75A991d64A7fad2’, functionName: 'addMargin', value: ’0x4563918244f40000‘ } const pulicCLient = createPublicClient({ chain: chain, transport: http() }) const gasLimit = await pulicCLient.estimateGas(writeParam);

发起estimateGas请求时,没有携带data和to参数,导致获取的gas不准确 {"jsonrpc":"2.0","id":7,"method":"eth_estimateGas","params":[{"from":"0xdDbdaEb812E6090961bb87f983368502FCD902D3","value":"0x4563918244f40000"}]}

Expected Behavior

{"jsonrpc":"2.0","id":7,"method":"eth_estimateGas","params":[{"from":"0xdDbdaEb812E6090961bb87f983368502FCD902D3","value":"0x4563918244f40000",to:"0x7F5418C0BB00d4CfB1c7C628B75A991d64A7fad2",data:"0x483a00e8"}]}

Steps To Reproduce

No response

Link to Minimal Reproducible Example

No response

Anything else?

No response

github-actions[bot] commented 3 months ago

Hello @gxtgh.

Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository.

Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster.

Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue.

github-actions[bot] commented 2 months ago

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.