diff --git a/src/node/spot_meta.rs b/src/node/spot_meta.rs index 71b483550..e0c0a5915 100644 --- a/src/node/spot_meta.rs +++ b/src/node/spot_meta.rs @@ -37,25 +37,24 @@ impl SpotId { } } -async fn fetch_spot_meta(chain_id: u64) -> Result { +fn fetch_spot_meta(chain_id: u64) -> Result { let url = match chain_id { MAINNET_CHAIN_ID => "https://api.hyperliquid.xyz/info", TESTNET_CHAIN_ID => "https://api.hyperliquid-testnet.xyz/info", _ => return Err(Error::msg("unknown chain id")), }; - let client = reqwest::Client::new(); - let response = client - .post(url) - .json(&serde_json::json!({"type": "spotMeta"})) - .send() - .await?; - Ok(response.json().await?) + let response = ureq::post(url) + .header("Content-Type", "application/json") + .send(serde_json::json!({"type": "spotMeta"}).to_string())? + .into_body() + .read_to_string()?; + Ok(serde_json::from_str(&response)?) } -pub(crate) async fn erc20_contract_to_spot_token( +pub(crate) fn erc20_contract_to_spot_token( chain_id: u64, ) -> Result> { - let meta = fetch_spot_meta(chain_id).await?; + let meta = fetch_spot_meta(chain_id)?; let mut map = BTreeMap::new(); for token in &meta.tokens { if let Some(evm_contract) = &token.evm_contract { diff --git a/src/node/types/reth_compat.rs b/src/node/types/reth_compat.rs index b144435e0..e0302b9ad 100644 --- a/src/node/types/reth_compat.rs +++ b/src/node/types/reth_compat.rs @@ -104,14 +104,7 @@ fn system_tx_to_reth_transaction( to ); let rt = Handle::current(); - futures::executor::block_on(async { - rt.spawn(async move { - *EVM_MAP.lock().unwrap() = - erc20_contract_to_spot_token(chain_id).await.unwrap(); - }) - .await - .expect("failed to spawn"); - }); + *EVM_MAP.lock().unwrap() = erc20_contract_to_spot_token(chain_id).unwrap(); } }; let signature = Signature::new(U256::from(0x1), s, true);