feat: tron v2 - #56
Open
hmalik88 wants to merge 31 commits into
Open
Conversation
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
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.
Explanation
Migrates the Tron wallet snap from the v1
Keyringinterface to the v2KeyringSnapRpcinterface, matching the pattern already established in the Solana snap.Changes:
Dependencies: Bumped
keyring-apito^23.7.0,keyring-snap-sdkto^9.2.1,snaps-clito^8.4.1, andsuperstructto^3.4.1to get v2 support and thesensitive()utility.TypeScript config: Switched
moduleResolutiontobundler(andmoduletopreserve) to support/v2subpath imports like@metamask/keyring-api/v2and@metamask/keyring-snap-sdk/v2.Interface:
KeyringHandlernow implementsKeyringSnapRpcinstead ofKeyring. Method renames:listAccounts→getAccounts,listAccountAssets→getAccountAssets,listAccountTransactions→getAccountTransactions.getAccountnow throws instead of returningundefined. Removed v1-only stubs (filterAccountChains,updateAccount). Thehandlemethod now routes throughhandleKeyringRequestfromkeyring-snap-sdk/v2.exportAccount: New method that derives the Tron keypair and returns the private key in hexadecimal format. Usessensitive()from@metamask/superstructto wrap the validation struct so any assertion failure redacts the key value from error messages and logs.Permissions: Added all v2
KeyringSnapRpcMethodstrings alongside the existing v1KeyringRpcMethodstrings (kept for backwards compatibility with callers on older versions). AddedExportAccountto MetaMask permissions.Manifest: Added
capabilitiesblock toendowment:keyringdeclaring thetron:728126428scope, hexadecimal private key export support, and BIP-44 derivation strategies.References
N/A
Checklist