@talken/talkenkit 2.8.4 → 2.8.5

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.
Files changed (99) hide show
  1. package/dist/{AbcCredentialManager-QM2BNLSR.js → AbcCredentialManager-WZBF3GHF.js} +1 -1
  2. package/dist/{abcWallet-4PXYWHYM.js → abcWallet-EOHU5AIB.js} +2 -2
  3. package/dist/{chunk-PS5CBMY5.js → chunk-CUPPBGFC.js} +13 -6
  4. package/dist/{chunk-ZISAJ7BZ.js → chunk-WGSS57V6.js} +998 -453
  5. package/dist/config/networks.d.ts +12 -0
  6. package/dist/gasless/utils/revokeDelegation.d.ts +4 -3
  7. package/dist/index.js +27 -21
  8. package/dist/utils/amount.d.ts +17 -0
  9. package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +3 -3
  10. package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +4 -4
  11. package/dist/wallets/walletConnectors/abcWallet/ProviderError.d.ts +7 -0
  12. package/dist/wallets/walletConnectors/abcWallet/StorageService.js +2 -2
  13. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +5 -5
  14. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +13 -4
  15. package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +19 -18
  16. package/dist/wallets/walletConnectors/abcWallet/abcProvider.d.ts +3 -4
  17. package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +9 -6
  18. package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +21 -19
  19. package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +3 -3
  20. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.d.ts +1 -1
  21. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +13 -4
  22. package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +20 -19
  23. package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.d.ts +18 -1
  24. package/dist/wallets/walletConnectors/abcWallet/abcXrplProvider.js +17 -6
  25. package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +2 -2
  26. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +16 -15
  27. package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +2 -2
  28. package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +3 -3
  29. package/dist/wallets/walletConnectors/abcWallet/api/index.js +21 -20
  30. package/dist/wallets/walletConnectors/abcWallet/api/modules/auth.js +3 -3
  31. package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.d.ts +16 -2
  32. package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.js +9 -8
  33. package/dist/wallets/walletConnectors/abcWallet/api/modules/evm.d.ts +19 -3
  34. package/dist/wallets/walletConnectors/abcWallet/api/modules/evm.js +8 -7
  35. package/dist/wallets/walletConnectors/abcWallet/api/modules/executeBodies.d.ts +79 -0
  36. package/dist/wallets/walletConnectors/abcWallet/api/modules/executeBodies.js +32 -0
  37. package/dist/wallets/walletConnectors/abcWallet/api/modules/signBodies.d.ts +4 -1
  38. package/dist/wallets/walletConnectors/abcWallet/api/modules/signBodies.js +6 -2
  39. package/dist/wallets/walletConnectors/abcWallet/api/modules/signingRefresh.d.ts +6 -2
  40. package/dist/wallets/walletConnectors/abcWallet/api/modules/signingRefresh.js +5 -5
  41. package/dist/wallets/walletConnectors/abcWallet/api/modules/solana.d.ts +9 -3
  42. package/dist/wallets/walletConnectors/abcWallet/api/modules/solana.js +5 -4
  43. package/dist/wallets/walletConnectors/abcWallet/api/modules/tron.d.ts +10 -4
  44. package/dist/wallets/walletConnectors/abcWallet/api/modules/tron.js +13 -2
  45. package/dist/wallets/walletConnectors/abcWallet/api/modules/wallet.js +2 -2
  46. package/dist/wallets/walletConnectors/abcWallet/api/modules/walletscan.js +2 -2
  47. package/dist/wallets/walletConnectors/abcWallet/api/modules/xrp.d.ts +13 -3
  48. package/dist/wallets/walletConnectors/abcWallet/api/modules/xrp.js +13 -2
  49. package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +17 -5
  50. package/dist/wallets/walletConnectors/abcWallet/constants.js +3 -1
  51. package/dist/wallets/walletConnectors/abcWallet/index.js +36 -34
  52. package/dist/wallets/walletConnectors/abcWallet/sendFailure.d.ts +10 -0
  53. package/dist/wallets/walletConnectors/abcWallet/sendFailure.js +7 -0
  54. package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +3 -3
  55. package/dist/wallets/walletConnectors/abcWallet/types/api.types.d.ts +76 -1
  56. package/dist/wallets/walletConnectors/abcWallet/types/config.types.d.ts +4 -0
  57. package/dist/wallets/walletConnectors/abcWallet/types/error.types.d.ts +14 -1
  58. package/dist/wallets/walletConnectors/abcWallet/types/error.types.js +1 -1
  59. package/dist/wallets/walletConnectors/abcWallet/types.js +5 -5
  60. package/dist/wallets/walletConnectors/abcWallet/utils.js +4 -4
  61. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +5 -5
  62. package/dist/wallets/walletConnectors/{chunk-KX3IFHJQ.js → chunk-2M6E3YXU.js} +28 -16
  63. package/dist/wallets/walletConnectors/{chunk-DPYQH3WE.js → chunk-365TL36N.js} +36 -31
  64. package/dist/wallets/walletConnectors/{chunk-CCUNTMLD.js → chunk-4CKIGJZD.js} +8 -8
  65. package/dist/wallets/walletConnectors/{chunk-XQTK7NGN.js → chunk-5SRSGEZR.js} +2 -2
  66. package/dist/wallets/walletConnectors/{chunk-HFW2XV2R.js → chunk-6MZWQBNQ.js} +28 -7
  67. package/dist/wallets/walletConnectors/chunk-6X2XITQP.js +71 -0
  68. package/dist/wallets/walletConnectors/{chunk-F6EG7H2O.js → chunk-743DKBGG.js} +2 -2
  69. package/dist/wallets/walletConnectors/chunk-DFG3BSSC.js +341 -0
  70. package/dist/wallets/walletConnectors/{chunk-ZTIRW7TR.js → chunk-DKMR2ML5.js} +3 -1
  71. package/dist/wallets/walletConnectors/{chunk-TXB6KXPR.js → chunk-DRL2CDHT.js} +24 -22
  72. package/dist/wallets/walletConnectors/{chunk-HXYOWG5P.js → chunk-EGLT3GPM.js} +1 -1
  73. package/dist/wallets/walletConnectors/{chunk-YECMDMEA.js → chunk-F4JUKZBB.js} +3 -3
  74. package/dist/wallets/walletConnectors/chunk-GAJ4FJTW.js +382 -0
  75. package/dist/wallets/walletConnectors/{chunk-UNLWNVSN.js → chunk-GO6HUJTP.js} +39 -10
  76. package/dist/wallets/walletConnectors/{chunk-5E7TNMON.js → chunk-HMIFFMGK.js} +18 -7
  77. package/dist/wallets/walletConnectors/chunk-M4SNNQU2.js +56 -0
  78. package/dist/wallets/walletConnectors/{chunk-6LPMWYFM.js → chunk-MNGSJBPX.js} +31 -14
  79. package/dist/wallets/walletConnectors/{chunk-6HR6CEOY.js → chunk-OMZSFUVN.js} +1 -1
  80. package/dist/wallets/walletConnectors/{chunk-75H6DQT6.js → chunk-OTLPTGHO.js} +1 -1
  81. package/dist/wallets/walletConnectors/{chunk-OEZE4GBQ.js → chunk-P64PMEPU.js} +2 -2
  82. package/dist/wallets/walletConnectors/{chunk-F6AHT6K4.js → chunk-PL56SINL.js} +1 -1
  83. package/dist/wallets/walletConnectors/{chunk-YUBS7MJ6.js → chunk-RSR35XOZ.js} +47 -12
  84. package/dist/wallets/walletConnectors/{chunk-5SHN7JNR.js → chunk-SORKIBWX.js} +1 -1
  85. package/dist/wallets/walletConnectors/{chunk-CIAVEXOY.js → chunk-SUPFF4EQ.js} +37 -811
  86. package/dist/wallets/walletConnectors/{chunk-BUAWEYGV.js → chunk-TP4BDK7W.js} +5 -1
  87. package/dist/wallets/walletConnectors/{chunk-FWKMNVWU.js → chunk-TRFREYPH.js} +1 -1
  88. package/dist/wallets/walletConnectors/{chunk-RQYBKCWA.js → chunk-UHVJ6AF6.js} +1 -1
  89. package/dist/wallets/walletConnectors/{chunk-ZITVWA4X.js → chunk-V6R6WDOQ.js} +1 -1
  90. package/dist/wallets/walletConnectors/chunk-XGQUYXTL.js +1215 -0
  91. package/dist/wallets/walletConnectors/{chunk-7GBAUSQJ.js → chunk-XPZCOEQL.js} +13 -6
  92. package/dist/wallets/walletConnectors/{chunk-QTBJ6WNZ.js → chunk-YPMD3ZHF.js} +33 -18
  93. package/dist/wallets/walletConnectors/chunk-Z66ETAKN.js +20 -0
  94. package/dist/wallets/walletConnectors/{chunk-HMMEOZDT.js → chunk-ZBI7MSWF.js} +5 -5
  95. package/dist/wallets/walletConnectors/chunk-ZWIAZOVB.js +58 -0
  96. package/dist/wallets/walletConnectors/index.js +51 -50
  97. package/package.json +1 -1
  98. package/dist/wallets/walletConnectors/chunk-6BHMNR5X.js +0 -46
  99. package/dist/wallets/walletConnectors/chunk-FLBJ7T4Q.js +0 -44
