From e8c2e3f08d1cddbe3fb47b12c6429fd6e9cb07fa Mon Sep 17 00:00:00 2001 From: Rodrigo Branas Date: Mon, 23 Sep 2024 14:38:15 -0300 Subject: [PATCH] considering only if have contractId and assetId --- packages/graphql/src/application/uc/NewAddBlockRange.ts | 6 +++++- packages/graphql/src/migrate-transactions.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/graphql/src/application/uc/NewAddBlockRange.ts b/packages/graphql/src/application/uc/NewAddBlockRange.ts index 195b5db9..8adb0637 100644 --- a/packages/graphql/src/application/uc/NewAddBlockRange.ts +++ b/packages/graphql/src/application/uc/NewAddBlockRange.ts @@ -67,7 +67,11 @@ export default class NewAddBlockRange { } if (transaction.data?.status?.receipts) { for (const receipt of transaction.data.status.receipts) { - if (receipt.receiptType === 'TRANSFER_OUT') { + if ( + receipt.receiptType === 'TRANSFER_OUT' && + receipt.assetId && + receipt.id + ) { queries.push({ statement: 'insert into indexer.assets_contracts (asset_id, contract_id) values ($1, $2) on conflict do nothing', diff --git a/packages/graphql/src/migrate-transactions.ts b/packages/graphql/src/migrate-transactions.ts index c172c36d..f117a907 100644 --- a/packages/graphql/src/migrate-transactions.ts +++ b/packages/graphql/src/migrate-transactions.ts @@ -23,7 +23,11 @@ async function migrate(from: number, to: number) { ); for (const transaction of transactions) { for (const receipt of transaction.data.status.receipts) { - if (receipt.receiptType === 'TRANSFER_OUT') { + if ( + receipt.receiptType === 'TRANSFER_OUT' && + receipt.assetId && + receipt.id + ) { await connection.query( 'insert into indexer.assets_contracts (asset_id, contract_id) values ($1, $2) on conflict do nothing', [receipt.assetId, receipt.id],