From 5fc9479fb19135cb2e04e8c31137fcca76ebdeef Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Tue, 4 Aug 2026 05:48:33 +0200 Subject: [PATCH 1/4] fix: replace computed Network enum initialisers with string literals to fix bip44:discover --- packages/tron-wallet-snap/CHANGELOG.md | 4 ++++ packages/tron-wallet-snap/src/constants/index.ts | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/tron-wallet-snap/CHANGELOG.md b/packages/tron-wallet-snap/CHANGELOG.md index 2ac3dea2..eb840bb8 100644 --- a/packages/tron-wallet-snap/CHANGELOG.md +++ b/packages/tron-wallet-snap/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix `bip44:discover` always failing due to `Network` enum being compiled bidirectionally by TypeScript when initialised from another enum's members, causing `Object.values(Network)` to include human-readable names (`"Mainnet"` etc.) alongside scope IDs; replaced enum initialisers with string literals so TypeScript emits a one-way mapping. + ### Added - **BREAKING** Implement Keyring API v2 (`KeyringSnapRpc` interface): rename `listAccounts` → `getAccounts`, `listAccountAssets` → `getAccountAssets`, `listAccountTransactions` → `getAccountTransactions`; `getAccount` now throws instead of returning `undefined`; add `exportAccount` with hexadecimal private key export using `sensitive()` for redaction; remove v1-only methods `createAccount`, `discoverAccounts`, `filterAccountChains`, and `updateAccount`. ([#56](https://github.com/MetaMask/internal-snaps/pull/56)) diff --git a/packages/tron-wallet-snap/src/constants/index.ts b/packages/tron-wallet-snap/src/constants/index.ts index 7dbb15d0..9efe87a6 100644 --- a/packages/tron-wallet-snap/src/constants/index.ts +++ b/packages/tron-wallet-snap/src/constants/index.ts @@ -1,4 +1,3 @@ -import { TrxScope } from '@metamask/keyring-api'; import { BigNumber } from 'bignumber.js'; export const ZERO = BigNumber(0); @@ -33,9 +32,9 @@ export const TRACK_TX_INTERVAL = 'PT3S'; export const TRACK_TX_MAX_ATTEMPTS = 5; export enum Network { - Mainnet = TrxScope.Mainnet, - Nile = TrxScope.Nile, - Shasta = TrxScope.Shasta, + Mainnet = 'tron:728126428', + Nile = 'tron:3448148188', + Shasta = 'tron:2494104990', } export enum KnownCaip19Id { From 5d2b17a42ddae9ed8937c9d5a5a3b7d72e332f95 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Tue, 4 Aug 2026 05:55:01 +0200 Subject: [PATCH 2/4] chore: update changelog entry --- packages/tron-wallet-snap/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tron-wallet-snap/CHANGELOG.md b/packages/tron-wallet-snap/CHANGELOG.md index eb840bb8..95a6130b 100644 --- a/packages/tron-wallet-snap/CHANGELOG.md +++ b/packages/tron-wallet-snap/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fix `bip44:discover` always failing due to `Network` enum being compiled bidirectionally by TypeScript when initialised from another enum's members, causing `Object.values(Network)` to include human-readable names (`"Mainnet"` etc.) alongside scope IDs; replaced enum initialisers with string literals so TypeScript emits a one-way mapping. +- Fix `bip44:discover` always failing due to `Network` enum being compiled bidirectionally by TypeScript when initialised from another enum's members, causing `Object.values(Network)` to include human-readable names (`"Mainnet"` etc.) alongside scope IDs; replaced enum initialisers with string literals so TypeScript emits a one-way mapping. ([#101](https://github.com/MetaMask/internal-snaps/pull/101)) ### Added From ef25e6bae64db8ac3905dac3f2f7a0f99f2cc268 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Tue, 4 Aug 2026 05:58:42 +0200 Subject: [PATCH 3/4] fix: changelog --- packages/tron-wallet-snap/CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/tron-wallet-snap/CHANGELOG.md b/packages/tron-wallet-snap/CHANGELOG.md index 95a6130b..6b3e76de 100644 --- a/packages/tron-wallet-snap/CHANGELOG.md +++ b/packages/tron-wallet-snap/CHANGELOG.md @@ -7,16 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Fixed - -- Fix `bip44:discover` always failing due to `Network` enum being compiled bidirectionally by TypeScript when initialised from another enum's members, causing `Object.values(Network)` to include human-readable names (`"Mainnet"` etc.) alongside scope IDs; replaced enum initialisers with string literals so TypeScript emits a one-way mapping. ([#101](https://github.com/MetaMask/internal-snaps/pull/101)) - ### Added - **BREAKING** Implement Keyring API v2 (`KeyringSnapRpc` interface): rename `listAccounts` → `getAccounts`, `listAccountAssets` → `getAccountAssets`, `listAccountTransactions` → `getAccountTransactions`; `getAccount` now throws instead of returning `undefined`; add `exportAccount` with hexadecimal private key export using `sensitive()` for redaction; remove v1-only methods `createAccount`, `discoverAccounts`, `filterAccountChains`, and `updateAccount`. ([#56](https://github.com/MetaMask/internal-snaps/pull/56)) - Add `bip44:discover` support to `createAccounts`: checks on-chain activity across all Tron networks before persisting; returns `[]` if no activity to signal end-of-discovery to the client. ([#56](https://github.com/MetaMask/internal-snaps/pull/56)) - Add `endowment:keyring` capabilities to manifest declaring the `tron:728126428` scope, hexadecimal private key export, and BIP-44 derivation strategies. ([#56](https://github.com/MetaMask/internal-snaps/pull/56)) +### Fixed + +- Fix `bip44:discover` always failing due to `Network` enum being compiled bidirectionally by TypeScript when initialised from another enum's members, causing `Object.values(Network)` to include human-readable names (`"Mainnet"` etc.) alongside scope IDs; replaced enum initialisers with string literals so TypeScript emits a one-way mapping. ([#101](https://github.com/MetaMask/internal-snaps/pull/101)) + ## [2.0.0] ### Changed From f24e2ee247d78622e1591d5e8240bb56dd59f115 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Tue, 4 Aug 2026 05:59:25 +0200 Subject: [PATCH 4/4] fix: tron shasum --- packages/tron-wallet-snap/snap.manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tron-wallet-snap/snap.manifest.json b/packages/tron-wallet-snap/snap.manifest.json index 0d4dc259..470b80d4 100644 --- a/packages/tron-wallet-snap/snap.manifest.json +++ b/packages/tron-wallet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/internal-snaps.git" }, "source": { - "shasum": "AzSGXXOl7hLkleKs2n45byefpbqom1y+l1ik4ucTd4Y=", + "shasum": "kpXPl/gHuE6MQIAy2ZxMvI3XByIC/Gj7xss6WPFWCe4=", "location": { "npm": { "filePath": "dist/bundle.js",