From 7b6b6784a5b6442b6f37c1f041a8e6b7163cf123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=89=9B=E5=95=A4?= Date: Mon, 8 Apr 2024 09:55:05 +0800 Subject: [PATCH] Fix: get tx by hash. (#254) --- explorer/src/service/v1/transaction.rs | 3 ++- explorer/src/service/v2/transaction.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/explorer/src/service/v1/transaction.rs b/explorer/src/service/v1/transaction.rs index af1a6ad..7609b36 100644 --- a/explorer/src/service/v1/transaction.rs +++ b/explorer/src/service/v1/transaction.rs @@ -1346,8 +1346,9 @@ struct Output { pub asset_type: Value, pub public_key: Value, } + #[allow(dead_code)] -fn wrap_evm_tx(tx: &mut TransactionResponse) -> Result<()> { +pub fn wrap_evm_tx(tx: &mut TransactionResponse) -> Result<()> { let tx_str: String = serde_json::to_string(&tx.value).unwrap(); if tx.ty == EVM_TRANSFER { diff --git a/explorer/src/service/v2/transaction.rs b/explorer/src/service/v2/transaction.rs index da58a95..e32cf0b 100644 --- a/explorer/src/service/v2/transaction.rs +++ b/explorer/src/service/v2/transaction.rs @@ -114,7 +114,7 @@ pub async fn get_tx_by_hash( ) -> Result> { let mut conn = state.pool.acquire().await.map_err(internal_error)?; - let sql_query = r#"SELECT tx_hash,block_hash,height,timestamp,ty_sub,code,log,origin,result,value + let sql_query = r#"SELECT tx_hash,block_hash,height,timestamp,ty,code,log,origin,result,value FROM transaction WHERE tx_hash=$1"#; let row = sqlx::query(sql_query)