Closed zerosnacks closed 4 months ago
I had to do this today for Arbitrum receipts:
#[derive(Debug, Deserialize)]
struct ArbOtherFields {
#[serde(rename = "gasUsedForL1")]
gas_used_for_l1: U128,
}
// ...
let alice_wallet = ProviderBuilder::new()
.network::<AnyNetwork>()
.with_recommended_fillers()
.wallet(EthereumWallet::from(alice.signer.clone()))
.on_http(alice.url().parse()?);
// ...
let arb_fields: ArbOtherFields = receipt.other.deserialize_into()?;
let l1_gas = arb_fields.gas_used_for_l1.to::<u128>();
Let me know if it makes sense to convert this into an example.
Hey @alexfertel, that would be great!
This example is part of the advanced
examples, see: https://github.com/alloy-rs/examples/issues/87
Relevant in the context of
op-alloy
and the requested usecase of ZKSync's PaymasterRelated: https://t.me/ethers_rs/38142