Skip to content

Commit

Permalink
Add value to EstimateGas request (#121)
Browse files Browse the repository at this point in the history
Add value when get contract call gas limit
  • Loading branch information
xiangliu-cb authored Apr 16, 2024
1 parent b33f1b5 commit e601273
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 159 deletions.
8 changes: 5 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,14 +837,16 @@ func (ec *SDKClient) GetContractCallGasLimit(
ctx context.Context,
toAddress string,
fromAddress string,
value *big.Int,
data []byte,
) (uint64, error) {
// ToAddress for contract address is the contract address
contractAddress := common.HexToAddress(toAddress)
gasLimit, err := ec.EstimateGas(ctx, goEthereum.CallMsg{
From: common.HexToAddress(fromAddress),
To: &contractAddress,
Data: data,
From: common.HexToAddress(fromAddress),
To: &contractAddress,
Value: value,
Data: data,
})
if err != nil {
return 0, err
Expand Down
21 changes: 2 additions & 19 deletions mocks/client/graph_ql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions mocks/client/jsonrpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e601273

Please sign in to comment.