From 5b7f638caf7258ab3a46410f1bfc4793058537d0 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Tue, 29 Oct 2024 14:34:08 +0530 Subject: [PATCH] Add check for amount to be returned --- packages/backend/src/registry.ts | 4 +++- packages/backend/src/service.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/registry.ts b/packages/backend/src/registry.ts index 03ef08aa..43d9c988 100644 --- a/packages/backend/src/registry.ts +++ b/packages/backend/src/registry.ts @@ -324,7 +324,9 @@ export class Registry { paymentAddress: auctionWinner, }); - const newRecords = records.filter(record => record.names !== null); + const newRecords = records.filter(record => { + return record.names !== null && record.names.length > 0; + }); for (const record of newRecords) { if (record.id) { diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index 98f19476..b142ad67 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -1391,10 +1391,12 @@ export class Service { amountToBeReturned = totalAuctionPrice; } - await this.laconicRegistry.sendTokensToAccount( - project.paymentAddress, - amountToBeReturned.toString() - ); + if (amountToBeReturned !== 0) { + await this.laconicRegistry.sendTokensToAccount( + project.paymentAddress, + amountToBeReturned.toString() + ); + } } async getDeployers(): Promise {