Skip to content

Commit

Permalink
fix(blockchain-link): do not fetch solana token account signatures fo…
Browse files Browse the repository at this point in the history
…r recipient address
  • Loading branch information
PeterBenc authored and tomasklim committed Oct 3, 2024
1 parent cf6ed62 commit 171c7d6
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions packages/blockchain-link/src/workers/solana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,21 @@ const getAccountInfo = async (request: Request<MessageTypes.GetAccountInfo>) =>

const allAccounts = [payload.descriptor, ...tokenAccounts.value.map(a => a.pubkey.toString())];

const allTxIds = Array.from(
new Set(
(await Promise.all(allAccounts.map(account => getAllSignatures(api, account))))
.flat()
.sort((a, b) => b.slot - a.slot)
.map(it => it.signature),
),
);
const allTxIds =
details === 'basic' || details === 'txs' || details === 'txids'
? Array.from(
new Set(
(
await Promise.all(
allAccounts.map(account => getAllSignatures(api, account)),
)
)
.flat()
.sort((a, b) => b.slot - a.slot)
.map(it => it.signature),
),
)
: [];

const pageNumber = payload.page ? payload.page - 1 : 0;
// for the first page of txs, payload.page is undefined, for the second page is 2
Expand Down

0 comments on commit 171c7d6

Please sign in to comment.