Skip to content

Commit 3756fc5

Browse files
committed
fix: estimate-gas-api
1 parent 6f946fe commit 3756fc5

2 files changed

Lines changed: 7 additions & 18 deletions

File tree

src/did/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub mod bytes;
88
pub mod codec;
99
pub mod constant;
1010
pub mod error;
11+
pub mod gas;
1112
pub mod hash;
1213
pub mod ic;
1314
pub mod integer;
@@ -24,6 +25,7 @@ pub use block::Block;
2425
use candid::{CandidType, Deserialize};
2526
pub use error::{ExitFatal, HaltError};
2627
pub use fees::FeeHistory;
28+
pub use gas::*;
2729
pub use hash::{H160, H256, H64};
2830
pub use integer::{U256, U64};
2931
pub use mint_order_exemption::MintOrderExemptionUserData;

src/evm-canister-client/src/client.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use candid::Principal;
22
use did::block::{BlockResult, ExeResult};
33
use did::error::Result;
44
use did::{
5-
BasicAccount, Block, BlockNumber, Bytes, Transaction, TransactionReceipt, H160, H256, U256,
5+
BasicAccount, Block, BlockNumber, Bytes, EstimateGasRequest, Transaction, TransactionReceipt,
6+
H160, H256, U256,
67
};
78
use ic_canister_client::{CanisterClient, CanisterClientResult};
89

@@ -329,29 +330,15 @@ impl<C: CanisterClient> EvmCanisterClient<C> {
329330
///
330331
/// # Arguments
331332
///
332-
/// * `from` - The address of the caller
333-
/// * `to` - The address of the contract to call
334-
/// * `gas_limit` - The gas limit for the call
335-
/// * `value` - The value to send to the contract
336-
/// * `input` - The data to send to the contract
337-
///
333+
/// * `request` - The request to estimate the gas for the call
338334
/// # Returns
339335
///
340336
/// The estimated gas for the call
341337
pub async fn eth_estimate_gas(
342338
&self,
343-
from: H160,
344-
to: Option<H160>,
345-
gas_limit: u64,
346-
value: U256,
347-
input: Bytes,
339+
request: EstimateGasRequest,
348340
) -> CanisterClientResult<EvmResult<U256>> {
349-
self.client
350-
.query(
351-
"eth_estimate_gas",
352-
(from, to, gas_limit, value, gas_limit, input),
353-
)
354-
.await
341+
self.client.query("eth_estimate_gas", (request,)).await
355342
}
356343

357344
/// Get the transaction count at a given block hash

0 commit comments

Comments
 (0)