Skip to content

feat: tron v2 - #56

Open
hmalik88 wants to merge 31 commits into
mainfrom
hm/tron-v2
Open

feat: tron v2#56
hmalik88 wants to merge 31 commits into
mainfrom
hm/tron-v2

Conversation

@hmalik88

@hmalik88 hmalik88 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Explanation

Migrates the Tron wallet snap from the v1 Keyring interface to the v2 KeyringSnapRpc interface, matching the pattern already established in the Solana snap.

Changes:

  • Dependencies: Bumped keyring-api to ^23.7.0, keyring-snap-sdk to ^9.2.1, snaps-cli to ^8.4.1, and superstruct to ^3.4.1 to get v2 support and the sensitive() utility.

  • TypeScript config: Switched moduleResolution to bundler (and module to preserve) to support /v2 subpath imports like @metamask/keyring-api/v2 and @metamask/keyring-snap-sdk/v2.

  • Interface: KeyringHandler now implements KeyringSnapRpc instead of Keyring. Method renames: listAccountsgetAccounts, listAccountAssetsgetAccountAssets, listAccountTransactionsgetAccountTransactions. getAccount now throws instead of returning undefined. Removed v1-only stubs (filterAccountChains, updateAccount). The handle method now routes through handleKeyringRequest from keyring-snap-sdk/v2.

  • exportAccount: New method that derives the Tron keypair and returns the private key in hexadecimal format. Uses sensitive() from @metamask/superstruct to wrap the validation struct so any assertion failure redacts the key value from error messages and logs.

  • Permissions: Added all v2 KeyringSnapRpcMethod strings alongside the existing v1 KeyringRpcMethod strings (kept for backwards compatibility with callers on older versions). Added ExportAccount to MetaMask permissions.

  • Manifest: Added capabilities block to endowment:keyring declaring the tron:728126428 scope, hexadecimal private key export support, and BIP-44 derivation strategies.

References

N/A

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@socket-security

socket-security Bot commented Jul 28, 2026

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@hmalik88
hmalik88 marked this pull request as ready for review July 30, 2026 13:51
@hmalik88
hmalik88 requested review from a team as code owners July 30, 2026 13:51
@hmalik88
hmalik88 temporarily deployed to default-branch July 30, 2026 13:51 — with GitHub Actions Inactive
@hmalik88

Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/bitcoin-wallet-snap@1.15.2-preview-e04998fd
@metamask-previews/tron-wallet-snap@1.33.2-preview-e04998fd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants