From 71f9b21d21c9b033e34fc8c6d33ffd8223ffda73 Mon Sep 17 00:00:00 2001 From: tomasklim Date: Wed, 20 Nov 2024 12:58:02 +0100 Subject: [PATCH] feat(blockchain-link): detect nonempty account when using nonarchive rpc (cherry picked from commit ba1c0b85d2bb94e5559bccaf7d78b98e842835a5) --- packages/blockchain-link/src/workers/solana/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/blockchain-link/src/workers/solana/index.ts b/packages/blockchain-link/src/workers/solana/index.ts index f5af3c99202..902f4d6ab19 100644 --- a/packages/blockchain-link/src/workers/solana/index.ts +++ b/packages/blockchain-link/src/workers/solana/index.ts @@ -219,11 +219,14 @@ const getAccountInfo = async (request: Request) => // https://solana.stackexchange.com/a/13102 const rent = await api.getMinimumBalanceForRentExemption(accountInfo?.data.byteLength || 0); + // allTxIds can be empty for non-archive rpc nodes + const isAccountEmpty = !(allTxIds.length || balance || tokens.length); + const account: AccountInfo = { descriptor: payload.descriptor, balance: balance.toString(), availableBalance: balance.toString(), - empty: !allTxIds.length, + empty: isAccountEmpty, history: { total: allTxIds.length, unconfirmed: 0,