diff --git a/src/ethereum-canister/candid.did b/src/ethereum-canister/candid.did index 8bc44cd..2174192 100644 --- a/src/ethereum-canister/candid.did +++ b/src/ethereum-canister/candid.did @@ -14,10 +14,11 @@ type setup_request = record { type estimate_gas_request = record { from: opt address; - to: opt address; - gas: opt u256; + to: address; + gas_limit: opt u256; gas_price: opt u256; value: opt u256; + // Hash of the method signature and encoded parameters. See the Ethereum contract ABI specification. data: opt blob; }; diff --git a/src/ethereum-canister/src/utils.rs b/src/ethereum-canister/src/utils.rs index f91530c..2fb15ca 100644 --- a/src/ethereum-canister/src/utils.rs +++ b/src/ethereum-canister/src/utils.rs @@ -24,7 +24,7 @@ impl IntoCallOpts for EstimateGasRequest { fn into_call_opts(self) -> CallOpts { CallOpts { from: self.from.map(Into::into), - to: self.to.map(Into::into), + to: Some(self.to.into()), gas: self.gas_limit.map(Into::into), gas_price: self.gas_price.map(Into::into), value: self.value.map(Into::into), diff --git a/src/ethereum-canister/tests/canister.rs b/src/ethereum-canister/tests/canister.rs index 1dcd1e5..f213dca 100644 --- a/src/ethereum-canister/tests/canister.rs +++ b/src/ethereum-canister/tests/canister.rs @@ -33,13 +33,14 @@ fn estimate_gas() { .unwrap(), }; let request = EstimateGasRequest { - to: Some( - "0xdAC17F958D2ee523a2206206994597C13D831ec7" // usdt - .parse() - .unwrap(), - ), + from: None, + to: "0xdAC17F958D2ee523a2206206994597C13D831ec7" // usdt + .parse() + .unwrap(), + gas_limit: None, + gas_price: None, + value: None, data: Some(erc20_balance_of.encode()), - ..Default::default() }; let gas: (Nat,) = call!(canister, "estimate_gas", request).unwrap(); diff --git a/src/interface/src/lib.rs b/src/interface/src/lib.rs index bfafe59..cfdefa9 100644 --- a/src/interface/src/lib.rs +++ b/src/interface/src/lib.rs @@ -28,10 +28,10 @@ pub struct Erc721OwnerOfRequest { pub token_id: U256, } -#[derive(Debug, Clone, PartialEq, Eq, CandidType, Deserialize, Default)] +#[derive(Debug, Clone, PartialEq, Eq, CandidType, Deserialize)] pub struct EstimateGasRequest { pub from: Option
, - pub to: Option, + pub to: Address, pub gas_limit: Option