@talken/talkenkit 2.7.5-beta.1 → 2.7.5-beta.2

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 (111) hide show
  1. package/dist/abcWallet-HKEIJA6T.js +172 -0
  2. package/dist/chunk-CGSOMXYJ.js +5757 -0
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +874 -792
  5. package/dist/providers/SignConfirmationProvider/SuppressSignConfirmation.d.ts +11 -0
  6. package/dist/providers/SignConfirmationProvider/index.d.ts +1 -0
  7. package/dist/providers/TransactionResultProvider/SuppressTransactionResult.d.ts +11 -0
  8. package/dist/providers/TransactionResultProvider/index.d.ts +1 -0
  9. package/dist/providers/TransactionResultProvider/types.d.ts +1 -0
  10. package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +1 -1
  11. package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.d.ts +9 -0
  12. package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.js +2 -2
  13. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +2 -2
  14. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +3 -3
  15. package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +13 -13
  16. package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +7 -7
  17. package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +9 -9
  18. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +3 -3
  19. package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +14 -14
  20. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +6 -6
  21. package/dist/wallets/walletConnectors/abcWallet/api/index.js +6 -6
  22. package/dist/wallets/walletConnectors/abcWallet/api/modules/auth.js +1 -1
  23. package/dist/wallets/walletConnectors/abcWallet/api/modules/bitcoin.d.ts +1 -1
  24. package/dist/wallets/walletConnectors/abcWallet/index.js +45 -45
  25. package/dist/wallets/walletConnectors/abcWallet/types/api.types.d.ts +10 -10
  26. package/dist/wallets/walletConnectors/abcWallet/types.js +1 -1
  27. package/dist/wallets/walletConnectors/abcWallet/utils.js +1 -1
  28. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +4 -4
  29. package/dist/wallets/walletConnectors/berasigWallet/berasigWallet.js +2 -2
  30. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  31. package/dist/wallets/walletConnectors/binanceWallet/binanceWallet.js +2 -2
  32. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  33. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  34. package/dist/wallets/walletConnectors/chunk-25VIZXJZ.js +341 -0
  35. package/dist/wallets/walletConnectors/chunk-26URNKLZ.js +341 -0
  36. package/dist/wallets/walletConnectors/chunk-2H2JI5BJ.js +108 -0
  37. package/dist/wallets/walletConnectors/chunk-3QC567QK.js +94 -0
  38. package/dist/wallets/walletConnectors/chunk-4K2V7RCL.js +96 -0
  39. package/dist/wallets/walletConnectors/chunk-4QNRNDMZ.js +378 -0
  40. package/dist/wallets/walletConnectors/chunk-4V3HRM2R.js +95 -0
  41. package/dist/wallets/walletConnectors/chunk-5QYCHHVB.js +98 -0
  42. package/dist/wallets/walletConnectors/chunk-6P3FYHAH.js +108 -0
  43. package/dist/wallets/walletConnectors/chunk-76M232IF.js +101 -0
  44. package/dist/wallets/walletConnectors/chunk-7IBMHOYD.js +102 -0
  45. package/dist/wallets/walletConnectors/chunk-ACGSFRMZ.js +73 -0
  46. package/dist/wallets/walletConnectors/chunk-BZPKBSWY.js +66 -0
  47. package/dist/wallets/walletConnectors/chunk-CHEPDEJ2.js +73 -0
  48. package/dist/wallets/walletConnectors/chunk-CMETID7A.js +1463 -0
  49. package/dist/wallets/walletConnectors/chunk-DDRPEB2X.js +366 -0
  50. package/dist/wallets/walletConnectors/chunk-DHWJ3552.js +93 -0
  51. package/dist/wallets/walletConnectors/chunk-DPVILLWF.js +492 -0
  52. package/dist/wallets/walletConnectors/chunk-EJALZNAR.js +101 -0
  53. package/dist/wallets/walletConnectors/chunk-FVA6H2VF.js +95 -0
  54. package/dist/wallets/walletConnectors/chunk-G7QF44XS.js +378 -0
  55. package/dist/wallets/walletConnectors/chunk-GCHYGJNO.js +131 -0
  56. package/dist/wallets/walletConnectors/chunk-GNF5CHDQ.js +102 -0
  57. package/dist/wallets/walletConnectors/chunk-GZPGNUNF.js +94 -0
  58. package/dist/wallets/walletConnectors/chunk-HALTGRQW.js +87 -0
  59. package/dist/wallets/walletConnectors/chunk-I2LB6GVH.js +341 -0
  60. package/dist/wallets/walletConnectors/chunk-JL3QLDZK.js +186 -0
  61. package/dist/wallets/walletConnectors/chunk-KLCVXROA.js +71 -0
  62. package/dist/wallets/walletConnectors/chunk-KNNHGFKJ.js +98 -0
  63. package/dist/wallets/walletConnectors/chunk-KQDFRZT4.js +65 -0
  64. package/dist/wallets/walletConnectors/chunk-LKNK2KKU.js +76 -0
  65. package/dist/wallets/walletConnectors/chunk-LLOSDVCH.js +58 -0
  66. package/dist/wallets/walletConnectors/chunk-MQ57XDYK.js +340 -0
  67. package/dist/wallets/walletConnectors/chunk-MUAOEA3O.js +103 -0
  68. package/dist/wallets/walletConnectors/chunk-MVZX47XV.js +366 -0
  69. package/dist/wallets/walletConnectors/chunk-MWHKTQPO.js +71 -0
  70. package/dist/wallets/walletConnectors/chunk-MYQPTETH.js +186 -0
  71. package/dist/wallets/walletConnectors/chunk-NP7RQXKC.js +94 -0
  72. package/dist/wallets/walletConnectors/chunk-OKTFRDOV.js +340 -0
  73. package/dist/wallets/walletConnectors/chunk-PXL5G2PM.js +96 -0
  74. package/dist/wallets/walletConnectors/chunk-QB3QLNSL.js +76 -0
  75. package/dist/wallets/walletConnectors/chunk-QCM7BJYI.js +366 -0
  76. package/dist/wallets/walletConnectors/chunk-QRU6XFHH.js +110 -0
  77. package/dist/wallets/walletConnectors/chunk-RIN5NUVA.js +1463 -0
  78. package/dist/wallets/walletConnectors/chunk-RM3S3BY3.js +58 -0
  79. package/dist/wallets/walletConnectors/chunk-S5XGT2XC.js +131 -0
  80. package/dist/wallets/walletConnectors/chunk-SJ7H7FJB.js +58 -0
  81. package/dist/wallets/walletConnectors/chunk-TA4DDCKN.js +96 -0
  82. package/dist/wallets/walletConnectors/chunk-TWVKSPTP.js +91 -0
  83. package/dist/wallets/walletConnectors/chunk-U5UPCM5V.js +66 -0
  84. package/dist/wallets/walletConnectors/chunk-UZAUWE5E.js +27 -0
  85. package/dist/wallets/walletConnectors/chunk-V2C47DTB.js +66 -0
  86. package/dist/wallets/walletConnectors/chunk-XFUNA24R.js +195 -0
  87. package/dist/wallets/walletConnectors/chunk-XS6GJRRA.js +98 -0
  88. package/dist/wallets/walletConnectors/chunk-XSJUQHR7.js +95 -0
  89. package/dist/wallets/walletConnectors/chunk-XSX5EECZ.js +96 -0
  90. package/dist/wallets/walletConnectors/chunk-YJ5RF7V4.js +492 -0
  91. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  92. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  93. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  94. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  95. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  96. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  97. package/dist/wallets/walletConnectors/index.js +87 -87
  98. package/dist/wallets/walletConnectors/iopayWallet/iopayWallet.js +2 -2
  99. package/dist/wallets/walletConnectors/kaiaWallet/kaiaWallet.js +2 -2
  100. package/dist/wallets/walletConnectors/kaikasWallet/kaikasWallet.js +2 -2
  101. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  102. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  103. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  104. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  105. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  106. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  107. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  108. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  109. package/dist/wallets/walletConnectors/zealWallet/zealWallet.js +2 -2
  110. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  111. package/package.json +2 -2
