diff --git a/backend/api/src/db/transaction.ts b/backend/api/src/db/transaction.ts index 414ca370..06311148 100644 --- a/backend/api/src/db/transaction.ts +++ b/backend/api/src/db/transaction.ts @@ -34,19 +34,16 @@ const chain = Chain(HASURA_URL, { */ export const insertTxn = async ({ clientId, - blockTime, + time, amount, fee, from, to, - postBalances, - preBalances, - recentBlockhash, - signature, + blockHash, + hash, network, slot, cluster, - nonce, chainId, }: InsertTxnType): Promise<{ status: dbResStatus; @@ -58,19 +55,15 @@ export const insertTxn = async ({ { object: { clientId, - signature, network, + hash, slot, amount, - blockTime, fee, from, to, - preBalances, - postBalances, - recentBlockhash, + blockHash, cluster, - nonce, chainId, }, }, @@ -120,22 +113,18 @@ export const getTxns = async ({ }, { id: true, - //@ts-ignore - signature: true, + hash: true, amount: true, - blockTime: true, + time: true, clientId: true, fee: true, - time: true, from: true, network: true, - //@ts-ignore - postBalances: true, - //@ts-ignore - preBalances: true, - recentBlockhash: true, + blockHash: true, slot: true, to: true, + cluster: true, + status: true }, ], }, @@ -160,7 +149,7 @@ export const getTxns = async ({ */ export const getTxnByHash = async ({ network, - sign, + hash, clientId, }: TxnQuerySignType): Promise<{ status: dbResStatus; @@ -172,29 +161,25 @@ export const getTxnByHash = async ({ transactions: [ { where: { - signature: { _contains: sign }, + hash: { _eq: hash }, clientId: { _eq: clientId }, network: { _eq: network }, }, }, { id: true, - //@ts-ignore - signature: true, amount: true, - blockTime: true, + time: true, clientId: true, fee: true, - time: true, from: true, network: true, - //@ts-ignore - postBalances: true, - //@ts-ignore - preBalances: true, - recentBlockhash: true, + blockHash: true, slot: true, to: true, + hash: true, + cluster: true, + status: true }, ], }, @@ -236,23 +221,18 @@ export const getAllTxn = async ({ }, { id: true, - //@ts-ignore - signature: true, + hash: true, amount: true, - blockTime: true, + time: true, clientId: true, fee: true, - time: true, from: true, network: true, - //@ts-ignore - postBalances: true, - //@ts-ignore - preBalances: true, - recentBlockhash: true, + blockHash: true, slot: true, to: true, cluster: true, + status: true }, ], }, diff --git a/backend/api/src/routes/transaction.ts b/backend/api/src/routes/transaction.ts index f7c4c4e0..3bc930fe 100644 --- a/backend/api/src/routes/transaction.ts +++ b/backend/api/src/routes/transaction.ts @@ -128,16 +128,16 @@ txnRouter.get("/get", async (req, res) => { //@ts-ignore const id = req.id as string; if (id) { - let { network, sign } = TxnQeuryByHash.parse(req.query); + let { network, hash } = TxnQeuryByHash.parse(req.query); /** * Cache */ - const isTxn = await cache.txn.cacheGetTxnBySign(sign); + const isTxn = await cache.txn.cacheGetTxnBySign(hash); if (isTxn) { return res.status(302).json({ txn: isTxn, status: responseStatus.Ok }); } //Db query - const txn = await getTxnByHash({ network, sign, clientId: id }); + const txn = await getTxnByHash({ network, hash, clientId: id }); if (txn.status == dbResStatus.Error) { return res .status(503)