Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
247 commits
Select commit Hold shift + click to select a range
a45cff3
feat: initial commit
ulissesferreira Jul 15, 2025
105bd3a
feat: add test dApp
ulissesferreira Jul 15, 2025
3486923
feat: add test dApp
ulissesferreira Jul 21, 2025
066533f
chore: lint all files
ulissesferreira Jul 21, 2025
c772ce3
chore: more improvements to the test dApp
ulissesferreira Jul 22, 2025
695b053
Merge pull request #3 from MetaMask/chore/developer-experience-improv…
ulissesferreira Jul 22, 2025
1283866
chore: resolve linting problems
ulissesferreira Jul 23, 2025
a07a08c
feat: implement account derivation
ulissesferreira Jul 24, 2025
97b84ed
Merge pull request #7 from MetaMask/nwnt-413-implement-account-deriva…
ulissesferreira Jul 25, 2025
489912c
feat: refactor accounts service
aganglada Jul 26, 2025
57b366a
Merge pull request #10 from MetaMask/feat/accounts
ulissesferreira Jul 26, 2025
30a6e91
chore: mock assets
aganglada Jul 25, 2025
3675b67
feat: list trx and trc10 assets
aganglada Jul 30, 2025
6b70e60
fix: comments
aganglada Jul 31, 2025
86ab7d2
feat: TRX and TRC10 assets
aganglada Jul 31, 2025
ca8b3ab
feat: TRX and TRC10 assets
aganglada Jul 31, 2025
23a280e
feat: fully support TRX + token assets balances
ulissesferreira Aug 26, 2025
583e6f9
chore: lint fix
zone-live Sep 2, 2025
27d1c85
Merge pull request #12 from MetaMask/feat/assets
ulissesferreira Sep 3, 2025
621b1d3
1.0.0
invalid-email-address Sep 3, 2025
df4efd5
chore: update changelogs
zone-live Sep 3, 2025
40bb275
chore: prettier
zone-live Sep 3, 2025
d5c6b7e
1.0.1
invalid-email-address Sep 4, 2025
2c83542
chore: update snap version
invalid-email-address Sep 4, 2025
35baa81
chore: changelog update
zone-live Sep 4, 2025
8e68b9e
Merge pull request #18 from MetaMask/release/1.0.1
zone-live Sep 4, 2025
6f6eb2b
1.0.2 (#20)
github-actions[bot] Sep 5, 2025
866dce5
chore: clean up old values (#22)
zone-live Sep 5, 2025
8f83e5f
1.0.3 (#23)
github-actions[bot] Sep 5, 2025
cebe70c
Better placement for some methods (#24)
ulissesferreira Sep 5, 2025
ef0962f
feat: transaction history (#19)
ulissesferreira Sep 12, 2025
ab1b2da
feat: support Energy and Bandwidth as transaction history fee (#25)
ulissesferreira Sep 15, 2025
4302dce
chore: simplify `calculateTronFees` + feat: implement `discoverAccoun…
ulissesferreira Sep 18, 2025
367909b
feat: send Energy and Bandwidth as assets (#27)
ulissesferreira Sep 18, 2025
63434bc
feat: send staked TRX as assets (#29)
ulissesferreira Sep 22, 2025
44f2672
feat: implement "Unified Non-EVM Send" spec (#28)
ulissesferreira Sep 25, 2025
ec30cfe
1.1.0 (#30)
github-actions[bot] Sep 25, 2025
180e239
feat: fetch token metadata from Token API instead of Trongrid (#31)
ulissesferreira Sep 30, 2025
9a18ea3
fix: price and market data request failures (#32)
ulissesferreira Sep 30, 2025
ca39b9e
1.1.1 (#33)
github-actions[bot] Sep 30, 2025
8b4ca7d
feat: `signAndSendTransaction` client request (#34)
aganglada Oct 1, 2025
2af9eb8
1.2.0 (#36)
github-actions[bot] Oct 1, 2025
50a626e
feat: implement `computeFee` handler (#40)
ulissesferreira Oct 9, 2025
0ca445d
chore: add new required fields to KeyringAccount objects (#41)
ulissesferreira Oct 9, 2025
c42d520
feat: implement account synchronization when transactions happen (#38)
ulissesferreira Oct 10, 2025
d0139c5
fix: missing sync transactions background event (#44)
ulissesferreira Oct 10, 2025
5c74f2d
1.4.0 (#45)
github-actions[bot] Oct 10, 2025
227b4bf
Revert "1.4.0 (#45)" (#47)
ulissesferreira Oct 13, 2025
c5ec93b
1.3.0 (#48)
github-actions[bot] Oct 13, 2025
8cc791c
feat: send maximum Bandwidth and Energy as assets (#42)
ulissesferreira Oct 13, 2025
9601ab8
chore: edit names and balance decimals (#49)
zone-live Oct 15, 2025
3d04b66
1.4.0 (#50)
github-actions[bot] Oct 16, 2025
917c6d5
feat: implement staking and unstaking handlers (#46)
ulissesferreira Oct 16, 2025
5e8dc7c
chore: implement safe error handling so that the Snap never crashes (…
ulissesferreira Oct 16, 2025
8752c81
fix: match the new Keyring `createAccount` spec (#52)
ulissesferreira Oct 17, 2025
297e6fb
1.5.0 (#53)
github-actions[bot] Oct 17, 2025
e1e1b18
fix: modify `signAndSendTransaction` to properly handle base64 transa…
ulissesferreira Oct 21, 2025
ca3c647
chore: update max bandwidth and energy values (#55)
zone-live Oct 21, 2025
55ef941
1.5.1 (#56)
github-actions[bot] Oct 21, 2025
fcd61de
fix: missing fields on `signAndSendTransaction`'s payload for Tron (#57)
ulissesferreira Oct 24, 2025
873e676
1.5.2 (#58)
github-actions[bot] Oct 24, 2025
b90fbc2
fix: make field `visible` configurable by caller on the `signAndSendT…
ulissesferreira Oct 24, 2025
0953a8b
1.5.3 (#60)
github-actions[bot] Oct 24, 2025
b0aada4
fix: use correct hex private key for `signAndSendTransaction` (#61)
ulissesferreira Oct 28, 2025
8e44079
1.5.4 (#62)
github-actions[bot] Oct 28, 2025
5738630
feat: implement `setSelectedAccounts` handler (#63)
ulissesferreira Oct 31, 2025
9708593
fix: adjust `timestamp` fields' precision in seconds, not millisecond…
ulissesferreira Oct 31, 2025
b5eb458
chore: bump shasum (#65)
ulissesferreira Oct 31, 2025
d99cba3
1.6.0 (#66)
github-actions[bot] Oct 31, 2025
11f6c29
fix: use the correct `index` instead of `groupIndex` for account crea…
ulissesferreira Oct 31, 2025
9f5edab
1.6.1 (#68)
github-actions[bot] Oct 31, 2025
4e01cec
refactor: add `options` to the unstake method (#69)
ulissesferreira Nov 6, 2025
36f4bf4
1.7.0 (#70)
github-actions[bot] Nov 6, 2025
98313ac
fix: staking methods need to convert amounts to sun (#71)
ulissesferreira Nov 7, 2025
62be855
All improvements (#73)
ulissesferreira Nov 7, 2025
ce19630
1.7.1 (#74)
github-actions[bot] Nov 10, 2025
57864e9
fix: adjust decimals when sending TRC20 tokens (#76)
ulissesferreira Nov 10, 2025
24e568a
feat: tron using infura (#75)
aganglada Nov 10, 2025
d21f4aa
More fixes (#77)
ulissesferreira Nov 10, 2025
a33a2da
1.7.2 (#78)
github-actions[bot] Nov 10, 2025
9173fc1
1.7.3 (#79)
github-actions[bot] Nov 11, 2025
f869647
Revert "1.7.3" (#80)
aganglada Nov 11, 2025
495e604
1.7.3 (#81)
github-actions[bot] Nov 11, 2025
3291702
fix: unstake method doing incorrect input validation (#82)
ulissesferreira Nov 11, 2025
c8ae618
1.7.4 (#83)
github-actions[bot] Nov 11, 2025
2454c9d
feat: implement confirmation UI (#86)
ulissesferreira Nov 14, 2025
ffd2d73
chore: remove logs (#87)
aganglada Nov 14, 2025
502dcfb
feat: add from and to to confirmation (#88)
aganglada Nov 14, 2025
296840c
feat: transactions analytics (#90)
aganglada Nov 14, 2025
cd06b72
feat: implement confirmation UI (#86) (#91)
ulissesferreira Nov 14, 2025
5ddf8dc
1.8.0 (#92)
github-actions[bot] Nov 17, 2025
030900e
fix: `computeFee` is not working (#84)
ulissesferreira Nov 18, 2025
d6bb6d5
feat: add Bandwidth and Energy confirmation logos (#95)
ulissesferreira Nov 18, 2025
21f6742
1.8.1 (#97)
github-actions[bot] Nov 19, 2025
f70c9ef
fix: dont allow clients requesting assets for tesnets (#99)
aganglada Nov 20, 2025
cebefd8
fix: track transaction when executed and map failed and swap transact…
aganglada Nov 20, 2025
9fe417b
1.9.0 (#100)
github-actions[bot] Nov 20, 2025
875f0fa
fix: Use mutex for state blob modifications (#93)
FrederikBolding Nov 20, 2025
c731478
fix: use available `triggerConstantContract` instead of `estimateEner…
ulissesferreira Nov 20, 2025
3357451
1.9.1 (#102)
github-actions[bot] Nov 20, 2025
7556656
fix: dont remove tron resources from assets (#104)
aganglada Nov 21, 2025
0007241
fix: fix `getAccount` and `listAccounts` (#105)
ccharly Nov 21, 2025
c83e783
fix: compute fee (#103)
aganglada Nov 21, 2025
4cf4a5c
1.10.0 (#106)
github-actions[bot] Nov 21, 2025
8f030d3
chore: map freeze/unfreeze txs (#107)
zone-live Nov 21, 2025
3ee5b0c
fix: computeFee error (#108)
aganglada Nov 24, 2025
1487895
1.10.1 (#109)
github-actions[bot] Nov 24, 2025
1ce7d96
feat: add pending transaction when executing (#110)
aganglada Nov 24, 2025
24b3f15
1.11.0 (#111)
github-actions[bot] Nov 24, 2025
bf4c561
fix: compute fee not accurate (#113)
aganglada Nov 25, 2025
5c3d19d
1.12.0 (#114)
github-actions[bot] Nov 25, 2025
57097fd
fix: trc20 decimals (#115)
aganglada Nov 25, 2025
1ccd7ce
fix: continuous synchronization of accounts not starting (#117)
ulissesferreira Nov 25, 2025
85b9fb1
1.12.1 (#118)
github-actions[bot] Nov 25, 2025
7b87d1f
fix: Ensure only safe concurrent state operations (#116)
FrederikBolding Nov 26, 2025
7c6f840
1.13.0 (#121)
github-actions[bot] Nov 26, 2025
84b645c
fix: set `isDev` to false (#122)
ulissesferreira Nov 26, 2025
32e3b12
feat: signRewardsMessage (#119)
aganglada Nov 26, 2025
eba9d39
fix: improve Send flow amount validation with fee estimation (#123)
ulissesferreira Nov 27, 2025
0bf5517
Feat/wallet service (#124)
aganglada Nov 27, 2025
cacde47
1.14.0 (#125)
github-actions[bot] Nov 27, 2025
961002a
fix: remove validation key from WalletService (#126)
baptiste-marchand Nov 27, 2025
36ebc0a
fix: `computeFee` does not consider account activations (#127)
ulissesferreira Nov 28, 2025
7aa983e
fix: `signTransaction` not rebuilding Tron transactions correctly aft…
ulissesferreira Dec 1, 2025
75cb4ed
feat: `signMessage` confirmation (#130)
aganglada Dec 2, 2025
5498f17
feat: allocate Tron power to Consensys' SR node (#129)
ulissesferreira Dec 2, 2025
32e2157
chore: Add compute staking fee (#112)
zone-live Dec 3, 2025
eb5e600
feat: `signTransaction` confirmation (#131)
aganglada Dec 3, 2025
73c8ae2
feat: add feeLimit option for energy calculation in FeeCalculatorServ…
ulissesferreira Dec 3, 2025
0a98418
1.15.0 (#134)
github-actions[bot] Dec 3, 2025
dd96e98
chore: bump `keyring-api` to version 21.3.0 (#136)
ulissesferreira Dec 3, 2025
0f2f813
1.15.1 (#137)
github-actions[bot] Dec 4, 2025
0d6a5c9
chore: stop signing transactions before user confirmation (#138)
ulissesferreira Dec 4, 2025
ac2af32
feat: blockaid integration (#139)
aganglada Dec 5, 2025
fbe8ec3
fix: audit fixes (#140)
aganglada Dec 9, 2025
429eee0
fix: enhance FeeCalculatorService with fallback energy estimation to …
ulissesferreira Dec 9, 2025
7d14570
1.16.0 (#144)
github-actions[bot] Dec 9, 2025
6748d0a
Fix/dapp connectivity confirmations (#146)
aganglada Dec 12, 2025
d99309c
1.16.1 (#147)
github-actions[bot] Dec 12, 2025
fdea585
feat: map TRC10 transaction history with proper metadata (#141)
ulissesferreira Dec 15, 2025
f26c622
Exclude permissive origins and permissions (#145)
ulissesferreira Dec 15, 2025
40d30f0
chore: address all `major` level audit findings (#148)
ulissesferreira Dec 17, 2025
c883fdc
chore: address all `minor` level audit findings (#149)
ulissesferreira Dec 18, 2025
91139b9
1.17.0 (#150)
github-actions[bot] Dec 18, 2025
417d449
chore: use sha256 from MM utils and remove pkey usage (#151)
zone-live Jan 7, 2026
1725b96
feat: implement token filtering by minimum USD value in AssetsService…
ulissesferreira Jan 7, 2026
3c0e415
feat(staking): add optional srNodeAddress param to confirmStake (#154)
aganglada Jan 8, 2026
df1953c
1.18.0 (#155)
github-actions[bot] Jan 8, 2026
f5dc83a
fix: unsubmitable swaps from Bridgers (#157)
ulissesferreira Jan 9, 2026
5ef1b3a
fix: ignore `visible` in `handleComputeFee` field (#158)
ulissesferreira Jan 9, 2026
201b08a
fix: always include TRX fee as first result on `computeFee` (#159)
ulissesferreira Jan 9, 2026
0c2c372
1.19.0 (#160)
github-actions[bot] Jan 9, 2026
5edea12
fix: signing messages of 3 characters or less (#161)
ulissesferreira Jan 12, 2026
f432323
chore: remove convertion layer for images displayed in Snaps UI (#162)
ulissesferreira Jan 14, 2026
906d7f2
chore: finalised vs finalized wording (#164)
zone-live Jan 15, 2026
5d1249c
1.19.1 (#165)
github-actions[bot] Jan 15, 2026
3618b2e
chore: display error message coming from the simulation API (#166)
Julink-eth Jan 23, 2026
24d46ab
1.19.2 (#168)
github-actions[bot] Jan 26, 2026
6486daf
fix: normalize locale string in simulations (#169)
mikesposito Jan 27, 2026
26f54e4
1.19.3 (#170)
github-actions[bot] Jan 27, 2026
4667598
chore: cache chain parameters until they expire (#171)
ulissesferreira Jan 27, 2026
85a14af
fix: inaccurate energy estimation for system contracts (#172)
ulissesferreira Jan 27, 2026
68b1fd4
perf: optimize data synchronization to avoid duplicate API requests (…
ulissesferreira Jan 28, 2026
9750965
feat: update approve type tx with unknow instead of send for MM type …
Battambang Jan 30, 2026
68932fa
fix: extract correct scan parameters from tx (#176)
mikesposito Jan 30, 2026
9c6a992
Fix/validation missing send trx flow (#179)
Julink-eth Jan 30, 2026
8387040
feat: support network fees with contract energy sharing mechanism (#181)
Battambang Feb 2, 2026
bc9a468
fix: ensure integer amounts when building TronWeb transactions (#178)
ulissesferreira Feb 2, 2026
9b1715f
1.20.0 (#182)
github-actions[bot] Feb 2, 2026
508cbf5
ci: enable preview builds (#180)
mikesposito Feb 2, 2026
ae6e24f
chore: add `tsx` and deduplicate dependencies (#184)
mikesposito Feb 3, 2026
9353b2d
fix: use `BigNumber` to display numbers (#191)
ulissesferreira Feb 4, 2026
6c27709
fix: consider current deployer energy when calculating fees (#192)
Battambang Feb 5, 2026
b206e84
1.21.0 (#193)
github-actions[bot] Feb 5, 2026
4c61062
fix: allow pending transactions to be updated when confirmed (#194)
ulissesferreira Feb 5, 2026
c8f5578
1.21.1 (#195)
github-actions[bot] Feb 5, 2026
4e59eed
ci: add changelog validation scripts (#198)
mikesposito Feb 9, 2026
3132d20
ci: enforce package deduplication (#201)
mikesposito Feb 9, 2026
c432267
chore: enable `@typescript-eslint/no-explicit-any` as `error` (#203)
mikesposito Feb 10, 2026
2318fa0
test: enable coverage collection and thresholds (#204)
mikesposito Feb 10, 2026
7f7f122
fix: decode hex-encoded TRC10 token names and symbols (#187)
ulissesferreira Feb 11, 2026
7e2f826
fix: clamp energy and bandwidth to zero to prevent negative values (#…
ulissesferreira Feb 12, 2026
0742a1b
feat: use security api for simulations (#205)
Julink-eth Feb 12, 2026
0ad21c0
feat: support TRC20 token balances for inactive accounts (#190)
ulissesferreira Feb 13, 2026
9202bd1
fix: gracefully handle dismissed interface errors in background jobs …
ulissesferreira Feb 13, 2026
8bcc36d
chore: release Tron snap version 1.22.0 (#207)
github-actions[bot] Feb 19, 2026
80810d1
feat: return TRX ready for withdrawal as part of assets (#208)
ulissesferreira Feb 20, 2026
420b9f8
feat: return TRX from staking rewards as part of assets (#209)
ulissesferreira Feb 20, 2026
5c7fcff
feat: return TRX in the `lock_period` as part of assets (#210)
ulissesferreira Feb 20, 2026
5a7a214
1.23.0 (#215)
github-actions[bot] Feb 26, 2026
d353a2d
fix: empty ID for derived accounts leading to state saving failures (…
ulissesferreira Mar 2, 2026
bae4a81
Revert staking improvements special assets (#222)
ulissesferreira Mar 3, 2026
5c06841
chore: rollback `package.json` version (#224)
ulissesferreira Mar 3, 2026
2fab2cf
1.22.1 (#225)
github-actions[bot] Mar 3, 2026
dbd6123
revert: revert: staking improvements' special assets (#226)
ulissesferreira Mar 5, 2026
d92fd80
chore: tweak symbols for new staking special assets (#227)
ulissesferreira Mar 5, 2026
8d2708b
1.23.1 (#229)
github-actions[bot] Mar 5, 2026
71840fe
feat: implement `claimUnstakedTrx` client request method (#231)
ulissesferreira Mar 6, 2026
6f57d4c
feat: implement `claimTrxStakingRewards` client request method (#232)
ulissesferreira Mar 6, 2026
cc32bab
fix: always extract special assets to prevent stale balances (#234)
ulissesferreira Mar 11, 2026
e4932bf
fix: add confirmation dialog to `claimUnstakedTrx` method
ulissesferreira Mar 17, 2026
bc79c53
1.24.0 (#241)
github-actions[bot] Mar 17, 2026
ed832a7
fix: assert transaction structure at all entry points (#237)
ulissesferreira Mar 19, 2026
e0f0370
fix: disable scanning of unsupported transactions (#238)
ulissesferreira Mar 19, 2026
6bf69d7
fix: correct endpoint path casing for /wallet/getReward (#242)
ulissesferreira Mar 19, 2026
29e8652
refactor: convert FetchStatus type alias to enum (#246)
ulissesferreira Mar 23, 2026
70bd14e
refactor: migrate Security Alerts API types to superstruct runtime va…
ulissesferreira Mar 23, 2026
92746dd
chore: remove entities barrel and use direct imports (#250)
ulissesferreira Mar 23, 2026
98addec
chore: narrow findByIds and fetchNewTransactionsForAccount types (#251)
ulissesferreira Mar 23, 2026
d4b750e
chore: optimize account discovery with lightweight activity check (#252)
ulissesferreira Mar 23, 2026
abb67b8
fix: avoid onAmountInput fee estimation failures when toAddress is mi…
ulissesferreira Mar 24, 2026
89507d8
fix: add raw data field for TRC20 scan request (#261)
Battambang Mar 25, 2026
e673643
fix: deadlock in chain parameters caching (#258)
mikesposito Mar 25, 2026
7d0cb1f
1.25.0 (#263)
github-actions[bot] Mar 25, 2026
576989c
fix: display correctly token icon size when sending TRC20 tokens (#262)
Battambang Mar 26, 2026
4c793f9
fix: display correctly decimal amount sent in confirmation dialog (#264)
Battambang Mar 26, 2026
0b41b40
fix: include memo fee (1 TRX) in transaction fee estimation (#281)
Battambang Mar 31, 2026
37ef7e4
fix: added set of fee_limit when building transaction (#280)
gabrieledm Apr 1, 2026
13d6488
fix: handle NFT asset types in transaction scan simulation (#285)
Battambang Apr 3, 2026
325145c
1.25.1 (#288)
github-actions[bot] Apr 7, 2026
59003c8
fix: transaction syncing failures (#289)
ulissesferreira Apr 9, 2026
ec0dc0a
1.25.2 (#290)
github-actions[bot] Apr 9, 2026
043e124
fix: error interface with id ... not found (#284)
Julink-eth Apr 17, 2026
77f22ab
fix: updated logic to manage stale balances during save of assets (#292)
gabrieledm Apr 22, 2026
6a28c37
1.25.3 (#294)
github-actions[bot] Apr 22, 2026
8c7589d
feat: harden `setSelectedAccounts` (#298)
hmalik88 May 7, 2026
1b88152
chore: remove internal uncessary checks for interfaces and align with…
Julink-eth May 11, 2026
a62007c
docs: fix changelog PR link (#303)
ulissesferreira May 13, 2026
1eee6ad
1.25.4 (#304)
github-actions[bot] May 13, 2026
e992287
fix: signature validation via checking owner address (#297)
gabrieledm May 21, 2026
4b23fe2
1.25.5 (#310)
github-actions[bot] May 21, 2026
ae516f4
fix: automatically refresh transaction expiration (#299)
ulissesferreira May 21, 2026
791cd15
feat: filter out address poisoning transactions (#301)
ulissesferreira May 21, 2026
4eb3ff2
1.25.6 (#312)
github-actions[bot] May 21, 2026
c01ef8d
fix: tx confirm button not to disable upon scan refresh (#302)
maxime-oe May 27, 2026
733c9ea
feat: add `trackError` to report errors to Sentry NEB-1241 (#311)
mikesposito May 27, 2026
f7633dd
chore: track errors in scanTransaction method of TransactionScanServi…
taran-a May 28, 2026
9d60080
chore: track errors in handle methods of ClientRequestHandler NEB-123…
taran-a May 28, 2026
4cb1f17
1.25.7 (#317)
github-actions[bot] May 28, 2026
8f69f51
fix: remove `snap_trackError` permission from manifest (#320)
mikesposito May 28, 2026
f43a0ae
1.25.8 (#321)
github-actions[bot] May 28, 2026
5fbc066
feat: add atomic state updates (#307)
gantunesr May 28, 2026
a544c6f
chore: track errors in AssetsService NEB-1238 (#322)
taran-a Jun 2, 2026
61b4095
chore: add error cause in keyring & ConfirmationHandler & validators …
taran-a Jun 3, 2026
04016e8
chore: track error in ConfirmationHandler NEB-1240 (#324)
taran-a Jun 3, 2026
6f5c6c8
docs: add snap migration process guide
mikesposito Jun 9, 2026
dd43f32
Merge remote-tracking branch 'tron-wallet-snap/main' into me/tron-tes…
mikesposito Jun 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This monorepo hosts MetaMask's first-party Snaps along with shared tooling and infrastructure for building, testing, and releasing them.

## Contributing

See the [Contributor Documentation](./docs) for help on:

- Setting up your development environment
- Working with the monorepo
- Testing changes in clients
- Issuing new releases
- Creating a new package

## Installation/Usage

Each snap in this repository has its own README with installation and usage instructions. See `packages/` for more.
Expand Down
7 changes: 7 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributor Documentation

Hi! Welcome to the contributor documentation for the `internal-snaps` monorepo.

## Processes

- [Migrating external snaps to the monorepo](./processes/snap-migration-process-guide.md)
212 changes: 212 additions & 0 deletions docs/processes/snap-migration-process-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Snap migration process guide

This document outlines the process for migrating a MetaMask first-party Snap into the `internal-snaps` monorepo. The migration target is assumed to be based off template-snap-monorepo.

> Prerequisites: `internal-snaps` has been created and prepared to host snaps, its CI is green, and the host repo grants merge access for the migration PRs. The migration target must be in a clean state with all in-flight work merged or rebased. Install `git-filter-repo`.

---

## Phase A: Preparation in the original repository

### [PR#1] Add the migration notice to the README

Add this banner to the top of `README.md`:

```markdown
<table><tr><td><p align="center"><b>⚠️ PLEASE READ ⚠️</b></p><p align="center">This package is currently being migrated to our <a href="<https://github.com/MetaMask/internal-snaps>"><code>internal-snaps</code></a> monorepo. Please do not make any commits to this repository while this migration is taking place, as they will not be transferred over. Also, please re-open PRs that are under active development in the <code>internal-snaps</code> repo.</p></td></tr></table>
```

### [PR#2] Align dependency versions and TypeScript / ESLint / Prettier / Oxfmt configurations with `internal-snaps`

- If the snap's dependency versions are ahead of `internal-snaps`, update the monorepo root first; otherwise, bump the snap to match.
- Copy the relevant tooling configs (`tsconfig.base.json` compiler flags, `.prettierrc.js`, `.oxfmtrc.json`, the shared ESLint config) so the snap satisfies them on the monorepo's tooling.
- Preserve any TypeScript compiler flags enabled in the snap but not in the monorepo.
- **Yarn version**: if the source repo (or the `packages/snap/package.json`) pins `yarn@3.x`, upgrade to Yarn 4 (`yarn set version berry && yarn set version stable`) and re-resolve `yarn.lock` before merging. The monorepo runs Yarn 4; a yarn-3 lockfile will be re-generated on first install in the monorepo regardless, but bumping in the source repo first avoids surprise dependency-resolution diffs at integration time.
- Resolve any errors that result from the alignment.

### [PR#3] Reconcile with `template-snap-monorepo`

Compare `<original-repo>/packages/snap` against the current sample-snap from `internal-snaps` and add anything missing: eslint, jest config, `LICENSE`, etc.

### [PR#4] Cut a final release from the source repo

Cut and publish a final release of the package from the original repository. All subsequent releases happen from `internal-snaps`. Keep the release tag for the changelog link in PR#7.

---

## Phase B: Staging from `internal-snaps`'s `merged-packages/`

### [PR#5] Migrate the source repo's git history into `merged-packages/`

> [!WARNING]
>
> - **Do not rebase** the migration branch: it will disrupt the imported history.
> - **Merge the PR without squashing.** Contact a maintainer to temporarily enable merge commits into `main`.
> - Coordinate with the team to minimise the time the PR stays open; superfluous merge commits to `main` will pollute the migrated git history. If history pollution occurs, replay the migration on a fresh branch before merging.

1. Navigate to a temporary directory: `cd /tmp`.
2. Clone a fresh copy of the source repo: `git clone <https://github.com/MetaMask/snap-tron-wallet`>. **Do not** reuse an existing clone: the next step rewrites history irreversibly.
3. `cd snap-tron-wallet`.
4. Rewrite history so the snap package lives at the staging path:
This both isolates the snap package (drops the `packages/site/` test-dapp and any other top-level files) and moves it into the staging directory in a single rewrite. If the source repo is **not** itself a monorepo (i.e. the snap lives at the repo root), use `-path-rename :merged-packages/<name>-snap/` instead.
`bash
git filter-repo \\
--path packages/snap/ \\
--path-rename packages/snap/:merged-packages/tron-wallet-snap/
`
5. `cd` into your local checkout of `internal-snaps`.
6. Add the rewritten repo as a remote: `git remote add tron-wallet-snap /tmp/snap-tron-wallet`.
7. Fetch history without tags: `git fetch tron-wallet-snap --no-tags`.
8. Create the migration branch: `git checkout -b migrate-tron-wallet-snap`.
9. Merge the snap into the monorepo: `git merge --allow-unrelated-histories tron-wallet-snap/main`.
10. Open a pull request in `internal-snaps` that reflects the above changes.

### [PR#6] Reset the CHANGELOG, linking back to the old repository

In `merged-packages/tron-wallet-snap/CHANGELOG.md`:

- Replace the file with a fresh CHANGELOG that contains only an empty `## [Unreleased]` section (no historical releases).
- Add a `### Changed` entry under `## [Unreleased]` explaining that the package was migrated, and include a link to the old changelog:
> This package was migrated from `MetaMask/snap-tron-wallet`. See the source repository for the original changelog.

do **not** try to rewrite the old tag-diff links to point at `internal-snaps`. The old tags do not exist in the new repo, so the links would 404.

### [PR#7] Remove files and directories replaced by the monorepo root

Inside `merged-packages/tron-wallet-snap/`:

- **Remove**: `.github/`, `.git*`, `.depcheckrc.{json,yml}`, `.yarn/`, `.yarnrc.yml`, `yarn.lock`, `.editorconfig`, `.eslint*`, `.prettier*`, `.oxfmtrc*`, `.nvm*`, `lavamoat/`, `simple-git-hooks` config, `node_modules/`, `dist/`, `coverage/`, real `.env` files (keep `.env.example` / `.env.sample`), and top-level `LICENSE` if present alongside `LICENSE.MIT0` / `LICENSE.APACHE2`.
- **Keep**: `src/`, `tests/`, `integration-test/` (if present), `docs/` (snap-internal docs), `scripts/` (snap-internal helpers like `build-preinstalled-snap.js`, `populate-en-locale.js` / `populate-locale.js`, `update-manifest-local.js`), `CHANGELOG.md`, `package.json`, `README.md`, `jest.config.js`, `jest.integration.config.js`, `jest.setup.ts` (if present), custom jest transformers (e.g. `svg-transformer.js`), `babel.config.js` (if jest uses babel), `tsconfig*.json`, `snap.manifest.json`, `snap.config.ts`, `messages.json`, `openrpc.json`, `keyring.openrpc.json`, `images/`, `locales/`, `crowdin.yml`, `.env.example` / `.env.sample`, `LICENSE.MIT0`, `LICENSE.APACHE2`.

Carry over any snap-specific Yarn patches into the monorepo root `.yarn/patches/`. For Tron, this means `tronweb-npm-6.1.0-771b242b6a.patch`. (e.g., Solana and Bitcoin have no patches; this step is no-op for them.)

### [PR#8] Replace config files

- `tsconfig.json`: See sample-snap config.
- `jest.config.js`: keep the snap's existing config (it already does what `@metamask/snaps-jest` expects). Verify its `preset` / `transform` / custom `setupFilesAfterEnv` / custom transformer references (e.g. `<rootDir>/svg-transformer.js`) still resolve under the monorepo's hoisted dependencies. Preserve any `coverageThreshold`, `collectCoverageFrom`, `coveragePathIgnorePatterns`, and `testMatch` overrides.
- If `jest.integration.config.js` (or any other config file) uses ESM `export default` while the rest of the snap is CommonJS, convert it to `module.exports` (or rename to `.mjs`); ESLint in the monorepo rejects the mismatch.
- Keep `babel.config.js` if jest uses babel for transformation.
- Add tsconfig reference paths for upstream dependencies: snaps in `internal-snaps` are leaf packages and do not consume monorepo workspaces, but this may change in the future.

### [PR#9] Align dependencies and build scripts with the monorepo

- Remove redundant build scripts already provided by the monorepo root.
- Remove redundant dev dependencies already listed at the monorepo root. **Exception**: do not remove `typescript`.
- Align dependency versions with the monorepo:
- If the snap version is ahead, decrement to match the monorepo (or bump the monorepo in a preceding PR).
- If behind, bump only when there are no resulting breaking changes to resolve.
- **Migrate root-level `resolutions`**: copy any entries from the source repo's root `package.json#resolutions` into the monorepo root `package.json#resolutions`, merging with the existing set. Common offenders: `@metamask/snaps-sdk` (Solana, Bitcoin), `@types/react` / `@types/react-dom` (Solana). If snaps in the monorepo disagree on a pinned version, raise it to a coordination decision before merging.
- **Migrate LavaMoat allow-list entries**: Run `yarn allow-scripts auto` to
- **Move `crowdin.yml`** from the source repo root (or `packages/snap/`) into the package directory so the monorepo's per-package Crowdin tooling treats it independently.
- **Snap-specific**: keep `scripts.build` starting with `mm-snap build` (the monorepo constraint only requires the prefix; chaining `&& yarn locale:build && yarn build-preinstalled-snap`: or `build:locale`, depending on the snap: is supported). Add `scripts.prepublishOnly: mm-snap manifest` so the manifest shasum stays in sync at publish time.
- Edit `package.json` metadata:
- `repository.url` → `https://github.com/MetaMask/internal-snaps.git`.
- `homepage` → `https://github.com/MetaMask/internal-snaps/tree/main/packages/tron-wallet-snap#readme`.
- `bugs.url` → `https://github.com/MetaMask/internal-snaps/issues`.
- `license` → `(MIT-0 OR Apache-2.0)`.
- `files`: includes `dist/`, `snap.manifest.json`, `images/`, `locales/`.
- Add `scripts.changelog:update`: `../../scripts/update-changelog.sh @metamask/tron-wallet-snap`.
- Add `scripts.changelog:validate`: `../../scripts/validate-changelog.sh @metamask/tron-wallet-snap`.
- Add `scripts.since-latest-release`: `../../scripts/since-latest-release.sh`.

### [PR#10] Update the README to reflect non-root-package status

- Preserve the opening sentence/paragraph that introduces the snap.
- Add or modify an "Installation" section (see other snap READMEs once they exist, or model after a core non-root package).
- Preserve the "Usage" section.
- Remove "Test", "Build" and other instructions for common development tasks (these now live in the monorepo's `docs/processes/`).
- Add a "Contributing" section that links to the monorepo's `docs/processes/`.

---

## [PR#11] Phase C: Integration into `packages/`

All Phase C steps go in a **single** PR. Coordinate with the team to minimise the time it stays open.

### 1. Move the package from `merged-packages/` to `packages/`

```bash
git mv merged-packages/tron-wallet-snap packages/tron-wallet-snap
yarn install
```

Check the snap's tests pass: `yarn workspace @metamask/tron-wallet-snap run test`.

### 2. Linter and constraints fixes

- `yarn constraints --fix` then `yarn constraints` until clean.
- Verify `scripts.changelog:validate` is present in `package.json` (added in PR#10).
- `yarn allow-scripts auto` if the snap brought new lifecycle scripts. Commit the LavaMoat policy update.
- `yarn lint:eslint --fix --suppress-all` to absorb existing snap-side findings into `eslint-suppressions.json`, then `yarn lint` to confirm clean.
- Update `teams.json`: add `"metamask/tron-wallet-snap": "@MetaMask/networks"` (or the owning team).
- Update `.github/CODEOWNERS`: append `/packages/tron-wallet-snap/ @MetaMask/networks`.

### 4. Resolve or TODO downstream errors

If the migration breaks anything inside the monorepo (rare, since snaps are leaf packages):

- Resolve simple errors in this PR.
- Mark complex/blocked errors with `@ts-expect-error TODO:` and file a follow-up issue.

### 5. Record changes in CHANGELOG `[Unreleased]`

In `packages/tron-wallet-snap/CHANGELOG.md` under `## [Unreleased]`, e.g.:

- `### Changed`
- Migrated package from `MetaMask/snap-tron-wallet` to `MetaMask/internal-snaps` (no consumer-visible behaviour change).
- Re-licensed split into `LICENSE.MIT0` + `LICENSE.APACHE2` files (SPDX expression unchanged).

### 6. Finalize merge

- Confirm all tests pass for the snap and for the rest of the monorepo (CI must be green).
- Double-check that any changes that landed on `main` while the PR was open are correctly merged in.

---

## Phase D: Clean-up and release

### Source repo (`snap-tron-wallet`)

1. **Transfer open issues** from the source repo into `internal-snaps` using GitHub's _Transfer issue_ feature. Prepend the title with `[tron-wallet-snap]`.
2. **Lock open PRs** (do not provide a reason). Leave this comment:

```markdown
This library has now been migrated into the internal-snaps monorepo. This PR has been locked and this repo will be archived shortly. Going forward, releases of this library will only include changes made in the internal-snaps repo.

- Please push this branch to internal-snaps and open a new PR there.
- Optionally, add a link pointing to the discussion in this PR to provide context.
```

For important PRs, manually migrate them into `internal-snaps` or create follow-up tickets.

3. **[PR#12] Replace the migration notice in `snap-tron-wallet/README.md`** with the archive notice (this replaces the banner added in PR#1):

```html
<table>
<tr>
<td>
<p align="center"><b>⚠️ PLEASE READ ⚠️</b></p>
<p align="center">
This package has been migrated to our
<a href="<https://github.com/MetaMask/internal-snaps>"
><code>internal-snaps</code></a
>
monorepo, and this repository has been archived. Please note that all
future development and feature releases will take place in the
<a href="<https://github.com/MetaMask/internal-snaps>"
><code>internal-snaps</code></a
>
repository.
</p>
</td>
</tr>
</table>
```

4. **Archive the source repository**. Contact a maintainer to perform this step. Keep tags and the final release intact for npm-package history continuity.

### `internal-snaps`

1. **Fix any `@ts-expect-error TODO:` annotations** added during PR#12. Do this before the first post-migration release if possible.
2. **[PR#13] Cut the first post-migration release** with `yarn create-release-branch -i`.
3. **Verify the preview-build workflow** by opening a no-op PR against the new package and confirming the preview-publish job posts.
3 changes: 3 additions & 0 deletions merged-packages/tron-wallet-snap/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignores": ["jest-transform-stub", "ts-jest", "@metamask/auto-changelog"]
}
31 changes: 31 additions & 0 deletions merged-packages/tron-wallet-snap/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use:
# - local for local development
# - test for running tests locally (mandatory)
# - production before submitting a PR
ENVIRONMENT=local

RPC_URL_LIST_MAINNET=https://api.trongrid.io
RPC_URL_LIST_NILE_TESTNET=https://nile.trongrid.io
RPC_URL_LIST_SHASTA_TESTNET=https://api.shasta.trongrid.io/jsonrpc

EXPLORER_MAINNET_BASE_URL=https://tronscan.org
EXPLORER_NILE_BASE_URL=https://nile.tronscan.org
EXPLORER_SHASTA_BASE_URL=https://shasta.tronscan.org

PRICE_API_BASE_URL=https://price.api.cx.metamask.io
TOKEN_API_BASE_URL=https://tokens.api.cx.metamask.io
STATIC_API_BASE_URL=https://static.cx.metamask.io
SECURITY_ALERTS_API_BASE_URL=https://security-alerts.api.cx.metamask.io
NFT_API_BASE_URL=https://nft.api.cx.metamask.io

LOCAL_API_BASE_URL=http://localhost:8899

# TronGrid API Base URLs
TRONGRID_BASE_URL_MAINNET=https://api.trongrid.io
TRONGRID_BASE_URL_NILE=https://nile.api.trongrid.io
TRONGRID_BASE_URL_SHASTA=https://shasta.api.trongrid.io

# Tron HTTP API Base URLs
TRON_HTTP_BASE_URL_MAINNET=https://api.trongrid.io
TRON_HTTP_BASE_URL_NILE=https://nile.trongrid.io
TRON_HTTP_BASE_URL_SHASTA=https://shasta.trongrid.io
2 changes: 2 additions & 0 deletions merged-packages/tron-wallet-snap/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
coverage/
Loading
Loading