From e7b3b9ac3eb570e99e387f80ff239b679b593b7e Mon Sep 17 00:00:00 2001 From: MHaris-Ferrum Date: Mon, 26 Aug 2024 13:19:48 +0500 Subject: [PATCH] transaction api updated for address queruy --- package-lock.json | 24 ++++++++++++------------ src/app.ts | 2 +- src/services/transaction.service.ts | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 09405eb..be9ccf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1260,9 +1260,9 @@ "integrity": "sha512-u5w79Rd7SU4JaIlA/zFqG+gOiuq25q5VLyZ8E+ijJeILuTxVzZgp2CaGw/UTw6pXYN9XMO9yiqj/nEHmhTG5CA==" }, "node_modules/axios": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", - "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.5.tgz", + "integrity": "sha512-fZu86yCo+svH3uqJ/yTdQ0QHpQu5oL+/QE+QPSv6BZSkDAoky9vytxp7u5qk83OJFS3kEBcesWni9WTZAv3tSw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -3324,9 +3324,9 @@ } }, "node_modules/mongoose": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz", - "integrity": "sha512-wLAP7xYz+tEnzy4VsZyMJ1mfaSIwfaeoSQ55ZVovFkdh1FVta6VNSVFCpJMzEinMJsRzTbZTcD4pND9J5aDiyA==", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.1.tgz", + "integrity": "sha512-c3MY8P1mGUGO+0H8rqxMNmAmhP0xb2EPNItfr7tHAHkh52uB0owH4Gu6q1GTUYj8yoHEDG5MN2V1aBBR6aJPuA==", "dependencies": { "bson": "^5.5.0", "kareem": "2.5.1", @@ -6126,9 +6126,9 @@ "integrity": "sha512-u5w79Rd7SU4JaIlA/zFqG+gOiuq25q5VLyZ8E+ijJeILuTxVzZgp2CaGw/UTw6pXYN9XMO9yiqj/nEHmhTG5CA==" }, "axios": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", - "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.5.tgz", + "integrity": "sha512-fZu86yCo+svH3uqJ/yTdQ0QHpQu5oL+/QE+QPSv6BZSkDAoky9vytxp7u5qk83OJFS3kEBcesWni9WTZAv3tSw==", "requires": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -7714,9 +7714,9 @@ } }, "mongoose": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz", - "integrity": "sha512-wLAP7xYz+tEnzy4VsZyMJ1mfaSIwfaeoSQ55ZVovFkdh1FVta6VNSVFCpJMzEinMJsRzTbZTcD4pND9J5aDiyA==", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.1.tgz", + "integrity": "sha512-c3MY8P1mGUGO+0H8rqxMNmAmhP0xb2EPNItfr7tHAHkh52uB0owH4Gu6q1GTUYj8yoHEDG5MN2V1aBBR6aJPuA==", "requires": { "bson": "^5.5.0", "kareem": "2.5.1", diff --git a/src/app.ts b/src/app.ts index 23b1ca1..75bc144 100644 --- a/src/app.ts +++ b/src/app.ts @@ -27,7 +27,7 @@ app.use(express.urlencoded({ extended: true })); app.use(cors()); app.options('*', cors()); -app.use(crons); +// app.use(crons); app.use('/v1/api', router); // send back a 404 error for any unknown api request diff --git a/src/services/transaction.service.ts b/src/services/transaction.service.ts index 5668029..ead8370 100644 --- a/src/services/transaction.service.ts +++ b/src/services/transaction.service.ts @@ -12,7 +12,7 @@ export const getTxs = async ( ): Promise => { const query: any = {}; if (address) { - query.$or = [{ sourceMsgSender: address }, { remoteContract: address }]; + query.$or = [{ from: address }, { to: address }]; } const docsPromise = QuantumPortalTransactionModel.find(query) .sort({ timestamp: -1 }) @@ -161,8 +161,8 @@ export const fetchRemoteTransactionWithMinedAndFinalizedTx = async ( const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL); // console.log('Fetching provider ', provider); let tx = await provider.getTransaction(txHash); - console.log('Found transaction,', tx); if (tx === null) { + console.log('Found transaction,', tx, tx === null); return new Error('Transaction not found'); } const block = await provider.getBlock(tx?.blockNumber);