@@ -0,0 +1,1463 @@
1
+ "use client";
2
+ import {
3
+ hexToNumber,
4
+ numberToHex
5
+ } from "./chunk-MEKVFRPV.js";
6
+ import {
7
+ AbstractChainProvider
8
+ } from "./chunk-S5XGT2XC.js";
9
+ import {
10
+ ProviderErrorCode,
11
+ ProviderRpcError
12
+ } from "./chunk-GJ4CJL7F.js";
13
+ import {
14
+ createLogger
15
+ } from "./chunk-762I67R6.js";
16
+ import {
17
+ getCredentialManager
18
+ } from "./chunk-P6KWAOFF.js";
19
+ import {
20
+ TalkenApiError
21
+ } from "./chunk-BUAWEYGV.js";
22
+
23
+ // src/wallets/walletConnectors/abcWallet/abcProvider.ts
24
+ import { parseGwei } from "viem";
25
+
26
+ // src/config/networks.ts
27
+ var NETWORK_CONFIGS = {
28
+ // Ethereum Mainnet
29
+ 1: {
30
+ chainId: 1,
31
+ network: "ethereum",
32
+ name: "Ethereum",
33
+ type: "EVM" /* EVM */,
34
+ isTestnet: false,
35
+ explorer: "https://etherscan.io",
36
+ website: "https://ethereum.org",
37
+ nativeCurrency: {
38
+ name: "Ether",
39
+ symbol: "ETH",
40
+ decimals: 18
41
+ },
42
+ apiSupport: { tokens: true, nft: true, transactions: true },
43
+ signSupport: { legacy: true, eip1559: true }
44
+ },
45
+ // Ethereum Sepolia Testnet
46
+ 11155111: {
47
+ chainId: 11155111,
48
+ network: "ethereum_sepolia",
49
+ name: "Ethereum Sepolia",
50
+ type: "EVM" /* EVM */,
51
+ isTestnet: true,
52
+ explorer: "https://sepolia.etherscan.io",
53
+ website: "https://ethereum.org",
54
+ nativeCurrency: {
55
+ name: "Sepolia Ether",
56
+ symbol: "ETH",
57
+ decimals: 18
58
+ },
59
+ apiSupport: { tokens: true, nft: true, transactions: true },
60
+ signSupport: { legacy: true, eip1559: true }
61
+ },
62
+ // Ethereum Holesky Testnet
63
+ 17e3: {
64
+ chainId: 17e3,
65
+ network: "ethereum_holesky",
66
+ name: "Ethereum Holesky",
67
+ type: "EVM" /* EVM */,
68
+ isTestnet: true,
69
+ explorer: "https://holesky.etherscan.io",
70
+ website: "https://ethereum.org",
71
+ nativeCurrency: {
72
+ name: "Holesky Ether",
73
+ symbol: "ETH",
74
+ decimals: 18
75
+ },
76
+ apiSupport: { tokens: true, nft: true, transactions: true },
77
+ signSupport: { legacy: true, eip1559: true }
78
+ },
79
+ // Kaia Mainnet (formerly Klaytn)
80
+ 8217: {
81
+ chainId: 8217,
82
+ network: "kaia",
83
+ name: "Kaia Mainnet",
84
+ type: "EVM" /* EVM */,
85
+ isTestnet: false,
86
+ explorer: "https://kaiascan.io",
87
+ website: "https://kaia.io",
88
+ nativeCurrency: {
89
+ name: "Kaia",
90
+ symbol: "KAIA",
91
+ decimals: 18
92
+ },
93
+ apiSupport: { tokens: true, nft: true, transactions: true },
94
+ signSupport: { legacy: true, eip1559: true }
95
+ },
96
+ // Kaia Kairos Testnet
97
+ 1001: {
98
+ chainId: 1001,
99
+ network: "kaia_kairos",
100
+ name: "Kaia Kairos Testnet",
101
+ type: "EVM" /* EVM */,
102
+ isTestnet: true,
103
+ explorer: "https://kairos.kaiascan.io",
104
+ website: "https://kaia.io",
105
+ nativeCurrency: {
106
+ name: "Kaia",
107
+ symbol: "KAIA",
108
+ decimals: 18
109
+ },
110
+ apiSupport: { tokens: true, nft: true, transactions: true },
111
+ signSupport: { legacy: true, eip1559: true }
112
+ },
113
+ // Polygon Mainnet
114
+ 137: {
115
+ chainId: 137,
116
+ network: "polygon",
117
+ name: "Polygon",
118
+ type: "EVM" /* EVM */,
119
+ isTestnet: false,
120
+ explorer: "https://polygonscan.com",
121
+ website: "https://polygon.technology",
122
+ nativeCurrency: {
123
+ name: "MATIC",
124
+ symbol: "MATIC",
125
+ decimals: 18
126
+ },
127
+ apiSupport: { tokens: true, nft: true, transactions: true },
128
+ signSupport: { legacy: true, eip1559: true }
129
+ },
130
+ // Polygon Amoy Testnet
131
+ 80002: {
132
+ chainId: 80002,
133
+ network: "polygon_amoy",
134
+ name: "Polygon Amoy Testnet",
135
+ type: "EVM" /* EVM */,
136
+ isTestnet: true,
137
+ explorer: "https://amoy.polygonscan.com",
138
+ website: "https://polygon.technology",
139
+ nativeCurrency: {
140
+ name: "MATIC",
141
+ symbol: "MATIC",
142
+ decimals: 18
143
+ },
144
+ apiSupport: { tokens: true, nft: true, transactions: true },
145
+ signSupport: { legacy: true, eip1559: true }
146
+ },
147
+ // Binance Smart Chain Mainnet
148
+ 56: {
149
+ chainId: 56,
150
+ network: "binance",
151
+ name: "Binance Smart Chain Mainnet",
152
+ type: "EVM" /* EVM */,
153
+ isTestnet: false,
154
+ explorer: "https://bscscan.com",
155
+ website: "https://www.bnbchain.org/en/bnb-smart-chain",
156
+ nativeCurrency: {
157
+ name: "BNB",
158
+ symbol: "BNB",
159
+ decimals: 18
160
+ },
161
+ apiSupport: { tokens: true, nft: true, transactions: true },
162
+ signSupport: { legacy: true, eip1559: true }
163
+ },
164
+ // Binance Smart Chain Testnet
165
+ 97: {
166
+ chainId: 97,
167
+ network: "binance_testnet",
168
+ name: "Binance Smart Chain Testnet",
169
+ type: "EVM" /* EVM */,
170
+ isTestnet: true,
171
+ explorer: "https://testnet.bscscan.com",
172
+ website: "https://www.bnbchain.org/en/bnb-smart-chain",
173
+ nativeCurrency: {
174
+ name: "BNB",
175
+ symbol: "BNB",
176
+ decimals: 18
177
+ },
178
+ apiSupport: { tokens: true, nft: true, transactions: true },
179
+ signSupport: { legacy: true, eip1559: true }
180
+ },
181
+ // Arbitrum One
182
+ 42161: {
183
+ chainId: 42161,
184
+ network: "arbitrum",
185
+ name: "Arbitrum One",
186
+ type: "EVM" /* EVM */,
187
+ isTestnet: false,
188
+ explorer: "https://arbiscan.io",
189
+ website: "https://arbitrum.io",
190
+ nativeCurrency: {
191
+ name: "Ether",
192
+ symbol: "ETH",
193
+ decimals: 18
194
+ },
195
+ apiSupport: { tokens: true, nft: true, transactions: true },
196
+ signSupport: { legacy: true, eip1559: true }
197
+ },
198
+ // Arbitrum Sepolia
199
+ 421614: {
200
+ chainId: 421614,
201
+ network: "arbitrum_sepolia",
202
+ name: "Arbitrum Sepolia",
203
+ type: "EVM" /* EVM */,
204
+ isTestnet: true,
205
+ explorer: "https://sepolia.arbiscan.io",
206
+ website: "https://arbitrum.io",
207
+ nativeCurrency: {
208
+ name: "Ether",
209
+ symbol: "ETH",
210
+ decimals: 18
211
+ },
212
+ apiSupport: { tokens: true, nft: true, transactions: true },
213
+ signSupport: { legacy: true, eip1559: true }
214
+ },
215
+ // Optimism Mainnet
216
+ 10: {
217
+ chainId: 10,
218
+ network: "optimism",
219
+ name: "Optimism",
220
+ type: "EVM" /* EVM */,
221
+ isTestnet: false,
222
+ explorer: "https://optimistic.etherscan.io",
223
+ website: "https://optimism.io",
224
+ nativeCurrency: {
225
+ name: "Ether",
226
+ symbol: "ETH",
227
+ decimals: 18
228
+ },
229
+ apiSupport: { tokens: true, nft: true, transactions: true },
230
+ signSupport: { legacy: true, eip1559: true }
231
+ },
232
+ // Optimism Sepolia
233
+ 420: {
234
+ chainId: 420,
235
+ network: "optimism_sepolia",
236
+ name: "Optimism Sepolia",
237
+ type: "EVM" /* EVM */,
238
+ isTestnet: true,
239
+ explorer: "https://sepolia-optimism.etherscan.io",
240
+ website: "https://optimism.io",
241
+ nativeCurrency: {
242
+ name: "Ether",
243
+ symbol: "ETH",
244
+ decimals: 18
245
+ },
246
+ apiSupport: { tokens: true, nft: true, transactions: true },
247
+ signSupport: { legacy: true, eip1559: true }
248
+ },
249
+ // Avalanche C-Chain
250
+ 43114: {
251
+ chainId: 43114,
252
+ network: "avalanche",
253
+ name: "Avalanche C-Chain",
254
+ type: "EVM" /* EVM */,
255
+ isTestnet: false,
256
+ explorer: "https://avascan.info/blockchain/c/home",
257
+ website: "https://avax.network",
258
+ nativeCurrency: {
259
+ name: "Avalanche",
260
+ symbol: "AVAX",
261
+ decimals: 18
262
+ },
263
+ apiSupport: { tokens: true, nft: true, transactions: true },
264
+ signSupport: { legacy: true, eip1559: true }
265
+ },
266
+ // Avalanche Fuji Testnet
267
+ 43113: {
268
+ chainId: 43113,
269
+ network: "avalanche_fuji",
270
+ name: "Avalanche Fuji Testnet",
271
+ type: "EVM" /* EVM */,
272
+ isTestnet: true,
273
+ explorer: "https://testnet.avascan.info",
274
+ website: "https://avax.network",
275
+ nativeCurrency: {
276
+ name: "Avalanche",
277
+ symbol: "AVAX",
278
+ decimals: 18
279
+ },
280
+ apiSupport: { tokens: false, nft: false, transactions: false },
281
+ signSupport: { legacy: true, eip1559: true }
282
+ },
283
+ // Mantle Mainnet
284
+ 5e3: {
285
+ chainId: 5e3,
286
+ network: "mantle",
287
+ name: "Mantle Mainnet",
288
+ type: "EVM" /* EVM */,
289
+ isTestnet: false,
290
+ explorer: "https://explorer.mantle.xyz",
291
+ website: "https://www.mantle.xyz",
292
+ nativeCurrency: {
293
+ name: "Mantle",
294
+ symbol: "MNT",
295
+ decimals: 18
296
+ },
297
+ apiSupport: { tokens: true, nft: true, transactions: true },
298
+ signSupport: { legacy: true, eip1559: true }
299
+ },
300
+ // Mantle Testnet
301
+ 5001: {
302
+ chainId: 5001,
303
+ network: "mantle_testnet",
304
+ name: "Mantle Testnet",
305
+ type: "EVM" /* EVM */,
306
+ isTestnet: true,
307
+ explorer: "https://sepolia.mantlescan.xyz",
308
+ website: "https://www.mantle.xyz",
309
+ nativeCurrency: {
310
+ name: "Mantle",
311
+ symbol: "MNT",
312
+ decimals: 18
313
+ },
314
+ apiSupport: { tokens: true, nft: true, transactions: true },
315
+ signSupport: { legacy: true, eip1559: true }
316
+ },
317
+ // Moonbeam
318
+ 1284: {
319
+ chainId: 1284,
320
+ network: "moonbeam",
321
+ name: "Moonbeam",
322
+ type: "EVM" /* EVM */,
323
+ isTestnet: false,
324
+ explorer: "https://moonbeam.moonscan.io",
325
+ website: "https://moonbeam.network",
326
+ nativeCurrency: {
327
+ name: "Glimmer",
328
+ symbol: "GLMR",
329
+ decimals: 18
330
+ },
331
+ apiSupport: { tokens: true, nft: true, transactions: true },
332
+ signSupport: { legacy: true, eip1559: true }
333
+ },
334
+ // Moonriver
335
+ 1285: {
336
+ chainId: 1285,
337
+ network: "moonriver",
338
+ name: "Moonriver",
339
+ type: "EVM" /* EVM */,
340
+ isTestnet: false,
341
+ explorer: "https://moonriver.moonscan.io",
342
+ website: "https://moonbeam.network/networks/moonriver",
343
+ nativeCurrency: {
344
+ name: "Moonriver",
345
+ symbol: "MOVR",
346
+ decimals: 18
347
+ },
348
+ apiSupport: { tokens: true, nft: true, transactions: true },
349
+ signSupport: { legacy: true, eip1559: true }
350
+ },
351
+ // Scroll Mainnet
352
+ 534352: {
353
+ chainId: 534352,
354
+ network: "scroll",
355
+ name: "Scroll",
356
+ type: "EVM" /* EVM */,
357
+ isTestnet: false,
358
+ explorer: "https://scrollscan.co",
359
+ website: "https://scroll.io",
360
+ nativeCurrency: {
361
+ name: "Ether",
362
+ symbol: "ETH",
363
+ decimals: 18
364
+ },
365
+ apiSupport: { tokens: true, nft: true, transactions: true },
366
+ signSupport: { legacy: true, eip1559: true }
367
+ },
368
+ // Scroll Testnet
369
+ 534351: {
370
+ chainId: 534351,
371
+ network: "scroll_testnet",
372
+ name: "Scroll Testnet",
373
+ type: "EVM" /* EVM */,
374
+ isTestnet: true,
375
+ explorer: "https://sepolia.scrollscan.com",
376
+ website: "https://scroll.io",
377
+ nativeCurrency: {
378
+ name: "Ether",
379
+ symbol: "ETH",
380
+ decimals: 18
381
+ },
382
+ apiSupport: { tokens: true, nft: true, transactions: true },
383
+ signSupport: { legacy: true, eip1559: true }
384
+ },
385
+ // Silicon Mainnet
386
+ 2355: {
387
+ chainId: 2355,
388
+ network: "silicon",
389
+ name: "Silicon",
390
+ type: "EVM" /* EVM */,
391
+ isTestnet: false,
392
+ explorer: "https://scope.silicon.network",
393
+ website: "https://silicon.network",
394
+ nativeCurrency: {
395
+ name: "Ether",
396
+ symbol: "ETH",
397
+ decimals: 18
398
+ },
399
+ apiSupport: { tokens: true, nft: true, transactions: true },
400
+ signSupport: { legacy: true, eip1559: true }
401
+ },
402
+ // Silicon Sepolia
403
+ 1722641160: {
404
+ chainId: 1722641160,
405
+ network: "silicon_sepolia",
406
+ name: "Silicon Sepolia",
407
+ type: "EVM" /* EVM */,
408
+ isTestnet: true,
409
+ explorer: "https://scope-sepolia.silicon.network",
410
+ website: "https://silicon.network",
411
+ nativeCurrency: {
412
+ name: "Ether",
413
+ symbol: "ETH",
414
+ decimals: 18
415
+ },
416
+ apiSupport: { tokens: true, nft: true, transactions: true },
417
+ signSupport: { legacy: true, eip1559: true }
418
+ },
419
+ // Six Protocol
420
+ 98: {
421
+ chainId: 98,
422
+ network: "six_evm",
423
+ name: "Six Protocol",
424
+ type: "EVM" /* EVM */,
425
+ isTestnet: false,
426
+ explorer: "https://v2.sixscan.io",
427
+ website: "https://www.six.network",
428
+ nativeCurrency: {
429
+ name: "SIX",
430
+ symbol: "SIX",
431
+ decimals: 18
432
+ },
433
+ apiSupport: { tokens: true, nft: false, transactions: true },
434
+ signSupport: { legacy: true, eip1559: false }
435
+ },
436
+ // Six Protocol Testnet
437
+ 150: {
438
+ chainId: 150,
439
+ network: "six_evm_testnet",
440
+ name: "Six Protocol Testnet",
441
+ type: "EVM" /* EVM */,
442
+ isTestnet: true,
443
+ explorer: "https://v2.fivenet.sixscan.io",
444
+ website: "https://www.six.network",
445
+ nativeCurrency: {
446
+ name: "SIX",
447
+ symbol: "SIX",
448
+ decimals: 18
449
+ },
450
+ apiSupport: { tokens: true, nft: false, transactions: true },
451
+ signSupport: { legacy: true, eip1559: false }
452
+ },
453
+ // Wemix Mainnet
454
+ 1111: {
455
+ chainId: 1111,
456
+ network: "wemix",
457
+ name: "Wemix3.0 Mainnet",
458
+ type: "EVM" /* EVM */,
459
+ isTestnet: false,
460
+ explorer: "https://explorer.wemix.com",
461
+ website: "https://wemix.com",
462
+ nativeCurrency: {
463
+ name: "WEMIX",
464
+ symbol: "WEMIX",
465
+ decimals: 18
466
+ },
467
+ apiSupport: { tokens: true, nft: true, transactions: true },
468
+ signSupport: { legacy: true, eip1559: true }
469
+ },
470
+ // Wemix Testnet
471
+ 1112: {
472
+ chainId: 1112,
473
+ network: "wemix_testnet",
474
+ name: "Wemix3.0 Testnet",
475
+ type: "EVM" /* EVM */,
476
+ isTestnet: true,
477
+ explorer: "https://explorer.test.wemix.com",
478
+ website: "https://wemix.com",
479
+ nativeCurrency: {
480
+ name: "WEMIX",
481
+ symbol: "WEMIX",
482
+ decimals: 18
483
+ },
484
+ apiSupport: { tokens: true, nft: true, transactions: true },
485
+ signSupport: { legacy: true, eip1559: true }
486
+ },
487
+ // Taiko Mainnet
488
+ 167e3: {
489
+ chainId: 167e3,
490
+ network: "taiko",
491
+ name: "Taiko Mainnet",
492
+ type: "EVM" /* EVM */,
493
+ isTestnet: false,
494
+ explorer: "https://taikoscan.io",
495
+ website: "https://taiko.xyz",
496
+ nativeCurrency: {
497
+ name: "Ether",
498
+ symbol: "ETH",
499
+ decimals: 18
500
+ },
501
+ apiSupport: { tokens: true, nft: true, transactions: true },
502
+ signSupport: { legacy: true, eip1559: true }
503
+ },
504
+ // Taiko Hekla Testnet
505
+ 167009: {
506
+ chainId: 167009,
507
+ network: "taiko_hekla",
508
+ name: "Taiko Hekla Testnet",
509
+ type: "EVM" /* EVM */,
510
+ isTestnet: true,
511
+ explorer: "https://hekla.taikoscan.io",
512
+ website: "https://taiko.xyz",
513
+ nativeCurrency: {
514
+ name: "Ether",
515
+ symbol: "ETH",
516
+ decimals: 18
517
+ },
518
+ apiSupport: { tokens: true, nft: true, transactions: true },
519
+ signSupport: { legacy: true, eip1559: true }
520
+ },
521
+ // Base Mainnet
522
+ 8453: {
523
+ chainId: 8453,
524
+ network: "base",
525
+ name: "Base",
526
+ type: "EVM" /* EVM */,
527
+ isTestnet: false,
528
+ explorer: "https://basescan.org",
529
+ website: "https://base.org",
530
+ nativeCurrency: {
531
+ name: "Ether",
532
+ symbol: "ETH",
533
+ decimals: 18
534
+ },
535
+ apiSupport: { tokens: true, nft: true, transactions: true },
536
+ signSupport: { legacy: true, eip1559: true }
537
+ },
538
+ // Base Sepolia Testnet
539
+ 84532: {
540
+ chainId: 84532,
541
+ network: "base_sepolia",
542
+ name: "Base Sepolia",
543
+ type: "EVM" /* EVM */,
544
+ isTestnet: true,
545
+ explorer: "https://sepolia.basescan.org",
546
+ website: "https://base.org",
547
+ nativeCurrency: {
548
+ name: "Ether",
549
+ symbol: "ETH",
550
+ decimals: 18
551
+ },
552
+ apiSupport: { tokens: true, nft: true, transactions: true },
553
+ signSupport: { legacy: true, eip1559: true }
554
+ },
555
+ // ChainBounty Mainnet
556
+ 51828: {
557
+ chainId: 51828,
558
+ network: "chainbounty",
559
+ name: "ChainBounty Mainnet",
560
+ type: "EVM" /* EVM */,
561
+ isTestnet: false,
562
+ explorer: "https://scan.chainbounty.io",
563
+ website: "https://chainbounty.io",
564
+ nativeCurrency: {
565
+ name: "ChainBounty",
566
+ symbol: "CBY",
567
+ decimals: 18
568
+ },
569
+ apiSupport: { tokens: true, nft: true, transactions: true },
570
+ signSupport: { legacy: true, eip1559: true }
571
+ },
572
+ // ChainBounty Testnet
573
+ 56580: {
574
+ chainId: 56580,
575
+ network: "chainbounty_testnet",
576
+ name: "ChainBounty Testnet",
577
+ type: "EVM" /* EVM */,
578
+ isTestnet: true,
579
+ explorer: "https://test.scan.chainbounty.io",
580
+ website: "https://chainbounty.io",
581
+ nativeCurrency: {
582
+ name: "ChainBounty",
583
+ symbol: "CBY",
584
+ decimals: 18
585
+ },
586
+ apiSupport: { tokens: true, nft: true, transactions: true },
587
+ signSupport: { legacy: true, eip1559: true }
588
+ },
589
+ // Aptos Mainnet (Non-EVM)
590
+ aptos: {
591
+ chainId: null,
592
+ network: "aptos",
593
+ name: "Aptos",
594
+ type: "Non-EVM" /* NON_EVM */,
595
+ isTestnet: false,
596
+ explorer: "https://explorer.aptoslabs.com/?network=mainnet",
597
+ website: "https://aptos.dev",
598
+ nativeCurrency: {
599
+ name: "Aptos",
600
+ symbol: "APT",
601
+ decimals: 8
602
+ },
603
+ apiSupport: { tokens: true, nft: true, transactions: true },
604
+ signSupport: { legacy: true, eip1559: false }
605
+ },
606
+ // Aptos Testnet (Non-EVM)
607
+ aptos_testnet: {
608
+ chainId: null,
609
+ network: "aptos_testnet",
610
+ name: "Aptos Testnet",
611
+ type: "Non-EVM" /* NON_EVM */,
612
+ isTestnet: true,
613
+ explorer: "https://explorer.aptoslabs.com/?network=testnet",
614
+ website: "https://aptos.dev",
615
+ nativeCurrency: {
616
+ name: "Aptos",
617
+ symbol: "APT",
618
+ decimals: 8
619
+ },
620
+ apiSupport: { tokens: true, nft: true, transactions: true },
621
+ signSupport: { legacy: true, eip1559: false }
622
+ },
623
+ // Bitcoin Mainnet
624
+ bitcoin: {
625
+ chainId: null,
626
+ network: "bitcoin",
627
+ name: "Bitcoin Mainnet",
628
+ type: "Bitcoin" /* BITCOIN */,
629
+ isTestnet: false,
630
+ explorer: "https://blockstream.info",
631
+ website: "https://bitcoin.org",
632
+ nativeCurrency: {
633
+ name: "Bitcoin",
634
+ symbol: "BTC",
635
+ decimals: 8
636
+ },
637
+ apiSupport: { tokens: true, nft: false, transactions: true },
638
+ signSupport: { legacy: true, eip1559: false }
639
+ },
640
+ // Bitcoin Testnet
641
+ bitcoin_testnet: {
642
+ chainId: null,
643
+ network: "bitcoin_testnet",
644
+ name: "Bitcoin Testnet",
645
+ type: "Bitcoin" /* BITCOIN */,
646
+ isTestnet: true,
647
+ explorer: "https://blockstream.info/testnet",
648
+ website: "https://bitcoin.org",
649
+ nativeCurrency: {
650
+ name: "Bitcoin",
651
+ symbol: "BTC",
652
+ decimals: 8
653
+ },
654
+ apiSupport: { tokens: true, nft: false, transactions: true },
655
+ signSupport: { legacy: true, eip1559: false }
656
+ },
657
+ // Tron Mainnet
658
+ tron: {
659
+ chainId: null,
660
+ network: "tron",
661
+ name: "Tron Mainnet",
662
+ type: "TRX" /* TRON */,
663
+ isTestnet: false,
664
+ explorer: "https://tronscan.org",
665
+ website: "https://tron.network",
666
+ nativeCurrency: {
667
+ name: "Tronix",
668
+ symbol: "TRX",
669
+ decimals: 6
670
+ },
671
+ apiSupport: { tokens: true, nft: true, transactions: true },
672
+ signSupport: { legacy: true, eip1559: true }
673
+ },
674
+ // Tron Nile Testnet
675
+ tron_nile: {
676
+ chainId: null,
677
+ network: "tron_nile",
678
+ name: "Tron Nile Testnet",
679
+ type: "TRX" /* TRON */,
680
+ isTestnet: true,
681
+ explorer: "https://nile.tronscan.org",
682
+ website: "https://tron.network",
683
+ nativeCurrency: {
684
+ name: "Tronix",
685
+ symbol: "TRX",
686
+ decimals: 6
687
+ },
688
+ apiSupport: { tokens: true, nft: true, transactions: true },
689
+ signSupport: { legacy: true, eip1559: true }
690
+ },
691
+ // ICP Mainnet
692
+ icp: {
693
+ chainId: null,
694
+ network: "icp",
695
+ name: "Internet Computer",
696
+ type: "ICP" /* ICP */,
697
+ isTestnet: false,
698
+ explorer: "https://dashboard.internetcomputer.org",
699
+ website: "https://internetcomputer.org",
700
+ nativeCurrency: {
701
+ name: "ICP",
702
+ symbol: "ICP",
703
+ decimals: 8
704
+ },
705
+ apiSupport: { tokens: true, nft: true, transactions: true },
706
+ signSupport: { legacy: true, eip1559: true }
707
+ }
708
+ };
709
+ var NETWORK_BY_PARAM = Object.values(
710
+ NETWORK_CONFIGS
711
+ ).reduce(
712
+ (acc, config) => {
713
+ acc[config.network] = config;
714
+ return acc;
715
+ },
716
+ {}
717
+ );
718
+ function getNetworkByChainId(chainId) {
719
+ return NETWORK_CONFIGS[chainId];
720
+ }
721
+ function getNetworkByParam(network) {
722
+ return NETWORK_BY_PARAM[network];
723
+ }
724
+ function getNetworkName(chainId, fallback = "ethereum") {
725
+ return NETWORK_CONFIGS[chainId]?.network ?? fallback;
726
+ }
727
+ var CHAIN_ID_TO_KEY = {
728
+ // Mainnet
729
+ 1: "ethereum",
730
+ 42161: "arbitrum",
731
+ 8217: "kaia",
732
+ 56: "bsc",
733
+ 8453: "base",
734
+ 137: "polygon",
735
+ 43114: "avalanche",
736
+ 5e3: "mantle",
737
+ 51828: "chainbounty",
738
+ // Testnet
739
+ 11155111: "sepolia",
740
+ 421614: "arbitrumSepolia",
741
+ 1001: "kaiaKairos",
742
+ 97: "bscTestnet",
743
+ 84532: "baseSepolia",
744
+ 80002: "polygonAmoy",
745
+ 43113: "avalancheFuji",
746
+ 5003: "mantleSepolia",
747
+ 56580: "chainbountyTestnet",
748
+ 998: "hyperevmTestnet"
749
+ };
750
+ function getChainKey(chainId) {
751
+ const key = CHAIN_ID_TO_KEY[chainId];
752
+ if (!key) {
753
+ throw new Error(`Unsupported chainId for tx endpoint: ${chainId}`);
754
+ }
755
+ return key;
756
+ }
757
+ function getExplorerTxUrl(chainIdOrNetwork, txHash) {
758
+ const config = typeof chainIdOrNetwork === "number" ? getNetworkByChainId(chainIdOrNetwork) : getNetworkByParam(chainIdOrNetwork);
759
+ if (!config) {
760
+ throw new Error(`Unknown network: ${chainIdOrNetwork}`);
761
+ }
762
+ return `${config.explorer}/tx/${txHash}`;
763
+ }
764
+
765
+ // src/wallets/walletConnectors/abcWallet/abcProvider.ts
766
+ var logger = createLogger("AbcProvider");
767
+ var AbcEvmProvider = class extends AbstractChainProvider {
768
+ constructor() {
769
+ super(...arguments);
770
+ this.chainId = 1;
771
+ }
772
+ // Default to Ethereum mainnet
773
+ getRecoveryEmail() {
774
+ const walletEmail = this.wallet?.email?.trim();
775
+ if (walletEmail) {
776
+ return walletEmail;
777
+ }
778
+ return getCredentialManager().getEmail() || void 0;
779
+ }
780
+ /**
781
+ * Set wallet — EVM override for chainId tracking + chainChanged event
782
+ */
783
+ setWallet(wallet) {
784
+ const previousChainId = this.chainId;
785
+ this.chainId = wallet.chainId;
786
+ super.setWallet(wallet);
787
+ if (previousChainId !== wallet.chainId) {
788
+ this.emit("chainChanged", numberToHex(wallet.chainId));
789
+ }
790
+ }
791
+ onWalletSet(wallet) {
792
+ this.emit("connect", { chainId: numberToHex(wallet.chainId) });
793
+ }
794
+ /**
795
+ * Check if an error is a "Missing required wallet fields" 502 from the server.
796
+ * When the server's in-memory signing credential cache is cold, it needs
797
+ * a wallet.generate() call (idempotent create/recover) to repopulate.
798
+ */
799
+ isSigningCredentialError(error) {
800
+ return error instanceof TalkenApiError && error.statusCode === 502 && error.message.includes("Missing required wallet fields");
801
+ }
802
+ /**
803
+ * Refresh server-side signing credentials.
804
+ *
805
+ * Strategy (in priority order):
806
+ * 1. PIN hash in memory → wallet.generate() to repopulate server cache
807
+ * 2. Neither available → throw UNAUTHORIZED
808
+ *
809
+ * Note: sessionStorage-cached credentials (evmCreds) are automatically
810
+ * attached to every signing request by TalkenApiClient, so the server
811
+ * can use them as fallback without a separate refresh call.
812
+ */
813
+ async refreshSigningCredentials() {
814
+ const credMgr = getCredentialManager();
815
+ const pinHash = credMgr.getPinHash();
816
+ const email = this.getRecoveryEmail();
817
+ if (pinHash && email) {
818
+ const api = this.getTalkenApiClientOrThrow();
819
+ logger.info("Refreshing signing credentials via wallet.generate...");
820
+ await api.wallet.generate(pinHash, email);
821
+ logger.info("Signing credentials refreshed via PIN");
822
+ return;
823
+ }
824
+ logger.warn(
825
+ "Cannot refresh signing credentials \u2014 PIN hash or email missing"
826
+ );
827
+ throw new ProviderRpcError(
828
+ ProviderErrorCode.UNAUTHORIZED,
829
+ "Session expired. Please reconnect and verify your PIN."
830
+ );
831
+ }
832
+ /**
833
+ * Wrap a signing operation with auto-retry on "Missing required wallet fields" error.
834
+ * On first failure, refreshes the server's signing credential cache and retries once.
835
+ */
836
+ async withSigningCredentialRetry(operation) {
837
+ try {
838
+ return await operation();
839
+ } catch (error) {
840
+ if (this.isSigningCredentialError(error)) {
841
+ logger.info(
842
+ "Signing credentials missing on server \u2014 attempting refresh and retry"
843
+ );
844
+ await this.refreshSigningCredentials();
845
+ return await operation();
846
+ }
847
+ throw error;
848
+ }
849
+ }
850
+ /**
851
+ * Call request interceptor if configured
852
+ * Called by specific signing/transaction methods that need user confirmation
853
+ * @returns Resolved transaction with user modifications if changed in confirmation modal
854
+ */
855
+ async callInterceptor(method, params) {
856
+ if (!this.requestInterceptor) {
857
+ return void 0;
858
+ }
859
+ const request = {
860
+ method,
861
+ params,
862
+ chainId: this.chainId,
863
+ address: this.wallet?.address || ""
864
+ };
865
+ return this.requestInterceptor(request);
866
+ }
867
+ /**
868
+ * EIP-1193 request method
869
+ */
870
+ async request(args) {
871
+ const { method, params } = args;
872
+ switch (method) {
873
+ case "eth_requestAccounts":
874
+ return this.eth_requestAccounts();
875
+ case "eth_accounts":
876
+ return this.eth_accounts();
877
+ case "eth_chainId":
878
+ return this.eth_chainId();
879
+ case "eth_sendTransaction":
880
+ case "wallet_sendTransaction":
881
+ return this.eth_sendTransaction(params);
882
+ case "eth_signTransaction":
883
+ return this.eth_signTransaction(params);
884
+ case "personal_sign":
885
+ return this.personal_sign(params);
886
+ case "eth_sign":
887
+ return this.eth_sign(params);
888
+ case "eth_signTypedData":
889
+ case "eth_signTypedData_v3":
890
+ case "eth_signTypedData_v4":
891
+ return this.eth_signTypedData(params);
892
+ case "wallet_getCapabilities":
893
+ return this.wallet_getCapabilities();
894
+ case "eth_signAuthorization":
895
+ return this.eth_signAuthorization(params);
896
+ case "wallet_switchEthereumChain":
897
+ return this.wallet_switchEthereumChain(params);
898
+ case "wallet_addEthereumChain":
899
+ return this.wallet_addEthereumChain(params);
900
+ case "eth_estimateGas":
901
+ return this.eth_estimateGas(params);
902
+ case "eth_getTransactionCount":
903
+ return this.eth_getTransactionCount(
904
+ Array.isArray(params) ? params : []
905
+ );
906
+ case "eth_call":
907
+ return this.eth_call(params);
908
+ case "eth_getBalance":
909
+ return this.eth_getBalance(params);
910
+ case "eth_blockNumber":
911
+ case "eth_gasPrice":
912
+ case "eth_getBlockByHash":
913
+ case "eth_getBlockByNumber":
914
+ case "eth_getCode":
915
+ case "eth_getStorageAt":
916
+ case "eth_getTransactionByHash":
917
+ case "eth_getTransactionReceipt":
918
+ throw new ProviderRpcError(
919
+ ProviderErrorCode.UNSUPPORTED_METHOD,
920
+ `Method ${method} should be handled by RPC provider`
921
+ );
922
+ default:
923
+ throw new ProviderRpcError(
924
+ ProviderErrorCode.UNSUPPORTED_METHOD,
925
+ `Method ${method} not supported`
926
+ );
927
+ }
928
+ }
929
+ /**
930
+ * Request accounts (EIP-1193)
931
+ */
932
+ async eth_requestAccounts() {
933
+ if (!this.wallet) {
934
+ throw new ProviderRpcError(
935
+ ProviderErrorCode.UNAUTHORIZED,
936
+ "Wallet not connected"
937
+ );
938
+ }
939
+ return [this.wallet.address];
940
+ }
941
+ /**
942
+ * Get accounts
943
+ */
944
+ async eth_accounts() {
945
+ if (!this.wallet) {
946
+ return [];
947
+ }
948
+ return [this.wallet.address];
949
+ }
950
+ /**
951
+ * Get chain ID
952
+ */
953
+ async eth_chainId() {
954
+ return numberToHex(this.chainId);
955
+ }
956
+ /**
957
+ * Send transaction
958
+ */
959
+ async eth_sendTransaction(params) {
960
+ if (!this.wallet) {
961
+ throw new ProviderRpcError(
962
+ ProviderErrorCode.UNAUTHORIZED,
963
+ "Wallet not connected"
964
+ );
965
+ }
966
+ if (!Array.isArray(params) || params.length === 0) {
967
+ throw new ProviderRpcError(
968
+ ProviderErrorCode.INVALID_PARAMS,
969
+ "Invalid transaction params"
970
+ );
971
+ }
972
+ const resolved = await this.callInterceptor("eth_sendTransaction", params);
973
+ const tx = params[0];
974
+ logger.debug("eth_sendTransaction incoming gas params:", {
975
+ gas: tx.gas ?? tx.gasLimit,
976
+ gasPrice: tx.gasPrice,
977
+ maxFeePerGas: tx.maxFeePerGas,
978
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas
979
+ });
980
+ if (resolved) {
981
+ if (resolved.data) {
982
+ tx.data = resolved.data;
983
+ }
984
+ if (resolved.gasFee?.maxFeePerGas) {
985
+ try {
986
+ const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
987
+ tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
988
+ } catch (error) {
989
+ logger.error("Failed to parse maxFeePerGas:", error);
990
+ }
991
+ }
992
+ if (resolved.gasFee?.maxPriorityFeePerGas) {
993
+ try {
994
+ const priorityFeeWei = parseGwei(
995
+ resolved.gasFee.maxPriorityFeePerGas
996
+ );
997
+ tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
998
+ } catch (error) {
999
+ logger.error("Failed to parse maxPriorityFeePerGas:", error);
1000
+ }
1001
+ }
1002
+ }
1003
+ logger.debug("eth_sendTransaction final gas params:", {
1004
+ gas: tx.gas ?? tx.gasLimit,
1005
+ gasPrice: tx.gasPrice,
1006
+ maxFeePerGas: tx.maxFeePerGas,
1007
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas
1008
+ });
1009
+ const isContractDeployment = !tx.to || tx.to === "0x" || tx.to === "0x0" || tx.to === "0x0000000000000000000000000000000000000000";
1010
+ if (isContractDeployment) {
1011
+ tx.to = "0x";
1012
+ } else if (!tx.to) {
1013
+ throw new ProviderRpcError(
1014
+ ProviderErrorCode.INVALID_PARAMS,
1015
+ 'Transaction must have "to" field'
1016
+ );
1017
+ }
1018
+ const api = this.getTalkenApiClientOrThrow();
1019
+ const pinHash = api.isAccessKeyMode() ? void 0 : getCredentialManager().getPinHash();
1020
+ if (!pinHash && !api.isAccessKeyMode()) {
1021
+ throw new ProviderRpcError(
1022
+ ProviderErrorCode.INTERNAL_ERROR,
1023
+ "PIN hash not found. Please login again."
1024
+ );
1025
+ }
1026
+ const hexValue = tx.value || "0x0";
1027
+ const amountWei = BigInt(hexValue).toString();
1028
+ const email = this.getRecoveryEmail();
1029
+ const chainKey = getChainKey(this.chainId);
1030
+ this.showPendingTx({ network: chainKey, chain: "evm" });
1031
+ try {
1032
+ const gasLimit = tx.gas || tx.gasLimit;
1033
+ const result = await this.withSigningCredentialRetry(
1034
+ () => api.evm.sendTransaction({
1035
+ chainKey,
1036
+ to: tx.to,
1037
+ amountWei,
1038
+ pin: pinHash,
1039
+ data: tx.data || "0x",
1040
+ waitForReceipt: true,
1041
+ ...gasLimit && { gasLimit },
1042
+ ...tx.gasPrice && { gasPrice: tx.gasPrice },
1043
+ ...tx.maxFeePerGas && { maxFeePerGas: tx.maxFeePerGas },
1044
+ ...tx.maxPriorityFeePerGas && {
1045
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas
1046
+ },
1047
+ ...email && { email }
1048
+ })
1049
+ );
1050
+ this.updateTxResult({
1051
+ txHash: result.txHash,
1052
+ network: chainKey,
1053
+ chain: "evm",
1054
+ receipt: result.receipt,
1055
+ explorerUrl: getExplorerTxUrl(this.chainId, result.txHash)
1056
+ });
1057
+ return result.txHash;
1058
+ } catch (error) {
1059
+ this.failTxResult({
1060
+ network: chainKey,
1061
+ chain: "evm",
1062
+ errorMessage: error.message
1063
+ });
1064
+ throw error;
1065
+ }
1066
+ }
1067
+ /**
1068
+ * Sign transaction (without sending)
1069
+ */
1070
+ async eth_signTransaction(params) {
1071
+ if (!this.wallet) {
1072
+ throw new ProviderRpcError(
1073
+ ProviderErrorCode.UNAUTHORIZED,
1074
+ "Wallet not connected"
1075
+ );
1076
+ }
1077
+ if (!Array.isArray(params) || params.length === 0) {
1078
+ throw new ProviderRpcError(
1079
+ ProviderErrorCode.INVALID_PARAMS,
1080
+ "Invalid transaction params"
1081
+ );
1082
+ }
1083
+ const resolved = await this.callInterceptor("eth_signTransaction", params);
1084
+ const tx = params[0];
1085
+ if (resolved) {
1086
+ if (resolved.data) {
1087
+ tx.data = resolved.data;
1088
+ }
1089
+ if (resolved.gasFee?.maxFeePerGas) {
1090
+ try {
1091
+ const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
1092
+ tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
1093
+ } catch (error) {
1094
+ logger.error("Failed to parse maxFeePerGas:", error);
1095
+ }
1096
+ }
1097
+ if (resolved.gasFee?.maxPriorityFeePerGas) {
1098
+ try {
1099
+ const priorityFeeWei = parseGwei(
1100
+ resolved.gasFee.maxPriorityFeePerGas
1101
+ );
1102
+ tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
1103
+ } catch (error) {
1104
+ logger.error("Failed to parse maxPriorityFeePerGas:", error);
1105
+ }
1106
+ }
1107
+ }
1108
+ const api = this.getTalkenApiClientOrThrow();
1109
+ const pinHash = getCredentialManager().getPinHash() || void 0;
1110
+ const email = this.getRecoveryEmail();
1111
+ const result = await this.withSigningCredentialRetry(
1112
+ () => api.evm.signTransaction({
1113
+ network: getNetworkName(this.chainId),
1114
+ to: tx.to,
1115
+ value: tx.value || "0x0",
1116
+ data: tx.data || "0x",
1117
+ gasLimit: tx.gas || tx.gasLimit,
1118
+ maxFeePerGas: tx.maxFeePerGas,
1119
+ maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1120
+ nonce: tx.nonce ? String(Number.parseInt(tx.nonce, 16)) : void 0,
1121
+ ...pinHash && { pin: pinHash },
1122
+ ...email && { email }
1123
+ })
1124
+ );
1125
+ return result.signature;
1126
+ }
1127
+ /**
1128
+ * Personal sign (EIP-191)
1129
+ */
1130
+ async personal_sign(params) {
1131
+ if (!this.wallet) {
1132
+ logger.error("Wallet not connected");
1133
+ throw new ProviderRpcError(
1134
+ ProviderErrorCode.UNAUTHORIZED,
1135
+ "Wallet not connected"
1136
+ );
1137
+ }
1138
+ if (!Array.isArray(params) || params.length < 2) {
1139
+ logger.error("Invalid params:", params);
1140
+ throw new ProviderRpcError(
1141
+ ProviderErrorCode.INVALID_PARAMS,
1142
+ "Invalid personal_sign params"
1143
+ );
1144
+ }
1145
+ await this.callInterceptor("personal_sign", params);
1146
+ const [message, address] = params;
1147
+ if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1148
+ logger.error("Address mismatch");
1149
+ throw new ProviderRpcError(
1150
+ ProviderErrorCode.INVALID_PARAMS,
1151
+ "Address does not match connected wallet"
1152
+ );
1153
+ }
1154
+ const api = this.getTalkenApiClientOrThrow();
1155
+ const network = getNetworkName(this.chainId);
1156
+ const pinHash = getCredentialManager().getPinHash() || void 0;
1157
+ const email = this.getRecoveryEmail();
1158
+ const rawOpts = Array.isArray(params) && params.length > 2 ? params[2] : null;
1159
+ const validPrefixes = ["eip191", "native"];
1160
+ const signaturePrefix = rawOpts != null && typeof rawOpts === "object" && "signaturePrefix" in rawOpts && validPrefixes.includes(rawOpts.signaturePrefix) ? rawOpts.signaturePrefix : void 0;
1161
+ const result = await this.withSigningCredentialRetry(
1162
+ () => api.evm.signPersonal({
1163
+ network,
1164
+ message,
1165
+ address,
1166
+ pin: pinHash,
1167
+ ...email && { email },
1168
+ ...signaturePrefix && { signaturePrefix }
1169
+ })
1170
+ );
1171
+ return result.signature;
1172
+ }
1173
+ /**
1174
+ * Eth sign
1175
+ */
1176
+ async eth_sign(params) {
1177
+ if (!Array.isArray(params) || params.length < 2) {
1178
+ throw new ProviderRpcError(
1179
+ ProviderErrorCode.INVALID_PARAMS,
1180
+ "Invalid eth_sign params"
1181
+ );
1182
+ }
1183
+ const [address, message] = params;
1184
+ return this.personal_sign([message, address]);
1185
+ }
1186
+ /**
1187
+ * Sign typed data (EIP-712)
1188
+ */
1189
+ async eth_signTypedData(params) {
1190
+ if (!this.wallet) {
1191
+ throw new ProviderRpcError(
1192
+ ProviderErrorCode.UNAUTHORIZED,
1193
+ "Wallet not connected"
1194
+ );
1195
+ }
1196
+ if (!Array.isArray(params) || params.length < 2) {
1197
+ throw new ProviderRpcError(
1198
+ ProviderErrorCode.INVALID_PARAMS,
1199
+ "Invalid signTypedData params"
1200
+ );
1201
+ }
1202
+ await this.callInterceptor("eth_signTypedData_v4", params);
1203
+ const [address, typedData] = params;
1204
+ if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1205
+ throw new ProviderRpcError(
1206
+ ProviderErrorCode.INVALID_PARAMS,
1207
+ "Address does not match connected wallet"
1208
+ );
1209
+ }
1210
+ const api = this.getTalkenApiClientOrThrow();
1211
+ const network = getNetworkName(this.chainId);
1212
+ const pinHash = getCredentialManager().getPinHash() || void 0;
1213
+ const email = this.getRecoveryEmail();
1214
+ const result = await this.withSigningCredentialRetry(
1215
+ () => api.evm.signTypedData({
1216
+ network,
1217
+ typedData: typeof typedData === "string" ? typedData : JSON.stringify(typedData),
1218
+ pin: pinHash,
1219
+ ...email && { email }
1220
+ })
1221
+ );
1222
+ return result.signature;
1223
+ }
1224
+ /**
1225
+ * Return normalized wallet capabilities for ABC embedded wallets.
1226
+ * ABC supports EIP-7702 authorization signing via talken-api.
1227
+ */
1228
+ async wallet_getCapabilities() {
1229
+ return {
1230
+ supportsTypedDataV4: true,
1231
+ supports7702Authorization: true,
1232
+ supports5792Batch: false,
1233
+ supportsPaymasterService: false,
1234
+ supportsPermit2RelayHints: true,
1235
+ walletType: "abc-embedded"
1236
+ };
1237
+ }
1238
+ /**
1239
+ * Sign EIP-7702 authorization via Talken API.
1240
+ */
1241
+ async eth_signAuthorization(params) {
1242
+ if (!this.wallet) {
1243
+ throw new ProviderRpcError(
1244
+ ProviderErrorCode.UNAUTHORIZED,
1245
+ "Wallet not connected"
1246
+ );
1247
+ }
1248
+ if (!Array.isArray(params) || params.length < 2) {
1249
+ throw new ProviderRpcError(
1250
+ ProviderErrorCode.INVALID_PARAMS,
1251
+ "Invalid signAuthorization params"
1252
+ );
1253
+ }
1254
+ const [address, authorization] = params;
1255
+ if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1256
+ throw new ProviderRpcError(
1257
+ ProviderErrorCode.INVALID_PARAMS,
1258
+ "Address does not match connected wallet"
1259
+ );
1260
+ }
1261
+ if (!authorization?.address || authorization.chainId == null || authorization.nonce == null) {
1262
+ throw new ProviderRpcError(
1263
+ ProviderErrorCode.INVALID_PARAMS,
1264
+ "Authorization payload is incomplete"
1265
+ );
1266
+ }
1267
+ await this.callInterceptor("eth_signAuthorization", params);
1268
+ const api = this.getTalkenApiClientOrThrow();
1269
+ const network = getNetworkName(this.chainId);
1270
+ const pinHash = getCredentialManager().getPinHash() || void 0;
1271
+ const email = this.getRecoveryEmail();
1272
+ const chainIdValue = typeof authorization.chainId === "string" ? Number(BigInt(authorization.chainId)) : Number(authorization.chainId);
1273
+ const nonceValue = typeof authorization.nonce === "string" ? BigInt(authorization.nonce).toString() : String(authorization.nonce);
1274
+ const authAddress = authorization.address;
1275
+ const result = await this.withSigningCredentialRetry(
1276
+ () => api.evm.signAuthorization({
1277
+ network,
1278
+ authorization: {
1279
+ chainId: chainIdValue,
1280
+ address: authAddress,
1281
+ nonce: nonceValue
1282
+ },
1283
+ pin: pinHash,
1284
+ ...email && { email }
1285
+ })
1286
+ );
1287
+ return result.authorization;
1288
+ }
1289
+ /**
1290
+ * Switch Ethereum chain
1291
+ */
1292
+ async wallet_switchEthereumChain(params) {
1293
+ if (!Array.isArray(params) || params.length === 0) {
1294
+ throw new ProviderRpcError(
1295
+ ProviderErrorCode.INVALID_PARAMS,
1296
+ "Invalid switchEthereumChain params"
1297
+ );
1298
+ }
1299
+ const { chainId } = params[0];
1300
+ const newChainId = hexToNumber(chainId);
1301
+ if (this.chainId === newChainId) {
1302
+ return null;
1303
+ }
1304
+ const _previousChainId = this.chainId;
1305
+ this.chainId = newChainId;
1306
+ if (this.wallet) {
1307
+ this.wallet.chainId = newChainId;
1308
+ }
1309
+ this.emit("chainChanged", numberToHex(newChainId));
1310
+ return null;
1311
+ }
1312
+ /**
1313
+ * Add Ethereum chain
1314
+ */
1315
+ async wallet_addEthereumChain(params) {
1316
+ return this.wallet_switchEthereumChain(params);
1317
+ }
1318
+ /**
1319
+ * Get transaction count (nonce) using ABC WaaS API
1320
+ */
1321
+ async eth_getTransactionCount(params) {
1322
+ const address = params[0]?.toLowerCase();
1323
+ if (!address) {
1324
+ throw new ProviderRpcError(
1325
+ ProviderErrorCode.INVALID_PARAMS,
1326
+ "Missing address parameter"
1327
+ );
1328
+ }
1329
+ const currentChainId = this.chainId;
1330
+ try {
1331
+ const api = this.getTalkenApiClientOrThrow();
1332
+ const response = await api.evm.getNonce(
1333
+ getNetworkName(currentChainId),
1334
+ address
1335
+ );
1336
+ const nonce = response.result !== void 0 ? typeof response.result === "number" ? `0x${response.result.toString(16)}` : response.result : void 0;
1337
+ if (!nonce) {
1338
+ throw new Error("No result in nonce response");
1339
+ }
1340
+ return nonce;
1341
+ } catch (error) {
1342
+ logger.error("Failed to get transaction count from ABC WaaS:", error);
1343
+ throw new ProviderRpcError(
1344
+ ProviderErrorCode.INTERNAL_ERROR,
1345
+ `Failed to get transaction count: ${error instanceof Error ? error.message : String(error)}`
1346
+ );
1347
+ }
1348
+ }
1349
+ /**
1350
+ * Estimate gas for transaction
1351
+ * Uses ABC WaaS gas estimation API with fallback
1352
+ */
1353
+ async eth_estimateGas(params) {
1354
+ if (!Array.isArray(params) || params.length === 0) {
1355
+ throw new ProviderRpcError(
1356
+ ProviderErrorCode.INVALID_PARAMS,
1357
+ "Invalid estimateGas params"
1358
+ );
1359
+ }
1360
+ const tx = params[0];
1361
+ if (!tx.to) {
1362
+ throw new ProviderRpcError(
1363
+ ProviderErrorCode.INVALID_PARAMS,
1364
+ 'Transaction must have "to" field'
1365
+ );
1366
+ }
1367
+ try {
1368
+ const response = await this.getTalkenApiClientOrThrow().evm.estimateGas({
1369
+ network: getNetworkName(this.chainId),
1370
+ from: tx.from || this.wallet?.address || "",
1371
+ to: tx.to,
1372
+ value: tx.value,
1373
+ data: tx.data
1374
+ });
1375
+ if (!response.result) {
1376
+ throw new Error("No result in gas estimate response");
1377
+ }
1378
+ return response.result;
1379
+ } catch (error) {
1380
+ logger.warn("Gas estimation failed, using fallback:", error);
1381
+ if (tx.data && tx.data !== "0x") {
1382
+ return "0x493e0";
1383
+ }
1384
+ return "0x5208";
1385
+ }
1386
+ }
1387
+ /**
1388
+ * Execute read-only eth_call via talken-api
1389
+ */
1390
+ async eth_call(params) {
1391
+ const p = Array.isArray(params) ? params : [];
1392
+ const tx = p[0];
1393
+ if (!tx?.to || !tx?.data) {
1394
+ throw new ProviderRpcError(
1395
+ ProviderErrorCode.INVALID_PARAMS,
1396
+ "eth_call requires to and data"
1397
+ );
1398
+ }
1399
+ try {
1400
+ const api = this.getTalkenApiClientOrThrow();
1401
+ const response = await api.evm.ethCall({
1402
+ network: getNetworkName(this.chainId),
1403
+ to: tx.to,
1404
+ data: tx.data,
1405
+ from: tx.from || this.wallet?.address
1406
+ });
1407
+ return response?.result ?? response?.data ?? "0x";
1408
+ } catch (error) {
1409
+ throw new ProviderRpcError(
1410
+ ProviderErrorCode.INTERNAL_ERROR,
1411
+ `eth_call failed: ${error instanceof Error ? error.message : String(error)}`
1412
+ );
1413
+ }
1414
+ }
1415
+ /**
1416
+ * Get native balance via talken-api
1417
+ */
1418
+ async eth_getBalance(params) {
1419
+ const p = Array.isArray(params) ? params : [];
1420
+ const address = p[0] || this.wallet?.address;
1421
+ if (!address) {
1422
+ throw new ProviderRpcError(
1423
+ ProviderErrorCode.INVALID_PARAMS,
1424
+ "Missing address parameter"
1425
+ );
1426
+ }
1427
+ try {
1428
+ const api = this.getTalkenApiClientOrThrow();
1429
+ const response = await api.evm.getBalance(
1430
+ getNetworkName(this.chainId),
1431
+ address
1432
+ );
1433
+ return response?.balance ?? "0x0";
1434
+ } catch (error) {
1435
+ throw new ProviderRpcError(
1436
+ ProviderErrorCode.INTERNAL_ERROR,
1437
+ `eth_getBalance failed: ${error instanceof Error ? error.message : String(error)}`
1438
+ );
1439
+ }
1440
+ }
1441
+ /**
1442
+ * Get current wallet
1443
+ */
1444
+ getWallet() {
1445
+ return this.wallet;
1446
+ }
1447
+ /**
1448
+ * Get current chain ID
1449
+ */
1450
+ getChainId() {
1451
+ return this.chainId;
1452
+ }
1453
+ };
1454
+ function createAbcEvmProvider(talkenApi) {
1455
+ return new AbcEvmProvider(talkenApi);
1456
+ }
1457
+ var createAbcProvider = createAbcEvmProvider;
1458
+
1459
+ export {
1460
+ AbcEvmProvider,
1461
+ createAbcEvmProvider,
1462
+ createAbcProvider
1463
+ };