@talken/talkenkit 2.4.26 → 2.4.28

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 (574) hide show
  1. package/dist/{abcWallet-GFKDYN2Z.js → abcWallet-2BVT5XFX.js} +1 -1
  2. package/dist/{chunk-RKEFBYBO.js → chunk-KOK5ZBR4.js} +82 -37
  3. package/dist/hooks/useProfile.d.ts +1 -1
  4. package/dist/index.css +13 -13
  5. package/dist/index.d.ts +0 -1
  6. package/dist/index.js +26 -129
  7. package/dist/services/AbcAuthService.d.ts +0 -3
  8. package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +4 -4
  9. package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +2 -2
  10. package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +4 -4
  11. package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +2 -2
  12. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.d.ts +1 -1
  13. package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +5 -5
  14. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +2 -2
  15. package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.d.ts +1 -0
  16. package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +3 -1
  17. package/dist/wallets/walletConnectors/abcWallet/api/index.js +5 -5
  18. package/dist/wallets/walletConnectors/abcWallet/index.js +16 -16
  19. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +2 -2
  20. package/dist/wallets/walletConnectors/berasigWallet/berasigWallet.js +2 -2
  21. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  22. package/dist/wallets/walletConnectors/binanceWallet/binanceWallet.js +2 -2
  23. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  24. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/{chunk-VTOD7PXP.js → chunk-BHEVY4QY.js} +12 -2
  26. package/dist/wallets/walletConnectors/{chunk-7F5DVU5U.js → chunk-FBJ5H6PM.js} +1 -1
  27. package/dist/wallets/walletConnectors/{chunk-WC7BGU5Z.js → chunk-J3YPHDHM.js} +18 -5
  28. package/dist/wallets/walletConnectors/{chunk-VKOPUEQG.js → chunk-L6WDO3ZN.js} +1 -1
  29. package/dist/wallets/walletConnectors/{chunk-INFMRNND.js → chunk-NLA45GHJ.js} +2 -2
  30. package/dist/wallets/walletConnectors/{chunk-GWYZ2IPP.js → chunk-NU3ITJNK.js} +11 -5
  31. package/dist/wallets/walletConnectors/{chunk-E7TDM6P6.js → chunk-NULM3THX.js} +38 -2
  32. package/dist/wallets/walletConnectors/{chunk-GBMOX5JN.js → chunk-VMCIDCO5.js} +4 -4
  33. package/dist/wallets/walletConnectors/{chunk-7DM6H5BJ.js → chunk-VNL7XEWF.js} +2 -2
  34. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  36. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  37. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  38. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  39. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  40. package/dist/wallets/walletConnectors/index.js +76 -76
  41. package/dist/wallets/walletConnectors/iopayWallet/iopayWallet.js +2 -2
  42. package/dist/wallets/walletConnectors/kaiaWallet/kaiaWallet.js +2 -2
  43. package/dist/wallets/walletConnectors/kaikasWallet/kaikasWallet.js +2 -2
  44. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  45. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  46. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  47. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  48. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  49. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  50. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  51. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  52. package/dist/wallets/walletConnectors/zealWallet/zealWallet.js +2 -2
  53. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  54. package/package.json +1 -1
  55. package/dist/AbcCredentialManager-E723A55X.js +0 -7
  56. package/dist/AbcCredentialManager-GUV5JQ2V.js +0 -7
  57. package/dist/AbcCredentialManager-Z7GDJHYR.js +0 -7
  58. package/dist/Arc-ILTINY4C.js +0 -8
  59. package/dist/Brave-4L5B7JJR.js +0 -8
  60. package/dist/Browser-XMB4J5WD.js +0 -8
  61. package/dist/Chrome-6ZDQIHC5.js +0 -8
  62. package/dist/Edge-OAWCEU7H.js +0 -8
  63. package/dist/Firefox-O66FZK3V.js +0 -8
  64. package/dist/Linux-NUJF4EPC.js +0 -8
  65. package/dist/Macos-46EJ2NPK.js +0 -8
  66. package/dist/Opera-KTUB3UWN.js +0 -8
  67. package/dist/Safari-A3Q6PIT2.js +0 -8
  68. package/dist/Windows-NL32NG52.js +0 -8
  69. package/dist/abcWallet-3PWHJXWR.js +0 -181
  70. package/dist/abcWallet-3XPV7ATY.js +0 -185
  71. package/dist/abcWallet-3XSSUDLJ.js +0 -155
  72. package/dist/abcWallet-4RS3B4ZG.js +0 -188
  73. package/dist/abcWallet-53HAU4MH.js +0 -155
  74. package/dist/abcWallet-5B2YHZGY.js +0 -155
  75. package/dist/abcWallet-664AHBNM.js +0 -183
  76. package/dist/abcWallet-7XAGJUQT.js +0 -188
  77. package/dist/abcWallet-BV7HK3OX.js +0 -181
  78. package/dist/abcWallet-CRKQ3O6J.js +0 -155
  79. package/dist/abcWallet-EBOW2RJB.js +0 -188
  80. package/dist/abcWallet-ES4OPRSK.js +0 -8
  81. package/dist/abcWallet-FSUKHVIW.js +0 -188
  82. package/dist/abcWallet-GYSVK4YG.js +0 -188
  83. package/dist/abcWallet-H4JOSC4N.js +0 -155
  84. package/dist/abcWallet-HM7KZIMP.js +0 -155
  85. package/dist/abcWallet-I5DVALAS.js +0 -155
  86. package/dist/abcWallet-IF3EOKHC.js +0 -183
  87. package/dist/abcWallet-IUG22ZE3.js +0 -155
  88. package/dist/abcWallet-IYC3CKEO.js +0 -155
  89. package/dist/abcWallet-JE6UR4QF.js +0 -181
  90. package/dist/abcWallet-JWLGBJVW.js +0 -188
  91. package/dist/abcWallet-KPKVEGNP.js +0 -185
  92. package/dist/abcWallet-MWUFO3JQ.js +0 -161
  93. package/dist/abcWallet-MZAL5NXP.js +0 -181
  94. package/dist/abcWallet-N2UADRNR.js +0 -155
  95. package/dist/abcWallet-NRFXVTKK.js +0 -188
  96. package/dist/abcWallet-O4GH6RHS.js +0 -181
  97. package/dist/abcWallet-OGHORNUW.js +0 -181
  98. package/dist/abcWallet-OL47MLVO.js +0 -161
  99. package/dist/abcWallet-QSK6VJFU.js +0 -181
  100. package/dist/abcWallet-RKT3W3FX.js +0 -155
  101. package/dist/abcWallet-RS4EOJ4I.js +0 -188
  102. package/dist/abcWallet-SNEZVK7V.js +0 -188
  103. package/dist/abcWallet-TC7M2JYX.js +0 -188
  104. package/dist/abcWallet-VHXTAARP.js +0 -155
  105. package/dist/abcWallet-VPEWH5VC.js +0 -188
  106. package/dist/abcWallet-VYU3TEGJ.js +0 -161
  107. package/dist/abcWallet-VZMW2DR3.js +0 -188
  108. package/dist/abcWallet-WZGXGXUA.js +0 -161
  109. package/dist/abcWallet-XJ3WSUVI.js +0 -188
  110. package/dist/abcWallet-XNCBZAIQ.js +0 -188
  111. package/dist/abcWallet-YFYTW2JH.js +0 -155
  112. package/dist/abcWallet-ZC4B5742.js +0 -188
  113. package/dist/abcWallet-ZPVQY4XE.js +0 -155
  114. package/dist/ar_AR-YBBYUEGS.js +0 -8
  115. package/dist/arbitrum-D2TUFPZI.js +0 -8
  116. package/dist/argentWallet-A5HM5FRP.js +0 -8
  117. package/dist/assets-4NDWRKXE.js +0 -8
  118. package/dist/avalanche-BOOSH35S.js +0 -8
  119. package/dist/base-3JMRS35B.js +0 -8
  120. package/dist/berasigWallet-6IOU73YL.js +0 -8
  121. package/dist/bestWallet-6LJUU6OL.js +0 -8
  122. package/dist/bifrostWallet-SLPPXZ2K.js +0 -8
  123. package/dist/binanceWallet-Z67J7362.js +0 -8
  124. package/dist/bitgetWallet-DLLOWMCI.js +0 -8
  125. package/dist/bitskiWallet-CPOXGABT.js +0 -8
  126. package/dist/bitverseWallet-SAK4MIS6.js +0 -8
  127. package/dist/blast-4GF24NR7.js +0 -8
  128. package/dist/bloomWallet-YIRCNQZJ.js +0 -8
  129. package/dist/braveWallet-PNBKQKJC.js +0 -8
  130. package/dist/bsc-KU6MBOYR.js +0 -8
  131. package/dist/bybitWallet-GCDBAJKO.js +0 -8
  132. package/dist/celo-5A5VXMPX.js +0 -8
  133. package/dist/chunk-2OHX4KTB.js +0 -5382
  134. package/dist/chunk-3VPMUBCL.js +0 -5196
  135. package/dist/chunk-5IC2HV5I.js +0 -7110
  136. package/dist/chunk-5SDWPKKX.js +0 -5322
  137. package/dist/chunk-6FLQAAC4.js +0 -7213
  138. package/dist/chunk-6G2FPET7.js +0 -7123
  139. package/dist/chunk-6RBGFYAF.js +0 -5076
  140. package/dist/chunk-7GIIMIPN.js +0 -7213
  141. package/dist/chunk-7L2ANWBB.js +0 -5139
  142. package/dist/chunk-7VIEAJAM.js +0 -5172
  143. package/dist/chunk-BOURCK5E.js +0 -7121
  144. package/dist/chunk-BY6GTSWI.js +0 -5059
  145. package/dist/chunk-DWE3CZEL.js +0 -5171
  146. package/dist/chunk-GTFQJSXY.js +0 -7139
  147. package/dist/chunk-IBFA37SC.js +0 -7228
  148. package/dist/chunk-J6P2IT7Z.js +0 -5465
  149. package/dist/chunk-JIRBQUIB.js +0 -5348
  150. package/dist/chunk-K6CLOFGV.js +0 -5129
  151. package/dist/chunk-KYTIQ23P.js +0 -5390
  152. package/dist/chunk-MARFD3QV.js +0 -5164
  153. package/dist/chunk-MRRWKS2W.js +0 -348
  154. package/dist/chunk-N7AWNQBH.js +0 -5319
  155. package/dist/chunk-NQCUKFAV.js +0 -5381
  156. package/dist/chunk-O5ZOC4NJ.js +0 -7215
  157. package/dist/chunk-OPOAKGEX.js +0 -7216
  158. package/dist/chunk-OTIHVCVR.js +0 -7213
  159. package/dist/chunk-P77BVZZF.js +0 -7369
  160. package/dist/chunk-PILL2YTG.js +0 -5075
  161. package/dist/chunk-QW7D53VM.js +0 -5129
  162. package/dist/chunk-R4FDCYJX.js +0 -7110
  163. package/dist/chunk-RAWLCGOW.js +0 -5058
  164. package/dist/chunk-RFLXXSQH.js +0 -7139
  165. package/dist/chunk-RIEG3EJO.js +0 -5385
  166. package/dist/chunk-SHUPSYR2.js +0 -5004
  167. package/dist/chunk-SUUJYVW2.js +0 -7089
  168. package/dist/chunk-TJX4M23U.js +0 -27
  169. package/dist/chunk-UIGQOSRS.js +0 -5174
  170. package/dist/chunk-UINIIZCG.js +0 -5098
  171. package/dist/chunk-UKIPSWEV.js +0 -5386
  172. package/dist/chunk-UX7ZGWNT.js +0 -7110
  173. package/dist/chunk-VOQSYTG3.js +0 -5419
  174. package/dist/chunk-VT5Q2XKZ.js +0 -5193
  175. package/dist/chunk-VXQYKPGQ.js +0 -5476
  176. package/dist/chunk-VYLJNEKY.js +0 -5129
  177. package/dist/chunk-X24B5DJR.js +0 -323
  178. package/dist/chunk-X3C73JWU.js +0 -5370
  179. package/dist/chunk-XIDK5P36.js +0 -288
  180. package/dist/chunk-ZHRI7SGC.js +0 -5359
  181. package/dist/clvWallet-R6YRCMZO.js +0 -8
  182. package/dist/coin98Wallet-4Y3ROAGP.js +0 -8
  183. package/dist/coinbaseWallet-L4QDZB5W.js +0 -8
  184. package/dist/compassWallet-NNBX35AV.js +0 -8
  185. package/dist/connect-Q2RLUT5B.js +0 -8
  186. package/dist/coreWallet-PN2LMNGN.js +0 -8
  187. package/dist/create-HQ4QXTKY.js +0 -8
  188. package/dist/cronos-KZAB32FC.js +0 -8
  189. package/dist/dawnWallet-AMO43DL3.js +0 -8
  190. package/dist/de_DE-RUWMVYCQ.js +0 -8
  191. package/dist/desigWallet-AD335WX5.js +0 -8
  192. package/dist/en_US-NQ25CUR4.js +0 -8
  193. package/dist/enkryptWallet-OOP27GE2.js +0 -8
  194. package/dist/es_419-HKJPYJRI.js +0 -8
  195. package/dist/ethereum-WAFT6DML.js +0 -8
  196. package/dist/flow-XANNOAPJ.js +0 -8
  197. package/dist/foxWallet-UDUWOW52.js +0 -8
  198. package/dist/fr_FR-2O5ZDLPQ.js +0 -1356
  199. package/dist/frameWallet-BEABTFIT.js +0 -8
  200. package/dist/frontierWallet-RG47M3C5.js +0 -8
  201. package/dist/gateWallet-XOP74BMB.js +0 -8
  202. package/dist/gnosis-7GFI4V27.js +0 -8
  203. package/dist/hardhat-6HKZWC4T.js +0 -8
  204. package/dist/hi_IN-XRZ4YIUW.js +0 -8
  205. package/dist/id_ID-REEY4CSS.js +0 -8
  206. package/dist/imTokenWallet-LTPKXYUD.js +0 -8
  207. package/dist/injectedWallet-YCFZTULL.js +0 -8
  208. package/dist/iopayWallet-XS37QAUO.js +0 -8
  209. package/dist/ja_JP-2OPCVN6X.js +0 -8
  210. package/dist/kaia-DQ3OSYXE.js +0 -8
  211. package/dist/kaiaWallet-2XZDQZ63.js +0 -8
  212. package/dist/kaikasWallet-V2GCFPEB.js +0 -8
  213. package/dist/ko_KR-DDXBZTYT.js +0 -8
  214. package/dist/krakenWallet-3VM7ZM2O.js +0 -8
  215. package/dist/kresusWallet-4MXFQP4P.js +0 -8
  216. package/dist/ledgerWallet-YC3HF3NJ.js +0 -8
  217. package/dist/login-DGIK764Z.js +0 -8
  218. package/dist/magicEden-BLYGUG47.js +0 -8
  219. package/dist/manta-OEF3QP66.js +0 -8
  220. package/dist/mantle-EYIH4GGM.js +0 -8
  221. package/dist/metaMaskWallet-ZZMFVM52.js +0 -8
  222. package/dist/mewWallet-D6JN37EZ.js +0 -8
  223. package/dist/ms_MY-PX7G4XTD.js +0 -8
  224. package/dist/nestWallet-X3CDHKNV.js +0 -8
  225. package/dist/oktoWallet-ZYLL2RLN.js +0 -8
  226. package/dist/okxWallet-FLICEG4S.js +0 -8
  227. package/dist/omniWallet-DAQHKHUN.js +0 -8
  228. package/dist/oneInchWallet-BRGGUXND.js +0 -8
  229. package/dist/oneKeyWallet-KDU2JIFD.js +0 -8
  230. package/dist/optimism-6GXRYJDW.js +0 -8
  231. package/dist/paraSwapWallet-7UHWT54G.js +0 -8
  232. package/dist/phantomWallet-BSCGZT6L.js +0 -8
  233. package/dist/polygon-YNJM552P.js +0 -8
  234. package/dist/pt_BR-A5R4SBSC.js +0 -8
  235. package/dist/rabbyWallet-RZIUL3YN.js +0 -8
  236. package/dist/rainbowWallet-4ALDT5ZL.js +0 -8
  237. package/dist/ramperWallet-IB3JRE2F.js +0 -8
  238. package/dist/refresh-R5NYTT3S.js +0 -8
  239. package/dist/ronin-LU7LZPWA.js +0 -8
  240. package/dist/roninWallet-BS7VDK7U.js +0 -8
  241. package/dist/ru_RU-4QDZLRSW.js +0 -1356
  242. package/dist/safeWallet-5NR62MJV.js +0 -8
  243. package/dist/safeheronWallet-7ELUSU44.js +0 -8
  244. package/dist/safepalWallet-CZJABQ5N.js +0 -8
  245. package/dist/scan-BVZ7DVJ4.js +0 -8
  246. package/dist/scroll-XRP46UTI.js +0 -8
  247. package/dist/seifWallet-XLBMTX4R.js +0 -8
  248. package/dist/sign-PREOQ4RR.js +0 -8
  249. package/dist/solana/ConfiguredWalletProvider.d.ts +0 -10
  250. package/dist/solana/LegacySolflareWalletAdapter.d.ts +0 -32
  251. package/dist/solana/isWalletReady.d.ts +0 -2
  252. package/dist/subWallet-47USA4OE.js +0 -8
  253. package/dist/tahoWallet-N3XXJ3NW.js +0 -8
  254. package/dist/talismanWallet-SV3B42TQ.js +0 -8
  255. package/dist/th_TH-4TWPYDKX.js +0 -1356
  256. package/dist/tokenPocketWallet-7IYW3MIL.js +0 -8
  257. package/dist/tokenaryWallet-7D2LN65X.js +0 -8
  258. package/dist/tr_TR-C37KIU7M.js +0 -1356
  259. package/dist/trustWallet-HJQBMBC6.js +0 -8
  260. package/dist/uk_UA-I77HS4GO.js +0 -1356
  261. package/dist/uniswapWallet-JZ2ULELN.js +0 -8
  262. package/dist/utils/abcWaasAdapter.d.ts +0 -75
  263. package/dist/utils/secureChannel.d.ts +0 -36
  264. package/dist/valoraWallet-PCTL6UBB.js +0 -8
  265. package/dist/vi_VN-KVPDLW26.js +0 -8
  266. package/dist/walletConnectWallet-AJ36XVBT.js +0 -8
  267. package/dist/wallets/walletConnectors/abcWallet/abcApi.d.ts +0 -238
  268. package/dist/wallets/walletConnectors/abcWallet/abcApi.js +0 -13
  269. package/dist/wallets/walletConnectors/abcWallet/api/AuthApi.d.ts +0 -75
  270. package/dist/wallets/walletConnectors/abcWallet/api/AuthApi.js +0 -11
  271. package/dist/wallets/walletConnectors/abcWallet/api/BaseApiClient.d.ts +0 -83
  272. package/dist/wallets/walletConnectors/abcWallet/api/BaseApiClient.js +0 -10
  273. package/dist/wallets/walletConnectors/abcWallet/api/BitcoinApi.d.ts +0 -65
  274. package/dist/wallets/walletConnectors/abcWallet/api/BitcoinApi.js +0 -11
  275. package/dist/wallets/walletConnectors/abcWallet/api/TransactionApi.d.ts +0 -45
  276. package/dist/wallets/walletConnectors/abcWallet/api/TransactionApi.js +0 -11
  277. package/dist/wallets/walletConnectors/abcWallet/api/TronApi.d.ts +0 -24
  278. package/dist/wallets/walletConnectors/abcWallet/api/TronApi.js +0 -11
  279. package/dist/wallets/walletConnectors/abcWallet/api/WalletApi.d.ts +0 -31
  280. package/dist/wallets/walletConnectors/abcWallet/api/WalletApi.js +0 -12
  281. package/dist/wallets/walletConnectors/abcWallet/backfillMissingWallets.d.ts +0 -3
  282. package/dist/wallets/walletConnectors/abcWallet/backfillMissingWallets.js +0 -16
  283. package/dist/wallets/walletConnectors/chunk-27346T3J.js +0 -134
  284. package/dist/wallets/walletConnectors/chunk-2IZBLAHI.js +0 -52
  285. package/dist/wallets/walletConnectors/chunk-2XX4LJSQ.js +0 -1387
  286. package/dist/wallets/walletConnectors/chunk-32IJ3ILH.js +0 -71
  287. package/dist/wallets/walletConnectors/chunk-35RTM3PL.js +0 -1
  288. package/dist/wallets/walletConnectors/chunk-37X7LFZU.js +0 -302
  289. package/dist/wallets/walletConnectors/chunk-3AX66UHT.js +0 -479
  290. package/dist/wallets/walletConnectors/chunk-3BUGPUMD.js +0 -151
  291. package/dist/wallets/walletConnectors/chunk-3BVPV64G.js +0 -36
  292. package/dist/wallets/walletConnectors/chunk-3DGFHWI3.js +0 -302
  293. package/dist/wallets/walletConnectors/chunk-3H7YKUJZ.js +0 -1407
  294. package/dist/wallets/walletConnectors/chunk-3OWQ6MEU.js +0 -54
  295. package/dist/wallets/walletConnectors/chunk-3SVPZCA6.js +0 -71
  296. package/dist/wallets/walletConnectors/chunk-3VDYWOS4.js +0 -300
  297. package/dist/wallets/walletConnectors/chunk-3XOXT4AM.js +0 -314
  298. package/dist/wallets/walletConnectors/chunk-42D2UPKR.js +0 -439
  299. package/dist/wallets/walletConnectors/chunk-42MF6LUP.js +0 -563
  300. package/dist/wallets/walletConnectors/chunk-4AINEBMQ.js +0 -52
  301. package/dist/wallets/walletConnectors/chunk-4FKUVQCM.js +0 -655
  302. package/dist/wallets/walletConnectors/chunk-4LIJB776.js +0 -273
  303. package/dist/wallets/walletConnectors/chunk-4RZVAQQ4.js +0 -574
  304. package/dist/wallets/walletConnectors/chunk-53UTBIKF.js +0 -209
  305. package/dist/wallets/walletConnectors/chunk-54KVT46V.js +0 -1477
  306. package/dist/wallets/walletConnectors/chunk-56SF4VRC.js +0 -640
  307. package/dist/wallets/walletConnectors/chunk-5KOE7NJW.js +0 -52
  308. package/dist/wallets/walletConnectors/chunk-5QEUEPNY.js +0 -94
  309. package/dist/wallets/walletConnectors/chunk-5UBUX5BT.js +0 -440
  310. package/dist/wallets/walletConnectors/chunk-5W7RBMPH.js +0 -351
  311. package/dist/wallets/walletConnectors/chunk-5ZBV5WE2.js +0 -94
  312. package/dist/wallets/walletConnectors/chunk-6BVNBUEI.js +0 -71
  313. package/dist/wallets/walletConnectors/chunk-6CVXZ3ZW.js +0 -771
  314. package/dist/wallets/walletConnectors/chunk-6EUOVOQK.js +0 -151
  315. package/dist/wallets/walletConnectors/chunk-6GCWEPU7.js +0 -643
  316. package/dist/wallets/walletConnectors/chunk-6ICR4O35.js +0 -372
  317. package/dist/wallets/walletConnectors/chunk-6LH6ZME2.js +0 -479
  318. package/dist/wallets/walletConnectors/chunk-6YFP3Q2I.js +0 -118
  319. package/dist/wallets/walletConnectors/chunk-6YUJPIJ5.js +0 -351
  320. package/dist/wallets/walletConnectors/chunk-77YYMCMD.js +0 -273
  321. package/dist/wallets/walletConnectors/chunk-7EEPPULA.js +0 -118
  322. package/dist/wallets/walletConnectors/chunk-7EQNUYV2.js +0 -482
  323. package/dist/wallets/walletConnectors/chunk-7K4BL7CY.js +0 -516
  324. package/dist/wallets/walletConnectors/chunk-7K77YGQN.js +0 -54
  325. package/dist/wallets/walletConnectors/chunk-7MDXHYMB.js +0 -151
  326. package/dist/wallets/walletConnectors/chunk-7MMVOEZF.js +0 -393
  327. package/dist/wallets/walletConnectors/chunk-7ORDZ6EQ.js +0 -1479
  328. package/dist/wallets/walletConnectors/chunk-7QHCSJDN.js +0 -726
  329. package/dist/wallets/walletConnectors/chunk-7QL42XTB.js +0 -302
  330. package/dist/wallets/walletConnectors/chunk-7RDMH4SD.js +0 -54
  331. package/dist/wallets/walletConnectors/chunk-7RSNIMBB.js +0 -372
  332. package/dist/wallets/walletConnectors/chunk-7S4N4DRT.js +0 -306
  333. package/dist/wallets/walletConnectors/chunk-7SWRH3EI.js +0 -96
  334. package/dist/wallets/walletConnectors/chunk-7ZCM4DCC.js +0 -272
  335. package/dist/wallets/walletConnectors/chunk-A3OJZTDV.js +0 -54
  336. package/dist/wallets/walletConnectors/chunk-A7ZSPSFX.js +0 -577
  337. package/dist/wallets/walletConnectors/chunk-AFM6KHDP.js +0 -314
  338. package/dist/wallets/walletConnectors/chunk-AI3CT254.js +0 -302
  339. package/dist/wallets/walletConnectors/chunk-AJBRO3VA.js +0 -300
  340. package/dist/wallets/walletConnectors/chunk-AMNVH7CZ.js +0 -151
  341. package/dist/wallets/walletConnectors/chunk-AOREXGRM.js +0 -350
  342. package/dist/wallets/walletConnectors/chunk-AXMN57KP.js +0 -1387
  343. package/dist/wallets/walletConnectors/chunk-B6JLYR3I.js +0 -66
  344. package/dist/wallets/walletConnectors/chunk-BBD77PEX.js +0 -761
  345. package/dist/wallets/walletConnectors/chunk-BDM7TUVM.js +0 -874
  346. package/dist/wallets/walletConnectors/chunk-BKVGLYLI.js +0 -194
  347. package/dist/wallets/walletConnectors/chunk-BLO7E54F.js +0 -302
  348. package/dist/wallets/walletConnectors/chunk-BNRH5PYS.js +0 -52
  349. package/dist/wallets/walletConnectors/chunk-BOV5FXU6.js +0 -151
  350. package/dist/wallets/walletConnectors/chunk-BR25RFNF.js +0 -260
  351. package/dist/wallets/walletConnectors/chunk-BXQ2UWJ3.js +0 -91
  352. package/dist/wallets/walletConnectors/chunk-BYZ5QLMX.js +0 -436
  353. package/dist/wallets/walletConnectors/chunk-C3FPON5L.js +0 -213
  354. package/dist/wallets/walletConnectors/chunk-C4L5XI6N.js +0 -302
  355. package/dist/wallets/walletConnectors/chunk-C6G5FPD6.js +0 -286
  356. package/dist/wallets/walletConnectors/chunk-CAMPW7O2.js +0 -874
  357. package/dist/wallets/walletConnectors/chunk-CBIDNYV4.js +0 -1407
  358. package/dist/wallets/walletConnectors/chunk-CC6GTQBN.js +0 -148
  359. package/dist/wallets/walletConnectors/chunk-CE37VZAR.js +0 -300
  360. package/dist/wallets/walletConnectors/chunk-CJOFM6CV.js +0 -71
  361. package/dist/wallets/walletConnectors/chunk-CLMFCNP7.js +0 -52
  362. package/dist/wallets/walletConnectors/chunk-CN672ZCD.js +0 -52
  363. package/dist/wallets/walletConnectors/chunk-CPAYLZZL.js +0 -205
  364. package/dist/wallets/walletConnectors/chunk-D5EFTEOM.js +0 -56
  365. package/dist/wallets/walletConnectors/chunk-DD6KK4BR.js +0 -54
  366. package/dist/wallets/walletConnectors/chunk-DHHVIM22.js +0 -259
  367. package/dist/wallets/walletConnectors/chunk-DSNVWCPD.js +0 -131
  368. package/dist/wallets/walletConnectors/chunk-DSZOE65L.js +0 -107
  369. package/dist/wallets/walletConnectors/chunk-DU6RCLWT.js +0 -272
  370. package/dist/wallets/walletConnectors/chunk-DULGAYBU.js +0 -785
  371. package/dist/wallets/walletConnectors/chunk-DZUXOGSA.js +0 -54
  372. package/dist/wallets/walletConnectors/chunk-EAKU7HN4.js +0 -302
  373. package/dist/wallets/walletConnectors/chunk-ENN6UGGA.js +0 -421
  374. package/dist/wallets/walletConnectors/chunk-EVJIFLSY.js +0 -93
  375. package/dist/wallets/walletConnectors/chunk-EVW3ZB3Q.js +0 -386
  376. package/dist/wallets/walletConnectors/chunk-EXLVQ5ES.js +0 -302
  377. package/dist/wallets/walletConnectors/chunk-EXWDLN5V.js +0 -204
  378. package/dist/wallets/walletConnectors/chunk-F2UWSAMX.js +0 -54
  379. package/dist/wallets/walletConnectors/chunk-F5C6OZYF.js +0 -577
  380. package/dist/wallets/walletConnectors/chunk-FAVNVTIA.js +0 -479
  381. package/dist/wallets/walletConnectors/chunk-FBVPR472.js +0 -314
  382. package/dist/wallets/walletConnectors/chunk-FFU26Y5Y.js +0 -272
  383. package/dist/wallets/walletConnectors/chunk-FGS2WHVA.js +0 -118
  384. package/dist/wallets/walletConnectors/chunk-FJJ3QI4R.js +0 -91
  385. package/dist/wallets/walletConnectors/chunk-FKS2YLVW.js +0 -273
  386. package/dist/wallets/walletConnectors/chunk-FOGNJZPY.js +0 -54
  387. package/dist/wallets/walletConnectors/chunk-FS2OOQYF.js +0 -204
  388. package/dist/wallets/walletConnectors/chunk-FSSV6JY3.js +0 -54
  389. package/dist/wallets/walletConnectors/chunk-G5X3COSW.js +0 -205
  390. package/dist/wallets/walletConnectors/chunk-GFLJ2MAG.js +0 -54
  391. package/dist/wallets/walletConnectors/chunk-GGPJJ6KS.js +0 -1407
  392. package/dist/wallets/walletConnectors/chunk-GJOFP2FQ.js +0 -71
  393. package/dist/wallets/walletConnectors/chunk-GMAYKJEI.js +0 -508
  394. package/dist/wallets/walletConnectors/chunk-GRN6YAJC.js +0 -71
  395. package/dist/wallets/walletConnectors/chunk-H2RCMAOR.js +0 -289
  396. package/dist/wallets/walletConnectors/chunk-H3OWNM73.js +0 -300
  397. package/dist/wallets/walletConnectors/chunk-H53R4SFZ.js +0 -204
  398. package/dist/wallets/walletConnectors/chunk-HF6GFAE5.js +0 -54
  399. package/dist/wallets/walletConnectors/chunk-HKWBR5B7.js +0 -102
  400. package/dist/wallets/walletConnectors/chunk-INT6LGH7.js +0 -180
  401. package/dist/wallets/walletConnectors/chunk-ITZ42A33.js +0 -273
  402. package/dist/wallets/walletConnectors/chunk-IX6DQDRE.js +0 -107
  403. package/dist/wallets/walletConnectors/chunk-IXEXMODE.js +0 -272
  404. package/dist/wallets/walletConnectors/chunk-J4IF6BFF.js +0 -300
  405. package/dist/wallets/walletConnectors/chunk-J4QGDATF.js +0 -71
  406. package/dist/wallets/walletConnectors/chunk-JAMJLNYQ.js +0 -54
  407. package/dist/wallets/walletConnectors/chunk-JDJUIRGF.js +0 -439
  408. package/dist/wallets/walletConnectors/chunk-JEWCPQJZ.js +0 -300
  409. package/dist/wallets/walletConnectors/chunk-JIJNCMJR.js +0 -874
  410. package/dist/wallets/walletConnectors/chunk-JK7LJ4B6.js +0 -1407
  411. package/dist/wallets/walletConnectors/chunk-JPOSJU2D.js +0 -594
  412. package/dist/wallets/walletConnectors/chunk-JSGZYU4A.js +0 -52
  413. package/dist/wallets/walletConnectors/chunk-JUFEPIO4.js +0 -1479
  414. package/dist/wallets/walletConnectors/chunk-JV4IC5Z7.js +0 -54
  415. package/dist/wallets/walletConnectors/chunk-JVT7R2GZ.js +0 -771
  416. package/dist/wallets/walletConnectors/chunk-K37GTJN7.js +0 -52
  417. package/dist/wallets/walletConnectors/chunk-K3JNN5UK.js +0 -71
  418. package/dist/wallets/walletConnectors/chunk-K3VHBOXQ.js +0 -32
  419. package/dist/wallets/walletConnectors/chunk-K4APJ4PE.js +0 -96
  420. package/dist/wallets/walletConnectors/chunk-KBHPY3NA.js +0 -302
  421. package/dist/wallets/walletConnectors/chunk-KBSO4UER.js +0 -372
  422. package/dist/wallets/walletConnectors/chunk-KEX6WS23.js +0 -640
  423. package/dist/wallets/walletConnectors/chunk-KHYKVVR7.js +0 -52
  424. package/dist/wallets/walletConnectors/chunk-KZS2C73S.js +0 -814
  425. package/dist/wallets/walletConnectors/chunk-L6EUMSX2.js +0 -54
  426. package/dist/wallets/walletConnectors/chunk-LJ2B47VF.js +0 -108
  427. package/dist/wallets/walletConnectors/chunk-LJNUFDGO.js +0 -205
  428. package/dist/wallets/walletConnectors/chunk-LOL7ZZ3S.js +0 -302
  429. package/dist/wallets/walletConnectors/chunk-LOSXI36Y.js +0 -479
  430. package/dist/wallets/walletConnectors/chunk-LXINMUQC.js +0 -186
  431. package/dist/wallets/walletConnectors/chunk-M2U5QGM7.js +0 -260
  432. package/dist/wallets/walletConnectors/chunk-M6KRNMD3.js +0 -71
  433. package/dist/wallets/walletConnectors/chunk-M73AWLIV.js +0 -107
  434. package/dist/wallets/walletConnectors/chunk-MAUC46AE.js +0 -302
  435. package/dist/wallets/walletConnectors/chunk-MBRXYEQC.js +0 -272
  436. package/dist/wallets/walletConnectors/chunk-MDDD4LG2.js +0 -874
  437. package/dist/wallets/walletConnectors/chunk-MEAJDFYT.js +0 -302
  438. package/dist/wallets/walletConnectors/chunk-MMR2QAEU.js +0 -642
  439. package/dist/wallets/walletConnectors/chunk-MNZZRFUC.js +0 -302
  440. package/dist/wallets/walletConnectors/chunk-MORUEOYX.js +0 -76
  441. package/dist/wallets/walletConnectors/chunk-MP3WVXPS.js +0 -273
  442. package/dist/wallets/walletConnectors/chunk-MQTXA63X.js +0 -27
  443. package/dist/wallets/walletConnectors/chunk-MRFTCMBN.js +0 -52
  444. package/dist/wallets/walletConnectors/chunk-MTC2HJPF.js +0 -96
  445. package/dist/wallets/walletConnectors/chunk-MTJF3SVB.js +0 -1487
  446. package/dist/wallets/walletConnectors/chunk-N7W4H2XZ.js +0 -71
  447. package/dist/wallets/walletConnectors/chunk-NBEDPUHX.js +0 -91
  448. package/dist/wallets/walletConnectors/chunk-NBVPVTJZ.js +0 -192
  449. package/dist/wallets/walletConnectors/chunk-NISMGNEE.js +0 -223
  450. package/dist/wallets/walletConnectors/chunk-NY5O2OBG.js +0 -1477
  451. package/dist/wallets/walletConnectors/chunk-NYDDRNUI.js +0 -445
  452. package/dist/wallets/walletConnectors/chunk-O47OQDRJ.js +0 -204
  453. package/dist/wallets/walletConnectors/chunk-O4DNG6JJ.js +0 -54
  454. package/dist/wallets/walletConnectors/chunk-OA57GKKV.js +0 -514
  455. package/dist/wallets/walletConnectors/chunk-OIRY24PH.js +0 -302
  456. package/dist/wallets/walletConnectors/chunk-ORBX4JE2.js +0 -52
  457. package/dist/wallets/walletConnectors/chunk-OTES5NGR.js +0 -286
  458. package/dist/wallets/walletConnectors/chunk-OXJFFDW7.js +0 -761
  459. package/dist/wallets/walletConnectors/chunk-OYF6AQOW.js +0 -194
  460. package/dist/wallets/walletConnectors/chunk-PBOCVGUC.js +0 -782
  461. package/dist/wallets/walletConnectors/chunk-PDXO6AOG.js +0 -300
  462. package/dist/wallets/walletConnectors/chunk-PGOYWXV2.js +0 -874
  463. package/dist/wallets/walletConnectors/chunk-PJSN4YRI.js +0 -1387
  464. package/dist/wallets/walletConnectors/chunk-PMZJGS7X.js +0 -73
  465. package/dist/wallets/walletConnectors/chunk-PVIO7FM7.js +0 -314
  466. package/dist/wallets/walletConnectors/chunk-PWJOXYDF.js +0 -54
  467. package/dist/wallets/walletConnectors/chunk-PYBSONED.js +0 -771
  468. package/dist/wallets/walletConnectors/chunk-PYKECUZ3.js +0 -54
  469. package/dist/wallets/walletConnectors/chunk-PYL7NUFJ.js +0 -52
  470. package/dist/wallets/walletConnectors/chunk-Q42NO7WB.js +0 -46
  471. package/dist/wallets/walletConnectors/chunk-Q7XBI5F6.js +0 -300
  472. package/dist/wallets/walletConnectors/chunk-QA3NATYL.js +0 -52
  473. package/dist/wallets/walletConnectors/chunk-QD3PPWTN.js +0 -272
  474. package/dist/wallets/walletConnectors/chunk-QHCLOJYA.js +0 -118
  475. package/dist/wallets/walletConnectors/chunk-QHUBLT7N.js +0 -156
  476. package/dist/wallets/walletConnectors/chunk-QP36UXD5.js +0 -54
  477. package/dist/wallets/walletConnectors/chunk-RCIABMG5.js +0 -259
  478. package/dist/wallets/walletConnectors/chunk-RHC4SVLB.js +0 -71
  479. package/dist/wallets/walletConnectors/chunk-RIJTOH57.js +0 -771
  480. package/dist/wallets/walletConnectors/chunk-RMV23JXO.js +0 -300
  481. package/dist/wallets/walletConnectors/chunk-RS36ZX4P.js +0 -36
  482. package/dist/wallets/walletConnectors/chunk-RY43MKRA.js +0 -552
  483. package/dist/wallets/walletConnectors/chunk-S2CB4KFC.js +0 -71
  484. package/dist/wallets/walletConnectors/chunk-S3L2SA4J.js +0 -300
  485. package/dist/wallets/walletConnectors/chunk-S466OQOC.js +0 -393
  486. package/dist/wallets/walletConnectors/chunk-S6HZD4XZ.js +0 -302
  487. package/dist/wallets/walletConnectors/chunk-S72LCNVX.js +0 -272
  488. package/dist/wallets/walletConnectors/chunk-SA7IXAFG.js +0 -54
  489. package/dist/wallets/walletConnectors/chunk-SCWE5EEX.js +0 -91
  490. package/dist/wallets/walletConnectors/chunk-SDB6BBHX.js +0 -585
  491. package/dist/wallets/walletConnectors/chunk-SFGVPX2G.js +0 -351
  492. package/dist/wallets/walletConnectors/chunk-SFQKJ6X6.js +0 -314
  493. package/dist/wallets/walletConnectors/chunk-SHJBMDP4.js +0 -278
  494. package/dist/wallets/walletConnectors/chunk-SKLRJRER.js +0 -1464
  495. package/dist/wallets/walletConnectors/chunk-SQVWIBWR.js +0 -351
  496. package/dist/wallets/walletConnectors/chunk-SSLHXCOX.js +0 -439
  497. package/dist/wallets/walletConnectors/chunk-SU6LV3EO.js +0 -314
  498. package/dist/wallets/walletConnectors/chunk-SU7IEZE2.js +0 -300
  499. package/dist/wallets/walletConnectors/chunk-TKEL4D4E.js +0 -151
  500. package/dist/wallets/walletConnectors/chunk-TKJEMEBZ.js +0 -71
  501. package/dist/wallets/walletConnectors/chunk-TMRB5SCL.js +0 -167
  502. package/dist/wallets/walletConnectors/chunk-TMUPUOQR.js +0 -54
  503. package/dist/wallets/walletConnectors/chunk-TNZ7QKXH.js +0 -771
  504. package/dist/wallets/walletConnectors/chunk-TQXCRSMS.js +0 -199
  505. package/dist/wallets/walletConnectors/chunk-TT2NLKIU.js +0 -1465
  506. package/dist/wallets/walletConnectors/chunk-TZ44ZREA.js +0 -302
  507. package/dist/wallets/walletConnectors/chunk-U3WGMWTH.js +0 -585
  508. package/dist/wallets/walletConnectors/chunk-UAV4SI4Y.js +0 -408
  509. package/dist/wallets/walletConnectors/chunk-UAWWPNS7.js +0 -54
  510. package/dist/wallets/walletConnectors/chunk-UGQSI3US.js +0 -547
  511. package/dist/wallets/walletConnectors/chunk-URFU24K7.js +0 -273
  512. package/dist/wallets/walletConnectors/chunk-USS5CPXQ.js +0 -54
  513. package/dist/wallets/walletConnectors/chunk-UU4JYY3C.js +0 -205
  514. package/dist/wallets/walletConnectors/chunk-UXRJASPW.js +0 -785
  515. package/dist/wallets/walletConnectors/chunk-UY5TAYLM.js +0 -54
  516. package/dist/wallets/walletConnectors/chunk-V5P5BL6Z.js +0 -302
  517. package/dist/wallets/walletConnectors/chunk-VB5IZDY7.js +0 -300
  518. package/dist/wallets/walletConnectors/chunk-VH6DIRPF.js +0 -71
  519. package/dist/wallets/walletConnectors/chunk-VIKJNKJZ.js +0 -219
  520. package/dist/wallets/walletConnectors/chunk-VPNZAMW5.js +0 -205
  521. package/dist/wallets/walletConnectors/chunk-VQYS4NXP.js +0 -314
  522. package/dist/wallets/walletConnectors/chunk-VVEXF6KG.js +0 -273
  523. package/dist/wallets/walletConnectors/chunk-W2YIRNMB.js +0 -300
  524. package/dist/wallets/walletConnectors/chunk-W6QN6QXO.js +0 -52
  525. package/dist/wallets/walletConnectors/chunk-W7EGSTIU.js +0 -71
  526. package/dist/wallets/walletConnectors/chunk-W7L2SBIG.js +0 -138
  527. package/dist/wallets/walletConnectors/chunk-WDULICVN.js +0 -302
  528. package/dist/wallets/walletConnectors/chunk-WGGHGODM.js +0 -272
  529. package/dist/wallets/walletConnectors/chunk-WS5FG53X.js +0 -54
  530. package/dist/wallets/walletConnectors/chunk-WVRGC2YL.js +0 -300
  531. package/dist/wallets/walletConnectors/chunk-WZZVA3LW.js +0 -101
  532. package/dist/wallets/walletConnectors/chunk-X33WL7R7.js +0 -300
  533. package/dist/wallets/walletConnectors/chunk-XG2R64B7.js +0 -785
  534. package/dist/wallets/walletConnectors/chunk-XOQNQKZE.js +0 -98
  535. package/dist/wallets/walletConnectors/chunk-XUCMTLM3.js +0 -52
  536. package/dist/wallets/walletConnectors/chunk-Y2BWF42Z.js +0 -54
  537. package/dist/wallets/walletConnectors/chunk-Y446VZWI.js +0 -585
  538. package/dist/wallets/walletConnectors/chunk-Y5WAX6WO.js +0 -52
  539. package/dist/wallets/walletConnectors/chunk-Y62PFBWE.js +0 -640
  540. package/dist/wallets/walletConnectors/chunk-YDSBY7NO.js +0 -54
  541. package/dist/wallets/walletConnectors/chunk-YRDNIP2H.js +0 -90
  542. package/dist/wallets/walletConnectors/chunk-YROAFC7Z.js +0 -54
  543. package/dist/wallets/walletConnectors/chunk-YWP2ASJM.js +0 -71
  544. package/dist/wallets/walletConnectors/chunk-Z3L3JJNU.js +0 -356
  545. package/dist/wallets/walletConnectors/chunk-Z4WVT3G2.js +0 -1416
  546. package/dist/wallets/walletConnectors/chunk-Z5SBGIWT.js +0 -300
  547. package/dist/wallets/walletConnectors/chunk-Z6ABK6G6.js +0 -107
  548. package/dist/wallets/walletConnectors/chunk-ZAZVSLZK.js +0 -52
  549. package/dist/wallets/walletConnectors/chunk-ZCA5QSIM.js +0 -71
  550. package/dist/wallets/walletConnectors/chunk-ZJ6OFFD5.js +0 -95
  551. package/dist/wallets/walletConnectors/chunk-ZJDZJW55.js +0 -479
  552. package/dist/wallets/walletConnectors/chunk-ZK3PZIAH.js +0 -300
  553. package/dist/wallets/walletConnectors/chunk-ZKCUYHBK.js +0 -300
  554. package/dist/wallets/walletConnectors/chunk-ZOF7ZDGU.js +0 -52
  555. package/dist/wallets/walletConnectors/chunk-ZPJLV3E7.js +0 -151
  556. package/dist/wallets/walletConnectors/chunk-ZQ3LCYGH.js +0 -408
  557. package/dist/wallets/walletConnectors/chunk-ZQJIAY3X.js +0 -286
  558. package/dist/wallets/walletConnectors/chunk-ZTNC64G5.js +0 -372
  559. package/dist/wallets/walletConnectors/chunk-ZUU57RHO.js +0 -36
  560. package/dist/wallets/walletConnectors/chunk-ZWFGRREM.js +0 -36
  561. package/dist/wallets/walletConnectors/chunk-ZX6HMX7N.js +0 -1468
  562. package/dist/wallets/walletConnectors/chunk-ZXN465CA.js +0 -209
  563. package/dist/wallets/walletConnectors/chunk-ZY5BCHP2.js +0 -302
  564. package/dist/wigwamWallet-D3MVGB5Z.js +0 -8
  565. package/dist/xdc-5NQHQJE5.js +0 -8
  566. package/dist/xdefiWallet-B4O6HAIP.js +0 -8
  567. package/dist/zealWallet-6SPNICRX.js +0 -8
  568. package/dist/zerionWallet-XZ3JCAOO.js +0 -8
  569. package/dist/zetachain-U6IILKZJ.js +0 -8
  570. package/dist/zh_CN-KGLAIP3N.js +0 -8
  571. package/dist/zh_HK-AEXEN6P6.js +0 -8
  572. package/dist/zh_TW-6C7R5V3K.js +0 -8
  573. package/dist/zkSync-TMPB52ZN.js +0 -8
  574. package/dist/zora-S46CHEOU.js +0 -8