@@ -0,0 +1,1215 @@
1
+ "use client";
2
+ import {
3
+ badRequest,
4
+ compact
5
+ } from "./chunk-DKMR2ML5.js";
6
+ import {
7
+ TalkenApiError
8
+ } from "./chunk-TP4BDK7W.js";
9
+
10
+ // src/config/networks.ts
11
+ var NETWORK_CONFIGS = {
12
+ // Ethereum Mainnet
13
+ 1: {
14
+ chainId: 1,
15
+ network: "ethereum",
16
+ name: "Ethereum",
17
+ type: "EVM" /* EVM */,
18
+ isTestnet: false,
19
+ explorer: "https://etherscan.io",
20
+ website: "https://ethereum.org",
21
+ nativeCurrency: {
22
+ name: "Ether",
23
+ symbol: "ETH",
24
+ decimals: 18
25
+ },
26
+ apiSupport: { tokens: true, nft: true, transactions: true },
27
+ signSupport: { legacy: true, eip1559: true }
28
+ },
29
+ // Ethereum Sepolia Testnet
30
+ 11155111: {
31
+ chainId: 11155111,
32
+ network: "ethereum_sepolia",
33
+ name: "Ethereum Sepolia",
34
+ type: "EVM" /* EVM */,
35
+ isTestnet: true,
36
+ explorer: "https://sepolia.etherscan.io",
37
+ website: "https://ethereum.org",
38
+ nativeCurrency: {
39
+ name: "Sepolia Ether",
40
+ symbol: "ETH",
41
+ decimals: 18
42
+ },
43
+ apiSupport: { tokens: true, nft: true, transactions: true },
44
+ signSupport: { legacy: true, eip1559: true }
45
+ },
46
+ // Ethereum Holesky Testnet
47
+ 17e3: {
48
+ chainId: 17e3,
49
+ network: "ethereum_holesky",
50
+ name: "Ethereum Holesky",
51
+ type: "EVM" /* EVM */,
52
+ isTestnet: true,
53
+ explorer: "https://holesky.etherscan.io",
54
+ website: "https://ethereum.org",
55
+ nativeCurrency: {
56
+ name: "Holesky Ether",
57
+ symbol: "ETH",
58
+ decimals: 18
59
+ },
60
+ apiSupport: { tokens: true, nft: true, transactions: true },
61
+ signSupport: { legacy: true, eip1559: true }
62
+ },
63
+ // Kaia Mainnet (formerly Klaytn)
64
+ 8217: {
65
+ chainId: 8217,
66
+ network: "kaia",
67
+ name: "Kaia Mainnet",
68
+ type: "EVM" /* EVM */,
69
+ isTestnet: false,
70
+ explorer: "https://kaiascan.io",
71
+ website: "https://kaia.io",
72
+ nativeCurrency: {
73
+ name: "Kaia",
74
+ symbol: "KAIA",
75
+ decimals: 18
76
+ },
77
+ apiSupport: { tokens: true, nft: true, transactions: true },
78
+ signSupport: { legacy: true, eip1559: true }
79
+ },
80
+ // Kaia Kairos Testnet
81
+ 1001: {
82
+ chainId: 1001,
83
+ network: "kaia_kairos",
84
+ name: "Kaia Kairos Testnet",
85
+ type: "EVM" /* EVM */,
86
+ isTestnet: true,
87
+ explorer: "https://kairos.kaiascan.io",
88
+ website: "https://kaia.io",
89
+ nativeCurrency: {
90
+ name: "Kaia",
91
+ symbol: "KAIA",
92
+ decimals: 18
93
+ },
94
+ apiSupport: { tokens: true, nft: true, transactions: true },
95
+ signSupport: { legacy: true, eip1559: true }
96
+ },
97
+ // Polygon Mainnet
98
+ 137: {
99
+ chainId: 137,
100
+ network: "polygon",
101
+ name: "Polygon",
102
+ type: "EVM" /* EVM */,
103
+ isTestnet: false,
104
+ explorer: "https://polygonscan.com",
105
+ website: "https://polygon.technology",
106
+ nativeCurrency: {
107
+ name: "MATIC",
108
+ symbol: "MATIC",
109
+ decimals: 18
110
+ },
111
+ apiSupport: { tokens: true, nft: true, transactions: true },
112
+ signSupport: { legacy: true, eip1559: true }
113
+ },
114
+ // Polygon Amoy Testnet
115
+ 80002: {
116
+ chainId: 80002,
117
+ network: "polygon_amoy",
118
+ name: "Polygon Amoy Testnet",
119
+ type: "EVM" /* EVM */,
120
+ isTestnet: true,
121
+ explorer: "https://amoy.polygonscan.com",
122
+ website: "https://polygon.technology",
123
+ nativeCurrency: {
124
+ name: "MATIC",
125
+ symbol: "MATIC",
126
+ decimals: 18
127
+ },
128
+ apiSupport: { tokens: true, nft: true, transactions: true },
129
+ signSupport: { legacy: true, eip1559: true }
130
+ },
131
+ // Binance Smart Chain Mainnet
132
+ 56: {
133
+ chainId: 56,
134
+ network: "binance",
135
+ name: "Binance Smart Chain Mainnet",
136
+ type: "EVM" /* EVM */,
137
+ isTestnet: false,
138
+ explorer: "https://bscscan.com",
139
+ website: "https://www.bnbchain.org/en/bnb-smart-chain",
140
+ nativeCurrency: {
141
+ name: "BNB",
142
+ symbol: "BNB",
143
+ decimals: 18
144
+ },
145
+ apiSupport: { tokens: true, nft: true, transactions: true },
146
+ signSupport: { legacy: true, eip1559: true }
147
+ },
148
+ // Binance Smart Chain Testnet
149
+ 97: {
150
+ chainId: 97,
151
+ network: "binance_testnet",
152
+ name: "Binance Smart Chain Testnet",
153
+ type: "EVM" /* EVM */,
154
+ isTestnet: true,
155
+ explorer: "https://testnet.bscscan.com",
156
+ website: "https://www.bnbchain.org/en/bnb-smart-chain",
157
+ nativeCurrency: {
158
+ name: "BNB",
159
+ symbol: "BNB",
160
+ decimals: 18
161
+ },
162
+ apiSupport: { tokens: true, nft: true, transactions: true },
163
+ signSupport: { legacy: true, eip1559: true }
164
+ },
165
+ // Arbitrum One
166
+ 42161: {
167
+ chainId: 42161,
168
+ network: "arbitrum",
169
+ name: "Arbitrum One",
170
+ type: "EVM" /* EVM */,
171
+ isTestnet: false,
172
+ explorer: "https://arbiscan.io",
173
+ website: "https://arbitrum.io",
174
+ nativeCurrency: {
175
+ name: "Ether",
176
+ symbol: "ETH",
177
+ decimals: 18
178
+ },
179
+ apiSupport: { tokens: true, nft: true, transactions: true },
180
+ signSupport: { legacy: true, eip1559: true }
181
+ },
182
+ // Arbitrum Sepolia
183
+ 421614: {
184
+ chainId: 421614,
185
+ network: "arbitrum_sepolia",
186
+ name: "Arbitrum Sepolia",
187
+ type: "EVM" /* EVM */,
188
+ isTestnet: true,
189
+ explorer: "https://sepolia.arbiscan.io",
190
+ website: "https://arbitrum.io",
191
+ nativeCurrency: {
192
+ name: "Ether",
193
+ symbol: "ETH",
194
+ decimals: 18
195
+ },
196
+ apiSupport: { tokens: true, nft: true, transactions: true },
197
+ signSupport: { legacy: true, eip1559: true }
198
+ },
199
+ // Optimism Mainnet
200
+ 10: {
201
+ chainId: 10,
202
+ network: "optimism",
203
+ name: "Optimism",
204
+ type: "EVM" /* EVM */,
205
+ isTestnet: false,
206
+ explorer: "https://optimistic.etherscan.io",
207
+ website: "https://optimism.io",
208
+ nativeCurrency: {
209
+ name: "Ether",
210
+ symbol: "ETH",
211
+ decimals: 18
212
+ },
213
+ apiSupport: { tokens: true, nft: true, transactions: true },
214
+ signSupport: { legacy: true, eip1559: true }
215
+ },
216
+ // Optimism Sepolia
217
+ 420: {
218
+ chainId: 420,
219
+ network: "optimism_sepolia",
220
+ name: "Optimism Sepolia",
221
+ type: "EVM" /* EVM */,
222
+ isTestnet: true,
223
+ explorer: "https://sepolia-optimism.etherscan.io",
224
+ website: "https://optimism.io",
225
+ nativeCurrency: {
226
+ name: "Ether",
227
+ symbol: "ETH",
228
+ decimals: 18
229
+ },
230
+ apiSupport: { tokens: true, nft: true, transactions: true },
231
+ signSupport: { legacy: true, eip1559: true }
232
+ },
233
+ // Avalanche C-Chain
234
+ 43114: {
235
+ chainId: 43114,
236
+ network: "avalanche",
237
+ name: "Avalanche C-Chain",
238
+ type: "EVM" /* EVM */,
239
+ isTestnet: false,
240
+ explorer: "https://avascan.info/blockchain/c/home",
241
+ website: "https://avax.network",
242
+ nativeCurrency: {
243
+ name: "Avalanche",
244
+ symbol: "AVAX",
245
+ decimals: 18
246
+ },
247
+ apiSupport: { tokens: true, nft: true, transactions: true },
248
+ signSupport: { legacy: true, eip1559: true }
249
+ },
250
+ // Avalanche Fuji Testnet
251
+ 43113: {
252
+ chainId: 43113,
253
+ network: "avalanche_fuji",
254
+ name: "Avalanche Fuji Testnet",
255
+ type: "EVM" /* EVM */,
256
+ isTestnet: true,
257
+ explorer: "https://testnet.avascan.info",
258
+ website: "https://avax.network",
259
+ nativeCurrency: {
260
+ name: "Avalanche",
261
+ symbol: "AVAX",
262
+ decimals: 18
263
+ },
264
+ apiSupport: { tokens: false, nft: false, transactions: false },
265
+ signSupport: { legacy: true, eip1559: true }
266
+ },
267
+ // Mantle Mainnet
268
+ 5e3: {
269
+ chainId: 5e3,
270
+ network: "mantle",
271
+ name: "Mantle Mainnet",
272
+ type: "EVM" /* EVM */,
273
+ isTestnet: false,
274
+ explorer: "https://explorer.mantle.xyz",
275
+ website: "https://www.mantle.xyz",
276
+ nativeCurrency: {
277
+ name: "Mantle",
278
+ symbol: "MNT",
279
+ decimals: 18
280
+ },
281
+ apiSupport: { tokens: true, nft: true, transactions: true },
282
+ signSupport: { legacy: true, eip1559: true }
283
+ },
284
+ // Mantle Testnet
285
+ 5001: {
286
+ chainId: 5001,
287
+ network: "mantle_testnet",
288
+ name: "Mantle Testnet",
289
+ type: "EVM" /* EVM */,
290
+ isTestnet: true,
291
+ explorer: "https://sepolia.mantlescan.xyz",
292
+ website: "https://www.mantle.xyz",
293
+ nativeCurrency: {
294
+ name: "Mantle",
295
+ symbol: "MNT",
296
+ decimals: 18
297
+ },
298
+ apiSupport: { tokens: true, nft: true, transactions: true },
299
+ signSupport: { legacy: true, eip1559: true }
300
+ },
301
+ // Moonbeam
302
+ 1284: {
303
+ chainId: 1284,
304
+ network: "moonbeam",
305
+ name: "Moonbeam",
306
+ type: "EVM" /* EVM */,
307
+ isTestnet: false,
308
+ explorer: "https://moonbeam.moonscan.io",
309
+ website: "https://moonbeam.network",
310
+ nativeCurrency: {
311
+ name: "Glimmer",
312
+ symbol: "GLMR",
313
+ decimals: 18
314
+ },
315
+ apiSupport: { tokens: true, nft: true, transactions: true },
316
+ signSupport: { legacy: true, eip1559: true }
317
+ },
318
+ // Moonriver
319
+ 1285: {
320
+ chainId: 1285,
321
+ network: "moonriver",
322
+ name: "Moonriver",
323
+ type: "EVM" /* EVM */,
324
+ isTestnet: false,
325
+ explorer: "https://moonriver.moonscan.io",
326
+ website: "https://moonbeam.network/networks/moonriver",
327
+ nativeCurrency: {
328
+ name: "Moonriver",
329
+ symbol: "MOVR",
330
+ decimals: 18
331
+ },
332
+ apiSupport: { tokens: true, nft: true, transactions: true },
333
+ signSupport: { legacy: true, eip1559: true }
334
+ },
335
+ // Scroll Mainnet
336
+ 534352: {
337
+ chainId: 534352,
338
+ network: "scroll",
339
+ name: "Scroll",
340
+ type: "EVM" /* EVM */,
341
+ isTestnet: false,
342
+ explorer: "https://scrollscan.co",
343
+ website: "https://scroll.io",
344
+ nativeCurrency: {
345
+ name: "Ether",
346
+ symbol: "ETH",
347
+ decimals: 18
348
+ },
349
+ apiSupport: { tokens: true, nft: true, transactions: true },
350
+ signSupport: { legacy: true, eip1559: true }
351
+ },
352
+ // Scroll Testnet
353
+ 534351: {
354
+ chainId: 534351,
355
+ network: "scroll_testnet",
356
+ name: "Scroll Testnet",
357
+ type: "EVM" /* EVM */,
358
+ isTestnet: true,
359
+ explorer: "https://sepolia.scrollscan.com",
360
+ website: "https://scroll.io",
361
+ nativeCurrency: {
362
+ name: "Ether",
363
+ symbol: "ETH",
364
+ decimals: 18
365
+ },
366
+ apiSupport: { tokens: true, nft: true, transactions: true },
367
+ signSupport: { legacy: true, eip1559: true }
368
+ },
369
+ // Silicon Mainnet
370
+ 2355: {
371
+ chainId: 2355,
372
+ network: "silicon",
373
+ name: "Silicon",
374
+ type: "EVM" /* EVM */,
375
+ isTestnet: false,
376
+ explorer: "https://scope.silicon.network",
377
+ website: "https://silicon.network",
378
+ nativeCurrency: {
379
+ name: "Ether",
380
+ symbol: "ETH",
381
+ decimals: 18
382
+ },
383
+ apiSupport: { tokens: true, nft: true, transactions: true },
384
+ signSupport: { legacy: true, eip1559: true }
385
+ },
386
+ // Silicon Sepolia
387
+ 1722641160: {
388
+ chainId: 1722641160,
389
+ network: "silicon_sepolia",
390
+ name: "Silicon Sepolia",
391
+ type: "EVM" /* EVM */,
392
+ isTestnet: true,
393
+ explorer: "https://scope-sepolia.silicon.network",
394
+ website: "https://silicon.network",
395
+ nativeCurrency: {
396
+ name: "Ether",
397
+ symbol: "ETH",
398
+ decimals: 18
399
+ },
400
+ apiSupport: { tokens: true, nft: true, transactions: true },
401
+ signSupport: { legacy: true, eip1559: true }
402
+ },
403
+ // Six Protocol
404
+ 98: {
405
+ chainId: 98,
406
+ network: "six_evm",
407
+ name: "Six Protocol",
408
+ type: "EVM" /* EVM */,
409
+ isTestnet: false,
410
+ explorer: "https://v2.sixscan.io",
411
+ website: "https://www.six.network",
412
+ nativeCurrency: {
413
+ name: "SIX",
414
+ symbol: "SIX",
415
+ decimals: 18
416
+ },
417
+ apiSupport: { tokens: true, nft: false, transactions: true },
418
+ signSupport: { legacy: true, eip1559: false }
419
+ },
420
+ // Six Protocol Testnet
421
+ 150: {
422
+ chainId: 150,
423
+ network: "six_evm_testnet",
424
+ name: "Six Protocol Testnet",
425
+ type: "EVM" /* EVM */,
426
+ isTestnet: true,
427
+ explorer: "https://v2.fivenet.sixscan.io",
428
+ website: "https://www.six.network",
429
+ nativeCurrency: {
430
+ name: "SIX",
431
+ symbol: "SIX",
432
+ decimals: 18
433
+ },
434
+ apiSupport: { tokens: true, nft: false, transactions: true },
435
+ signSupport: { legacy: true, eip1559: false }
436
+ },
437
+ // Wemix Mainnet
438
+ 1111: {
439
+ chainId: 1111,
440
+ network: "wemix",
441
+ name: "Wemix3.0 Mainnet",
442
+ type: "EVM" /* EVM */,
443
+ isTestnet: false,
444
+ explorer: "https://explorer.wemix.com",
445
+ website: "https://wemix.com",
446
+ nativeCurrency: {
447
+ name: "WEMIX",
448
+ symbol: "WEMIX",
449
+ decimals: 18
450
+ },
451
+ apiSupport: { tokens: true, nft: true, transactions: true },
452
+ signSupport: { legacy: true, eip1559: true }
453
+ },
454
+ // Wemix Testnet
455
+ 1112: {
456
+ chainId: 1112,
457
+ network: "wemix_testnet",
458
+ name: "Wemix3.0 Testnet",
459
+ type: "EVM" /* EVM */,
460
+ isTestnet: true,
461
+ explorer: "https://explorer.test.wemix.com",
462
+ website: "https://wemix.com",
463
+ nativeCurrency: {
464
+ name: "WEMIX",
465
+ symbol: "WEMIX",
466
+ decimals: 18
467
+ },
468
+ apiSupport: { tokens: true, nft: true, transactions: true },
469
+ signSupport: { legacy: true, eip1559: true }
470
+ },
471
+ // Taiko Mainnet
472
+ 167e3: {
473
+ chainId: 167e3,
474
+ network: "taiko",
475
+ name: "Taiko Mainnet",
476
+ type: "EVM" /* EVM */,
477
+ isTestnet: false,
478
+ explorer: "https://taikoscan.io",
479
+ website: "https://taiko.xyz",
480
+ nativeCurrency: {
481
+ name: "Ether",
482
+ symbol: "ETH",
483
+ decimals: 18
484
+ },
485
+ apiSupport: { tokens: true, nft: true, transactions: true },
486
+ signSupport: { legacy: true, eip1559: true }
487
+ },
488
+ // Taiko Hekla Testnet
489
+ 167009: {
490
+ chainId: 167009,
491
+ network: "taiko_hekla",
492
+ name: "Taiko Hekla Testnet",
493
+ type: "EVM" /* EVM */,
494
+ isTestnet: true,
495
+ explorer: "https://hekla.taikoscan.io",
496
+ website: "https://taiko.xyz",
497
+ nativeCurrency: {
498
+ name: "Ether",
499
+ symbol: "ETH",
500
+ decimals: 18
501
+ },
502
+ apiSupport: { tokens: true, nft: true, transactions: true },
503
+ signSupport: { legacy: true, eip1559: true }
504
+ },
505
+ // Base Mainnet
506
+ 8453: {
507
+ chainId: 8453,
508
+ network: "base",
509
+ name: "Base",
510
+ type: "EVM" /* EVM */,
511
+ isTestnet: false,
512
+ explorer: "https://basescan.org",
513
+ website: "https://base.org",
514
+ nativeCurrency: {
515
+ name: "Ether",
516
+ symbol: "ETH",
517
+ decimals: 18
518
+ },
519
+ apiSupport: { tokens: true, nft: true, transactions: true },
520
+ signSupport: { legacy: true, eip1559: true }
521
+ },
522
+ // Base Sepolia Testnet
523
+ 84532: {
524
+ chainId: 84532,
525
+ network: "base_sepolia",
526
+ name: "Base Sepolia",
527
+ type: "EVM" /* EVM */,
528
+ isTestnet: true,
529
+ explorer: "https://sepolia.basescan.org",
530
+ website: "https://base.org",
531
+ nativeCurrency: {
532
+ name: "Ether",
533
+ symbol: "ETH",
534
+ decimals: 18
535
+ },
536
+ apiSupport: { tokens: true, nft: true, transactions: true },
537
+ signSupport: { legacy: true, eip1559: true }
538
+ },
539
+ // ChainBounty Mainnet
540
+ 51828: {
541
+ chainId: 51828,
542
+ network: "chainbounty",
543
+ name: "ChainBounty Mainnet",
544
+ type: "EVM" /* EVM */,
545
+ isTestnet: false,
546
+ explorer: "https://scan.chainbounty.io",
547
+ website: "https://chainbounty.io",
548
+ nativeCurrency: {
549
+ name: "ChainBounty",
550
+ symbol: "CBY",
551
+ decimals: 18
552
+ },
553
+ apiSupport: { tokens: true, nft: true, transactions: true },
554
+ signSupport: { legacy: true, eip1559: true }
555
+ },
556
+ // ChainBounty Testnet
557
+ 56580: {
558
+ chainId: 56580,
559
+ network: "chainbounty_testnet",
560
+ name: "ChainBounty Testnet",
561
+ type: "EVM" /* EVM */,
562
+ isTestnet: true,
563
+ explorer: "https://test.scan.chainbounty.io",
564
+ website: "https://chainbounty.io",
565
+ nativeCurrency: {
566
+ name: "ChainBounty",
567
+ symbol: "CBY",
568
+ decimals: 18
569
+ },
570
+ apiSupport: { tokens: true, nft: true, transactions: true },
571
+ signSupport: { legacy: true, eip1559: true }
572
+ },
573
+ // Aptos Mainnet (Non-EVM)
574
+ aptos: {
575
+ chainId: null,
576
+ network: "aptos",
577
+ name: "Aptos",
578
+ type: "Non-EVM" /* NON_EVM */,
579
+ isTestnet: false,
580
+ explorer: "https://explorer.aptoslabs.com/?network=mainnet",
581
+ website: "https://aptos.dev",
582
+ nativeCurrency: {
583
+ name: "Aptos",
584
+ symbol: "APT",
585
+ decimals: 8
586
+ },
587
+ apiSupport: { tokens: true, nft: true, transactions: true },
588
+ signSupport: { legacy: true, eip1559: false }
589
+ },
590
+ // Aptos Testnet (Non-EVM)
591
+ aptos_testnet: {
592
+ chainId: null,
593
+ network: "aptos_testnet",
594
+ name: "Aptos Testnet",
595
+ type: "Non-EVM" /* NON_EVM */,
596
+ isTestnet: true,
597
+ explorer: "https://explorer.aptoslabs.com/?network=testnet",
598
+ website: "https://aptos.dev",
599
+ nativeCurrency: {
600
+ name: "Aptos",
601
+ symbol: "APT",
602
+ decimals: 8
603
+ },
604
+ apiSupport: { tokens: true, nft: true, transactions: true },
605
+ signSupport: { legacy: true, eip1559: false }
606
+ },
607
+ // Bitcoin Mainnet
608
+ bitcoin: {
609
+ chainId: null,
610
+ network: "bitcoin",
611
+ name: "Bitcoin Mainnet",
612
+ type: "Bitcoin" /* BITCOIN */,
613
+ isTestnet: false,
614
+ explorer: "https://blockstream.info",
615
+ website: "https://bitcoin.org",
616
+ nativeCurrency: {
617
+ name: "Bitcoin",
618
+ symbol: "BTC",
619
+ decimals: 8
620
+ },
621
+ apiSupport: { tokens: true, nft: false, transactions: true },
622
+ signSupport: { legacy: true, eip1559: false }
623
+ },
624
+ // Bitcoin Testnet
625
+ bitcoin_testnet: {
626
+ chainId: null,
627
+ network: "bitcoin_testnet",
628
+ name: "Bitcoin Testnet",
629
+ type: "Bitcoin" /* BITCOIN */,
630
+ isTestnet: true,
631
+ explorer: "https://blockstream.info/testnet",
632
+ website: "https://bitcoin.org",
633
+ nativeCurrency: {
634
+ name: "Bitcoin",
635
+ symbol: "BTC",
636
+ decimals: 8
637
+ },
638
+ apiSupport: { tokens: true, nft: false, transactions: true },
639
+ signSupport: { legacy: true, eip1559: false }
640
+ },
641
+ // Tron Mainnet
642
+ tron: {
643
+ chainId: null,
644
+ network: "tron",
645
+ name: "Tron Mainnet",
646
+ type: "TRX" /* TRON */,
647
+ isTestnet: false,
648
+ explorer: "https://tronscan.org",
649
+ website: "https://tron.network",
650
+ nativeCurrency: {
651
+ name: "Tronix",
652
+ symbol: "TRX",
653
+ decimals: 6
654
+ },
655
+ apiSupport: { tokens: true, nft: true, transactions: true },
656
+ signSupport: { legacy: true, eip1559: true }
657
+ },
658
+ // Tron Nile Testnet
659
+ tron_nile: {
660
+ chainId: null,
661
+ network: "tron_nile",
662
+ name: "Tron Nile Testnet",
663
+ type: "TRX" /* TRON */,
664
+ isTestnet: true,
665
+ explorer: "https://nile.tronscan.org",
666
+ website: "https://tron.network",
667
+ nativeCurrency: {
668
+ name: "Tronix",
669
+ symbol: "TRX",
670
+ decimals: 6
671
+ },
672
+ apiSupport: { tokens: true, nft: true, transactions: true },
673
+ signSupport: { legacy: true, eip1559: true }
674
+ },
675
+ // ICP Mainnet
676
+ icp: {
677
+ chainId: null,
678
+ network: "icp",
679
+ name: "Internet Computer",
680
+ type: "ICP" /* ICP */,
681
+ isTestnet: false,
682
+ explorer: "https://dashboard.internetcomputer.org",
683
+ website: "https://internetcomputer.org",
684
+ nativeCurrency: {
685
+ name: "ICP",
686
+ symbol: "ICP",
687
+ decimals: 8
688
+ },
689
+ apiSupport: { tokens: true, nft: true, transactions: true },
690
+ signSupport: { legacy: true, eip1559: true }
691
+ },
692
+ // XRP
693
+ xrpl: {
694
+ chainId: null,
695
+ network: "xrpl",
696
+ name: "XRP",
697
+ type: "XRPL" /* XRPL */,
698
+ isTestnet: false,
699
+ explorer: "https://xrpscan.com",
700
+ website: "https://xrpl.org",
701
+ nativeCurrency: {
702
+ name: "XRP",
703
+ symbol: "XRP",
704
+ decimals: 6
705
+ },
706
+ apiSupport: { tokens: true, nft: true, transactions: true },
707
+ signSupport: { legacy: true, eip1559: false }
708
+ },
709
+ // XRP Testnet
710
+ xrpl_testnet: {
711
+ chainId: null,
712
+ network: "xrpl_testnet",
713
+ name: "XRP Testnet",
714
+ type: "XRPL" /* XRPL */,
715
+ isTestnet: true,
716
+ explorer: "https://testnet.xrpscan.com",
717
+ website: "https://xrpl.org",
718
+ nativeCurrency: {
719
+ name: "XRP",
720
+ symbol: "XRP",
721
+ decimals: 6
722
+ },
723
+ apiSupport: { tokens: true, nft: true, transactions: true },
724
+ signSupport: { legacy: true, eip1559: false }
725
+ }
726
+ };
727
+ var NETWORK_BY_PARAM = Object.values(
728
+ NETWORK_CONFIGS
729
+ ).reduce(
730
+ (acc, config) => {
731
+ acc[config.network] = config;
732
+ return acc;
733
+ },
734
+ {}
735
+ );
736
+ function getNetworkByChainId(chainId) {
737
+ return NETWORK_CONFIGS[chainId];
738
+ }
739
+ function getNetworkByParam(network) {
740
+ return NETWORK_BY_PARAM[network];
741
+ }
742
+ function getNetworkName(chainId, fallback = "ethereum") {
743
+ return NETWORK_CONFIGS[chainId]?.network ?? fallback;
744
+ }
745
+ var CHAIN_ID_TO_KEY = {
746
+ // Mainnet
747
+ 1: "ethereum",
748
+ 42161: "arbitrum",
749
+ 8217: "kaia",
750
+ 56: "bsc",
751
+ 8453: "base",
752
+ 137: "polygon",
753
+ 43114: "avalanche",
754
+ 5e3: "mantle",
755
+ 51828: "chainbounty",
756
+ // Testnet
757
+ 11155111: "sepolia",
758
+ 421614: "arbitrumSepolia",
759
+ 1001: "kaiaKairos",
760
+ 97: "bscTestnet",
761
+ 84532: "baseSepolia",
762
+ 80002: "polygonAmoy",
763
+ 43113: "avalancheFuji",
764
+ 5003: "mantleSepolia",
765
+ 56580: "chainbountyTestnet",
766
+ 998: "hyperevmTestnet"
767
+ };
768
+ var NON_EVM_CHAIN_KEY = {
769
+ solana: "solana",
770
+ solana_devnet: "solanaDevnet",
771
+ bitcoin: "bitcoin",
772
+ bitcoin_testnet: "bitcoinTestnet",
773
+ tron: "tron",
774
+ tron_nile: "tronNile",
775
+ xrpl: "xrpl",
776
+ xrpl_testnet: "xrplTestnet"
777
+ };
778
+ function getChainKey(chainId) {
779
+ const key = CHAIN_ID_TO_KEY[chainId];
780
+ if (!key) {
781
+ throw new Error(`Unsupported chainId for tx endpoint: ${chainId}`);
782
+ }
783
+ return key;
784
+ }
785
+ function getNetworkType(network) {
786
+ const byParam = NETWORK_BY_PARAM[network];
787
+ if (byParam)
788
+ return byParam.type;
789
+ const nonEvmParam = Object.keys(NON_EVM_CHAIN_KEY).find(
790
+ (param) => NON_EVM_CHAIN_KEY[param] === network
791
+ );
792
+ if (nonEvmParam)
793
+ return NETWORK_BY_PARAM[nonEvmParam]?.type ?? "Non-EVM" /* NON_EVM */;
794
+ if (Object.values(CHAIN_ID_TO_KEY).includes(network))
795
+ return "EVM" /* EVM */;
796
+ return void 0;
797
+ }
798
+ function getEvmChainKey(network) {
799
+ const chainId = NETWORK_BY_PARAM[network]?.chainId;
800
+ if (chainId != null)
801
+ return CHAIN_ID_TO_KEY[chainId];
802
+ return Object.values(CHAIN_ID_TO_KEY).includes(network) ? network : void 0;
803
+ }
804
+ function getExplorerTxUrl(chainIdOrNetwork, txHash) {
805
+ const config = typeof chainIdOrNetwork === "number" ? getNetworkByChainId(chainIdOrNetwork) : getNetworkByParam(chainIdOrNetwork);
806
+ if (!config) {
807
+ throw new Error(`Unknown network: ${chainIdOrNetwork}`);
808
+ }
809
+ return `${config.explorer}/tx/${txHash}`;
810
+ }
811
+
812
+ // src/utils/amount.ts
813
+ var MAX_DECIMALS = 255;
814
+ var U64_MAX = BigInt("18446744073709551615");
815
+ var ZERO = BigInt(0);
816
+ var TEN = BigInt(10);
817
+ var CANONICAL_DECIMAL = /^(0|[1-9]\d*)(\.\d+)?$/;
818
+ var BASE_UNIT_INTEGER = /^(0|[1-9]\d*)$/;
819
+ function validateAmount(amount) {
820
+ if (typeof amount === "string") {
821
+ if (!CANONICAL_DECIMAL.test(amount))
822
+ throw new Error(
823
+ "Token amount must be a plain decimal string (no sign, exponent or separators)"
824
+ );
825
+ if (!/[1-9]/.test(amount))
826
+ throw new Error("Token amount must be finite and positive");
827
+ return;
828
+ }
829
+ if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0)
830
+ throw new Error("Token amount must be finite and positive");
831
+ }
832
+ function isValidDecimals(decimals) {
833
+ return decimals !== void 0 && Number.isInteger(decimals) && decimals >= 0 && decimals <= MAX_DECIMALS;
834
+ }
835
+ function assertDecimals(decimals) {
836
+ if (!isValidDecimals(decimals))
837
+ throw new Error("Token decimals are missing or invalid");
838
+ }
839
+ function splitAmount(amount) {
840
+ const [coefficient, exponent = "0"] = String(amount).toLowerCase().split("e");
841
+ const [whole, fraction = ""] = coefficient.split(".");
842
+ return {
843
+ digits: BigInt(`${whole}${fraction}`),
844
+ fractionLength: fraction.length,
845
+ exponent: Number(exponent)
846
+ };
847
+ }
848
+ function toBaseUnits(amount, decimals) {
849
+ validateAmount(amount);
850
+ assertDecimals(decimals);
851
+ const { digits, fractionLength, exponent } = splitAmount(amount);
852
+ if (typeof amount === "string" && fractionLength > decimals)
853
+ throw new Error(
854
+ `Token amount exceeds decimal precision (${decimals} decimals)`
855
+ );
856
+ const scale = decimals + exponent - fractionLength;
857
+ if (scale >= 0)
858
+ return digits * TEN ** BigInt(scale);
859
+ const divisor = TEN ** BigInt(-scale);
860
+ if (digits % divisor !== ZERO)
861
+ throw new Error(
862
+ `Token amount exceeds decimal precision (${decimals} decimals)`
863
+ );
864
+ return digits / divisor;
865
+ }
866
+ function toDecimalAmount(baseUnits, decimals) {
867
+ assertDecimals(decimals);
868
+ if (typeof baseUnits === "string" && !BASE_UNIT_INTEGER.test(baseUnits))
869
+ throw new Error("Base-unit amount must be a non-negative integer string");
870
+ const value = BigInt(baseUnits);
871
+ if (value <= ZERO)
872
+ throw new Error("Token amount must be finite and positive");
873
+ const unit = TEN ** BigInt(decimals);
874
+ const whole = value / unit;
875
+ const fraction = (value % unit).toString().padStart(decimals, "0").replace(/0+$/, "");
876
+ return fraction ? `${whole}.${fraction}` : whole.toString();
877
+ }
878
+ function toSplRawAmount(amount, decimals) {
879
+ validateAmount(amount);
880
+ if (!isValidDecimals(decimals))
881
+ throw new Error("SPL token decimals are missing or invalid");
882
+ const raw = toBaseUnits(amount, decimals);
883
+ if (raw > U64_MAX)
884
+ throw new Error("Token amount is outside the SPL u64 range");
885
+ return raw;
886
+ }
887
+
888
+ // src/wallets/walletConnectors/abcWallet/api/modules/executeBodies.ts
889
+ var NATIVE_DECIMALS = {
890
+ solana: 9,
891
+ tron: 6,
892
+ xrpl: 6,
893
+ bitcoin: 8
894
+ };
895
+ var MAX_IDEMPOTENCY_KEY_LENGTH = 200;
896
+ var IDEMPOTENCY_KEY_BYTES = 16;
897
+ var BTC_FEE_RATE_PATTERN = /^[1-9][0-9]{0,3}$/;
898
+ var BTC_FEE_RATE_MAX = 1e3;
899
+ var XRP_FEE_PATTERN = /^[1-9][0-9]{0,6}$/;
900
+ var XRP_FEE_MAX_DROPS = 1e6;
901
+ var TRC20_FEE_LIMIT_MAX_SUN = 1e9;
902
+ var XRP_DESTINATION_TAG_MAX = 4294967295;
903
+ var SOLANA_CHAIN_KEYS = { solana: "solana", solana_devnet: "solanaDevnet" };
904
+ var TRON_CHAIN_KEYS = { tron: "tron", tron_nile: "tronNile" };
905
+ var XRPL_CHAIN_KEYS = { xrpl: "xrpl", xrpl_testnet: "xrplTestnet" };
906
+ var BITCOIN_CHAIN_KEYS = {
907
+ bitcoin: "bitcoin",
908
+ bitcoin_testnet: "bitcoinTestnet"
909
+ };
910
+ function newIdempotencyKey() {
911
+ const bytes = crypto.getRandomValues(new Uint8Array(IDEMPOTENCY_KEY_BYTES));
912
+ return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join(
913
+ ""
914
+ );
915
+ }
916
+ function acceptIdempotencyKey(key) {
917
+ if (key === void 0)
918
+ return newIdempotencyKey();
919
+ if (typeof key !== "string" || key === "" || key.length > MAX_IDEMPOTENCY_KEY_LENGTH) {
920
+ throw badRequest(
921
+ `idempotencyKey must be a string of 1 to ${MAX_IDEMPOTENCY_KEY_LENGTH} characters`
922
+ );
923
+ }
924
+ return key;
925
+ }
926
+ function chainKeyFor(label, table, network) {
927
+ if (typeof network === "string" && Object.prototype.hasOwnProperty.call(table, network)) {
928
+ return table[network];
929
+ }
930
+ throw badRequest(
931
+ `${label} network must be one of: ${Object.keys(table).join(", ")}`
932
+ );
933
+ }
934
+ function required(value, field) {
935
+ if (typeof value !== "string" || value === "") {
936
+ throw badRequest(`${field} is required`);
937
+ }
938
+ return value;
939
+ }
940
+ function refuseDefined(params, fields, context) {
941
+ for (const field of fields) {
942
+ if (params[field] != null) {
943
+ throw badRequest(`${field} is not supported ${context}`);
944
+ }
945
+ }
946
+ }
947
+ function humanAmount(baseUnits, decimals, field) {
948
+ try {
949
+ return toDecimalAmount(required(baseUnits, field), decimals);
950
+ } catch (error) {
951
+ if (error instanceof TalkenApiError)
952
+ throw error;
953
+ throw badRequest(
954
+ `${field}: ${error instanceof Error ? error.message : String(error)}`
955
+ );
956
+ }
957
+ }
958
+ function toExecuteTxBody(params) {
959
+ return compact({
960
+ chainKey: params.chainKey,
961
+ to: params.to,
962
+ amountWei: params.amountWei,
963
+ data: params.data,
964
+ gasLimit: params.gasLimit,
965
+ gasPrice: params.gasPrice,
966
+ maxFeePerGas: params.maxFeePerGas,
967
+ maxPriorityFeePerGas: params.maxPriorityFeePerGas,
968
+ pin: params.pin,
969
+ email: params.email,
970
+ waitForReceipt: params.waitForReceipt,
971
+ idempotencyKey: acceptIdempotencyKey(params.idempotencyKey)
972
+ });
973
+ }
974
+ function toSolanaSendBody(params) {
975
+ const chainKey = chainKeyFor("Solana", SOLANA_CHAIN_KEYS, params.network);
976
+ const to = required(params.toAddress, "toAddress");
977
+ const kind = params.kind ?? (params.mintAddress ? "spl" : "native");
978
+ if (kind !== "native" && kind !== "spl") {
979
+ throw badRequest("kind must be native or spl");
980
+ }
981
+ const common = {
982
+ pin: params.pin,
983
+ email: params.email,
984
+ waitForReceipt: params.waitForConfirmation,
985
+ idempotencyKey: acceptIdempotencyKey(params.idempotencyKey)
986
+ };
987
+ if (kind === "native") {
988
+ refuseDefined(
989
+ params,
990
+ ["mintAddress", "amount", "decimals"],
991
+ "for a native SOL transfer"
992
+ );
993
+ return compact({
994
+ to,
995
+ chainKey,
996
+ amount: humanAmount(
997
+ params.amountLamports,
998
+ NATIVE_DECIMALS.solana,
999
+ "amountLamports"
1000
+ ),
1001
+ ...common
1002
+ });
1003
+ }
1004
+ refuseDefined(params, ["amountLamports"], "for an SPL transfer");
1005
+ return compact({
1006
+ to,
1007
+ chainKey,
1008
+ amount: humanAmount(params.amount, params.decimals, "amount"),
1009
+ token: required(params.mintAddress, "mintAddress"),
1010
+ decimals: params.decimals,
1011
+ ...common
1012
+ });
1013
+ }
1014
+ function toTronSendBody(params) {
1015
+ const chainKey = chainKeyFor("TRON", TRON_CHAIN_KEYS, params.network);
1016
+ const to = required(params.toAddress, "toAddress");
1017
+ const kind = params.kind ?? "native";
1018
+ refuseDefined(
1019
+ params,
1020
+ ["data", "callValue", "confirmPollMs", "confirmMaxAttempts"],
1021
+ "by /execute/send"
1022
+ );
1023
+ const common = {
1024
+ pin: params.pin,
1025
+ email: params.email,
1026
+ waitForReceipt: params.waitForConfirmation,
1027
+ idempotencyKey: acceptIdempotencyKey(params.idempotencyKey)
1028
+ };
1029
+ if (kind === "native") {
1030
+ refuseDefined(
1031
+ params,
1032
+ ["contractAddress", "amount", "decimals", "feeLimit"],
1033
+ "for a native TRX transfer"
1034
+ );
1035
+ return compact({
1036
+ to,
1037
+ chainKey,
1038
+ amount: humanAmount(params.amountSun, NATIVE_DECIMALS.tron, "amountSun"),
1039
+ ...common
1040
+ });
1041
+ }
1042
+ if (kind !== "trc20") {
1043
+ throw badRequest("kind must be native or trc20");
1044
+ }
1045
+ refuseDefined(params, ["amountSun"], "for a TRC-20 transfer");
1046
+ if (params.feeLimit != null && !(Number.isSafeInteger(params.feeLimit) && params.feeLimit >= 1 && params.feeLimit <= TRC20_FEE_LIMIT_MAX_SUN)) {
1047
+ throw badRequest(
1048
+ `feeLimit must be an integer number of sun from 1 to ${TRC20_FEE_LIMIT_MAX_SUN}`
1049
+ );
1050
+ }
1051
+ return compact({
1052
+ to,
1053
+ chainKey,
1054
+ amount: humanAmount(params.amount, params.decimals, "amount"),
1055
+ token: required(params.contractAddress, "contractAddress"),
1056
+ decimals: params.decimals,
1057
+ feeLimit: params.feeLimit,
1058
+ ...common
1059
+ });
1060
+ }
1061
+ function toXrpSendBody(params) {
1062
+ const chainKey = chainKeyFor("XRPL", XRPL_CHAIN_KEYS, params.network);
1063
+ const to = required(params.destination, "destination");
1064
+ if (params.destinationTag != null && !(Number.isInteger(params.destinationTag) && params.destinationTag >= 0 && params.destinationTag <= XRP_DESTINATION_TAG_MAX)) {
1065
+ throw badRequest(
1066
+ `destinationTag must be an integer from 0 to ${XRP_DESTINATION_TAG_MAX}`
1067
+ );
1068
+ }
1069
+ if (params.fee != null && !(typeof params.fee === "string" && XRP_FEE_PATTERN.test(params.fee) && Number(params.fee) <= XRP_FEE_MAX_DROPS)) {
1070
+ throw badRequest(
1071
+ `fee must be a decimal string of whole drops from 1 to ${XRP_FEE_MAX_DROPS}`
1072
+ );
1073
+ }
1074
+ const common = {
1075
+ destinationTag: params.destinationTag,
1076
+ fee: params.fee,
1077
+ pin: params.pin,
1078
+ email: params.email,
1079
+ waitForReceipt: params.waitForConfirmation,
1080
+ idempotencyKey: acceptIdempotencyKey(params.idempotencyKey)
1081
+ };
1082
+ if (params.kind === "native") {
1083
+ refuseDefined(params, ["currency", "issuer"], "for a native XRP transfer");
1084
+ return compact({
1085
+ to,
1086
+ chainKey,
1087
+ amount: humanAmount(params.amount, NATIVE_DECIMALS.xrpl, "amount"),
1088
+ ...common
1089
+ });
1090
+ }
1091
+ if (params.kind !== "fungible") {
1092
+ throw badRequest("kind must be native or fungible");
1093
+ }
1094
+ try {
1095
+ validateAmount(required(params.amount, "amount"));
1096
+ } catch (error) {
1097
+ if (error instanceof TalkenApiError)
1098
+ throw error;
1099
+ throw badRequest(
1100
+ `amount: ${error instanceof Error ? error.message : String(error)}`
1101
+ );
1102
+ }
1103
+ return compact({
1104
+ to,
1105
+ chainKey,
1106
+ amount: params.amount,
1107
+ token: required(params.currency, "currency"),
1108
+ issuer: required(params.issuer, "issuer"),
1109
+ ...common
1110
+ });
1111
+ }
1112
+ function toBitcoinSendBody(params) {
1113
+ if (params.action !== void 0 && params.action !== "transfer") {
1114
+ throw badRequest("only action=transfer is sent through /execute/send");
1115
+ }
1116
+ refuseDefined(
1117
+ params,
1118
+ [
1119
+ "blocks",
1120
+ "hash",
1121
+ "signatureHex",
1122
+ "confirmPollMs",
1123
+ "confirmMaxAttempts",
1124
+ "minConfirmations"
1125
+ ],
1126
+ "by /execute/send"
1127
+ );
1128
+ const chainKey = chainKeyFor("Bitcoin", BITCOIN_CHAIN_KEYS, params.network);
1129
+ let feeRate;
1130
+ if (params.feeRate != null) {
1131
+ feeRate = String(params.feeRate);
1132
+ if (!BTC_FEE_RATE_PATTERN.test(feeRate) || Number(feeRate) > BTC_FEE_RATE_MAX) {
1133
+ throw badRequest(
1134
+ `feeRate must be a whole sat/vB from 1 to ${BTC_FEE_RATE_MAX}`
1135
+ );
1136
+ }
1137
+ }
1138
+ return compact({
1139
+ to: required(params.toAddress, "toAddress"),
1140
+ chainKey,
1141
+ amount: humanAmount(
1142
+ params.amountSats,
1143
+ NATIVE_DECIMALS.bitcoin,
1144
+ "amountSats"
1145
+ ),
1146
+ feeRate,
1147
+ pin: params.pin,
1148
+ email: params.email,
1149
+ idempotencyKey: acceptIdempotencyKey(params.idempotencyKey)
1150
+ });
1151
+ }
1152
+ function toBroadcastBody(chainKey, transaction) {
1153
+ return {
1154
+ chainKey: required(chainKey, "chainKey"),
1155
+ transaction: required(transaction, "transaction")
1156
+ };
1157
+ }
1158
+ function routeRawTransaction(params) {
1159
+ const { chain } = params;
1160
+ if (chain === "tvm" && params.network == null)
1161
+ return "legacy";
1162
+ const network = required(params.network, "network");
1163
+ const family = getNetworkType(network);
1164
+ const contradiction = () => badRequest(`chain=${chain} contradicts network=${network}`);
1165
+ if (chain === "tvm" || family === "TRX" /* TRON */) {
1166
+ if (chain !== void 0 && chain !== "tvm" || family !== "TRX" /* TRON */) {
1167
+ throw family === void 0 && chain === "tvm" ? badRequest(`network ${network} is not a TRON network`) : contradiction();
1168
+ }
1169
+ return "legacy";
1170
+ }
1171
+ if (chain === "svm") {
1172
+ throw badRequest(
1173
+ "sendRawTransaction broadcasts signed EVM transactions only; send a Solana transfer with solana.transfer, or sign a Solana message or transaction with solana.sign"
1174
+ );
1175
+ }
1176
+ if (family !== "EVM" /* EVM */) {
1177
+ throw badRequest(
1178
+ `network ${network} is not an EVM network; /execute/broadcast takes signed EVM transactions only`
1179
+ );
1180
+ }
1181
+ if (chain !== void 0 && chain !== "evm")
1182
+ throw contradiction();
1183
+ return getEvmChainKey(network) === void 0 ? "legacy" : "broadcast";
1184
+ }
1185
+ function toExecuteBroadcastBody(params) {
1186
+ const chainKey = routeRawTransaction(params) === "broadcast" ? getEvmChainKey(required(params.network, "network")) : void 0;
1187
+ if (chainKey === void 0) {
1188
+ throw badRequest(
1189
+ "Only a signed EVM transaction on a network with a chain key is broadcast through /execute/broadcast"
1190
+ );
1191
+ }
1192
+ return toBroadcastBody(
1193
+ chainKey,
1194
+ required(params.signedSerializeTx, "signedSerializeTx")
1195
+ );
1196
+ }
1197
+
1198
+ export {
1199
+ getNetworkName,
1200
+ getChainKey,
1201
+ getExplorerTxUrl,
1202
+ validateAmount,
1203
+ toBaseUnits,
1204
+ toSplRawAmount,
1205
+ NATIVE_DECIMALS,
1206
+ newIdempotencyKey,
1207
+ toExecuteTxBody,
1208
+ toSolanaSendBody,
1209
+ toTronSendBody,
1210
+ toXrpSendBody,
1211
+ toBitcoinSendBody,
1212
+ toBroadcastBody,
1213
+ routeRawTransaction,
1214
+ toExecuteBroadcastBody
1215
+ };