Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Solana Token-2022 program #36699

Closed
yrliou opened this issue Mar 11, 2024 · 2 comments · Fixed by brave/brave-core#23945
Closed

Support Solana Token-2022 program #36699

yrliou opened this issue Mar 11, 2024 · 2 comments · Fixed by brave/brave-core#23945
Assignees
Labels
feature/web3/wallet/core feature/web3/wallet/solana feature/web3/wallet Integrating Ethereum+ wallet support OS/Android Fixes related to Android browser functionality OS/Desktop priority/P3 The next thing for us to work on. It'll ride the trains. QA Pass - Android ARM QA Pass-Win64 QA/Yes release-notes/include

Comments

@yrliou
Copy link
Member

yrliou commented Mar 11, 2024

https://spl.solana.com/token-2022

We need

  • Store token program info in BlockchainToken (token program or token-2022 program)
    • Update token-lists to provide token2022 boolean when "tags":["community","token-2022"] appears in fetched JupiterTokensList Set Solana token-2022 property token-lists#138
    • Update BlockchainToken mojo struct to have an optional SPLTokenProgram enum with either TokenProgram or TokenProgram2022 value.
    • Assign TokenProgram or TokenProgram2022 for SPL tokens during parsing tokens from registry
  • Get balance and transfer
    • SolanaKeyring::GetAssociatedTokenAccount needs to take SPLTokenProgram enum as a parameter to use the right token program ID.
    • Migrate from Transfer to TransferChecked because Transfer is deprecated.
    • During MakeTokenProgramTransferTxData, use the correct token program ID throughout the process.
  • Auto discovery(DiscoverSPLTokensFromRegistry) and GetSPLTokenBalances
    • Update GetSolanaTokenAccountsByOwner to also query token2022 program ID.

Obsolete items just for reference:
- Adding custom token manually
- When adding custom SPL tokens, in the backend we need to make a network call to fetch the program owner (token program or token program 2022) before adding it (store in BlockchainToken struct) if it's still unknown.
Just wait until balance fetching or transfer to update it.
- Migration on existing user assets (SPL tokens only), use network call to update their token program Retrieve account owner (which token program) when token is used.

@yrliou yrliou added priority/P3 The next thing for us to work on. It'll ride the trains. QA/Yes release-notes/include OS/Android Fixes related to Android browser functionality OS/Desktop feature/web3/wallet/solana labels Mar 11, 2024
@yrliou yrliou self-assigned this Mar 11, 2024
@brave-builds brave-builds added feature/web3/wallet Integrating Ethereum+ wallet support feature/web3/wallet/core labels Jun 5, 2024
@brave-builds brave-builds added this to the 1.68.x - Nightly milestone Jun 5, 2024
@srirambv
Copy link
Contributor

Verification passed on

Brave 1.68.88 Chromium: 126.0.6478.71 (Official Build) beta (64-bit)
Revision 70077e4ec26f79de0bac54bc09204be0a3e6cea6
OS Windows 11 Version 23H2 (Build 22631.3737)
  • Verified steps form brave/brave-core#23945
  • Verified Swaped token updates balance in Portfolio
  • Verified able to send token to a different account successfully
36699.mp4

@srirambv
Copy link
Contributor

srirambv commented Jul 1, 2024

Verification passed on Google Pixel 8 with Android 14 running 1.68.99 x64 Beta build

  • Verified steps form brave/brave-core#23945
  • Verified Swaped token updates balance in Portfolio
  • Verified able to send token to a different account successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/web3/wallet/core feature/web3/wallet/solana feature/web3/wallet Integrating Ethereum+ wallet support OS/Android Fixes related to Android browser functionality OS/Desktop priority/P3 The next thing for us to work on. It'll ride the trains. QA Pass - Android ARM QA Pass-Win64 QA/Yes release-notes/include
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants