diff --git a/bindings/wasm/src/rpc_client.rs b/bindings/wasm/src/rpc_client.rs index ab069c35..2e08a5e5 100644 --- a/bindings/wasm/src/rpc_client.rs +++ b/bindings/wasm/src/rpc_client.rs @@ -322,4 +322,20 @@ impl RpcClient { let _ = builder.insert(client_offset); rpc_request!("getWebSocketEvents", builder, &self.server_url, bool) } + + #[wasm_bindgen(js_name=getWithdrawStatus)] + pub async fn get_withdraw_status(&self, hashes: Vec) -> Result { + let hashes: Result, RpcError> = hashes + .iter() + .map(|hash| TxHash::from_hex(&hash).map_err(|_e| RpcError::InvalidInputParameter)) + .collect(); + let mut builder = ArrayParams::new(); + let _ = builder.insert(hashes?); + rpc_request!( + "getWithdrawStatus", + builder, + &self.server_url, + Vec + ) + } } diff --git a/provider/src/response.rs b/provider/src/response.rs index 25d9aa55..9d1a0848 100644 --- a/provider/src/response.rs +++ b/provider/src/response.rs @@ -483,6 +483,17 @@ pub struct TokenInfo { pub fast_withdraw: bool, } +#[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(rename_all = "camelCase")] +pub struct StoredWithdrawalResp { + pub l2_tx_hash: TxHash, + pub l1_tx_hash: Option, + pub executed: bool, + pub success: bool, + pub block_number: BlockNumber, + pub block_index: i32, +} + #[cfg(test)] mod test { use super::*; diff --git a/provider/src/rpc.rs b/provider/src/rpc.rs index 621b1382..59dc56ca 100644 --- a/provider/src/rpc.rs +++ b/provider/src/rpc.rs @@ -125,4 +125,10 @@ pub trait ZkLinkRpc { tx: ZkLinkTx, l1_signature: Option, ) -> RpcResult; + + #[method(name = "getWithdrawStatus")] + async fn get_withdraw_status( + &self, + hashes: Vec, + ) -> RpcResult>; }