@metamask-previews/tron-wallet-snap 1.20.0-preview-3141b7e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,424 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.20.0]
11
+
12
+ ### Added
13
+
14
+ - Support estimating network fees with contract energy sharing mechanism ([#181](https://github.com/MetaMask/snap-tron-wallet/pull/181))
15
+
16
+ ### Changed
17
+
18
+ - Optimize data synchronization to avoid duplicate API requests ([#173](https://github.com/MetaMask/snap-tron-wallet/pull/173))
19
+ - Cache chain parameters until they expire ([#171](https://github.com/MetaMask/snap-tron-wallet/pull/171))
20
+
21
+ ### Fixed
22
+
23
+ - Add pre-confirmation validation to `confirmSend` flow ([#179](https://github.com/MetaMask/snap-tron-wallet/pull/179))
24
+ - Validates that the user has enough funds to cover both the amount and all associated fees (bandwidth, energy, account activation) before showing the confirmation dialog.
25
+ - Fix missing values in simulation API request ([#176](https://github.com/MetaMask/snap-tron-wallet/pull/176))
26
+ - The wrong parameters sent to the simulation API were causing inaccurate estimations and false negatives.
27
+ - Ensure integer amounts are passed to TronWeb's functions that involve `SUN` ([#178](https://github.com/MetaMask/snap-tron-wallet/pull/178))
28
+ - Correct inaccurate energy estimation for system contracts ([#172](https://github.com/MetaMask/snap-tron-wallet/pull/172))
29
+ - Correct mapping of `approve` type transactions ([#177](https://github.com/MetaMask/snap-tron-wallet/pull/177))
30
+
31
+ ## [1.19.3]
32
+
33
+ ### Fixed
34
+
35
+ - Normalize locale string when showing simulation estimated changes ([#169](https://github.com/MetaMask/snap-tron-wallet/pull/169))
36
+
37
+ ## [1.19.2]
38
+
39
+ ### Added
40
+
41
+ - Display error message coming from transaction simulations ([#166](https://github.com/MetaMask/snap-tron-wallet/pull/166))
42
+
43
+ ## [1.19.1]
44
+
45
+ ### Changed
46
+
47
+ - Remove convertion layer for images displayed in Snaps UI ([#162](https://github.com/MetaMask/snap-tron-wallet/pull/162))
48
+
49
+ ### Fixed
50
+
51
+ - Finalised word transformed to us-en ([#164](https://github.com/MetaMask/snap-tron-wallet/pull/164))
52
+ - Signing messages of 3 characters or less ([#161](https://github.com/MetaMask/snap-tron-wallet/pull/161))
53
+
54
+ ## [1.19.0]
55
+
56
+ ### Fixed
57
+
58
+ - Always include TRX fee as first result on `computeFee` ([#159](https://github.com/MetaMask/snap-tron-wallet/pull/159))
59
+ - Ignore `visible` in `handleComputeFee` field ([#158](https://github.com/MetaMask/snap-tron-wallet/pull/158))
60
+ - Address unsubmitable swaps from Bridgers ([#157](https://github.com/MetaMask/snap-tron-wallet/pull/157))
61
+
62
+ ## [1.18.0]
63
+
64
+ ### Added
65
+
66
+ - Add optional `srNodeAddress` param to `confirmStake` ([#154](https://github.com/MetaMask/snap-tron-wallet/pull/154))
67
+ - Implement token filtering by minimum USD value in `AssetsService` ([#152](https://github.com/MetaMask/snap-tron-wallet/pull/152))
68
+
69
+ ### Fixed
70
+
71
+ - Use `sha256` from MM utils and remove pkey usage ([#151](https://github.com/MetaMask/snap-tron-wallet/pull/151))
72
+
73
+ ## [1.17.0]
74
+
75
+ ### Added
76
+
77
+ - Map TRC10 transaction history with metadata fetched onchain ([#141](https://github.com/MetaMask/snap-tron-wallet/pull/141))
78
+
79
+ ### Fixed
80
+
81
+ - Address all `minor` level audit findings ([#149](https://github.com/MetaMask/snap-tron-wallet/pull/149))
82
+ - Address all `major` level audit findings ([#148](https://github.com/MetaMask/snap-tron-wallet/pull/148))
83
+ - Exclude permissive origins and permissions ([#145](https://github.com/MetaMask/snap-tron-wallet/pull/145))
84
+
85
+ ## [1.16.1]
86
+
87
+ ### Fixed
88
+
89
+ - Dapp connectivity confirmations ([#146](https://github.com/MetaMask/snap-tron-wallet/pull/146))
90
+
91
+ ## [1.16.0]
92
+
93
+ ### Added
94
+
95
+ - Integrate Blockaid transaction simulation ([#139](https://github.com/MetaMask/snap-tron-wallet/pull/139))
96
+
97
+ ### Fixed
98
+
99
+ - Enhance FeeCalculatorService with fallback energy estimation to `feeLimit` ([#142](https://github.com/MetaMask/snap-tron-wallet/pull/142))
100
+ - Audit fixes ([#140](https://github.com/MetaMask/snap-tron-wallet/pull/140))
101
+ - Stop signing transactions before user confirmation ([#138](https://github.com/MetaMask/snap-tron-wallet/pull/138))
102
+
103
+ ## [1.15.1]
104
+
105
+ ### Changed
106
+
107
+ - Bump `keyring-api` to version 21.3.0 ([#136](https://github.com/MetaMask/snap-tron-wallet/pull/136))
108
+
109
+ ## [1.15.0]
110
+
111
+ ### Added
112
+
113
+ - Added `feeLimit` option for energy calculation in FeeCalculatorService ([#132](https://github.com/MetaMask/snap-tron-wallet/pull/132))
114
+ - Added `signTransaction` confirmation ([#131](https://github.com/MetaMask/snap-tron-wallet/pull/131))
115
+ - Added `signMessage` confirmation ([#130](https://github.com/MetaMask/snap-tron-wallet/pull/130))
116
+ - Allocate Tron power to Consensys' SR node ([#129](https://github.com/MetaMask/snap-tron-wallet/pull/129))
117
+ - Added compute staking fee ([#112](https://github.com/MetaMask/snap-tron-wallet/pull/112))
118
+
119
+ ### Fixed
120
+
121
+ - `signTransaction` not rebuilding Tron transactions correctly after receiving them as input ([#128](https://github.com/MetaMask/snap-tron-wallet/pull/128))
122
+ - `computeFee` does not consider account activations ([#127](https://github.com/MetaMask/snap-tron-wallet/pull/127))
123
+ - Remove validation key from WalletService ([#126](https://github.com/MetaMask/snap-tron-wallet/pull/126))
124
+
125
+ ## [1.14.0]
126
+
127
+ ### Added
128
+
129
+ - Dapp connectivity methods (`sign{Message/Transaction}`) ([#124](https://github.com/MetaMask/snap-tron-wallet/pull/124))
130
+ - Client `signRewardsMessage` ([#119](https://github.com/MetaMask/snap-tron-wallet/pull/119))
131
+
132
+ ### Changed
133
+
134
+ - Improve Send flow amount validation with fee estimation ([#123](https://github.com/MetaMask/snap-tron-wallet/pull/123))
135
+
136
+ ### Fixed
137
+
138
+ - Det `isDev` to false ([#122](https://github.com/MetaMask/snap-tron-wallet/pull/122))
139
+
140
+ ## [1.13.0]
141
+
142
+ ### Changed
143
+
144
+ - Ensure only safe concurrent state operations ([#116](https://github.com/MetaMask/snap-tron-wallet/pull/116))
145
+
146
+ ## [1.12.1]
147
+
148
+ ### Fixed
149
+
150
+ - Continuous synchronization of accounts not starting until we locked and unlocked the client ([#117](https://github.com/MetaMask/snap-tron-wallet/pull/117))
151
+ - Could not send TRC20 tokens where decimals were `18` ([#115](https://github.com/MetaMask/snap-tron-wallet/pull/115))
152
+
153
+ ## [1.12.0]
154
+
155
+ ### Changed
156
+
157
+ - `computeFee` not calling `triggerConstantContract` with accurate parameters ([#113](https://github.com/MetaMask/snap-tron-wallet/pull/113))
158
+
159
+ ## [1.11.0]
160
+
161
+ ### Added
162
+
163
+ - Pending transaction when executing ([#110](https://github.com/MetaMask/snap-tron-wallet/pull/110))
164
+
165
+ ## [1.10.1]
166
+
167
+ ### Fixed
168
+
169
+ - `computeFee` error ([#108](https://github.com/MetaMask/snap-tron-wallet/pull/108))
170
+ - Map freeze/unfreeze txs ([#107](https://github.com/MetaMask/snap-tron-wallet/pull/107))
171
+
172
+ ## [1.10.0]
173
+
174
+ ### Fixed
175
+
176
+ - Compute fee accuracy ([#103](https://github.com/MetaMask/snap-tron-wallet/pull/103))
177
+ - Fix `getAccount` and `listAccounts` ([#105](https://github.com/MetaMask/snap-tron-wallet/pull/105))
178
+ - Don't remove tron resources from assets ([#104](https://github.com/MetaMask/snap-tron-wallet/pull/104))
179
+
180
+ ## [1.9.1]
181
+
182
+ ### Fixed
183
+
184
+ - Use available `triggerConstantContract` instead of `estimateEnergy` ([#101](https://github.com/MetaMask/snap-tron-wallet/pull/101))
185
+ - Use mutex for state blob modifications ([#93](https://github.com/MetaMask/snap-tron-wallet/pull/93))
186
+
187
+ ## [1.9.0]
188
+
189
+ ### Added
190
+
191
+ - Track transaction when executed and map `failed` and `swap` transactions ([#98](https://github.com/MetaMask/snap-tron-wallet/pull/98))
192
+
193
+ ### Fixed
194
+
195
+ - Dont allow clients requesting assets for tesnets ([#99](https://github.com/MetaMask/snap-tron-wallet/pull/99))
196
+
197
+ ## [1.8.1]
198
+
199
+ ### Added
200
+
201
+ - Bandwidth and Energy confirmation logos ([#95](https://github.com/MetaMask/snap-tron-wallet/pull/95))
202
+
203
+ ### Fixed
204
+
205
+ - `computeFee` was returning in SUN and inaccurate values ([#84](https://github.com/MetaMask/snap-tron-wallet/pull/84))
206
+
207
+ ## [1.8.0]
208
+
209
+ ### Added
210
+
211
+ - Confirmation UI (#86) ([#86](https://github.com/MetaMask/snap-tron-wallet/pull/86))
212
+ - Transactions analytics ([#90](https://github.com/MetaMask/snap-tron-wallet/pull/90))
213
+ - Add `from` and `to` to confirmation ([#88](https://github.com/MetaMask/snap-tron-wallet/pull/88))
214
+
215
+ ### Fixed
216
+
217
+ - Remove logs ([#87](https://github.com/MetaMask/snap-tron-wallet/pull/87))
218
+
219
+ ## [1.7.4]
220
+
221
+ ### Fixed
222
+
223
+ - Unstake method was doing incorrect input validation ([#82](https://github.com/MetaMask/snap-tron-wallet/pull/82))
224
+
225
+ ## [1.7.3]
226
+
227
+ ### Added
228
+
229
+ - Use Infura urls ([#75](https://github.com/MetaMask/snap-tron-wallet/pull/75))
230
+
231
+ ## [1.7.2]
232
+
233
+ ### Added
234
+
235
+ - Use Infura for all API dependencies ([#75](https://github.com/MetaMask/snap-tron-wallet/pull/75))
236
+
237
+ ### Fixed
238
+
239
+ - Return transaction history fees in TRX not in SUN ([#77](https://github.com/MetaMask/snap-tron-wallet/pull/77))
240
+ - `computeFee` method needs to reconstruct Tron transactions the same way `signAndSendTransaction` does ([#77](https://github.com/MetaMask/snap-tron-wallet/pull/77))
241
+ - Adjust decimals when sending TRC20 tokens ([#76](https://github.com/MetaMask/snap-tron-wallet/pull/76))
242
+
243
+ ## [1.7.1]
244
+
245
+ ### Changed
246
+
247
+ - Remove unused "Localnet" ([#73](https://github.com/MetaMask/snap-tron-wallet/pull/73))
248
+
249
+ ### Fixed
250
+
251
+ - Incorrect staked Tron amount due to not counting delegated TRX ([#73](https://github.com/MetaMask/snap-tron-wallet/pull/73))
252
+ - No initialized placeholder TRX value, nor special assets (Bandwidth, Energy) on accounts without TRX ([#73](https://github.com/MetaMask/snap-tron-wallet/pull/73))
253
+ - Staking methods need to convert amounts to sun ([#71](https://github.com/MetaMask/snap-tron-wallet/pull/71))
254
+
255
+ ## [1.7.0]
256
+
257
+ ### Changed
258
+
259
+ - Add `options` to the unstake method ([#69](https://github.com/MetaMask/snap-tron-wallet/pull/69))
260
+
261
+ ## [1.6.1]
262
+
263
+ ### Fixed
264
+
265
+ - Use the correct `index` field instead of `groupIndex` for account creation ([#67](https://github.com/MetaMask/snap-tron-wallet/pull/67))
266
+
267
+ ## [1.6.0]
268
+
269
+ ### Added
270
+
271
+ - Implement `setSelectedAccounts` handler ([#63](https://github.com/MetaMask/snap-tron-wallet/pull/63))
272
+
273
+ ### Fixed
274
+
275
+ - Adjust `timestamp` fields' precision to be in seconds, not milliseconds ([#64](https://github.com/MetaMask/snap-tron-wallet/pull/64))
276
+
277
+ ## [1.5.4]
278
+
279
+ ### Fixed
280
+
281
+ - Use the correct hexadecimal format private key (excluding the `0x` prefix) when using TronWeb ([#61](https://github.com/MetaMask/snap-tron-wallet/pull/61))
282
+
283
+ ## [1.5.3]
284
+
285
+ ### Fixed
286
+
287
+ - Make field `visible` configurable by caller on the `signAndSendTransaction` handler ([#59](https://github.com/MetaMask/snap-tron-wallet/pull/59))
288
+
289
+ ## [1.5.2]
290
+
291
+ ### Fixed
292
+
293
+ - Add missing fields on `signAndSendTransaction`'s payload for Tron ([#57](https://github.com/MetaMask/snap-tron-wallet/pull/57))
294
+
295
+ ## [1.5.1]
296
+
297
+ ### Changed
298
+
299
+ - Send the metadata for the max bandwidth and energy values ([#55](https://github.com/MetaMask/snap-tron-wallet/pull/55))
300
+ - Modify `signAndSendTransaction` to properly handle base64 transactions ([#54](https://github.com/MetaMask/snap-tron-wallet/pull/54))
301
+
302
+ ## [1.5.0]
303
+
304
+ ### Added
305
+
306
+ - Implement staking and unstaking handlers ([#46](https://github.com/MetaMask/snap-tron-wallet/pull/46))
307
+
308
+ ### Changed
309
+
310
+ - Match the new Keyring `createAccount` spec ([#52](https://github.com/MetaMask/snap-tron-wallet/pull/52))
311
+ - Implement safe error handling so that the Snap never crashes ([#51](https://github.com/MetaMask/snap-tron-wallet/pull/51))
312
+
313
+ ## [1.4.0]
314
+
315
+ ### Fixed
316
+
317
+ - Edit assets names and balance decimals ([#49](https://github.com/MetaMask/snap-tron-wallet/pull/49))
318
+ - Send maximum Bandwidth and Energy as assets ([#42](https://github.com/MetaMask/snap-tron-wallet/pull/42))
319
+
320
+ ## [1.3.0]
321
+
322
+ ### Added
323
+
324
+ - Add missing "sync transactions" background event ([#44](https://github.com/MetaMask/snap-tron-wallet/pull/44))
325
+ - Implement account synchronization when transactions happen ([#38](https://github.com/MetaMask/snap-tron-wallet/pull/38))
326
+ - Add new required fields to KeyringAccount objects ([#41](https://github.com/MetaMask/snap-tron-wallet/pull/41))
327
+ - Implement `computeFee` handler ([#40](https://github.com/MetaMask/snap-tron-wallet/pull/40))
328
+
329
+ ## [1.2.0]
330
+
331
+ ### Added
332
+
333
+ - `signAndSendTransaction` client request ([#34](https://github.com/MetaMask/snap-tron-wallet/pull/34))
334
+
335
+ ## [1.1.1]
336
+
337
+ ### Added
338
+
339
+ - Fetch token metadata from Token API instead of Trongrid ([#31](https://github.com/MetaMask/snap-tron-wallet/pull/31))
340
+
341
+ ### Fixed
342
+
343
+ - Price and market data request failures from passing Energy, Bandwidth and other unsupported assets to the API calls directly ([#32](https://github.com/MetaMask/snap-tron-wallet/pull/32))
344
+
345
+ ## [1.1.0]
346
+
347
+ ### Added
348
+
349
+ - Implement "Unified Non-EVM Send" spec ([#28](https://github.com/MetaMask/snap-tron-wallet/pull/28))
350
+ - Send Staked TRX positions as assets ([#29](https://github.com/MetaMask/snap-tron-wallet/pull/29))
351
+ - Send Energy and Bandwidth as assets ([#27](https://github.com/MetaMask/snap-tron-wallet/pull/27))
352
+ - Implement `discoverAccounts` keyring method ([#26](https://github.com/MetaMask/snap-tron-wallet/pull/26))
353
+ - Support Energy and Bandwidth as transaction history fees ([#25](https://github.com/MetaMask/snap-tron-wallet/pull/25))
354
+ - Implement transaction history ([#19](https://github.com/MetaMask/snap-tron-wallet/pull/19))
355
+
356
+ ## [1.0.3]
357
+
358
+ ### Changed
359
+
360
+ - Clean unnecessary values ([#22](https://github.com/MetaMask/snap-tron-wallet/pull/22))
361
+
362
+ ## [1.0.2]
363
+
364
+ ### Changed
365
+
366
+ - Release config update
367
+
368
+ ## [1.0.1]
369
+
370
+ ### Added
371
+
372
+ - Enable corepack ([#17](https://github.com/MetaMask/snap-tron-wallet/pull/17))
373
+
374
+ ## [1.0.0]
375
+
376
+ ### Added
377
+
378
+ - Initial release of Tron wallet snap
379
+ - Support for TRX and token assets balances ([#12](https://github.com/MetaMask/snap-tron-wallet/pull/12))
380
+
381
+ [Unreleased]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.20.0...HEAD
382
+ [1.20.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.19.3...v1.20.0
383
+ [1.19.3]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.19.2...v1.19.3
384
+ [1.19.2]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.19.1...v1.19.2
385
+ [1.19.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.19.0...v1.19.1
386
+ [1.19.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.18.0...v1.19.0
387
+ [1.18.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.17.0...v1.18.0
388
+ [1.17.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.16.1...v1.17.0
389
+ [1.16.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.16.0...v1.16.1
390
+ [1.16.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.15.1...v1.16.0
391
+ [1.15.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.15.0...v1.15.1
392
+ [1.15.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.14.0...v1.15.0
393
+ [1.14.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.13.0...v1.14.0
394
+ [1.13.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.12.1...v1.13.0
395
+ [1.12.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.12.0...v1.12.1
396
+ [1.12.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.11.0...v1.12.0
397
+ [1.11.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.10.1...v1.11.0
398
+ [1.10.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.10.0...v1.10.1
399
+ [1.10.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.9.1...v1.10.0
400
+ [1.9.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.9.0...v1.9.1
401
+ [1.9.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.8.1...v1.9.0
402
+ [1.8.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.8.0...v1.8.1
403
+ [1.8.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.7.4...v1.8.0
404
+ [1.7.4]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.7.3...v1.7.4
405
+ [1.7.3]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.7.2...v1.7.3
406
+ [1.7.2]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.7.1...v1.7.2
407
+ [1.7.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.7.0...v1.7.1
408
+ [1.7.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.6.1...v1.7.0
409
+ [1.6.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.6.0...v1.6.1
410
+ [1.6.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.5.4...v1.6.0
411
+ [1.5.4]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.5.3...v1.5.4
412
+ [1.5.3]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.5.2...v1.5.3
413
+ [1.5.2]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.5.1...v1.5.2
414
+ [1.5.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.5.0...v1.5.1
415
+ [1.5.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.4.0...v1.5.0
416
+ [1.4.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.3.0...v1.4.0
417
+ [1.3.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.2.0...v1.3.0
418
+ [1.2.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.1.1...v1.2.0
419
+ [1.1.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.1.0...v1.1.1
420
+ [1.1.0]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.0.3...v1.1.0
421
+ [1.0.3]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.0.2...v1.0.3
422
+ [1.0.2]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.0.1...v1.0.2
423
+ [1.0.1]: https://github.com/MetaMask/snap-tron-wallet/compare/v1.0.0...v1.0.1
424
+ [1.0.0]: https://github.com/MetaMask/snap-tron-wallet/releases/tag/v1.0.0
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # Tron Snap
2
+
3
+ ## Configuration
4
+
5
+ Rename `.env.example` to `.env`
6
+ Configurations are setup though `.env`,
7
+
8
+ ## API:
9
+
10
+ ### `keyring_createAccount`
11
+
12
+ example:
13
+
14
+ ```typescript
15
+ provider.request({
16
+ method: 'wallet_invokeKeyring',
17
+ params: {
18
+ snapId,
19
+ request: {
20
+ method: 'keyring_createAccount',
21
+ params: {
22
+ scope: 'bip122:000000000933ea01ad0ee984209779ba', // the CAIP-2 chain ID of the network
23
+ addressType: 'bip122:p2wpkh', // the CAIP-like address type
24
+ },
25
+ },
26
+ },
27
+ });
28
+ ```
29
+
30
+ ### `confirmStake`
31
+
32
+ Stakes TRX for bandwidth or energy resources. Votes are automatically allocated to a Super Representative (SR) node after staking.
33
+
34
+ **Parameters:**
35
+
36
+ | Parameter | Type | Required | Description |
37
+ | ----------------------- | ------------------------- | -------- | ------------------------------------------------------------------------------------------------- |
38
+ | `fromAccountId` | `string` | Yes | The UUID of the account to stake from |
39
+ | `assetId` | `string` | Yes | The CAIP-19 asset ID (e.g., `tron:728126428/slip44:195`) |
40
+ | `value` | `string` | Yes | The amount of TRX to stake |
41
+ | `options.purpose` | `'ENERGY' \| 'BANDWIDTH'` | Yes | The resource type to stake for |
42
+ | `options.srNodeAddress` | `string` | No | Optional SR node address to allocate votes to. If not provided, defaults to the Consensys SR node |
43
+
44
+ **Example:**
45
+
46
+ ```typescript
47
+ // Stake with default Consensys SR node
48
+ provider.request({
49
+ method: 'wallet_invokeSnap',
50
+ params: {
51
+ snapId,
52
+ request: {
53
+ method: 'confirmStake',
54
+ params: {
55
+ fromAccountId: 'account-uuid',
56
+ assetId: 'tron:728126428/slip44:195',
57
+ value: '100',
58
+ options: {
59
+ purpose: 'ENERGY',
60
+ },
61
+ },
62
+ },
63
+ },
64
+ });
65
+
66
+ // Stake with custom SR node address
67
+ provider.request({
68
+ method: 'wallet_invokeSnap',
69
+ params: {
70
+ snapId,
71
+ request: {
72
+ method: 'confirmStake',
73
+ params: {
74
+ fromAccountId: 'account-uuid',
75
+ assetId: 'tron:728126428/slip44:195',
76
+ value: '100',
77
+ options: {
78
+ purpose: 'BANDWIDTH',
79
+ srNodeAddress: 'TCustomSRNodeAddress1234567890abc',
80
+ },
81
+ },
82
+ },
83
+ },
84
+ });
85
+ ```