@@ -1,5004 +0,0 @@
1
- "use client";
2
- import {
3
- ABC_WALLET_METADATA,
4
- DEFAULT_TALKEN_API_CONFIG,
5
- PIN_CONFIG,
6
- STORAGE_PREFIX,
7
- TALKEN_API_ENDPOINTS,
8
- TOKEN_EXPIRY,
9
- getCredentialManager
10
- } from "./chunk-XIDK5P36.js";
11
-
12
- // src/wallets/walletConnectors/abcWallet/abcWallet.ts
13
- import { setTalkenApiClient as setTalkenApiClient2 } from "@talken/talkenkit";
14
-
15
- // src/wallets/walletConnectors/abcWallet/abcConnector.ts
16
- import { getTalkenApiClient as getTalkenApiClient3 } from "@talken/talkenkit";
17
- import { createConnector } from "wagmi";
18
-
19
- // src/wallets/walletConnectors/abcWallet/abcProvider.ts
20
- import { getTalkenApiClient } from "@talken/talkenkit";
21
- import { parseGwei } from "viem";
22
-
23
- // src/config/networks.ts
24
- var NetworkType = /* @__PURE__ */ ((NetworkType2) => {
25
- NetworkType2["EVM"] = "EVM";
26
- NetworkType2["NON_EVM"] = "Non-EVM";
27
- NetworkType2["BITCOIN"] = "Bitcoin";
28
- NetworkType2["TRON"] = "TRX";
29
- NetworkType2["ICP"] = "ICP";
30
- NetworkType2["SOLANA"] = "Solana";
31
- return NetworkType2;
32
- })(NetworkType || {});
33
- var NETWORK_CONFIGS = {
34
- // Ethereum Mainnet
35
- 1: {
36
- chainId: 1,
37
- network: "ethereum",
38
- name: "Ethereum",
39
- type: "EVM" /* EVM */,
40
- isTestnet: false,
41
- explorer: "https://etherscan.io",
42
- website: "https://ethereum.org",
43
- nativeCurrency: {
44
- name: "Ether",
45
- symbol: "ETH",
46
- decimals: 18
47
- },
48
- apiSupport: { tokens: true, nft: true, transactions: true },
49
- signSupport: { legacy: true, eip1559: true }
50
- },
51
- // Ethereum Sepolia Testnet
52
- 11155111: {
53
- chainId: 11155111,
54
- network: "ethereum_sepolia",
55
- name: "Ethereum Sepolia",
56
- type: "EVM" /* EVM */,
57
- isTestnet: true,
58
- explorer: "https://sepolia.etherscan.io",
59
- website: "https://ethereum.org",
60
- nativeCurrency: {
61
- name: "Sepolia Ether",
62
- symbol: "ETH",
63
- decimals: 18
64
- },
65
- apiSupport: { tokens: true, nft: true, transactions: true },
66
- signSupport: { legacy: true, eip1559: true }
67
- },
68
- // Ethereum Holesky Testnet
69
- 17e3: {
70
- chainId: 17e3,
71
- network: "ethereum_holesky",
72
- name: "Ethereum Holesky",
73
- type: "EVM" /* EVM */,
74
- isTestnet: true,
75
- explorer: "https://holesky.etherscan.io",
76
- website: "https://ethereum.org",
77
- nativeCurrency: {
78
- name: "Holesky Ether",
79
- symbol: "ETH",
80
- decimals: 18
81
- },
82
- apiSupport: { tokens: true, nft: true, transactions: true },
83
- signSupport: { legacy: true, eip1559: true }
84
- },
85
- // Kaia Mainnet (formerly Klaytn)
86
- 8217: {
87
- chainId: 8217,
88
- network: "kaia",
89
- name: "Kaia Mainnet",
90
- type: "EVM" /* EVM */,
91
- isTestnet: false,
92
- explorer: "https://kaiascan.io",
93
- website: "https://kaia.io",
94
- nativeCurrency: {
95
- name: "Kaia",
96
- symbol: "KAIA",
97
- decimals: 18
98
- },
99
- apiSupport: { tokens: true, nft: true, transactions: true },
100
- signSupport: { legacy: true, eip1559: true }
101
- },
102
- // Kaia Kairos Testnet
103
- 1001: {
104
- chainId: 1001,
105
- network: "kaia_kairos",
106
- name: "Kaia Kairos Testnet",
107
- type: "EVM" /* EVM */,
108
- isTestnet: true,
109
- explorer: "https://kairos.kaiascan.io",
110
- website: "https://kaia.io",
111
- nativeCurrency: {
112
- name: "Kaia",
113
- symbol: "KAIA",
114
- decimals: 18
115
- },
116
- apiSupport: { tokens: true, nft: true, transactions: true },
117
- signSupport: { legacy: true, eip1559: true }
118
- },
119
- // Polygon Mainnet
120
- 137: {
121
- chainId: 137,
122
- network: "polygon",
123
- name: "Polygon",
124
- type: "EVM" /* EVM */,
125
- isTestnet: false,
126
- explorer: "https://polygonscan.com",
127
- website: "https://polygon.technology",
128
- nativeCurrency: {
129
- name: "MATIC",
130
- symbol: "MATIC",
131
- decimals: 18
132
- },
133
- apiSupport: { tokens: true, nft: true, transactions: true },
134
- signSupport: { legacy: true, eip1559: true }
135
- },
136
- // Polygon Amoy Testnet
137
- 80001: {
138
- chainId: 80001,
139
- network: "polygon_amoy",
140
- name: "Polygon Amoy Testnet",
141
- type: "EVM" /* EVM */,
142
- isTestnet: true,
143
- explorer: "https://amoy.polygonscan.com",
144
- website: "https://polygon.technology",
145
- nativeCurrency: {
146
- name: "MATIC",
147
- symbol: "MATIC",
148
- decimals: 18
149
- },
150
- apiSupport: { tokens: true, nft: true, transactions: true },
151
- signSupport: { legacy: true, eip1559: true }
152
- },
153
- // Binance Smart Chain Mainnet
154
- 56: {
155
- chainId: 56,
156
- network: "binance",
157
- name: "Binance Smart Chain Mainnet",
158
- type: "EVM" /* EVM */,
159
- isTestnet: false,
160
- explorer: "https://bscscan.com",
161
- website: "https://www.bnbchain.org/en/bnb-smart-chain",
162
- nativeCurrency: {
163
- name: "BNB",
164
- symbol: "BNB",
165
- decimals: 18
166
- },
167
- apiSupport: { tokens: true, nft: true, transactions: true },
168
- signSupport: { legacy: true, eip1559: true }
169
- },
170
- // Binance Smart Chain Testnet
171
- 97: {
172
- chainId: 97,
173
- network: "binance_testnet",
174
- name: "Binance Smart Chain Testnet",
175
- type: "EVM" /* EVM */,
176
- isTestnet: true,
177
- explorer: "https://testnet.bscscan.com",
178
- website: "https://www.bnbchain.org/en/bnb-smart-chain",
179
- nativeCurrency: {
180
- name: "BNB",
181
- symbol: "BNB",
182
- decimals: 18
183
- },
184
- apiSupport: { tokens: true, nft: true, transactions: true },
185
- signSupport: { legacy: true, eip1559: true }
186
- },
187
- // Arbitrum One
188
- 42161: {
189
- chainId: 42161,
190
- network: "arbitrum",
191
- name: "Arbitrum One",
192
- type: "EVM" /* EVM */,
193
- isTestnet: false,
194
- explorer: "https://arbiscan.io",
195
- website: "https://arbitrum.io",
196
- nativeCurrency: {
197
- name: "Ether",
198
- symbol: "ETH",
199
- decimals: 18
200
- },
201
- apiSupport: { tokens: true, nft: true, transactions: true },
202
- signSupport: { legacy: true, eip1559: true }
203
- },
204
- // Arbitrum Sepolia
205
- 421614: {
206
- chainId: 421614,
207
- network: "arbitrum_sepolia",
208
- name: "Arbitrum Sepolia",
209
- type: "EVM" /* EVM */,
210
- isTestnet: true,
211
- explorer: "https://sepolia.arbiscan.io",
212
- website: "https://arbitrum.io",
213
- nativeCurrency: {
214
- name: "Ether",
215
- symbol: "ETH",
216
- decimals: 18
217
- },
218
- apiSupport: { tokens: true, nft: true, transactions: true },
219
- signSupport: { legacy: true, eip1559: true }
220
- },
221
- // Optimism Mainnet
222
- 10: {
223
- chainId: 10,
224
- network: "optimism",
225
- name: "Optimism",
226
- type: "EVM" /* EVM */,
227
- isTestnet: false,
228
- explorer: "https://optimistic.etherscan.io",
229
- website: "https://optimism.io",
230
- nativeCurrency: {
231
- name: "Ether",
232
- symbol: "ETH",
233
- decimals: 18
234
- },
235
- apiSupport: { tokens: true, nft: true, transactions: true },
236
- signSupport: { legacy: true, eip1559: true }
237
- },
238
- // Optimism Sepolia
239
- 420: {
240
- chainId: 420,
241
- network: "optimism_sepolia",
242
- name: "Optimism Sepolia",
243
- type: "EVM" /* EVM */,
244
- isTestnet: true,
245
- explorer: "https://sepolia-optimism.etherscan.io",
246
- website: "https://optimism.io",
247
- nativeCurrency: {
248
- name: "Ether",
249
- symbol: "ETH",
250
- decimals: 18
251
- },
252
- apiSupport: { tokens: true, nft: true, transactions: true },
253
- signSupport: { legacy: true, eip1559: true }
254
- },
255
- // Avalanche C-Chain
256
- 43114: {
257
- chainId: 43114,
258
- network: "avalanche",
259
- name: "Avalanche C-Chain",
260
- type: "EVM" /* EVM */,
261
- isTestnet: false,
262
- explorer: "https://avascan.info/blockchain/c/home",
263
- website: "https://avax.network",
264
- nativeCurrency: {
265
- name: "Avalanche",
266
- symbol: "AVAX",
267
- decimals: 18
268
- },
269
- apiSupport: { tokens: true, nft: true, transactions: true },
270
- signSupport: { legacy: true, eip1559: true }
271
- },
272
- // Avalanche Fuji Testnet
273
- 43113: {
274
- chainId: 43113,
275
- network: "avalanche_fuji",
276
- name: "Avalanche Fuji Testnet",
277
- type: "EVM" /* EVM */,
278
- isTestnet: true,
279
- explorer: "https://testnet.avascan.info",
280
- website: "https://avax.network",
281
- nativeCurrency: {
282
- name: "Avalanche",
283
- symbol: "AVAX",
284
- decimals: 18
285
- },
286
- apiSupport: { tokens: false, nft: false, transactions: false },
287
- signSupport: { legacy: true, eip1559: true }
288
- },
289
- // Mantle Mainnet
290
- 5e3: {
291
- chainId: 5e3,
292
- network: "mantle",
293
- name: "Mantle Mainnet",
294
- type: "EVM" /* EVM */,
295
- isTestnet: false,
296
- explorer: "https://explorer.mantle.xyz",
297
- website: "https://www.mantle.xyz",
298
- nativeCurrency: {
299
- name: "Mantle",
300
- symbol: "MNT",
301
- decimals: 18
302
- },
303
- apiSupport: { tokens: true, nft: true, transactions: true },
304
- signSupport: { legacy: true, eip1559: true }
305
- },
306
- // Mantle Testnet
307
- 5001: {
308
- chainId: 5001,
309
- network: "mantle_testnet",
310
- name: "Mantle Testnet",
311
- type: "EVM" /* EVM */,
312
- isTestnet: true,
313
- explorer: "https://sepolia.mantlescan.xyz",
314
- website: "https://www.mantle.xyz",
315
- nativeCurrency: {
316
- name: "Mantle",
317
- symbol: "MNT",
318
- decimals: 18
319
- },
320
- apiSupport: { tokens: true, nft: true, transactions: true },
321
- signSupport: { legacy: true, eip1559: true }
322
- },
323
- // Moonbeam
324
- 1284: {
325
- chainId: 1284,
326
- network: "moonbeam",
327
- name: "Moonbeam",
328
- type: "EVM" /* EVM */,
329
- isTestnet: false,
330
- explorer: "https://moonbeam.moonscan.io",
331
- website: "https://moonbeam.network",
332
- nativeCurrency: {
333
- name: "Glimmer",
334
- symbol: "GLMR",
335
- decimals: 18
336
- },
337
- apiSupport: { tokens: true, nft: true, transactions: true },
338
- signSupport: { legacy: true, eip1559: true }
339
- },
340
- // Moonriver
341
- 1285: {
342
- chainId: 1285,
343
- network: "moonriver",
344
- name: "Moonriver",
345
- type: "EVM" /* EVM */,
346
- isTestnet: false,
347
- explorer: "https://moonriver.moonscan.io",
348
- website: "https://moonbeam.network/networks/moonriver",
349
- nativeCurrency: {
350
- name: "Moonriver",
351
- symbol: "MOVR",
352
- decimals: 18
353
- },
354
- apiSupport: { tokens: true, nft: true, transactions: true },
355
- signSupport: { legacy: true, eip1559: true }
356
- },
357
- // Scroll Mainnet
358
- 534352: {
359
- chainId: 534352,
360
- network: "scroll",
361
- name: "Scroll",
362
- type: "EVM" /* EVM */,
363
- isTestnet: false,
364
- explorer: "https://scrollscan.co",
365
- website: "https://scroll.io",
366
- nativeCurrency: {
367
- name: "Ether",
368
- symbol: "ETH",
369
- decimals: 18
370
- },
371
- apiSupport: { tokens: true, nft: true, transactions: true },
372
- signSupport: { legacy: true, eip1559: true }
373
- },
374
- // Scroll Testnet
375
- 534351: {
376
- chainId: 534351,
377
- network: "scroll_testnet",
378
- name: "Scroll Testnet",
379
- type: "EVM" /* EVM */,
380
- isTestnet: true,
381
- explorer: "https://sepolia.scrollscan.com",
382
- website: "https://scroll.io",
383
- nativeCurrency: {
384
- name: "Ether",
385
- symbol: "ETH",
386
- decimals: 18
387
- },
388
- apiSupport: { tokens: true, nft: true, transactions: true },
389
- signSupport: { legacy: true, eip1559: true }
390
- },
391
- // Silicon Mainnet
392
- 2355: {
393
- chainId: 2355,
394
- network: "silicon",
395
- name: "Silicon",
396
- type: "EVM" /* EVM */,
397
- isTestnet: false,
398
- explorer: "https://scope.silicon.network",
399
- website: "https://silicon.network",
400
- nativeCurrency: {
401
- name: "Ether",
402
- symbol: "ETH",
403
- decimals: 18
404
- },
405
- apiSupport: { tokens: true, nft: true, transactions: true },
406
- signSupport: { legacy: true, eip1559: true }
407
- },
408
- // Silicon Sepolia
409
- 1722641160: {
410
- chainId: 1722641160,
411
- network: "silicon_sepolia",
412
- name: "Silicon Sepolia",
413
- type: "EVM" /* EVM */,
414
- isTestnet: true,
415
- explorer: "https://scope-sepolia.silicon.network",
416
- website: "https://silicon.network",
417
- nativeCurrency: {
418
- name: "Ether",
419
- symbol: "ETH",
420
- decimals: 18
421
- },
422
- apiSupport: { tokens: true, nft: true, transactions: true },
423
- signSupport: { legacy: true, eip1559: true }
424
- },
425
- // Six Protocol
426
- 98: {
427
- chainId: 98,
428
- network: "six_evm",
429
- name: "Six Protocol",
430
- type: "EVM" /* EVM */,
431
- isTestnet: false,
432
- explorer: "https://v2.sixscan.io",
433
- website: "https://www.six.network",
434
- nativeCurrency: {
435
- name: "SIX",
436
- symbol: "SIX",
437
- decimals: 18
438
- },
439
- apiSupport: { tokens: true, nft: false, transactions: true },
440
- signSupport: { legacy: true, eip1559: false }
441
- },
442
- // Six Protocol Testnet
443
- 150: {
444
- chainId: 150,
445
- network: "six_evm_testnet",
446
- name: "Six Protocol Testnet",
447
- type: "EVM" /* EVM */,
448
- isTestnet: true,
449
- explorer: "https://v2.fivenet.sixscan.io",
450
- website: "https://www.six.network",
451
- nativeCurrency: {
452
- name: "SIX",
453
- symbol: "SIX",
454
- decimals: 18
455
- },
456
- apiSupport: { tokens: true, nft: false, transactions: true },
457
- signSupport: { legacy: true, eip1559: false }
458
- },
459
- // Wemix Mainnet
460
- 1111: {
461
- chainId: 1111,
462
- network: "wemix",
463
- name: "Wemix3.0 Mainnet",
464
- type: "EVM" /* EVM */,
465
- isTestnet: false,
466
- explorer: "https://explorer.wemix.com",
467
- website: "https://wemix.com",
468
- nativeCurrency: {
469
- name: "WEMIX",
470
- symbol: "WEMIX",
471
- decimals: 18
472
- },
473
- apiSupport: { tokens: true, nft: true, transactions: true },
474
- signSupport: { legacy: true, eip1559: true }
475
- },
476
- // Wemix Testnet
477
- 1112: {
478
- chainId: 1112,
479
- network: "wemix_testnet",
480
- name: "Wemix3.0 Testnet",
481
- type: "EVM" /* EVM */,
482
- isTestnet: true,
483
- explorer: "https://explorer.test.wemix.com",
484
- website: "https://wemix.com",
485
- nativeCurrency: {
486
- name: "WEMIX",
487
- symbol: "WEMIX",
488
- decimals: 18
489
- },
490
- apiSupport: { tokens: true, nft: true, transactions: true },
491
- signSupport: { legacy: true, eip1559: true }
492
- },
493
- // Taiko Mainnet
494
- 167e3: {
495
- chainId: 167e3,
496
- network: "taiko",
497
- name: "Taiko Mainnet",
498
- type: "EVM" /* EVM */,
499
- isTestnet: false,
500
- explorer: "https://taikoscan.io",
501
- website: "https://taiko.xyz",
502
- nativeCurrency: {
503
- name: "Ether",
504
- symbol: "ETH",
505
- decimals: 18
506
- },
507
- apiSupport: { tokens: true, nft: true, transactions: true },
508
- signSupport: { legacy: true, eip1559: true }
509
- },
510
- // Taiko Hekla Testnet
511
- 167009: {
512
- chainId: 167009,
513
- network: "taiko_hekla",
514
- name: "Taiko Hekla Testnet",
515
- type: "EVM" /* EVM */,
516
- isTestnet: true,
517
- explorer: "https://hekla.taikoscan.io",
518
- website: "https://taiko.xyz",
519
- nativeCurrency: {
520
- name: "Ether",
521
- symbol: "ETH",
522
- decimals: 18
523
- },
524
- apiSupport: { tokens: true, nft: true, transactions: true },
525
- signSupport: { legacy: true, eip1559: true }
526
- },
527
- // Base Mainnet
528
- 8453: {
529
- chainId: 8453,
530
- network: "base",
531
- name: "Base",
532
- type: "EVM" /* EVM */,
533
- isTestnet: false,
534
- explorer: "https://basescan.org",
535
- website: "https://base.org",
536
- nativeCurrency: {
537
- name: "Ether",
538
- symbol: "ETH",
539
- decimals: 18
540
- },
541
- apiSupport: { tokens: true, nft: true, transactions: true },
542
- signSupport: { legacy: true, eip1559: true }
543
- },
544
- // Base Sepolia Testnet
545
- 84532: {
546
- chainId: 84532,
547
- network: "base_sepolia",
548
- name: "Base Sepolia",
549
- type: "EVM" /* EVM */,
550
- isTestnet: true,
551
- explorer: "https://sepolia.basescan.org",
552
- website: "https://base.org",
553
- nativeCurrency: {
554
- name: "Ether",
555
- symbol: "ETH",
556
- decimals: 18
557
- },
558
- apiSupport: { tokens: true, nft: true, transactions: true },
559
- signSupport: { legacy: true, eip1559: true }
560
- },
561
- // ChainBounty Mainnet
562
- 51828: {
563
- chainId: 51828,
564
- network: "chainbounty",
565
- name: "ChainBounty Mainnet",
566
- type: "EVM" /* EVM */,
567
- isTestnet: false,
568
- explorer: "https://scan.chainbounty.io",
569
- website: "https://chainbounty.io",
570
- nativeCurrency: {
571
- name: "ChainBounty",
572
- symbol: "CBY",
573
- decimals: 18
574
- },
575
- apiSupport: { tokens: true, nft: true, transactions: true },
576
- signSupport: { legacy: true, eip1559: true }
577
- },
578
- // ChainBounty Testnet
579
- 56580: {
580
- chainId: 56580,
581
- network: "chainbounty_testnet",
582
- name: "ChainBounty Testnet",
583
- type: "EVM" /* EVM */,
584
- isTestnet: true,
585
- explorer: "https://test.scan.chainbounty.io",
586
- website: "https://chainbounty.io",
587
- nativeCurrency: {
588
- name: "ChainBounty",
589
- symbol: "CBY",
590
- decimals: 18
591
- },
592
- apiSupport: { tokens: true, nft: true, transactions: true },
593
- signSupport: { legacy: true, eip1559: true }
594
- },
595
- // Aptos Mainnet (Non-EVM)
596
- aptos: {
597
- chainId: null,
598
- network: "aptos",
599
- name: "Aptos",
600
- type: "Non-EVM" /* NON_EVM */,
601
- isTestnet: false,
602
- explorer: "https://explorer.aptoslabs.com/?network=mainnet",
603
- website: "https://aptos.dev",
604
- nativeCurrency: {
605
- name: "Aptos",
606
- symbol: "APT",
607
- decimals: 8
608
- },
609
- apiSupport: { tokens: true, nft: true, transactions: true },
610
- signSupport: { legacy: true, eip1559: false }
611
- },
612
- // Aptos Testnet (Non-EVM)
613
- aptos_testnet: {
614
- chainId: null,
615
- network: "aptos_testnet",
616
- name: "Aptos Testnet",
617
- type: "Non-EVM" /* NON_EVM */,
618
- isTestnet: true,
619
- explorer: "https://explorer.aptoslabs.com/?network=testnet",
620
- website: "https://aptos.dev",
621
- nativeCurrency: {
622
- name: "Aptos",
623
- symbol: "APT",
624
- decimals: 8
625
- },
626
- apiSupport: { tokens: true, nft: true, transactions: true },
627
- signSupport: { legacy: true, eip1559: false }
628
- },
629
- // Bitcoin Mainnet
630
- bitcoin: {
631
- chainId: null,
632
- network: "bitcoin",
633
- name: "Bitcoin Mainnet",
634
- type: "Bitcoin" /* BITCOIN */,
635
- isTestnet: false,
636
- explorer: "https://blockstream.info",
637
- website: "https://bitcoin.org",
638
- nativeCurrency: {
639
- name: "Bitcoin",
640
- symbol: "BTC",
641
- decimals: 8
642
- },
643
- apiSupport: { tokens: true, nft: false, transactions: true },
644
- signSupport: { legacy: true, eip1559: false }
645
- },
646
- // Bitcoin Testnet
647
- bitcoin_testnet: {
648
- chainId: null,
649
- network: "bitcoin_testnet",
650
- name: "Bitcoin Testnet",
651
- type: "Bitcoin" /* BITCOIN */,
652
- isTestnet: true,
653
- explorer: "https://blockstream.info/testnet",
654
- website: "https://bitcoin.org",
655
- nativeCurrency: {
656
- name: "Bitcoin",
657
- symbol: "BTC",
658
- decimals: 8
659
- },
660
- apiSupport: { tokens: true, nft: false, transactions: true },
661
- signSupport: { legacy: true, eip1559: false }
662
- },
663
- // Tron Mainnet
664
- tron: {
665
- chainId: null,
666
- network: "tron",
667
- name: "Tron Mainnet",
668
- type: "TRX" /* TRON */,
669
- isTestnet: false,
670
- explorer: "https://tronscan.org",
671
- website: "https://tron.network",
672
- nativeCurrency: {
673
- name: "Tronix",
674
- symbol: "TRX",
675
- decimals: 6
676
- },
677
- apiSupport: { tokens: true, nft: true, transactions: true },
678
- signSupport: { legacy: true, eip1559: true }
679
- },
680
- // Tron Nile Testnet
681
- tron_nile: {
682
- chainId: null,
683
- network: "tron_nile",
684
- name: "Tron Nile Testnet",
685
- type: "TRX" /* TRON */,
686
- isTestnet: true,
687
- explorer: "https://nile.tronscan.org",
688
- website: "https://tron.network",
689
- nativeCurrency: {
690
- name: "Tronix",
691
- symbol: "TRX",
692
- decimals: 6
693
- },
694
- apiSupport: { tokens: true, nft: true, transactions: true },
695
- signSupport: { legacy: true, eip1559: true }
696
- },
697
- // ICP Mainnet
698
- icp: {
699
- chainId: null,
700
- network: "icp",
701
- name: "Internet Computer",
702
- type: "ICP" /* ICP */,
703
- isTestnet: false,
704
- explorer: "https://dashboard.internetcomputer.org",
705
- website: "https://internetcomputer.org",
706
- nativeCurrency: {
707
- name: "ICP",
708
- symbol: "ICP",
709
- decimals: 8
710
- },
711
- apiSupport: { tokens: true, nft: true, transactions: true },
712
- signSupport: { legacy: true, eip1559: true }
713
- }
714
- };
715
- var NETWORK_BY_PARAM = Object.values(
716
- NETWORK_CONFIGS
717
- ).reduce(
718
- (acc, config) => {
719
- acc[config.network] = config;
720
- return acc;
721
- },
722
- {}
723
- );
724
- function getNetworkByChainId(chainId) {
725
- return NETWORK_CONFIGS[chainId];
726
- }
727
- function getNetworkByParam(network) {
728
- return NETWORK_BY_PARAM[network];
729
- }
730
- function chainIdToNetwork(chainId) {
731
- return NETWORK_CONFIGS[chainId]?.network;
732
- }
733
- function getNetworkName(chainId, fallback = "ethereum") {
734
- return NETWORK_CONFIGS[chainId]?.network ?? fallback;
735
- }
736
- var CHAIN_ID_TO_KEY = {
737
- // Mainnet
738
- 1: "ethereum",
739
- 42161: "arbitrum",
740
- 8217: "kaia",
741
- 56: "bsc",
742
- 8453: "base",
743
- 137: "polygon",
744
- // Testnet
745
- 11155111: "sepolia",
746
- 421614: "arbitrumSepolia",
747
- 1001: "kaiaKairos",
748
- 97: "bscTestnet",
749
- 84532: "baseSepolia",
750
- 80002: "polygonAmoy",
751
- 998: "hyperevmTestnet"
752
- };
753
- function getChainKey(chainId) {
754
- const key = CHAIN_ID_TO_KEY[chainId];
755
- if (!key) {
756
- throw new Error(`Unsupported chainId for tx endpoint: ${chainId}`);
757
- }
758
- return key;
759
- }
760
- function networkNameToChainKey(network) {
761
- const chainId = NETWORK_BY_PARAM[network]?.chainId;
762
- if (chainId == null)
763
- return network;
764
- return CHAIN_ID_TO_KEY[chainId] ?? network;
765
- }
766
- function networkToChainId(network) {
767
- return NETWORK_BY_PARAM[network]?.chainId;
768
- }
769
- function getExplorerTxUrl(chainIdOrNetwork, txHash) {
770
- const config = typeof chainIdOrNetwork === "number" ? getNetworkByChainId(chainIdOrNetwork) : getNetworkByParam(chainIdOrNetwork);
771
- if (!config) {
772
- throw new Error(`Unknown network: ${chainIdOrNetwork}`);
773
- }
774
- return `${config.explorer}/tx/${txHash}`;
775
- }
776
- function getExplorerAddressUrl(chainIdOrNetwork, address) {
777
- const config = typeof chainIdOrNetwork === "number" ? getNetworkByChainId(chainIdOrNetwork) : getNetworkByParam(chainIdOrNetwork);
778
- if (!config) {
779
- throw new Error(`Unknown network: ${chainIdOrNetwork}`);
780
- }
781
- return `${config.explorer}/address/${address}`;
782
- }
783
- function isEvmNetwork(chainIdOrNetwork) {
784
- const config = typeof chainIdOrNetwork === "number" ? getNetworkByChainId(chainIdOrNetwork) : getNetworkByParam(chainIdOrNetwork);
785
- return config?.type === "EVM" /* EVM */;
786
- }
787
- function isTestnet(chainIdOrNetwork) {
788
- const config = typeof chainIdOrNetwork === "number" ? getNetworkByChainId(chainIdOrNetwork) : getNetworkByParam(chainIdOrNetwork);
789
- return config?.isTestnet ?? false;
790
- }
791
- function getSupportedChainIds(includeTestnets = true) {
792
- return Object.values(NETWORK_CONFIGS).filter(
793
- (config) => config.chainId !== null && (includeTestnets || !config.isTestnet)
794
- ).map((config) => config.chainId);
795
- }
796
- function getSupportedNetworks(includeTestnets = true) {
797
- return Object.values(NETWORK_CONFIGS).filter((config) => includeTestnets || !config.isTestnet).map((config) => config.network);
798
- }
799
-
800
- // src/wallets/walletConnectors/abcWallet/types.ts
801
- var AbcStorageKey = /* @__PURE__ */ ((AbcStorageKey2) => {
802
- AbcStorageKey2["USER"] = "user";
803
- AbcStorageKey2["WALLET"] = "wallet";
804
- AbcStorageKey2["SOLANA_WALLET"] = "solana_wallet";
805
- AbcStorageKey2["BITCOIN_WALLET"] = "bitcoin_wallet";
806
- AbcStorageKey2["TRON_WALLET"] = "tron_wallet";
807
- AbcStorageKey2["ACCESS_TOKEN"] = "access_token";
808
- AbcStorageKey2["REFRESH_TOKEN"] = "refresh_token";
809
- AbcStorageKey2["EXPIRES_AT"] = "expires_at";
810
- AbcStorageKey2["AUTH_STATE"] = "auth_state";
811
- return AbcStorageKey2;
812
- })(AbcStorageKey || {});
813
- var AbcErrorCode = /* @__PURE__ */ ((AbcErrorCode3) => {
814
- AbcErrorCode3["INVALID_CREDENTIALS"] = "INVALID_CREDENTIALS";
815
- AbcErrorCode3["TOKEN_EXPIRED"] = "TOKEN_EXPIRED";
816
- AbcErrorCode3["WALLET_NOT_FOUND"] = "WALLET_NOT_FOUND";
817
- AbcErrorCode3["INVALID_PIN"] = "INVALID_PIN";
818
- AbcErrorCode3["NETWORK_ERROR"] = "NETWORK_ERROR";
819
- AbcErrorCode3["SIGNATURE_FAILED"] = "SIGNATURE_FAILED";
820
- AbcErrorCode3["USER_CANCELLED"] = "USER_CANCELLED";
821
- AbcErrorCode3["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
822
- return AbcErrorCode3;
823
- })(AbcErrorCode || {});
824
- var AbcError = class extends Error {
825
- constructor(code, message, details, statusCode) {
826
- super(message);
827
- this.name = "AbcError";
828
- this.code = code;
829
- this.details = details;
830
- this.statusCode = statusCode;
831
- }
832
- };
833
- var TalkenApiError = class extends Error {
834
- constructor(code, message, statusCode, details) {
835
- super(message);
836
- this.name = "TalkenApiError";
837
- this.code = code;
838
- this.statusCode = statusCode;
839
- this.details = details;
840
- }
841
- };
842
-
843
- // src/wallets/walletConnectors/abcWallet/utils.ts
844
- async function hashPin(pin) {
845
- if (typeof window === "undefined" || !window.crypto?.subtle) {
846
- return btoa(pin);
847
- }
848
- const encoder = new TextEncoder();
849
- const data = encoder.encode(pin);
850
- const hashBuffer = await window.crypto.subtle.digest("SHA-256", data);
851
- const hashArray = Array.from(new Uint8Array(hashBuffer));
852
- const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
853
- return hashHex;
854
- }
855
- function validatePin(pin) {
856
- if (!pin || typeof pin !== "string") {
857
- return false;
858
- }
859
- const pinLength = pin.length;
860
- if (pinLength < PIN_CONFIG.MIN_LENGTH || pinLength > PIN_CONFIG.MAX_LENGTH) {
861
- return false;
862
- }
863
- return /^\d+$/.test(pin);
864
- }
865
- function validateEmail(email) {
866
- if (!email || typeof email !== "string") {
867
- return false;
868
- }
869
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
870
- return emailRegex.test(email);
871
- }
872
- function getStorageKey(key) {
873
- return `${STORAGE_PREFIX}${key}`;
874
- }
875
- function saveToStorage(key, value) {
876
- if (typeof window === "undefined")
877
- return;
878
- try {
879
- const storageKey = getStorageKey(key);
880
- const serialized = JSON.stringify(value);
881
- localStorage.setItem(storageKey, serialized);
882
- } catch (error) {
883
- console.error("Failed to save to storage:", error);
884
- }
885
- }
886
- function loadFromStorage(key) {
887
- if (typeof window === "undefined")
888
- return null;
889
- try {
890
- const storageKey = getStorageKey(key);
891
- const serialized = localStorage.getItem(storageKey);
892
- if (!serialized)
893
- return null;
894
- try {
895
- return JSON.parse(serialized);
896
- } catch {
897
- return serialized;
898
- }
899
- } catch (error) {
900
- console.error("Failed to load from storage:", error);
901
- return null;
902
- }
903
- }
904
- function removeFromStorage(key) {
905
- if (typeof window === "undefined")
906
- return;
907
- try {
908
- const storageKey = getStorageKey(key);
909
- localStorage.removeItem(storageKey);
910
- } catch (error) {
911
- console.error("Failed to remove from storage:", error);
912
- }
913
- }
914
- function clearStorage() {
915
- if (typeof window === "undefined")
916
- return;
917
- const keysToRemove = [];
918
- for (let i = 0; i < localStorage.length; i++) {
919
- const key = localStorage.key(i);
920
- if (key?.startsWith(STORAGE_PREFIX)) {
921
- keysToRemove.push(key);
922
- }
923
- }
924
- for (const key of keysToRemove) {
925
- localStorage.removeItem(key);
926
- }
927
- }
928
- function isTokenExpired(expiresAt) {
929
- if (!expiresAt)
930
- return true;
931
- return Date.now() >= expiresAt - TOKEN_EXPIRY.REFRESH_BUFFER;
932
- }
933
- function calculateExpiryTimestamp(expiresIn) {
934
- return Date.now() + expiresIn * 1e3;
935
- }
936
- function saveAuthState(state) {
937
- saveToStorage("auth_state" /* AUTH_STATE */, state);
938
- if (state.user) {
939
- saveToStorage("user" /* USER */, state.user);
940
- }
941
- if (state.wallet) {
942
- saveToStorage("wallet" /* WALLET */, state.wallet);
943
- }
944
- if (state.solanaWallet) {
945
- saveToStorage("solana_wallet" /* SOLANA_WALLET */, state.solanaWallet);
946
- }
947
- if (state.bitcoinWallet) {
948
- saveToStorage("bitcoin_wallet" /* BITCOIN_WALLET */, state.bitcoinWallet);
949
- }
950
- if (state.tronWallet) {
951
- saveToStorage("tron_wallet" /* TRON_WALLET */, state.tronWallet);
952
- }
953
- if (state.accessToken) {
954
- saveToStorage("access_token" /* ACCESS_TOKEN */, state.accessToken);
955
- }
956
- if (state.refreshToken) {
957
- saveToStorage("refresh_token" /* REFRESH_TOKEN */, state.refreshToken);
958
- }
959
- if (state.expiresAt) {
960
- saveToStorage("expires_at" /* EXPIRES_AT */, state.expiresAt);
961
- }
962
- }
963
- function hydrateAuthStateFromIndividualStorage(state) {
964
- const user = loadFromStorage("user" /* USER */);
965
- const wallet = loadFromStorage("wallet" /* WALLET */);
966
- const solanaWallet = loadFromStorage("solana_wallet" /* SOLANA_WALLET */);
967
- const bitcoinWallet = loadFromStorage("bitcoin_wallet" /* BITCOIN_WALLET */);
968
- const tronWallet = loadFromStorage("tron_wallet" /* TRON_WALLET */);
969
- const accessToken = loadFromStorage("access_token" /* ACCESS_TOKEN */);
970
- const refreshToken = loadFromStorage("refresh_token" /* REFRESH_TOKEN */);
971
- const expiresAt = loadFromStorage("expires_at" /* EXPIRES_AT */);
972
- const nextState = {
973
- ...state,
974
- user: state.user || user || null,
975
- wallet: state.wallet || wallet || null,
976
- solanaWallet: state.solanaWallet || solanaWallet || null,
977
- bitcoinWallet: state.bitcoinWallet || bitcoinWallet || null,
978
- tronWallet: state.tronWallet || tronWallet || null,
979
- accessToken: state.accessToken || accessToken || null,
980
- refreshToken: state.refreshToken || refreshToken || null,
981
- expiresAt: state.expiresAt || expiresAt || null
982
- };
983
- const wasHydrated = nextState.user !== state.user || nextState.wallet !== state.wallet || nextState.solanaWallet !== state.solanaWallet || nextState.bitcoinWallet !== state.bitcoinWallet || nextState.tronWallet !== state.tronWallet || nextState.accessToken !== state.accessToken || nextState.refreshToken !== state.refreshToken || nextState.expiresAt !== state.expiresAt;
984
- if (wasHydrated) {
985
- saveToStorage("auth_state" /* AUTH_STATE */, nextState);
986
- }
987
- return nextState;
988
- }
989
- function loadAuthState() {
990
- const state = loadFromStorage("auth_state" /* AUTH_STATE */);
991
- if (state) {
992
- if (state.accessToken && isTokenExpired(state.expiresAt)) {
993
- clearStorage();
994
- return null;
995
- }
996
- return hydrateAuthStateFromIndividualStorage(state);
997
- }
998
- const user = loadFromStorage("user" /* USER */);
999
- const wallet = loadFromStorage("wallet" /* WALLET */);
1000
- const solanaWallet = loadFromStorage("solana_wallet" /* SOLANA_WALLET */);
1001
- const accessToken = loadFromStorage("access_token" /* ACCESS_TOKEN */);
1002
- const refreshToken = loadFromStorage("refresh_token" /* REFRESH_TOKEN */);
1003
- const expiresAt = loadFromStorage("expires_at" /* EXPIRES_AT */);
1004
- if (!user || !accessToken) {
1005
- return null;
1006
- }
1007
- const bitcoinWallet = loadFromStorage("bitcoin_wallet" /* BITCOIN_WALLET */);
1008
- const tronWallet = loadFromStorage("tron_wallet" /* TRON_WALLET */);
1009
- return {
1010
- isAuthenticated: true,
1011
- user,
1012
- wallet,
1013
- solanaWallet,
1014
- bitcoinWallet,
1015
- tronWallet,
1016
- accessToken,
1017
- refreshToken,
1018
- expiresAt
1019
- };
1020
- }
1021
- function clearAuthState() {
1022
- clearStorage();
1023
- }
1024
- function createAbcError(code, message, details, statusCode) {
1025
- return new AbcError(code, message, details, statusCode);
1026
- }
1027
- function hexToNumber(hex) {
1028
- return Number.parseInt(hex, 16);
1029
- }
1030
- function numberToHex(num) {
1031
- return `0x${num.toString(16)}`;
1032
- }
1033
-
1034
- // src/wallets/walletConnectors/abcWallet/abcProvider.ts
1035
- var EventEmitter = class {
1036
- constructor() {
1037
- this.events = /* @__PURE__ */ new Map();
1038
- }
1039
- on(event, listener) {
1040
- if (!this.events.has(event)) {
1041
- this.events.set(event, []);
1042
- }
1043
- this.events.get(event).push(listener);
1044
- return this;
1045
- }
1046
- off(event, listener) {
1047
- const listeners = this.events.get(event);
1048
- if (listeners) {
1049
- const index = listeners.indexOf(listener);
1050
- if (index !== -1) {
1051
- listeners.splice(index, 1);
1052
- }
1053
- }
1054
- return this;
1055
- }
1056
- removeListener(event, listener) {
1057
- return this.off(event, listener);
1058
- }
1059
- emit(event, ...args) {
1060
- const listeners = this.events.get(event);
1061
- if (listeners) {
1062
- for (const listener of listeners) {
1063
- listener(...args);
1064
- }
1065
- return true;
1066
- }
1067
- return false;
1068
- }
1069
- removeAllListeners(event) {
1070
- if (event) {
1071
- this.events.delete(event);
1072
- } else {
1073
- this.events.clear();
1074
- }
1075
- return this;
1076
- }
1077
- };
1078
- var ProviderRpcError = class extends Error {
1079
- constructor(code, message, data) {
1080
- super(message);
1081
- this.code = code;
1082
- this.data = data;
1083
- this.name = "ProviderRpcError";
1084
- }
1085
- };
1086
- var ErrorCode = {
1087
- USER_REJECTED: 4001,
1088
- UNAUTHORIZED: 4100,
1089
- UNSUPPORTED_METHOD: 4200,
1090
- DISCONNECTED: 4900,
1091
- CHAIN_DISCONNECTED: 4901,
1092
- INVALID_PARAMS: -32602,
1093
- INTERNAL_ERROR: -32603
1094
- };
1095
- var AbcEvmProvider = class extends EventEmitter {
1096
- constructor(talkenApi) {
1097
- super();
1098
- this.wallet = null;
1099
- this.chainId = 1;
1100
- // Default to Ethereum mainnet
1101
- this.connected = false;
1102
- this.talkenApi = talkenApi;
1103
- }
1104
- getRecoveryEmail() {
1105
- const walletEmail = this.wallet?.email?.trim();
1106
- if (walletEmail) {
1107
- return walletEmail;
1108
- }
1109
- return getCredentialManager().getEmail() || void 0;
1110
- }
1111
- /**
1112
- * Set wallet information
1113
- */
1114
- setWallet(wallet) {
1115
- const previousAddress = this.wallet?.address;
1116
- const previousChainId = this.chainId;
1117
- this.wallet = wallet;
1118
- this.chainId = wallet.chainId;
1119
- this.connected = true;
1120
- if (previousAddress !== wallet.address) {
1121
- this.emit("accountsChanged", [wallet.address]);
1122
- }
1123
- if (previousChainId !== wallet.chainId) {
1124
- this.emit("chainChanged", numberToHex(wallet.chainId));
1125
- }
1126
- this.emit("connect", { chainId: numberToHex(wallet.chainId) });
1127
- }
1128
- /**
1129
- * Clear wallet (disconnect)
1130
- */
1131
- clearWallet() {
1132
- this.wallet = null;
1133
- this.connected = false;
1134
- this.emit("disconnect", {
1135
- code: ErrorCode.DISCONNECTED,
1136
- message: "User disconnected"
1137
- });
1138
- this.emit("accountsChanged", []);
1139
- }
1140
- /**
1141
- * Set request interceptor for sign confirmation
1142
- * The interceptor is called before signing operations to show confirmation UI
1143
- */
1144
- setRequestInterceptor(interceptor) {
1145
- this.requestInterceptor = interceptor;
1146
- }
1147
- /**
1148
- * Set TalkenApiClient for backend-proxied transaction flow
1149
- * When set, transaction methods will use a single API call instead of multi-step WaaS
1150
- */
1151
- setTalkenApi(talkenApi) {
1152
- this.talkenApi = talkenApi;
1153
- }
1154
- getTalkenApiClientOrThrow() {
1155
- const api = this.talkenApi || getTalkenApiClient();
1156
- if (!api) {
1157
- throw new ProviderRpcError(
1158
- ErrorCode.INTERNAL_ERROR,
1159
- "TalkenApiClient not initialized"
1160
- );
1161
- }
1162
- return api;
1163
- }
1164
- /**
1165
- * Call request interceptor if configured
1166
- * Called by specific signing/transaction methods that need user confirmation
1167
- * @returns Resolved transaction with user modifications if changed in confirmation modal
1168
- */
1169
- async callInterceptor(method, params) {
1170
- if (!this.requestInterceptor) {
1171
- return void 0;
1172
- }
1173
- const request = {
1174
- method,
1175
- params,
1176
- chainId: this.chainId,
1177
- address: this.wallet?.address || ""
1178
- };
1179
- return this.requestInterceptor(request);
1180
- }
1181
- /**
1182
- * EIP-1193 request method
1183
- */
1184
- async request(args) {
1185
- const { method, params } = args;
1186
- switch (method) {
1187
- case "eth_requestAccounts":
1188
- return this.eth_requestAccounts();
1189
- case "eth_accounts":
1190
- return this.eth_accounts();
1191
- case "eth_chainId":
1192
- return this.eth_chainId();
1193
- case "eth_sendTransaction":
1194
- case "wallet_sendTransaction":
1195
- return this.eth_sendTransaction(params);
1196
- case "eth_signTransaction":
1197
- return this.eth_signTransaction(params);
1198
- case "personal_sign":
1199
- return this.personal_sign(params);
1200
- case "eth_sign":
1201
- return this.eth_sign(params);
1202
- case "eth_signTypedData":
1203
- case "eth_signTypedData_v3":
1204
- case "eth_signTypedData_v4":
1205
- return this.eth_signTypedData(params);
1206
- case "wallet_getCapabilities":
1207
- return this.wallet_getCapabilities();
1208
- case "eth_signAuthorization":
1209
- return this.eth_signAuthorization(params);
1210
- case "wallet_switchEthereumChain":
1211
- return this.wallet_switchEthereumChain(params);
1212
- case "wallet_addEthereumChain":
1213
- return this.wallet_addEthereumChain(params);
1214
- case "eth_estimateGas":
1215
- return this.eth_estimateGas(params);
1216
- case "eth_getTransactionCount":
1217
- return this.eth_getTransactionCount(
1218
- Array.isArray(params) ? params : []
1219
- );
1220
- case "eth_blockNumber":
1221
- case "eth_call":
1222
- case "eth_gasPrice":
1223
- case "eth_getBalance":
1224
- case "eth_getBlockByHash":
1225
- case "eth_getBlockByNumber":
1226
- case "eth_getCode":
1227
- case "eth_getStorageAt":
1228
- case "eth_getTransactionByHash":
1229
- case "eth_getTransactionReceipt":
1230
- throw new ProviderRpcError(
1231
- ErrorCode.UNSUPPORTED_METHOD,
1232
- `Method ${method} should be handled by RPC provider`
1233
- );
1234
- default:
1235
- throw new ProviderRpcError(
1236
- ErrorCode.UNSUPPORTED_METHOD,
1237
- `Method ${method} not supported`
1238
- );
1239
- }
1240
- }
1241
- /**
1242
- * Request accounts (EIP-1193)
1243
- */
1244
- async eth_requestAccounts() {
1245
- if (!this.wallet) {
1246
- throw new ProviderRpcError(
1247
- ErrorCode.UNAUTHORIZED,
1248
- "Wallet not connected"
1249
- );
1250
- }
1251
- return [this.wallet.address];
1252
- }
1253
- /**
1254
- * Get accounts
1255
- */
1256
- async eth_accounts() {
1257
- if (!this.wallet) {
1258
- return [];
1259
- }
1260
- return [this.wallet.address];
1261
- }
1262
- /**
1263
- * Get chain ID
1264
- */
1265
- async eth_chainId() {
1266
- return numberToHex(this.chainId);
1267
- }
1268
- /**
1269
- * Send transaction
1270
- */
1271
- async eth_sendTransaction(params) {
1272
- if (!this.wallet) {
1273
- throw new ProviderRpcError(
1274
- ErrorCode.UNAUTHORIZED,
1275
- "Wallet not connected"
1276
- );
1277
- }
1278
- if (!Array.isArray(params) || params.length === 0) {
1279
- throw new ProviderRpcError(
1280
- ErrorCode.INVALID_PARAMS,
1281
- "Invalid transaction params"
1282
- );
1283
- }
1284
- const resolved = await this.callInterceptor("eth_sendTransaction", params);
1285
- const tx = params[0];
1286
- console.log("[AbcProvider] eth_sendTransaction incoming gas params:", {
1287
- gas: tx.gas ?? tx.gasLimit,
1288
- gasPrice: tx.gasPrice,
1289
- maxFeePerGas: tx.maxFeePerGas,
1290
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas
1291
- });
1292
- if (resolved) {
1293
- if (resolved.data) {
1294
- tx.data = resolved.data;
1295
- }
1296
- if (resolved.gasFee?.maxFeePerGas) {
1297
- try {
1298
- const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
1299
- tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
1300
- } catch (error) {
1301
- console.error(
1302
- "[AbcProvider] \u274C Failed to parse maxFeePerGas:",
1303
- error
1304
- );
1305
- }
1306
- }
1307
- if (resolved.gasFee?.maxPriorityFeePerGas) {
1308
- try {
1309
- const priorityFeeWei = parseGwei(
1310
- resolved.gasFee.maxPriorityFeePerGas
1311
- );
1312
- tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
1313
- } catch (error) {
1314
- console.error(
1315
- "[AbcProvider] \u274C Failed to parse maxPriorityFeePerGas:",
1316
- error
1317
- );
1318
- }
1319
- }
1320
- }
1321
- console.log("[AbcProvider] eth_sendTransaction final gas params:", {
1322
- gas: tx.gas ?? tx.gasLimit,
1323
- gasPrice: tx.gasPrice,
1324
- maxFeePerGas: tx.maxFeePerGas,
1325
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas
1326
- });
1327
- const isContractDeployment = !tx.to || tx.to === "0x" || tx.to === "0x0" || tx.to === "0x0000000000000000000000000000000000000000";
1328
- if (isContractDeployment) {
1329
- tx.to = "0x";
1330
- } else if (!tx.to) {
1331
- throw new ProviderRpcError(
1332
- ErrorCode.INVALID_PARAMS,
1333
- 'Transaction must have "to" field'
1334
- );
1335
- }
1336
- const pinHash = getCredentialManager().getPinHash();
1337
- if (!pinHash) {
1338
- throw new ProviderRpcError(
1339
- ErrorCode.INTERNAL_ERROR,
1340
- "PIN hash not found. Please login again."
1341
- );
1342
- }
1343
- const hexValue = tx.value || "0x0";
1344
- const amountWei = BigInt(hexValue).toString();
1345
- const email = this.getRecoveryEmail();
1346
- const api = this.getTalkenApiClientOrThrow();
1347
- const result = await api.evm.sendTransaction({
1348
- chainKey: getChainKey(this.chainId),
1349
- to: tx.to,
1350
- amountWei,
1351
- pin: pinHash,
1352
- data: tx.data || "0x",
1353
- gasLimit: tx.gas || tx.gasLimit,
1354
- maxFeePerGas: tx.maxFeePerGas,
1355
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1356
- ...email && { email }
1357
- });
1358
- return result.txHash;
1359
- }
1360
- /**
1361
- * Sign transaction (without sending)
1362
- */
1363
- async eth_signTransaction(params) {
1364
- if (!this.wallet) {
1365
- throw new ProviderRpcError(
1366
- ErrorCode.UNAUTHORIZED,
1367
- "Wallet not connected"
1368
- );
1369
- }
1370
- if (!Array.isArray(params) || params.length === 0) {
1371
- throw new ProviderRpcError(
1372
- ErrorCode.INVALID_PARAMS,
1373
- "Invalid transaction params"
1374
- );
1375
- }
1376
- const resolved = await this.callInterceptor("eth_signTransaction", params);
1377
- const tx = params[0];
1378
- if (resolved) {
1379
- if (resolved.data) {
1380
- tx.data = resolved.data;
1381
- }
1382
- if (resolved.gasFee?.maxFeePerGas) {
1383
- try {
1384
- const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
1385
- tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
1386
- } catch (error) {
1387
- console.error(
1388
- "[AbcProvider] \u274C Failed to parse maxFeePerGas:",
1389
- error
1390
- );
1391
- }
1392
- }
1393
- if (resolved.gasFee?.maxPriorityFeePerGas) {
1394
- try {
1395
- const priorityFeeWei = parseGwei(
1396
- resolved.gasFee.maxPriorityFeePerGas
1397
- );
1398
- tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
1399
- } catch (error) {
1400
- console.error(
1401
- "[AbcProvider] \u274C Failed to parse maxPriorityFeePerGas:",
1402
- error
1403
- );
1404
- }
1405
- }
1406
- }
1407
- const api = this.getTalkenApiClientOrThrow();
1408
- const pinHash = getCredentialManager().getPinHash() || void 0;
1409
- const email = this.getRecoveryEmail();
1410
- const result = await api.evm.signTransaction({
1411
- network: getNetworkName(this.chainId),
1412
- to: tx.to,
1413
- value: tx.value || "0x0",
1414
- data: tx.data || "0x",
1415
- gasLimit: tx.gas || tx.gasLimit,
1416
- maxFeePerGas: tx.maxFeePerGas,
1417
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1418
- nonce: tx.nonce ? String(Number.parseInt(tx.nonce, 16)) : void 0,
1419
- ...pinHash && { pin: pinHash },
1420
- ...email && { email }
1421
- });
1422
- return result.signature;
1423
- }
1424
- /**
1425
- * Personal sign (EIP-191)
1426
- */
1427
- async personal_sign(params) {
1428
- if (!this.wallet) {
1429
- console.error("[AbcProvider] \u274C Wallet not connected");
1430
- throw new ProviderRpcError(
1431
- ErrorCode.UNAUTHORIZED,
1432
- "Wallet not connected"
1433
- );
1434
- }
1435
- if (!Array.isArray(params) || params.length < 2) {
1436
- console.error("[AbcProvider] \u274C Invalid params:", params);
1437
- throw new ProviderRpcError(
1438
- ErrorCode.INVALID_PARAMS,
1439
- "Invalid personal_sign params"
1440
- );
1441
- }
1442
- await this.callInterceptor("personal_sign", params);
1443
- const [message, address] = params;
1444
- if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1445
- console.error("[AbcProvider] \u274C Address mismatch");
1446
- throw new ProviderRpcError(
1447
- ErrorCode.INVALID_PARAMS,
1448
- "Address does not match connected wallet"
1449
- );
1450
- }
1451
- const api = this.getTalkenApiClientOrThrow();
1452
- const network = getNetworkName(this.chainId);
1453
- const pinHash = getCredentialManager().getPinHash() || void 0;
1454
- const email = this.getRecoveryEmail();
1455
- const result = await api.evm.signPersonal({
1456
- network,
1457
- message,
1458
- address,
1459
- pin: pinHash,
1460
- ...email && { email }
1461
- });
1462
- return result.signature;
1463
- }
1464
- /**
1465
- * Eth sign
1466
- */
1467
- async eth_sign(params) {
1468
- if (!Array.isArray(params) || params.length < 2) {
1469
- throw new ProviderRpcError(
1470
- ErrorCode.INVALID_PARAMS,
1471
- "Invalid eth_sign params"
1472
- );
1473
- }
1474
- const [address, message] = params;
1475
- return this.personal_sign([message, address]);
1476
- }
1477
- /**
1478
- * Sign typed data (EIP-712)
1479
- */
1480
- async eth_signTypedData(params) {
1481
- if (!this.wallet) {
1482
- throw new ProviderRpcError(
1483
- ErrorCode.UNAUTHORIZED,
1484
- "Wallet not connected"
1485
- );
1486
- }
1487
- if (!Array.isArray(params) || params.length < 2) {
1488
- throw new ProviderRpcError(
1489
- ErrorCode.INVALID_PARAMS,
1490
- "Invalid signTypedData params"
1491
- );
1492
- }
1493
- await this.callInterceptor("eth_signTypedData_v4", params);
1494
- const [address, typedData] = params;
1495
- if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1496
- throw new ProviderRpcError(
1497
- ErrorCode.INVALID_PARAMS,
1498
- "Address does not match connected wallet"
1499
- );
1500
- }
1501
- const api = this.getTalkenApiClientOrThrow();
1502
- const network = getNetworkName(this.chainId);
1503
- const pinHash = getCredentialManager().getPinHash() || void 0;
1504
- const email = this.getRecoveryEmail();
1505
- const result = await api.evm.signTypedData({
1506
- network,
1507
- typedData: typeof typedData === "string" ? typedData : JSON.stringify(typedData),
1508
- pin: pinHash,
1509
- ...email && { email }
1510
- });
1511
- return result.signature;
1512
- }
1513
- /**
1514
- * Return normalized wallet capabilities for ABC embedded wallets.
1515
- * ABC supports EIP-7702 authorization signing via talken-api.
1516
- */
1517
- async wallet_getCapabilities() {
1518
- return {
1519
- supportsTypedDataV4: true,
1520
- supports7702Authorization: true,
1521
- supports5792Batch: false,
1522
- supportsPaymasterService: false,
1523
- supportsPermit2RelayHints: true,
1524
- walletType: "abc-embedded"
1525
- };
1526
- }
1527
- /**
1528
- * Sign EIP-7702 authorization via Talken API.
1529
- */
1530
- async eth_signAuthorization(params) {
1531
- if (!this.wallet) {
1532
- throw new ProviderRpcError(
1533
- ErrorCode.UNAUTHORIZED,
1534
- "Wallet not connected"
1535
- );
1536
- }
1537
- if (!Array.isArray(params) || params.length < 2) {
1538
- throw new ProviderRpcError(
1539
- ErrorCode.INVALID_PARAMS,
1540
- "Invalid signAuthorization params"
1541
- );
1542
- }
1543
- const [address, authorization] = params;
1544
- if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1545
- throw new ProviderRpcError(
1546
- ErrorCode.INVALID_PARAMS,
1547
- "Address does not match connected wallet"
1548
- );
1549
- }
1550
- if (!authorization?.address || authorization.chainId == null || authorization.nonce == null) {
1551
- throw new ProviderRpcError(
1552
- ErrorCode.INVALID_PARAMS,
1553
- "Authorization payload is incomplete"
1554
- );
1555
- }
1556
- await this.callInterceptor("eth_signAuthorization", params);
1557
- const api = this.getTalkenApiClientOrThrow();
1558
- const network = getNetworkName(this.chainId);
1559
- const pinHash = getCredentialManager().getPinHash() || void 0;
1560
- const email = this.getRecoveryEmail();
1561
- const chainIdValue = typeof authorization.chainId === "string" ? Number(BigInt(authorization.chainId)) : Number(authorization.chainId);
1562
- const nonceValue = typeof authorization.nonce === "string" ? BigInt(authorization.nonce).toString() : String(authorization.nonce);
1563
- const result = await api.evm.signAuthorization({
1564
- network,
1565
- authorization: {
1566
- chainId: chainIdValue,
1567
- address: authorization.address,
1568
- nonce: nonceValue
1569
- },
1570
- pin: pinHash,
1571
- ...email && { email }
1572
- });
1573
- return result.authorization;
1574
- }
1575
- /**
1576
- * Switch Ethereum chain
1577
- */
1578
- async wallet_switchEthereumChain(params) {
1579
- if (!Array.isArray(params) || params.length === 0) {
1580
- throw new ProviderRpcError(
1581
- ErrorCode.INVALID_PARAMS,
1582
- "Invalid switchEthereumChain params"
1583
- );
1584
- }
1585
- const { chainId } = params[0];
1586
- const newChainId = hexToNumber(chainId);
1587
- if (this.chainId === newChainId) {
1588
- return null;
1589
- }
1590
- const _previousChainId = this.chainId;
1591
- this.chainId = newChainId;
1592
- if (this.wallet) {
1593
- this.wallet.chainId = newChainId;
1594
- }
1595
- this.emit("chainChanged", numberToHex(newChainId));
1596
- return null;
1597
- }
1598
- /**
1599
- * Add Ethereum chain
1600
- */
1601
- async wallet_addEthereumChain(params) {
1602
- return this.wallet_switchEthereumChain(params);
1603
- }
1604
- /**
1605
- * Get transaction count (nonce) using ABC WaaS API
1606
- */
1607
- async eth_getTransactionCount(params) {
1608
- const address = params[0]?.toLowerCase();
1609
- if (!address) {
1610
- throw new ProviderRpcError(
1611
- ErrorCode.INVALID_PARAMS,
1612
- "Missing address parameter"
1613
- );
1614
- }
1615
- const currentChainId = this.chainId;
1616
- try {
1617
- const api = this.getTalkenApiClientOrThrow();
1618
- const response = await api.evm.getNonce(
1619
- getNetworkName(currentChainId),
1620
- address
1621
- );
1622
- const nonce = response.result !== void 0 ? typeof response.result === "number" ? `0x${response.result.toString(16)}` : response.result : void 0;
1623
- if (!nonce) {
1624
- throw new Error("No result in nonce response");
1625
- }
1626
- return nonce;
1627
- } catch (error) {
1628
- console.error(
1629
- "[AbcEvmProvider] \u274C Failed to get transaction count from ABC WaaS:",
1630
- error
1631
- );
1632
- throw new ProviderRpcError(
1633
- ErrorCode.INTERNAL_ERROR,
1634
- `Failed to get transaction count: ${error instanceof Error ? error.message : String(error)}`
1635
- );
1636
- }
1637
- }
1638
- /**
1639
- * Estimate gas for transaction
1640
- * Uses ABC WaaS gas estimation API with fallback
1641
- */
1642
- async eth_estimateGas(params) {
1643
- if (!Array.isArray(params) || params.length === 0) {
1644
- throw new ProviderRpcError(
1645
- ErrorCode.INVALID_PARAMS,
1646
- "Invalid estimateGas params"
1647
- );
1648
- }
1649
- const tx = params[0];
1650
- if (!tx.to) {
1651
- throw new ProviderRpcError(
1652
- ErrorCode.INVALID_PARAMS,
1653
- 'Transaction must have "to" field'
1654
- );
1655
- }
1656
- try {
1657
- const response = await this.getTalkenApiClientOrThrow().evm.estimateGas({
1658
- network: getNetworkName(this.chainId),
1659
- from: tx.from || this.wallet?.address || "",
1660
- to: tx.to,
1661
- value: tx.value,
1662
- data: tx.data
1663
- });
1664
- if (!response.result) {
1665
- throw new Error("No result in gas estimate response");
1666
- }
1667
- return response.result;
1668
- } catch (error) {
1669
- console.warn(
1670
- "[AbcEvmProvider] Gas estimation failed, using fallback:",
1671
- error
1672
- );
1673
- if (tx.data && tx.data !== "0x") {
1674
- return "0x493e0";
1675
- }
1676
- return "0x5208";
1677
- }
1678
- }
1679
- /**
1680
- * Check if connected
1681
- */
1682
- isConnected() {
1683
- return this.connected;
1684
- }
1685
- /**
1686
- * Get current wallet
1687
- */
1688
- getWallet() {
1689
- return this.wallet;
1690
- }
1691
- /**
1692
- * Get current chain ID
1693
- */
1694
- getChainId() {
1695
- return this.chainId;
1696
- }
1697
- };
1698
- function createAbcEvmProvider(talkenApi) {
1699
- return new AbcEvmProvider(talkenApi);
1700
- }
1701
- var createAbcProvider = createAbcEvmProvider;
1702
-
1703
- // src/wallets/walletConnectors/abcWallet/api/TalkenApiClient.ts
1704
- var STORAGE_KEY_PREFIX = "talken_api_";
1705
- function loadToken(key) {
1706
- if (typeof window === "undefined")
1707
- return null;
1708
- try {
1709
- return localStorage.getItem(`${STORAGE_KEY_PREFIX}${key}`);
1710
- } catch {
1711
- return null;
1712
- }
1713
- }
1714
- function saveToken(key, value) {
1715
- if (typeof window === "undefined")
1716
- return;
1717
- try {
1718
- localStorage.setItem(`${STORAGE_KEY_PREFIX}${key}`, value);
1719
- } catch {
1720
- }
1721
- }
1722
- function removeToken(key) {
1723
- if (typeof window === "undefined")
1724
- return;
1725
- try {
1726
- localStorage.removeItem(`${STORAGE_KEY_PREFIX}${key}`);
1727
- } catch {
1728
- }
1729
- }
1730
- function normalizeAuthResponse(raw) {
1731
- const d = raw.data || raw;
1732
- const loginData = d.login || d;
1733
- return {
1734
- accessToken: loginData.access_token || loginData.accessToken || "",
1735
- refreshToken: loginData.refresh_token || loginData.refreshToken || "",
1736
- expiresIn: loginData.expires_in || loginData.expire_in || loginData.expiresIn || 3600,
1737
- uid: d.uid || loginData.uid || "",
1738
- email: d.email || loginData.email || "",
1739
- isNewUser: d.isNewUser
1740
- };
1741
- }
1742
- var TalkenAuthModule = class {
1743
- constructor(client) {
1744
- this.client = client;
1745
- }
1746
- /**
1747
- * Login with email and password
1748
- * POST /wallet/auth { action: 'login', method: 'password', email, password }
1749
- */
1750
- async loginWithPassword(email, password) {
1751
- const raw = await this.client.post(
1752
- TALKEN_API_ENDPOINTS.AUTH,
1753
- { action: "login", method: "password", email, password },
1754
- { skipAuth: true }
1755
- );
1756
- const res = normalizeAuthResponse(raw);
1757
- this.client.handleAuthResponse(res);
1758
- return res;
1759
- }
1760
- /**
1761
- * Send OTP code to email
1762
- * POST /wallet/auth { action: 'otp.send', email }
1763
- */
1764
- async sendOtp(email) {
1765
- const raw = await this.client.post(
1766
- TALKEN_API_ENDPOINTS.AUTH,
1767
- { action: "otp.send", email },
1768
- { skipAuth: true }
1769
- );
1770
- return raw.data || raw;
1771
- }
1772
- /**
1773
- * Verify OTP code
1774
- * POST /wallet/auth { action: 'otp.verify', email, otpCode }
1775
- */
1776
- async verifyOtp(email, otpCode) {
1777
- const raw = await this.client.post(
1778
- TALKEN_API_ENDPOINTS.AUTH,
1779
- { action: "otp.verify", email, otpCode },
1780
- { skipAuth: true }
1781
- );
1782
- return raw.data || raw;
1783
- }
1784
- /**
1785
- * Check if email is already registered
1786
- * POST /wallet/auth { action: 'email.check', email }
1787
- * Returns code 606 if email exists
1788
- */
1789
- async checkEmail(email) {
1790
- const raw = await this.client.post(
1791
- TALKEN_API_ENDPOINTS.AUTH,
1792
- { action: "email.check", email },
1793
- { skipAuth: true }
1794
- );
1795
- const d = raw.data || raw;
1796
- return {
1797
- code: d.code,
1798
- message: d.message,
1799
- exists: d.code === 606
1800
- };
1801
- }
1802
- /**
1803
- * Register a new user (creates account + auto-login)
1804
- * POST /wallet/auth { action: 'register', email, otpCode, password, name? }
1805
- */
1806
- async register(params) {
1807
- const raw = await this.client.post(
1808
- TALKEN_API_ENDPOINTS.AUTH,
1809
- { action: "register", ...params },
1810
- { skipAuth: true }
1811
- );
1812
- const res = normalizeAuthResponse(raw);
1813
- this.client.handleAuthResponse(res);
1814
- return res;
1815
- }
1816
- /**
1817
- * Reset password for existing user
1818
- * POST /wallet/auth { action: 'password.reset', email, newPassword, emailCode }
1819
- */
1820
- async resetPassword(email, newPassword, emailCode) {
1821
- const raw = await this.client.post(
1822
- TALKEN_API_ENDPOINTS.AUTH,
1823
- { action: "password.reset", email, newPassword, emailCode },
1824
- { skipAuth: true }
1825
- );
1826
- return raw.data || raw;
1827
- }
1828
- /**
1829
- * Login with social provider (Google, Apple, Kakao, etc.)
1830
- * POST /wallet/auth { action: 'login', method: 'sns', token, service, audience? }
1831
- */
1832
- async loginWithSns(params) {
1833
- const raw = await this.client.post(
1834
- TALKEN_API_ENDPOINTS.AUTH,
1835
- {
1836
- action: "login",
1837
- method: "sns",
1838
- token: params.token,
1839
- service: params.service,
1840
- ...params.audience && { audience: params.audience }
1841
- },
1842
- { skipAuth: true }
1843
- );
1844
- const res = normalizeAuthResponse(raw);
1845
- this.client.handleAuthResponse(res);
1846
- return res;
1847
- }
1848
- /**
1849
- * Refresh access token
1850
- * POST /wallet/auth { action: 'token.refresh', refreshToken }
1851
- */
1852
- async refresh() {
1853
- const refreshToken = this.client.getRefreshToken();
1854
- if (!refreshToken) {
1855
- throw new TalkenApiError(
1856
- "TOKEN_EXPIRED",
1857
- "No refresh token available",
1858
- 401
1859
- );
1860
- }
1861
- const raw = await this.client.post(
1862
- TALKEN_API_ENDPOINTS.AUTH,
1863
- { action: "token.refresh", refreshToken },
1864
- { skipAuth: true }
1865
- );
1866
- const res = normalizeAuthResponse(raw);
1867
- this.client.handleAuthResponse(res);
1868
- return res;
1869
- }
1870
- /**
1871
- * Logout (clear local session only — no server endpoint)
1872
- */
1873
- logout() {
1874
- this.client.clearSession();
1875
- }
1876
- };
1877
- var TalkenWalletModule = class {
1878
- constructor(client) {
1879
- this.client = client;
1880
- }
1881
- /**
1882
- * Generate/recover MPC wallets (create = idempotent generate/recover)
1883
- * POST /wallet/mpc { action: 'create', email?, pin }
1884
- *
1885
- * @param pin - SHA-256 hashed PIN
1886
- * @param email - User email (optional; server resolves from bearer token if omitted)
1887
- */
1888
- async generate(pin, email) {
1889
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_MPC, {
1890
- action: "create",
1891
- ...email && { email },
1892
- pin
1893
- });
1894
- }
1895
- /**
1896
- * Recover is the same as generate (create is idempotent)
1897
- */
1898
- async recover(pin, email) {
1899
- return this.generate(pin, email);
1900
- }
1901
- /**
1902
- * Get wallet info
1903
- * POST /wallet/mpc { action: 'info' }
1904
- */
1905
- async getInfo() {
1906
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_MPC, {
1907
- action: "info"
1908
- });
1909
- }
1910
- /**
1911
- * Get addresses for all chains
1912
- * POST /wallet/address { chain: 'all' }
1913
- */
1914
- async getAddresses() {
1915
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_ADDRESS, {
1916
- chain: "all"
1917
- });
1918
- }
1919
- /**
1920
- * Get addresses for a specific chain
1921
- * POST /wallet/address { chain, publicKey?, pin? }
1922
- */
1923
- async getAddressForChain(chain, publicKey, pin) {
1924
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_ADDRESS, {
1925
- chain,
1926
- ...publicKey && { publicKey },
1927
- ...pin && { pin }
1928
- });
1929
- }
1930
- };
1931
- var TalkenEvmModule = class {
1932
- constructor(client) {
1933
- this.client = client;
1934
- }
1935
- /**
1936
- * Sign EVM transaction (sign only, no broadcast)
1937
- * POST /wallet/sign/evm { network, to, from?, value?, data?, ... }
1938
- * Server handles SecureChannel internally
1939
- */
1940
- async signTransaction(params) {
1941
- return this.client.post(
1942
- TALKEN_API_ENDPOINTS.SIGN_EVM,
1943
- params
1944
- );
1945
- }
1946
- /**
1947
- * Sign EIP-712 typed data
1948
- * POST /wallet/sign/evm/typed { network, typedData }
1949
- */
1950
- async signTypedData(params) {
1951
- return this.client.post(
1952
- TALKEN_API_ENDPOINTS.SIGN_TYPED,
1953
- params
1954
- );
1955
- }
1956
- /**
1957
- * Sign personal message (EIP-191)
1958
- * POST /wallet/sign/evm/personal { network, message, address? }
1959
- */
1960
- async signPersonal(params) {
1961
- const res = await this.client.post(
1962
- TALKEN_API_ENDPOINTS.SIGN_PERSONAL,
1963
- params
1964
- );
1965
- return {
1966
- signature: res?.signature ?? res?.serializedTx ?? "",
1967
- txHash: res?.txHash ?? res?.rawTx
1968
- };
1969
- }
1970
- /**
1971
- * Sign EIP-7702 authorization payload
1972
- * POST /wallet/sign/authorization { network, authorization, pin? }
1973
- */
1974
- async signAuthorization(params) {
1975
- return this.client.post(
1976
- TALKEN_API_ENDPOINTS.SIGN_AUTHORIZATION,
1977
- params
1978
- );
1979
- }
1980
- /**
1981
- * Broadcast signed transaction
1982
- * POST /wallet/tx/raw { network, signedSerializeTx }
1983
- */
1984
- async sendRawTransaction(params) {
1985
- return this.client.post(
1986
- TALKEN_API_ENDPOINTS.TX_RAW,
1987
- params
1988
- );
1989
- }
1990
- /**
1991
- * Integrated EVM transfer (sign + broadcast)
1992
- * POST /wallet/tx/evm { chainKey, to, amountWei, pin, ... }
1993
- */
1994
- async sendTransaction(params) {
1995
- return this.client.post(
1996
- TALKEN_API_ENDPOINTS.TX_EVM,
1997
- params
1998
- );
1999
- }
2000
- /**
2001
- * Get gas price
2002
- * GET /wallet/gas/price?network=
2003
- */
2004
- async getGasPrice(network) {
2005
- return this.client.get(
2006
- `${TALKEN_API_ENDPOINTS.GAS_PRICE}?network=${encodeURIComponent(network)}`
2007
- );
2008
- }
2009
- /**
2010
- * Get suggested gas fees (EIP-1559)
2011
- * GET /wallet/gas/suggested?network=
2012
- */
2013
- async getGasSuggested(network) {
2014
- return this.client.get(
2015
- `${TALKEN_API_ENDPOINTS.GAS_SUGGESTED}?network=${encodeURIComponent(network)}`
2016
- );
2017
- }
2018
- /**
2019
- * Estimate gas
2020
- * POST /wallet/gas/estimate { network, from, to, value?, data? }
2021
- */
2022
- async estimateGas(params) {
2023
- return this.client.post(
2024
- TALKEN_API_ENDPOINTS.GAS_ESTIMATE,
2025
- params
2026
- );
2027
- }
2028
- /**
2029
- * Get nonce for address
2030
- * GET /wallet/nonce?network=&address=
2031
- */
2032
- async getNonce(network, address) {
2033
- const qs = new URLSearchParams({ network, address }).toString();
2034
- return this.client.get(`${TALKEN_API_ENDPOINTS.NONCE}?${qs}`);
2035
- }
2036
- };
2037
- var TalkenSolanaModule = class {
2038
- constructor(client) {
2039
- this.client = client;
2040
- }
2041
- /**
2042
- * Transfer SOL or SPL token (integrated sign + broadcast)
2043
- * POST /wallet/tx/sol
2044
- * - kind='native': { toAddress, amountLamports, pin }
2045
- * - kind='spl': { toAddress, mintAddress, amount, decimals, network, pin }
2046
- */
2047
- async transfer(params) {
2048
- return this.client.post(
2049
- TALKEN_API_ENDPOINTS.TX_SOL,
2050
- params
2051
- );
2052
- }
2053
- /**
2054
- * Sign Solana transaction or message (sign-only, no broadcast)
2055
- * POST /wallet/sign/sol
2056
- *
2057
- * Two modes:
2058
- * - PIN mode: { message, pin } — server resolves signing material
2059
- * - Share mode: { message, keyId, encryptedShare } — no PIN required (for signMessage)
2060
- *
2061
- * @returns Ed25519 signature (hex) and optionally public key
2062
- */
2063
- async sign(params) {
2064
- return this.client.post(
2065
- TALKEN_API_ENDPOINTS.SIGN_SVM,
2066
- params
2067
- );
2068
- }
2069
- };
2070
- var TalkenBitcoinModule = class {
2071
- constructor(client) {
2072
- this.client = client;
2073
- }
2074
- /**
2075
- * BTC fee rate lookup
2076
- * GET /wallet/btc?mode=fee&network=&blocks=
2077
- */
2078
- async getFeeRate(network, blocks) {
2079
- const qs = new URLSearchParams({
2080
- mode: "fee",
2081
- network,
2082
- ...typeof blocks === "number" ? { blocks: String(blocks) } : {}
2083
- }).toString();
2084
- return this.client.get(
2085
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2086
- );
2087
- }
2088
- /**
2089
- * BTC tx status by hash
2090
- * GET /wallet/btc?mode=txHash&network=&txHash=
2091
- */
2092
- async getTxByHash(txHash, network) {
2093
- const qs = new URLSearchParams({
2094
- mode: "txHash",
2095
- network,
2096
- txHash
2097
- }).toString();
2098
- return this.client.get(
2099
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2100
- );
2101
- }
2102
- /**
2103
- * BTC UTXO list
2104
- * GET /wallet/btc?mode=utxos&network=&address=
2105
- */
2106
- async getUtxos(network, address) {
2107
- const qs = new URLSearchParams({
2108
- mode: "utxos",
2109
- network,
2110
- ...address ? { address } : {}
2111
- }).toString();
2112
- return this.client.get(
2113
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2114
- );
2115
- }
2116
- /**
2117
- * BTC address validation
2118
- * GET /wallet/btc?mode=validateAddress&network=&address=
2119
- */
2120
- async validateAddress(address, network) {
2121
- const qs = new URLSearchParams({
2122
- mode: "validateAddress",
2123
- network,
2124
- address
2125
- }).toString();
2126
- return this.client.get(
2127
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2128
- );
2129
- }
2130
- /**
2131
- * Send BTC (integrated sign + broadcast, action=transfer)
2132
- * POST /wallet/tx/btc
2133
- */
2134
- async sendTransaction(params) {
2135
- const payload = { action: "transfer", ...params };
2136
- return this.client.post(
2137
- TALKEN_API_ENDPOINTS.TX_BTC,
2138
- payload
2139
- );
2140
- }
2141
- /**
2142
- * Execute BTC action endpoint (transfer|generate|signHash|finalize)
2143
- * POST /wallet/tx/btc
2144
- */
2145
- async execute(params) {
2146
- return this.client.post(
2147
- TALKEN_API_ENDPOINTS.TX_BTC,
2148
- params
2149
- );
2150
- }
2151
- /**
2152
- * Sign raw hash via secp256k1 MPC (universal: EVM/BTC/TVM)
2153
- * POST /wallet/sign/hash { hash, pin, network? }
2154
- */
2155
- async signHash(params) {
2156
- return this.client.post(
2157
- TALKEN_API_ENDPOINTS.SIGN_HASH,
2158
- params
2159
- );
2160
- }
2161
- /**
2162
- * Broadcast raw BTC transaction
2163
- * POST /wallet/tx/raw { network, signedSerializeTx }
2164
- */
2165
- async broadcastRawTransaction(params) {
2166
- return this.client.post(TALKEN_API_ENDPOINTS.TX_RAW, {
2167
- network: params.network,
2168
- signedSerializeTx: params.rawTransaction
2169
- });
2170
- }
2171
- };
2172
- var TalkenTronModule = class {
2173
- constructor(client) {
2174
- this.client = client;
2175
- }
2176
- /**
2177
- * Execute TVM(TRON) transfer/call (integrated sign + broadcast)
2178
- * POST /wallet/tx/tvm
2179
- * - kind=native: TRX transfer (amountSun)
2180
- * - kind=trc20: TRC-20 transfer (contractAddress + amount)
2181
- * - kind=contract: arbitrary contract call (contractAddress + data)
2182
- */
2183
- async transferTrx(params) {
2184
- return this.client.post(
2185
- TALKEN_API_ENDPOINTS.TX_TVM,
2186
- params
2187
- );
2188
- }
2189
- };
2190
- var TalkenWalletscanModule = class {
2191
- constructor(client) {
2192
- this.client = client;
2193
- }
2194
- /**
2195
- * Get token metadata by contract address
2196
- * GET /wallet/scan?type=tokens&chainKeys=...&contractAddress=...
2197
- */
2198
- async getToken(params) {
2199
- const qs = new URLSearchParams({
2200
- type: "tokens",
2201
- chainKeys: params.chainKeys,
2202
- contractAddress: params.contractAddress
2203
- }).toString();
2204
- return this.client.get(
2205
- `${TALKEN_API_ENDPOINTS.WALLET_SCAN}?${qs}`
2206
- );
2207
- }
2208
- /**
2209
- * Get native coin balances
2210
- * GET /wallet/scan?type=natives&chainKeys=...&walletAddress=...
2211
- */
2212
- async getNativeTokens(params) {
2213
- const qs = new URLSearchParams({
2214
- type: "natives",
2215
- chainKeys: params.chainKeys,
2216
- walletAddress: params.walletAddress
2217
- }).toString();
2218
- return this.client.get(
2219
- `${TALKEN_API_ENDPOINTS.WALLET_SCAN}?${qs}`
2220
- );
2221
- }
2222
- /**
2223
- * Get NFT metadata
2224
- * GET /wallet/scan?type=nfts&chainKeys=...&walletAddress=...
2225
- */
2226
- async getNfts(params) {
2227
- const qs = new URLSearchParams({
2228
- type: "nfts",
2229
- chainKeys: params.chainKeys,
2230
- walletAddress: params.walletAddress
2231
- }).toString();
2232
- return this.client.get(
2233
- `${TALKEN_API_ENDPOINTS.WALLET_SCAN}?${qs}`
2234
- );
2235
- }
2236
- };
2237
- var TalkenApiClient = class {
2238
- constructor(config) {
2239
- this.accessToken = null;
2240
- this.refreshToken_ = null;
2241
- this.expiresAt = null;
2242
- this.isRefreshing = false;
2243
- this.refreshPromise = null;
2244
- this.config = {
2245
- baseUrl: config?.baseUrl || DEFAULT_TALKEN_API_CONFIG.baseUrl || "",
2246
- timeout: config?.timeout || DEFAULT_TALKEN_API_CONFIG.timeout,
2247
- environment: config?.environment || "development",
2248
- defaultChainId: config?.defaultChainId,
2249
- debug: config?.debug || false
2250
- };
2251
- this.auth = new TalkenAuthModule(this);
2252
- this.wallet = new TalkenWalletModule(this);
2253
- this.evm = new TalkenEvmModule(this);
2254
- this.solana = new TalkenSolanaModule(this);
2255
- this.bitcoin = new TalkenBitcoinModule(this);
2256
- this.tron = new TalkenTronModule(this);
2257
- this.walletscan = new TalkenWalletscanModule(this);
2258
- this.restoreSession();
2259
- }
2260
- // ── Session Management ──────────────────────────────────────────────
2261
- restoreSession() {
2262
- this.accessToken = loadToken("access_token");
2263
- this.refreshToken_ = loadToken("refresh_token");
2264
- const expiresAtStr = loadToken("expires_at");
2265
- this.expiresAt = expiresAtStr ? Number(expiresAtStr) : null;
2266
- }
2267
- /** @internal Called by auth module after successful login/register */
2268
- handleAuthResponse(response) {
2269
- this.accessToken = response.accessToken;
2270
- this.refreshToken_ = response.refreshToken;
2271
- this.expiresAt = Date.now() + response.expiresIn * 1e3;
2272
- saveToken("access_token", response.accessToken);
2273
- saveToken("refresh_token", response.refreshToken);
2274
- saveToken("expires_at", String(this.expiresAt));
2275
- }
2276
- /** @internal Clear all session data */
2277
- clearSession() {
2278
- this.accessToken = null;
2279
- this.refreshToken_ = null;
2280
- this.expiresAt = null;
2281
- removeToken("access_token");
2282
- removeToken("refresh_token");
2283
- removeToken("expires_at");
2284
- }
2285
- /**
2286
- * Check if user is authenticated (has valid access token)
2287
- */
2288
- isAuthenticated() {
2289
- return !!this.accessToken && !this.isTokenExpired();
2290
- }
2291
- /**
2292
- * Check if current access token is expired
2293
- */
2294
- isTokenExpired() {
2295
- if (!this.expiresAt)
2296
- return true;
2297
- return Date.now() >= this.expiresAt - TOKEN_EXPIRY.REFRESH_BUFFER;
2298
- }
2299
- /**
2300
- * Get current access token
2301
- */
2302
- getAccessToken() {
2303
- return this.accessToken;
2304
- }
2305
- /**
2306
- * Get current refresh token
2307
- * @internal Used by auth module for token refresh
2308
- */
2309
- getRefreshToken() {
2310
- return this.refreshToken_;
2311
- }
2312
- /**
2313
- * Get client configuration
2314
- */
2315
- getConfig() {
2316
- return { ...this.config };
2317
- }
2318
- /**
2319
- * Set tokens externally (useful for SSR or state management integration)
2320
- */
2321
- setTokens(accessToken, refreshToken, expiresAt) {
2322
- this.accessToken = accessToken;
2323
- this.refreshToken_ = refreshToken;
2324
- this.expiresAt = expiresAt;
2325
- saveToken("access_token", accessToken);
2326
- saveToken("refresh_token", refreshToken);
2327
- saveToken("expires_at", String(expiresAt));
2328
- }
2329
- // ── HTTP Methods (Internal) ─────────────────────────────────────────
2330
- /** @internal Make a GET request */
2331
- async get(endpoint, options) {
2332
- return this.request(endpoint, { method: "GET", ...options });
2333
- }
2334
- /** @internal Make a POST request */
2335
- async post(endpoint, body, options) {
2336
- return this.request(endpoint, { method: "POST", body, ...options });
2337
- }
2338
- /**
2339
- * Core HTTP request handler with automatic token refresh
2340
- * @internal
2341
- */
2342
- async request(endpoint, options) {
2343
- const { method, body, skipAuth = false } = options;
2344
- if (!skipAuth && this.isTokenExpired() && this.refreshToken_) {
2345
- await this.ensureTokenRefreshed();
2346
- }
2347
- const url = `${this.config.baseUrl}${endpoint}`;
2348
- const headers = {
2349
- "Content-Type": "application/json",
2350
- Accept: "application/json"
2351
- };
2352
- if (!skipAuth && this.accessToken) {
2353
- headers.Authorization = `Bearer ${this.accessToken}`;
2354
- }
2355
- if (this.config.debug) {
2356
- console.log(`[TalkenApiClient] ${method} ${url}`);
2357
- }
2358
- try {
2359
- const controller = new AbortController();
2360
- const timeoutId = setTimeout(
2361
- () => controller.abort(),
2362
- this.config.timeout || 3e4
2363
- );
2364
- const response = await fetch(url, {
2365
- method,
2366
- headers,
2367
- body: body ? JSON.stringify(body) : void 0,
2368
- signal: controller.signal,
2369
- credentials: "include"
2370
- });
2371
- clearTimeout(timeoutId);
2372
- const text = await response.text();
2373
- let data;
2374
- if (text) {
2375
- try {
2376
- data = JSON.parse(text);
2377
- } catch {
2378
- throw new TalkenApiError(
2379
- "PARSE_ERROR",
2380
- "Invalid JSON response from server",
2381
- response.status,
2382
- { text: text.substring(0, 200) }
2383
- );
2384
- }
2385
- } else {
2386
- data = { success: true };
2387
- }
2388
- if (response.status === 401 && !skipAuth && this.refreshToken_) {
2389
- try {
2390
- await this.forceTokenRefresh();
2391
- return this.request(endpoint, { ...options, skipAuth: true });
2392
- } catch {
2393
- this.clearSession();
2394
- throw new TalkenApiError(
2395
- "TOKEN_EXPIRED",
2396
- "Session expired. Please login again.",
2397
- 401
2398
- );
2399
- }
2400
- }
2401
- if (!response.ok) {
2402
- const errCode = data.error?.code || "UNKNOWN_ERROR";
2403
- const errMsg = data.error?.message || `Request failed with status ${response.status}`;
2404
- if (this.config.debug) {
2405
- console.error(`[TalkenApiClient] Error: ${errCode} - ${errMsg}`);
2406
- }
2407
- throw new TalkenApiError(
2408
- errCode,
2409
- errMsg,
2410
- response.status,
2411
- data.error?.details || data.details
2412
- );
2413
- }
2414
- return data.data ?? data;
2415
- } catch (error) {
2416
- if (error instanceof TalkenApiError) {
2417
- throw error;
2418
- }
2419
- if (error instanceof DOMException && error.name === "AbortError") {
2420
- throw new TalkenApiError("TIMEOUT", "Request timed out", 408);
2421
- }
2422
- const errorMessage = error instanceof Error ? error.message : "Network request failed";
2423
- throw new TalkenApiError("NETWORK_ERROR", errorMessage, 0);
2424
- }
2425
- }
2426
- /**
2427
- * Ensure token is refreshed (handles concurrent requests)
2428
- */
2429
- async ensureTokenRefreshed() {
2430
- if (this.isRefreshing && this.refreshPromise) {
2431
- await this.refreshPromise;
2432
- return;
2433
- }
2434
- await this.forceTokenRefresh();
2435
- }
2436
- /**
2437
- * Force a token refresh
2438
- */
2439
- async forceTokenRefresh() {
2440
- if (this.isRefreshing && this.refreshPromise) {
2441
- await this.refreshPromise;
2442
- return;
2443
- }
2444
- this.isRefreshing = true;
2445
- this.refreshPromise = (async () => {
2446
- try {
2447
- await this.auth.refresh();
2448
- } finally {
2449
- this.isRefreshing = false;
2450
- this.refreshPromise = null;
2451
- }
2452
- })();
2453
- await this.refreshPromise;
2454
- }
2455
- };
2456
- function createTalkenApiClient(config) {
2457
- return new TalkenApiClient(config);
2458
- }
2459
-
2460
- // src/wallets/walletConnectors/abcWallet/api/TalkenApiSingleton.ts
2461
- var _instance;
2462
- function setTalkenApiClient(client) {
2463
- _instance = client;
2464
- }
2465
- function getTalkenApiClient2() {
2466
- return _instance;
2467
- }
2468
-
2469
- // src/wallets/walletConnectors/abcWallet/networkConfig.ts
2470
- var SolanaNetwork = /* @__PURE__ */ ((SolanaNetwork2) => {
2471
- SolanaNetwork2["Mainnet"] = "solana";
2472
- SolanaNetwork2["Devnet"] = "solana_devnet";
2473
- SolanaNetwork2["Testnet"] = "solana_testnet";
2474
- return SolanaNetwork2;
2475
- })(SolanaNetwork || {});
2476
- var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
2477
- BitcoinNetwork2["Mainnet"] = "bitcoin";
2478
- BitcoinNetwork2["Testnet"] = "bitcoin_testnet";
2479
- return BitcoinNetwork2;
2480
- })(BitcoinNetwork || {});
2481
- var TronNetwork = /* @__PURE__ */ ((TronNetwork2) => {
2482
- TronNetwork2["Mainnet"] = "tron";
2483
- TronNetwork2["Nile"] = "tron_nile";
2484
- return TronNetwork2;
2485
- })(TronNetwork || {});
2486
- var DEFAULT_NETWORK_CONFIG = {
2487
- evm: {
2488
- mainnet: 1,
2489
- // Ethereum Mainnet
2490
- testnet: 11155111
2491
- // Sepolia Testnet
2492
- },
2493
- solana: {
2494
- mainnet: "solana" /* Mainnet */,
2495
- devnet: "solana_devnet" /* Devnet */
2496
- },
2497
- bitcoin: {
2498
- mainnet: "bitcoin" /* Mainnet */,
2499
- testnet: "bitcoin_testnet" /* Testnet */
2500
- },
2501
- tron: {
2502
- mainnet: "tron" /* Mainnet */,
2503
- testnet: "tron_nile" /* Nile */
2504
- }
2505
- };
2506
- var globalDefaultChainId;
2507
- var globalDefaultSolanaNetwork;
2508
- var globalDefaultBitcoinNetwork;
2509
- var globalDefaultTronNetwork;
2510
- function setGlobalDefaultChainId(chainId) {
2511
- globalDefaultChainId = chainId;
2512
- }
2513
- function setGlobalDefaultSolanaNetwork(network) {
2514
- globalDefaultSolanaNetwork = network;
2515
- }
2516
- function setGlobalDefaultBitcoinNetwork(network) {
2517
- globalDefaultBitcoinNetwork = network;
2518
- }
2519
- function getEvmNetwork(customChainId) {
2520
- if (customChainId !== void 0) {
2521
- return customChainId;
2522
- }
2523
- if (globalDefaultChainId !== void 0) {
2524
- return globalDefaultChainId;
2525
- }
2526
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2527
- const fallbackChainId = isProduction ? DEFAULT_NETWORK_CONFIG.evm.mainnet : DEFAULT_NETWORK_CONFIG.evm.testnet;
2528
- return fallbackChainId;
2529
- }
2530
- function getSolanaNetwork() {
2531
- if (globalDefaultSolanaNetwork !== void 0) {
2532
- return globalDefaultSolanaNetwork;
2533
- }
2534
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2535
- return isProduction ? DEFAULT_NETWORK_CONFIG.solana.mainnet : DEFAULT_NETWORK_CONFIG.solana.devnet;
2536
- }
2537
- function getBitcoinNetwork() {
2538
- if (globalDefaultBitcoinNetwork !== void 0) {
2539
- return globalDefaultBitcoinNetwork;
2540
- }
2541
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2542
- return isProduction ? DEFAULT_NETWORK_CONFIG.bitcoin.mainnet : DEFAULT_NETWORK_CONFIG.bitcoin.testnet;
2543
- }
2544
- function getTronNetwork() {
2545
- if (globalDefaultTronNetwork !== void 0) {
2546
- return globalDefaultTronNetwork;
2547
- }
2548
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2549
- return isProduction ? DEFAULT_NETWORK_CONFIG.tron.mainnet : DEFAULT_NETWORK_CONFIG.tron.testnet;
2550
- }
2551
-
2552
- // src/wallets/walletConnectors/abcWallet/resolveTalkenApiUrl.ts
2553
- function resolveTalkenApiUrl(explicitUrl) {
2554
- const talkenApiUrl = explicitUrl || process.env.NEXT_PUBLIC_TALKEN_API_URL;
2555
- if (!talkenApiUrl) {
2556
- throw new Error(
2557
- "Talken API URL is required. Pass talkenApiUrl explicitly or set NEXT_PUBLIC_TALKEN_API_URL."
2558
- );
2559
- }
2560
- return talkenApiUrl;
2561
- }
2562
-
2563
- // src/wallets/walletConnectors/abcWallet/abcConnector.ts
2564
- function abcConnector(options) {
2565
- const { config } = options;
2566
- if (config.defaultChainId) {
2567
- setGlobalDefaultChainId(config.defaultChainId);
2568
- }
2569
- if (config.defaultSolanaNetwork) {
2570
- setGlobalDefaultSolanaNetwork(config.defaultSolanaNetwork);
2571
- }
2572
- if (config.defaultBitcoinNetwork) {
2573
- setGlobalDefaultBitcoinNetwork(config.defaultBitcoinNetwork);
2574
- }
2575
- return createConnector((wagmiConfig) => {
2576
- const talkenApi = getTalkenApiClient3() || createTalkenApiClient({
2577
- baseUrl: resolveTalkenApiUrl(config.talkenApiUrl),
2578
- environment: config.environment,
2579
- debug: config.environment === "development",
2580
- defaultChainId: config.defaultChainId
2581
- });
2582
- setTalkenApiClient(talkenApi);
2583
- const provider = createAbcEvmProvider(talkenApi);
2584
- let accountsChangedHandler;
2585
- let chainChangedHandler;
2586
- let disconnectHandler;
2587
- return {
2588
- id: "abc",
2589
- name: "ABC Wallet",
2590
- type: "abc",
2591
- /**
2592
- * Connect wallet
2593
- */
2594
- async connect() {
2595
- try {
2596
- const authState = loadAuthState();
2597
- if (!authState || !authState.isAuthenticated || !authState.wallet) {
2598
- throw new Error("ABC_LOGIN_REQUIRED");
2599
- }
2600
- provider.setWallet(authState.wallet);
2601
- if (authState.accessToken && authState.refreshToken && authState.expiresAt) {
2602
- talkenApi.setTokens(
2603
- authState.accessToken,
2604
- authState.refreshToken,
2605
- authState.expiresAt
2606
- );
2607
- }
2608
- const accounts = await provider.request({
2609
- method: "eth_requestAccounts"
2610
- });
2611
- let currentChainId = await provider.request({
2612
- method: "eth_chainId"
2613
- });
2614
- const currentChainIdNumber = Number(currentChainId);
2615
- const isChainSupported = wagmiConfig.chains.some(
2616
- (c) => c.id === currentChainIdNumber
2617
- );
2618
- if (!isChainSupported && wagmiConfig.chains.length > 0) {
2619
- const fallbackChainId = wagmiConfig.chains[0].id;
2620
- await provider.request({
2621
- method: "wallet_switchEthereumChain",
2622
- params: [{ chainId: `0x${fallbackChainId.toString(16)}` }]
2623
- });
2624
- currentChainId = `0x${fallbackChainId.toString(16)}`;
2625
- if (authState.wallet) {
2626
- authState.wallet.chainId = fallbackChainId;
2627
- saveAuthState(authState);
2628
- }
2629
- }
2630
- if (accountsChangedHandler) {
2631
- provider.removeListener("accountsChanged", accountsChangedHandler);
2632
- }
2633
- accountsChangedHandler = (accounts2) => {
2634
- wagmiConfig.emitter.emit("change", {
2635
- accounts: accounts2
2636
- });
2637
- };
2638
- provider.on("accountsChanged", accountsChangedHandler);
2639
- if (chainChangedHandler) {
2640
- provider.removeListener("chainChanged", chainChangedHandler);
2641
- }
2642
- chainChangedHandler = (chainId) => {
2643
- wagmiConfig.emitter.emit("change", {
2644
- chainId: Number(chainId)
2645
- });
2646
- };
2647
- provider.on("chainChanged", chainChangedHandler);
2648
- if (disconnectHandler) {
2649
- provider.removeListener("disconnect", disconnectHandler);
2650
- }
2651
- disconnectHandler = () => {
2652
- wagmiConfig.emitter.emit("disconnect");
2653
- this.onDisconnect();
2654
- };
2655
- provider.on("disconnect", disconnectHandler);
2656
- wagmiConfig.emitter.emit("connect", {
2657
- accounts,
2658
- chainId: Number(currentChainId)
2659
- });
2660
- return {
2661
- accounts,
2662
- chainId: Number(currentChainId)
2663
- };
2664
- } catch (error) {
2665
- console.error("\u274C ABC Connector connect() failed:", {
2666
- message: error.message,
2667
- code: error.code,
2668
- error
2669
- });
2670
- if (error.message === "ABC_LOGIN_REQUIRED") {
2671
- throw error;
2672
- }
2673
- throw error;
2674
- }
2675
- },
2676
- /**
2677
- * Disconnect wallet
2678
- */
2679
- async disconnect() {
2680
- if (accountsChangedHandler) {
2681
- provider.removeListener("accountsChanged", accountsChangedHandler);
2682
- accountsChangedHandler = void 0;
2683
- }
2684
- if (chainChangedHandler) {
2685
- provider.removeListener("chainChanged", chainChangedHandler);
2686
- chainChangedHandler = void 0;
2687
- }
2688
- if (disconnectHandler) {
2689
- provider.removeListener("disconnect", disconnectHandler);
2690
- disconnectHandler = void 0;
2691
- }
2692
- provider.clearWallet();
2693
- talkenApi.auth.logout();
2694
- clearAuthState();
2695
- getCredentialManager().clear();
2696
- },
2697
- /**
2698
- * Get accounts
2699
- */
2700
- async getAccounts() {
2701
- const accounts = await provider.request({
2702
- method: "eth_accounts"
2703
- });
2704
- return accounts.map((account) => account);
2705
- },
2706
- /**
2707
- * Get chain ID
2708
- */
2709
- async getChainId() {
2710
- const chainId = await provider.request({
2711
- method: "eth_chainId"
2712
- });
2713
- return Number(chainId);
2714
- },
2715
- /**
2716
- * Get provider
2717
- */
2718
- async getProvider() {
2719
- return provider;
2720
- },
2721
- /**
2722
- * Check if authorized (has valid session)
2723
- * Auto-refreshes access token if expired but refresh token is valid
2724
- */
2725
- async isAuthorized() {
2726
- try {
2727
- const authState = loadAuthState();
2728
- if (!authState || !authState.isAuthenticated) {
2729
- return false;
2730
- }
2731
- if (!authState.wallet) {
2732
- return false;
2733
- }
2734
- if (talkenApi.isAuthenticated()) {
2735
- return true;
2736
- }
2737
- const refreshToken = loadFromStorage(
2738
- "refresh_token" /* REFRESH_TOKEN */
2739
- );
2740
- if (!refreshToken) {
2741
- clearStorage();
2742
- return false;
2743
- }
2744
- try {
2745
- const api = getTalkenApiClient3();
2746
- if (!api) {
2747
- clearStorage();
2748
- return false;
2749
- }
2750
- const res = await api.auth.refresh();
2751
- talkenApi.setTokens(
2752
- res.accessToken,
2753
- res.refreshToken,
2754
- Date.now() + res.expiresIn * 1e3
2755
- );
2756
- const updatedState = loadAuthState();
2757
- return updatedState?.isAuthenticated ?? false;
2758
- } catch (error) {
2759
- console.error("[AbcConnector] Token refresh failed:", error);
2760
- clearStorage();
2761
- return false;
2762
- }
2763
- } catch (error) {
2764
- console.error(
2765
- "[AbcConnector] Unexpected error in isAuthorized:",
2766
- error
2767
- );
2768
- return false;
2769
- }
2770
- },
2771
- /**
2772
- * Switch chain
2773
- */
2774
- async switchChain({ chainId }) {
2775
- await provider.request({
2776
- method: "wallet_switchEthereumChain",
2777
- params: [{ chainId: `0x${chainId.toString(16)}` }]
2778
- });
2779
- const newChainId = await this.getChainId();
2780
- const authState = loadAuthState();
2781
- if (authState?.wallet) {
2782
- authState.wallet.chainId = newChainId;
2783
- saveAuthState(authState);
2784
- }
2785
- return wagmiConfig.chains.find((x) => x.id === chainId) ?? {
2786
- id: chainId,
2787
- name: `Chain ${chainId}`,
2788
- nativeCurrency: {
2789
- name: "Ether",
2790
- decimals: 18,
2791
- symbol: "ETH"
2792
- },
2793
- rpcUrls: {
2794
- default: { http: [""] }
2795
- }
2796
- };
2797
- },
2798
- /**
2799
- * Handle accounts changed
2800
- */
2801
- onAccountsChanged(accounts) {
2802
- if (accounts.length === 0) {
2803
- this.onDisconnect();
2804
- } else {
2805
- wagmiConfig.emitter.emit("change", {
2806
- accounts
2807
- });
2808
- }
2809
- },
2810
- /**
2811
- * Handle chain changed
2812
- */
2813
- onChainChanged(chain) {
2814
- const chainId = Number(chain);
2815
- wagmiConfig.emitter.emit("change", { chainId });
2816
- },
2817
- /**
2818
- * Handle disconnect
2819
- */
2820
- onDisconnect(_error) {
2821
- provider.clearWallet();
2822
- clearAuthState();
2823
- wagmiConfig.emitter.emit("disconnect");
2824
- }
2825
- };
2826
- });
2827
- }
2828
-
2829
- // src/wallets/walletConnectors/abcWallet/abcWallet.ts
2830
- var abcWallet = (specificOptions) => ({ projectId }) => {
2831
- const talkenApiUrl = resolveTalkenApiUrl(specificOptions?.talkenApiUrl);
2832
- const talkenApi = createTalkenApiClient({
2833
- baseUrl: talkenApiUrl,
2834
- debug: specificOptions?.environment === "development"
2835
- });
2836
- setTalkenApiClient2(talkenApi);
2837
- const config = {
2838
- talkenApiUrl,
2839
- apiKey: specificOptions?.apiKey,
2840
- plain: specificOptions?.plain || "",
2841
- // Deprecated - not used (secure.ts uses random generation)
2842
- environment: specificOptions?.environment || "development",
2843
- defaultChainId: specificOptions?.defaultChainId,
2844
- defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
2845
- defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
2846
- projectId
2847
- };
2848
- return {
2849
- id: ABC_WALLET_METADATA.id,
2850
- name: ABC_WALLET_METADATA.name,
2851
- rdns: ABC_WALLET_METADATA.rdns,
2852
- iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
2853
- iconBackground: ABC_WALLET_METADATA.iconBackground,
2854
- // Embedded wallet - no installation required
2855
- installed: void 0,
2856
- // No download URLs for embedded wallet
2857
- downloadUrls: void 0,
2858
- // Create connector - wrapper function required by Wallet type
2859
- createConnector: (_walletDetails) => abcConnector({ config }),
2860
- // Embedded wallet always available
2861
- hidden: () => false
2862
- };
2863
- };
2864
-
2865
- // src/wallets/walletConnectors/abcWallet/api/WalletscanApi.ts
2866
- import { getTalkenApiClient as getTalkenApiClient4, networkNameToChainKey as networkNameToChainKey2 } from "@talken/talkenkit";
2867
- var WalletscanApi = class {
2868
- /**
2869
- * Get token metadata via TalkenApiClient walletscan endpoint
2870
- *
2871
- * @param params - Contract address and networks
2872
- * @returns Token metadata or null if not found/failed
2873
- */
2874
- async getContractToken(params) {
2875
- const api = getTalkenApiClient4();
2876
- if (!api)
2877
- throw new Error("TalkenApiClient not initialized");
2878
- try {
2879
- const tokens = await api.walletscan.getToken({
2880
- contractAddress: params.contractAddress,
2881
- chainKeys: networkNameToChainKey2(params.networks)
2882
- });
2883
- return tokens.length > 0 ? tokens[0] : null;
2884
- } catch (error) {
2885
- console.warn(
2886
- "[WalletscanApi] TalkenApi getToken failed:",
2887
- params.contractAddress,
2888
- error
2889
- );
2890
- return null;
2891
- }
2892
- }
2893
- /**
2894
- * Get token metadata with timeout
2895
- *
2896
- * @param params - Contract address and networks
2897
- * @param timeoutMs - Timeout in milliseconds (default: 3000)
2898
- * @returns Token metadata or null if timeout/failed
2899
- */
2900
- async getContractTokenWithTimeout(params, timeoutMs = 3e3) {
2901
- try {
2902
- const result = await Promise.race([
2903
- this.getContractToken(params),
2904
- new Promise(
2905
- (resolve) => setTimeout(() => resolve(null), timeoutMs)
2906
- )
2907
- ]);
2908
- return result;
2909
- } catch (_error) {
2910
- console.warn(
2911
- "[WalletscanApi] Token metadata request timed out:",
2912
- params.contractAddress
2913
- );
2914
- return null;
2915
- }
2916
- }
2917
- /**
2918
- * Get native coin info via TalkenApiClient walletscan endpoint
2919
- *
2920
- * @param params - Wallet address and networks
2921
- * @returns Array of native coins or empty array if failed
2922
- */
2923
- async getNativeToken(params) {
2924
- const api = getTalkenApiClient4();
2925
- if (!api)
2926
- throw new Error("TalkenApiClient not initialized");
2927
- try {
2928
- return await api.walletscan.getNativeTokens({
2929
- walletAddress: params.walletAddress,
2930
- chainKeys: networkNameToChainKey2(params.networks)
2931
- });
2932
- } catch (error) {
2933
- console.warn("[WalletscanApi] TalkenApi getNativeTokens failed:", error);
2934
- return [];
2935
- }
2936
- }
2937
- /**
2938
- * Get native coin info with timeout
2939
- *
2940
- * @param params - Wallet address and networks
2941
- * @param timeoutMs - Timeout in milliseconds (default: 3000)
2942
- * @returns First native coin or null if timeout/failed
2943
- */
2944
- async getNativeTokenWithTimeout(params, timeoutMs = 3e3) {
2945
- try {
2946
- const natives = await Promise.race([
2947
- this.getNativeToken(params),
2948
- new Promise(
2949
- (resolve) => setTimeout(() => resolve([]), timeoutMs)
2950
- )
2951
- ]);
2952
- return natives.length > 0 ? natives[0] : null;
2953
- } catch (_error) {
2954
- console.warn("[WalletscanApi] Native coin request timed out");
2955
- return null;
2956
- }
2957
- }
2958
- /**
2959
- * Get NFT metadata via TalkenApiClient walletscan endpoint
2960
- *
2961
- * @param params - Contract address, wallet address, and networks
2962
- * @returns Array of NFT metadata or empty array if failed
2963
- */
2964
- async getNFT(params) {
2965
- const api = getTalkenApiClient4();
2966
- if (!api)
2967
- throw new Error("TalkenApiClient not initialized");
2968
- try {
2969
- return await api.walletscan.getNfts({
2970
- chainKeys: networkNameToChainKey2(params.networks),
2971
- walletAddress: params.walletAddress
2972
- });
2973
- } catch (error) {
2974
- console.warn(
2975
- "[WalletscanApi] TalkenApi getNfts failed:",
2976
- params.contractAddress,
2977
- error
2978
- );
2979
- return [];
2980
- }
2981
- }
2982
- /**
2983
- * Get NFT metadata with timeout
2984
- *
2985
- * @param params - Contract address, wallet address, and networks
2986
- * @param timeoutMs - Timeout in milliseconds (default: 3000)
2987
- * @returns First NFT or null if timeout/failed/empty
2988
- */
2989
- async getNFTWithTimeout(params, timeoutMs = 3e3) {
2990
- try {
2991
- const nfts = await Promise.race([
2992
- this.getNFT(params),
2993
- new Promise(
2994
- (resolve) => setTimeout(() => resolve([]), timeoutMs)
2995
- )
2996
- ]);
2997
- return nfts.length > 0 ? nfts[0] : null;
2998
- } catch (_error) {
2999
- console.warn(
3000
- "[WalletscanApi] NFT metadata request timed out:",
3001
- params.contractAddress
3002
- );
3003
- return null;
3004
- }
3005
- }
3006
- };
3007
-
3008
- // src/wallets/walletConnectors/abcWallet/api/GasApi.ts
3009
- import { getTalkenApiClient as getTalkenApiClient5 } from "@talken/talkenkit";
3010
- var GasApi = class {
3011
- parseGasFees(data) {
3012
- return {
3013
- ...data,
3014
- networkCongestion: data.networkCongestion != null ? Number(data.networkCongestion) : void 0
3015
- };
3016
- }
3017
- /**
3018
- * Get suggested gas fees for EIP-1559 transactions via TalkenApiClient
3019
- *
3020
- * @param network - Network name (ethereum, polygon, klaytn, etc.)
3021
- * @returns Suggested gas fees or null if failed
3022
- */
3023
- async getSuggestedGasFees(network) {
3024
- const api = getTalkenApiClient5();
3025
- if (!api)
3026
- throw new Error("TalkenApiClient not initialized");
3027
- try {
3028
- const gasFees = await api.evm.getGasSuggested(network);
3029
- return this.parseGasFees(gasFees);
3030
- } catch (error) {
3031
- console.warn(
3032
- "[GasApi] TalkenApi getGasSuggested failed:",
3033
- network,
3034
- error
3035
- );
3036
- return null;
3037
- }
3038
- }
3039
- /**
3040
- * Estimate gas limit for EIP-1559 transaction via TalkenApiClient
3041
- *
3042
- * @param params - Transaction parameters
3043
- * @returns Gas limit (hex string) or null if failed
3044
- */
3045
- async estimateGas(params) {
3046
- const api = getTalkenApiClient5();
3047
- if (!api)
3048
- throw new Error("TalkenApiClient not initialized");
3049
- try {
3050
- const response = await api.evm.estimateGas({
3051
- network: params.network,
3052
- from: params.from || "",
3053
- to: params.to,
3054
- value: params.value || "0x0",
3055
- data: params.data || "0x"
3056
- });
3057
- return response.result ?? null;
3058
- } catch (error) {
3059
- console.warn("[GasApi] TalkenApi estimateGas failed:", error);
3060
- return null;
3061
- }
3062
- }
3063
- /**
3064
- * Get suggested gas fees with timeout
3065
- *
3066
- * @param network - Network name
3067
- * @param timeoutMs - Timeout in milliseconds (default: 5000)
3068
- * @returns Suggested gas fees or null if timeout/failed
3069
- */
3070
- async getSuggestedGasFeesWithTimeout(network, timeoutMs = 5e3) {
3071
- try {
3072
- const result = await Promise.race([
3073
- this.getSuggestedGasFees(network),
3074
- new Promise(
3075
- (resolve) => setTimeout(() => resolve(null), timeoutMs)
3076
- )
3077
- ]);
3078
- return result;
3079
- } catch (_error) {
3080
- console.warn("[GasApi] Gas fees request timed out:", network);
3081
- return null;
3082
- }
3083
- }
3084
- /**
3085
- * Estimate gas with timeout
3086
- *
3087
- * @param params - Transaction parameters
3088
- * @param timeoutMs - Timeout in milliseconds (default: 5000)
3089
- * @returns Gas limit (hex string) or null if timeout/failed
3090
- */
3091
- async estimateGasWithTimeout(params, timeoutMs = 5e3) {
3092
- try {
3093
- const result = await Promise.race([
3094
- this.estimateGas(params),
3095
- new Promise(
3096
- (resolve) => setTimeout(() => resolve(null), timeoutMs)
3097
- )
3098
- ]);
3099
- return result;
3100
- } catch (_error) {
3101
- console.warn("[GasApi] Gas estimate request timed out");
3102
- return null;
3103
- }
3104
- }
3105
- };
3106
-
3107
- // src/wallets/walletConnectors/abcWallet/sessionUtils.ts
3108
- import { getTalkenApiClient as getTalkenApiClient6 } from "@talken/talkenkit";
3109
- var SessionExpiredError = class extends Error {
3110
- constructor(message = "Session expired. Please reconnect your wallet.") {
3111
- super(message);
3112
- this.name = "SessionExpiredError";
3113
- }
3114
- };
3115
- function dispatchSessionExpired() {
3116
- if (typeof window !== "undefined") {
3117
- console.warn("[SessionUtils] \u{1F6A8} dispatchSessionExpired called from:");
3118
- console.trace();
3119
- window.dispatchEvent(new CustomEvent("talkenkit:session_expired"));
3120
- }
3121
- }
3122
- function handleUnauthorizedResponse(response) {
3123
- if (response.status === 401) {
3124
- dispatchSessionExpired();
3125
- throw new SessionExpiredError(
3126
- "Session expired. Please reconnect your wallet."
3127
- );
3128
- }
3129
- }
3130
- async function fetchWithSessionCheck(url, options) {
3131
- const response = await fetch(url, options);
3132
- if (!response.ok && response.status === 401) {
3133
- const errorText = await response.text();
3134
- console.error("[ABC WaaS] \u274C Unauthorized (401):", errorText);
3135
- dispatchSessionExpired();
3136
- throw new SessionExpiredError(
3137
- "Session expired. Please reconnect your wallet."
3138
- );
3139
- }
3140
- return response;
3141
- }
3142
- async function refreshAccessToken(pinCallback) {
3143
- if (pinCallback) {
3144
- await pinCallback();
3145
- }
3146
- const refreshToken = localStorage.getItem(`${STORAGE_PREFIX}refresh_token`);
3147
- if (!refreshToken) {
3148
- console.warn("[SessionUtils] No refresh token - opening connect modal");
3149
- dispatchSessionExpired();
3150
- await new Promise((resolve) => setTimeout(resolve, 100));
3151
- throw new SessionExpiredError(
3152
- "Session expired. Please reconnect your wallet."
3153
- );
3154
- }
3155
- try {
3156
- const api = getTalkenApiClient6();
3157
- if (!api) {
3158
- throw new Error("TalkenApiClient not initialized");
3159
- }
3160
- api.setTokens(
3161
- localStorage.getItem(`${STORAGE_PREFIX}access_token`) || "",
3162
- refreshToken,
3163
- Number(localStorage.getItem(`${STORAGE_PREFIX}expires_at`) || "0")
3164
- );
3165
- const res = await api.auth.refresh();
3166
- const expiresAt = Date.now() + res.expiresIn * 1e3;
3167
- localStorage.setItem(`${STORAGE_PREFIX}access_token`, res.accessToken);
3168
- if (res.refreshToken) {
3169
- localStorage.setItem(`${STORAGE_PREFIX}refresh_token`, res.refreshToken);
3170
- }
3171
- localStorage.setItem(`${STORAGE_PREFIX}expires_at`, String(expiresAt));
3172
- console.log(
3173
- "[SessionUtils] \u2705 Token refreshed - expires in:",
3174
- (res.expiresIn / 60 / 60).toFixed(2),
3175
- "hours"
3176
- );
3177
- return res.accessToken;
3178
- } catch (error) {
3179
- console.error("[SessionUtils] Token refresh failed:", error);
3180
- dispatchSessionExpired();
3181
- await new Promise((resolve) => setTimeout(resolve, 100));
3182
- throw new SessionExpiredError(
3183
- "Session expired. Please reconnect your wallet."
3184
- );
3185
- }
3186
- }
3187
-
3188
- // src/wallets/walletConnectors/abcWallet/abcBitcoinProvider.ts
3189
- import { getTalkenApiClient as getTalkenApiClient7 } from "@talken/talkenkit";
3190
- function isTalkenApiClient(client) {
3191
- return typeof client?.bitcoin?.getUtxos === "function";
3192
- }
3193
- var EventEmitter2 = class {
3194
- constructor() {
3195
- this.events = /* @__PURE__ */ new Map();
3196
- }
3197
- on(event, listener) {
3198
- if (!this.events.has(event)) {
3199
- this.events.set(event, []);
3200
- }
3201
- this.events.get(event).push(listener);
3202
- return this;
3203
- }
3204
- off(event, listener) {
3205
- const listeners = this.events.get(event);
3206
- if (listeners) {
3207
- const index = listeners.indexOf(listener);
3208
- if (index !== -1) {
3209
- listeners.splice(index, 1);
3210
- }
3211
- }
3212
- return this;
3213
- }
3214
- removeListener(event, listener) {
3215
- return this.off(event, listener);
3216
- }
3217
- emit(event, ...args) {
3218
- const listeners = this.events.get(event);
3219
- if (listeners) {
3220
- for (const listener of listeners) {
3221
- listener(...args);
3222
- }
3223
- return true;
3224
- }
3225
- return false;
3226
- }
3227
- removeAllListeners(event) {
3228
- if (event) {
3229
- this.events.delete(event);
3230
- } else {
3231
- this.events.clear();
3232
- }
3233
- return this;
3234
- }
3235
- };
3236
- var BitcoinErrorCode = {
3237
- USER_REJECTED: 4001,
3238
- UNAUTHORIZED: 4100,
3239
- UNSUPPORTED_METHOD: 4200,
3240
- DISCONNECTED: 4900,
3241
- INVALID_PARAMS: -32602,
3242
- INTERNAL_ERROR: -32603,
3243
- INSUFFICIENT_FUNDS: 5001,
3244
- UTXO_NOT_FOUND: 5002
3245
- };
3246
- var BitcoinProviderError = class extends Error {
3247
- constructor(code, message, data) {
3248
- super(message);
3249
- this.code = code;
3250
- this.data = data;
3251
- this.name = "BitcoinProviderError";
3252
- }
3253
- };
3254
- var BITCOIN_NETWORKS = {
3255
- mainnet: {
3256
- name: "Bitcoin Mainnet",
3257
- type: "bitcoin",
3258
- explorer: "https://blockstream.info"
3259
- },
3260
- testnet: {
3261
- name: "Bitcoin Testnet",
3262
- type: "bitcoin_testnet",
3263
- explorer: "https://blockstream.info/testnet"
3264
- }
3265
- };
3266
- var AbcBitcoinProvider = class extends EventEmitter2 {
3267
- constructor(client) {
3268
- super();
3269
- this.wallet = null;
3270
- this.network = BITCOIN_NETWORKS.testnet;
3271
- this.connected = false;
3272
- this.utxoCache = /* @__PURE__ */ new Map();
3273
- this.cacheExpiry = /* @__PURE__ */ new Map();
3274
- this.CACHE_TTL = 6e4;
3275
- if (isTalkenApiClient(client)) {
3276
- this.talkenApi = client;
3277
- }
3278
- }
3279
- extractHashSignature(result) {
3280
- const data = result;
3281
- return data?.signatureHex || data?.signstr || data?.result?.signstr || data?.data?.signatureHex || data?.data?.signstr || data?.data?.result?.signstr || "";
3282
- }
3283
- getRecoveryEmail() {
3284
- return getCredentialManager().getEmail() || void 0;
3285
- }
3286
- /**
3287
- * Set request interceptor for sign/transfer confirmation modals
3288
- */
3289
- setRequestInterceptor(interceptor) {
3290
- this.requestInterceptor = interceptor;
3291
- }
3292
- /**
3293
- * Call request interceptor if set (throws on user cancel)
3294
- */
3295
- async callInterceptor(request) {
3296
- if (this.requestInterceptor) {
3297
- await this.requestInterceptor(request);
3298
- }
3299
- }
3300
- /**
3301
- * Set wallet information
3302
- */
3303
- setWallet(wallet) {
3304
- const previousAddress = this.wallet?.address;
3305
- this.wallet = wallet;
3306
- this.connected = true;
3307
- if (wallet.network === "bitcoin") {
3308
- this.network = BITCOIN_NETWORKS.mainnet;
3309
- } else {
3310
- this.network = BITCOIN_NETWORKS.testnet;
3311
- }
3312
- if (previousAddress !== wallet.address) {
3313
- this.emit("accountsChanged", [wallet.address]);
3314
- this.clearUtxoCache();
3315
- }
3316
- this.emit("connect", {
3317
- address: wallet.address,
3318
- network: this.network.type
3319
- });
3320
- console.log(
3321
- "[BitcoinProvider] \u2705 Wallet connected:",
3322
- `${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 6)}`
3323
- );
3324
- }
3325
- /**
3326
- * Clear wallet (disconnect)
3327
- */
3328
- clearWallet() {
3329
- this.wallet = null;
3330
- this.connected = false;
3331
- this.clearUtxoCache();
3332
- this.emit("disconnect");
3333
- this.emit("accountsChanged", []);
3334
- console.log("[BitcoinProvider] \u{1F50C} Wallet disconnected");
3335
- }
3336
- /**
3337
- * Set TalkenApiClient for backend-proxied transaction flow
3338
- * When set, sendTransaction will use a single API call instead of multi-step WaaS
3339
- */
3340
- setTalkenApi(talkenApi) {
3341
- this.talkenApi = talkenApi;
3342
- }
3343
- /**
3344
- * Set network
3345
- */
3346
- setNetwork(networkKey) {
3347
- const newNetwork = BITCOIN_NETWORKS[networkKey];
3348
- if (!newNetwork) {
3349
- throw new BitcoinProviderError(
3350
- BitcoinErrorCode.INVALID_PARAMS,
3351
- `Unknown network: ${networkKey}`
3352
- );
3353
- }
3354
- const previousType = this.network.type;
3355
- this.network = newNetwork;
3356
- if (previousType !== newNetwork.type) {
3357
- this.emit("networkChanged", newNetwork.type);
3358
- this.clearUtxoCache();
3359
- }
3360
- }
3361
- /**
3362
- * Get current network
3363
- */
3364
- getNetwork() {
3365
- return this.network;
3366
- }
3367
- /**
3368
- * Check if connected
3369
- */
3370
- isConnected() {
3371
- return this.connected && this.wallet !== null;
3372
- }
3373
- /**
3374
- * Get Bitcoin address
3375
- */
3376
- async getAddress() {
3377
- if (!this.wallet) {
3378
- throw new BitcoinProviderError(
3379
- BitcoinErrorCode.DISCONNECTED,
3380
- "Wallet not connected"
3381
- );
3382
- }
3383
- return this.wallet.address;
3384
- }
3385
- /**
3386
- * Get compressed public key (33 bytes)
3387
- */
3388
- async getPublicKey() {
3389
- if (!this.wallet) {
3390
- throw new BitcoinProviderError(
3391
- BitcoinErrorCode.DISCONNECTED,
3392
- "Wallet not connected"
3393
- );
3394
- }
3395
- return this.wallet.publicKey;
3396
- }
3397
- /**
3398
- * Get address type (bech32, p2pkh, etc.)
3399
- */
3400
- getAddressType() {
3401
- if (!this.wallet) {
3402
- throw new BitcoinProviderError(
3403
- BitcoinErrorCode.DISCONNECTED,
3404
- "Wallet not connected"
3405
- );
3406
- }
3407
- return this.wallet.addressType;
3408
- }
3409
- /**
3410
- * Clear UTXO cache
3411
- */
3412
- clearUtxoCache() {
3413
- this.utxoCache.clear();
3414
- this.cacheExpiry.clear();
3415
- }
3416
- /**
3417
- * Check if cache is valid
3418
- */
3419
- isCacheValid(address) {
3420
- const expiry = this.cacheExpiry.get(address);
3421
- if (!expiry)
3422
- return false;
3423
- return Date.now() < expiry;
3424
- }
3425
- normalizeUtxos(rawUtxos) {
3426
- return rawUtxos.map((u) => ({
3427
- txid: String(u?.txid ?? u?.tx_hash ?? ""),
3428
- vout: Number(u?.vout ?? u?.output_index ?? 0),
3429
- value: Number(u?.value ?? u?.satoshis ?? 0),
3430
- scriptPubKey: String(
3431
- u?.scriptPubKey ?? u?.script_pub_key ?? u?.script ?? ""
3432
- ),
3433
- confirmations: Number(u?.confirmations ?? 0)
3434
- })).filter(
3435
- (u) => Boolean(u.txid) && Number.isFinite(u.vout) && Number.isFinite(u.value) && Number.isFinite(u.confirmations)
3436
- );
3437
- }
3438
- /**
3439
- * Get UTXOs for address (with caching)
3440
- */
3441
- async getUtxos(forceRefresh = false) {
3442
- if (!this.wallet) {
3443
- throw new BitcoinProviderError(
3444
- BitcoinErrorCode.DISCONNECTED,
3445
- "Wallet not connected"
3446
- );
3447
- }
3448
- const address = this.wallet.address;
3449
- if (!forceRefresh && this.isCacheValid(address)) {
3450
- const cached = this.utxoCache.get(address);
3451
- if (cached) {
3452
- console.log(
3453
- `[BitcoinProvider] \u{1F4E6} Using cached UTXOs (${cached.length} items)`
3454
- );
3455
- return cached;
3456
- }
3457
- }
3458
- try {
3459
- console.log("[BitcoinProvider] \u{1F50D} Fetching UTXOs from network...");
3460
- const api = this.talkenApi || getTalkenApiClient7();
3461
- const result = await api.bitcoin.getUtxos(this.network.type, address);
3462
- const utxos = this.normalizeUtxos(result.utxos || []);
3463
- this.utxoCache.set(address, utxos);
3464
- this.cacheExpiry.set(address, Date.now() + this.CACHE_TTL);
3465
- console.log(`[BitcoinProvider] \u2705 Fetched ${utxos.length} UTXOs`);
3466
- return utxos;
3467
- } catch (error) {
3468
- console.error(
3469
- "[BitcoinProvider] \u274C Failed to fetch UTXOs:",
3470
- error.message
3471
- );
3472
- throw new BitcoinProviderError(
3473
- BitcoinErrorCode.INTERNAL_ERROR,
3474
- "Failed to fetch UTXOs",
3475
- error
3476
- );
3477
- }
3478
- }
3479
- /**
3480
- * Get total balance (sum of all UTXOs)
3481
- * Returns balance in satoshis
3482
- */
3483
- async getBalance(forceRefresh = false) {
3484
- const utxos = await this.getUtxos(forceRefresh);
3485
- const balance = utxos.reduce((sum, utxo) => sum + utxo.value, 0);
3486
- console.log(
3487
- `[BitcoinProvider] \u{1F4B0} Balance: ${balance} satoshis (${balance / 1e8} BTC)`
3488
- );
3489
- return balance;
3490
- }
3491
- /**
3492
- * Estimate transaction fee
3493
- * Returns fee rate in satoshis per byte
3494
- */
3495
- async estimateFee(targetBlocks = 6) {
3496
- try {
3497
- const api = this.talkenApi || getTalkenApiClient7();
3498
- const result = await api.bitcoin.getFeeRate(
3499
- this.network.type,
3500
- targetBlocks
3501
- );
3502
- const feeRate = Number(result.feeRate);
3503
- if (!Number.isFinite(feeRate) || feeRate <= 0) {
3504
- throw new Error("Invalid fee rate");
3505
- }
3506
- console.log(`[BitcoinProvider] \u26FD Fee rate: ${feeRate} sat/byte`);
3507
- return feeRate;
3508
- } catch (_error) {
3509
- console.error("[BitcoinProvider] \u26A0\uFE0F Fee estimation failed, using default");
3510
- return 1;
3511
- }
3512
- }
3513
- /**
3514
- * Sign Bitcoin message (Bitcoin Signed Message format)
3515
- * Uses secp256k1 sign/hash endpoint with double-SHA256 of prefixed message.
3516
- *
3517
- * Format: SHA256(SHA256("\x18Bitcoin Signed Message:\n" + varint(len) + message))
3518
- *
3519
- * @param message - Message to sign (string)
3520
- * @returns Signature in hex format (compact: r + s + v)
3521
- */
3522
- async signMessage(message) {
3523
- if (!this.wallet) {
3524
- throw new BitcoinProviderError(
3525
- BitcoinErrorCode.DISCONNECTED,
3526
- "Wallet not connected"
3527
- );
3528
- }
3529
- await this.callInterceptor({
3530
- chain: "bitcoin",
3531
- method: "signMessage",
3532
- address: this.wallet.address,
3533
- network: this.network.type,
3534
- message
3535
- });
3536
- console.log("[BitcoinProvider] \u{1F4DD} Signing Bitcoin message...");
3537
- const prefix = "Bitcoin Signed Message:\n";
3538
- const msgBytes = new TextEncoder().encode(message);
3539
- const varint = this.encodeVarint(msgBytes.length);
3540
- const prefixBytes = new TextEncoder().encode(prefix);
3541
- const preimage = new Uint8Array(
3542
- prefixBytes.length + varint.length + msgBytes.length
3543
- );
3544
- preimage.set(prefixBytes, 0);
3545
- preimage.set(varint, prefixBytes.length);
3546
- preimage.set(msgBytes, prefixBytes.length + varint.length);
3547
- const hash1 = await crypto.subtle.digest("SHA-256", preimage);
3548
- const hash2 = await crypto.subtle.digest("SHA-256", hash1);
3549
- const hashHex = Array.from(new Uint8Array(hash2)).map((b) => b.toString(16).padStart(2, "0")).join("");
3550
- const api = getTalkenApiClient7();
3551
- if (!api) {
3552
- throw new BitcoinProviderError(
3553
- BitcoinErrorCode.INTERNAL_ERROR,
3554
- "TalkenApiClient not initialized"
3555
- );
3556
- }
3557
- const pinHash = getCredentialManager().getPinHash() || "";
3558
- const email = this.getRecoveryEmail();
3559
- let signstr = "";
3560
- try {
3561
- const result = await api.bitcoin.execute({
3562
- action: "signHash",
3563
- hash: hashHex,
3564
- pin: pinHash,
3565
- network: this.network.type,
3566
- ...email && { email }
3567
- });
3568
- signstr = this.extractHashSignature(result);
3569
- } catch (error) {
3570
- console.warn(
3571
- "[BitcoinProvider] BTC signHash endpoint failed, falling back to generic sign/hash:",
3572
- error
3573
- );
3574
- }
3575
- if (!signstr) {
3576
- signstr = this.extractHashSignature(
3577
- await api.bitcoin.signHash({
3578
- hash: hashHex,
3579
- pin: pinHash,
3580
- network: this.network.type,
3581
- ...email && { email }
3582
- })
3583
- );
3584
- }
3585
- if (!signstr) {
3586
- throw new BitcoinProviderError(
3587
- BitcoinErrorCode.INTERNAL_ERROR,
3588
- "Empty signature from sign/hash"
3589
- );
3590
- }
3591
- console.log("[BitcoinProvider] \u2705 Message signed successfully");
3592
- return signstr;
3593
- }
3594
- /** Encode integer as Bitcoin varint */
3595
- encodeVarint(n) {
3596
- if (n < 253)
3597
- return new Uint8Array([n]);
3598
- if (n <= 65535) {
3599
- const buf2 = new Uint8Array(3);
3600
- buf2[0] = 253;
3601
- buf2[1] = n & 255;
3602
- buf2[2] = n >> 8 & 255;
3603
- return buf2;
3604
- }
3605
- const buf = new Uint8Array(5);
3606
- buf[0] = 254;
3607
- buf[1] = n & 255;
3608
- buf[2] = n >> 8 & 255;
3609
- buf[3] = n >> 16 & 255;
3610
- buf[4] = n >> 24 & 255;
3611
- return buf;
3612
- }
3613
- /**
3614
- * High-level transaction sending (like Solana pattern)
3615
- * Creates, signs, and broadcasts transaction
3616
- *
3617
- * @param params - Transaction parameters
3618
- * @param params.toAddress - Recipient Bitcoin address
3619
- * @param params.amount - Amount in BTC (will be converted to satoshis)
3620
- * @returns Transaction hash
3621
- */
3622
- async sendTransaction(params) {
3623
- if (!this.wallet) {
3624
- throw new BitcoinProviderError(
3625
- BitcoinErrorCode.DISCONNECTED,
3626
- "Wallet not connected"
3627
- );
3628
- }
3629
- try {
3630
- await this.callInterceptor({
3631
- chain: "bitcoin",
3632
- method: "sendTransaction",
3633
- fromAddress: this.wallet.address,
3634
- toAddress: params.toAddress,
3635
- amount: String(params.amount),
3636
- symbol: "BTC",
3637
- network: this.network.type,
3638
- isNativeToken: true,
3639
- feeSymbol: "BTC"
3640
- });
3641
- console.log("[BitcoinProvider] \u{1F4B8} Starting high-level transaction...");
3642
- const pinHash = getCredentialManager().getPinHash();
3643
- if (!pinHash) {
3644
- throw new BitcoinProviderError(
3645
- BitcoinErrorCode.INTERNAL_ERROR,
3646
- "PIN hash not found. Please login again."
3647
- );
3648
- }
3649
- const email = this.getRecoveryEmail();
3650
- const satoshis = Math.floor(params.amount * 1e8);
3651
- const api = this.talkenApi || getTalkenApiClient7();
3652
- const result = await api.bitcoin.sendTransaction({
3653
- toAddress: params.toAddress,
3654
- amountSats: satoshis.toString(),
3655
- pin: pinHash,
3656
- ...email && { email }
3657
- });
3658
- console.log(
3659
- "[BitcoinProvider] \u2705 BTC transaction complete via TalkenApiClient:",
3660
- result.txHash
3661
- );
3662
- this.emit("transactionBroadcasted", {
3663
- txHash: result.txHash,
3664
- explorerUrl: `${this.network.explorer}/tx/${result.txHash}`
3665
- });
3666
- this.clearUtxoCache();
3667
- return result.txHash;
3668
- } catch (error) {
3669
- if (error.message?.includes("cancelled") || error.message?.includes("rejected")) {
3670
- console.log("[BitcoinProvider] \u2139\uFE0F User cancelled transaction");
3671
- throw new BitcoinProviderError(
3672
- BitcoinErrorCode.USER_REJECTED,
3673
- "User rejected transaction",
3674
- error
3675
- );
3676
- }
3677
- console.error("[BitcoinProvider] \u274C Transaction failed:", error.message);
3678
- if (error.message?.includes("insufficient")) {
3679
- throw new BitcoinProviderError(
3680
- BitcoinErrorCode.INSUFFICIENT_FUNDS,
3681
- "Insufficient BTC balance",
3682
- error
3683
- );
3684
- }
3685
- this.emit("error", error);
3686
- throw new BitcoinProviderError(
3687
- BitcoinErrorCode.INTERNAL_ERROR,
3688
- "Failed to send transaction",
3689
- error
3690
- );
3691
- }
3692
- }
3693
- /**
3694
- * Broadcast signed transaction to network
3695
- *
3696
- * @param rawTransaction - Raw transaction in hex format
3697
- * @param psbt - Optional finalized PSBT
3698
- * @returns Transaction hash
3699
- */
3700
- async broadcastTransaction(rawTransaction, psbt) {
3701
- if (!this.wallet) {
3702
- throw new BitcoinProviderError(
3703
- BitcoinErrorCode.DISCONNECTED,
3704
- "Wallet not connected"
3705
- );
3706
- }
3707
- try {
3708
- console.log("[BitcoinProvider] \u{1F4E1} Broadcasting transaction...");
3709
- if (psbt) {
3710
- console.log(
3711
- "[BitcoinProvider] \u2139\uFE0F PSBT argument provided; raw tx broadcast uses rawTransaction only via talken-api"
3712
- );
3713
- }
3714
- const api = this.talkenApi || getTalkenApiClient7();
3715
- const result = await api.bitcoin.broadcastRawTransaction({
3716
- network: this.network.type,
3717
- rawTransaction
3718
- });
3719
- console.log(
3720
- "[BitcoinProvider] \u2705 Transaction broadcasted:",
3721
- result.txHash
3722
- );
3723
- this.emit("transactionBroadcasted", {
3724
- txHash: result.txHash,
3725
- explorerUrl: `${this.network.explorer}/tx/${result.txHash}`
3726
- });
3727
- this.clearUtxoCache();
3728
- return result.txHash;
3729
- } catch (error) {
3730
- console.error(
3731
- "[BitcoinProvider] \u274C Transaction broadcast failed:",
3732
- error.message
3733
- );
3734
- this.emit("error", error);
3735
- throw new BitcoinProviderError(
3736
- BitcoinErrorCode.INTERNAL_ERROR,
3737
- "Failed to broadcast transaction",
3738
- error
3739
- );
3740
- }
3741
- }
3742
- /**
3743
- * Get wallet info
3744
- */
3745
- getWalletInfo() {
3746
- if (!this.wallet)
3747
- return null;
3748
- return {
3749
- address: this.wallet.address,
3750
- publicKey: this.wallet.publicKey,
3751
- addressType: this.wallet.addressType,
3752
- network: this.network.type
3753
- };
3754
- }
3755
- /**
3756
- * Refresh UTXO cache
3757
- */
3758
- async refreshUtxos() {
3759
- return this.getUtxos(true);
3760
- }
3761
- };
3762
-
3763
- // src/wallets/walletConnectors/abcWallet/abcBitcoinConnector.ts
3764
- import { getTalkenApiClient as getTalkenApiClient8 } from "@talken/talkenkit";
3765
- var AbcBitcoinConnector = class {
3766
- constructor(config) {
3767
- this.wallet = null;
3768
- this.connected = false;
3769
- // Event listeners
3770
- this.connectListeners = /* @__PURE__ */ new Set();
3771
- this.disconnectListeners = /* @__PURE__ */ new Set();
3772
- this.accountsChangedListeners = /* @__PURE__ */ new Set();
3773
- this.networkChangedListeners = /* @__PURE__ */ new Set();
3774
- this.provider = config.provider;
3775
- this.setupProviderListeners();
3776
- }
3777
- /**
3778
- * Setup provider event listeners
3779
- */
3780
- setupProviderListeners() {
3781
- this.provider.on("connect", () => {
3782
- this.connected = true;
3783
- if (this.wallet) {
3784
- for (const listener of this.connectListeners) {
3785
- listener(this.wallet);
3786
- }
3787
- }
3788
- });
3789
- this.provider.on("disconnect", () => {
3790
- this.connected = false;
3791
- this.wallet = null;
3792
- for (const listener of this.disconnectListeners) {
3793
- listener();
3794
- }
3795
- });
3796
- this.provider.on("accountsChanged", (accounts) => {
3797
- for (const listener of this.accountsChangedListeners) {
3798
- listener(accounts);
3799
- }
3800
- });
3801
- this.provider.on("networkChanged", (network) => {
3802
- for (const listener of this.networkChangedListeners) {
3803
- listener(network);
3804
- }
3805
- });
3806
- }
3807
- /**
3808
- * Connect Bitcoin wallet
3809
- */
3810
- async connect() {
3811
- try {
3812
- const authState = loadAuthState();
3813
- console.log("[BitcoinConnector] \u{1F527} connect() called:", {
3814
- hasAuthState: !!authState,
3815
- isAuthenticated: authState?.isAuthenticated,
3816
- hasBitcoinWallet: !!authState?.bitcoinWallet,
3817
- bitcoinAddress: authState?.bitcoinWallet?.address
3818
- });
3819
- if (!authState || !authState.isAuthenticated || !authState.bitcoinWallet) {
3820
- throw new Error("BITCOIN_LOGIN_REQUIRED");
3821
- }
3822
- this.wallet = authState.bitcoinWallet;
3823
- this.provider.setWallet(authState.bitcoinWallet);
3824
- console.log("[BitcoinConnector] \u2705 Wallet set:", {
3825
- address: authState.bitcoinWallet.address,
3826
- publicKey: authState.bitcoinWallet.publicKey,
3827
- addressType: authState.bitcoinWallet.addressType,
3828
- network: authState.bitcoinWallet.network
3829
- });
3830
- this.connected = true;
3831
- return {
3832
- address: authState.bitcoinWallet.address,
3833
- publicKey: authState.bitcoinWallet.publicKey,
3834
- network: authState.bitcoinWallet.network
3835
- };
3836
- } catch (error) {
3837
- if (error.message === "BITCOIN_LOGIN_REQUIRED") {
3838
- throw error;
3839
- }
3840
- console.error("[BitcoinConnector] \u274C connect error:", error);
3841
- throw error;
3842
- }
3843
- }
3844
- /**
3845
- * Disconnect Bitcoin wallet
3846
- */
3847
- async disconnect() {
3848
- try {
3849
- this.provider.clearWallet();
3850
- this.wallet = null;
3851
- this.connected = false;
3852
- console.log("[BitcoinConnector] \u2705 Wallet disconnected");
3853
- } catch (error) {
3854
- console.error("[BitcoinConnector] \u274C disconnect error:", error);
3855
- throw error;
3856
- }
3857
- }
3858
- /**
3859
- * Get Bitcoin address
3860
- */
3861
- async getAddress() {
3862
- return this.provider.getAddress();
3863
- }
3864
- /**
3865
- * Get compressed public key (33 bytes)
3866
- */
3867
- async getPublicKey() {
3868
- return this.provider.getPublicKey();
3869
- }
3870
- /**
3871
- * Get address type (bech32, p2pkh, etc.)
3872
- */
3873
- getAddressType() {
3874
- return this.provider.getAddressType();
3875
- }
3876
- /**
3877
- * Get UTXOs
3878
- */
3879
- async getUtxos(forceRefresh = false) {
3880
- return this.provider.getUtxos(forceRefresh);
3881
- }
3882
- /**
3883
- * Get balance (in satoshis)
3884
- */
3885
- async getBalance(forceRefresh = false) {
3886
- return this.provider.getBalance(forceRefresh);
3887
- }
3888
- /**
3889
- * Estimate transaction fee
3890
- */
3891
- async estimateFee(targetBlocks = 6) {
3892
- return this.provider.estimateFee(targetBlocks);
3893
- }
3894
- /**
3895
- * Sign Bitcoin message (BIP-322)
3896
- * NOTE: Currently not supported - Bitcoin uses v2 API which doesn't have message signing endpoint
3897
- */
3898
- async signMessage(message) {
3899
- return this.provider.signMessage(message);
3900
- }
3901
- /**
3902
- * Send Bitcoin transaction (high-level API)
3903
- * Creates, signs, and broadcasts transaction
3904
- */
3905
- async sendTransaction(params) {
3906
- return this.provider.sendTransaction(params);
3907
- }
3908
- /**
3909
- * Broadcast signed transaction to network (low-level API)
3910
- */
3911
- async broadcastTransaction(rawTransaction, psbt) {
3912
- return this.provider.broadcastTransaction(rawTransaction, psbt);
3913
- }
3914
- /**
3915
- * Check if authorized (has valid session)
3916
- */
3917
- async isAuthorized() {
3918
- try {
3919
- const authState = loadAuthState();
3920
- if (!authState || !authState.isAuthenticated) {
3921
- return false;
3922
- }
3923
- if (!authState.bitcoinWallet) {
3924
- return false;
3925
- }
3926
- const api = getTalkenApiClient8();
3927
- return !!api && !api.isTokenExpired();
3928
- } catch {
3929
- return false;
3930
- }
3931
- }
3932
- /**
3933
- * Check if connected
3934
- */
3935
- isConnected() {
3936
- return this.connected && this.provider.isConnected();
3937
- }
3938
- /**
3939
- * Get current wallet
3940
- */
3941
- getWallet() {
3942
- return this.wallet;
3943
- }
3944
- /**
3945
- * Get provider
3946
- */
3947
- getProvider() {
3948
- return this.provider;
3949
- }
3950
- /**
3951
- * Get wallet info
3952
- */
3953
- getWalletInfo() {
3954
- return this.provider.getWalletInfo();
3955
- }
3956
- /**
3957
- * Switch network
3958
- */
3959
- async switchNetwork(network) {
3960
- this.provider.setNetwork(network);
3961
- const authState = loadAuthState();
3962
- if (authState?.bitcoinWallet) {
3963
- authState.bitcoinWallet.network = network === "mainnet" ? "bitcoin" /* Mainnet */ : "bitcoin_testnet" /* Testnet */;
3964
- saveAuthState(authState);
3965
- }
3966
- console.log("[BitcoinConnector] \u{1F504} Network switched to:", network);
3967
- }
3968
- /**
3969
- * Get current network
3970
- */
3971
- getNetwork() {
3972
- return this.provider.getNetwork().type;
3973
- }
3974
- /**
3975
- * Refresh UTXO cache
3976
- */
3977
- async refreshUtxos() {
3978
- return this.provider.refreshUtxos();
3979
- }
3980
- on(event, listener) {
3981
- switch (event) {
3982
- case "connect":
3983
- this.connectListeners.add(listener);
3984
- break;
3985
- case "disconnect":
3986
- this.disconnectListeners.add(listener);
3987
- break;
3988
- case "accountsChanged":
3989
- this.accountsChangedListeners.add(listener);
3990
- break;
3991
- case "networkChanged":
3992
- this.networkChangedListeners.add(listener);
3993
- break;
3994
- }
3995
- }
3996
- off(event, listener) {
3997
- switch (event) {
3998
- case "connect":
3999
- this.connectListeners.delete(listener);
4000
- break;
4001
- case "disconnect":
4002
- this.disconnectListeners.delete(listener);
4003
- break;
4004
- case "accountsChanged":
4005
- this.accountsChangedListeners.delete(listener);
4006
- break;
4007
- case "networkChanged":
4008
- this.networkChangedListeners.delete(listener);
4009
- break;
4010
- }
4011
- }
4012
- /**
4013
- * Remove all listeners
4014
- */
4015
- removeAllListeners() {
4016
- this.connectListeners.clear();
4017
- this.disconnectListeners.clear();
4018
- this.accountsChangedListeners.clear();
4019
- this.networkChangedListeners.clear();
4020
- }
4021
- };
4022
- function createAbcBitcoinConnector(config) {
4023
- return new AbcBitcoinConnector(config);
4024
- }
4025
-
4026
- // src/wallets/walletConnectors/abcWallet/abcSolanaProvider.ts
4027
- import { getTalkenApiClient as getTalkenApiClient9 } from "@talken/talkenkit";
4028
- var EventEmitter3 = class {
4029
- constructor() {
4030
- this.events = /* @__PURE__ */ new Map();
4031
- }
4032
- on(event, listener) {
4033
- if (!this.events.has(event)) {
4034
- this.events.set(event, []);
4035
- }
4036
- this.events.get(event).push(listener);
4037
- return this;
4038
- }
4039
- off(event, listener) {
4040
- const listeners = this.events.get(event);
4041
- if (listeners) {
4042
- const index = listeners.indexOf(listener);
4043
- if (index !== -1) {
4044
- listeners.splice(index, 1);
4045
- }
4046
- }
4047
- return this;
4048
- }
4049
- removeListener(event, listener) {
4050
- return this.off(event, listener);
4051
- }
4052
- emit(event, ...args) {
4053
- const listeners = this.events.get(event);
4054
- if (listeners) {
4055
- for (const listener of listeners) {
4056
- listener(...args);
4057
- }
4058
- return true;
4059
- }
4060
- return false;
4061
- }
4062
- removeAllListeners(event) {
4063
- if (event) {
4064
- this.events.delete(event);
4065
- } else {
4066
- this.events.clear();
4067
- }
4068
- return this;
4069
- }
4070
- };
4071
- var SolanaErrorCode = {
4072
- USER_REJECTED: 4001,
4073
- UNAUTHORIZED: 4100,
4074
- UNSUPPORTED_METHOD: 4200,
4075
- DISCONNECTED: 4900,
4076
- INVALID_PARAMS: -32602,
4077
- INTERNAL_ERROR: -32603
4078
- };
4079
- var SolanaProviderError = class extends Error {
4080
- constructor(code, message, data) {
4081
- super(message);
4082
- this.code = code;
4083
- this.data = data;
4084
- this.name = "SolanaProviderError";
4085
- }
4086
- };
4087
- var AbcSolanaProvider = class extends EventEmitter3 {
4088
- constructor(talkenApi) {
4089
- super();
4090
- this.wallet = null;
4091
- this.connected = false;
4092
- this.talkenApi = talkenApi;
4093
- }
4094
- /**
4095
- * Set request interceptor for sign/transfer confirmation modals
4096
- */
4097
- setRequestInterceptor(interceptor) {
4098
- this.requestInterceptor = interceptor;
4099
- }
4100
- /**
4101
- * Call request interceptor if set (throws on user cancel)
4102
- */
4103
- async callInterceptor(request) {
4104
- if (this.requestInterceptor) {
4105
- await this.requestInterceptor(request);
4106
- }
4107
- }
4108
- /**
4109
- * Set wallet information
4110
- */
4111
- setWallet(wallet) {
4112
- const previousAddress = this.wallet?.address;
4113
- this.wallet = wallet;
4114
- this.connected = true;
4115
- if (previousAddress !== wallet.address) {
4116
- this.emit("accountsChanged", [wallet.address]);
4117
- }
4118
- this.emit("connect", {
4119
- address: wallet.address,
4120
- network: wallet.network
4121
- });
4122
- }
4123
- /**
4124
- * Clear wallet (disconnect)
4125
- */
4126
- clearWallet() {
4127
- this.wallet = null;
4128
- this.connected = false;
4129
- this.emit("disconnect");
4130
- this.emit("accountsChanged", []);
4131
- }
4132
- /**
4133
- * Set TalkenApiClient for backend-proxied transaction flow
4134
- * When set, native SOL transfers will use a single API call instead of multi-step WaaS
4135
- */
4136
- setTalkenApi(talkenApi) {
4137
- this.talkenApi = talkenApi;
4138
- }
4139
- getTalkenApiClientOrThrow() {
4140
- const api = this.talkenApi || getTalkenApiClient9();
4141
- if (!api) {
4142
- throw new SolanaProviderError(
4143
- SolanaErrorCode.INTERNAL_ERROR,
4144
- "TalkenApiClient not initialized"
4145
- );
4146
- }
4147
- return api;
4148
- }
4149
- getSigningNetwork() {
4150
- return this.wallet?.network === "solana" ? "solana" : "solana_devnet";
4151
- }
4152
- /**
4153
- * Check if connected
4154
- */
4155
- isConnected() {
4156
- return this.connected && this.wallet !== null;
4157
- }
4158
- /**
4159
- * Get Solana address
4160
- */
4161
- async getAddress() {
4162
- if (!this.wallet) {
4163
- throw new SolanaProviderError(
4164
- SolanaErrorCode.DISCONNECTED,
4165
- "Wallet not connected"
4166
- );
4167
- }
4168
- return this.wallet.address;
4169
- }
4170
- /**
4171
- * Get public key
4172
- */
4173
- async getPublicKey() {
4174
- if (!this.wallet) {
4175
- throw new SolanaProviderError(
4176
- SolanaErrorCode.DISCONNECTED,
4177
- "Wallet not connected"
4178
- );
4179
- }
4180
- return this.wallet.publicKey;
4181
- }
4182
- /**
4183
- * Sign Solana message (no PIN required)
4184
- * Uses encrypted_share which doesn't require PIN
4185
- */
4186
- async signMessage(encodedMessage, _display) {
4187
- if (!this.wallet) {
4188
- throw new SolanaProviderError(
4189
- SolanaErrorCode.DISCONNECTED,
4190
- "Wallet not connected"
4191
- );
4192
- }
4193
- try {
4194
- const decodedText = new TextDecoder().decode(encodedMessage);
4195
- await this.callInterceptor({
4196
- chain: "solana",
4197
- method: "signMessage",
4198
- address: this.wallet.address,
4199
- network: this.wallet.network,
4200
- message: decodedText
4201
- });
4202
- const messageHex = `0x${Array.from(encodedMessage).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
4203
- const result = await this.getTalkenApiClientOrThrow().solana.sign({
4204
- message: messageHex,
4205
- encryptedShare: this.wallet.encryptedShare,
4206
- keyId: this.wallet.keyId,
4207
- secretStore: this.wallet.secretStore || "",
4208
- network: this.getSigningNetwork()
4209
- });
4210
- const signatureHex = result.signature.startsWith("0x") ? result.signature.slice(2) : result.signature;
4211
- const signatureBytes = new Uint8Array(
4212
- signatureHex.match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || []
4213
- );
4214
- return { signature: signatureBytes };
4215
- } catch (error) {
4216
- this.emit("error", error);
4217
- throw new SolanaProviderError(
4218
- SolanaErrorCode.INTERNAL_ERROR,
4219
- "Failed to sign message",
4220
- error
4221
- );
4222
- }
4223
- }
4224
- /**
4225
- * Sign arbitrary Solana transaction (requires PIN)
4226
- * Supports both Legacy Transaction and VersionedTransaction
4227
- * Used for custom transactions, dApp interactions, and protocol integrations
4228
- */
4229
- async signTransaction(transaction) {
4230
- if (!this.wallet) {
4231
- throw new SolanaProviderError(
4232
- SolanaErrorCode.DISCONNECTED,
4233
- "Wallet not connected"
4234
- );
4235
- }
4236
- try {
4237
- let txMessage = "";
4238
- try {
4239
- txMessage = JSON.stringify(transaction, null, 2);
4240
- } catch {
4241
- txMessage = String(transaction);
4242
- }
4243
- await this.callInterceptor({
4244
- chain: "solana",
4245
- method: "signTransaction",
4246
- address: this.wallet.address,
4247
- network: this.wallet.network,
4248
- message: txMessage,
4249
- isTransaction: true
4250
- });
4251
- const { VersionedTransaction, PublicKey } = await import("@solana/web3.js");
4252
- const isVersioned = transaction instanceof VersionedTransaction;
4253
- let serialized;
4254
- if (isVersioned) {
4255
- serialized = transaction.message.serialize();
4256
- } else {
4257
- serialized = transaction.serializeMessage();
4258
- }
4259
- const messageHex = Buffer.from(serialized).toString("hex");
4260
- const signatureResponse = await this.getTalkenApiClientOrThrow().solana.sign({
4261
- keyId: this.wallet.keyId,
4262
- encryptedShare: this.wallet.encryptedShare,
4263
- secretStore: this.wallet.secretStore || "",
4264
- message: messageHex,
4265
- network: this.getSigningNetwork()
4266
- });
4267
- const signatureHex = signatureResponse.signature.startsWith("0x") ? signatureResponse.signature.slice(2) : signatureResponse.signature;
4268
- const signatureBytes = Buffer.from(signatureHex, "hex");
4269
- const publicKey = new PublicKey(this.wallet.address);
4270
- if (isVersioned) {
4271
- transaction.addSignature(publicKey, signatureBytes);
4272
- } else {
4273
- transaction.addSignature(publicKey, signatureBytes);
4274
- }
4275
- return transaction;
4276
- } catch (error) {
4277
- if (error.code === 4001 || error.cancelled) {
4278
- throw error;
4279
- }
4280
- this.emit("error", error);
4281
- throw new SolanaProviderError(
4282
- SolanaErrorCode.INTERNAL_ERROR,
4283
- "Failed to sign transaction",
4284
- error
4285
- );
4286
- }
4287
- }
4288
- /**
4289
- * Sign multiple transactions (batch signing)
4290
- */
4291
- async signAllTransactions(transactions) {
4292
- const signedTransactions = [];
4293
- for (const transaction of transactions) {
4294
- const signed = await this.signTransaction(transaction);
4295
- signedTransactions.push(signed);
4296
- }
4297
- return signedTransactions;
4298
- }
4299
- /**
4300
- * Unified transfer: SOL, SPL token, or NFT
4301
- * - No mintAddress → native SOL transfer (kind='native')
4302
- * - With mintAddress → SPL/NFT transfer (kind='spl')
4303
- * - NFT = transfer({ mintAddress, toAddress, amount: 1 })
4304
- */
4305
- async transfer(params) {
4306
- if (!this.wallet) {
4307
- throw new SolanaProviderError(
4308
- SolanaErrorCode.DISCONNECTED,
4309
- "Wallet not connected"
4310
- );
4311
- }
4312
- try {
4313
- const symbol = params.mintAddress ? "SPL" : "SOL";
4314
- await this.callInterceptor({
4315
- chain: "solana",
4316
- method: "transfer",
4317
- fromAddress: this.wallet.address,
4318
- toAddress: params.toAddress,
4319
- amount: String(params.amount),
4320
- symbol,
4321
- network: this.wallet.network,
4322
- tokenAddress: params.mintAddress,
4323
- isNativeToken: !params.mintAddress,
4324
- feeSymbol: "SOL"
4325
- });
4326
- const pinHash = getCredentialManager().getPinHash();
4327
- if (!pinHash) {
4328
- throw new SolanaProviderError(
4329
- SolanaErrorCode.INTERNAL_ERROR,
4330
- "PIN hash not found. Please login again."
4331
- );
4332
- }
4333
- console.log("[AbcSolanaProvider] transfer START", {
4334
- kind: params.mintAddress ? "spl" : "native",
4335
- toAddress: params.toAddress,
4336
- amount: params.amount,
4337
- mintAddress: params.mintAddress || null,
4338
- network: this.wallet.network,
4339
- hasPinHash: !!pinHash
4340
- });
4341
- const api = this.getTalkenApiClientOrThrow();
4342
- if (params.mintAddress) {
4343
- const apiNetwork = this.wallet.network === "solana" ? "solana_mainnet" : this.wallet.network;
4344
- const { PublicKey, Connection } = await import("@solana/web3.js");
4345
- const connection = new Connection(this.getRpcUrl(), "confirmed");
4346
- const mintPubkey = new PublicKey(params.mintAddress);
4347
- const mintInfo = await connection.getParsedAccountInfo(mintPubkey);
4348
- const decimals = mintInfo.value?.data?.parsed?.info?.decimals || 9;
4349
- const rawAmount = Math.floor(params.amount * 10 ** decimals);
4350
- const result2 = await api.solana.transfer({
4351
- kind: "spl",
4352
- toAddress: params.toAddress,
4353
- mintAddress: params.mintAddress,
4354
- amount: String(rawAmount),
4355
- decimals,
4356
- network: apiNetwork,
4357
- pin: pinHash
4358
- });
4359
- console.log("[AbcSolanaProvider] SPL transfer result:", result2);
4360
- return { signature: result2.txHash };
4361
- }
4362
- const { LAMPORTS_PER_SOL } = await import("@solana/web3.js");
4363
- const amountLamports = params.amount * LAMPORTS_PER_SOL;
4364
- console.log("[AbcSolanaProvider] native transfer request:", {
4365
- toAddress: params.toAddress,
4366
- amountLamports: String(amountLamports),
4367
- amountSOL: params.amount
4368
- });
4369
- const result = await api.solana.transfer({
4370
- kind: "native",
4371
- toAddress: params.toAddress,
4372
- amountLamports: String(amountLamports),
4373
- pin: pinHash
4374
- });
4375
- console.log("[AbcSolanaProvider] native transfer result:", result);
4376
- return { signature: result.txHash };
4377
- } catch (error) {
4378
- console.error("[AbcSolanaProvider] transfer FAILED:", {
4379
- message: error.message,
4380
- code: error.code,
4381
- status: error.status,
4382
- details: error.details || error.data
4383
- });
4384
- if (error.code === 4001 || error.cancelled) {
4385
- throw error;
4386
- }
4387
- this.emit("error", error);
4388
- throw new SolanaProviderError(
4389
- SolanaErrorCode.INTERNAL_ERROR,
4390
- "Failed to transfer",
4391
- error
4392
- );
4393
- }
4394
- }
4395
- /**
4396
- * Get wallet info
4397
- */
4398
- getWalletInfo() {
4399
- if (!this.wallet)
4400
- return null;
4401
- return {
4402
- address: this.wallet.address,
4403
- publicKey: this.wallet.publicKey,
4404
- network: this.wallet.network
4405
- };
4406
- }
4407
- /**
4408
- * Get SPL token balance
4409
- *
4410
- * @param mintAddress - Token mint address
4411
- * @returns Token balance information
4412
- */
4413
- async getTokenBalance(mintAddress) {
4414
- if (!this.wallet) {
4415
- throw new SolanaProviderError(
4416
- SolanaErrorCode.DISCONNECTED,
4417
- "Wallet not connected"
4418
- );
4419
- }
4420
- try {
4421
- const { PublicKey, Connection } = await import("@solana/web3.js");
4422
- const { getAssociatedTokenAddress, TOKEN_PROGRAM_ID } = await import("@solana/spl-token");
4423
- const connection = new Connection(this.getRpcUrl(), "confirmed");
4424
- const mintPubkey = new PublicKey(mintAddress);
4425
- const ownerPubkey = new PublicKey(this.wallet.address);
4426
- const tokenAccount = await getAssociatedTokenAddress(
4427
- mintPubkey,
4428
- ownerPubkey,
4429
- false,
4430
- TOKEN_PROGRAM_ID
4431
- );
4432
- const balance = await connection.getTokenAccountBalance(tokenAccount);
4433
- return {
4434
- amount: balance.value.amount,
4435
- decimals: balance.value.decimals,
4436
- uiAmount: balance.value.uiAmount || 0
4437
- };
4438
- } catch (error) {
4439
- this.emit("error", error);
4440
- throw new SolanaProviderError(
4441
- SolanaErrorCode.INTERNAL_ERROR,
4442
- "Failed to get token balance",
4443
- error
4444
- );
4445
- }
4446
- }
4447
- /**
4448
- * Get RPC URL based on network
4449
- */
4450
- getRpcUrl() {
4451
- const isMainnet = this.wallet?.network === "solana";
4452
- return isMainnet ? process.env.NEXT_PUBLIC_SOLANA_RPC_MAINNET || "https://api.mainnet-beta.solana.com" : process.env.NEXT_PUBLIC_SOLANA_RPC_DEVNET || "https://api.devnet.solana.com";
4453
- }
4454
- };
4455
-
4456
- // src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
4457
- import { getTalkenApiClient as getTalkenApiClient10 } from "@talken/talkenkit";
4458
- function isTalkenApiClient2(client) {
4459
- return typeof client?.tron?.transferTrx === "function";
4460
- }
4461
- var TronErrorCode = {
4462
- USER_REJECTED: 4001,
4463
- UNAUTHORIZED: 4100,
4464
- UNSUPPORTED_METHOD: 4200,
4465
- DISCONNECTED: 4900,
4466
- INVALID_PARAMS: -32602,
4467
- INTERNAL_ERROR: -32603,
4468
- INSUFFICIENT_FUNDS: 5001
4469
- };
4470
- var TronProviderError = class extends Error {
4471
- constructor(code, message, data) {
4472
- super(message);
4473
- this.code = code;
4474
- this.data = data;
4475
- this.name = "TronProviderError";
4476
- }
4477
- };
4478
- var TRON_NETWORKS = {
4479
- mainnet: {
4480
- name: "TRON Mainnet",
4481
- type: "tron",
4482
- explorer: "https://tronscan.org"
4483
- },
4484
- nile: {
4485
- name: "TRON Nile Testnet",
4486
- type: "tron_nile",
4487
- explorer: "https://nile.tronscan.org"
4488
- }
4489
- };
4490
- var EventEmitter4 = class {
4491
- constructor() {
4492
- this.events = /* @__PURE__ */ new Map();
4493
- }
4494
- on(event, listener) {
4495
- if (!this.events.has(event)) {
4496
- this.events.set(event, []);
4497
- }
4498
- this.events.get(event).push(listener);
4499
- return this;
4500
- }
4501
- off(event, listener) {
4502
- const listeners = this.events.get(event);
4503
- if (listeners) {
4504
- const index = listeners.indexOf(listener);
4505
- if (index !== -1) {
4506
- listeners.splice(index, 1);
4507
- }
4508
- }
4509
- return this;
4510
- }
4511
- emit(event, ...args) {
4512
- const listeners = this.events.get(event);
4513
- if (listeners) {
4514
- for (const listener of listeners) {
4515
- listener(...args);
4516
- }
4517
- return true;
4518
- }
4519
- return false;
4520
- }
4521
- removeAllListeners(event) {
4522
- if (event) {
4523
- this.events.delete(event);
4524
- } else {
4525
- this.events.clear();
4526
- }
4527
- return this;
4528
- }
4529
- };
4530
- var AbcTronProvider = class extends EventEmitter4 {
4531
- constructor(client) {
4532
- super();
4533
- this.wallet = null;
4534
- this.network = TRON_NETWORKS.mainnet;
4535
- this.connected = false;
4536
- this.tokenMetadataCache = /* @__PURE__ */ new Map();
4537
- if (isTalkenApiClient2(client)) {
4538
- this.talkenApi = client;
4539
- }
4540
- }
4541
- /**
4542
- * Set request interceptor for transfer confirmation modals
4543
- */
4544
- setRequestInterceptor(interceptor) {
4545
- this.requestInterceptor = interceptor;
4546
- }
4547
- /**
4548
- * Call request interceptor if set (throws on user cancel)
4549
- */
4550
- async callInterceptor(request) {
4551
- if (this.requestInterceptor) {
4552
- await this.requestInterceptor(request);
4553
- }
4554
- }
4555
- /**
4556
- * Set wallet information
4557
- */
4558
- setWallet(wallet) {
4559
- const previousAddress = this.wallet?.address;
4560
- this.wallet = wallet;
4561
- this.connected = true;
4562
- if (wallet.network === "tron") {
4563
- this.network = TRON_NETWORKS.mainnet;
4564
- } else {
4565
- this.network = TRON_NETWORKS.nile;
4566
- }
4567
- if (previousAddress !== wallet.address) {
4568
- this.emit("accountsChanged", [wallet.address]);
4569
- }
4570
- this.emit("connect", {
4571
- address: wallet.address,
4572
- network: this.network.type
4573
- });
4574
- console.log(
4575
- "[TronProvider] \u2705 Wallet connected:",
4576
- `${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 6)}`
4577
- );
4578
- }
4579
- /**
4580
- * Clear wallet (disconnect)
4581
- */
4582
- clearWallet() {
4583
- this.wallet = null;
4584
- this.connected = false;
4585
- this.emit("disconnect");
4586
- this.emit("accountsChanged", []);
4587
- console.log("[TronProvider] \u{1F50C} Wallet disconnected");
4588
- }
4589
- /**
4590
- * Set TalkenApiClient for backend-proxied transaction flow
4591
- * When set, sendTransaction will use a single API call instead of multi-step WaaS
4592
- */
4593
- setTalkenApi(talkenApi) {
4594
- this.talkenApi = talkenApi;
4595
- }
4596
- /**
4597
- * Fetch token metadata (symbol, logo) from walletscan API with caching.
4598
- * Falls back to 'TRX'/'TRC20' on failure.
4599
- */
4600
- async fetchTokenMetadata(contractAddress) {
4601
- const cacheKey = contractAddress || "__native__";
4602
- const cached = this.tokenMetadataCache.get(cacheKey);
4603
- if (cached)
4604
- return cached;
4605
- try {
4606
- const api = this.talkenApi || getTalkenApiClient10();
4607
- const chainKeys = this.network.type === "tron_nile" ? "tronNile" : "tron";
4608
- let tokens;
4609
- if (contractAddress) {
4610
- tokens = await api.walletscan.getToken({ chainKeys, contractAddress });
4611
- } else {
4612
- tokens = await api.walletscan.getNativeTokens({
4613
- chainKeys,
4614
- walletAddress: this.wallet.address
4615
- });
4616
- }
4617
- if (tokens.length > 0) {
4618
- const info = { symbol: tokens[0].symbol, logo: tokens[0].logo };
4619
- this.tokenMetadataCache.set(cacheKey, info);
4620
- return info;
4621
- }
4622
- } catch {
4623
- }
4624
- return { symbol: contractAddress ? "TRC20" : "TRX" };
4625
- }
4626
- /**
4627
- * Check if connected
4628
- */
4629
- isConnected() {
4630
- return this.connected && this.wallet !== null;
4631
- }
4632
- /**
4633
- * Get TRON address
4634
- */
4635
- async getAddress() {
4636
- if (!this.wallet) {
4637
- throw new TronProviderError(
4638
- TronErrorCode.DISCONNECTED,
4639
- "Wallet not connected"
4640
- );
4641
- }
4642
- return this.wallet.address;
4643
- }
4644
- /**
4645
- * Get public key
4646
- */
4647
- async getPublicKey() {
4648
- if (!this.wallet) {
4649
- throw new TronProviderError(
4650
- TronErrorCode.DISCONNECTED,
4651
- "Wallet not connected"
4652
- );
4653
- }
4654
- return this.wallet.publicKey;
4655
- }
4656
- /**
4657
- * Get current network
4658
- */
4659
- getNetwork() {
4660
- return this.network;
4661
- }
4662
- /**
4663
- * Sign TRON message (not supported)
4664
- */
4665
- async signMessage(_message) {
4666
- throw new TronProviderError(
4667
- TronErrorCode.UNSUPPORTED_METHOD,
4668
- "TRON message signing is not supported. Use sendTransaction() instead."
4669
- );
4670
- }
4671
- /**
4672
- * Send TRON transaction (TRX native or TRC20)
4673
- * Complete flow: create unsigned tx -> request PIN -> sign -> broadcast
4674
- *
4675
- * @param params - Transaction parameters
4676
- * @returns Transaction hash
4677
- */
4678
- async sendTransaction(params) {
4679
- if (!this.wallet) {
4680
- throw new TronProviderError(
4681
- TronErrorCode.DISCONNECTED,
4682
- "Wallet not connected"
4683
- );
4684
- }
4685
- try {
4686
- const tokenMetadata = await this.fetchTokenMetadata(
4687
- params.contractAddress
4688
- );
4689
- await this.callInterceptor({
4690
- chain: "tron",
4691
- method: "sendTransaction",
4692
- fromAddress: this.wallet.address,
4693
- toAddress: params.toAddress,
4694
- amount: params.amount,
4695
- symbol: tokenMetadata.symbol,
4696
- network: this.network.type,
4697
- tokenAddress: params.contractAddress,
4698
- isNativeToken: !params.contractAddress,
4699
- feeSymbol: "TRX",
4700
- tokenLogo: tokenMetadata.logo
4701
- });
4702
- console.log("[TronProvider] \u{1F4B8} Starting TRON transaction...");
4703
- const pinHash = getCredentialManager().getPinHash();
4704
- if (!pinHash) {
4705
- throw new TronProviderError(
4706
- TronErrorCode.INTERNAL_ERROR,
4707
- "PIN hash not found. Please login again."
4708
- );
4709
- }
4710
- const txType = params.contractAddress ? "TRC20" : "NATIVE";
4711
- let amountRaw;
4712
- if (txType === "NATIVE") {
4713
- amountRaw = Math.floor(
4714
- Number.parseFloat(params.amount) * 1e6
4715
- ).toString();
4716
- console.log(
4717
- `[TronProvider] Converting ${params.amount} TRX -> ${amountRaw} SUN`
4718
- );
4719
- } else {
4720
- const decimals = params.decimals ?? 6;
4721
- amountRaw = Math.floor(
4722
- Number.parseFloat(params.amount) * 10 ** decimals
4723
- ).toString();
4724
- console.log(
4725
- `[TronProvider] Converting ${params.amount} -> ${amountRaw} (decimals: ${decimals})`
4726
- );
4727
- }
4728
- const email = getCredentialManager().getEmail() || void 0;
4729
- const api = this.talkenApi || getTalkenApiClient10();
4730
- const request = txType === "NATIVE" ? {
4731
- kind: "native",
4732
- network: this.network.type,
4733
- toAddress: params.toAddress,
4734
- amountSun: amountRaw,
4735
- pin: pinHash,
4736
- ...email && { email }
4737
- } : {
4738
- kind: "trc20",
4739
- network: this.network.type,
4740
- toAddress: params.toAddress,
4741
- contractAddress: params.contractAddress,
4742
- amount: amountRaw,
4743
- feeLimit: params.feeLimit,
4744
- pin: pinHash,
4745
- ...email && { email }
4746
- };
4747
- const result = await api.tron.transferTrx(request);
4748
- const txHash = result.txHash;
4749
- console.log(
4750
- `[TronProvider] \u2705 ${txType === "NATIVE" ? "TRX" : "TRC-20"} transaction complete via TalkenApiClient:`,
4751
- txHash
4752
- );
4753
- this.emit("transactionBroadcasted", {
4754
- txHash,
4755
- explorerUrl: `${this.network.explorer}/#/transaction/${txHash}`
4756
- });
4757
- return txHash;
4758
- } catch (error) {
4759
- if (error.message?.includes("cancelled") || error.message?.includes("rejected")) {
4760
- console.log("[TronProvider] \u2139\uFE0F User cancelled transaction");
4761
- throw new TronProviderError(
4762
- TronErrorCode.USER_REJECTED,
4763
- "User rejected transaction",
4764
- error
4765
- );
4766
- }
4767
- console.error("[TronProvider] \u274C Transaction failed:", error.message);
4768
- if (error.message?.includes("insufficient")) {
4769
- throw new TronProviderError(
4770
- TronErrorCode.INSUFFICIENT_FUNDS,
4771
- "Insufficient TRX balance",
4772
- error
4773
- );
4774
- }
4775
- this.emit("error", error);
4776
- throw new TronProviderError(
4777
- TronErrorCode.INTERNAL_ERROR,
4778
- error.message || "Failed to send TRON transaction",
4779
- error
4780
- );
4781
- }
4782
- }
4783
- /**
4784
- * Get wallet info
4785
- */
4786
- getWalletInfo() {
4787
- if (!this.wallet)
4788
- return null;
4789
- return {
4790
- address: this.wallet.address,
4791
- publicKey: this.wallet.publicKey,
4792
- network: this.network.type
4793
- };
4794
- }
4795
- };
4796
-
4797
- // src/wallets/walletConnectors/abcWallet/walletGeneration.ts
4798
- import { getTalkenApiClient as getTalkenApiClient11 } from "@talken/talkenkit";
4799
- function mapApiResponseToWallets(genResponse, infoResponse, email) {
4800
- const accounts = infoResponse?.accounts || [];
4801
- const evmAccount = accounts[0] || infoResponse || {};
4802
- const uid = String(genResponse.uid || evmAccount.uid || "");
4803
- const wid = String(genResponse.wid || evmAccount.wid || "");
4804
- const sid = String(evmAccount.sid || evmAccount.ethAddress || genResponse.evmAddress || "");
4805
- const pubkey = String(evmAccount.pubkey || genResponse.pubkey || "");
4806
- const solMaterial = genResponse.solana || {};
4807
- const evmWallet = {
4808
- uid,
4809
- sessionId: sid,
4810
- keyId: wid,
4811
- encryptedShare: String(evmAccount.pvencstr || ""),
4812
- secretStore: String(evmAccount.encryptDevicePassword || ""),
4813
- address: genResponse.evmAddress || sid,
4814
- chainId: getEvmNetwork(),
4815
- sid,
4816
- type: "evm",
4817
- email,
4818
- pubkey
4819
- };
4820
- const solanaWallet = {
4821
- uid,
4822
- sessionId: String(solMaterial.shareId || ""),
4823
- keyId: String(solMaterial.keyId || ""),
4824
- encryptedShare: String(solMaterial.encryptedShare || ""),
4825
- secretStore: String(solMaterial.secretStore || ""),
4826
- shareId: String(solMaterial.shareId || ""),
4827
- publicKey: String(solMaterial.publicKey || ""),
4828
- address: genResponse.solAddress || solMaterial.address || "",
4829
- network: getSolanaNetwork()
4830
- };
4831
- const bitcoinWallet = {
4832
- uid,
4833
- sessionId: sid,
4834
- keyId: wid,
4835
- encryptedShare: String(evmAccount.pvencstr || ""),
4836
- shareId: sid,
4837
- publicKey: pubkey,
4838
- address: genResponse.btcAddress || "",
4839
- addressType: "bech32",
4840
- network: getBitcoinNetwork()
4841
- };
4842
- const tronWallet = {
4843
- uid,
4844
- sessionId: sid,
4845
- keyId: wid,
4846
- encryptedShare: String(evmAccount.pvencstr || ""),
4847
- shareId: sid,
4848
- publicKey: pubkey,
4849
- address: genResponse.trxAddress || "",
4850
- network: getTronNetwork()
4851
- };
4852
- return { evmWallet, solanaWallet, bitcoinWallet, tronWallet };
4853
- }
4854
- async function generateMpcWallets(hashedPin, email) {
4855
- const api = getTalkenApiClient11();
4856
- if (!api) {
4857
- throw new AbcError(
4858
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4859
- "TalkenApiClient not initialized"
4860
- );
4861
- }
4862
- try {
4863
- const genResponse = await api.wallet.generate(hashedPin, email);
4864
- const infoResponse = await api.wallet.getInfo().catch(() => ({}));
4865
- return mapApiResponseToWallets(genResponse, infoResponse, email || "");
4866
- } catch (error) {
4867
- throw new AbcError(
4868
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4869
- `Failed to generate MPC wallets: ${error.message}`,
4870
- { originalError: error }
4871
- );
4872
- }
4873
- }
4874
- async function recoverMpcWallets(hashedPin, email) {
4875
- const api = getTalkenApiClient11();
4876
- if (!api) {
4877
- throw new AbcError(
4878
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4879
- "TalkenApiClient not initialized"
4880
- );
4881
- }
4882
- try {
4883
- const genResponse = await api.wallet.recover(hashedPin, email);
4884
- const infoResponse = await api.wallet.getInfo().catch(() => ({}));
4885
- return mapApiResponseToWallets(genResponse, infoResponse, email || "");
4886
- } catch (error) {
4887
- throw new AbcError(
4888
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4889
- `Failed to recover MPC wallets: ${error.message}`,
4890
- { originalError: error }
4891
- );
4892
- }
4893
- }
4894
- function validateMpcWallets(result) {
4895
- const errors = [];
4896
- if (!result.evmWallet) {
4897
- errors.push("EVM wallet is missing");
4898
- } else {
4899
- if (!result.evmWallet.address || !result.evmWallet.address.startsWith("0x")) {
4900
- errors.push("Invalid EVM wallet address");
4901
- }
4902
- }
4903
- if (!result.solanaWallet) {
4904
- errors.push("Solana wallet is missing");
4905
- } else {
4906
- if (!result.solanaWallet.address) {
4907
- errors.push("Invalid Solana wallet address");
4908
- }
4909
- }
4910
- if (!result.bitcoinWallet) {
4911
- errors.push("Bitcoin wallet is missing");
4912
- } else {
4913
- if (!result.bitcoinWallet.address) {
4914
- errors.push("Invalid Bitcoin wallet address");
4915
- }
4916
- }
4917
- if (!result.tronWallet) {
4918
- errors.push("TRON wallet is missing");
4919
- } else {
4920
- if (!result.tronWallet.address) {
4921
- errors.push("Invalid TRON wallet address");
4922
- } else if (!result.tronWallet.address.startsWith("T")) {
4923
- errors.push("Invalid TRON address format (expected T prefix)");
4924
- }
4925
- }
4926
- return {
4927
- valid: errors.length === 0,
4928
- errors
4929
- };
4930
- }
4931
-
4932
- export {
4933
- AbcStorageKey,
4934
- AbcErrorCode,
4935
- AbcError,
4936
- hashPin,
4937
- validatePin,
4938
- validateEmail,
4939
- getStorageKey,
4940
- saveToStorage,
4941
- loadFromStorage,
4942
- removeFromStorage,
4943
- clearStorage,
4944
- isTokenExpired,
4945
- calculateExpiryTimestamp,
4946
- saveAuthState,
4947
- loadAuthState,
4948
- clearAuthState,
4949
- createAbcError,
4950
- hexToNumber,
4951
- numberToHex,
4952
- NetworkType,
4953
- NETWORK_CONFIGS,
4954
- NETWORK_BY_PARAM,
4955
- getNetworkByChainId,
4956
- getNetworkByParam,
4957
- chainIdToNetwork,
4958
- getNetworkName,
4959
- networkNameToChainKey,
4960
- networkToChainId,
4961
- getExplorerTxUrl,
4962
- getExplorerAddressUrl,
4963
- isEvmNetwork,
4964
- isTestnet,
4965
- getSupportedChainIds,
4966
- getSupportedNetworks,
4967
- AbcEvmProvider,
4968
- createAbcEvmProvider,
4969
- createAbcProvider,
4970
- TalkenApiClient,
4971
- createTalkenApiClient,
4972
- setTalkenApiClient,
4973
- getTalkenApiClient2 as getTalkenApiClient,
4974
- SolanaNetwork,
4975
- BitcoinNetwork,
4976
- TronNetwork,
4977
- getEvmNetwork,
4978
- getSolanaNetwork,
4979
- getBitcoinNetwork,
4980
- getTronNetwork,
4981
- resolveTalkenApiUrl,
4982
- abcConnector,
4983
- abcWallet,
4984
- WalletscanApi,
4985
- GasApi,
4986
- SessionExpiredError,
4987
- dispatchSessionExpired,
4988
- handleUnauthorizedResponse,
4989
- fetchWithSessionCheck,
4990
- refreshAccessToken,
4991
- BitcoinProviderError,
4992
- BITCOIN_NETWORKS,
4993
- AbcBitcoinProvider,
4994
- AbcBitcoinConnector,
4995
- createAbcBitcoinConnector,
4996
- SolanaProviderError,
4997
- AbcSolanaProvider,
4998
- TronProviderError,
4999
- TRON_NETWORKS,
5000
- AbcTronProvider,
5001
- generateMpcWallets,
5002
- recoverMpcWallets,
5003
- validateMpcWallets
5004
- };