Skip to content

Commit

Permalink
feat(blockchain-link): detect nonempty account when using nonarchive rpc
Browse files Browse the repository at this point in the history
(cherry picked from commit ba1c0b8)
  • Loading branch information
tomasklim authored and MiroslavProchazka committed Nov 22, 2024
1 parent 31920b2 commit 71f9b21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/blockchain-link/src/workers/solana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,14 @@ const getAccountInfo = async (request: Request<MessageTypes.GetAccountInfo>) =>
// 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,
Expand Down

0 comments on commit 71f9b21

Please sign in to comment.