diff --git a/packages/indexer-common/src/allocations/__tests__/tap.test.ts b/packages/indexer-common/src/allocations/__tests__/tap.test.ts index cd2f4d93c..9ca8c7bb2 100644 --- a/packages/indexer-common/src/allocations/__tests__/tap.test.ts +++ b/packages/indexer-common/src/allocations/__tests__/tap.test.ts @@ -87,8 +87,6 @@ const rav = { ), senderAddress: SENDER_ADDRESS_1, redeemedAt: null, - createdAt: currentTimestamp, - updatedAt: currentTimestamp, } const SIGNATURE = Buffer.from( @@ -240,8 +238,6 @@ describe('TAP', () => { signature: SIGNATURE, senderAddress: SENDER_ADDRESS_3, redeemedAt: new Date(redeemDate), - createdAt: currentTimestamp, - updatedAt: currentTimestamp, } await queryFeeModels.receiptAggregateVouchers.create(rav2) const ravs = await receiptCollector['pendingRAVs']() @@ -277,8 +273,6 @@ describe('TAP', () => { signature: SIGNATURE, senderAddress: SENDER_ADDRESS_3, redeemedAt: new Date(redeemDate), - createdAt: currentTimestamp, - updatedAt: currentTimestamp, } await queryFeeModels.receiptAggregateVouchers.create(rav2) @@ -379,8 +373,6 @@ describe('TAP', () => { signature: SIGNATURE, senderAddress: SENDER_ADDRESS_3, redeemedAt: new Date(redeemDate), - createdAt: currentTimestamp, - updatedAt: currentTimestamp, } await queryFeeModels.receiptAggregateVouchers.create(rav2) let ravs = await receiptCollector['pendingRAVs']() @@ -390,9 +382,9 @@ describe('TAP', () => { where: { last: true, final: true }, }) //Final rav wont be returned here - expect(ravs).toEqual([rav]) + expect(ravs).toEqual([expect.objectContaining(rav)]) // Expect final rav to be returned here - expect(finalRavs).toEqual([{ ...rav2, final: true }]) + expect(finalRavs).toEqual([expect.objectContaining({ ...rav2, final: true })]) }, timeout, ) diff --git a/packages/indexer-common/src/allocations/query-fees.ts b/packages/indexer-common/src/allocations/query-fees.ts index 0fc9bf75b..ff0d84523 100644 --- a/packages/indexer-common/src/allocations/query-fees.ts +++ b/packages/indexer-common/src/allocations/query-fees.ts @@ -598,15 +598,14 @@ export class AllocationReceiptCollector implements ReceiptCollector { ): Promise { const tapSubgraphResponse = await this.findTransactionsForRavs(ravLastNotFinal) - const redeemedRavsNotOnOurDatabase = tapSubgraphResponse.transactions.filter((tx) => { - const ravNotInOurDb = !ravLastNotFinal.find( - (rav) => - toAddress(rav.senderAddress) === toAddress(tx.sender.id) && - toAddress(rav.allocationId) === toAddress(tx.allocationID), - ) - console.log("allocation: " + tx.allocationID + " sender: " + tx.sender.id + " not in db: " + ravNotInOurDb) - return ravNotInOurDb - }) + const redeemedRavsNotOnOurDatabase = tapSubgraphResponse.transactions.filter( + (tx) => + !ravLastNotFinal.find( + (rav) => + toAddress(rav.senderAddress) === toAddress(tx.sender.id) && + toAddress(rav.allocationId) === toAddress(tx.allocationID), + ), + ) // for each transaction that is not redeemed on our database // but was redeemed on the blockchain, update it to redeemed @@ -620,18 +619,17 @@ export class AllocationReceiptCollector implements ReceiptCollector { } } - console.log(tapSubgraphResponse.transactions) // Filter unfinalized RAVS fetched from DB, keeping RAVs that have not yet been redeemed on-chain const nonRedeemedRavs = ravLastNotFinal .filter((rav) => !!rav.redeemedAt) .filter( (rav) => - !tapSubgraphResponse.transactions.find((tx) => { - toAddress(rav.senderAddress) === toAddress(tx.sender.id) && - toAddress(rav.allocationId) === toAddress(tx.allocationID) - }), + !tapSubgraphResponse.transactions.find( + (tx) => + toAddress(rav.senderAddress) === toAddress(tx.sender.id) && + toAddress(rav.allocationId) === toAddress(tx.allocationID), + ), ) - console.log(nonRedeemedRavs) // we use the subgraph timestamp to make decisions // block timestamp minus 1 minute (because of blockchain timestamp uncertainty) @@ -721,7 +719,6 @@ export class AllocationReceiptCollector implements ReceiptCollector { AND timestamp_ns < ${blockTimestampNs} ` - console.log(query) await this.models.receiptAggregateVouchers.sequelize?.query(query) } @@ -736,7 +733,6 @@ export class AllocationReceiptCollector implements ReceiptCollector { AND redeemed_at < to_timestamp(${blockTimestampSecs - this.finalityTime}) ` - console.log(query) await this.models.receiptAggregateVouchers.sequelize?.query(query) } @@ -1122,6 +1118,7 @@ export class AllocationReceiptCollector implements ReceiptCollector { .toLowerCase() .replace('0x', '')}' ` + await this.models.receiptAggregateVouchers.sequelize?.query(query) }