-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show token balance changes on a simulated transaction (#286)
Currently, the simulation only shows whether or not the transaction succeeds and the logs. It would be very useful for this to include token balance changes since the token program doesnt log the accounts or amounts. This should bring the displayed information of a simulation up to parity with what the explorer does for completed transactions. The difficult part of this is that the simulateTransaction RPC spec does not include the pre/post token balances similar to asking for a completed transaction. To address this, we request the accountData for all accounts immediately before simulating and record the values of all token accounts. Then the simulateTransaction allows optional arguments for accounts to get their post simulation data. Parse that to get the post transaction token balance. Then convert it to the same format that the existing token balances component from the transaction page. Example with token balances (before, the simulate was the same thing without the token changes component): ![image](https://github.com/solana-labs/explorer/assets/1320260/f53a2c60-a287-4839-9038-1431c68cb9cd) --------- Co-authored-by: Callum McIntyre <[email protected]>
- Loading branch information
1 parent
4b26de2
commit b91b274
Showing
5 changed files
with
184 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
b91b274
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
explorer – ./
explorer.solana.com
explorer-solana-labs.vercel.app
explorer-git-master-solana-labs.vercel.app