@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,5058 +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
- * Check if an error is a "Missing required wallet fields" 502 from the server.
1166
- * When the server's in-memory signing credential cache is cold, it needs
1167
- * a wallet.generate() call (idempotent create/recover) to repopulate.
1168
- */
1169
- isSigningCredentialError(error) {
1170
- return error instanceof TalkenApiError && error.statusCode === 502 && error.message.includes("Missing required wallet fields");
1171
- }
1172
- /**
1173
- * Refresh server-side signing credentials by calling wallet.generate().
1174
- * This is idempotent — it recovers existing wallets, not creates new ones.
1175
- */
1176
- async refreshSigningCredentials() {
1177
- const pinHash = getCredentialManager().getPinHash();
1178
- const email = this.getRecoveryEmail();
1179
- if (!pinHash || !email) {
1180
- console.warn(
1181
- "[AbcProvider] Cannot refresh signing credentials \u2014 PIN hash or email missing"
1182
- );
1183
- return;
1184
- }
1185
- const api = this.getTalkenApiClientOrThrow();
1186
- console.log("[AbcProvider] Refreshing server-side signing credentials...");
1187
- await api.wallet.generate(pinHash, email);
1188
- console.log("[AbcProvider] Signing credentials refreshed");
1189
- }
1190
- /**
1191
- * Wrap a signing operation with auto-retry on "Missing required wallet fields" error.
1192
- * On first failure, refreshes the server's signing credential cache and retries once.
1193
- */
1194
- async withSigningCredentialRetry(operation) {
1195
- try {
1196
- return await operation();
1197
- } catch (error) {
1198
- if (this.isSigningCredentialError(error)) {
1199
- console.log(
1200
- "[AbcProvider] Signing credentials missing on server \u2014 attempting refresh and retry"
1201
- );
1202
- await this.refreshSigningCredentials();
1203
- return await operation();
1204
- }
1205
- throw error;
1206
- }
1207
- }
1208
- /**
1209
- * Call request interceptor if configured
1210
- * Called by specific signing/transaction methods that need user confirmation
1211
- * @returns Resolved transaction with user modifications if changed in confirmation modal
1212
- */
1213
- async callInterceptor(method, params) {
1214
- if (!this.requestInterceptor) {
1215
- return void 0;
1216
- }
1217
- const request = {
1218
- method,
1219
- params,
1220
- chainId: this.chainId,
1221
- address: this.wallet?.address || ""
1222
- };
1223
- return this.requestInterceptor(request);
1224
- }
1225
- /**
1226
- * EIP-1193 request method
1227
- */
1228
- async request(args) {
1229
- const { method, params } = args;
1230
- switch (method) {
1231
- case "eth_requestAccounts":
1232
- return this.eth_requestAccounts();
1233
- case "eth_accounts":
1234
- return this.eth_accounts();
1235
- case "eth_chainId":
1236
- return this.eth_chainId();
1237
- case "eth_sendTransaction":
1238
- case "wallet_sendTransaction":
1239
- return this.eth_sendTransaction(params);
1240
- case "eth_signTransaction":
1241
- return this.eth_signTransaction(params);
1242
- case "personal_sign":
1243
- return this.personal_sign(params);
1244
- case "eth_sign":
1245
- return this.eth_sign(params);
1246
- case "eth_signTypedData":
1247
- case "eth_signTypedData_v3":
1248
- case "eth_signTypedData_v4":
1249
- return this.eth_signTypedData(params);
1250
- case "wallet_getCapabilities":
1251
- return this.wallet_getCapabilities();
1252
- case "eth_signAuthorization":
1253
- return this.eth_signAuthorization(params);
1254
- case "wallet_switchEthereumChain":
1255
- return this.wallet_switchEthereumChain(params);
1256
- case "wallet_addEthereumChain":
1257
- return this.wallet_addEthereumChain(params);
1258
- case "eth_estimateGas":
1259
- return this.eth_estimateGas(params);
1260
- case "eth_getTransactionCount":
1261
- return this.eth_getTransactionCount(
1262
- Array.isArray(params) ? params : []
1263
- );
1264
- case "eth_blockNumber":
1265
- case "eth_call":
1266
- case "eth_gasPrice":
1267
- case "eth_getBalance":
1268
- case "eth_getBlockByHash":
1269
- case "eth_getBlockByNumber":
1270
- case "eth_getCode":
1271
- case "eth_getStorageAt":
1272
- case "eth_getTransactionByHash":
1273
- case "eth_getTransactionReceipt":
1274
- throw new ProviderRpcError(
1275
- ErrorCode.UNSUPPORTED_METHOD,
1276
- `Method ${method} should be handled by RPC provider`
1277
- );
1278
- default:
1279
- throw new ProviderRpcError(
1280
- ErrorCode.UNSUPPORTED_METHOD,
1281
- `Method ${method} not supported`
1282
- );
1283
- }
1284
- }
1285
- /**
1286
- * Request accounts (EIP-1193)
1287
- */
1288
- async eth_requestAccounts() {
1289
- if (!this.wallet) {
1290
- throw new ProviderRpcError(
1291
- ErrorCode.UNAUTHORIZED,
1292
- "Wallet not connected"
1293
- );
1294
- }
1295
- return [this.wallet.address];
1296
- }
1297
- /**
1298
- * Get accounts
1299
- */
1300
- async eth_accounts() {
1301
- if (!this.wallet) {
1302
- return [];
1303
- }
1304
- return [this.wallet.address];
1305
- }
1306
- /**
1307
- * Get chain ID
1308
- */
1309
- async eth_chainId() {
1310
- return numberToHex(this.chainId);
1311
- }
1312
- /**
1313
- * Send transaction
1314
- */
1315
- async eth_sendTransaction(params) {
1316
- if (!this.wallet) {
1317
- throw new ProviderRpcError(
1318
- ErrorCode.UNAUTHORIZED,
1319
- "Wallet not connected"
1320
- );
1321
- }
1322
- if (!Array.isArray(params) || params.length === 0) {
1323
- throw new ProviderRpcError(
1324
- ErrorCode.INVALID_PARAMS,
1325
- "Invalid transaction params"
1326
- );
1327
- }
1328
- const resolved = await this.callInterceptor("eth_sendTransaction", params);
1329
- const tx = params[0];
1330
- console.log("[AbcProvider] eth_sendTransaction incoming gas params:", {
1331
- gas: tx.gas ?? tx.gasLimit,
1332
- gasPrice: tx.gasPrice,
1333
- maxFeePerGas: tx.maxFeePerGas,
1334
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas
1335
- });
1336
- if (resolved) {
1337
- if (resolved.data) {
1338
- tx.data = resolved.data;
1339
- }
1340
- if (resolved.gasFee?.maxFeePerGas) {
1341
- try {
1342
- const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
1343
- tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
1344
- } catch (error) {
1345
- console.error(
1346
- "[AbcProvider] \u274C Failed to parse maxFeePerGas:",
1347
- error
1348
- );
1349
- }
1350
- }
1351
- if (resolved.gasFee?.maxPriorityFeePerGas) {
1352
- try {
1353
- const priorityFeeWei = parseGwei(
1354
- resolved.gasFee.maxPriorityFeePerGas
1355
- );
1356
- tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
1357
- } catch (error) {
1358
- console.error(
1359
- "[AbcProvider] \u274C Failed to parse maxPriorityFeePerGas:",
1360
- error
1361
- );
1362
- }
1363
- }
1364
- }
1365
- console.log("[AbcProvider] eth_sendTransaction final gas params:", {
1366
- gas: tx.gas ?? tx.gasLimit,
1367
- gasPrice: tx.gasPrice,
1368
- maxFeePerGas: tx.maxFeePerGas,
1369
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas
1370
- });
1371
- const isContractDeployment = !tx.to || tx.to === "0x" || tx.to === "0x0" || tx.to === "0x0000000000000000000000000000000000000000";
1372
- if (isContractDeployment) {
1373
- tx.to = "0x";
1374
- } else if (!tx.to) {
1375
- throw new ProviderRpcError(
1376
- ErrorCode.INVALID_PARAMS,
1377
- 'Transaction must have "to" field'
1378
- );
1379
- }
1380
- const pinHash = getCredentialManager().getPinHash();
1381
- if (!pinHash) {
1382
- throw new ProviderRpcError(
1383
- ErrorCode.INTERNAL_ERROR,
1384
- "PIN hash not found. Please login again."
1385
- );
1386
- }
1387
- const hexValue = tx.value || "0x0";
1388
- const amountWei = BigInt(hexValue).toString();
1389
- const email = this.getRecoveryEmail();
1390
- const api = this.getTalkenApiClientOrThrow();
1391
- const result = await this.withSigningCredentialRetry(
1392
- () => api.evm.sendTransaction({
1393
- chainKey: getChainKey(this.chainId),
1394
- to: tx.to,
1395
- amountWei,
1396
- pin: pinHash,
1397
- data: tx.data || "0x",
1398
- gasLimit: tx.gas || tx.gasLimit,
1399
- maxFeePerGas: tx.maxFeePerGas,
1400
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1401
- ...email && { email }
1402
- })
1403
- );
1404
- return result.txHash;
1405
- }
1406
- /**
1407
- * Sign transaction (without sending)
1408
- */
1409
- async eth_signTransaction(params) {
1410
- if (!this.wallet) {
1411
- throw new ProviderRpcError(
1412
- ErrorCode.UNAUTHORIZED,
1413
- "Wallet not connected"
1414
- );
1415
- }
1416
- if (!Array.isArray(params) || params.length === 0) {
1417
- throw new ProviderRpcError(
1418
- ErrorCode.INVALID_PARAMS,
1419
- "Invalid transaction params"
1420
- );
1421
- }
1422
- const resolved = await this.callInterceptor("eth_signTransaction", params);
1423
- const tx = params[0];
1424
- if (resolved) {
1425
- if (resolved.data) {
1426
- tx.data = resolved.data;
1427
- }
1428
- if (resolved.gasFee?.maxFeePerGas) {
1429
- try {
1430
- const maxFeeWei = parseGwei(resolved.gasFee.maxFeePerGas);
1431
- tx.maxFeePerGas = `0x${maxFeeWei.toString(16)}`;
1432
- } catch (error) {
1433
- console.error(
1434
- "[AbcProvider] \u274C Failed to parse maxFeePerGas:",
1435
- error
1436
- );
1437
- }
1438
- }
1439
- if (resolved.gasFee?.maxPriorityFeePerGas) {
1440
- try {
1441
- const priorityFeeWei = parseGwei(
1442
- resolved.gasFee.maxPriorityFeePerGas
1443
- );
1444
- tx.maxPriorityFeePerGas = `0x${priorityFeeWei.toString(16)}`;
1445
- } catch (error) {
1446
- console.error(
1447
- "[AbcProvider] \u274C Failed to parse maxPriorityFeePerGas:",
1448
- error
1449
- );
1450
- }
1451
- }
1452
- }
1453
- const api = this.getTalkenApiClientOrThrow();
1454
- const pinHash = getCredentialManager().getPinHash() || void 0;
1455
- const email = this.getRecoveryEmail();
1456
- const result = await this.withSigningCredentialRetry(
1457
- () => api.evm.signTransaction({
1458
- network: getNetworkName(this.chainId),
1459
- to: tx.to,
1460
- value: tx.value || "0x0",
1461
- data: tx.data || "0x",
1462
- gasLimit: tx.gas || tx.gasLimit,
1463
- maxFeePerGas: tx.maxFeePerGas,
1464
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
1465
- nonce: tx.nonce ? String(Number.parseInt(tx.nonce, 16)) : void 0,
1466
- ...pinHash && { pin: pinHash },
1467
- ...email && { email }
1468
- })
1469
- );
1470
- return result.signature;
1471
- }
1472
- /**
1473
- * Personal sign (EIP-191)
1474
- */
1475
- async personal_sign(params) {
1476
- if (!this.wallet) {
1477
- console.error("[AbcProvider] \u274C Wallet not connected");
1478
- throw new ProviderRpcError(
1479
- ErrorCode.UNAUTHORIZED,
1480
- "Wallet not connected"
1481
- );
1482
- }
1483
- if (!Array.isArray(params) || params.length < 2) {
1484
- console.error("[AbcProvider] \u274C Invalid params:", params);
1485
- throw new ProviderRpcError(
1486
- ErrorCode.INVALID_PARAMS,
1487
- "Invalid personal_sign params"
1488
- );
1489
- }
1490
- await this.callInterceptor("personal_sign", params);
1491
- const [message, address] = params;
1492
- if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1493
- console.error("[AbcProvider] \u274C Address mismatch");
1494
- throw new ProviderRpcError(
1495
- ErrorCode.INVALID_PARAMS,
1496
- "Address does not match connected wallet"
1497
- );
1498
- }
1499
- const api = this.getTalkenApiClientOrThrow();
1500
- const network = getNetworkName(this.chainId);
1501
- const pinHash = getCredentialManager().getPinHash() || void 0;
1502
- const email = this.getRecoveryEmail();
1503
- const result = await this.withSigningCredentialRetry(
1504
- () => api.evm.signPersonal({
1505
- network,
1506
- message,
1507
- address,
1508
- pin: pinHash,
1509
- ...email && { email }
1510
- })
1511
- );
1512
- return result.signature;
1513
- }
1514
- /**
1515
- * Eth sign
1516
- */
1517
- async eth_sign(params) {
1518
- if (!Array.isArray(params) || params.length < 2) {
1519
- throw new ProviderRpcError(
1520
- ErrorCode.INVALID_PARAMS,
1521
- "Invalid eth_sign params"
1522
- );
1523
- }
1524
- const [address, message] = params;
1525
- return this.personal_sign([message, address]);
1526
- }
1527
- /**
1528
- * Sign typed data (EIP-712)
1529
- */
1530
- async eth_signTypedData(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 signTypedData params"
1541
- );
1542
- }
1543
- await this.callInterceptor("eth_signTypedData_v4", params);
1544
- const [address, typedData] = params;
1545
- if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1546
- throw new ProviderRpcError(
1547
- ErrorCode.INVALID_PARAMS,
1548
- "Address does not match connected wallet"
1549
- );
1550
- }
1551
- const api = this.getTalkenApiClientOrThrow();
1552
- const network = getNetworkName(this.chainId);
1553
- const pinHash = getCredentialManager().getPinHash() || void 0;
1554
- const email = this.getRecoveryEmail();
1555
- const result = await this.withSigningCredentialRetry(
1556
- () => api.evm.signTypedData({
1557
- network,
1558
- typedData: typeof typedData === "string" ? typedData : JSON.stringify(typedData),
1559
- pin: pinHash,
1560
- ...email && { email }
1561
- })
1562
- );
1563
- return result.signature;
1564
- }
1565
- /**
1566
- * Return normalized wallet capabilities for ABC embedded wallets.
1567
- * ABC supports EIP-7702 authorization signing via talken-api.
1568
- */
1569
- async wallet_getCapabilities() {
1570
- return {
1571
- supportsTypedDataV4: true,
1572
- supports7702Authorization: true,
1573
- supports5792Batch: false,
1574
- supportsPaymasterService: false,
1575
- supportsPermit2RelayHints: true,
1576
- walletType: "abc-embedded"
1577
- };
1578
- }
1579
- /**
1580
- * Sign EIP-7702 authorization via Talken API.
1581
- */
1582
- async eth_signAuthorization(params) {
1583
- if (!this.wallet) {
1584
- throw new ProviderRpcError(
1585
- ErrorCode.UNAUTHORIZED,
1586
- "Wallet not connected"
1587
- );
1588
- }
1589
- if (!Array.isArray(params) || params.length < 2) {
1590
- throw new ProviderRpcError(
1591
- ErrorCode.INVALID_PARAMS,
1592
- "Invalid signAuthorization params"
1593
- );
1594
- }
1595
- const [address, authorization] = params;
1596
- if (address.toLowerCase() !== this.wallet.address.toLowerCase()) {
1597
- throw new ProviderRpcError(
1598
- ErrorCode.INVALID_PARAMS,
1599
- "Address does not match connected wallet"
1600
- );
1601
- }
1602
- if (!authorization?.address || authorization.chainId == null || authorization.nonce == null) {
1603
- throw new ProviderRpcError(
1604
- ErrorCode.INVALID_PARAMS,
1605
- "Authorization payload is incomplete"
1606
- );
1607
- }
1608
- await this.callInterceptor("eth_signAuthorization", params);
1609
- const api = this.getTalkenApiClientOrThrow();
1610
- const network = getNetworkName(this.chainId);
1611
- const pinHash = getCredentialManager().getPinHash() || void 0;
1612
- const email = this.getRecoveryEmail();
1613
- const chainIdValue = typeof authorization.chainId === "string" ? Number(BigInt(authorization.chainId)) : Number(authorization.chainId);
1614
- const nonceValue = typeof authorization.nonce === "string" ? BigInt(authorization.nonce).toString() : String(authorization.nonce);
1615
- const result = await this.withSigningCredentialRetry(
1616
- () => api.evm.signAuthorization({
1617
- network,
1618
- authorization: {
1619
- chainId: chainIdValue,
1620
- address: authorization.address,
1621
- nonce: nonceValue
1622
- },
1623
- pin: pinHash,
1624
- ...email && { email }
1625
- })
1626
- );
1627
- return result.authorization;
1628
- }
1629
- /**
1630
- * Switch Ethereum chain
1631
- */
1632
- async wallet_switchEthereumChain(params) {
1633
- if (!Array.isArray(params) || params.length === 0) {
1634
- throw new ProviderRpcError(
1635
- ErrorCode.INVALID_PARAMS,
1636
- "Invalid switchEthereumChain params"
1637
- );
1638
- }
1639
- const { chainId } = params[0];
1640
- const newChainId = hexToNumber(chainId);
1641
- if (this.chainId === newChainId) {
1642
- return null;
1643
- }
1644
- const _previousChainId = this.chainId;
1645
- this.chainId = newChainId;
1646
- if (this.wallet) {
1647
- this.wallet.chainId = newChainId;
1648
- }
1649
- this.emit("chainChanged", numberToHex(newChainId));
1650
- return null;
1651
- }
1652
- /**
1653
- * Add Ethereum chain
1654
- */
1655
- async wallet_addEthereumChain(params) {
1656
- return this.wallet_switchEthereumChain(params);
1657
- }
1658
- /**
1659
- * Get transaction count (nonce) using ABC WaaS API
1660
- */
1661
- async eth_getTransactionCount(params) {
1662
- const address = params[0]?.toLowerCase();
1663
- if (!address) {
1664
- throw new ProviderRpcError(
1665
- ErrorCode.INVALID_PARAMS,
1666
- "Missing address parameter"
1667
- );
1668
- }
1669
- const currentChainId = this.chainId;
1670
- try {
1671
- const api = this.getTalkenApiClientOrThrow();
1672
- const response = await api.evm.getNonce(
1673
- getNetworkName(currentChainId),
1674
- address
1675
- );
1676
- const nonce = response.result !== void 0 ? typeof response.result === "number" ? `0x${response.result.toString(16)}` : response.result : void 0;
1677
- if (!nonce) {
1678
- throw new Error("No result in nonce response");
1679
- }
1680
- return nonce;
1681
- } catch (error) {
1682
- console.error(
1683
- "[AbcEvmProvider] \u274C Failed to get transaction count from ABC WaaS:",
1684
- error
1685
- );
1686
- throw new ProviderRpcError(
1687
- ErrorCode.INTERNAL_ERROR,
1688
- `Failed to get transaction count: ${error instanceof Error ? error.message : String(error)}`
1689
- );
1690
- }
1691
- }
1692
- /**
1693
- * Estimate gas for transaction
1694
- * Uses ABC WaaS gas estimation API with fallback
1695
- */
1696
- async eth_estimateGas(params) {
1697
- if (!Array.isArray(params) || params.length === 0) {
1698
- throw new ProviderRpcError(
1699
- ErrorCode.INVALID_PARAMS,
1700
- "Invalid estimateGas params"
1701
- );
1702
- }
1703
- const tx = params[0];
1704
- if (!tx.to) {
1705
- throw new ProviderRpcError(
1706
- ErrorCode.INVALID_PARAMS,
1707
- 'Transaction must have "to" field'
1708
- );
1709
- }
1710
- try {
1711
- const response = await this.getTalkenApiClientOrThrow().evm.estimateGas({
1712
- network: getNetworkName(this.chainId),
1713
- from: tx.from || this.wallet?.address || "",
1714
- to: tx.to,
1715
- value: tx.value,
1716
- data: tx.data
1717
- });
1718
- if (!response.result) {
1719
- throw new Error("No result in gas estimate response");
1720
- }
1721
- return response.result;
1722
- } catch (error) {
1723
- console.warn(
1724
- "[AbcEvmProvider] Gas estimation failed, using fallback:",
1725
- error
1726
- );
1727
- if (tx.data && tx.data !== "0x") {
1728
- return "0x493e0";
1729
- }
1730
- return "0x5208";
1731
- }
1732
- }
1733
- /**
1734
- * Check if connected
1735
- */
1736
- isConnected() {
1737
- return this.connected;
1738
- }
1739
- /**
1740
- * Get current wallet
1741
- */
1742
- getWallet() {
1743
- return this.wallet;
1744
- }
1745
- /**
1746
- * Get current chain ID
1747
- */
1748
- getChainId() {
1749
- return this.chainId;
1750
- }
1751
- };
1752
- function createAbcEvmProvider(talkenApi) {
1753
- return new AbcEvmProvider(talkenApi);
1754
- }
1755
- var createAbcProvider = createAbcEvmProvider;
1756
-
1757
- // src/wallets/walletConnectors/abcWallet/api/TalkenApiClient.ts
1758
- var STORAGE_KEY_PREFIX = "talken_api_";
1759
- function loadToken(key) {
1760
- if (typeof window === "undefined")
1761
- return null;
1762
- try {
1763
- return localStorage.getItem(`${STORAGE_KEY_PREFIX}${key}`);
1764
- } catch {
1765
- return null;
1766
- }
1767
- }
1768
- function saveToken(key, value) {
1769
- if (typeof window === "undefined")
1770
- return;
1771
- try {
1772
- localStorage.setItem(`${STORAGE_KEY_PREFIX}${key}`, value);
1773
- } catch {
1774
- }
1775
- }
1776
- function removeToken(key) {
1777
- if (typeof window === "undefined")
1778
- return;
1779
- try {
1780
- localStorage.removeItem(`${STORAGE_KEY_PREFIX}${key}`);
1781
- } catch {
1782
- }
1783
- }
1784
- function normalizeAuthResponse(raw) {
1785
- const d = raw.data || raw;
1786
- const loginData = d.login || d;
1787
- return {
1788
- accessToken: loginData.access_token || loginData.accessToken || "",
1789
- refreshToken: loginData.refresh_token || loginData.refreshToken || "",
1790
- expiresIn: loginData.expires_in || loginData.expire_in || loginData.expiresIn || 3600,
1791
- uid: d.uid || loginData.uid || "",
1792
- email: d.email || loginData.email || "",
1793
- isNewUser: d.isNewUser
1794
- };
1795
- }
1796
- var TalkenAuthModule = class {
1797
- constructor(client) {
1798
- this.client = client;
1799
- }
1800
- /**
1801
- * Login with email and password
1802
- * POST /wallet/auth { action: 'login', method: 'password', email, password }
1803
- */
1804
- async loginWithPassword(email, password) {
1805
- const raw = await this.client.post(
1806
- TALKEN_API_ENDPOINTS.AUTH,
1807
- { action: "login", method: "password", email, password },
1808
- { skipAuth: true }
1809
- );
1810
- const res = normalizeAuthResponse(raw);
1811
- this.client.handleAuthResponse(res);
1812
- return res;
1813
- }
1814
- /**
1815
- * Send OTP code to email
1816
- * POST /wallet/auth { action: 'otp.send', email }
1817
- */
1818
- async sendOtp(email) {
1819
- const raw = await this.client.post(
1820
- TALKEN_API_ENDPOINTS.AUTH,
1821
- { action: "otp.send", email },
1822
- { skipAuth: true }
1823
- );
1824
- return raw.data || raw;
1825
- }
1826
- /**
1827
- * Verify OTP code
1828
- * POST /wallet/auth { action: 'otp.verify', email, otpCode }
1829
- */
1830
- async verifyOtp(email, otpCode) {
1831
- const raw = await this.client.post(
1832
- TALKEN_API_ENDPOINTS.AUTH,
1833
- { action: "otp.verify", email, otpCode },
1834
- { skipAuth: true }
1835
- );
1836
- return raw.data || raw;
1837
- }
1838
- /**
1839
- * Check if email is already registered
1840
- * POST /wallet/auth { action: 'email.check', email }
1841
- * Returns code 606 if email exists
1842
- */
1843
- async checkEmail(email) {
1844
- const raw = await this.client.post(
1845
- TALKEN_API_ENDPOINTS.AUTH,
1846
- { action: "email.check", email },
1847
- { skipAuth: true }
1848
- );
1849
- const d = raw.data || raw;
1850
- return {
1851
- code: d.code,
1852
- message: d.message,
1853
- exists: d.code === 606
1854
- };
1855
- }
1856
- /**
1857
- * Register a new user (creates account + auto-login)
1858
- * POST /wallet/auth { action: 'register', email, otpCode, password, name? }
1859
- */
1860
- async register(params) {
1861
- const raw = await this.client.post(
1862
- TALKEN_API_ENDPOINTS.AUTH,
1863
- { action: "register", ...params },
1864
- { skipAuth: true }
1865
- );
1866
- const res = normalizeAuthResponse(raw);
1867
- this.client.handleAuthResponse(res);
1868
- return res;
1869
- }
1870
- /**
1871
- * Reset password for existing user
1872
- * POST /wallet/auth { action: 'password.reset', email, newPassword, emailCode }
1873
- */
1874
- async resetPassword(email, newPassword, emailCode) {
1875
- const raw = await this.client.post(
1876
- TALKEN_API_ENDPOINTS.AUTH,
1877
- { action: "password.reset", email, newPassword, emailCode },
1878
- { skipAuth: true }
1879
- );
1880
- return raw.data || raw;
1881
- }
1882
- /**
1883
- * Login with social provider (Google, Apple, Kakao, etc.)
1884
- * POST /wallet/auth { action: 'login', method: 'sns', token, service, audience? }
1885
- */
1886
- async loginWithSns(params) {
1887
- const raw = await this.client.post(
1888
- TALKEN_API_ENDPOINTS.AUTH,
1889
- {
1890
- action: "login",
1891
- method: "sns",
1892
- token: params.token,
1893
- service: params.service,
1894
- ...params.audience && { audience: params.audience }
1895
- },
1896
- { skipAuth: true }
1897
- );
1898
- const res = normalizeAuthResponse(raw);
1899
- this.client.handleAuthResponse(res);
1900
- return res;
1901
- }
1902
- /**
1903
- * Refresh access token
1904
- * POST /wallet/auth { action: 'token.refresh', refreshToken }
1905
- */
1906
- async refresh() {
1907
- const refreshToken = this.client.getRefreshToken();
1908
- if (!refreshToken) {
1909
- throw new TalkenApiError(
1910
- "TOKEN_EXPIRED",
1911
- "No refresh token available",
1912
- 401
1913
- );
1914
- }
1915
- const raw = await this.client.post(
1916
- TALKEN_API_ENDPOINTS.AUTH,
1917
- { action: "token.refresh", refreshToken },
1918
- { skipAuth: true }
1919
- );
1920
- const res = normalizeAuthResponse(raw);
1921
- this.client.handleAuthResponse(res);
1922
- return res;
1923
- }
1924
- /**
1925
- * Logout (clear local session only — no server endpoint)
1926
- */
1927
- logout() {
1928
- this.client.clearSession();
1929
- }
1930
- };
1931
- var TalkenWalletModule = class {
1932
- constructor(client) {
1933
- this.client = client;
1934
- }
1935
- /**
1936
- * Generate/recover MPC wallets (create = idempotent generate/recover)
1937
- * POST /wallet/mpc { action: 'create', email?, pin }
1938
- *
1939
- * @param pin - SHA-256 hashed PIN
1940
- * @param email - User email (optional; server resolves from bearer token if omitted)
1941
- */
1942
- async generate(pin, email) {
1943
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_MPC, {
1944
- action: "create",
1945
- ...email && { email },
1946
- pin
1947
- });
1948
- }
1949
- /**
1950
- * Recover is the same as generate (create is idempotent)
1951
- */
1952
- async recover(pin, email) {
1953
- return this.generate(pin, email);
1954
- }
1955
- /**
1956
- * Get wallet info
1957
- * POST /wallet/mpc { action: 'info' }
1958
- */
1959
- async getInfo() {
1960
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_MPC, {
1961
- action: "info"
1962
- });
1963
- }
1964
- /**
1965
- * Get addresses for all chains
1966
- * POST /wallet/address { chain: 'all' }
1967
- */
1968
- async getAddresses() {
1969
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_ADDRESS, {
1970
- chain: "all"
1971
- });
1972
- }
1973
- /**
1974
- * Get addresses for a specific chain
1975
- * POST /wallet/address { chain, publicKey?, pin? }
1976
- */
1977
- async getAddressForChain(chain, publicKey, pin) {
1978
- return this.client.post(TALKEN_API_ENDPOINTS.WALLET_ADDRESS, {
1979
- chain,
1980
- ...publicKey && { publicKey },
1981
- ...pin && { pin }
1982
- });
1983
- }
1984
- };
1985
- var TalkenEvmModule = class {
1986
- constructor(client) {
1987
- this.client = client;
1988
- }
1989
- /**
1990
- * Sign EVM transaction (sign only, no broadcast)
1991
- * POST /wallet/sign/evm { network, to, from?, value?, data?, ... }
1992
- * Server handles SecureChannel internally
1993
- */
1994
- async signTransaction(params) {
1995
- return this.client.post(
1996
- TALKEN_API_ENDPOINTS.SIGN_EVM,
1997
- params
1998
- );
1999
- }
2000
- /**
2001
- * Sign EIP-712 typed data
2002
- * POST /wallet/sign/evm/typed { network, typedData }
2003
- */
2004
- async signTypedData(params) {
2005
- return this.client.post(
2006
- TALKEN_API_ENDPOINTS.SIGN_TYPED,
2007
- params
2008
- );
2009
- }
2010
- /**
2011
- * Sign personal message (EIP-191)
2012
- * POST /wallet/sign/evm/personal { network, message, address? }
2013
- */
2014
- async signPersonal(params) {
2015
- const res = await this.client.post(
2016
- TALKEN_API_ENDPOINTS.SIGN_PERSONAL,
2017
- params
2018
- );
2019
- return {
2020
- signature: res?.signature ?? res?.serializedTx ?? "",
2021
- txHash: res?.txHash ?? res?.rawTx
2022
- };
2023
- }
2024
- /**
2025
- * Sign EIP-7702 authorization payload
2026
- * POST /wallet/sign/authorization { network, authorization, pin? }
2027
- */
2028
- async signAuthorization(params) {
2029
- return this.client.post(
2030
- TALKEN_API_ENDPOINTS.SIGN_AUTHORIZATION,
2031
- params
2032
- );
2033
- }
2034
- /**
2035
- * Broadcast signed transaction
2036
- * POST /wallet/tx/raw { network, signedSerializeTx }
2037
- */
2038
- async sendRawTransaction(params) {
2039
- return this.client.post(
2040
- TALKEN_API_ENDPOINTS.TX_RAW,
2041
- params
2042
- );
2043
- }
2044
- /**
2045
- * Integrated EVM transfer (sign + broadcast)
2046
- * POST /wallet/tx/evm { chainKey, to, amountWei, pin, ... }
2047
- */
2048
- async sendTransaction(params) {
2049
- return this.client.post(
2050
- TALKEN_API_ENDPOINTS.TX_EVM,
2051
- params
2052
- );
2053
- }
2054
- /**
2055
- * Get gas price
2056
- * GET /wallet/gas/price?network=
2057
- */
2058
- async getGasPrice(network) {
2059
- return this.client.get(
2060
- `${TALKEN_API_ENDPOINTS.GAS_PRICE}?network=${encodeURIComponent(network)}`
2061
- );
2062
- }
2063
- /**
2064
- * Get suggested gas fees (EIP-1559)
2065
- * GET /wallet/gas/suggested?network=
2066
- */
2067
- async getGasSuggested(network) {
2068
- return this.client.get(
2069
- `${TALKEN_API_ENDPOINTS.GAS_SUGGESTED}?network=${encodeURIComponent(network)}`
2070
- );
2071
- }
2072
- /**
2073
- * Estimate gas
2074
- * POST /wallet/gas/estimate { network, from, to, value?, data? }
2075
- */
2076
- async estimateGas(params) {
2077
- return this.client.post(
2078
- TALKEN_API_ENDPOINTS.GAS_ESTIMATE,
2079
- params
2080
- );
2081
- }
2082
- /**
2083
- * Get nonce for address
2084
- * GET /wallet/nonce?network=&address=
2085
- */
2086
- async getNonce(network, address) {
2087
- const qs = new URLSearchParams({ network, address }).toString();
2088
- return this.client.get(`${TALKEN_API_ENDPOINTS.NONCE}?${qs}`);
2089
- }
2090
- };
2091
- var TalkenSolanaModule = class {
2092
- constructor(client) {
2093
- this.client = client;
2094
- }
2095
- /**
2096
- * Transfer SOL or SPL token (integrated sign + broadcast)
2097
- * POST /wallet/tx/sol
2098
- * - kind='native': { toAddress, amountLamports, pin }
2099
- * - kind='spl': { toAddress, mintAddress, amount, decimals, network, pin }
2100
- */
2101
- async transfer(params) {
2102
- return this.client.post(
2103
- TALKEN_API_ENDPOINTS.TX_SOL,
2104
- params
2105
- );
2106
- }
2107
- /**
2108
- * Sign Solana transaction or message (sign-only, no broadcast)
2109
- * POST /wallet/sign/sol
2110
- *
2111
- * Two modes:
2112
- * - PIN mode: { message, pin } — server resolves signing material
2113
- * - Share mode: { message, keyId, encryptedShare } — no PIN required (for signMessage)
2114
- *
2115
- * @returns Ed25519 signature (hex) and optionally public key
2116
- */
2117
- async sign(params) {
2118
- return this.client.post(
2119
- TALKEN_API_ENDPOINTS.SIGN_SVM,
2120
- params
2121
- );
2122
- }
2123
- };
2124
- var TalkenBitcoinModule = class {
2125
- constructor(client) {
2126
- this.client = client;
2127
- }
2128
- /**
2129
- * BTC fee rate lookup
2130
- * GET /wallet/btc?mode=fee&network=&blocks=
2131
- */
2132
- async getFeeRate(network, blocks) {
2133
- const qs = new URLSearchParams({
2134
- mode: "fee",
2135
- network,
2136
- ...typeof blocks === "number" ? { blocks: String(blocks) } : {}
2137
- }).toString();
2138
- return this.client.get(
2139
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2140
- );
2141
- }
2142
- /**
2143
- * BTC tx status by hash
2144
- * GET /wallet/btc?mode=txHash&network=&txHash=
2145
- */
2146
- async getTxByHash(txHash, network) {
2147
- const qs = new URLSearchParams({
2148
- mode: "txHash",
2149
- network,
2150
- txHash
2151
- }).toString();
2152
- return this.client.get(
2153
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2154
- );
2155
- }
2156
- /**
2157
- * BTC UTXO list
2158
- * GET /wallet/btc?mode=utxos&network=&address=
2159
- */
2160
- async getUtxos(network, address) {
2161
- const qs = new URLSearchParams({
2162
- mode: "utxos",
2163
- network,
2164
- ...address ? { address } : {}
2165
- }).toString();
2166
- return this.client.get(
2167
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2168
- );
2169
- }
2170
- /**
2171
- * BTC address validation
2172
- * GET /wallet/btc?mode=validateAddress&network=&address=
2173
- */
2174
- async validateAddress(address, network) {
2175
- const qs = new URLSearchParams({
2176
- mode: "validateAddress",
2177
- network,
2178
- address
2179
- }).toString();
2180
- return this.client.get(
2181
- `${TALKEN_API_ENDPOINTS.WALLET_BTC}?${qs}`
2182
- );
2183
- }
2184
- /**
2185
- * Send BTC (integrated sign + broadcast, action=transfer)
2186
- * POST /wallet/tx/btc
2187
- */
2188
- async sendTransaction(params) {
2189
- const payload = { action: "transfer", ...params };
2190
- return this.client.post(
2191
- TALKEN_API_ENDPOINTS.TX_BTC,
2192
- payload
2193
- );
2194
- }
2195
- /**
2196
- * Execute BTC action endpoint (transfer|generate|signHash|finalize)
2197
- * POST /wallet/tx/btc
2198
- */
2199
- async execute(params) {
2200
- return this.client.post(
2201
- TALKEN_API_ENDPOINTS.TX_BTC,
2202
- params
2203
- );
2204
- }
2205
- /**
2206
- * Sign raw hash via secp256k1 MPC (universal: EVM/BTC/TVM)
2207
- * POST /wallet/sign/hash { hash, pin, network? }
2208
- */
2209
- async signHash(params) {
2210
- return this.client.post(
2211
- TALKEN_API_ENDPOINTS.SIGN_HASH,
2212
- params
2213
- );
2214
- }
2215
- /**
2216
- * Broadcast raw BTC transaction
2217
- * POST /wallet/tx/raw { network, signedSerializeTx }
2218
- */
2219
- async broadcastRawTransaction(params) {
2220
- return this.client.post(TALKEN_API_ENDPOINTS.TX_RAW, {
2221
- network: params.network,
2222
- signedSerializeTx: params.rawTransaction
2223
- });
2224
- }
2225
- };
2226
- var TalkenTronModule = class {
2227
- constructor(client) {
2228
- this.client = client;
2229
- }
2230
- /**
2231
- * Execute TVM(TRON) transfer/call (integrated sign + broadcast)
2232
- * POST /wallet/tx/tvm
2233
- * - kind=native: TRX transfer (amountSun)
2234
- * - kind=trc20: TRC-20 transfer (contractAddress + amount)
2235
- * - kind=contract: arbitrary contract call (contractAddress + data)
2236
- */
2237
- async transferTrx(params) {
2238
- return this.client.post(
2239
- TALKEN_API_ENDPOINTS.TX_TVM,
2240
- params
2241
- );
2242
- }
2243
- };
2244
- var TalkenWalletscanModule = class {
2245
- constructor(client) {
2246
- this.client = client;
2247
- }
2248
- /**
2249
- * Get token metadata by contract address
2250
- * GET /wallet/scan?type=tokens&chainKeys=...&contractAddress=...
2251
- */
2252
- async getToken(params) {
2253
- const qs = new URLSearchParams({
2254
- type: "tokens",
2255
- chainKeys: params.chainKeys,
2256
- contractAddress: params.contractAddress
2257
- }).toString();
2258
- return this.client.get(
2259
- `${TALKEN_API_ENDPOINTS.WALLET_SCAN}?${qs}`
2260
- );
2261
- }
2262
- /**
2263
- * Get native coin balances
2264
- * GET /wallet/scan?type=natives&chainKeys=...&walletAddress=...
2265
- */
2266
- async getNativeTokens(params) {
2267
- const qs = new URLSearchParams({
2268
- type: "natives",
2269
- chainKeys: params.chainKeys,
2270
- walletAddress: params.walletAddress
2271
- }).toString();
2272
- return this.client.get(
2273
- `${TALKEN_API_ENDPOINTS.WALLET_SCAN}?${qs}`
2274
- );
2275
- }
2276
- /**
2277
- * Get NFT metadata
2278
- * GET /wallet/scan?type=nfts&chainKeys=...&walletAddress=...
2279
- */
2280
- async getNfts(params) {
2281
- const qs = new URLSearchParams({
2282
- type: "nfts",
2283
- chainKeys: params.chainKeys,
2284
- walletAddress: params.walletAddress
2285
- }).toString();
2286
- return this.client.get(
2287
- `${TALKEN_API_ENDPOINTS.WALLET_SCAN}?${qs}`
2288
- );
2289
- }
2290
- };
2291
- var TalkenApiClient = class {
2292
- constructor(config) {
2293
- this.accessToken = null;
2294
- this.refreshToken_ = null;
2295
- this.expiresAt = null;
2296
- this.isRefreshing = false;
2297
- this.refreshPromise = null;
2298
- this.config = {
2299
- baseUrl: config?.baseUrl || DEFAULT_TALKEN_API_CONFIG.baseUrl || "",
2300
- timeout: config?.timeout || DEFAULT_TALKEN_API_CONFIG.timeout,
2301
- environment: config?.environment || "development",
2302
- defaultChainId: config?.defaultChainId,
2303
- debug: config?.debug || false
2304
- };
2305
- this.auth = new TalkenAuthModule(this);
2306
- this.wallet = new TalkenWalletModule(this);
2307
- this.evm = new TalkenEvmModule(this);
2308
- this.solana = new TalkenSolanaModule(this);
2309
- this.bitcoin = new TalkenBitcoinModule(this);
2310
- this.tron = new TalkenTronModule(this);
2311
- this.walletscan = new TalkenWalletscanModule(this);
2312
- this.restoreSession();
2313
- }
2314
- // ── Session Management ──────────────────────────────────────────────
2315
- restoreSession() {
2316
- this.accessToken = loadToken("access_token");
2317
- this.refreshToken_ = loadToken("refresh_token");
2318
- const expiresAtStr = loadToken("expires_at");
2319
- this.expiresAt = expiresAtStr ? Number(expiresAtStr) : null;
2320
- }
2321
- /** @internal Called by auth module after successful login/register */
2322
- handleAuthResponse(response) {
2323
- this.accessToken = response.accessToken;
2324
- this.refreshToken_ = response.refreshToken;
2325
- this.expiresAt = Date.now() + response.expiresIn * 1e3;
2326
- saveToken("access_token", response.accessToken);
2327
- saveToken("refresh_token", response.refreshToken);
2328
- saveToken("expires_at", String(this.expiresAt));
2329
- }
2330
- /** @internal Clear all session data */
2331
- clearSession() {
2332
- this.accessToken = null;
2333
- this.refreshToken_ = null;
2334
- this.expiresAt = null;
2335
- removeToken("access_token");
2336
- removeToken("refresh_token");
2337
- removeToken("expires_at");
2338
- }
2339
- /**
2340
- * Check if user is authenticated (has valid access token)
2341
- */
2342
- isAuthenticated() {
2343
- return !!this.accessToken && !this.isTokenExpired();
2344
- }
2345
- /**
2346
- * Check if current access token is expired
2347
- */
2348
- isTokenExpired() {
2349
- if (!this.expiresAt)
2350
- return true;
2351
- return Date.now() >= this.expiresAt - TOKEN_EXPIRY.REFRESH_BUFFER;
2352
- }
2353
- /**
2354
- * Get current access token
2355
- */
2356
- getAccessToken() {
2357
- return this.accessToken;
2358
- }
2359
- /**
2360
- * Get current refresh token
2361
- * @internal Used by auth module for token refresh
2362
- */
2363
- getRefreshToken() {
2364
- return this.refreshToken_;
2365
- }
2366
- /**
2367
- * Get client configuration
2368
- */
2369
- getConfig() {
2370
- return { ...this.config };
2371
- }
2372
- /**
2373
- * Set tokens externally (useful for SSR or state management integration)
2374
- */
2375
- setTokens(accessToken, refreshToken, expiresAt) {
2376
- this.accessToken = accessToken;
2377
- this.refreshToken_ = refreshToken;
2378
- this.expiresAt = expiresAt;
2379
- saveToken("access_token", accessToken);
2380
- saveToken("refresh_token", refreshToken);
2381
- saveToken("expires_at", String(expiresAt));
2382
- }
2383
- // ── HTTP Methods (Internal) ─────────────────────────────────────────
2384
- /** @internal Make a GET request */
2385
- async get(endpoint, options) {
2386
- return this.request(endpoint, { method: "GET", ...options });
2387
- }
2388
- /** @internal Make a POST request */
2389
- async post(endpoint, body, options) {
2390
- return this.request(endpoint, { method: "POST", body, ...options });
2391
- }
2392
- /**
2393
- * Core HTTP request handler with automatic token refresh
2394
- * @internal
2395
- */
2396
- async request(endpoint, options) {
2397
- const { method, body, skipAuth = false } = options;
2398
- if (!skipAuth && this.isTokenExpired() && this.refreshToken_) {
2399
- await this.ensureTokenRefreshed();
2400
- }
2401
- const url = `${this.config.baseUrl}${endpoint}`;
2402
- const headers = {
2403
- "Content-Type": "application/json",
2404
- Accept: "application/json"
2405
- };
2406
- if (!skipAuth && this.accessToken) {
2407
- headers.Authorization = `Bearer ${this.accessToken}`;
2408
- }
2409
- if (this.config.debug) {
2410
- console.log(`[TalkenApiClient] ${method} ${url}`);
2411
- }
2412
- try {
2413
- const controller = new AbortController();
2414
- const timeoutId = setTimeout(
2415
- () => controller.abort(),
2416
- this.config.timeout || 3e4
2417
- );
2418
- const response = await fetch(url, {
2419
- method,
2420
- headers,
2421
- body: body ? JSON.stringify(body) : void 0,
2422
- signal: controller.signal,
2423
- credentials: "include"
2424
- });
2425
- clearTimeout(timeoutId);
2426
- const text = await response.text();
2427
- let data;
2428
- if (text) {
2429
- try {
2430
- data = JSON.parse(text);
2431
- } catch {
2432
- throw new TalkenApiError(
2433
- "PARSE_ERROR",
2434
- "Invalid JSON response from server",
2435
- response.status,
2436
- { text: text.substring(0, 200) }
2437
- );
2438
- }
2439
- } else {
2440
- data = { success: true };
2441
- }
2442
- if (response.status === 401 && !skipAuth && this.refreshToken_) {
2443
- try {
2444
- await this.forceTokenRefresh();
2445
- return this.request(endpoint, { ...options, skipAuth: true });
2446
- } catch {
2447
- this.clearSession();
2448
- throw new TalkenApiError(
2449
- "TOKEN_EXPIRED",
2450
- "Session expired. Please login again.",
2451
- 401
2452
- );
2453
- }
2454
- }
2455
- if (!response.ok) {
2456
- const errCode = data.error?.code || "UNKNOWN_ERROR";
2457
- const errMsg = data.error?.message || `Request failed with status ${response.status}`;
2458
- if (this.config.debug) {
2459
- console.error(`[TalkenApiClient] Error: ${errCode} - ${errMsg}`);
2460
- }
2461
- throw new TalkenApiError(
2462
- errCode,
2463
- errMsg,
2464
- response.status,
2465
- data.error?.details || data.details
2466
- );
2467
- }
2468
- return data.data ?? data;
2469
- } catch (error) {
2470
- if (error instanceof TalkenApiError) {
2471
- throw error;
2472
- }
2473
- if (error instanceof DOMException && error.name === "AbortError") {
2474
- throw new TalkenApiError("TIMEOUT", "Request timed out", 408);
2475
- }
2476
- const errorMessage = error instanceof Error ? error.message : "Network request failed";
2477
- throw new TalkenApiError("NETWORK_ERROR", errorMessage, 0);
2478
- }
2479
- }
2480
- /**
2481
- * Ensure token is refreshed (handles concurrent requests)
2482
- */
2483
- async ensureTokenRefreshed() {
2484
- if (this.isRefreshing && this.refreshPromise) {
2485
- await this.refreshPromise;
2486
- return;
2487
- }
2488
- await this.forceTokenRefresh();
2489
- }
2490
- /**
2491
- * Force a token refresh
2492
- */
2493
- async forceTokenRefresh() {
2494
- if (this.isRefreshing && this.refreshPromise) {
2495
- await this.refreshPromise;
2496
- return;
2497
- }
2498
- this.isRefreshing = true;
2499
- this.refreshPromise = (async () => {
2500
- try {
2501
- await this.auth.refresh();
2502
- } finally {
2503
- this.isRefreshing = false;
2504
- this.refreshPromise = null;
2505
- }
2506
- })();
2507
- await this.refreshPromise;
2508
- }
2509
- };
2510
- function createTalkenApiClient(config) {
2511
- return new TalkenApiClient(config);
2512
- }
2513
-
2514
- // src/wallets/walletConnectors/abcWallet/api/TalkenApiSingleton.ts
2515
- var _instance;
2516
- function setTalkenApiClient(client) {
2517
- _instance = client;
2518
- }
2519
- function getTalkenApiClient2() {
2520
- return _instance;
2521
- }
2522
-
2523
- // src/wallets/walletConnectors/abcWallet/networkConfig.ts
2524
- var SolanaNetwork = /* @__PURE__ */ ((SolanaNetwork2) => {
2525
- SolanaNetwork2["Mainnet"] = "solana";
2526
- SolanaNetwork2["Devnet"] = "solana_devnet";
2527
- SolanaNetwork2["Testnet"] = "solana_testnet";
2528
- return SolanaNetwork2;
2529
- })(SolanaNetwork || {});
2530
- var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
2531
- BitcoinNetwork2["Mainnet"] = "bitcoin";
2532
- BitcoinNetwork2["Testnet"] = "bitcoin_testnet";
2533
- return BitcoinNetwork2;
2534
- })(BitcoinNetwork || {});
2535
- var TronNetwork = /* @__PURE__ */ ((TronNetwork2) => {
2536
- TronNetwork2["Mainnet"] = "tron";
2537
- TronNetwork2["Nile"] = "tron_nile";
2538
- return TronNetwork2;
2539
- })(TronNetwork || {});
2540
- var DEFAULT_NETWORK_CONFIG = {
2541
- evm: {
2542
- mainnet: 1,
2543
- // Ethereum Mainnet
2544
- testnet: 11155111
2545
- // Sepolia Testnet
2546
- },
2547
- solana: {
2548
- mainnet: "solana" /* Mainnet */,
2549
- devnet: "solana_devnet" /* Devnet */
2550
- },
2551
- bitcoin: {
2552
- mainnet: "bitcoin" /* Mainnet */,
2553
- testnet: "bitcoin_testnet" /* Testnet */
2554
- },
2555
- tron: {
2556
- mainnet: "tron" /* Mainnet */,
2557
- testnet: "tron_nile" /* Nile */
2558
- }
2559
- };
2560
- var globalDefaultChainId;
2561
- var globalDefaultSolanaNetwork;
2562
- var globalDefaultBitcoinNetwork;
2563
- var globalDefaultTronNetwork;
2564
- function setGlobalDefaultChainId(chainId) {
2565
- globalDefaultChainId = chainId;
2566
- }
2567
- function setGlobalDefaultSolanaNetwork(network) {
2568
- globalDefaultSolanaNetwork = network;
2569
- }
2570
- function setGlobalDefaultBitcoinNetwork(network) {
2571
- globalDefaultBitcoinNetwork = network;
2572
- }
2573
- function getEvmNetwork(customChainId) {
2574
- if (customChainId !== void 0) {
2575
- return customChainId;
2576
- }
2577
- if (globalDefaultChainId !== void 0) {
2578
- return globalDefaultChainId;
2579
- }
2580
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2581
- const fallbackChainId = isProduction ? DEFAULT_NETWORK_CONFIG.evm.mainnet : DEFAULT_NETWORK_CONFIG.evm.testnet;
2582
- return fallbackChainId;
2583
- }
2584
- function getSolanaNetwork() {
2585
- if (globalDefaultSolanaNetwork !== void 0) {
2586
- return globalDefaultSolanaNetwork;
2587
- }
2588
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2589
- return isProduction ? DEFAULT_NETWORK_CONFIG.solana.mainnet : DEFAULT_NETWORK_CONFIG.solana.devnet;
2590
- }
2591
- function getBitcoinNetwork() {
2592
- if (globalDefaultBitcoinNetwork !== void 0) {
2593
- return globalDefaultBitcoinNetwork;
2594
- }
2595
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2596
- return isProduction ? DEFAULT_NETWORK_CONFIG.bitcoin.mainnet : DEFAULT_NETWORK_CONFIG.bitcoin.testnet;
2597
- }
2598
- function getTronNetwork() {
2599
- if (globalDefaultTronNetwork !== void 0) {
2600
- return globalDefaultTronNetwork;
2601
- }
2602
- const isProduction = typeof process !== "undefined" && process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
2603
- return isProduction ? DEFAULT_NETWORK_CONFIG.tron.mainnet : DEFAULT_NETWORK_CONFIG.tron.testnet;
2604
- }
2605
-
2606
- // src/wallets/walletConnectors/abcWallet/resolveTalkenApiUrl.ts
2607
- function resolveTalkenApiUrl(explicitUrl) {
2608
- const talkenApiUrl = explicitUrl || process.env.NEXT_PUBLIC_TALKEN_API_URL;
2609
- if (!talkenApiUrl) {
2610
- throw new Error(
2611
- "Talken API URL is required. Pass talkenApiUrl explicitly or set NEXT_PUBLIC_TALKEN_API_URL."
2612
- );
2613
- }
2614
- return talkenApiUrl;
2615
- }
2616
-
2617
- // src/wallets/walletConnectors/abcWallet/abcConnector.ts
2618
- function abcConnector(options) {
2619
- const { config } = options;
2620
- if (config.defaultChainId) {
2621
- setGlobalDefaultChainId(config.defaultChainId);
2622
- }
2623
- if (config.defaultSolanaNetwork) {
2624
- setGlobalDefaultSolanaNetwork(config.defaultSolanaNetwork);
2625
- }
2626
- if (config.defaultBitcoinNetwork) {
2627
- setGlobalDefaultBitcoinNetwork(config.defaultBitcoinNetwork);
2628
- }
2629
- return createConnector((wagmiConfig) => {
2630
- const talkenApi = getTalkenApiClient3() || createTalkenApiClient({
2631
- baseUrl: resolveTalkenApiUrl(config.talkenApiUrl),
2632
- environment: config.environment,
2633
- debug: config.environment === "development",
2634
- defaultChainId: config.defaultChainId
2635
- });
2636
- setTalkenApiClient(talkenApi);
2637
- const provider = createAbcEvmProvider(talkenApi);
2638
- let accountsChangedHandler;
2639
- let chainChangedHandler;
2640
- let disconnectHandler;
2641
- return {
2642
- id: "abc",
2643
- name: "ABC Wallet",
2644
- type: "abc",
2645
- /**
2646
- * Connect wallet
2647
- */
2648
- async connect() {
2649
- try {
2650
- const authState = loadAuthState();
2651
- if (!authState || !authState.isAuthenticated || !authState.wallet) {
2652
- throw new Error("ABC_LOGIN_REQUIRED");
2653
- }
2654
- provider.setWallet(authState.wallet);
2655
- if (authState.accessToken && authState.refreshToken && authState.expiresAt) {
2656
- talkenApi.setTokens(
2657
- authState.accessToken,
2658
- authState.refreshToken,
2659
- authState.expiresAt
2660
- );
2661
- }
2662
- const accounts = await provider.request({
2663
- method: "eth_requestAccounts"
2664
- });
2665
- let currentChainId = await provider.request({
2666
- method: "eth_chainId"
2667
- });
2668
- const currentChainIdNumber = Number(currentChainId);
2669
- const isChainSupported = wagmiConfig.chains.some(
2670
- (c) => c.id === currentChainIdNumber
2671
- );
2672
- if (!isChainSupported && wagmiConfig.chains.length > 0) {
2673
- const fallbackChainId = wagmiConfig.chains[0].id;
2674
- await provider.request({
2675
- method: "wallet_switchEthereumChain",
2676
- params: [{ chainId: `0x${fallbackChainId.toString(16)}` }]
2677
- });
2678
- currentChainId = `0x${fallbackChainId.toString(16)}`;
2679
- if (authState.wallet) {
2680
- authState.wallet.chainId = fallbackChainId;
2681
- saveAuthState(authState);
2682
- }
2683
- }
2684
- if (accountsChangedHandler) {
2685
- provider.removeListener("accountsChanged", accountsChangedHandler);
2686
- }
2687
- accountsChangedHandler = (accounts2) => {
2688
- wagmiConfig.emitter.emit("change", {
2689
- accounts: accounts2
2690
- });
2691
- };
2692
- provider.on("accountsChanged", accountsChangedHandler);
2693
- if (chainChangedHandler) {
2694
- provider.removeListener("chainChanged", chainChangedHandler);
2695
- }
2696
- chainChangedHandler = (chainId) => {
2697
- wagmiConfig.emitter.emit("change", {
2698
- chainId: Number(chainId)
2699
- });
2700
- };
2701
- provider.on("chainChanged", chainChangedHandler);
2702
- if (disconnectHandler) {
2703
- provider.removeListener("disconnect", disconnectHandler);
2704
- }
2705
- disconnectHandler = () => {
2706
- wagmiConfig.emitter.emit("disconnect");
2707
- this.onDisconnect();
2708
- };
2709
- provider.on("disconnect", disconnectHandler);
2710
- wagmiConfig.emitter.emit("connect", {
2711
- accounts,
2712
- chainId: Number(currentChainId)
2713
- });
2714
- return {
2715
- accounts,
2716
- chainId: Number(currentChainId)
2717
- };
2718
- } catch (error) {
2719
- console.error("\u274C ABC Connector connect() failed:", {
2720
- message: error.message,
2721
- code: error.code,
2722
- error
2723
- });
2724
- if (error.message === "ABC_LOGIN_REQUIRED") {
2725
- throw error;
2726
- }
2727
- throw error;
2728
- }
2729
- },
2730
- /**
2731
- * Disconnect wallet
2732
- */
2733
- async disconnect() {
2734
- if (accountsChangedHandler) {
2735
- provider.removeListener("accountsChanged", accountsChangedHandler);
2736
- accountsChangedHandler = void 0;
2737
- }
2738
- if (chainChangedHandler) {
2739
- provider.removeListener("chainChanged", chainChangedHandler);
2740
- chainChangedHandler = void 0;
2741
- }
2742
- if (disconnectHandler) {
2743
- provider.removeListener("disconnect", disconnectHandler);
2744
- disconnectHandler = void 0;
2745
- }
2746
- provider.clearWallet();
2747
- talkenApi.auth.logout();
2748
- clearAuthState();
2749
- getCredentialManager().clear();
2750
- },
2751
- /**
2752
- * Get accounts
2753
- */
2754
- async getAccounts() {
2755
- const accounts = await provider.request({
2756
- method: "eth_accounts"
2757
- });
2758
- return accounts.map((account) => account);
2759
- },
2760
- /**
2761
- * Get chain ID
2762
- */
2763
- async getChainId() {
2764
- const chainId = await provider.request({
2765
- method: "eth_chainId"
2766
- });
2767
- return Number(chainId);
2768
- },
2769
- /**
2770
- * Get provider
2771
- */
2772
- async getProvider() {
2773
- return provider;
2774
- },
2775
- /**
2776
- * Check if authorized (has valid session)
2777
- * Auto-refreshes access token if expired but refresh token is valid
2778
- */
2779
- async isAuthorized() {
2780
- try {
2781
- const authState = loadAuthState();
2782
- if (!authState || !authState.isAuthenticated) {
2783
- return false;
2784
- }
2785
- if (!authState.wallet) {
2786
- return false;
2787
- }
2788
- if (talkenApi.isAuthenticated()) {
2789
- return true;
2790
- }
2791
- const refreshToken = loadFromStorage(
2792
- "refresh_token" /* REFRESH_TOKEN */
2793
- );
2794
- if (!refreshToken) {
2795
- clearStorage();
2796
- return false;
2797
- }
2798
- try {
2799
- const api = getTalkenApiClient3();
2800
- if (!api) {
2801
- clearStorage();
2802
- return false;
2803
- }
2804
- const res = await api.auth.refresh();
2805
- talkenApi.setTokens(
2806
- res.accessToken,
2807
- res.refreshToken,
2808
- Date.now() + res.expiresIn * 1e3
2809
- );
2810
- const updatedState = loadAuthState();
2811
- return updatedState?.isAuthenticated ?? false;
2812
- } catch (error) {
2813
- console.error("[AbcConnector] Token refresh failed:", error);
2814
- clearStorage();
2815
- return false;
2816
- }
2817
- } catch (error) {
2818
- console.error(
2819
- "[AbcConnector] Unexpected error in isAuthorized:",
2820
- error
2821
- );
2822
- return false;
2823
- }
2824
- },
2825
- /**
2826
- * Switch chain
2827
- */
2828
- async switchChain({ chainId }) {
2829
- await provider.request({
2830
- method: "wallet_switchEthereumChain",
2831
- params: [{ chainId: `0x${chainId.toString(16)}` }]
2832
- });
2833
- const newChainId = await this.getChainId();
2834
- const authState = loadAuthState();
2835
- if (authState?.wallet) {
2836
- authState.wallet.chainId = newChainId;
2837
- saveAuthState(authState);
2838
- }
2839
- return wagmiConfig.chains.find((x) => x.id === chainId) ?? {
2840
- id: chainId,
2841
- name: `Chain ${chainId}`,
2842
- nativeCurrency: {
2843
- name: "Ether",
2844
- decimals: 18,
2845
- symbol: "ETH"
2846
- },
2847
- rpcUrls: {
2848
- default: { http: [""] }
2849
- }
2850
- };
2851
- },
2852
- /**
2853
- * Handle accounts changed
2854
- */
2855
- onAccountsChanged(accounts) {
2856
- if (accounts.length === 0) {
2857
- this.onDisconnect();
2858
- } else {
2859
- wagmiConfig.emitter.emit("change", {
2860
- accounts
2861
- });
2862
- }
2863
- },
2864
- /**
2865
- * Handle chain changed
2866
- */
2867
- onChainChanged(chain) {
2868
- const chainId = Number(chain);
2869
- wagmiConfig.emitter.emit("change", { chainId });
2870
- },
2871
- /**
2872
- * Handle disconnect
2873
- */
2874
- onDisconnect(_error) {
2875
- provider.clearWallet();
2876
- clearAuthState();
2877
- wagmiConfig.emitter.emit("disconnect");
2878
- }
2879
- };
2880
- });
2881
- }
2882
-
2883
- // src/wallets/walletConnectors/abcWallet/abcWallet.ts
2884
- var abcWallet = (specificOptions) => ({ projectId }) => {
2885
- const talkenApiUrl = resolveTalkenApiUrl(specificOptions?.talkenApiUrl);
2886
- const talkenApi = createTalkenApiClient({
2887
- baseUrl: talkenApiUrl,
2888
- debug: specificOptions?.environment === "development"
2889
- });
2890
- setTalkenApiClient2(talkenApi);
2891
- const config = {
2892
- talkenApiUrl,
2893
- apiKey: specificOptions?.apiKey,
2894
- plain: specificOptions?.plain || "",
2895
- // Deprecated - not used (secure.ts uses random generation)
2896
- environment: specificOptions?.environment || "development",
2897
- defaultChainId: specificOptions?.defaultChainId,
2898
- defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
2899
- defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
2900
- projectId
2901
- };
2902
- return {
2903
- id: ABC_WALLET_METADATA.id,
2904
- name: ABC_WALLET_METADATA.name,
2905
- rdns: ABC_WALLET_METADATA.rdns,
2906
- iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
2907
- iconBackground: ABC_WALLET_METADATA.iconBackground,
2908
- // Embedded wallet - no installation required
2909
- installed: void 0,
2910
- // No download URLs for embedded wallet
2911
- downloadUrls: void 0,
2912
- // Create connector - wrapper function required by Wallet type
2913
- createConnector: (_walletDetails) => abcConnector({ config }),
2914
- // Embedded wallet always available
2915
- hidden: () => false
2916
- };
2917
- };
2918
-
2919
- // src/wallets/walletConnectors/abcWallet/api/WalletscanApi.ts
2920
- import { getTalkenApiClient as getTalkenApiClient4, networkNameToChainKey as networkNameToChainKey2 } from "@talken/talkenkit";
2921
- var WalletscanApi = class {
2922
- /**
2923
- * Get token metadata via TalkenApiClient walletscan endpoint
2924
- *
2925
- * @param params - Contract address and networks
2926
- * @returns Token metadata or null if not found/failed
2927
- */
2928
- async getContractToken(params) {
2929
- const api = getTalkenApiClient4();
2930
- if (!api)
2931
- throw new Error("TalkenApiClient not initialized");
2932
- try {
2933
- const tokens = await api.walletscan.getToken({
2934
- contractAddress: params.contractAddress,
2935
- chainKeys: networkNameToChainKey2(params.networks)
2936
- });
2937
- return tokens.length > 0 ? tokens[0] : null;
2938
- } catch (error) {
2939
- console.warn(
2940
- "[WalletscanApi] TalkenApi getToken failed:",
2941
- params.contractAddress,
2942
- error
2943
- );
2944
- return null;
2945
- }
2946
- }
2947
- /**
2948
- * Get token metadata with timeout
2949
- *
2950
- * @param params - Contract address and networks
2951
- * @param timeoutMs - Timeout in milliseconds (default: 3000)
2952
- * @returns Token metadata or null if timeout/failed
2953
- */
2954
- async getContractTokenWithTimeout(params, timeoutMs = 3e3) {
2955
- try {
2956
- const result = await Promise.race([
2957
- this.getContractToken(params),
2958
- new Promise(
2959
- (resolve) => setTimeout(() => resolve(null), timeoutMs)
2960
- )
2961
- ]);
2962
- return result;
2963
- } catch (_error) {
2964
- console.warn(
2965
- "[WalletscanApi] Token metadata request timed out:",
2966
- params.contractAddress
2967
- );
2968
- return null;
2969
- }
2970
- }
2971
- /**
2972
- * Get native coin info via TalkenApiClient walletscan endpoint
2973
- *
2974
- * @param params - Wallet address and networks
2975
- * @returns Array of native coins or empty array if failed
2976
- */
2977
- async getNativeToken(params) {
2978
- const api = getTalkenApiClient4();
2979
- if (!api)
2980
- throw new Error("TalkenApiClient not initialized");
2981
- try {
2982
- return await api.walletscan.getNativeTokens({
2983
- walletAddress: params.walletAddress,
2984
- chainKeys: networkNameToChainKey2(params.networks)
2985
- });
2986
- } catch (error) {
2987
- console.warn("[WalletscanApi] TalkenApi getNativeTokens failed:", error);
2988
- return [];
2989
- }
2990
- }
2991
- /**
2992
- * Get native coin info with timeout
2993
- *
2994
- * @param params - Wallet address and networks
2995
- * @param timeoutMs - Timeout in milliseconds (default: 3000)
2996
- * @returns First native coin or null if timeout/failed
2997
- */
2998
- async getNativeTokenWithTimeout(params, timeoutMs = 3e3) {
2999
- try {
3000
- const natives = await Promise.race([
3001
- this.getNativeToken(params),
3002
- new Promise(
3003
- (resolve) => setTimeout(() => resolve([]), timeoutMs)
3004
- )
3005
- ]);
3006
- return natives.length > 0 ? natives[0] : null;
3007
- } catch (_error) {
3008
- console.warn("[WalletscanApi] Native coin request timed out");
3009
- return null;
3010
- }
3011
- }
3012
- /**
3013
- * Get NFT metadata via TalkenApiClient walletscan endpoint
3014
- *
3015
- * @param params - Contract address, wallet address, and networks
3016
- * @returns Array of NFT metadata or empty array if failed
3017
- */
3018
- async getNFT(params) {
3019
- const api = getTalkenApiClient4();
3020
- if (!api)
3021
- throw new Error("TalkenApiClient not initialized");
3022
- try {
3023
- return await api.walletscan.getNfts({
3024
- chainKeys: networkNameToChainKey2(params.networks),
3025
- walletAddress: params.walletAddress
3026
- });
3027
- } catch (error) {
3028
- console.warn(
3029
- "[WalletscanApi] TalkenApi getNfts failed:",
3030
- params.contractAddress,
3031
- error
3032
- );
3033
- return [];
3034
- }
3035
- }
3036
- /**
3037
- * Get NFT metadata with timeout
3038
- *
3039
- * @param params - Contract address, wallet address, and networks
3040
- * @param timeoutMs - Timeout in milliseconds (default: 3000)
3041
- * @returns First NFT or null if timeout/failed/empty
3042
- */
3043
- async getNFTWithTimeout(params, timeoutMs = 3e3) {
3044
- try {
3045
- const nfts = await Promise.race([
3046
- this.getNFT(params),
3047
- new Promise(
3048
- (resolve) => setTimeout(() => resolve([]), timeoutMs)
3049
- )
3050
- ]);
3051
- return nfts.length > 0 ? nfts[0] : null;
3052
- } catch (_error) {
3053
- console.warn(
3054
- "[WalletscanApi] NFT metadata request timed out:",
3055
- params.contractAddress
3056
- );
3057
- return null;
3058
- }
3059
- }
3060
- };
3061
-
3062
- // src/wallets/walletConnectors/abcWallet/api/GasApi.ts
3063
- import { getTalkenApiClient as getTalkenApiClient5 } from "@talken/talkenkit";
3064
- var GasApi = class {
3065
- parseGasFees(data) {
3066
- return {
3067
- ...data,
3068
- networkCongestion: data.networkCongestion != null ? Number(data.networkCongestion) : void 0
3069
- };
3070
- }
3071
- /**
3072
- * Get suggested gas fees for EIP-1559 transactions via TalkenApiClient
3073
- *
3074
- * @param network - Network name (ethereum, polygon, klaytn, etc.)
3075
- * @returns Suggested gas fees or null if failed
3076
- */
3077
- async getSuggestedGasFees(network) {
3078
- const api = getTalkenApiClient5();
3079
- if (!api)
3080
- throw new Error("TalkenApiClient not initialized");
3081
- try {
3082
- const gasFees = await api.evm.getGasSuggested(network);
3083
- return this.parseGasFees(gasFees);
3084
- } catch (error) {
3085
- console.warn(
3086
- "[GasApi] TalkenApi getGasSuggested failed:",
3087
- network,
3088
- error
3089
- );
3090
- return null;
3091
- }
3092
- }
3093
- /**
3094
- * Estimate gas limit for EIP-1559 transaction via TalkenApiClient
3095
- *
3096
- * @param params - Transaction parameters
3097
- * @returns Gas limit (hex string) or null if failed
3098
- */
3099
- async estimateGas(params) {
3100
- const api = getTalkenApiClient5();
3101
- if (!api)
3102
- throw new Error("TalkenApiClient not initialized");
3103
- try {
3104
- const response = await api.evm.estimateGas({
3105
- network: params.network,
3106
- from: params.from || "",
3107
- to: params.to,
3108
- value: params.value || "0x0",
3109
- data: params.data || "0x"
3110
- });
3111
- return response.result ?? null;
3112
- } catch (error) {
3113
- console.warn("[GasApi] TalkenApi estimateGas failed:", error);
3114
- return null;
3115
- }
3116
- }
3117
- /**
3118
- * Get suggested gas fees with timeout
3119
- *
3120
- * @param network - Network name
3121
- * @param timeoutMs - Timeout in milliseconds (default: 5000)
3122
- * @returns Suggested gas fees or null if timeout/failed
3123
- */
3124
- async getSuggestedGasFeesWithTimeout(network, timeoutMs = 5e3) {
3125
- try {
3126
- const result = await Promise.race([
3127
- this.getSuggestedGasFees(network),
3128
- new Promise(
3129
- (resolve) => setTimeout(() => resolve(null), timeoutMs)
3130
- )
3131
- ]);
3132
- return result;
3133
- } catch (_error) {
3134
- console.warn("[GasApi] Gas fees request timed out:", network);
3135
- return null;
3136
- }
3137
- }
3138
- /**
3139
- * Estimate gas with timeout
3140
- *
3141
- * @param params - Transaction parameters
3142
- * @param timeoutMs - Timeout in milliseconds (default: 5000)
3143
- * @returns Gas limit (hex string) or null if timeout/failed
3144
- */
3145
- async estimateGasWithTimeout(params, timeoutMs = 5e3) {
3146
- try {
3147
- const result = await Promise.race([
3148
- this.estimateGas(params),
3149
- new Promise(
3150
- (resolve) => setTimeout(() => resolve(null), timeoutMs)
3151
- )
3152
- ]);
3153
- return result;
3154
- } catch (_error) {
3155
- console.warn("[GasApi] Gas estimate request timed out");
3156
- return null;
3157
- }
3158
- }
3159
- };
3160
-
3161
- // src/wallets/walletConnectors/abcWallet/sessionUtils.ts
3162
- import { getTalkenApiClient as getTalkenApiClient6 } from "@talken/talkenkit";
3163
- var SessionExpiredError = class extends Error {
3164
- constructor(message = "Session expired. Please reconnect your wallet.") {
3165
- super(message);
3166
- this.name = "SessionExpiredError";
3167
- }
3168
- };
3169
- function dispatchSessionExpired() {
3170
- if (typeof window !== "undefined") {
3171
- console.warn("[SessionUtils] \u{1F6A8} dispatchSessionExpired called from:");
3172
- console.trace();
3173
- window.dispatchEvent(new CustomEvent("talkenkit:session_expired"));
3174
- }
3175
- }
3176
- function handleUnauthorizedResponse(response) {
3177
- if (response.status === 401) {
3178
- dispatchSessionExpired();
3179
- throw new SessionExpiredError(
3180
- "Session expired. Please reconnect your wallet."
3181
- );
3182
- }
3183
- }
3184
- async function fetchWithSessionCheck(url, options) {
3185
- const response = await fetch(url, options);
3186
- if (!response.ok && response.status === 401) {
3187
- const errorText = await response.text();
3188
- console.error("[ABC WaaS] \u274C Unauthorized (401):", errorText);
3189
- dispatchSessionExpired();
3190
- throw new SessionExpiredError(
3191
- "Session expired. Please reconnect your wallet."
3192
- );
3193
- }
3194
- return response;
3195
- }
3196
- async function refreshAccessToken(pinCallback) {
3197
- if (pinCallback) {
3198
- await pinCallback();
3199
- }
3200
- const refreshToken = localStorage.getItem(`${STORAGE_PREFIX}refresh_token`);
3201
- if (!refreshToken) {
3202
- console.warn("[SessionUtils] No refresh token - opening connect modal");
3203
- dispatchSessionExpired();
3204
- await new Promise((resolve) => setTimeout(resolve, 100));
3205
- throw new SessionExpiredError(
3206
- "Session expired. Please reconnect your wallet."
3207
- );
3208
- }
3209
- try {
3210
- const api = getTalkenApiClient6();
3211
- if (!api) {
3212
- throw new Error("TalkenApiClient not initialized");
3213
- }
3214
- api.setTokens(
3215
- localStorage.getItem(`${STORAGE_PREFIX}access_token`) || "",
3216
- refreshToken,
3217
- Number(localStorage.getItem(`${STORAGE_PREFIX}expires_at`) || "0")
3218
- );
3219
- const res = await api.auth.refresh();
3220
- const expiresAt = Date.now() + res.expiresIn * 1e3;
3221
- localStorage.setItem(`${STORAGE_PREFIX}access_token`, res.accessToken);
3222
- if (res.refreshToken) {
3223
- localStorage.setItem(`${STORAGE_PREFIX}refresh_token`, res.refreshToken);
3224
- }
3225
- localStorage.setItem(`${STORAGE_PREFIX}expires_at`, String(expiresAt));
3226
- console.log(
3227
- "[SessionUtils] \u2705 Token refreshed - expires in:",
3228
- (res.expiresIn / 60 / 60).toFixed(2),
3229
- "hours"
3230
- );
3231
- return res.accessToken;
3232
- } catch (error) {
3233
- console.error("[SessionUtils] Token refresh failed:", error);
3234
- dispatchSessionExpired();
3235
- await new Promise((resolve) => setTimeout(resolve, 100));
3236
- throw new SessionExpiredError(
3237
- "Session expired. Please reconnect your wallet."
3238
- );
3239
- }
3240
- }
3241
-
3242
- // src/wallets/walletConnectors/abcWallet/abcBitcoinProvider.ts
3243
- import { getTalkenApiClient as getTalkenApiClient7 } from "@talken/talkenkit";
3244
- function isTalkenApiClient(client) {
3245
- return typeof client?.bitcoin?.getUtxos === "function";
3246
- }
3247
- var EventEmitter2 = class {
3248
- constructor() {
3249
- this.events = /* @__PURE__ */ new Map();
3250
- }
3251
- on(event, listener) {
3252
- if (!this.events.has(event)) {
3253
- this.events.set(event, []);
3254
- }
3255
- this.events.get(event).push(listener);
3256
- return this;
3257
- }
3258
- off(event, listener) {
3259
- const listeners = this.events.get(event);
3260
- if (listeners) {
3261
- const index = listeners.indexOf(listener);
3262
- if (index !== -1) {
3263
- listeners.splice(index, 1);
3264
- }
3265
- }
3266
- return this;
3267
- }
3268
- removeListener(event, listener) {
3269
- return this.off(event, listener);
3270
- }
3271
- emit(event, ...args) {
3272
- const listeners = this.events.get(event);
3273
- if (listeners) {
3274
- for (const listener of listeners) {
3275
- listener(...args);
3276
- }
3277
- return true;
3278
- }
3279
- return false;
3280
- }
3281
- removeAllListeners(event) {
3282
- if (event) {
3283
- this.events.delete(event);
3284
- } else {
3285
- this.events.clear();
3286
- }
3287
- return this;
3288
- }
3289
- };
3290
- var BitcoinErrorCode = {
3291
- USER_REJECTED: 4001,
3292
- UNAUTHORIZED: 4100,
3293
- UNSUPPORTED_METHOD: 4200,
3294
- DISCONNECTED: 4900,
3295
- INVALID_PARAMS: -32602,
3296
- INTERNAL_ERROR: -32603,
3297
- INSUFFICIENT_FUNDS: 5001,
3298
- UTXO_NOT_FOUND: 5002
3299
- };
3300
- var BitcoinProviderError = class extends Error {
3301
- constructor(code, message, data) {
3302
- super(message);
3303
- this.code = code;
3304
- this.data = data;
3305
- this.name = "BitcoinProviderError";
3306
- }
3307
- };
3308
- var BITCOIN_NETWORKS = {
3309
- mainnet: {
3310
- name: "Bitcoin Mainnet",
3311
- type: "bitcoin",
3312
- explorer: "https://blockstream.info"
3313
- },
3314
- testnet: {
3315
- name: "Bitcoin Testnet",
3316
- type: "bitcoin_testnet",
3317
- explorer: "https://blockstream.info/testnet"
3318
- }
3319
- };
3320
- var AbcBitcoinProvider = class extends EventEmitter2 {
3321
- constructor(client) {
3322
- super();
3323
- this.wallet = null;
3324
- this.network = BITCOIN_NETWORKS.testnet;
3325
- this.connected = false;
3326
- this.utxoCache = /* @__PURE__ */ new Map();
3327
- this.cacheExpiry = /* @__PURE__ */ new Map();
3328
- this.CACHE_TTL = 6e4;
3329
- if (isTalkenApiClient(client)) {
3330
- this.talkenApi = client;
3331
- }
3332
- }
3333
- extractHashSignature(result) {
3334
- const data = result;
3335
- return data?.signatureHex || data?.signstr || data?.result?.signstr || data?.data?.signatureHex || data?.data?.signstr || data?.data?.result?.signstr || "";
3336
- }
3337
- getRecoveryEmail() {
3338
- return getCredentialManager().getEmail() || void 0;
3339
- }
3340
- /**
3341
- * Set request interceptor for sign/transfer confirmation modals
3342
- */
3343
- setRequestInterceptor(interceptor) {
3344
- this.requestInterceptor = interceptor;
3345
- }
3346
- /**
3347
- * Call request interceptor if set (throws on user cancel)
3348
- */
3349
- async callInterceptor(request) {
3350
- if (this.requestInterceptor) {
3351
- await this.requestInterceptor(request);
3352
- }
3353
- }
3354
- /**
3355
- * Set wallet information
3356
- */
3357
- setWallet(wallet) {
3358
- const previousAddress = this.wallet?.address;
3359
- this.wallet = wallet;
3360
- this.connected = true;
3361
- if (wallet.network === "bitcoin") {
3362
- this.network = BITCOIN_NETWORKS.mainnet;
3363
- } else {
3364
- this.network = BITCOIN_NETWORKS.testnet;
3365
- }
3366
- if (previousAddress !== wallet.address) {
3367
- this.emit("accountsChanged", [wallet.address]);
3368
- this.clearUtxoCache();
3369
- }
3370
- this.emit("connect", {
3371
- address: wallet.address,
3372
- network: this.network.type
3373
- });
3374
- console.log(
3375
- "[BitcoinProvider] \u2705 Wallet connected:",
3376
- `${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 6)}`
3377
- );
3378
- }
3379
- /**
3380
- * Clear wallet (disconnect)
3381
- */
3382
- clearWallet() {
3383
- this.wallet = null;
3384
- this.connected = false;
3385
- this.clearUtxoCache();
3386
- this.emit("disconnect");
3387
- this.emit("accountsChanged", []);
3388
- console.log("[BitcoinProvider] \u{1F50C} Wallet disconnected");
3389
- }
3390
- /**
3391
- * Set TalkenApiClient for backend-proxied transaction flow
3392
- * When set, sendTransaction will use a single API call instead of multi-step WaaS
3393
- */
3394
- setTalkenApi(talkenApi) {
3395
- this.talkenApi = talkenApi;
3396
- }
3397
- /**
3398
- * Set network
3399
- */
3400
- setNetwork(networkKey) {
3401
- const newNetwork = BITCOIN_NETWORKS[networkKey];
3402
- if (!newNetwork) {
3403
- throw new BitcoinProviderError(
3404
- BitcoinErrorCode.INVALID_PARAMS,
3405
- `Unknown network: ${networkKey}`
3406
- );
3407
- }
3408
- const previousType = this.network.type;
3409
- this.network = newNetwork;
3410
- if (previousType !== newNetwork.type) {
3411
- this.emit("networkChanged", newNetwork.type);
3412
- this.clearUtxoCache();
3413
- }
3414
- }
3415
- /**
3416
- * Get current network
3417
- */
3418
- getNetwork() {
3419
- return this.network;
3420
- }
3421
- /**
3422
- * Check if connected
3423
- */
3424
- isConnected() {
3425
- return this.connected && this.wallet !== null;
3426
- }
3427
- /**
3428
- * Get Bitcoin address
3429
- */
3430
- async getAddress() {
3431
- if (!this.wallet) {
3432
- throw new BitcoinProviderError(
3433
- BitcoinErrorCode.DISCONNECTED,
3434
- "Wallet not connected"
3435
- );
3436
- }
3437
- return this.wallet.address;
3438
- }
3439
- /**
3440
- * Get compressed public key (33 bytes)
3441
- */
3442
- async getPublicKey() {
3443
- if (!this.wallet) {
3444
- throw new BitcoinProviderError(
3445
- BitcoinErrorCode.DISCONNECTED,
3446
- "Wallet not connected"
3447
- );
3448
- }
3449
- return this.wallet.publicKey;
3450
- }
3451
- /**
3452
- * Get address type (bech32, p2pkh, etc.)
3453
- */
3454
- getAddressType() {
3455
- if (!this.wallet) {
3456
- throw new BitcoinProviderError(
3457
- BitcoinErrorCode.DISCONNECTED,
3458
- "Wallet not connected"
3459
- );
3460
- }
3461
- return this.wallet.addressType;
3462
- }
3463
- /**
3464
- * Clear UTXO cache
3465
- */
3466
- clearUtxoCache() {
3467
- this.utxoCache.clear();
3468
- this.cacheExpiry.clear();
3469
- }
3470
- /**
3471
- * Check if cache is valid
3472
- */
3473
- isCacheValid(address) {
3474
- const expiry = this.cacheExpiry.get(address);
3475
- if (!expiry)
3476
- return false;
3477
- return Date.now() < expiry;
3478
- }
3479
- normalizeUtxos(rawUtxos) {
3480
- return rawUtxos.map((u) => ({
3481
- txid: String(u?.txid ?? u?.tx_hash ?? ""),
3482
- vout: Number(u?.vout ?? u?.output_index ?? 0),
3483
- value: Number(u?.value ?? u?.satoshis ?? 0),
3484
- scriptPubKey: String(
3485
- u?.scriptPubKey ?? u?.script_pub_key ?? u?.script ?? ""
3486
- ),
3487
- confirmations: Number(u?.confirmations ?? 0)
3488
- })).filter(
3489
- (u) => Boolean(u.txid) && Number.isFinite(u.vout) && Number.isFinite(u.value) && Number.isFinite(u.confirmations)
3490
- );
3491
- }
3492
- /**
3493
- * Get UTXOs for address (with caching)
3494
- */
3495
- async getUtxos(forceRefresh = false) {
3496
- if (!this.wallet) {
3497
- throw new BitcoinProviderError(
3498
- BitcoinErrorCode.DISCONNECTED,
3499
- "Wallet not connected"
3500
- );
3501
- }
3502
- const address = this.wallet.address;
3503
- if (!forceRefresh && this.isCacheValid(address)) {
3504
- const cached = this.utxoCache.get(address);
3505
- if (cached) {
3506
- console.log(
3507
- `[BitcoinProvider] \u{1F4E6} Using cached UTXOs (${cached.length} items)`
3508
- );
3509
- return cached;
3510
- }
3511
- }
3512
- try {
3513
- console.log("[BitcoinProvider] \u{1F50D} Fetching UTXOs from network...");
3514
- const api = this.talkenApi || getTalkenApiClient7();
3515
- const result = await api.bitcoin.getUtxos(this.network.type, address);
3516
- const utxos = this.normalizeUtxos(result.utxos || []);
3517
- this.utxoCache.set(address, utxos);
3518
- this.cacheExpiry.set(address, Date.now() + this.CACHE_TTL);
3519
- console.log(`[BitcoinProvider] \u2705 Fetched ${utxos.length} UTXOs`);
3520
- return utxos;
3521
- } catch (error) {
3522
- console.error(
3523
- "[BitcoinProvider] \u274C Failed to fetch UTXOs:",
3524
- error.message
3525
- );
3526
- throw new BitcoinProviderError(
3527
- BitcoinErrorCode.INTERNAL_ERROR,
3528
- "Failed to fetch UTXOs",
3529
- error
3530
- );
3531
- }
3532
- }
3533
- /**
3534
- * Get total balance (sum of all UTXOs)
3535
- * Returns balance in satoshis
3536
- */
3537
- async getBalance(forceRefresh = false) {
3538
- const utxos = await this.getUtxos(forceRefresh);
3539
- const balance = utxos.reduce((sum, utxo) => sum + utxo.value, 0);
3540
- console.log(
3541
- `[BitcoinProvider] \u{1F4B0} Balance: ${balance} satoshis (${balance / 1e8} BTC)`
3542
- );
3543
- return balance;
3544
- }
3545
- /**
3546
- * Estimate transaction fee
3547
- * Returns fee rate in satoshis per byte
3548
- */
3549
- async estimateFee(targetBlocks = 6) {
3550
- try {
3551
- const api = this.talkenApi || getTalkenApiClient7();
3552
- const result = await api.bitcoin.getFeeRate(
3553
- this.network.type,
3554
- targetBlocks
3555
- );
3556
- const feeRate = Number(result.feeRate);
3557
- if (!Number.isFinite(feeRate) || feeRate <= 0) {
3558
- throw new Error("Invalid fee rate");
3559
- }
3560
- console.log(`[BitcoinProvider] \u26FD Fee rate: ${feeRate} sat/byte`);
3561
- return feeRate;
3562
- } catch (_error) {
3563
- console.error("[BitcoinProvider] \u26A0\uFE0F Fee estimation failed, using default");
3564
- return 1;
3565
- }
3566
- }
3567
- /**
3568
- * Sign Bitcoin message (Bitcoin Signed Message format)
3569
- * Uses secp256k1 sign/hash endpoint with double-SHA256 of prefixed message.
3570
- *
3571
- * Format: SHA256(SHA256("\x18Bitcoin Signed Message:\n" + varint(len) + message))
3572
- *
3573
- * @param message - Message to sign (string)
3574
- * @returns Signature in hex format (compact: r + s + v)
3575
- */
3576
- async signMessage(message) {
3577
- if (!this.wallet) {
3578
- throw new BitcoinProviderError(
3579
- BitcoinErrorCode.DISCONNECTED,
3580
- "Wallet not connected"
3581
- );
3582
- }
3583
- await this.callInterceptor({
3584
- chain: "bitcoin",
3585
- method: "signMessage",
3586
- address: this.wallet.address,
3587
- network: this.network.type,
3588
- message
3589
- });
3590
- console.log("[BitcoinProvider] \u{1F4DD} Signing Bitcoin message...");
3591
- const prefix = "Bitcoin Signed Message:\n";
3592
- const msgBytes = new TextEncoder().encode(message);
3593
- const varint = this.encodeVarint(msgBytes.length);
3594
- const prefixBytes = new TextEncoder().encode(prefix);
3595
- const preimage = new Uint8Array(
3596
- prefixBytes.length + varint.length + msgBytes.length
3597
- );
3598
- preimage.set(prefixBytes, 0);
3599
- preimage.set(varint, prefixBytes.length);
3600
- preimage.set(msgBytes, prefixBytes.length + varint.length);
3601
- const hash1 = await crypto.subtle.digest("SHA-256", preimage);
3602
- const hash2 = await crypto.subtle.digest("SHA-256", hash1);
3603
- const hashHex = Array.from(new Uint8Array(hash2)).map((b) => b.toString(16).padStart(2, "0")).join("");
3604
- const api = getTalkenApiClient7();
3605
- if (!api) {
3606
- throw new BitcoinProviderError(
3607
- BitcoinErrorCode.INTERNAL_ERROR,
3608
- "TalkenApiClient not initialized"
3609
- );
3610
- }
3611
- const pinHash = getCredentialManager().getPinHash() || "";
3612
- const email = this.getRecoveryEmail();
3613
- let signstr = "";
3614
- try {
3615
- const result = await api.bitcoin.execute({
3616
- action: "signHash",
3617
- hash: hashHex,
3618
- pin: pinHash,
3619
- network: this.network.type,
3620
- ...email && { email }
3621
- });
3622
- signstr = this.extractHashSignature(result);
3623
- } catch (error) {
3624
- console.warn(
3625
- "[BitcoinProvider] BTC signHash endpoint failed, falling back to generic sign/hash:",
3626
- error
3627
- );
3628
- }
3629
- if (!signstr) {
3630
- signstr = this.extractHashSignature(
3631
- await api.bitcoin.signHash({
3632
- hash: hashHex,
3633
- pin: pinHash,
3634
- network: this.network.type,
3635
- ...email && { email }
3636
- })
3637
- );
3638
- }
3639
- if (!signstr) {
3640
- throw new BitcoinProviderError(
3641
- BitcoinErrorCode.INTERNAL_ERROR,
3642
- "Empty signature from sign/hash"
3643
- );
3644
- }
3645
- console.log("[BitcoinProvider] \u2705 Message signed successfully");
3646
- return signstr;
3647
- }
3648
- /** Encode integer as Bitcoin varint */
3649
- encodeVarint(n) {
3650
- if (n < 253)
3651
- return new Uint8Array([n]);
3652
- if (n <= 65535) {
3653
- const buf2 = new Uint8Array(3);
3654
- buf2[0] = 253;
3655
- buf2[1] = n & 255;
3656
- buf2[2] = n >> 8 & 255;
3657
- return buf2;
3658
- }
3659
- const buf = new Uint8Array(5);
3660
- buf[0] = 254;
3661
- buf[1] = n & 255;
3662
- buf[2] = n >> 8 & 255;
3663
- buf[3] = n >> 16 & 255;
3664
- buf[4] = n >> 24 & 255;
3665
- return buf;
3666
- }
3667
- /**
3668
- * High-level transaction sending (like Solana pattern)
3669
- * Creates, signs, and broadcasts transaction
3670
- *
3671
- * @param params - Transaction parameters
3672
- * @param params.toAddress - Recipient Bitcoin address
3673
- * @param params.amount - Amount in BTC (will be converted to satoshis)
3674
- * @returns Transaction hash
3675
- */
3676
- async sendTransaction(params) {
3677
- if (!this.wallet) {
3678
- throw new BitcoinProviderError(
3679
- BitcoinErrorCode.DISCONNECTED,
3680
- "Wallet not connected"
3681
- );
3682
- }
3683
- try {
3684
- await this.callInterceptor({
3685
- chain: "bitcoin",
3686
- method: "sendTransaction",
3687
- fromAddress: this.wallet.address,
3688
- toAddress: params.toAddress,
3689
- amount: String(params.amount),
3690
- symbol: "BTC",
3691
- network: this.network.type,
3692
- isNativeToken: true,
3693
- feeSymbol: "BTC"
3694
- });
3695
- console.log("[BitcoinProvider] \u{1F4B8} Starting high-level transaction...");
3696
- const pinHash = getCredentialManager().getPinHash();
3697
- if (!pinHash) {
3698
- throw new BitcoinProviderError(
3699
- BitcoinErrorCode.INTERNAL_ERROR,
3700
- "PIN hash not found. Please login again."
3701
- );
3702
- }
3703
- const email = this.getRecoveryEmail();
3704
- const satoshis = Math.floor(params.amount * 1e8);
3705
- const api = this.talkenApi || getTalkenApiClient7();
3706
- const result = await api.bitcoin.sendTransaction({
3707
- toAddress: params.toAddress,
3708
- amountSats: satoshis.toString(),
3709
- pin: pinHash,
3710
- ...email && { email }
3711
- });
3712
- console.log(
3713
- "[BitcoinProvider] \u2705 BTC transaction complete via TalkenApiClient:",
3714
- result.txHash
3715
- );
3716
- this.emit("transactionBroadcasted", {
3717
- txHash: result.txHash,
3718
- explorerUrl: `${this.network.explorer}/tx/${result.txHash}`
3719
- });
3720
- this.clearUtxoCache();
3721
- return result.txHash;
3722
- } catch (error) {
3723
- if (error.message?.includes("cancelled") || error.message?.includes("rejected")) {
3724
- console.log("[BitcoinProvider] \u2139\uFE0F User cancelled transaction");
3725
- throw new BitcoinProviderError(
3726
- BitcoinErrorCode.USER_REJECTED,
3727
- "User rejected transaction",
3728
- error
3729
- );
3730
- }
3731
- console.error("[BitcoinProvider] \u274C Transaction failed:", error.message);
3732
- if (error.message?.includes("insufficient")) {
3733
- throw new BitcoinProviderError(
3734
- BitcoinErrorCode.INSUFFICIENT_FUNDS,
3735
- "Insufficient BTC balance",
3736
- error
3737
- );
3738
- }
3739
- this.emit("error", error);
3740
- throw new BitcoinProviderError(
3741
- BitcoinErrorCode.INTERNAL_ERROR,
3742
- "Failed to send transaction",
3743
- error
3744
- );
3745
- }
3746
- }
3747
- /**
3748
- * Broadcast signed transaction to network
3749
- *
3750
- * @param rawTransaction - Raw transaction in hex format
3751
- * @param psbt - Optional finalized PSBT
3752
- * @returns Transaction hash
3753
- */
3754
- async broadcastTransaction(rawTransaction, psbt) {
3755
- if (!this.wallet) {
3756
- throw new BitcoinProviderError(
3757
- BitcoinErrorCode.DISCONNECTED,
3758
- "Wallet not connected"
3759
- );
3760
- }
3761
- try {
3762
- console.log("[BitcoinProvider] \u{1F4E1} Broadcasting transaction...");
3763
- if (psbt) {
3764
- console.log(
3765
- "[BitcoinProvider] \u2139\uFE0F PSBT argument provided; raw tx broadcast uses rawTransaction only via talken-api"
3766
- );
3767
- }
3768
- const api = this.talkenApi || getTalkenApiClient7();
3769
- const result = await api.bitcoin.broadcastRawTransaction({
3770
- network: this.network.type,
3771
- rawTransaction
3772
- });
3773
- console.log(
3774
- "[BitcoinProvider] \u2705 Transaction broadcasted:",
3775
- result.txHash
3776
- );
3777
- this.emit("transactionBroadcasted", {
3778
- txHash: result.txHash,
3779
- explorerUrl: `${this.network.explorer}/tx/${result.txHash}`
3780
- });
3781
- this.clearUtxoCache();
3782
- return result.txHash;
3783
- } catch (error) {
3784
- console.error(
3785
- "[BitcoinProvider] \u274C Transaction broadcast failed:",
3786
- error.message
3787
- );
3788
- this.emit("error", error);
3789
- throw new BitcoinProviderError(
3790
- BitcoinErrorCode.INTERNAL_ERROR,
3791
- "Failed to broadcast transaction",
3792
- error
3793
- );
3794
- }
3795
- }
3796
- /**
3797
- * Get wallet info
3798
- */
3799
- getWalletInfo() {
3800
- if (!this.wallet)
3801
- return null;
3802
- return {
3803
- address: this.wallet.address,
3804
- publicKey: this.wallet.publicKey,
3805
- addressType: this.wallet.addressType,
3806
- network: this.network.type
3807
- };
3808
- }
3809
- /**
3810
- * Refresh UTXO cache
3811
- */
3812
- async refreshUtxos() {
3813
- return this.getUtxos(true);
3814
- }
3815
- };
3816
-
3817
- // src/wallets/walletConnectors/abcWallet/abcBitcoinConnector.ts
3818
- import { getTalkenApiClient as getTalkenApiClient8 } from "@talken/talkenkit";
3819
- var AbcBitcoinConnector = class {
3820
- constructor(config) {
3821
- this.wallet = null;
3822
- this.connected = false;
3823
- // Event listeners
3824
- this.connectListeners = /* @__PURE__ */ new Set();
3825
- this.disconnectListeners = /* @__PURE__ */ new Set();
3826
- this.accountsChangedListeners = /* @__PURE__ */ new Set();
3827
- this.networkChangedListeners = /* @__PURE__ */ new Set();
3828
- this.provider = config.provider;
3829
- this.setupProviderListeners();
3830
- }
3831
- /**
3832
- * Setup provider event listeners
3833
- */
3834
- setupProviderListeners() {
3835
- this.provider.on("connect", () => {
3836
- this.connected = true;
3837
- if (this.wallet) {
3838
- for (const listener of this.connectListeners) {
3839
- listener(this.wallet);
3840
- }
3841
- }
3842
- });
3843
- this.provider.on("disconnect", () => {
3844
- this.connected = false;
3845
- this.wallet = null;
3846
- for (const listener of this.disconnectListeners) {
3847
- listener();
3848
- }
3849
- });
3850
- this.provider.on("accountsChanged", (accounts) => {
3851
- for (const listener of this.accountsChangedListeners) {
3852
- listener(accounts);
3853
- }
3854
- });
3855
- this.provider.on("networkChanged", (network) => {
3856
- for (const listener of this.networkChangedListeners) {
3857
- listener(network);
3858
- }
3859
- });
3860
- }
3861
- /**
3862
- * Connect Bitcoin wallet
3863
- */
3864
- async connect() {
3865
- try {
3866
- const authState = loadAuthState();
3867
- console.log("[BitcoinConnector] \u{1F527} connect() called:", {
3868
- hasAuthState: !!authState,
3869
- isAuthenticated: authState?.isAuthenticated,
3870
- hasBitcoinWallet: !!authState?.bitcoinWallet,
3871
- bitcoinAddress: authState?.bitcoinWallet?.address
3872
- });
3873
- if (!authState || !authState.isAuthenticated || !authState.bitcoinWallet) {
3874
- throw new Error("BITCOIN_LOGIN_REQUIRED");
3875
- }
3876
- this.wallet = authState.bitcoinWallet;
3877
- this.provider.setWallet(authState.bitcoinWallet);
3878
- console.log("[BitcoinConnector] \u2705 Wallet set:", {
3879
- address: authState.bitcoinWallet.address,
3880
- publicKey: authState.bitcoinWallet.publicKey,
3881
- addressType: authState.bitcoinWallet.addressType,
3882
- network: authState.bitcoinWallet.network
3883
- });
3884
- this.connected = true;
3885
- return {
3886
- address: authState.bitcoinWallet.address,
3887
- publicKey: authState.bitcoinWallet.publicKey,
3888
- network: authState.bitcoinWallet.network
3889
- };
3890
- } catch (error) {
3891
- if (error.message === "BITCOIN_LOGIN_REQUIRED") {
3892
- throw error;
3893
- }
3894
- console.error("[BitcoinConnector] \u274C connect error:", error);
3895
- throw error;
3896
- }
3897
- }
3898
- /**
3899
- * Disconnect Bitcoin wallet
3900
- */
3901
- async disconnect() {
3902
- try {
3903
- this.provider.clearWallet();
3904
- this.wallet = null;
3905
- this.connected = false;
3906
- console.log("[BitcoinConnector] \u2705 Wallet disconnected");
3907
- } catch (error) {
3908
- console.error("[BitcoinConnector] \u274C disconnect error:", error);
3909
- throw error;
3910
- }
3911
- }
3912
- /**
3913
- * Get Bitcoin address
3914
- */
3915
- async getAddress() {
3916
- return this.provider.getAddress();
3917
- }
3918
- /**
3919
- * Get compressed public key (33 bytes)
3920
- */
3921
- async getPublicKey() {
3922
- return this.provider.getPublicKey();
3923
- }
3924
- /**
3925
- * Get address type (bech32, p2pkh, etc.)
3926
- */
3927
- getAddressType() {
3928
- return this.provider.getAddressType();
3929
- }
3930
- /**
3931
- * Get UTXOs
3932
- */
3933
- async getUtxos(forceRefresh = false) {
3934
- return this.provider.getUtxos(forceRefresh);
3935
- }
3936
- /**
3937
- * Get balance (in satoshis)
3938
- */
3939
- async getBalance(forceRefresh = false) {
3940
- return this.provider.getBalance(forceRefresh);
3941
- }
3942
- /**
3943
- * Estimate transaction fee
3944
- */
3945
- async estimateFee(targetBlocks = 6) {
3946
- return this.provider.estimateFee(targetBlocks);
3947
- }
3948
- /**
3949
- * Sign Bitcoin message (BIP-322)
3950
- * NOTE: Currently not supported - Bitcoin uses v2 API which doesn't have message signing endpoint
3951
- */
3952
- async signMessage(message) {
3953
- return this.provider.signMessage(message);
3954
- }
3955
- /**
3956
- * Send Bitcoin transaction (high-level API)
3957
- * Creates, signs, and broadcasts transaction
3958
- */
3959
- async sendTransaction(params) {
3960
- return this.provider.sendTransaction(params);
3961
- }
3962
- /**
3963
- * Broadcast signed transaction to network (low-level API)
3964
- */
3965
- async broadcastTransaction(rawTransaction, psbt) {
3966
- return this.provider.broadcastTransaction(rawTransaction, psbt);
3967
- }
3968
- /**
3969
- * Check if authorized (has valid session)
3970
- */
3971
- async isAuthorized() {
3972
- try {
3973
- const authState = loadAuthState();
3974
- if (!authState || !authState.isAuthenticated) {
3975
- return false;
3976
- }
3977
- if (!authState.bitcoinWallet) {
3978
- return false;
3979
- }
3980
- const api = getTalkenApiClient8();
3981
- return !!api && !api.isTokenExpired();
3982
- } catch {
3983
- return false;
3984
- }
3985
- }
3986
- /**
3987
- * Check if connected
3988
- */
3989
- isConnected() {
3990
- return this.connected && this.provider.isConnected();
3991
- }
3992
- /**
3993
- * Get current wallet
3994
- */
3995
- getWallet() {
3996
- return this.wallet;
3997
- }
3998
- /**
3999
- * Get provider
4000
- */
4001
- getProvider() {
4002
- return this.provider;
4003
- }
4004
- /**
4005
- * Get wallet info
4006
- */
4007
- getWalletInfo() {
4008
- return this.provider.getWalletInfo();
4009
- }
4010
- /**
4011
- * Switch network
4012
- */
4013
- async switchNetwork(network) {
4014
- this.provider.setNetwork(network);
4015
- const authState = loadAuthState();
4016
- if (authState?.bitcoinWallet) {
4017
- authState.bitcoinWallet.network = network === "mainnet" ? "bitcoin" /* Mainnet */ : "bitcoin_testnet" /* Testnet */;
4018
- saveAuthState(authState);
4019
- }
4020
- console.log("[BitcoinConnector] \u{1F504} Network switched to:", network);
4021
- }
4022
- /**
4023
- * Get current network
4024
- */
4025
- getNetwork() {
4026
- return this.provider.getNetwork().type;
4027
- }
4028
- /**
4029
- * Refresh UTXO cache
4030
- */
4031
- async refreshUtxos() {
4032
- return this.provider.refreshUtxos();
4033
- }
4034
- on(event, listener) {
4035
- switch (event) {
4036
- case "connect":
4037
- this.connectListeners.add(listener);
4038
- break;
4039
- case "disconnect":
4040
- this.disconnectListeners.add(listener);
4041
- break;
4042
- case "accountsChanged":
4043
- this.accountsChangedListeners.add(listener);
4044
- break;
4045
- case "networkChanged":
4046
- this.networkChangedListeners.add(listener);
4047
- break;
4048
- }
4049
- }
4050
- off(event, listener) {
4051
- switch (event) {
4052
- case "connect":
4053
- this.connectListeners.delete(listener);
4054
- break;
4055
- case "disconnect":
4056
- this.disconnectListeners.delete(listener);
4057
- break;
4058
- case "accountsChanged":
4059
- this.accountsChangedListeners.delete(listener);
4060
- break;
4061
- case "networkChanged":
4062
- this.networkChangedListeners.delete(listener);
4063
- break;
4064
- }
4065
- }
4066
- /**
4067
- * Remove all listeners
4068
- */
4069
- removeAllListeners() {
4070
- this.connectListeners.clear();
4071
- this.disconnectListeners.clear();
4072
- this.accountsChangedListeners.clear();
4073
- this.networkChangedListeners.clear();
4074
- }
4075
- };
4076
- function createAbcBitcoinConnector(config) {
4077
- return new AbcBitcoinConnector(config);
4078
- }
4079
-
4080
- // src/wallets/walletConnectors/abcWallet/abcSolanaProvider.ts
4081
- import { getTalkenApiClient as getTalkenApiClient9 } from "@talken/talkenkit";
4082
- var EventEmitter3 = class {
4083
- constructor() {
4084
- this.events = /* @__PURE__ */ new Map();
4085
- }
4086
- on(event, listener) {
4087
- if (!this.events.has(event)) {
4088
- this.events.set(event, []);
4089
- }
4090
- this.events.get(event).push(listener);
4091
- return this;
4092
- }
4093
- off(event, listener) {
4094
- const listeners = this.events.get(event);
4095
- if (listeners) {
4096
- const index = listeners.indexOf(listener);
4097
- if (index !== -1) {
4098
- listeners.splice(index, 1);
4099
- }
4100
- }
4101
- return this;
4102
- }
4103
- removeListener(event, listener) {
4104
- return this.off(event, listener);
4105
- }
4106
- emit(event, ...args) {
4107
- const listeners = this.events.get(event);
4108
- if (listeners) {
4109
- for (const listener of listeners) {
4110
- listener(...args);
4111
- }
4112
- return true;
4113
- }
4114
- return false;
4115
- }
4116
- removeAllListeners(event) {
4117
- if (event) {
4118
- this.events.delete(event);
4119
- } else {
4120
- this.events.clear();
4121
- }
4122
- return this;
4123
- }
4124
- };
4125
- var SolanaErrorCode = {
4126
- USER_REJECTED: 4001,
4127
- UNAUTHORIZED: 4100,
4128
- UNSUPPORTED_METHOD: 4200,
4129
- DISCONNECTED: 4900,
4130
- INVALID_PARAMS: -32602,
4131
- INTERNAL_ERROR: -32603
4132
- };
4133
- var SolanaProviderError = class extends Error {
4134
- constructor(code, message, data) {
4135
- super(message);
4136
- this.code = code;
4137
- this.data = data;
4138
- this.name = "SolanaProviderError";
4139
- }
4140
- };
4141
- var AbcSolanaProvider = class extends EventEmitter3 {
4142
- constructor(talkenApi) {
4143
- super();
4144
- this.wallet = null;
4145
- this.connected = false;
4146
- this.talkenApi = talkenApi;
4147
- }
4148
- /**
4149
- * Set request interceptor for sign/transfer confirmation modals
4150
- */
4151
- setRequestInterceptor(interceptor) {
4152
- this.requestInterceptor = interceptor;
4153
- }
4154
- /**
4155
- * Call request interceptor if set (throws on user cancel)
4156
- */
4157
- async callInterceptor(request) {
4158
- if (this.requestInterceptor) {
4159
- await this.requestInterceptor(request);
4160
- }
4161
- }
4162
- /**
4163
- * Set wallet information
4164
- */
4165
- setWallet(wallet) {
4166
- const previousAddress = this.wallet?.address;
4167
- this.wallet = wallet;
4168
- this.connected = true;
4169
- if (previousAddress !== wallet.address) {
4170
- this.emit("accountsChanged", [wallet.address]);
4171
- }
4172
- this.emit("connect", {
4173
- address: wallet.address,
4174
- network: wallet.network
4175
- });
4176
- }
4177
- /**
4178
- * Clear wallet (disconnect)
4179
- */
4180
- clearWallet() {
4181
- this.wallet = null;
4182
- this.connected = false;
4183
- this.emit("disconnect");
4184
- this.emit("accountsChanged", []);
4185
- }
4186
- /**
4187
- * Set TalkenApiClient for backend-proxied transaction flow
4188
- * When set, native SOL transfers will use a single API call instead of multi-step WaaS
4189
- */
4190
- setTalkenApi(talkenApi) {
4191
- this.talkenApi = talkenApi;
4192
- }
4193
- getTalkenApiClientOrThrow() {
4194
- const api = this.talkenApi || getTalkenApiClient9();
4195
- if (!api) {
4196
- throw new SolanaProviderError(
4197
- SolanaErrorCode.INTERNAL_ERROR,
4198
- "TalkenApiClient not initialized"
4199
- );
4200
- }
4201
- return api;
4202
- }
4203
- getSigningNetwork() {
4204
- return this.wallet?.network === "solana" ? "solana" : "solana_devnet";
4205
- }
4206
- /**
4207
- * Check if connected
4208
- */
4209
- isConnected() {
4210
- return this.connected && this.wallet !== null;
4211
- }
4212
- /**
4213
- * Get Solana address
4214
- */
4215
- async getAddress() {
4216
- if (!this.wallet) {
4217
- throw new SolanaProviderError(
4218
- SolanaErrorCode.DISCONNECTED,
4219
- "Wallet not connected"
4220
- );
4221
- }
4222
- return this.wallet.address;
4223
- }
4224
- /**
4225
- * Get public key
4226
- */
4227
- async getPublicKey() {
4228
- if (!this.wallet) {
4229
- throw new SolanaProviderError(
4230
- SolanaErrorCode.DISCONNECTED,
4231
- "Wallet not connected"
4232
- );
4233
- }
4234
- return this.wallet.publicKey;
4235
- }
4236
- /**
4237
- * Sign Solana message (no PIN required)
4238
- * Uses encrypted_share which doesn't require PIN
4239
- */
4240
- async signMessage(encodedMessage, _display) {
4241
- if (!this.wallet) {
4242
- throw new SolanaProviderError(
4243
- SolanaErrorCode.DISCONNECTED,
4244
- "Wallet not connected"
4245
- );
4246
- }
4247
- try {
4248
- const decodedText = new TextDecoder().decode(encodedMessage);
4249
- await this.callInterceptor({
4250
- chain: "solana",
4251
- method: "signMessage",
4252
- address: this.wallet.address,
4253
- network: this.wallet.network,
4254
- message: decodedText
4255
- });
4256
- const messageHex = `0x${Array.from(encodedMessage).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
4257
- const result = await this.getTalkenApiClientOrThrow().solana.sign({
4258
- message: messageHex,
4259
- encryptedShare: this.wallet.encryptedShare,
4260
- keyId: this.wallet.keyId,
4261
- secretStore: this.wallet.secretStore || "",
4262
- network: this.getSigningNetwork()
4263
- });
4264
- const signatureHex = result.signature.startsWith("0x") ? result.signature.slice(2) : result.signature;
4265
- const signatureBytes = new Uint8Array(
4266
- signatureHex.match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || []
4267
- );
4268
- return { signature: signatureBytes };
4269
- } catch (error) {
4270
- this.emit("error", error);
4271
- throw new SolanaProviderError(
4272
- SolanaErrorCode.INTERNAL_ERROR,
4273
- "Failed to sign message",
4274
- error
4275
- );
4276
- }
4277
- }
4278
- /**
4279
- * Sign arbitrary Solana transaction (requires PIN)
4280
- * Supports both Legacy Transaction and VersionedTransaction
4281
- * Used for custom transactions, dApp interactions, and protocol integrations
4282
- */
4283
- async signTransaction(transaction) {
4284
- if (!this.wallet) {
4285
- throw new SolanaProviderError(
4286
- SolanaErrorCode.DISCONNECTED,
4287
- "Wallet not connected"
4288
- );
4289
- }
4290
- try {
4291
- let txMessage = "";
4292
- try {
4293
- txMessage = JSON.stringify(transaction, null, 2);
4294
- } catch {
4295
- txMessage = String(transaction);
4296
- }
4297
- await this.callInterceptor({
4298
- chain: "solana",
4299
- method: "signTransaction",
4300
- address: this.wallet.address,
4301
- network: this.wallet.network,
4302
- message: txMessage,
4303
- isTransaction: true
4304
- });
4305
- const { VersionedTransaction, PublicKey } = await import("@solana/web3.js");
4306
- const isVersioned = transaction instanceof VersionedTransaction;
4307
- let serialized;
4308
- if (isVersioned) {
4309
- serialized = transaction.message.serialize();
4310
- } else {
4311
- serialized = transaction.serializeMessage();
4312
- }
4313
- const messageHex = Buffer.from(serialized).toString("hex");
4314
- const signatureResponse = await this.getTalkenApiClientOrThrow().solana.sign({
4315
- keyId: this.wallet.keyId,
4316
- encryptedShare: this.wallet.encryptedShare,
4317
- secretStore: this.wallet.secretStore || "",
4318
- message: messageHex,
4319
- network: this.getSigningNetwork()
4320
- });
4321
- const signatureHex = signatureResponse.signature.startsWith("0x") ? signatureResponse.signature.slice(2) : signatureResponse.signature;
4322
- const signatureBytes = Buffer.from(signatureHex, "hex");
4323
- const publicKey = new PublicKey(this.wallet.address);
4324
- if (isVersioned) {
4325
- transaction.addSignature(publicKey, signatureBytes);
4326
- } else {
4327
- transaction.addSignature(publicKey, signatureBytes);
4328
- }
4329
- return transaction;
4330
- } catch (error) {
4331
- if (error.code === 4001 || error.cancelled) {
4332
- throw error;
4333
- }
4334
- this.emit("error", error);
4335
- throw new SolanaProviderError(
4336
- SolanaErrorCode.INTERNAL_ERROR,
4337
- "Failed to sign transaction",
4338
- error
4339
- );
4340
- }
4341
- }
4342
- /**
4343
- * Sign multiple transactions (batch signing)
4344
- */
4345
- async signAllTransactions(transactions) {
4346
- const signedTransactions = [];
4347
- for (const transaction of transactions) {
4348
- const signed = await this.signTransaction(transaction);
4349
- signedTransactions.push(signed);
4350
- }
4351
- return signedTransactions;
4352
- }
4353
- /**
4354
- * Unified transfer: SOL, SPL token, or NFT
4355
- * - No mintAddress → native SOL transfer (kind='native')
4356
- * - With mintAddress → SPL/NFT transfer (kind='spl')
4357
- * - NFT = transfer({ mintAddress, toAddress, amount: 1 })
4358
- */
4359
- async transfer(params) {
4360
- if (!this.wallet) {
4361
- throw new SolanaProviderError(
4362
- SolanaErrorCode.DISCONNECTED,
4363
- "Wallet not connected"
4364
- );
4365
- }
4366
- try {
4367
- const symbol = params.mintAddress ? "SPL" : "SOL";
4368
- await this.callInterceptor({
4369
- chain: "solana",
4370
- method: "transfer",
4371
- fromAddress: this.wallet.address,
4372
- toAddress: params.toAddress,
4373
- amount: String(params.amount),
4374
- symbol,
4375
- network: this.wallet.network,
4376
- tokenAddress: params.mintAddress,
4377
- isNativeToken: !params.mintAddress,
4378
- feeSymbol: "SOL"
4379
- });
4380
- const pinHash = getCredentialManager().getPinHash();
4381
- if (!pinHash) {
4382
- throw new SolanaProviderError(
4383
- SolanaErrorCode.INTERNAL_ERROR,
4384
- "PIN hash not found. Please login again."
4385
- );
4386
- }
4387
- console.log("[AbcSolanaProvider] transfer START", {
4388
- kind: params.mintAddress ? "spl" : "native",
4389
- toAddress: params.toAddress,
4390
- amount: params.amount,
4391
- mintAddress: params.mintAddress || null,
4392
- network: this.wallet.network,
4393
- hasPinHash: !!pinHash
4394
- });
4395
- const api = this.getTalkenApiClientOrThrow();
4396
- if (params.mintAddress) {
4397
- const apiNetwork = this.wallet.network === "solana" ? "solana_mainnet" : this.wallet.network;
4398
- const { PublicKey, Connection } = await import("@solana/web3.js");
4399
- const connection = new Connection(this.getRpcUrl(), "confirmed");
4400
- const mintPubkey = new PublicKey(params.mintAddress);
4401
- const mintInfo = await connection.getParsedAccountInfo(mintPubkey);
4402
- const decimals = mintInfo.value?.data?.parsed?.info?.decimals || 9;
4403
- const rawAmount = Math.floor(params.amount * 10 ** decimals);
4404
- const result2 = await api.solana.transfer({
4405
- kind: "spl",
4406
- toAddress: params.toAddress,
4407
- mintAddress: params.mintAddress,
4408
- amount: String(rawAmount),
4409
- decimals,
4410
- network: apiNetwork,
4411
- pin: pinHash
4412
- });
4413
- console.log("[AbcSolanaProvider] SPL transfer result:", result2);
4414
- return { signature: result2.txHash };
4415
- }
4416
- const { LAMPORTS_PER_SOL } = await import("@solana/web3.js");
4417
- const amountLamports = params.amount * LAMPORTS_PER_SOL;
4418
- console.log("[AbcSolanaProvider] native transfer request:", {
4419
- toAddress: params.toAddress,
4420
- amountLamports: String(amountLamports),
4421
- amountSOL: params.amount
4422
- });
4423
- const result = await api.solana.transfer({
4424
- kind: "native",
4425
- toAddress: params.toAddress,
4426
- amountLamports: String(amountLamports),
4427
- pin: pinHash
4428
- });
4429
- console.log("[AbcSolanaProvider] native transfer result:", result);
4430
- return { signature: result.txHash };
4431
- } catch (error) {
4432
- console.error("[AbcSolanaProvider] transfer FAILED:", {
4433
- message: error.message,
4434
- code: error.code,
4435
- status: error.status,
4436
- details: error.details || error.data
4437
- });
4438
- if (error.code === 4001 || error.cancelled) {
4439
- throw error;
4440
- }
4441
- this.emit("error", error);
4442
- throw new SolanaProviderError(
4443
- SolanaErrorCode.INTERNAL_ERROR,
4444
- "Failed to transfer",
4445
- error
4446
- );
4447
- }
4448
- }
4449
- /**
4450
- * Get wallet info
4451
- */
4452
- getWalletInfo() {
4453
- if (!this.wallet)
4454
- return null;
4455
- return {
4456
- address: this.wallet.address,
4457
- publicKey: this.wallet.publicKey,
4458
- network: this.wallet.network
4459
- };
4460
- }
4461
- /**
4462
- * Get SPL token balance
4463
- *
4464
- * @param mintAddress - Token mint address
4465
- * @returns Token balance information
4466
- */
4467
- async getTokenBalance(mintAddress) {
4468
- if (!this.wallet) {
4469
- throw new SolanaProviderError(
4470
- SolanaErrorCode.DISCONNECTED,
4471
- "Wallet not connected"
4472
- );
4473
- }
4474
- try {
4475
- const { PublicKey, Connection } = await import("@solana/web3.js");
4476
- const { getAssociatedTokenAddress, TOKEN_PROGRAM_ID } = await import("@solana/spl-token");
4477
- const connection = new Connection(this.getRpcUrl(), "confirmed");
4478
- const mintPubkey = new PublicKey(mintAddress);
4479
- const ownerPubkey = new PublicKey(this.wallet.address);
4480
- const tokenAccount = await getAssociatedTokenAddress(
4481
- mintPubkey,
4482
- ownerPubkey,
4483
- false,
4484
- TOKEN_PROGRAM_ID
4485
- );
4486
- const balance = await connection.getTokenAccountBalance(tokenAccount);
4487
- return {
4488
- amount: balance.value.amount,
4489
- decimals: balance.value.decimals,
4490
- uiAmount: balance.value.uiAmount || 0
4491
- };
4492
- } catch (error) {
4493
- this.emit("error", error);
4494
- throw new SolanaProviderError(
4495
- SolanaErrorCode.INTERNAL_ERROR,
4496
- "Failed to get token balance",
4497
- error
4498
- );
4499
- }
4500
- }
4501
- /**
4502
- * Get RPC URL based on network
4503
- */
4504
- getRpcUrl() {
4505
- const isMainnet = this.wallet?.network === "solana";
4506
- 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";
4507
- }
4508
- };
4509
-
4510
- // src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
4511
- import { getTalkenApiClient as getTalkenApiClient10 } from "@talken/talkenkit";
4512
- function isTalkenApiClient2(client) {
4513
- return typeof client?.tron?.transferTrx === "function";
4514
- }
4515
- var TronErrorCode = {
4516
- USER_REJECTED: 4001,
4517
- UNAUTHORIZED: 4100,
4518
- UNSUPPORTED_METHOD: 4200,
4519
- DISCONNECTED: 4900,
4520
- INVALID_PARAMS: -32602,
4521
- INTERNAL_ERROR: -32603,
4522
- INSUFFICIENT_FUNDS: 5001
4523
- };
4524
- var TronProviderError = class extends Error {
4525
- constructor(code, message, data) {
4526
- super(message);
4527
- this.code = code;
4528
- this.data = data;
4529
- this.name = "TronProviderError";
4530
- }
4531
- };
4532
- var TRON_NETWORKS = {
4533
- mainnet: {
4534
- name: "TRON Mainnet",
4535
- type: "tron",
4536
- explorer: "https://tronscan.org"
4537
- },
4538
- nile: {
4539
- name: "TRON Nile Testnet",
4540
- type: "tron_nile",
4541
- explorer: "https://nile.tronscan.org"
4542
- }
4543
- };
4544
- var EventEmitter4 = class {
4545
- constructor() {
4546
- this.events = /* @__PURE__ */ new Map();
4547
- }
4548
- on(event, listener) {
4549
- if (!this.events.has(event)) {
4550
- this.events.set(event, []);
4551
- }
4552
- this.events.get(event).push(listener);
4553
- return this;
4554
- }
4555
- off(event, listener) {
4556
- const listeners = this.events.get(event);
4557
- if (listeners) {
4558
- const index = listeners.indexOf(listener);
4559
- if (index !== -1) {
4560
- listeners.splice(index, 1);
4561
- }
4562
- }
4563
- return this;
4564
- }
4565
- emit(event, ...args) {
4566
- const listeners = this.events.get(event);
4567
- if (listeners) {
4568
- for (const listener of listeners) {
4569
- listener(...args);
4570
- }
4571
- return true;
4572
- }
4573
- return false;
4574
- }
4575
- removeAllListeners(event) {
4576
- if (event) {
4577
- this.events.delete(event);
4578
- } else {
4579
- this.events.clear();
4580
- }
4581
- return this;
4582
- }
4583
- };
4584
- var AbcTronProvider = class extends EventEmitter4 {
4585
- constructor(client) {
4586
- super();
4587
- this.wallet = null;
4588
- this.network = TRON_NETWORKS.mainnet;
4589
- this.connected = false;
4590
- this.tokenMetadataCache = /* @__PURE__ */ new Map();
4591
- if (isTalkenApiClient2(client)) {
4592
- this.talkenApi = client;
4593
- }
4594
- }
4595
- /**
4596
- * Set request interceptor for transfer confirmation modals
4597
- */
4598
- setRequestInterceptor(interceptor) {
4599
- this.requestInterceptor = interceptor;
4600
- }
4601
- /**
4602
- * Call request interceptor if set (throws on user cancel)
4603
- */
4604
- async callInterceptor(request) {
4605
- if (this.requestInterceptor) {
4606
- await this.requestInterceptor(request);
4607
- }
4608
- }
4609
- /**
4610
- * Set wallet information
4611
- */
4612
- setWallet(wallet) {
4613
- const previousAddress = this.wallet?.address;
4614
- this.wallet = wallet;
4615
- this.connected = true;
4616
- if (wallet.network === "tron") {
4617
- this.network = TRON_NETWORKS.mainnet;
4618
- } else {
4619
- this.network = TRON_NETWORKS.nile;
4620
- }
4621
- if (previousAddress !== wallet.address) {
4622
- this.emit("accountsChanged", [wallet.address]);
4623
- }
4624
- this.emit("connect", {
4625
- address: wallet.address,
4626
- network: this.network.type
4627
- });
4628
- console.log(
4629
- "[TronProvider] \u2705 Wallet connected:",
4630
- `${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 6)}`
4631
- );
4632
- }
4633
- /**
4634
- * Clear wallet (disconnect)
4635
- */
4636
- clearWallet() {
4637
- this.wallet = null;
4638
- this.connected = false;
4639
- this.emit("disconnect");
4640
- this.emit("accountsChanged", []);
4641
- console.log("[TronProvider] \u{1F50C} Wallet disconnected");
4642
- }
4643
- /**
4644
- * Set TalkenApiClient for backend-proxied transaction flow
4645
- * When set, sendTransaction will use a single API call instead of multi-step WaaS
4646
- */
4647
- setTalkenApi(talkenApi) {
4648
- this.talkenApi = talkenApi;
4649
- }
4650
- /**
4651
- * Fetch token metadata (symbol, logo) from walletscan API with caching.
4652
- * Falls back to 'TRX'/'TRC20' on failure.
4653
- */
4654
- async fetchTokenMetadata(contractAddress) {
4655
- const cacheKey = contractAddress || "__native__";
4656
- const cached = this.tokenMetadataCache.get(cacheKey);
4657
- if (cached)
4658
- return cached;
4659
- try {
4660
- const api = this.talkenApi || getTalkenApiClient10();
4661
- const chainKeys = this.network.type === "tron_nile" ? "tronNile" : "tron";
4662
- let tokens;
4663
- if (contractAddress) {
4664
- tokens = await api.walletscan.getToken({ chainKeys, contractAddress });
4665
- } else {
4666
- tokens = await api.walletscan.getNativeTokens({
4667
- chainKeys,
4668
- walletAddress: this.wallet.address
4669
- });
4670
- }
4671
- if (tokens.length > 0) {
4672
- const info = { symbol: tokens[0].symbol, logo: tokens[0].logo };
4673
- this.tokenMetadataCache.set(cacheKey, info);
4674
- return info;
4675
- }
4676
- } catch {
4677
- }
4678
- return { symbol: contractAddress ? "TRC20" : "TRX" };
4679
- }
4680
- /**
4681
- * Check if connected
4682
- */
4683
- isConnected() {
4684
- return this.connected && this.wallet !== null;
4685
- }
4686
- /**
4687
- * Get TRON address
4688
- */
4689
- async getAddress() {
4690
- if (!this.wallet) {
4691
- throw new TronProviderError(
4692
- TronErrorCode.DISCONNECTED,
4693
- "Wallet not connected"
4694
- );
4695
- }
4696
- return this.wallet.address;
4697
- }
4698
- /**
4699
- * Get public key
4700
- */
4701
- async getPublicKey() {
4702
- if (!this.wallet) {
4703
- throw new TronProviderError(
4704
- TronErrorCode.DISCONNECTED,
4705
- "Wallet not connected"
4706
- );
4707
- }
4708
- return this.wallet.publicKey;
4709
- }
4710
- /**
4711
- * Get current network
4712
- */
4713
- getNetwork() {
4714
- return this.network;
4715
- }
4716
- /**
4717
- * Sign TRON message (not supported)
4718
- */
4719
- async signMessage(_message) {
4720
- throw new TronProviderError(
4721
- TronErrorCode.UNSUPPORTED_METHOD,
4722
- "TRON message signing is not supported. Use sendTransaction() instead."
4723
- );
4724
- }
4725
- /**
4726
- * Send TRON transaction (TRX native or TRC20)
4727
- * Complete flow: create unsigned tx -> request PIN -> sign -> broadcast
4728
- *
4729
- * @param params - Transaction parameters
4730
- * @returns Transaction hash
4731
- */
4732
- async sendTransaction(params) {
4733
- if (!this.wallet) {
4734
- throw new TronProviderError(
4735
- TronErrorCode.DISCONNECTED,
4736
- "Wallet not connected"
4737
- );
4738
- }
4739
- try {
4740
- const tokenMetadata = await this.fetchTokenMetadata(
4741
- params.contractAddress
4742
- );
4743
- await this.callInterceptor({
4744
- chain: "tron",
4745
- method: "sendTransaction",
4746
- fromAddress: this.wallet.address,
4747
- toAddress: params.toAddress,
4748
- amount: params.amount,
4749
- symbol: tokenMetadata.symbol,
4750
- network: this.network.type,
4751
- tokenAddress: params.contractAddress,
4752
- isNativeToken: !params.contractAddress,
4753
- feeSymbol: "TRX",
4754
- tokenLogo: tokenMetadata.logo
4755
- });
4756
- console.log("[TronProvider] \u{1F4B8} Starting TRON transaction...");
4757
- const pinHash = getCredentialManager().getPinHash();
4758
- if (!pinHash) {
4759
- throw new TronProviderError(
4760
- TronErrorCode.INTERNAL_ERROR,
4761
- "PIN hash not found. Please login again."
4762
- );
4763
- }
4764
- const txType = params.contractAddress ? "TRC20" : "NATIVE";
4765
- let amountRaw;
4766
- if (txType === "NATIVE") {
4767
- amountRaw = Math.floor(
4768
- Number.parseFloat(params.amount) * 1e6
4769
- ).toString();
4770
- console.log(
4771
- `[TronProvider] Converting ${params.amount} TRX -> ${amountRaw} SUN`
4772
- );
4773
- } else {
4774
- const decimals = params.decimals ?? 6;
4775
- amountRaw = Math.floor(
4776
- Number.parseFloat(params.amount) * 10 ** decimals
4777
- ).toString();
4778
- console.log(
4779
- `[TronProvider] Converting ${params.amount} -> ${amountRaw} (decimals: ${decimals})`
4780
- );
4781
- }
4782
- const email = getCredentialManager().getEmail() || void 0;
4783
- const api = this.talkenApi || getTalkenApiClient10();
4784
- const request = txType === "NATIVE" ? {
4785
- kind: "native",
4786
- network: this.network.type,
4787
- toAddress: params.toAddress,
4788
- amountSun: amountRaw,
4789
- pin: pinHash,
4790
- ...email && { email }
4791
- } : {
4792
- kind: "trc20",
4793
- network: this.network.type,
4794
- toAddress: params.toAddress,
4795
- contractAddress: params.contractAddress,
4796
- amount: amountRaw,
4797
- feeLimit: params.feeLimit,
4798
- pin: pinHash,
4799
- ...email && { email }
4800
- };
4801
- const result = await api.tron.transferTrx(request);
4802
- const txHash = result.txHash;
4803
- console.log(
4804
- `[TronProvider] \u2705 ${txType === "NATIVE" ? "TRX" : "TRC-20"} transaction complete via TalkenApiClient:`,
4805
- txHash
4806
- );
4807
- this.emit("transactionBroadcasted", {
4808
- txHash,
4809
- explorerUrl: `${this.network.explorer}/#/transaction/${txHash}`
4810
- });
4811
- return txHash;
4812
- } catch (error) {
4813
- if (error.message?.includes("cancelled") || error.message?.includes("rejected")) {
4814
- console.log("[TronProvider] \u2139\uFE0F User cancelled transaction");
4815
- throw new TronProviderError(
4816
- TronErrorCode.USER_REJECTED,
4817
- "User rejected transaction",
4818
- error
4819
- );
4820
- }
4821
- console.error("[TronProvider] \u274C Transaction failed:", error.message);
4822
- if (error.message?.includes("insufficient")) {
4823
- throw new TronProviderError(
4824
- TronErrorCode.INSUFFICIENT_FUNDS,
4825
- "Insufficient TRX balance",
4826
- error
4827
- );
4828
- }
4829
- this.emit("error", error);
4830
- throw new TronProviderError(
4831
- TronErrorCode.INTERNAL_ERROR,
4832
- error.message || "Failed to send TRON transaction",
4833
- error
4834
- );
4835
- }
4836
- }
4837
- /**
4838
- * Get wallet info
4839
- */
4840
- getWalletInfo() {
4841
- if (!this.wallet)
4842
- return null;
4843
- return {
4844
- address: this.wallet.address,
4845
- publicKey: this.wallet.publicKey,
4846
- network: this.network.type
4847
- };
4848
- }
4849
- };
4850
-
4851
- // src/wallets/walletConnectors/abcWallet/walletGeneration.ts
4852
- import { getTalkenApiClient as getTalkenApiClient11 } from "@talken/talkenkit";
4853
- function mapApiResponseToWallets(genResponse, infoResponse, email) {
4854
- const accounts = infoResponse?.accounts || [];
4855
- const evmAccount = accounts[0] || infoResponse || {};
4856
- const uid = String(genResponse.uid || evmAccount.uid || "");
4857
- const wid = String(genResponse.wid || evmAccount.wid || "");
4858
- const sid = String(evmAccount.sid || evmAccount.ethAddress || genResponse.evmAddress || "");
4859
- const pubkey = String(evmAccount.pubkey || genResponse.pubkey || "");
4860
- const solMaterial = genResponse.solana || {};
4861
- const evmWallet = {
4862
- uid,
4863
- sessionId: sid,
4864
- keyId: wid,
4865
- encryptedShare: String(evmAccount.pvencstr || ""),
4866
- secretStore: String(evmAccount.encryptDevicePassword || ""),
4867
- address: genResponse.evmAddress || sid,
4868
- chainId: getEvmNetwork(),
4869
- sid,
4870
- type: "evm",
4871
- email,
4872
- pubkey
4873
- };
4874
- const solanaWallet = {
4875
- uid,
4876
- sessionId: String(solMaterial.shareId || ""),
4877
- keyId: String(solMaterial.keyId || ""),
4878
- encryptedShare: String(solMaterial.encryptedShare || ""),
4879
- secretStore: String(solMaterial.secretStore || ""),
4880
- shareId: String(solMaterial.shareId || ""),
4881
- publicKey: String(solMaterial.publicKey || ""),
4882
- address: genResponse.solAddress || solMaterial.address || "",
4883
- network: getSolanaNetwork()
4884
- };
4885
- const bitcoinWallet = {
4886
- uid,
4887
- sessionId: sid,
4888
- keyId: wid,
4889
- encryptedShare: String(evmAccount.pvencstr || ""),
4890
- shareId: sid,
4891
- publicKey: pubkey,
4892
- address: genResponse.btcAddress || "",
4893
- addressType: "bech32",
4894
- network: getBitcoinNetwork()
4895
- };
4896
- const tronWallet = {
4897
- uid,
4898
- sessionId: sid,
4899
- keyId: wid,
4900
- encryptedShare: String(evmAccount.pvencstr || ""),
4901
- shareId: sid,
4902
- publicKey: pubkey,
4903
- address: genResponse.trxAddress || "",
4904
- network: getTronNetwork()
4905
- };
4906
- return { evmWallet, solanaWallet, bitcoinWallet, tronWallet };
4907
- }
4908
- async function generateMpcWallets(hashedPin, email) {
4909
- const api = getTalkenApiClient11();
4910
- if (!api) {
4911
- throw new AbcError(
4912
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4913
- "TalkenApiClient not initialized"
4914
- );
4915
- }
4916
- try {
4917
- const genResponse = await api.wallet.generate(hashedPin, email);
4918
- const infoResponse = await api.wallet.getInfo().catch(() => ({}));
4919
- return mapApiResponseToWallets(genResponse, infoResponse, email || "");
4920
- } catch (error) {
4921
- throw new AbcError(
4922
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4923
- `Failed to generate MPC wallets: ${error.message}`,
4924
- { originalError: error }
4925
- );
4926
- }
4927
- }
4928
- async function recoverMpcWallets(hashedPin, email) {
4929
- const api = getTalkenApiClient11();
4930
- if (!api) {
4931
- throw new AbcError(
4932
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4933
- "TalkenApiClient not initialized"
4934
- );
4935
- }
4936
- try {
4937
- const genResponse = await api.wallet.recover(hashedPin, email);
4938
- const infoResponse = await api.wallet.getInfo().catch(() => ({}));
4939
- return mapApiResponseToWallets(genResponse, infoResponse, email || "");
4940
- } catch (error) {
4941
- throw new AbcError(
4942
- "WALLET_NOT_FOUND" /* WALLET_NOT_FOUND */,
4943
- `Failed to recover MPC wallets: ${error.message}`,
4944
- { originalError: error }
4945
- );
4946
- }
4947
- }
4948
- function validateMpcWallets(result) {
4949
- const errors = [];
4950
- if (!result.evmWallet) {
4951
- errors.push("EVM wallet is missing");
4952
- } else {
4953
- if (!result.evmWallet.address || !result.evmWallet.address.startsWith("0x")) {
4954
- errors.push("Invalid EVM wallet address");
4955
- }
4956
- }
4957
- if (!result.solanaWallet) {
4958
- errors.push("Solana wallet is missing");
4959
- } else {
4960
- if (!result.solanaWallet.address) {
4961
- errors.push("Invalid Solana wallet address");
4962
- }
4963
- }
4964
- if (!result.bitcoinWallet) {
4965
- errors.push("Bitcoin wallet is missing");
4966
- } else {
4967
- if (!result.bitcoinWallet.address) {
4968
- errors.push("Invalid Bitcoin wallet address");
4969
- }
4970
- }
4971
- if (!result.tronWallet) {
4972
- errors.push("TRON wallet is missing");
4973
- } else {
4974
- if (!result.tronWallet.address) {
4975
- errors.push("Invalid TRON wallet address");
4976
- } else if (!result.tronWallet.address.startsWith("T")) {
4977
- errors.push("Invalid TRON address format (expected T prefix)");
4978
- }
4979
- }
4980
- return {
4981
- valid: errors.length === 0,
4982
- errors
4983
- };
4984
- }
4985
-
4986
- export {
4987
- AbcStorageKey,
4988
- AbcErrorCode,
4989
- AbcError,
4990
- hashPin,
4991
- validatePin,
4992
- validateEmail,
4993
- getStorageKey,
4994
- saveToStorage,
4995
- loadFromStorage,
4996
- removeFromStorage,
4997
- clearStorage,
4998
- isTokenExpired,
4999
- calculateExpiryTimestamp,
5000
- saveAuthState,
5001
- loadAuthState,
5002
- clearAuthState,
5003
- createAbcError,
5004
- hexToNumber,
5005
- numberToHex,
5006
- NetworkType,
5007
- NETWORK_CONFIGS,
5008
- NETWORK_BY_PARAM,
5009
- getNetworkByChainId,
5010
- getNetworkByParam,
5011
- chainIdToNetwork,
5012
- getNetworkName,
5013
- networkNameToChainKey,
5014
- networkToChainId,
5015
- getExplorerTxUrl,
5016
- getExplorerAddressUrl,
5017
- isEvmNetwork,
5018
- isTestnet,
5019
- getSupportedChainIds,
5020
- getSupportedNetworks,
5021
- AbcEvmProvider,
5022
- createAbcEvmProvider,
5023
- createAbcProvider,
5024
- TalkenApiClient,
5025
- createTalkenApiClient,
5026
- setTalkenApiClient,
5027
- getTalkenApiClient2 as getTalkenApiClient,
5028
- SolanaNetwork,
5029
- BitcoinNetwork,
5030
- TronNetwork,
5031
- getEvmNetwork,
5032
- getSolanaNetwork,
5033
- getBitcoinNetwork,
5034
- getTronNetwork,
5035
- resolveTalkenApiUrl,
5036
- abcConnector,
5037
- abcWallet,
5038
- WalletscanApi,
5039
- GasApi,
5040
- SessionExpiredError,
5041
- dispatchSessionExpired,
5042
- handleUnauthorizedResponse,
5043
- fetchWithSessionCheck,
5044
- refreshAccessToken,
5045
- BitcoinProviderError,
5046
- BITCOIN_NETWORKS,
5047
- AbcBitcoinProvider,
5048
- AbcBitcoinConnector,
5049
- createAbcBitcoinConnector,
5050
- SolanaProviderError,
5051
- AbcSolanaProvider,
5052
- TronProviderError,
5053
- TRON_NETWORKS,
5054
- AbcTronProvider,
5055
- generateMpcWallets,
5056
- recoverMpcWallets,
5057
- validateMpcWallets
5058
- };