From 20ecd9d526daae1fbb9a96981e88d2d4d5e5e72f Mon Sep 17 00:00:00 2001 From: Vladimir Bugaev Date: Fri, 5 Jan 2024 00:10:24 +0700 Subject: [PATCH] fix empty parameters error --- evm_loader/lib/src/abi/mod.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/evm_loader/lib/src/abi/mod.rs b/evm_loader/lib/src/abi/mod.rs index dec16ad597..d16dc2f0fa 100644 --- a/evm_loader/lib/src/abi/mod.rs +++ b/evm_loader/lib/src/abi/mod.rs @@ -81,10 +81,14 @@ async fn load_config() -> Result { async fn dispatch(method_str: &str, params_str: &str) -> Result { let method: LibMethods = method_str.parse()?; let config = load_config().await?; - let RequestWithSlot { - slot, - tx_index_in_block, - } = serde_json::from_str(params_str).map_err(|_| params_to_neon_error(params_str))?; + let mut slot: Option = None; + let mut tx_index_in_block: Option = None; + if params_str != "" { + let RequestWithSlot { + slot, + tx_index_in_block, + } = serde_json::from_str(params_str).map_err(|_| params_to_neon_error(params_str))?; + } let rpc = build_rpc(&config, slot, tx_index_in_block).await?; let singer = build_signer(&config)?;