Skip to content

Commit

Permalink
add wasm binding for eth_getStorageAt
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaan7 committed Feb 13, 2025
1 parent b8acc3f commit efde667
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion helios-ts/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::str::FromStr;

use alloy::hex::FromHex;
use alloy::primitives::{Address, B256, U256};
use alloy::rpc::types::serde_helpers::JsonStorageKey;
use alloy::rpc::types::{Filter, TransactionRequest};
use eyre::Result;
use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -235,7 +236,7 @@ impl EthereumClient {
block: JsValue,
) -> Result<JsValue, JsError> {
let address: Address = serde_wasm_bindgen::from_value(address)?;
let slot: U256 = serde_wasm_bindgen::from_value(slot)?;
let slot: JsonStorageKey = serde_wasm_bindgen::from_value(slot)?;
let block: BlockTag = serde_wasm_bindgen::from_value(block)?;
let storage = map_err(self.inner.get_storage_at(address, slot, block).await)?;
Ok(serde_wasm_bindgen::to_value(&storage)?)
Expand Down
3 changes: 2 additions & 1 deletion helios-ts/src/opstack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extern crate web_sys;
use std::str::FromStr;

use alloy::primitives::{Address, B256, U256};
use alloy::rpc::types::serde_helpers::JsonStorageKey;
use alloy::rpc::types::Filter;
use wasm_bindgen::prelude::*;

Expand Down Expand Up @@ -183,7 +184,7 @@ impl OpStackClient {
block: JsValue,
) -> Result<JsValue, JsError> {
let address: Address = serde_wasm_bindgen::from_value(address)?;
let slot: U256 = serde_wasm_bindgen::from_value(slot)?;
let slot: JsonStorageKey = serde_wasm_bindgen::from_value(slot)?;
let block: BlockTag = serde_wasm_bindgen::from_value(block)?;
let storage = map_err(self.inner.get_storage_at(address, slot, block).await)?;
Ok(serde_wasm_bindgen::to_value(&storage)?)
Expand Down

0 comments on commit efde667

Please sign in to comment.