Function ethers_providers::call_raw::spoof::nonce
source · pub fn nonce(adr: H160, nonce: U64) -> State
Expand description
Returns a state override set with a single element setting the nonce of the address.
§Examples
ⓘ
let geth = Geth::new().spawn();
let provider = Provider::<Http>::try_from(geth.endpoint()).unwrap();
let adr: Address = "0x6fC21092DA55B392b045eD78F4732bff3C580e2c".parse()?;
let pay_amt = parse_ether(1u64)?;
let tx = TransactionRequest::default().from(adr).into();
// override the sender's nonce for the call
let state = spoof::nonce(adr, 72.into());
provider.call_raw(&tx).state(&state).await?;