[BCN] Handle missing Solana token ATA in txhistory#4173
Open
msalcala11 wants to merge 1 commit into
Open
Conversation
80ab6fd to
03b5dc1
Compare
7d469b0 to
18e0943
Compare
18e0943 to
d634fea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a BitPay app txhistory failure observed with zero-balance Solana token wallets.
Zero-balance Solana token wallets can still have transaction history. A user may have received or sent a token before, then sent the balance back to zero or closed the associated token account. In that state, the wallet should still be able to show historical activity.
Observed failure mode: When the app fetched txhistory for one of these token wallets, BWS returned a plain-text
Error getting ATA addressresponse instead of an empty or historical transaction list.Root cause: BWS forwards
/v1/txhistory/requests withtokenAddressto bitcore-node wallet transaction streaming. In the Solana token path, bitcore-node resolves the wallet address's associated token account before listing signatures. If there is no currently initialized ATA,getConfirmedAtathrows and the stream fails.The fix: This change keeps
getConfirmedAtaas the first lookup, so invalid mints and other non-missing-ATA failures keep their existing behavior. For the missing or uninitialized ATA case, it derives the deterministic ATA address and uses it to find any prior token-account activity. If prior activity exists, txhistory returns the corresponding transaction history even if the ATA was later closed.Changelog
SOL + tokenAddress + missing current ATA.Testing Notes
From
packages/bitcore-node, run: