From 3858108ab55a6e2574363dd626482edc035f2032 Mon Sep 17 00:00:00 2001 From: artemkolodko Date: Mon, 1 May 2023 17:35:50 +0100 Subject: [PATCH] Allow to fetch internal and logs --- src/api/client.ts | 58 ++++++++++++++--------------- src/pages/TransactionPage/index.tsx | 16 ++++---- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/api/client.ts b/src/api/client.ts index fc00dc2..0faadaf 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -72,35 +72,35 @@ export function getStakingTransactionByField(params: [number, "hash", string]) { export function getInternalTransactionsByField(params: any[], blockNumber?: string) { // fallback to rpc as we don't keep old records older than 34000000 any more in postgres - if (!blockNumber || +blockNumber < 34000000) { - const queryType = params[1] - if (queryType !== 'transaction_hash') { - console.error('use only transaction hash to get internal transactions') - return [] as InternalTransaction[] - } - - const txHash = params[2] - // - console.info('internal transactions is not available to serve') - return [] as InternalTransaction[] - // todo note check error field may not work properly - /* return eth_traceTransaction(txHash).then(txs => { - const mapTxs = txs.map((tx: any, i: number) => ({ - type: tx.action.type || tx.type, - value: tx.value, - input: tx.action.input, - output: tx.result.output, - transactionHash: tx.transactionHash, - gasUsed: tx.result.gasUsed, - index: i, - to: tx.action.to, - from: tx.action.from, - error: tx.result.error, - gas: tx.action.gas - })) - return mapTxs as InternalTransaction[] - }) */ - } + // if (!blockNumber || +blockNumber < 34000000) { + // const queryType = params[1] + // if (queryType !== 'transaction_hash') { + // console.error('use only transaction hash to get internal transactions') + // return [] as InternalTransaction[] + // } + // + // const txHash = params[2] + // // + // console.info('internal transactions is not available to serve') + // return [] as InternalTransaction[] + // // todo note check error field may not work properly + // /* return eth_traceTransaction(txHash).then(txs => { + // const mapTxs = txs.map((tx: any, i: number) => ({ + // type: tx.action.type || tx.type, + // value: tx.value, + // input: tx.action.input, + // output: tx.result.output, + // transactionHash: tx.transactionHash, + // gasUsed: tx.result.gasUsed, + // index: i, + // to: tx.action.to, + // from: tx.action.from, + // error: tx.result.error, + // gas: tx.action.gas + // })) + // return mapTxs as InternalTransaction[] + // }) */ + // } return transport("getInternalTransactionsByField", params) as Promise; } diff --git a/src/pages/TransactionPage/index.tsx b/src/pages/TransactionPage/index.tsx index e7ffbe6..2011cef 100644 --- a/src/pages/TransactionPage/index.tsx +++ b/src/pages/TransactionPage/index.tsx @@ -150,14 +150,14 @@ export const TransactionPage = () => { const contractShardID = process.env.REACT_APP_CONTRACT_SHARD ? (process.env.REACT_APP_CONTRACT_SHARD || 0) : 0 if (tx.hash && [0, contractShardID].includes(tx.shardID)) { - const SevenDaysBlock = 60 * 60 * 24 * 7 / 2 - const txDate = new Date(tx.timestamp).getTime() - const now = Date.now() - - if (now - txDate > SevenDaysBlock) { - console.log('no logs served') - return - } + // const SevenDaysBlock = 60 * 60 * 24 * 7 / 2 + // const txDate = new Date(tx.timestamp).getTime() + // const now = Date.now() + // + // if (now - txDate > SevenDaysBlock) { + // console.log('no logs served') + // return + // } try { //@ts-ignore