ic_web3_rs/types/proof.rs
1use crate::types::Bytes;
2use ethereum_types::{H256, U256};
3use serde::{Deserialize, Serialize};
4
5///Proof struct returned by eth_getProof method
6///
7/// https://eips.ethereum.org/EIPS/eip-1186
8#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)]
9pub struct Proof {
10 /// the balance of the account. See eth_getBalance
11 pub balance: U256,
12 /// hash of the code of the account
13 #[serde(rename = "codeHash")]
14 pub code_hash: H256,
15 /// nonce of the account. See eth_getTransactionCount
16 pub nonce: U256,
17 /// SHA3 of the StorageRoot.
18 #[serde(rename = "storageHash")]
19 pub storage_hash: H256,
20 /// Array of rlp-serialized MerkleTree-Nodes, starting with the stateRoot-Node, following the path of the SHA3 (address) as key.
21 #[serde(rename = "accountProof")]
22 pub account_proof: Vec<Bytes>,
23 /// Array of storage-entries as requested
24 #[serde(rename = "storageProof")]
25 pub storage_proof: Vec<StorageProof>,
26}
27
28/// A key-value pair and it's state proof.
29#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)]
30pub struct StorageProof {
31 /// the requested storage key
32 pub key: U256,
33 /// the storage value
34 pub value: U256,
35 /// Array of rlp-serialized MerkleTree-Nodes, starting with the storageHash-Node, following the path of the SHA3 (key) as path.
36 pub proof: Vec<Bytes>,
37}