From 3870598a0b3cba4ecc9ef8bfb3d30994aa453cd5 Mon Sep 17 00:00:00 2001 From: Yolley Date: Wed, 27 Mar 2024 16:42:17 +0900 Subject: [PATCH 1/2] fix claim when locked amount is 0 --- packages/distributor/solana/client.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/distributor/solana/client.ts b/packages/distributor/solana/client.ts index 60e6cf68..e643e9f1 100644 --- a/packages/distributor/solana/client.ts +++ b/packages/distributor/solana/client.ts @@ -180,7 +180,9 @@ export default class SolanaDistributorClient { ixs.push(newClaim(args, accounts, this.programId)); } - ixs.push(claimLocked(accounts, this.programId)); + if (data.amountLocked.gt(new BN("0"))) { + ixs.push(claimLocked(accounts, this.programId)); + } const { tx, hash } = await prepareTransaction(this.connection, ixs, invoker.publicKey); const signature = await wrappedSignAndExecuteTransaction(this.connection, invoker, tx, hash); From c487fe2a9fbdebcfebc48e14c7b72adf757cb317 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 27 Mar 2024 12:22:23 +0300 Subject: [PATCH 2/2] feat: use bn api with `n` suffix if an arg is number it is faster --- packages/distributor/solana/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/distributor/solana/client.ts b/packages/distributor/solana/client.ts index e643e9f1..f5ddd445 100644 --- a/packages/distributor/solana/client.ts +++ b/packages/distributor/solana/client.ts @@ -180,7 +180,7 @@ export default class SolanaDistributorClient { ixs.push(newClaim(args, accounts, this.programId)); } - if (data.amountLocked.gt(new BN("0"))) { + if (data.amountLocked.gtn(0)) { ixs.push(claimLocked(accounts, this.programId)); }