@talken/talkenkit 2.4.23 → 2.4.25

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 (267) hide show
  1. package/dist/AbcCredentialManager-DDHLW2IH.js +7 -0
  2. package/dist/AbcCredentialManager-E723A55X.js +7 -0
  3. package/dist/AbcCredentialManager-GUV5JQ2V.js +7 -0
  4. package/dist/AbcCredentialManager-Z7GDJHYR.js +7 -0
  5. package/dist/abcWallet-3PWHJXWR.js +181 -0
  6. package/dist/abcWallet-3XPV7ATY.js +185 -0
  7. package/dist/abcWallet-3XSSUDLJ.js +155 -0
  8. package/dist/abcWallet-53HAU4MH.js +155 -0
  9. package/dist/abcWallet-5B2YHZGY.js +155 -0
  10. package/dist/abcWallet-664AHBNM.js +183 -0
  11. package/dist/abcWallet-BV7HK3OX.js +181 -0
  12. package/dist/abcWallet-CRKQ3O6J.js +155 -0
  13. package/dist/abcWallet-H4JOSC4N.js +155 -0
  14. package/dist/abcWallet-HM7KZIMP.js +155 -0
  15. package/dist/abcWallet-I5DVALAS.js +155 -0
  16. package/dist/abcWallet-IF3EOKHC.js +183 -0
  17. package/dist/abcWallet-IUG22ZE3.js +155 -0
  18. package/dist/abcWallet-IYC3CKEO.js +155 -0
  19. package/dist/abcWallet-JE6UR4QF.js +181 -0
  20. package/dist/abcWallet-KPKVEGNP.js +185 -0
  21. package/dist/abcWallet-MWUFO3JQ.js +161 -0
  22. package/dist/abcWallet-MZAL5NXP.js +181 -0
  23. package/dist/abcWallet-N2UADRNR.js +155 -0
  24. package/dist/abcWallet-OGHORNUW.js +181 -0
  25. package/dist/abcWallet-OL47MLVO.js +161 -0
  26. package/dist/abcWallet-QSK6VJFU.js +181 -0
  27. package/dist/abcWallet-RKT3W3FX.js +155 -0
  28. package/dist/abcWallet-VHXTAARP.js +155 -0
  29. package/dist/abcWallet-VYU3TEGJ.js +161 -0
  30. package/dist/abcWallet-WZGXGXUA.js +161 -0
  31. package/dist/abcWallet-YFYTW2JH.js +155 -0
  32. package/dist/abcWallet-ZPVQY4XE.js +155 -0
  33. package/dist/chunk-2OHX4KTB.js +5382 -0
  34. package/dist/chunk-3VPMUBCL.js +5196 -0
  35. package/dist/chunk-5SDWPKKX.js +5322 -0
  36. package/dist/chunk-6RBGFYAF.js +5076 -0
  37. package/dist/chunk-7L2ANWBB.js +5139 -0
  38. package/dist/chunk-7VIEAJAM.js +5172 -0
  39. package/dist/chunk-ALBABQ53.js +354 -0
  40. package/dist/chunk-BY6GTSWI.js +5059 -0
  41. package/dist/chunk-DWE3CZEL.js +5171 -0
  42. package/dist/chunk-J6P2IT7Z.js +5465 -0
  43. package/dist/chunk-JIRBQUIB.js +5348 -0
  44. package/dist/chunk-K6CLOFGV.js +5129 -0
  45. package/dist/chunk-KYTIQ23P.js +5390 -0
  46. package/dist/chunk-MARFD3QV.js +5164 -0
  47. package/dist/chunk-MRRWKS2W.js +348 -0
  48. package/dist/chunk-NQCUKFAV.js +5381 -0
  49. package/dist/chunk-PILL2YTG.js +5075 -0
  50. package/dist/chunk-QW7D53VM.js +5129 -0
  51. package/dist/chunk-RAWLCGOW.js +5058 -0
  52. package/dist/chunk-RIEG3EJO.js +5385 -0
  53. package/dist/chunk-SHUPSYR2.js +5004 -0
  54. package/dist/chunk-UIGQOSRS.js +5174 -0
  55. package/dist/chunk-UINIIZCG.js +5098 -0
  56. package/dist/chunk-UKIPSWEV.js +5386 -0
  57. package/dist/chunk-VOQSYTG3.js +5419 -0
  58. package/dist/chunk-VT5Q2XKZ.js +5193 -0
  59. package/dist/chunk-VXQYKPGQ.js +5476 -0
  60. package/dist/chunk-VYLJNEKY.js +5129 -0
  61. package/dist/chunk-X24B5DJR.js +323 -0
  62. package/dist/chunk-X3C73JWU.js +5370 -0
  63. package/dist/chunk-XIDK5P36.js +288 -0
  64. package/dist/chunk-ZHRI7SGC.js +5359 -0
  65. package/dist/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthFlow.d.ts +1 -2
  66. package/dist/components/RainbowKitProvider/InternalPinProvider.d.ts +1 -1
  67. package/dist/contexts/MultiChainContext.d.ts +2 -2
  68. package/dist/hooks/internal/abcEmbeddedWallet.d.ts +26 -0
  69. package/dist/hooks/useProfile.d.ts +13 -6
  70. package/dist/hooks/useSolanaWallet.d.ts +13 -8
  71. package/dist/index.d.ts +3 -3
  72. package/dist/index.js +1211 -1158
  73. package/dist/providers/AbcAuthProvider.d.ts +3 -1
  74. package/dist/providers/SignConfirmationProvider/useApiClient.d.ts +3 -0
  75. package/dist/solana/ConfiguredWalletProvider.d.ts +10 -0
  76. package/dist/solana/LegacySolflareWalletAdapter.d.ts +32 -0
  77. package/dist/solana/connectExternalWallet.d.ts +9 -0
  78. package/dist/solana/isWalletReady.d.ts +2 -0
  79. package/dist/transactions/transactionStore.d.ts +2 -5
  80. package/dist/utils/apiClientFactory.d.ts +16 -1
  81. package/dist/utils/encryption.d.ts +0 -4
  82. package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.d.ts +49 -0
  83. package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +8 -0
  84. package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.d.ts +4 -0
  85. package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +12 -15
  86. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +4 -4
  87. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.d.ts +2 -0
  88. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +3 -1
  89. package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +7 -6
  90. package/dist/wallets/walletConnectors/abcWallet/abcProvider.d.ts +25 -1
  91. package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +5 -4
  92. package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.d.ts +0 -4
  93. package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +11 -1
  94. package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +14 -9
  95. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.d.ts +3 -2
  96. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +3 -1
  97. package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +8 -7
  98. package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.d.ts +21 -0
  99. package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +8 -0
  100. package/dist/wallets/walletConnectors/abcWallet/api/SolanaApi.d.ts +28 -115
  101. package/dist/wallets/walletConnectors/abcWallet/api/SolanaApi.js +1 -6
  102. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +24 -1
  103. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +4 -3
  104. package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.d.ts +14 -0
  105. package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +8 -0
  106. package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.d.ts +20 -0
  107. package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +1 -1
  108. package/dist/wallets/walletConnectors/abcWallet/api/index.d.ts +3 -0
  109. package/dist/wallets/walletConnectors/abcWallet/api/index.js +19 -6
  110. package/dist/wallets/walletConnectors/abcWallet/backfillMissingWallets.d.ts +3 -0
  111. package/dist/wallets/walletConnectors/abcWallet/backfillMissingWallets.js +16 -0
  112. package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +4 -0
  113. package/dist/wallets/walletConnectors/abcWallet/constants.js +1 -1
  114. package/dist/wallets/walletConnectors/abcWallet/index.d.ts +3 -2
  115. package/dist/wallets/walletConnectors/abcWallet/index.js +39 -53
  116. package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +2 -1
  117. package/dist/wallets/walletConnectors/abcWallet/types.d.ts +10 -9
  118. package/dist/wallets/walletConnectors/abcWallet/types.js +1 -1
  119. package/dist/wallets/walletConnectors/abcWallet/utils.d.ts +0 -83
  120. package/dist/wallets/walletConnectors/abcWallet/utils.js +3 -41
  121. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.d.ts +9 -3
  122. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +5 -2
  123. package/dist/wallets/walletConnectors/chunk-2XX4LJSQ.js +1387 -0
  124. package/dist/wallets/walletConnectors/chunk-3BUGPUMD.js +151 -0
  125. package/dist/wallets/walletConnectors/chunk-3H7YKUJZ.js +1407 -0
  126. package/dist/wallets/walletConnectors/chunk-3OWQ6MEU.js +54 -0
  127. package/dist/wallets/walletConnectors/chunk-3VDYWOS4.js +300 -0
  128. package/dist/wallets/walletConnectors/chunk-3XOXT4AM.js +314 -0
  129. package/dist/wallets/walletConnectors/chunk-42D2UPKR.js +439 -0
  130. package/dist/wallets/walletConnectors/chunk-42MF6LUP.js +563 -0
  131. package/dist/wallets/walletConnectors/chunk-4LIJB776.js +273 -0
  132. package/dist/wallets/walletConnectors/chunk-4P3SPC44.js +51 -0
  133. package/dist/wallets/walletConnectors/chunk-4RZVAQQ4.js +574 -0
  134. package/dist/wallets/walletConnectors/chunk-53UTBIKF.js +209 -0
  135. package/dist/wallets/walletConnectors/chunk-54KVT46V.js +1477 -0
  136. package/dist/wallets/walletConnectors/chunk-5UBUX5BT.js +440 -0
  137. package/dist/wallets/walletConnectors/chunk-5ZBV5WE2.js +94 -0
  138. package/dist/wallets/walletConnectors/chunk-6EUOVOQK.js +151 -0
  139. package/dist/wallets/walletConnectors/chunk-6WF4SXLB.js +156 -0
  140. package/dist/wallets/walletConnectors/chunk-6YUJPIJ5.js +351 -0
  141. package/dist/wallets/walletConnectors/chunk-77YYMCMD.js +273 -0
  142. package/dist/wallets/walletConnectors/chunk-7DM6H5BJ.js +54 -0
  143. package/dist/wallets/walletConnectors/chunk-7EQNUYV2.js +482 -0
  144. package/dist/wallets/walletConnectors/chunk-7K77YGQN.js +54 -0
  145. package/dist/wallets/walletConnectors/chunk-7MMVOEZF.js +393 -0
  146. package/dist/wallets/walletConnectors/chunk-7ORDZ6EQ.js +1479 -0
  147. package/dist/wallets/walletConnectors/chunk-7RDMH4SD.js +54 -0
  148. package/dist/wallets/walletConnectors/chunk-7S4N4DRT.js +306 -0
  149. package/dist/wallets/walletConnectors/chunk-7SWRH3EI.js +96 -0
  150. package/dist/wallets/walletConnectors/chunk-A3OJZTDV.js +54 -0
  151. package/dist/wallets/walletConnectors/chunk-A66MTFML.js +223 -0
  152. package/dist/wallets/walletConnectors/chunk-ACLPF2UW.js +96 -0
  153. package/dist/wallets/walletConnectors/chunk-AJBRO3VA.js +300 -0
  154. package/dist/wallets/walletConnectors/chunk-BKVGLYLI.js +194 -0
  155. package/dist/wallets/walletConnectors/chunk-BXH3GDX5.js +273 -0
  156. package/dist/wallets/walletConnectors/chunk-C3FPON5L.js +213 -0
  157. package/dist/wallets/walletConnectors/chunk-CABLJOMU.js +194 -0
  158. package/dist/wallets/walletConnectors/chunk-CBIDNYV4.js +1407 -0
  159. package/dist/wallets/walletConnectors/chunk-CE37VZAR.js +300 -0
  160. package/dist/wallets/walletConnectors/chunk-DD6KK4BR.js +54 -0
  161. package/dist/wallets/walletConnectors/chunk-DPTDOCWL.js +205 -0
  162. package/dist/wallets/walletConnectors/chunk-DSNVWCPD.js +131 -0
  163. package/dist/wallets/walletConnectors/chunk-DULGAYBU.js +785 -0
  164. package/dist/wallets/walletConnectors/chunk-DZUXOGSA.js +54 -0
  165. package/dist/wallets/walletConnectors/chunk-E7TDM6P6.js +205 -0
  166. package/dist/wallets/walletConnectors/chunk-EVJIFLSY.js +93 -0
  167. package/dist/wallets/walletConnectors/chunk-EVW3ZB3Q.js +386 -0
  168. package/dist/wallets/walletConnectors/chunk-F2UWSAMX.js +54 -0
  169. package/dist/wallets/walletConnectors/chunk-FBVPR472.js +314 -0
  170. package/dist/wallets/walletConnectors/chunk-FKS2YLVW.js +273 -0
  171. package/dist/wallets/walletConnectors/chunk-FOGNJZPY.js +54 -0
  172. package/dist/wallets/walletConnectors/chunk-FSSV6JY3.js +54 -0
  173. package/dist/wallets/walletConnectors/chunk-GBMOX5JN.js +54 -0
  174. package/dist/wallets/walletConnectors/chunk-GFLJ2MAG.js +54 -0
  175. package/dist/wallets/walletConnectors/chunk-GGPJJ6KS.js +1407 -0
  176. package/dist/wallets/walletConnectors/chunk-GMAYKJEI.js +508 -0
  177. package/dist/wallets/walletConnectors/chunk-GWYZ2IPP.js +1479 -0
  178. package/dist/wallets/walletConnectors/chunk-H3OWNM73.js +300 -0
  179. package/dist/wallets/walletConnectors/chunk-HF6GFAE5.js +54 -0
  180. package/dist/wallets/walletConnectors/chunk-IM7DEERX.js +585 -0
  181. package/dist/wallets/walletConnectors/chunk-INFMRNND.js +300 -0
  182. package/dist/wallets/walletConnectors/chunk-INT6LGH7.js +180 -0
  183. package/dist/wallets/walletConnectors/chunk-ITZ42A33.js +273 -0
  184. package/dist/wallets/walletConnectors/chunk-J4IF6BFF.js +300 -0
  185. package/dist/wallets/walletConnectors/chunk-JADQLTFW.js +194 -0
  186. package/dist/wallets/walletConnectors/chunk-JAMJLNYQ.js +54 -0
  187. package/dist/wallets/walletConnectors/chunk-JDJUIRGF.js +439 -0
  188. package/dist/wallets/walletConnectors/chunk-JEWCPQJZ.js +300 -0
  189. package/dist/wallets/walletConnectors/chunk-JGXJY3SB.js +1 -0
  190. package/dist/wallets/walletConnectors/chunk-JK7LJ4B6.js +1407 -0
  191. package/dist/wallets/walletConnectors/chunk-JPOSJU2D.js +594 -0
  192. package/dist/wallets/walletConnectors/chunk-JUFEPIO4.js +1479 -0
  193. package/dist/wallets/walletConnectors/chunk-JV4IC5Z7.js +54 -0
  194. package/dist/wallets/walletConnectors/chunk-K3VHBOXQ.js +32 -0
  195. package/dist/wallets/walletConnectors/chunk-KZS2C73S.js +814 -0
  196. package/dist/wallets/walletConnectors/chunk-LJNUFDGO.js +205 -0
  197. package/dist/wallets/walletConnectors/chunk-MO2AXXLI.js +30 -0
  198. package/dist/wallets/walletConnectors/chunk-MP3WVXPS.js +273 -0
  199. package/dist/wallets/walletConnectors/chunk-MTC2HJPF.js +96 -0
  200. package/dist/wallets/walletConnectors/chunk-MTJF3SVB.js +1487 -0
  201. package/dist/wallets/walletConnectors/chunk-NBVPVTJZ.js +192 -0
  202. package/dist/wallets/walletConnectors/chunk-NISMGNEE.js +223 -0
  203. package/dist/wallets/walletConnectors/chunk-NY5O2OBG.js +1477 -0
  204. package/dist/wallets/walletConnectors/chunk-NYDDRNUI.js +445 -0
  205. package/dist/wallets/walletConnectors/chunk-O4DNG6JJ.js +54 -0
  206. package/dist/wallets/walletConnectors/chunk-OTLZVWY7.js +39 -0
  207. package/dist/wallets/walletConnectors/chunk-OYF6AQOW.js +194 -0
  208. package/dist/wallets/walletConnectors/chunk-PBOCVGUC.js +782 -0
  209. package/dist/wallets/walletConnectors/chunk-PDXO6AOG.js +300 -0
  210. package/dist/wallets/walletConnectors/chunk-PJSN4YRI.js +1387 -0
  211. package/dist/wallets/walletConnectors/chunk-PVIO7FM7.js +314 -0
  212. package/dist/wallets/walletConnectors/chunk-PWJOXYDF.js +54 -0
  213. package/dist/wallets/walletConnectors/chunk-PYBSONED.js +771 -0
  214. package/dist/wallets/walletConnectors/chunk-PYKECUZ3.js +54 -0
  215. package/dist/wallets/walletConnectors/chunk-Q42NO7WB.js +46 -0
  216. package/dist/wallets/walletConnectors/chunk-Q7XBI5F6.js +300 -0
  217. package/dist/wallets/walletConnectors/chunk-QHUBLT7N.js +156 -0
  218. package/dist/wallets/walletConnectors/chunk-RMV23JXO.js +300 -0
  219. package/dist/wallets/walletConnectors/chunk-S3L2SA4J.js +300 -0
  220. package/dist/wallets/walletConnectors/chunk-S466OQOC.js +393 -0
  221. package/dist/wallets/walletConnectors/chunk-SA7IXAFG.js +54 -0
  222. package/dist/wallets/walletConnectors/chunk-SDB6BBHX.js +585 -0
  223. package/dist/wallets/walletConnectors/chunk-SFGVPX2G.js +351 -0
  224. package/dist/wallets/walletConnectors/chunk-SFQKJ6X6.js +314 -0
  225. package/dist/wallets/walletConnectors/chunk-SKLRJRER.js +1464 -0
  226. package/dist/wallets/walletConnectors/chunk-SQVWIBWR.js +351 -0
  227. package/dist/wallets/walletConnectors/chunk-SSLHXCOX.js +439 -0
  228. package/dist/wallets/walletConnectors/chunk-SU6LV3EO.js +314 -0
  229. package/dist/wallets/walletConnectors/chunk-SU7IEZE2.js +300 -0
  230. package/dist/wallets/walletConnectors/chunk-TMRB5SCL.js +167 -0
  231. package/dist/wallets/walletConnectors/chunk-TMUPUOQR.js +54 -0
  232. package/dist/wallets/walletConnectors/chunk-TNZ7QKXH.js +771 -0
  233. package/dist/wallets/walletConnectors/chunk-TT2NLKIU.js +1465 -0
  234. package/dist/wallets/walletConnectors/chunk-U3WGMWTH.js +585 -0
  235. package/dist/wallets/walletConnectors/chunk-UAV4SI4Y.js +408 -0
  236. package/dist/wallets/walletConnectors/chunk-UAWWPNS7.js +54 -0
  237. package/dist/wallets/walletConnectors/chunk-UXRJASPW.js +785 -0
  238. package/dist/wallets/walletConnectors/chunk-UY5TAYLM.js +54 -0
  239. package/dist/wallets/walletConnectors/chunk-VB5IZDY7.js +300 -0
  240. package/dist/wallets/walletConnectors/chunk-VDWJ3NQ5.js +52 -0
  241. package/dist/wallets/walletConnectors/chunk-VIKJNKJZ.js +219 -0
  242. package/dist/wallets/walletConnectors/chunk-VKOPUEQG.js +445 -0
  243. package/dist/wallets/walletConnectors/chunk-VTOD7PXP.js +817 -0
  244. package/dist/wallets/walletConnectors/chunk-VVEXF6KG.js +273 -0
  245. package/dist/wallets/walletConnectors/chunk-W2YIRNMB.js +300 -0
  246. package/dist/wallets/walletConnectors/chunk-W7L2SBIG.js +138 -0
  247. package/dist/wallets/walletConnectors/chunk-WC7BGU5Z.js +814 -0
  248. package/dist/wallets/walletConnectors/chunk-WS5FG53X.js +54 -0
  249. package/dist/wallets/walletConnectors/chunk-WVRGC2YL.js +300 -0
  250. package/dist/wallets/walletConnectors/chunk-X33WL7R7.js +300 -0
  251. package/dist/wallets/walletConnectors/chunk-XG2R64B7.js +785 -0
  252. package/dist/wallets/walletConnectors/chunk-Y2BWF42Z.js +54 -0
  253. package/dist/wallets/walletConnectors/chunk-Y446VZWI.js +585 -0
  254. package/dist/wallets/walletConnectors/chunk-YDSBY7NO.js +54 -0
  255. package/dist/wallets/walletConnectors/chunk-YROAFC7Z.js +54 -0
  256. package/dist/wallets/walletConnectors/chunk-YV6IZWGE.js +393 -0
  257. package/dist/wallets/walletConnectors/chunk-Z4WVT3G2.js +1416 -0
  258. package/dist/wallets/walletConnectors/chunk-Z5SBGIWT.js +300 -0
  259. package/dist/wallets/walletConnectors/chunk-ZK3PZIAH.js +300 -0
  260. package/dist/wallets/walletConnectors/chunk-ZKCUYHBK.js +300 -0
  261. package/dist/wallets/walletConnectors/chunk-ZPJLV3E7.js +151 -0
  262. package/dist/wallets/walletConnectors/chunk-ZQ3LCYGH.js +408 -0
  263. package/dist/wallets/walletConnectors/chunk-ZX6HMX7N.js +1468 -0
  264. package/dist/wallets/walletConnectors/chunk-ZXN465CA.js +209 -0
  265. package/dist/wallets/walletConnectors/index.js +73 -72
  266. package/package.json +12 -11
  267. package/LICENSE +0 -9
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use client";
2
+ import {
3
+ en_US_default
4
+ } from "./chunk-X4GSACNW.js";
2
5
  import {
3
6
  darkTheme
4
7
  } from "./chunk-RZWDCITT.js";
@@ -11,18 +14,27 @@ import {
11
14
  import "./chunk-DQLAW7KN.js";
12
15
  import {
13
16
  BitcoinNetwork,
17
+ ConfigApi,
14
18
  GasApi,
15
19
  NETWORK_BY_PARAM,
16
20
  NETWORK_CONFIGS,
17
21
  NetworkType,
18
22
  SessionExpiredError,
23
+ SolanaApi,
19
24
  SolanaNetwork,
20
25
  TalkenApiClient,
26
+ TokenApi,
21
27
  TronNetwork,
22
28
  WalletscanApi,
23
29
  chainIdToNetwork,
30
+ createConfigApi,
31
+ createGasApi,
32
+ createSolanaApi,
24
33
  createTalkenApiClient,
34
+ createTokenApi,
35
+ createWalletscanApi,
25
36
  getBitcoinNetwork,
37
+ getChainKey,
26
38
  getEvmNetwork,
27
39
  getExplorerAddressUrl,
28
40
  getExplorerTxUrl,
@@ -36,17 +48,19 @@ import {
36
48
  getTronNetwork,
37
49
  isEvmNetwork,
38
50
  isTestnet,
51
+ loadAuthState,
39
52
  networkNameToChainKey,
40
53
  networkToChainId,
41
54
  resolveTalkenApiUrl,
42
55
  setTalkenApiClient
43
- } from "./chunk-N7AWNQBH.js";
56
+ } from "./chunk-UKIPSWEV.js";
44
57
  import {
45
- en_US_default
46
- } from "./chunk-X4GSACNW.js";
58
+ STORAGE_PREFIX,
59
+ getCredentialManager
60
+ } from "./chunk-ALBABQ53.js";
47
61
 
48
62
  // src/components/ConnectButton/ConnectButton.tsx
49
- import React100, { useContext as useContext29, useEffect as useEffect31, useState as useState38 } from "react";
63
+ import React100, { useContext as useContext29, useEffect as useEffect32, useState as useState39 } from "react";
50
64
 
51
65
  // src/css/sprinkles.css.ts
52
66
  import { createMapValueFn as _51c72 } from "@vanilla-extract/sprinkles/createUtils";
@@ -81,90 +95,90 @@ function useNonEvmConfirmation() {
81
95
  return useContext(NonEvmConfirmationContext);
82
96
  }
83
97
 
98
+ // src/hooks/internal/abcEmbeddedWallet.ts
99
+ function hasAbcEmbeddedSession(evmConnected, connector) {
100
+ return evmConnected && connector?.id === "abc";
101
+ }
102
+ function subscribeToAbcStorageUpdates(refresh) {
103
+ const handleStorageUpdate = () => {
104
+ void refresh();
105
+ };
106
+ window.addEventListener("talkenkit_storage_update", handleStorageUpdate);
107
+ return () => {
108
+ window.removeEventListener("talkenkit_storage_update", handleStorageUpdate);
109
+ };
110
+ }
111
+ function loadEmbeddedWalletFromAuthState(walletKey) {
112
+ const authState = loadAuthState();
113
+ return authState?.[walletKey] ?? null;
114
+ }
115
+ async function restoreEmbeddedWalletState(params) {
116
+ const {
117
+ enabled,
118
+ wallet,
119
+ emptyState,
120
+ requestInterceptor,
121
+ importProvider,
122
+ mapState
123
+ } = params;
124
+ if (!enabled || !wallet?.address) {
125
+ return emptyState;
126
+ }
127
+ const Provider = await importProvider();
128
+ const provider = new Provider();
129
+ provider.setWallet(wallet);
130
+ if (requestInterceptor) {
131
+ provider.setRequestInterceptor?.(requestInterceptor);
132
+ }
133
+ return mapState(wallet, provider);
134
+ }
135
+
84
136
  // src/hooks/useBitcoinWallet.ts
85
137
  function useBitcoinWallet() {
86
138
  const { isConnected: evmConnected, connector } = useAccount();
87
139
  const { requestInterceptor } = useNonEvmConfirmation();
88
- const [wallet, setWallet] = useState({
140
+ const emptyWalletState = {
89
141
  address: null,
90
142
  publicKey: null,
91
143
  network: null,
92
144
  addressType: null,
93
145
  isConnected: false,
94
146
  provider: null
95
- });
147
+ };
148
+ const [wallet, setWallet] = useState(emptyWalletState);
96
149
  const [isLoading, setIsLoading] = useState(false);
97
150
  const [error2, setError] = useState(null);
98
151
  const refresh = async () => {
99
- if (!evmConnected || !connector || connector.id !== "abc") {
100
- setWallet({
101
- address: null,
102
- publicKey: null,
103
- network: null,
104
- addressType: null,
105
- isConnected: false,
106
- provider: null
107
- });
108
- return;
109
- }
110
152
  try {
111
153
  setIsLoading(true);
112
154
  setError(null);
113
- const authState = localStorage.getItem("talkenkit_abc_auth_state");
114
- if (!authState) {
115
- setWallet({
116
- address: null,
117
- publicKey: null,
118
- network: null,
119
- addressType: null,
120
- isConnected: false,
121
- provider: null
122
- });
123
- return;
124
- }
125
- const authData = JSON.parse(authState);
126
- const bitcoinWallet = authData.bitcoinWallet;
127
- if (!bitcoinWallet || !bitcoinWallet.address) {
128
- setWallet({
129
- address: null,
130
- publicKey: null,
131
- network: null,
132
- addressType: null,
133
- isConnected: false,
134
- provider: null
135
- });
136
- return;
137
- }
138
- const { AbcBitcoinProvider } = await import("./abcWallet-O4GH6RHS.js");
139
- const bitcoinProvider = new AbcBitcoinProvider();
140
- bitcoinProvider.setWallet(bitcoinWallet);
141
- if (requestInterceptor) {
142
- bitcoinProvider.setRequestInterceptor(requestInterceptor);
143
- }
144
- setWallet({
145
- address: bitcoinWallet.address,
146
- publicKey: bitcoinWallet.publicKey,
147
- network: bitcoinWallet.network || "bitcoin_testnet",
148
- addressType: bitcoinWallet.addressType || "bech32",
149
- isConnected: true,
150
- provider: bitcoinProvider
155
+ const bitcoinWallet = loadEmbeddedWalletFromAuthState("bitcoinWallet");
156
+ const nextState = await restoreEmbeddedWalletState({
157
+ enabled: hasAbcEmbeddedSession(evmConnected, connector),
158
+ wallet: bitcoinWallet,
159
+ emptyState: emptyWalletState,
160
+ requestInterceptor,
161
+ importProvider: async () => (await import("./abcWallet-MWUFO3JQ.js")).AbcBitcoinProvider,
162
+ mapState: (nextWallet, provider) => ({
163
+ address: nextWallet.address,
164
+ publicKey: nextWallet.publicKey,
165
+ network: nextWallet.network || "bitcoin_testnet",
166
+ addressType: nextWallet.addressType || "bech32",
167
+ isConnected: true,
168
+ provider
169
+ })
151
170
  });
171
+ setWallet(nextState);
152
172
  } catch (err) {
153
173
  setError(err);
154
- setWallet({
155
- address: null,
156
- publicKey: null,
157
- network: null,
158
- addressType: null,
159
- isConnected: false,
160
- provider: null
161
- });
174
+ setWallet(emptyWalletState);
162
175
  } finally {
163
176
  setIsLoading(false);
164
177
  }
165
178
  };
166
179
  useEffect(() => {
167
- refresh();
180
+ void refresh();
181
+ return subscribeToAbcStorageUpdates(refresh);
168
182
  }, [evmConnected, connector?.id]);
169
183
  useEffect(() => {
170
184
  if (wallet.provider) {
@@ -1203,251 +1217,654 @@ var useShowBalance = () => useContext5(ShowBalanceContext);
1203
1217
 
1204
1218
  // src/components/ConnectButton/ConnectButtonRenderer.tsx
1205
1219
  import React99, { useContext as useContext28 } from "react";
1206
- import { useAccount as useAccount17, useConfig as useConfig4 } from "wagmi";
1220
+ import { useAccount as useAccount18, useConfig as useConfig4 } from "wagmi";
1207
1221
 
1208
1222
  // src/contexts/MultiChainContext.tsx
1209
- import { useWallet } from "@solana/wallet-adapter-react";
1223
+ import { useWallet as useWallet2 } from "@solana/wallet-adapter-react";
1210
1224
  import React11, {
1211
1225
  createContext as createContext7,
1212
1226
  useCallback,
1213
1227
  useContext as useContext6,
1214
- useEffect as useEffect6,
1215
- useState as useState6
1228
+ useEffect as useEffect7,
1229
+ useState as useState7
1216
1230
  } from "react";
1217
- import { useAccount as useAccount4, useDisconnect as useWagmiDisconnect } from "wagmi";
1218
- var MultiChainContext = createContext7(null);
1219
- function useMultiChain() {
1220
- const context = useContext6(MultiChainContext);
1221
- if (!context) {
1222
- throw new Error("useMultiChain must be used within MultiChainProvider");
1223
- }
1224
- return context;
1225
- }
1226
- function MultiChainProvider({
1227
- children,
1228
- defaultChain = "evm",
1229
- enableSolana = false
1230
- }) {
1231
- const {
1232
- address: evmAddress,
1233
- chainId: evmChainId,
1234
- isConnected: evmConnected
1235
- } = useAccount4();
1236
- const solanaWallet = enableSolana ? useWallet() : null;
1237
- const solanaAddress = solanaWallet?.publicKey?.toBase58();
1238
- const solanaConnected = solanaWallet?.connected ?? false;
1239
- const { disconnect: wagmiDisconnect } = useWagmiDisconnect();
1240
- const solanaDisconnect = solanaWallet?.disconnect;
1241
- const [activeChain, setActiveChain] = useState6(defaultChain);
1242
- useEffect6(() => {
1243
- const stored = localStorage.getItem("talkenkit_active_chain");
1244
- if (stored && (stored === "evm" || stored === "solana")) {
1245
- setActiveChain(stored);
1246
- }
1247
- }, []);
1248
- useEffect6(() => {
1249
- localStorage.setItem("talkenkit_active_chain", activeChain);
1250
- }, [activeChain]);
1251
- const disconnectAll = useCallback(async () => {
1252
- try {
1253
- if (evmConnected) {
1254
- wagmiDisconnect();
1255
- }
1256
- if (solanaConnected && solanaDisconnect) {
1257
- await solanaDisconnect();
1258
- }
1259
- } catch (error2) {
1260
- console.error("[MultiChainContext] Failed to disconnect:", error2);
1261
- }
1262
- }, [evmConnected, solanaConnected, wagmiDisconnect, solanaDisconnect]);
1263
- const state = {
1264
- evmAddress,
1265
- evmChainId,
1266
- evmConnected,
1267
- solanaAddress,
1268
- solanaConnected,
1269
- solanaWallet,
1270
- activeChain,
1271
- setActiveChain,
1272
- disconnectAll
1273
- };
1274
- return /* @__PURE__ */ React11.createElement(MultiChainContext.Provider, { value: state }, children);
1275
- }
1276
-
1277
- // src/hooks/useIsMounted.ts
1278
- import { useCallback as useCallback2, useEffect as useEffect7, useState as useState7 } from "react";
1279
- function useIsMounted() {
1280
- const [isMounted, setIsMounted] = useState7(false);
1281
- useEffect7(() => {
1282
- setIsMounted(true);
1283
- return () => {
1284
- setIsMounted(false);
1285
- };
1286
- }, []);
1287
- return useCallback2(() => isMounted, [isMounted]);
1288
- }
1289
-
1290
- // src/hooks/useProfile.ts
1291
- import { useBalance } from "wagmi";
1231
+ import { useAccount as useAccount5, useDisconnect as useWagmiDisconnect } from "wagmi";
1292
1232
 
1293
- // src/hooks/useMainnetEnsAvatar.ts
1294
- import { normalize } from "viem/ens";
1295
- import { useEnsAvatar } from "wagmi";
1296
- import { mainnet as mainnet2 } from "wagmi/chains";
1233
+ // src/hooks/useSolanaWallet.ts
1234
+ import { useConnection, useWallet } from "@solana/wallet-adapter-react";
1235
+ import { useEffect as useEffect6, useState as useState6 } from "react";
1236
+ import { useAccount as useAccount4 } from "wagmi";
1297
1237
 
1298
- // src/hooks/useIsMainnetConfigured.ts
1299
- import { mainnet } from "wagmi/chains";
1300
- function useIsMainnetConfigured() {
1301
- const rainbowKitChains = useRainbowKitChains();
1302
- const chainId = mainnet.id;
1303
- const configured = rainbowKitChains.some(
1304
- (rainbowKitChain) => rainbowKitChain.id === chainId
1238
+ // src/solana/connectExternalWallet.ts
1239
+ async function connectExternalSolanaWallet({
1240
+ walletName: walletName2,
1241
+ wallets,
1242
+ selectedWalletName,
1243
+ selectWallet
1244
+ }) {
1245
+ const wallet = wallets.find(
1246
+ (candidate) => candidate.adapter.name === walletName2
1305
1247
  );
1306
- return configured;
1307
- }
1308
-
1309
- // src/hooks/useMainnetEnsAvatar.ts
1310
- function useMainnetEnsAvatar(name) {
1311
- const mainnetConfigured = useIsMainnetConfigured();
1312
- const safeNormalize = (ensName) => {
1313
- try {
1314
- return normalize(ensName);
1315
- } catch {
1316
- }
1317
- };
1318
- const { data: ensAvatar } = useEnsAvatar({
1319
- chainId: mainnet2.id,
1320
- name: name ? safeNormalize(name) : void 0,
1321
- query: {
1322
- enabled: mainnetConfigured
1323
- }
1324
- });
1325
- return ensAvatar;
1248
+ if (!wallet) {
1249
+ throw new Error(`Solana wallet adapter not found: ${walletName2}`);
1250
+ }
1251
+ if (wallet.adapter.connected) {
1252
+ return wallet;
1253
+ }
1254
+ if (selectedWalletName !== wallet.adapter.name) {
1255
+ selectWallet(wallet.adapter.name);
1256
+ }
1257
+ await wallet.adapter.connect();
1258
+ return wallet;
1326
1259
  }
1327
1260
 
1328
- // src/hooks/useMainnetEnsName.ts
1329
- import { useQuery } from "@tanstack/react-query";
1330
- import { useEnsName } from "wagmi";
1331
- import { mainnet as mainnet3 } from "wagmi/chains";
1332
-
1333
- // src/core/network/internal/rainbowFetch.ts
1334
- async function rainbowFetch(url, opts) {
1335
- opts = {
1336
- headers: {},
1337
- method: "get",
1338
- ...opts,
1339
- // Any other fetch options
1340
- timeout: opts.timeout ?? 1e4
1341
- // 10 secs
1342
- };
1343
- if (!url)
1344
- throw new Error("rainbowFetch: Missing url argument");
1345
- const controller = new AbortController();
1346
- const id = setTimeout(() => controller.abort(), opts.timeout);
1347
- const { body, params, headers, ...otherOpts } = opts;
1348
- const requestBody = body && typeof body === "object" ? JSON.stringify(opts.body) : opts.body;
1349
- const response = await fetch(`${url}${createParams(params)}`, {
1350
- ...otherOpts,
1351
- body: requestBody,
1352
- headers: {
1353
- Accept: "application/json",
1354
- "Content-Type": "application/json",
1355
- ...headers
1356
- },
1357
- signal: controller.signal
1358
- });
1359
- clearTimeout(id);
1360
- const responseBody = await getBody(response);
1361
- if (response.ok) {
1362
- const { headers: headers2, status } = response;
1363
- return { data: responseBody, headers: headers2, status };
1261
+ // src/hooks/useSolanaWallet.ts
1262
+ async function sendExternalSolanaTransaction(params) {
1263
+ const { transaction, connection, externalWallet, options } = params;
1264
+ if (externalWallet.sendTransaction) {
1265
+ const rawSignature = await externalWallet.sendTransaction(
1266
+ transaction,
1267
+ connection,
1268
+ options
1269
+ );
1270
+ return await normalizeSolanaSignature(rawSignature);
1364
1271
  }
1365
- const errorResponseBody = typeof responseBody === "string" ? { error: responseBody } : responseBody;
1366
- const error2 = generateError({
1367
- requestBody: body,
1368
- response,
1369
- responseBody: errorResponseBody
1370
- });
1371
- throw error2;
1372
- }
1373
- function getBody(response) {
1374
- const contentType = response.headers.get("Content-Type");
1375
- if (contentType?.startsWith("application/json")) {
1376
- return response.json();
1272
+ if (!externalWallet.signTransaction) {
1273
+ throw new Error("Wallet does not support transactions");
1377
1274
  }
1378
- return response.text();
1379
- }
1380
- function createParams(params) {
1381
- return params && Object.keys(params).length ? `?${new URLSearchParams(params)}` : "";
1382
- }
1383
- function generateError({
1384
- requestBody,
1385
- response,
1386
- responseBody
1387
- }) {
1388
- const message = responseBody?.error || response?.statusText || "There was an error with the request.";
1389
- const error2 = new Error(message);
1390
- error2.response = response;
1391
- error2.responseBody = responseBody;
1392
- error2.requestBody = requestBody;
1393
- return error2;
1275
+ const signedTransaction = await externalWallet.signTransaction(transaction);
1276
+ const rawTransaction = signedTransaction.serialize();
1277
+ return await connection.sendRawTransaction(rawTransaction, options);
1394
1278
  }
1395
- var RainbowFetchClient = class {
1396
- constructor(opts = {}) {
1397
- const { baseUrl = "", ...otherOpts } = opts;
1398
- this.baseUrl = baseUrl;
1399
- this.opts = otherOpts;
1400
- }
1401
- /**
1402
- * Perform a GET request with the RainbowFetchClient.
1403
- */
1404
- get(url, opts) {
1405
- return rainbowFetch(`${this.baseUrl}${url}`, {
1406
- ...this.opts,
1407
- ...opts || {},
1408
- method: "get"
1409
- });
1279
+ async function normalizeSolanaSignature(signature) {
1280
+ if (typeof signature === "string") {
1281
+ return signature;
1410
1282
  }
1411
- /**
1412
- * Perform a DELETE request with the RainbowFetchClient.
1413
- */
1414
- delete(url, opts) {
1415
- return rainbowFetch(`${this.baseUrl}${url}`, {
1416
- ...this.opts,
1417
- ...opts || {},
1418
- method: "delete"
1419
- });
1283
+ if (signature && typeof signature === "object" && "signature" in signature) {
1284
+ return normalizeSolanaSignature(signature.signature);
1420
1285
  }
1421
- /**
1422
- * Perform a HEAD request with the RainbowFetchClient.
1423
- */
1424
- head(url, opts) {
1425
- return rainbowFetch(`${this.baseUrl}${url}`, {
1426
- ...this.opts,
1427
- ...opts || {},
1428
- method: "head"
1429
- });
1286
+ const bs58 = (await import("bs58")).default;
1287
+ if (signature instanceof Uint8Array) {
1288
+ return bs58.encode(signature);
1430
1289
  }
1431
- /**
1432
- * Perform a OPTIONS request with the RainbowFetchClient.
1433
- */
1434
- options(url, opts) {
1435
- return rainbowFetch(`${this.baseUrl}${url}`, {
1436
- ...this.opts,
1437
- ...opts || {},
1438
- method: "options"
1439
- });
1290
+ if (ArrayBuffer.isView(signature)) {
1291
+ return bs58.encode(
1292
+ new Uint8Array(
1293
+ signature.buffer,
1294
+ signature.byteOffset,
1295
+ signature.byteLength
1296
+ )
1297
+ );
1440
1298
  }
1441
- /**
1442
- * Perform a POST request with the RainbowFetchClient.
1443
- */
1444
- post(url, body, opts) {
1445
- return rainbowFetch(`${this.baseUrl}${url}`, {
1446
- ...this.opts,
1447
- ...opts || {},
1448
- body,
1449
- method: "post"
1450
- });
1299
+ if (Array.isArray(signature) && signature.every((value) => typeof value === "number")) {
1300
+ return bs58.encode(Uint8Array.from(signature));
1301
+ }
1302
+ throw new Error(
1303
+ `Unsupported Solana transaction signature shape: ${Object.prototype.toString.call(signature)}`
1304
+ );
1305
+ }
1306
+ function useSolanaWallet() {
1307
+ const { isConnected: evmConnected, connector } = useAccount4();
1308
+ const { requestInterceptor } = useNonEvmConfirmation();
1309
+ const emptyWalletState = {
1310
+ address: null,
1311
+ publicKey: null,
1312
+ network: null,
1313
+ isConnected: false,
1314
+ provider: null
1315
+ };
1316
+ const { connection } = useConnection();
1317
+ const solanaApiNetwork = process.env.NEXT_PUBLIC_ENVIRONMENT === "production" ? "solana" : "solana_devnet";
1318
+ const externalWallet = useWallet();
1319
+ const [abcWallet, setAbcWallet] = useState6(emptyWalletState);
1320
+ const [isLoading, setIsLoading] = useState6(false);
1321
+ const [error2, setError] = useState6(null);
1322
+ const refreshAbcWallet = async () => {
1323
+ try {
1324
+ setIsLoading(true);
1325
+ setError(null);
1326
+ const solanaWallet = loadEmbeddedWalletFromAuthState("solanaWallet");
1327
+ const nextState = await restoreEmbeddedWalletState({
1328
+ enabled: hasAbcEmbeddedSession(evmConnected, connector),
1329
+ wallet: solanaWallet,
1330
+ emptyState: emptyWalletState,
1331
+ requestInterceptor,
1332
+ importProvider: async () => (await import("./abcWallet-MWUFO3JQ.js")).AbcSolanaProvider,
1333
+ mapState: (nextWallet, provider) => ({
1334
+ address: nextWallet.address,
1335
+ publicKey: nextWallet.publicKey,
1336
+ network: nextWallet.network || "solana_devnet",
1337
+ isConnected: true,
1338
+ provider
1339
+ })
1340
+ });
1341
+ setAbcWallet(nextState);
1342
+ } catch (err) {
1343
+ setError(err);
1344
+ setAbcWallet(emptyWalletState);
1345
+ } finally {
1346
+ setIsLoading(false);
1347
+ }
1348
+ };
1349
+ const refresh = refreshAbcWallet;
1350
+ const getWalletscanNetwork = () => process.env.NEXT_PUBLIC_ENVIRONMENT === "production" ? "solana" : "solana_devnet";
1351
+ useEffect6(() => {
1352
+ void refreshAbcWallet();
1353
+ return subscribeToAbcStorageUpdates(refreshAbcWallet);
1354
+ }, [evmConnected, connector?.id]);
1355
+ useEffect6(() => {
1356
+ if (abcWallet.provider) {
1357
+ abcWallet.provider.setRequestInterceptor(requestInterceptor ?? void 0);
1358
+ }
1359
+ }, [requestInterceptor]);
1360
+ const activeWallet = abcWallet.isConnected ? {
1361
+ ...abcWallet,
1362
+ type: "abc",
1363
+ walletName: "ABC Wallet"
1364
+ } : externalWallet.connected ? {
1365
+ address: externalWallet.publicKey?.toBase58() || null,
1366
+ publicKey: externalWallet.publicKey?.toBase58() || null,
1367
+ network: process.env.NEXT_PUBLIC_ENVIRONMENT === "production" ? "solana" : "solana_devnet",
1368
+ isConnected: true,
1369
+ type: "external",
1370
+ walletName: externalWallet.wallet?.adapter.name || "External Wallet",
1371
+ provider: null
1372
+ } : {
1373
+ address: null,
1374
+ publicKey: null,
1375
+ network: null,
1376
+ isConnected: false,
1377
+ type: null,
1378
+ walletName: null,
1379
+ provider: null
1380
+ };
1381
+ const connect = async (walletName2 = "ABC Wallet") => {
1382
+ if (activeWallet.isConnected && activeWallet.walletName === walletName2) {
1383
+ return;
1384
+ }
1385
+ await connectExternalSolanaWallet({
1386
+ walletName: walletName2,
1387
+ wallets: externalWallet.wallets,
1388
+ selectedWalletName: externalWallet.wallet?.adapter.name,
1389
+ selectWallet: externalWallet.select
1390
+ });
1391
+ };
1392
+ const signMessage = async (params) => {
1393
+ if (activeWallet.type === "abc") {
1394
+ if (!abcWallet.provider) {
1395
+ throw new Error("ABC Solana provider not available");
1396
+ }
1397
+ const encodedMessage = new TextEncoder().encode(params.message);
1398
+ const result = await abcWallet.provider.signMessage(
1399
+ encodedMessage,
1400
+ "utf8"
1401
+ );
1402
+ const signatureHex = Array.from(result.signature).map((b) => b.toString(16).padStart(2, "0")).join("");
1403
+ return { signature: signatureHex };
1404
+ }
1405
+ if (activeWallet.type === "external") {
1406
+ if (!externalWallet.signMessage) {
1407
+ throw new Error("Wallet does not support message signing");
1408
+ }
1409
+ const encodedMessage = new TextEncoder().encode(params.message);
1410
+ const signature = await externalWallet.signMessage(encodedMessage);
1411
+ const bs58 = await import("bs58");
1412
+ const signatureBase58 = bs58.default.encode(signature);
1413
+ return { signature: signatureBase58 };
1414
+ }
1415
+ throw new Error("No Solana wallet connected");
1416
+ };
1417
+ const transfer = async (params) => {
1418
+ if (activeWallet.type === "abc") {
1419
+ if (!abcWallet.provider) {
1420
+ throw new Error("ABC Solana provider not available");
1421
+ }
1422
+ return await abcWallet.provider.transfer(params);
1423
+ }
1424
+ if (activeWallet.type === "external") {
1425
+ if (!externalWallet.publicKey || !externalWallet.sendTransaction) {
1426
+ throw new Error("Wallet does not support transactions");
1427
+ }
1428
+ const solanaApi = createSolanaApi();
1429
+ const { blockhash } = await solanaApi.getLatestBlockhash(solanaApiNetwork);
1430
+ if (params.mintAddress) {
1431
+ const { PublicKey: PublicKey3, Transaction: Transaction3 } = await import("@solana/web3.js");
1432
+ const {
1433
+ getAssociatedTokenAddress,
1434
+ createAssociatedTokenAccountIdempotentInstruction,
1435
+ createTransferInstruction,
1436
+ TOKEN_PROGRAM_ID
1437
+ } = await import("@solana/spl-token");
1438
+ const mintPubkey = new PublicKey3(params.mintAddress);
1439
+ const fromPubkey2 = externalWallet.publicKey;
1440
+ const toPubkey2 = new PublicKey3(params.toAddress);
1441
+ const walletscanApi = createWalletscanApi();
1442
+ const tokenInfo = await walletscanApi.getContractTokenWithTimeout({
1443
+ contractAddress: params.mintAddress,
1444
+ networks: solanaApiNetwork
1445
+ });
1446
+ const decimals = tokenInfo?.decimals ?? 0;
1447
+ const fromTokenAccount = await getAssociatedTokenAddress(
1448
+ mintPubkey,
1449
+ fromPubkey2,
1450
+ false,
1451
+ TOKEN_PROGRAM_ID
1452
+ );
1453
+ const toTokenAccount = await getAssociatedTokenAddress(
1454
+ mintPubkey,
1455
+ toPubkey2,
1456
+ false,
1457
+ TOKEN_PROGRAM_ID
1458
+ );
1459
+ const transaction2 = new Transaction3();
1460
+ transaction2.add(
1461
+ createAssociatedTokenAccountIdempotentInstruction(
1462
+ fromPubkey2,
1463
+ toTokenAccount,
1464
+ toPubkey2,
1465
+ mintPubkey,
1466
+ TOKEN_PROGRAM_ID
1467
+ )
1468
+ );
1469
+ const rawAmount = Math.floor(params.amount * 10 ** decimals);
1470
+ transaction2.add(
1471
+ createTransferInstruction(
1472
+ fromTokenAccount,
1473
+ toTokenAccount,
1474
+ fromPubkey2,
1475
+ rawAmount,
1476
+ [],
1477
+ TOKEN_PROGRAM_ID
1478
+ )
1479
+ );
1480
+ transaction2.recentBlockhash = blockhash;
1481
+ transaction2.feePayer = fromPubkey2;
1482
+ const signature2 = await sendExternalSolanaTransaction({
1483
+ transaction: transaction2,
1484
+ connection,
1485
+ externalWallet
1486
+ });
1487
+ await solanaApi.waitForTransactionStatus({
1488
+ network: solanaApiNetwork,
1489
+ signature: signature2
1490
+ });
1491
+ return { signature: signature2 };
1492
+ }
1493
+ const { PublicKey: PublicKey2, SystemProgram, Transaction: Transaction2, LAMPORTS_PER_SOL } = await import("@solana/web3.js");
1494
+ const fromPubkey = externalWallet.publicKey;
1495
+ const toPubkey = new PublicKey2(params.toAddress);
1496
+ const transaction = new Transaction2().add(
1497
+ SystemProgram.transfer({
1498
+ fromPubkey,
1499
+ toPubkey,
1500
+ lamports: params.amount * LAMPORTS_PER_SOL
1501
+ })
1502
+ );
1503
+ transaction.recentBlockhash = blockhash;
1504
+ transaction.feePayer = fromPubkey;
1505
+ const signature = await sendExternalSolanaTransaction({
1506
+ transaction,
1507
+ connection,
1508
+ externalWallet
1509
+ });
1510
+ await solanaApi.waitForTransactionStatus({
1511
+ network: solanaApiNetwork,
1512
+ signature
1513
+ });
1514
+ return { signature };
1515
+ }
1516
+ throw new Error("No Solana wallet connected");
1517
+ };
1518
+ const getTokenBalance = async (mintAddress) => {
1519
+ if (activeWallet.type === "abc") {
1520
+ if (!abcWallet.provider) {
1521
+ throw new Error("ABC Solana provider not available");
1522
+ }
1523
+ return await abcWallet.provider.getTokenBalance(mintAddress);
1524
+ }
1525
+ if (activeWallet.type === "external") {
1526
+ if (!externalWallet.publicKey) {
1527
+ throw new Error("Wallet not connected");
1528
+ }
1529
+ const walletscanApi = createWalletscanApi();
1530
+ const balance = await walletscanApi.getWalletTokenBalanceWithTimeout({
1531
+ walletAddress: externalWallet.publicKey.toBase58(),
1532
+ networks: getWalletscanNetwork(),
1533
+ contractAddress: mintAddress
1534
+ });
1535
+ if (!balance) {
1536
+ return {
1537
+ amount: "0",
1538
+ decimals: 0,
1539
+ uiAmount: 0
1540
+ };
1541
+ }
1542
+ return {
1543
+ amount: String(balance.balance ?? 0),
1544
+ decimals: balance.decimals ?? 0,
1545
+ uiAmount: balance.hrBalance ?? 0
1546
+ };
1547
+ }
1548
+ throw new Error("No Solana wallet connected");
1549
+ };
1550
+ const signTransaction = async (transaction) => {
1551
+ if (activeWallet.type === "abc") {
1552
+ if (!abcWallet.provider) {
1553
+ throw new Error("ABC Solana provider not available");
1554
+ }
1555
+ return await abcWallet.provider.signTransaction(transaction);
1556
+ }
1557
+ if (activeWallet.type === "external") {
1558
+ if (!externalWallet.signTransaction) {
1559
+ throw new Error("Wallet does not support transaction signing");
1560
+ }
1561
+ return await externalWallet.signTransaction(transaction);
1562
+ }
1563
+ throw new Error("No Solana wallet connected");
1564
+ };
1565
+ const signAllTransactions = async (transactions) => {
1566
+ if (activeWallet.type === "abc") {
1567
+ if (!abcWallet.provider) {
1568
+ throw new Error("ABC Solana provider not available");
1569
+ }
1570
+ return await abcWallet.provider.signAllTransactions(transactions);
1571
+ }
1572
+ if (activeWallet.type === "external") {
1573
+ if (!externalWallet.signAllTransactions) {
1574
+ throw new Error("Wallet does not support batch signing");
1575
+ }
1576
+ return await externalWallet.signAllTransactions(transactions);
1577
+ }
1578
+ throw new Error("No Solana wallet connected");
1579
+ };
1580
+ const sendTransactionUniversal = async (transaction, options) => {
1581
+ if (activeWallet.type === "abc") {
1582
+ throw new Error(
1583
+ "sendTransactionUniversal for ABC Wallet not yet implemented. Use sendTransaction for SOL transfers."
1584
+ );
1585
+ }
1586
+ if (activeWallet.type === "external") {
1587
+ if (!externalWallet.sendTransaction && !externalWallet.signTransaction) {
1588
+ throw new Error("Wallet does not support transactions");
1589
+ }
1590
+ return await sendExternalSolanaTransaction({
1591
+ transaction,
1592
+ connection,
1593
+ externalWallet,
1594
+ options
1595
+ });
1596
+ }
1597
+ throw new Error("No Solana wallet connected");
1598
+ };
1599
+ return {
1600
+ address: activeWallet.address,
1601
+ publicKey: activeWallet.publicKey,
1602
+ network: activeWallet.network,
1603
+ isConnected: activeWallet.isConnected,
1604
+ type: activeWallet.type,
1605
+ walletName: activeWallet.walletName,
1606
+ isLoading,
1607
+ connecting: externalWallet.connecting,
1608
+ error: error2,
1609
+ connect,
1610
+ signMessage,
1611
+ transfer,
1612
+ getTokenBalance,
1613
+ signTransaction,
1614
+ signAllTransactions,
1615
+ sendTransactionUniversal,
1616
+ refresh
1617
+ };
1618
+ }
1619
+
1620
+ // src/contexts/MultiChainContext.tsx
1621
+ var MultiChainContext = createContext7(null);
1622
+ function useMultiChain() {
1623
+ const context = useContext6(MultiChainContext);
1624
+ if (!context) {
1625
+ throw new Error("useMultiChain must be used within MultiChainProvider");
1626
+ }
1627
+ return context;
1628
+ }
1629
+ function MultiChainProvider({
1630
+ children,
1631
+ defaultChain = "evm",
1632
+ enableSolana = false
1633
+ }) {
1634
+ const {
1635
+ address: evmAddress,
1636
+ chainId: evmChainId,
1637
+ isConnected: evmConnected
1638
+ } = useAccount5();
1639
+ const solanaWallet = enableSolana ? useSolanaWallet() : null;
1640
+ const solanaAddress = solanaWallet?.address ?? void 0;
1641
+ const solanaConnected = solanaWallet?.isConnected ?? false;
1642
+ const { disconnect: wagmiDisconnect } = useWagmiDisconnect();
1643
+ const solanaAdapterWallet = enableSolana ? useWallet2() : null;
1644
+ const solanaDisconnect = solanaAdapterWallet?.disconnect;
1645
+ const [activeChain, setActiveChain] = useState7(defaultChain);
1646
+ useEffect7(() => {
1647
+ const stored = localStorage.getItem("talkenkit_active_chain");
1648
+ if (stored && (stored === "evm" || stored === "solana")) {
1649
+ setActiveChain(stored);
1650
+ }
1651
+ }, []);
1652
+ useEffect7(() => {
1653
+ localStorage.setItem("talkenkit_active_chain", activeChain);
1654
+ }, [activeChain]);
1655
+ const disconnectAll = useCallback(async () => {
1656
+ try {
1657
+ if (evmConnected) {
1658
+ wagmiDisconnect();
1659
+ }
1660
+ if (solanaConnected && solanaDisconnect) {
1661
+ await solanaDisconnect();
1662
+ }
1663
+ } catch (error2) {
1664
+ console.error("[MultiChainContext] Failed to disconnect:", error2);
1665
+ }
1666
+ }, [evmConnected, solanaConnected, wagmiDisconnect, solanaDisconnect]);
1667
+ const state = {
1668
+ evmAddress,
1669
+ evmChainId,
1670
+ evmConnected,
1671
+ solanaAddress,
1672
+ solanaConnected,
1673
+ solanaWallet,
1674
+ activeChain,
1675
+ setActiveChain,
1676
+ disconnectAll
1677
+ };
1678
+ return /* @__PURE__ */ React11.createElement(MultiChainContext.Provider, { value: state }, children);
1679
+ }
1680
+
1681
+ // src/hooks/useIsMounted.ts
1682
+ import { useCallback as useCallback2, useEffect as useEffect8, useState as useState8 } from "react";
1683
+ function useIsMounted() {
1684
+ const [isMounted, setIsMounted] = useState8(false);
1685
+ useEffect8(() => {
1686
+ setIsMounted(true);
1687
+ return () => {
1688
+ setIsMounted(false);
1689
+ };
1690
+ }, []);
1691
+ return useCallback2(() => isMounted, [isMounted]);
1692
+ }
1693
+
1694
+ // src/hooks/useProfile.ts
1695
+ import { useQuery as useQuery2 } from "@tanstack/react-query";
1696
+ import { formatUnits } from "viem";
1697
+
1698
+ // src/core/react-query/createQuery.ts
1699
+ function createQueryKey(key, args, config2 = {}) {
1700
+ return [key, args, config2];
1701
+ }
1702
+
1703
+ // src/hooks/useChainId.ts
1704
+ import { useAccount as useAccount6 } from "wagmi";
1705
+ function useChainId() {
1706
+ const { chain: activeChain } = useAccount6();
1707
+ return activeChain?.id ?? null;
1708
+ }
1709
+
1710
+ // src/hooks/useMainnetEnsAvatar.ts
1711
+ import { normalize } from "viem/ens";
1712
+ import { useEnsAvatar } from "wagmi";
1713
+ import { mainnet as mainnet2 } from "wagmi/chains";
1714
+
1715
+ // src/hooks/useIsMainnetConfigured.ts
1716
+ import { mainnet } from "wagmi/chains";
1717
+ function useIsMainnetConfigured() {
1718
+ const rainbowKitChains = useRainbowKitChains();
1719
+ const chainId = mainnet.id;
1720
+ const configured = rainbowKitChains.some(
1721
+ (rainbowKitChain) => rainbowKitChain.id === chainId
1722
+ );
1723
+ return configured;
1724
+ }
1725
+
1726
+ // src/hooks/useMainnetEnsAvatar.ts
1727
+ function useMainnetEnsAvatar(name) {
1728
+ const mainnetConfigured = useIsMainnetConfigured();
1729
+ const safeNormalize = (ensName) => {
1730
+ try {
1731
+ return normalize(ensName);
1732
+ } catch {
1733
+ }
1734
+ };
1735
+ const { data: ensAvatar } = useEnsAvatar({
1736
+ chainId: mainnet2.id,
1737
+ name: name ? safeNormalize(name) : void 0,
1738
+ query: {
1739
+ enabled: mainnetConfigured
1740
+ }
1741
+ });
1742
+ return ensAvatar;
1743
+ }
1744
+
1745
+ // src/hooks/useMainnetEnsName.ts
1746
+ import { useQuery } from "@tanstack/react-query";
1747
+ import { useEnsName } from "wagmi";
1748
+ import { mainnet as mainnet3 } from "wagmi/chains";
1749
+
1750
+ // src/core/network/internal/rainbowFetch.ts
1751
+ async function rainbowFetch(url, opts) {
1752
+ opts = {
1753
+ headers: {},
1754
+ method: "get",
1755
+ ...opts,
1756
+ // Any other fetch options
1757
+ timeout: opts.timeout ?? 1e4
1758
+ // 10 secs
1759
+ };
1760
+ if (!url)
1761
+ throw new Error("rainbowFetch: Missing url argument");
1762
+ const controller = new AbortController();
1763
+ const id = setTimeout(() => controller.abort(), opts.timeout);
1764
+ const { body, params, headers, ...otherOpts } = opts;
1765
+ const requestBody = body && typeof body === "object" ? JSON.stringify(opts.body) : opts.body;
1766
+ const response = await fetch(`${url}${createParams(params)}`, {
1767
+ ...otherOpts,
1768
+ body: requestBody,
1769
+ headers: {
1770
+ Accept: "application/json",
1771
+ "Content-Type": "application/json",
1772
+ ...headers
1773
+ },
1774
+ signal: controller.signal
1775
+ });
1776
+ clearTimeout(id);
1777
+ const responseBody = await getBody(response);
1778
+ if (response.ok) {
1779
+ const { headers: headers2, status } = response;
1780
+ return { data: responseBody, headers: headers2, status };
1781
+ }
1782
+ const errorResponseBody = typeof responseBody === "string" ? { error: responseBody } : responseBody;
1783
+ const error2 = generateError({
1784
+ requestBody: body,
1785
+ response,
1786
+ responseBody: errorResponseBody
1787
+ });
1788
+ throw error2;
1789
+ }
1790
+ function getBody(response) {
1791
+ const contentType = response.headers.get("Content-Type");
1792
+ if (contentType?.startsWith("application/json")) {
1793
+ return response.json();
1794
+ }
1795
+ return response.text();
1796
+ }
1797
+ function createParams(params) {
1798
+ return params && Object.keys(params).length ? `?${new URLSearchParams(params)}` : "";
1799
+ }
1800
+ function generateError({
1801
+ requestBody,
1802
+ response,
1803
+ responseBody
1804
+ }) {
1805
+ const message = responseBody?.error || response?.statusText || "There was an error with the request.";
1806
+ const error2 = new Error(message);
1807
+ error2.response = response;
1808
+ error2.responseBody = responseBody;
1809
+ error2.requestBody = requestBody;
1810
+ return error2;
1811
+ }
1812
+ var RainbowFetchClient = class {
1813
+ constructor(opts = {}) {
1814
+ const { baseUrl = "", ...otherOpts } = opts;
1815
+ this.baseUrl = baseUrl;
1816
+ this.opts = otherOpts;
1817
+ }
1818
+ /**
1819
+ * Perform a GET request with the RainbowFetchClient.
1820
+ */
1821
+ get(url, opts) {
1822
+ return rainbowFetch(`${this.baseUrl}${url}`, {
1823
+ ...this.opts,
1824
+ ...opts || {},
1825
+ method: "get"
1826
+ });
1827
+ }
1828
+ /**
1829
+ * Perform a DELETE request with the RainbowFetchClient.
1830
+ */
1831
+ delete(url, opts) {
1832
+ return rainbowFetch(`${this.baseUrl}${url}`, {
1833
+ ...this.opts,
1834
+ ...opts || {},
1835
+ method: "delete"
1836
+ });
1837
+ }
1838
+ /**
1839
+ * Perform a HEAD request with the RainbowFetchClient.
1840
+ */
1841
+ head(url, opts) {
1842
+ return rainbowFetch(`${this.baseUrl}${url}`, {
1843
+ ...this.opts,
1844
+ ...opts || {},
1845
+ method: "head"
1846
+ });
1847
+ }
1848
+ /**
1849
+ * Perform a OPTIONS request with the RainbowFetchClient.
1850
+ */
1851
+ options(url, opts) {
1852
+ return rainbowFetch(`${this.baseUrl}${url}`, {
1853
+ ...this.opts,
1854
+ ...opts || {},
1855
+ method: "options"
1856
+ });
1857
+ }
1858
+ /**
1859
+ * Perform a POST request with the RainbowFetchClient.
1860
+ */
1861
+ post(url, body, opts) {
1862
+ return rainbowFetch(`${this.baseUrl}${url}`, {
1863
+ ...this.opts,
1864
+ ...opts || {},
1865
+ body,
1866
+ method: "post"
1867
+ });
1451
1868
  }
1452
1869
  /**
1453
1870
  * Perform a PUT request with the RainbowFetchClient.
@@ -1494,11 +1911,6 @@ var enhancedProviderHttp = createHttpClient({
1494
1911
  }
1495
1912
  });
1496
1913
 
1497
- // src/core/react-query/createQuery.ts
1498
- function createQueryKey(key, args, config2 = {}) {
1499
- return [key, args, config2];
1500
- }
1501
-
1502
1914
  // src/utils/ens.ts
1503
1915
  import { isAddress } from "viem";
1504
1916
  function getStorageEnsNameKey(address) {
@@ -1578,29 +1990,54 @@ function useMainnetEnsName(address) {
1578
1990
  }
1579
1991
 
1580
1992
  // src/hooks/useProfile.ts
1993
+ var createNativeBalanceQueryKey = (address, chainId) => createQueryKey("nativeBalance", {
1994
+ address,
1995
+ chainId: chainId ?? void 0
1996
+ });
1581
1997
  function useProfile({ address, includeBalance }) {
1998
+ const chainId = useChainId();
1582
1999
  const ensName = useMainnetEnsName(address);
1583
2000
  const ensAvatar = useMainnetEnsAvatar(ensName);
1584
- const { data: balance } = useBalance({
1585
- address: includeBalance ? address : void 0
2001
+ const { data: balance } = useQuery2({
2002
+ queryKey: createNativeBalanceQueryKey(address, chainId),
2003
+ queryFn: async () => {
2004
+ if (!address || !chainId)
2005
+ return void 0;
2006
+ const walletscanApi = createWalletscanApi();
2007
+ const nativeToken = await walletscanApi.getNativeTokenWithTimeout(
2008
+ {
2009
+ walletAddress: address,
2010
+ networks: getNetworkName(chainId),
2011
+ minimalInfo: false
2012
+ },
2013
+ 3e3
2014
+ );
2015
+ if (!nativeToken)
2016
+ return void 0;
2017
+ const decimals = nativeToken.decimals ?? 18;
2018
+ const rawBalance = nativeToken.balance ?? 0;
2019
+ const value = BigInt(String(rawBalance));
2020
+ return {
2021
+ decimals,
2022
+ formatted: formatUnits(value, decimals),
2023
+ symbol: nativeToken.symbol,
2024
+ value
2025
+ };
2026
+ },
2027
+ enabled: Boolean(includeBalance && address && chainId),
2028
+ staleTime: 3e4
1586
2029
  });
1587
2030
  return { ensName, ensAvatar, balance };
1588
2031
  }
1589
2032
 
1590
2033
  // src/transactions/useRecentTransactions.ts
1591
- import { useEffect as useEffect8, useState as useState8 } from "react";
1592
- import { useAccount as useAccount7 } from "wagmi";
1593
-
1594
- // src/hooks/useChainId.ts
1595
- import { useAccount as useAccount5 } from "wagmi";
1596
- function useChainId() {
1597
- const { chain: activeChain } = useAccount5();
1598
- return activeChain?.id ?? null;
1599
- }
2034
+ import { useEffect as useEffect9, useState as useState9 } from "react";
2035
+ import { useAccount as useAccount8 } from "wagmi";
1600
2036
 
1601
2037
  // src/transactions/TransactionStoreContext.tsx
2038
+ import { useQueryClient } from "@tanstack/react-query";
1602
2039
  import React12 from "react";
1603
- import { useAccount as useAccount6, useBalance as useBalance2, usePublicClient } from "wagmi";
2040
+ import { useAccount as useAccount7 } from "wagmi";
1604
2041
 
1605
2042
  // src/transactions/transactionStore.ts
1606
2043
  var storageKey = "rk-transactions";
@@ -1631,17 +2068,11 @@ function validateTransaction(transaction) {
1631
2068
  }
1632
2069
  return errors;
1633
2070
  }
1634
- function createTransactionStore({
1635
- provider: initialProvider
1636
- }) {
2071
+ function createTransactionStore() {
1637
2072
  let data = loadData();
1638
- let provider = initialProvider;
1639
2073
  const listeners = /* @__PURE__ */ new Set();
1640
2074
  const transactionListeners = /* @__PURE__ */ new Set();
1641
2075
  const transactionRequestCache = /* @__PURE__ */ new Map();
1642
- function setProvider(newProvider) {
1643
- provider = newProvider;
1644
- }
1645
2076
  function getTransactions(account, chainId) {
1646
2077
  return data[account]?.[chainId] ?? [];
1647
2078
  }
@@ -1674,34 +2105,31 @@ function createTransactionStore({
1674
2105
  async function waitForPendingTransactions(account, chainId) {
1675
2106
  await Promise.all(
1676
2107
  getTransactions(account, chainId).filter((transaction) => transaction.status === "pending").map(async (transaction) => {
1677
- const { confirmations, hash } = transaction;
2108
+ const { hash } = transaction;
1678
2109
  const existingRequest = transactionRequestCache.get(hash);
1679
2110
  if (existingRequest) {
1680
2111
  return await existingRequest;
1681
2112
  }
1682
- const requestPromise = provider.waitForTransactionReceipt({
1683
- confirmations,
1684
- hash,
1685
- timeout: 3e5
1686
- // 5 minutes
1687
- }).then(({ status }) => {
1688
- transactionRequestCache.delete(hash);
1689
- if (status === void 0) {
1690
- return;
2113
+ const requestResult = (async () => {
2114
+ try {
2115
+ const chainKey = getChainKey(chainId);
2116
+ const configApi = createConfigApi();
2117
+ const status = await configApi.waitForTxStatus(chainKey, hash, {
2118
+ timeoutMs: 3e5,
2119
+ pollIntervalMs: 3e3
2120
+ });
2121
+ transactionRequestCache.delete(hash);
2122
+ setTransactionStatus(account, chainId, hash, "confirmed");
2123
+ notifyTransactionListeners(
2124
+ status.status === "success" ? "success" : 1
2125
+ );
2126
+ } catch {
2127
+ transactionRequestCache.delete(hash);
2128
+ setTransactionStatus(account, chainId, hash, "failed");
1691
2129
  }
1692
- setTransactionStatus(
1693
- account,
1694
- chainId,
1695
- hash,
1696
- // @ts-ignore - types changed with viem@1.1.0
1697
- status === 0 || status === "reverted" ? "failed" : "confirmed"
1698
- );
1699
- notifyTransactionListeners(status);
1700
- }).catch(() => {
1701
- setTransactionStatus(account, chainId, hash, "failed");
1702
- });
1703
- transactionRequestCache.set(hash, requestPromise);
1704
- return await requestPromise;
2130
+ })();
2131
+ transactionRequestCache.set(hash, requestResult);
2132
+ return await requestResult;
1705
2133
  })
1706
2134
  );
1707
2135
  }
@@ -1749,7 +2177,6 @@ function createTransactionStore({
1749
2177
  getTransactions,
1750
2178
  onTransactionStatus,
1751
2179
  onChange,
1752
- setProvider,
1753
2180
  waitForPendingTransactions
1754
2181
  };
1755
2182
  }
@@ -1762,28 +2189,22 @@ var TransactionStoreContext = React12.createContext(
1762
2189
  function TransactionStoreProvider({
1763
2190
  children
1764
2191
  }) {
1765
- const provider = usePublicClient();
1766
- const { address } = useAccount6();
2192
+ const { address } = useAccount7();
1767
2193
  const chainId = useChainId();
1768
- const { refetch } = useBalance2({
1769
- address,
1770
- query: {
1771
- enabled: false
1772
- }
1773
- });
2194
+ const queryClient = useQueryClient();
1774
2195
  const [store] = React12.useState(
1775
- () => storeSingleton ?? (storeSingleton = createTransactionStore({ provider }))
2196
+ () => storeSingleton ?? (storeSingleton = createTransactionStore())
1776
2197
  );
1777
2198
  const onTransactionStatus = React12.useCallback(
1778
2199
  (txStatus) => {
1779
- if (txStatus === "success")
1780
- refetch();
2200
+ if (txStatus === "success" && address && chainId) {
2201
+ queryClient.invalidateQueries({
2202
+ queryKey: createNativeBalanceQueryKey(address, chainId)
2203
+ });
2204
+ }
1781
2205
  },
1782
- [refetch]
2206
+ [address, chainId, queryClient]
1783
2207
  );
1784
- React12.useEffect(() => {
1785
- store.setProvider(provider);
1786
- }, [store, provider]);
1787
2208
  React12.useEffect(() => {
1788
2209
  if (address && chainId) {
1789
2210
  store.waitForPendingTransactions(address, chainId);
@@ -1807,12 +2228,12 @@ function useTransactionStore() {
1807
2228
  // src/transactions/useRecentTransactions.ts
1808
2229
  function useRecentTransactions() {
1809
2230
  const store = useTransactionStore();
1810
- const { address } = useAccount7();
2231
+ const { address } = useAccount8();
1811
2232
  const chainId = useChainId();
1812
- const [transactions, setTransactions] = useState8(
2233
+ const [transactions, setTransactions] = useState9(
1813
2234
  () => store && address && chainId ? store.getTransactions(address, chainId) : []
1814
2235
  );
1815
- useEffect8(() => {
2236
+ useEffect9(() => {
1816
2237
  if (store && address && chainId) {
1817
2238
  setTransactions(store.getTransactions(address, chainId));
1818
2239
  return store.onChange(() => {
@@ -1828,21 +2249,21 @@ import React98, {
1828
2249
  createContext as createContext16,
1829
2250
  useCallback as useCallback25,
1830
2251
  useContext as useContext27,
1831
- useEffect as useEffect30,
2252
+ useEffect as useEffect31,
1832
2253
  useMemo as useMemo19,
1833
- useState as useState37
2254
+ useState as useState38
1834
2255
  } from "react";
1835
- import { useAccount as useAccount16, useAccountEffect as useAccountEffect3, useConfig as useConfig3 } from "wagmi";
2256
+ import { useAccount as useAccount17, useAccountEffect as useAccountEffect3, useConfig as useConfig3 } from "wagmi";
1836
2257
 
1837
2258
  // src/components/AccountModal/AccountModal.tsx
1838
2259
  import React62, { useContext as useContext15 } from "react";
1839
- import { useAccount as useAccount13, useDisconnect } from "wagmi";
2260
+ import { useAccount as useAccount14, useDisconnect } from "wagmi";
1840
2261
 
1841
2262
  // src/components/Dialog/Dialog.tsx
1842
2263
  import React50, {
1843
2264
  useCallback as useCallback18,
1844
- useEffect as useEffect21,
1845
- useState as useState20
2265
+ useEffect as useEffect22,
2266
+ useState as useState21
1846
2267
  } from "react";
1847
2268
  import { createPortal } from "react-dom";
1848
2269
  import { RemoveScroll } from "react-remove-scroll";
@@ -1891,21 +2312,21 @@ function cssStringFromTheme(theme, options = {}) {
1891
2312
  }
1892
2313
 
1893
2314
  // src/providers/SignConfirmationProvider/SignConfirmationProvider.tsx
1894
- import { useWallet as useWallet2 } from "@solana/wallet-adapter-react";
2315
+ import { useWallet as useWallet3 } from "@solana/wallet-adapter-react";
1895
2316
  import React35, {
1896
2317
  createContext as createContext8,
1897
2318
  useContext as useContext7,
1898
- useState as useState17,
2319
+ useState as useState18,
1899
2320
  useCallback as useCallback13,
1900
- useEffect as useEffect15
2321
+ useEffect as useEffect16
1901
2322
  } from "react";
1902
- import { useAccount as useAccount8 } from "wagmi";
2323
+ import { useAccount as useAccount9 } from "wagmi";
1903
2324
 
1904
2325
  // src/components/ConfirmationModal/SignConfirmationModal.tsx
1905
2326
  import React17, {
1906
- useEffect as useEffect9,
2327
+ useEffect as useEffect10,
1907
2328
  useRef,
1908
- useState as useState10,
2329
+ useState as useState11,
1909
2330
  useCallback as useCallback4,
1910
2331
  useMemo as useMemo6
1911
2332
  } from "react";
@@ -2026,11 +2447,11 @@ function Toast({ message, isVisible }) {
2026
2447
  }
2027
2448
 
2028
2449
  // src/components/Toast/useToast.ts
2029
- import { useCallback as useCallback3, useState as useState9 } from "react";
2450
+ import { useCallback as useCallback3, useState as useState10 } from "react";
2030
2451
  function useToast(options = {}) {
2031
2452
  const { duration = 1500 } = options;
2032
- const [isVisible, setIsVisible] = useState9(false);
2033
- const [message, setMessage] = useState9("");
2453
+ const [isVisible, setIsVisible] = useState10(false);
2454
+ const [message, setMessage] = useState10("");
2034
2455
  const showToast = useCallback3(
2035
2456
  (msg) => {
2036
2457
  setMessage(msg);
@@ -2204,7 +2625,7 @@ function SignConfirmationModal({
2204
2625
  defaultExpanded = true
2205
2626
  }) {
2206
2627
  const modalRef = useRef(null);
2207
- const [isExpanded, setIsExpanded] = useState10(defaultExpanded);
2628
+ const [isExpanded, setIsExpanded] = useState11(defaultExpanded);
2208
2629
  const {
2209
2630
  isVisible: toastVisible2,
2210
2631
  message: toastMessage,
@@ -2227,7 +2648,7 @@ function SignConfirmationModal({
2227
2648
  console.error("[SignConfirmationModal] Failed to copy message:", err);
2228
2649
  }
2229
2650
  }, [message, showToast]);
2230
- useEffect9(() => {
2651
+ useEffect10(() => {
2231
2652
  const handleEscape = (e) => {
2232
2653
  if (e.key === "Escape" && isOpen) {
2233
2654
  onClose();
@@ -2236,7 +2657,7 @@ function SignConfirmationModal({
2236
2657
  document.addEventListener("keydown", handleEscape);
2237
2658
  return () => document.removeEventListener("keydown", handleEscape);
2238
2659
  }, [isOpen, onClose]);
2239
- useEffect9(() => {
2660
+ useEffect10(() => {
2240
2661
  if (isOpen) {
2241
2662
  document.body.style.overflow = "hidden";
2242
2663
  } else {
@@ -2246,7 +2667,7 @@ function SignConfirmationModal({
2246
2667
  document.body.style.overflow = "";
2247
2668
  };
2248
2669
  }, [isOpen]);
2249
- useEffect9(() => {
2670
+ useEffect10(() => {
2250
2671
  if (isOpen) {
2251
2672
  setIsExpanded(defaultExpanded);
2252
2673
  }
@@ -2378,9 +2799,9 @@ function SignConfirmationModal({
2378
2799
 
2379
2800
  // src/components/ConfirmationModal/TransactionConfirmationModal.tsx
2380
2801
  import React32, {
2381
- useEffect as useEffect12,
2802
+ useEffect as useEffect13,
2382
2803
  useRef as useRef6,
2383
- useState as useState15,
2804
+ useState as useState16,
2384
2805
  useCallback as useCallback9,
2385
2806
  useMemo as useMemo11
2386
2807
  } from "react";
@@ -2408,10 +2829,10 @@ function createBlockiesDataUrl(address, size = 8, scale = 4) {
2408
2829
  // src/components/GasFeeModal/GasFeeEditModal.tsx
2409
2830
  import React25, {
2410
2831
  useCallback as useCallback5,
2411
- useEffect as useEffect10,
2832
+ useEffect as useEffect11,
2412
2833
  useMemo as useMemo7,
2413
2834
  useRef as useRef2,
2414
- useState as useState11
2835
+ useState as useState12
2415
2836
  } from "react";
2416
2837
 
2417
2838
  // src/components/Icons/Close2.tsx
@@ -2843,10 +3264,10 @@ function GasFeeEditModal({
2843
3264
  currentPriorityFee = "",
2844
3265
  nativeSymbol = "ETH"
2845
3266
  }) {
2846
- const [selectedPriority, setSelectedPriority] = useState11(currentOption);
2847
- const [customGasLimit, setCustomGasLimit] = useState11(currentGasLimit);
2848
- const [customMaxFee, setCustomMaxFee] = useState11(currentMaxFee);
2849
- const [customPriorityFee, setCustomPriorityFee] = useState11(currentPriorityFee);
3267
+ const [selectedPriority, setSelectedPriority] = useState12(currentOption);
3268
+ const [customGasLimit, setCustomGasLimit] = useState12(currentGasLimit);
3269
+ const [customMaxFee, setCustomMaxFee] = useState12(currentMaxFee);
3270
+ const [customPriorityFee, setCustomPriorityFee] = useState12(currentPriorityFee);
2850
3271
  const modalRef = useRef2(null);
2851
3272
  const handleTooltipMouseEnter2 = useCallback5(
2852
3273
  (e) => {
@@ -2870,7 +3291,7 @@ function GasFeeEditModal({
2870
3291
  },
2871
3292
  []
2872
3293
  );
2873
- useEffect10(() => {
3294
+ useEffect11(() => {
2874
3295
  if (isOpen) {
2875
3296
  setSelectedPriority(currentOption);
2876
3297
  setCustomGasLimit(currentGasLimit);
@@ -2884,7 +3305,7 @@ function GasFeeEditModal({
2884
3305
  currentMaxFee,
2885
3306
  currentPriorityFee
2886
3307
  ]);
2887
- useEffect10(() => {
3308
+ useEffect11(() => {
2888
3309
  const handleEscape = (e) => {
2889
3310
  if (e.key === "Escape" && isOpen) {
2890
3311
  onClose();
@@ -3200,7 +3621,7 @@ var EditIcon = ({ size = 18 }) => /* @__PURE__ */ React26.createElement(
3200
3621
  );
3201
3622
 
3202
3623
  // src/components/ConfirmationModal/NftApprovalSection.tsx
3203
- import React28, { useCallback as useCallback6, useMemo as useMemo8, useRef as useRef3, useState as useState12 } from "react";
3624
+ import React28, { useCallback as useCallback6, useMemo as useMemo8, useRef as useRef3, useState as useState13 } from "react";
3204
3625
 
3205
3626
  // src/components/ConfirmationModal/NFTPlaceholder.tsx
3206
3627
  import React27 from "react";
@@ -3333,7 +3754,7 @@ function NftApprovalSection({
3333
3754
  nftApprovalInfo
3334
3755
  }) {
3335
3756
  const sectionRef = useRef3(null);
3336
- const [imageError, setImageError] = useState12(false);
3757
+ const [imageError, setImageError] = useState13(false);
3337
3758
  const handleTooltipPosition = useCallback6(
3338
3759
  (e) => handleTooltipMouseEnter(e, sectionRef),
3339
3760
  []
@@ -3427,10 +3848,10 @@ var MAX_UINT256 = BigInt(
3427
3848
  // src/components/ConfirmationModal/ApproveSection.tsx
3428
3849
  import React29, {
3429
3850
  useCallback as useCallback7,
3430
- useEffect as useEffect11,
3851
+ useEffect as useEffect12,
3431
3852
  useMemo as useMemo9,
3432
3853
  useRef as useRef4,
3433
- useState as useState13
3854
+ useState as useState14
3434
3855
  } from "react";
3435
3856
 
3436
3857
  // src/utils/tokenMapper.ts
@@ -3552,9 +3973,9 @@ function ApproveSection({
3552
3973
  }
3553
3974
  return formatTokenAmount(approveInfo.amount, tokenDecimals);
3554
3975
  }, [approveInfo.amount, tokenDecimals]);
3555
- const [inputValue, setInputValue] = useState13(formattedAmount);
3976
+ const [inputValue, setInputValue] = useState14(formattedAmount);
3556
3977
  const isUserEditing = useRef4(false);
3557
- useEffect11(() => {
3978
+ useEffect12(() => {
3558
3979
  if (!isUserEditing.current) {
3559
3980
  setInputValue(formattedAmount);
3560
3981
  }
@@ -3701,7 +4122,7 @@ function ApproveSection({
3701
4122
  }
3702
4123
 
3703
4124
  // src/components/ConfirmationModal/TransferSection.tsx
3704
- import React30, { useState as useState14 } from "react";
4125
+ import React30, { useState as useState15 } from "react";
3705
4126
 
3706
4127
  // src/components/ConfirmationModal/TransferSection.css.ts
3707
4128
  var addressColumn = "_1gau5ng9";
@@ -3735,7 +4156,7 @@ function isNftToken(token) {
3735
4156
  }
3736
4157
  function TransferSection({ transferInfo }) {
3737
4158
  const { from, to, token, amount, amountUsd } = transferInfo;
3738
- const [imageError, setImageError] = useState14(false);
4159
+ const [imageError, setImageError] = useState15(false);
3739
4160
  const isNft = isNftToken(token);
3740
4161
  return /* @__PURE__ */ React30.createElement("div", { className: transferSection }, isNft ? (
3741
4162
  // NFT Display
@@ -4310,7 +4731,7 @@ function TransactionConfirmationModal({
4310
4731
  defaultDataExpanded = false
4311
4732
  }) {
4312
4733
  const modalRef = useRef6(null);
4313
- const [isDataExpanded, setIsDataExpanded] = useState15(defaultDataExpanded);
4734
+ const [isDataExpanded, setIsDataExpanded] = useState16(defaultDataExpanded);
4314
4735
  const {
4315
4736
  isVisible: toastVisible2,
4316
4737
  message: toastMessage,
@@ -4346,11 +4767,11 @@ function TransactionConfirmationModal({
4346
4767
  return void 0;
4347
4768
  }, [gasLimit, maxFee]);
4348
4769
  const estimatedGasUsd = void 0;
4349
- const [isGasFeeEditOpen, setIsGasFeeEditOpen] = useState15(false);
4350
- const [selectedGasOption, setSelectedGasOption] = useState15(
4770
+ const [isGasFeeEditOpen, setIsGasFeeEditOpen] = useState16(false);
4771
+ const [selectedGasOption, setSelectedGasOption] = useState16(
4351
4772
  null
4352
4773
  );
4353
- const [localApproveInfo, setLocalApproveInfo] = useState15(approveInfo);
4774
+ const [localApproveInfo, setLocalApproveInfo] = useState16(approveInfo);
4354
4775
  const displayedGasSpeed = useMemo11(() => {
4355
4776
  if (!selectedGasOption)
4356
4777
  return gasSpeed || "--";
@@ -4512,7 +4933,7 @@ function TransactionConfirmationModal({
4512
4933
  },
4513
4934
  [localApproveInfo, approveInfo]
4514
4935
  );
4515
- useEffect12(() => {
4936
+ useEffect13(() => {
4516
4937
  setLocalApproveInfo(approveInfo);
4517
4938
  }, [approveInfo]);
4518
4939
  const hasData = data && data !== "0x" && data.length > 2;
@@ -4536,7 +4957,7 @@ function TransactionConfirmationModal({
4536
4957
  console.error("[TransactionConfirmationModal] Failed to copy data:", err);
4537
4958
  }
4538
4959
  }, [data, showToast]);
4539
- useEffect12(() => {
4960
+ useEffect13(() => {
4540
4961
  const handleEscape = (e) => {
4541
4962
  if (e.key === "Escape" && isOpen) {
4542
4963
  onClose();
@@ -4545,7 +4966,7 @@ function TransactionConfirmationModal({
4545
4966
  document.addEventListener("keydown", handleEscape);
4546
4967
  return () => document.removeEventListener("keydown", handleEscape);
4547
4968
  }, [isOpen, onClose]);
4548
- useEffect12(() => {
4969
+ useEffect13(() => {
4549
4970
  if (isOpen) {
4550
4971
  document.body.style.overflow = "hidden";
4551
4972
  } else {
@@ -4555,7 +4976,7 @@ function TransactionConfirmationModal({
4555
4976
  document.body.style.overflow = "";
4556
4977
  };
4557
4978
  }, [isOpen]);
4558
- useEffect12(() => {
4979
+ useEffect13(() => {
4559
4980
  if (isOpen) {
4560
4981
  setIsDataExpanded(defaultDataExpanded);
4561
4982
  }
@@ -4748,7 +5169,7 @@ function TransactionConfirmationModal({
4748
5169
  }
4749
5170
 
4750
5171
  // src/components/ConfirmationModal/NonEvmSignConfirmationModal.tsx
4751
- import React33, { useCallback as useCallback10, useEffect as useEffect13, useRef as useRef7, useState as useState16 } from "react";
5172
+ import React33, { useCallback as useCallback10, useEffect as useEffect14, useRef as useRef7, useState as useState17 } from "react";
4752
5173
 
4753
5174
  // src/components/ConfirmationModal/NonEvmConfirmationModal.css.ts
4754
5175
  var actions3 = "_1i4xtnq1b";
@@ -4890,7 +5311,7 @@ function NonEvmSignConfirmationModal({
4890
5311
  request
4891
5312
  }) {
4892
5313
  const modalRef = useRef7(null);
4893
- const [isExpanded, setIsExpanded] = useState16(true);
5314
+ const [isExpanded, setIsExpanded] = useState17(true);
4894
5315
  const {
4895
5316
  isVisible: toastVisible2,
4896
5317
  message: toastMessage,
@@ -4909,7 +5330,7 @@ function NonEvmSignConfirmationModal({
4909
5330
  console.error("[NonEvmSignModal] Failed to copy:", err);
4910
5331
  }
4911
5332
  }, [request.message, showToast]);
4912
- useEffect13(() => {
5333
+ useEffect14(() => {
4913
5334
  const handleEscape = (e) => {
4914
5335
  if (e.key === "Escape" && isOpen)
4915
5336
  onClose();
@@ -4917,7 +5338,7 @@ function NonEvmSignConfirmationModal({
4917
5338
  document.addEventListener("keydown", handleEscape);
4918
5339
  return () => document.removeEventListener("keydown", handleEscape);
4919
5340
  }, [isOpen, onClose]);
4920
- useEffect13(() => {
5341
+ useEffect14(() => {
4921
5342
  if (isOpen) {
4922
5343
  document.body.style.overflow = "hidden";
4923
5344
  } else {
@@ -4927,7 +5348,7 @@ function NonEvmSignConfirmationModal({
4927
5348
  document.body.style.overflow = "";
4928
5349
  };
4929
5350
  }, [isOpen]);
4930
- useEffect13(() => {
5351
+ useEffect14(() => {
4931
5352
  if (isOpen)
4932
5353
  setIsExpanded(true);
4933
5354
  }, [isOpen]);
@@ -5026,7 +5447,7 @@ function NonEvmSignConfirmationModal({
5026
5447
  }
5027
5448
 
5028
5449
  // src/components/ConfirmationModal/NonEvmTransferConfirmationModal.tsx
5029
- import React34, { useEffect as useEffect14, useRef as useRef8 } from "react";
5450
+ import React34, { useEffect as useEffect15, useRef as useRef8 } from "react";
5030
5451
 
5031
5452
  // src/components/ConfirmationModal/commonStyles.css.ts
5032
5453
  var sendAmountNegative = "_1i4xtnqu";
@@ -5053,7 +5474,7 @@ function NonEvmTransferConfirmationModal({
5053
5474
  const { isVisible: toastVisible2, message: toastMessage } = useToast();
5054
5475
  const chainName2 = getChainDisplayName2(request.chain, request.network);
5055
5476
  const modalTitle = "Transfer request";
5056
- useEffect14(() => {
5477
+ useEffect15(() => {
5057
5478
  const handleEscape = (e) => {
5058
5479
  if (e.key === "Escape" && isOpen)
5059
5480
  onClose();
@@ -5061,7 +5482,7 @@ function NonEvmTransferConfirmationModal({
5061
5482
  document.addEventListener("keydown", handleEscape);
5062
5483
  return () => document.removeEventListener("keydown", handleEscape);
5063
5484
  }, [isOpen, onClose]);
5064
- useEffect14(() => {
5485
+ useEffect15(() => {
5065
5486
  if (isOpen) {
5066
5487
  document.body.style.overflow = "hidden";
5067
5488
  } else {
@@ -5664,22 +6085,10 @@ function parseTransactionParams(params) {
5664
6085
 
5665
6086
  // src/providers/SignConfirmationProvider/useTransactionResolver.ts
5666
6087
  import { useCallback as useCallback12 } from "react";
5667
- import { erc20Abi as erc20Abi2 } from "viem";
5668
- import { usePublicClient as usePublicClient2 } from "wagmi";
5669
6088
 
5670
6089
  // src/providers/SignConfirmationProvider/useApiClient.ts
5671
6090
  import { useCallback as useCallback11 } from "react";
5672
6091
  import { toHex } from "viem";
5673
-
5674
- // src/utils/apiClientFactory.ts
5675
- function createWalletscanApi() {
5676
- return new WalletscanApi();
5677
- }
5678
- function createGasApi() {
5679
- return new GasApi();
5680
- }
5681
-
5682
- // src/providers/SignConfirmationProvider/useApiClient.ts
5683
6092
  function useApiClient() {
5684
6093
  const fetchGasFees = useCallback11(
5685
6094
  async (chainId) => {
@@ -5770,6 +6179,22 @@ function useApiClient() {
5770
6179
  },
5771
6180
  []
5772
6181
  );
6182
+ const fetchTokenBalance = useCallback11(
6183
+ async (ownerAddress, tokenAddress, chainId) => {
6184
+ try {
6185
+ const tokenApi = createTokenApi();
6186
+ return await tokenApi.getTokenBalance(
6187
+ ownerAddress,
6188
+ getChainKey(chainId),
6189
+ tokenAddress
6190
+ );
6191
+ } catch (error2) {
6192
+ console.warn("[useApiClient] Failed to fetch token balance:", error2);
6193
+ return null;
6194
+ }
6195
+ },
6196
+ []
6197
+ );
5773
6198
  const fetchNFTMetadata = useCallback11(
5774
6199
  async (contractAddress, walletAddress, chainId) => {
5775
6200
  try {
@@ -5793,9 +6218,11 @@ function useApiClient() {
5793
6218
  []
5794
6219
  );
5795
6220
  return {
6221
+ createConfigApi,
5796
6222
  fetchGasFees,
5797
6223
  fetchGasLimit,
5798
6224
  fetchNativeTokenMetadata,
6225
+ fetchTokenBalance,
5799
6226
  fetchTokenMetadata,
5800
6227
  fetchNFTMetadata
5801
6228
  };
@@ -5803,12 +6230,12 @@ function useApiClient() {
5803
6230
 
5804
6231
  // src/providers/SignConfirmationProvider/useTransactionResolver.ts
5805
6232
  function useTransactionResolver() {
5806
- const publicClient = usePublicClient2();
5807
6233
  const rainbowKitChainsById = useRainbowKitChainsById();
5808
6234
  const {
5809
6235
  fetchGasFees,
5810
6236
  fetchGasLimit,
5811
6237
  fetchNativeTokenMetadata,
6238
+ fetchTokenBalance,
5812
6239
  fetchTokenMetadata,
5813
6240
  fetchNFTMetadata
5814
6241
  } = useApiClient();
@@ -6035,20 +6462,17 @@ function useTransactionResolver() {
6035
6462
  const metadata = await fetchTokenMetadata(parsed.to, request.chainId);
6036
6463
  const token = metadata ? { ...toFungibleToken(metadata), contractAddress: parsed.to } : createFallbackFungibleToken(parsed.to);
6037
6464
  let balance;
6038
- if (publicClient) {
6039
- try {
6040
- balance = await publicClient.readContract({
6041
- address: parsed.to,
6042
- abi: erc20Abi2,
6043
- functionName: "balanceOf",
6044
- args: [request.address]
6045
- });
6046
- } catch (balanceError) {
6047
- console.warn(
6048
- "[useTransactionResolver] Failed to fetch token balance:",
6049
- balanceError
6050
- );
6051
- }
6465
+ try {
6466
+ balance = await fetchTokenBalance(
6467
+ request.address,
6468
+ parsed.to,
6469
+ request.chainId
6470
+ ) ?? void 0;
6471
+ } catch (balanceError) {
6472
+ console.warn(
6473
+ "[useTransactionResolver] Failed to fetch token balance:",
6474
+ balanceError
6475
+ );
6052
6476
  }
6053
6477
  parsed.approveInfo = {
6054
6478
  spender: decoded.spender,
@@ -6081,7 +6505,7 @@ function useTransactionResolver() {
6081
6505
  }
6082
6506
  }
6083
6507
  },
6084
- [publicClient, fetchTokenMetadata]
6508
+ [fetchTokenBalance, fetchTokenMetadata]
6085
6509
  );
6086
6510
  const resolveSwapInfo = useCallback12(
6087
6511
  async (parsed, request) => {
@@ -6269,24 +6693,24 @@ function SignConfirmationProvider({
6269
6693
  children,
6270
6694
  disabled = false
6271
6695
  }) {
6272
- const [isModalOpen, setIsModalOpen] = useState17(false);
6273
- const [requestType, setRequestType] = useState17(null);
6274
- const [currentRequest, setCurrentRequest] = useState17(null);
6275
- const [parsedSign, setParsedSign] = useState17(null);
6276
- const [parsedTypedData, setParsedTypedData] = useState17(null);
6277
- const [parsedAuthorization, setParsedAuthorization] = useState17(null);
6278
- const [parsedTransaction, setParsedTransaction] = useState17(null);
6279
- const [nonEvmRequest, setNonEvmRequest] = useState17(null);
6280
- const [resolver, setResolver] = useState17(null);
6281
- const [rejecter, setRejecter] = useState17(
6696
+ const [isModalOpen, setIsModalOpen] = useState18(false);
6697
+ const [requestType, setRequestType] = useState18(null);
6698
+ const [currentRequest, setCurrentRequest] = useState18(null);
6699
+ const [parsedSign, setParsedSign] = useState18(null);
6700
+ const [parsedTypedData, setParsedTypedData] = useState18(null);
6701
+ const [parsedAuthorization, setParsedAuthorization] = useState18(null);
6702
+ const [parsedTransaction, setParsedTransaction] = useState18(null);
6703
+ const [nonEvmRequest, setNonEvmRequest] = useState18(null);
6704
+ const [resolver, setResolver] = useState18(null);
6705
+ const [rejecter, setRejecter] = useState18(
6282
6706
  null
6283
6707
  );
6284
- const [nonEvmResolver, setNonEvmResolver] = useState17(
6708
+ const [nonEvmResolver, setNonEvmResolver] = useState18(
6285
6709
  null
6286
6710
  );
6287
- const [nonEvmRejecter, setNonEvmRejecter] = useState17(null);
6288
- const { connector, isConnected } = useAccount8();
6289
- const { wallets: solanaWallets } = useWallet2();
6711
+ const [nonEvmRejecter, setNonEvmRejecter] = useState18(null);
6712
+ const { connector, isConnected } = useAccount9();
6713
+ const { wallets: solanaWallets } = useWallet3();
6290
6714
  const { resolveTransaction } = useTransactionResolver();
6291
6715
  const rainbowKitChainsById = useRainbowKitChainsById();
6292
6716
  const resetState = useCallback13(() => {
@@ -6387,7 +6811,7 @@ function SignConfirmationProvider({
6387
6811
  },
6388
6812
  [disabled]
6389
6813
  );
6390
- useEffect15(() => {
6814
+ useEffect16(() => {
6391
6815
  if (disabled || !connector || !isConnected) {
6392
6816
  return;
6393
6817
  }
@@ -6420,7 +6844,7 @@ function SignConfirmationProvider({
6420
6844
  cleanup();
6421
6845
  };
6422
6846
  }, [connector, isConnected, requestConfirmation, disabled]);
6423
- useEffect15(() => {
6847
+ useEffect16(() => {
6424
6848
  if (disabled)
6425
6849
  return;
6426
6850
  const abcWalletInfo = solanaWallets.find(
@@ -6440,8 +6864,8 @@ function SignConfirmationProvider({
6440
6864
  }, [solanaWallets, requestNonEvmConfirmation, disabled]);
6441
6865
  const chainName2 = currentRequest ? getNetworkName(currentRequest.chainId) : "Unknown";
6442
6866
  const displayChainName = chainName2.charAt(0).toUpperCase() + chainName2.slice(1);
6443
- const [_chainIcon, setChainIcon] = useState17(void 0);
6444
- useEffect15(() => {
6867
+ const [_chainIcon, setChainIcon] = useState18(void 0);
6868
+ useEffect16(() => {
6445
6869
  if (currentRequest?.chainId) {
6446
6870
  const chain = rainbowKitChainsById[currentRequest.chainId];
6447
6871
  if (chain?.iconUrl) {
@@ -6627,10 +7051,6 @@ async function decryptWithPin(encryptedHex, hashedPin, saltHex) {
6627
7051
  throw new Error("Failed to decrypt data. Invalid PIN or corrupted data.");
6628
7052
  }
6629
7053
  }
6630
- async function verifyPin(pin, storedPinHash) {
6631
- const hashedPin = await hashPin(pin);
6632
- return hashedPin === storedPinHash;
6633
- }
6634
7054
 
6635
7055
  // src/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.ts
6636
7056
  var AbcWalletName = "ABC Wallet";
@@ -6852,7 +7272,7 @@ var AbcSolanaWalletAdapter = class extends BaseMessageSignerWalletAdapter {
6852
7272
  return;
6853
7273
  }
6854
7274
  this._connecting = true;
6855
- const authState = localStorage.getItem("talkenkit_abc_auth_state");
7275
+ const authState = localStorage.getItem(`${STORAGE_PREFIX}auth_state`);
6856
7276
  if (authState) {
6857
7277
  try {
6858
7278
  const authData = JSON.parse(authState);
@@ -6897,7 +7317,7 @@ var AbcSolanaWalletAdapter = class extends BaseMessageSignerWalletAdapter {
6897
7317
  console.log(
6898
7318
  "[AbcSolanaWalletAdapter] Token expired, clearing session"
6899
7319
  );
6900
- localStorage.removeItem("talkenkit_abc_auth_state");
7320
+ localStorage.removeItem(`${STORAGE_PREFIX}auth_state`);
6901
7321
  }
6902
7322
  } catch (error2) {
6903
7323
  console.error(
@@ -7038,7 +7458,7 @@ var AbcSolanaWalletAdapter = class extends BaseMessageSignerWalletAdapter {
7038
7458
  message: messageText
7039
7459
  });
7040
7460
  const messageHex = Buffer.from(message).toString("hex");
7041
- const pinHash = localStorage.getItem("talkenkit_abc_pin_hash") || "";
7461
+ const pinHash = getCredentialManager().getPinHash() || "";
7042
7462
  const signatureResponse = await this._talkenApi.solana.sign({
7043
7463
  keyId: this._wallet.keyId || "",
7044
7464
  encryptedShare: this._wallet.encryptedShare || "",
@@ -7175,7 +7595,7 @@ var AbcSolanaWalletAdapter = class extends BaseMessageSignerWalletAdapter {
7175
7595
  if (this.connected || this.connecting) {
7176
7596
  return;
7177
7597
  }
7178
- const authState = localStorage.getItem("talkenkit_abc_auth_state");
7598
+ const authState = localStorage.getItem(`${STORAGE_PREFIX}auth_state`);
7179
7599
  if (!authState) {
7180
7600
  return;
7181
7601
  }
@@ -7337,8 +7757,8 @@ var AbcSolanaWalletAdapter = class extends BaseMessageSignerWalletAdapter {
7337
7757
  var abcSolanaWalletAdapter_default = AbcSolanaWalletAdapter;
7338
7758
 
7339
7759
  // src/solana/AbcSolanaAutoConnector.tsx
7340
- import { useWallet as useWallet3 } from "@solana/wallet-adapter-react";
7341
- import { useEffect as useEffect16, useRef as useRef9 } from "react";
7760
+ import { useWallet as useWallet4 } from "@solana/wallet-adapter-react";
7761
+ import { useEffect as useEffect17, useRef as useRef9 } from "react";
7342
7762
 
7343
7763
  // src/solana/recentSolanaWalletIds.ts
7344
7764
  var RECENT_SOLANA_WALLET_STORAGE_KEY = "talkenkit.recent_solana_wallet";
@@ -7362,15 +7782,15 @@ function setRecentSolanaWallet(walletName2) {
7362
7782
 
7363
7783
  // src/solana/AbcSolanaAutoConnector.tsx
7364
7784
  function AbcSolanaAutoConnector() {
7365
- const { wallets, select, connected, wallet } = useWallet3();
7785
+ const { wallets, select, connected, wallet } = useWallet4();
7366
7786
  const isConnectingRef = useRef9(false);
7367
7787
  const hasAttemptedRef = useRef9(false);
7368
- useEffect16(() => {
7788
+ useEffect17(() => {
7369
7789
  if (connected && wallet?.adapter.name) {
7370
7790
  setRecentSolanaWallet(wallet.adapter.name);
7371
7791
  }
7372
7792
  }, [connected, wallet?.adapter.name]);
7373
- useEffect16(() => {
7793
+ useEffect17(() => {
7374
7794
  let retryCount = 0;
7375
7795
  const maxRetries = 3;
7376
7796
  const retryDelay = 500;
@@ -7381,14 +7801,13 @@ function AbcSolanaAutoConnector() {
7381
7801
  if (isConnectingRef.current) {
7382
7802
  return;
7383
7803
  }
7384
- const authState = localStorage.getItem("talkenkit_abc_auth_state");
7385
- if (authState) {
7804
+ const authData = loadAuthState();
7805
+ if (authData) {
7386
7806
  try {
7387
- const authData = JSON.parse(authState);
7388
7807
  if (authData.solanaWallet?.address) {
7389
7808
  const solWallet = authData.solanaWallet;
7390
- const keyId = solWallet.keyId || solWallet.key_id;
7391
- const encryptedShare = solWallet.encryptedShare || solWallet.encrypted_share;
7809
+ const keyId = solWallet.keyId;
7810
+ const encryptedShare = solWallet.encryptedShare;
7392
7811
  if (keyId && encryptedShare) {
7393
7812
  const abcWallet = wallets.find(
7394
7813
  (w) => w.adapter.name === "ABC Wallet"
@@ -7409,7 +7828,7 @@ function AbcSolanaAutoConnector() {
7409
7828
  return;
7410
7829
  } catch (error2) {
7411
7830
  if (error2?.message?.includes("requires authentication")) {
7412
- localStorage.removeItem("talkenkit_abc_auth_state");
7831
+ localStorage.removeItem(`${STORAGE_PREFIX}auth_state`);
7413
7832
  }
7414
7833
  if (retryCount < maxRetries) {
7415
7834
  retryCount++;
@@ -7498,7 +7917,7 @@ function InternalPinProvider({ children }) {
7498
7917
  import React40, { createContext as createContext13, useContext as useContext9 } from "react";
7499
7918
 
7500
7919
  // src/hooks/useWindowSize.ts
7501
- import { useEffect as useEffect17, useState as useState18 } from "react";
7920
+ import { useEffect as useEffect18, useState as useState19 } from "react";
7502
7921
 
7503
7922
  // src/utils/debounce.ts
7504
7923
  function debounce(fn, ms) {
@@ -7516,11 +7935,11 @@ function debounce(fn, ms) {
7516
7935
 
7517
7936
  // src/hooks/useWindowSize.ts
7518
7937
  var useWindowSize = () => {
7519
- const [windowSize, setWindowSize] = useState18({
7938
+ const [windowSize, setWindowSize] = useState19({
7520
7939
  height: void 0,
7521
7940
  width: void 0
7522
7941
  });
7523
- useEffect17(() => {
7942
+ useEffect18(() => {
7524
7943
  const handleResize = debounce(() => {
7525
7944
  setWindowSize({
7526
7945
  height: window.innerHeight,
@@ -7554,14 +7973,14 @@ function useRainbowKitConfig() {
7554
7973
  }
7555
7974
 
7556
7975
  // src/components/RainbowKitProvider/WalletButtonContext.tsx
7557
- import React39, { createContext as createContext12, useMemo as useMemo13, useState as useState19 } from "react";
7976
+ import React39, { createContext as createContext12, useMemo as useMemo13, useState as useState20 } from "react";
7558
7977
  var WalletButtonContext = createContext12({
7559
7978
  connector: null,
7560
7979
  setConnector: () => {
7561
7980
  }
7562
7981
  });
7563
7982
  function WalletButtonProvider({ children }) {
7564
- const [connector, setConnector] = useState19(null);
7983
+ const [connector, setConnector] = useState20(null);
7565
7984
  return /* @__PURE__ */ React39.createElement(
7566
7985
  WalletButtonContext.Provider,
7567
7986
  {
@@ -7607,22 +8026,22 @@ import { createContext as createContext14 } from "react";
7607
8026
  var ShowRecentTransactionsContext = createContext14(false);
7608
8027
 
7609
8028
  // src/components/RainbowKitProvider/useFingerprint.ts
7610
- import { useCallback as useCallback14, useEffect as useEffect18 } from "react";
8029
+ import { useCallback as useCallback14, useEffect as useEffect19 } from "react";
7611
8030
  var storageKey2 = "rk-version";
7612
8031
  function setRainbowKitVersion({ version }) {
7613
8032
  localStorage.setItem(storageKey2, version);
7614
8033
  }
7615
8034
  function useFingerprint() {
7616
8035
  const fingerprint = useCallback14(() => {
7617
- setRainbowKitVersion({ version: "2.4.23" });
8036
+ setRainbowKitVersion({ version: "2.4.25" });
7618
8037
  }, []);
7619
- useEffect18(() => {
8038
+ useEffect19(() => {
7620
8039
  fingerprint();
7621
8040
  }, [fingerprint]);
7622
8041
  }
7623
8042
 
7624
8043
  // src/components/RainbowKitProvider/usePreloadImages.ts
7625
- import { useCallback as useCallback16, useEffect as useEffect19 } from "react";
8044
+ import { useCallback as useCallback16, useEffect as useEffect20 } from "react";
7626
8045
 
7627
8046
  // src/wallets/useWalletConnectors.ts
7628
8047
  import { useConnect } from "wagmi";
@@ -7930,7 +8349,7 @@ var LoginIcon = () => /* @__PURE__ */ React42.createElement(
7930
8349
  // src/components/SignIn/SignIn.tsx
7931
8350
  import React47, { useCallback as useCallback15, useContext as useContext10, useRef as useRef10 } from "react";
7932
8351
  import { UserRejectedRequestError } from "viem";
7933
- import { useAccount as useAccount9, useSignMessage } from "wagmi";
8352
+ import { useAccount as useAccount10, useSignMessage } from "wagmi";
7934
8353
 
7935
8354
  // src/components/Button/ActionButton.tsx
7936
8355
  import React44 from "react";
@@ -8152,7 +8571,7 @@ function SignIn({
8152
8571
  getNonce();
8153
8572
  }, [getNonce]);
8154
8573
  const mobile = isMobile();
8155
- const { address, chain: activeChain } = useAccount9();
8574
+ const { address, chain: activeChain } = useAccount10();
8156
8575
  const { signMessageAsync } = useSignMessage();
8157
8576
  const signIn = async () => {
8158
8577
  try {
@@ -8360,7 +8779,7 @@ function usePreloadImages() {
8360
8779
  loadImages(signInIcon);
8361
8780
  }
8362
8781
  }, [walletConnectors, rainbowKitChains, isUnauthenticated]);
8363
- useEffect19(() => {
8782
+ useEffect20(() => {
8364
8783
  preloadImages();
8365
8784
  }, [preloadImages]);
8366
8785
  }
@@ -8527,7 +8946,7 @@ var overlay5 = "qjzye43 kwh1ip9h kwh1ipb3 kwh1ipa kwh1ip2q kwh1ip8q";
8527
8946
 
8528
8947
  // src/components/Dialog/FocusTrap.tsx
8529
8948
  import React49 from "react";
8530
- import { useCallback as useCallback17, useEffect as useEffect20, useRef as useRef11 } from "react";
8949
+ import { useCallback as useCallback17, useEffect as useEffect21, useRef as useRef11 } from "react";
8531
8950
  var moveFocusWithin = (element2, position) => {
8532
8951
  const focusableElements = element2.querySelectorAll(
8533
8952
  "button:not(:disabled), a[href]"
@@ -8538,13 +8957,13 @@ var moveFocusWithin = (element2, position) => {
8538
8957
  };
8539
8958
  function FocusTrap(props) {
8540
8959
  const contentRef = useRef11(null);
8541
- useEffect20(() => {
8960
+ useEffect21(() => {
8542
8961
  const previouslyActiveElement = document.activeElement;
8543
8962
  return () => {
8544
8963
  previouslyActiveElement.focus?.();
8545
8964
  };
8546
8965
  }, []);
8547
- useEffect20(() => {
8966
+ useEffect21(() => {
8548
8967
  if (contentRef.current) {
8549
8968
  const elementToFocus = contentRef.current.querySelector("[data-auto-focus]");
8550
8969
  if (elementToFocus) {
@@ -8586,13 +9005,13 @@ function FocusTrap(props) {
8586
9005
  // src/components/Dialog/Dialog.tsx
8587
9006
  var stopPropagation = (event) => event.stopPropagation();
8588
9007
  function Dialog({ children, onClose, open, titleId }) {
8589
- useEffect21(() => {
9008
+ useEffect22(() => {
8590
9009
  const handleEscape = (event) => open && event.key === "Escape" && onClose();
8591
9010
  document.addEventListener("keydown", handleEscape);
8592
9011
  return () => document.removeEventListener("keydown", handleEscape);
8593
9012
  }, [open, onClose]);
8594
- const [bodyScrollable, setBodyScrollable] = useState20(true);
8595
- useEffect21(() => {
9013
+ const [bodyScrollable, setBodyScrollable] = useState21(true);
9014
+ useEffect22(() => {
8596
9015
  setBodyScrollable(
8597
9016
  getComputedStyle(window.document.body).overflow !== "hidden"
8598
9017
  );
@@ -8670,7 +9089,7 @@ function DialogContent({
8670
9089
  }
8671
9090
 
8672
9091
  // src/components/ProfileDetails/ProfileDetails.tsx
8673
- import React61, { useCallback as useCallback20, useContext as useContext14, useEffect as useEffect22, useState as useState21 } from "react";
9092
+ import React61, { useCallback as useCallback20, useContext as useContext14, useEffect as useEffect23, useState as useState22 } from "react";
8674
9093
 
8675
9094
  // src/components/ConnectButton/abbreviateETHBalance.ts
8676
9095
  var units = ["k", "m", "b", "t"];
@@ -8785,14 +9204,14 @@ var DisconnectIcon = () => /* @__PURE__ */ React54.createElement(
8785
9204
 
8786
9205
  // src/components/Txs/TxList.tsx
8787
9206
  import React59, { useContext as useContext13 } from "react";
8788
- import { useAccount as useAccount12 } from "wagmi";
9207
+ import { useAccount as useAccount13 } from "wagmi";
8789
9208
 
8790
9209
  // src/transactions/useClearRecentTransactions.ts
8791
9210
  import { useCallback as useCallback19 } from "react";
8792
- import { useAccount as useAccount10 } from "wagmi";
9211
+ import { useAccount as useAccount11 } from "wagmi";
8793
9212
  function useClearRecentTransactions() {
8794
9213
  const store = useTransactionStore();
8795
- const { address } = useAccount10();
9214
+ const { address } = useAccount11();
8796
9215
  const chainId = useChainId();
8797
9216
  return useCallback19(() => {
8798
9217
  if (!address || !chainId) {
@@ -8828,7 +9247,7 @@ var ExternalLinkIcon = () => /* @__PURE__ */ React55.createElement(
8828
9247
 
8829
9248
  // src/components/Txs/TxItem.tsx
8830
9249
  import React58 from "react";
8831
- import { useAccount as useAccount11 } from "wagmi";
9250
+ import { useAccount as useAccount12 } from "wagmi";
8832
9251
 
8833
9252
  // src/components/Icons/Cancel.tsx
8834
9253
  import React56 from "react";
@@ -8889,7 +9308,7 @@ function TxItem({ tx }) {
8889
9308
  const mobile = isMobile();
8890
9309
  const Icon = getTxStatusIcon(tx.status);
8891
9310
  const color = tx.status === "failed" ? "error" : "accentColor";
8892
- const { chain: activeChain } = useAccount11();
9311
+ const { chain: activeChain } = useAccount12();
8893
9312
  const confirmationStatus = tx.status === "confirmed" ? "Confirmed" : tx.status === "failed" ? "Failed" : "Pending";
8894
9313
  const explorerLink = chainToExplorerUrl(activeChain);
8895
9314
  return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
@@ -8950,7 +9369,7 @@ var NUMBER_OF_VISIBLE_TXS = 3;
8950
9369
  function TxList({ address }) {
8951
9370
  const recentTransactions = useRecentTransactions();
8952
9371
  const clearRecentTransactions = useClearRecentTransactions();
8953
- const { chain: activeChain } = useAccount12();
9372
+ const { chain: activeChain } = useAccount13();
8954
9373
  const explorerLink = chainToExplorerUrl(activeChain);
8955
9374
  const visibleTxs = recentTransactions.slice(0, NUMBER_OF_VISIBLE_TXS);
8956
9375
  const hasTransactions = visibleTxs.length > 0;
@@ -9133,14 +9552,14 @@ function ProfileDetails({
9133
9552
  onDisconnect
9134
9553
  }) {
9135
9554
  const showRecentTransactions = useContext14(ShowRecentTransactionsContext);
9136
- const [copiedAddress, setCopiedAddress] = useState21(false);
9555
+ const [copiedAddress, setCopiedAddress] = useState22(false);
9137
9556
  const copyAddressAction = useCallback20(() => {
9138
9557
  if (address) {
9139
9558
  navigator.clipboard.writeText(address);
9140
9559
  setCopiedAddress(true);
9141
9560
  }
9142
9561
  }, [address]);
9143
- useEffect22(() => {
9562
+ useEffect23(() => {
9144
9563
  if (copiedAddress) {
9145
9564
  const timer = setTimeout(() => {
9146
9565
  setCopiedAddress(false);
@@ -9253,7 +9672,7 @@ function ProfileDetails({
9253
9672
 
9254
9673
  // src/components/AccountModal/AccountModal.tsx
9255
9674
  function AccountModal({ onClose, open }) {
9256
- const { address } = useAccount13();
9675
+ const { address } = useAccount14();
9257
9676
  const { balance, ensAvatar, ensName } = useProfile({
9258
9677
  address,
9259
9678
  includeBalance: open
@@ -9287,8 +9706,8 @@ function AccountModal({ onClose, open }) {
9287
9706
  }
9288
9707
 
9289
9708
  // src/components/ChainModal/ChainModal.tsx
9290
- import React66, { useContext as useContext17, useState as useState22 } from "react";
9291
- import { useAccount as useAccount14, useDisconnect as useDisconnect2, useSwitchChain } from "wagmi";
9709
+ import React66, { useContext as useContext17, useState as useState23 } from "react";
9710
+ import { useAccount as useAccount15, useDisconnect as useDisconnect2, useSwitchChain } from "wagmi";
9292
9711
  import { useConfig as useConfig2 } from "wagmi";
9293
9712
 
9294
9713
  // src/components/Icons/DisconnectSq.tsx
@@ -9481,9 +9900,9 @@ var MobileScrollClassName = "ty310n1";
9481
9900
 
9482
9901
  // src/components/ChainModal/ChainModal.tsx
9483
9902
  function ChainModal({ onClose, open }) {
9484
- const { chainId } = useAccount14();
9903
+ const { chainId } = useAccount15();
9485
9904
  const { chains } = useConfig2();
9486
- const [pendingChainId, setPendingChainId] = useState22(null);
9905
+ const [pendingChainId, setPendingChainId] = useState23(null);
9487
9906
  const { switchChain } = useSwitchChain({
9488
9907
  mutation: {
9489
9908
  onMutate: ({ chainId: _chainId }) => {
@@ -9613,13 +10032,13 @@ function ChainModal({ onClose, open }) {
9613
10032
 
9614
10033
  // src/components/ConnectModal/ConnectModal.tsx
9615
10034
  import React97, { useContext as useContext26 } from "react";
9616
- import { useAccount as useAccount15, useDisconnect as useDisconnect3 } from "wagmi";
10035
+ import { useAccount as useAccount16, useDisconnect as useDisconnect3 } from "wagmi";
9617
10036
 
9618
10037
  // src/components/ConnectOptions/ConnectOptions.tsx
9619
10038
  import {
9620
10039
  WalletContext
9621
10040
  } from "@solana/wallet-adapter-react";
9622
- import React93, { useCallback as useCallback22, useContext as useContext24, useMemo as useMemo18, useState as useState34 } from "react";
10041
+ import React93, { useCallback as useCallback22, useContext as useContext24, useMemo as useMemo18, useState as useState35 } from "react";
9623
10042
 
9624
10043
  // src/wallets/recentSolanaWalletIds.ts
9625
10044
  var storageKey5 = "rk-recent-solana";
@@ -9643,7 +10062,7 @@ function addRecentSolanaWalletId(walletName2) {
9643
10062
  }
9644
10063
 
9645
10064
  // src/components/ConnectOptions/ConnectOptionsModal.tsx
9646
- import React90, { useContext as useContext21, useEffect as useEffect28, useRef as useRef13, useState as useState32 } from "react";
10065
+ import React90, { useContext as useContext21, useEffect as useEffect29, useRef as useRef13, useState as useState33 } from "react";
9647
10066
  import { useConnect as useConnect2, useConnectors } from "wagmi";
9648
10067
 
9649
10068
  // src/components/ConnectModal/ConnectModalIntro.tsx
@@ -9818,7 +10237,7 @@ var InfoButton = ({
9818
10237
  import React77 from "react";
9819
10238
 
9820
10239
  // src/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthSections.tsx
9821
- import React76, { useState as useState23 } from "react";
10240
+ import React76, { useState as useState24 } from "react";
9822
10241
 
9823
10242
  // src/components/Icons/Apple.tsx
9824
10243
  import React73 from "react";
@@ -9948,7 +10367,7 @@ function AbcWaasAuthSections(props) {
9948
10367
  setAbcWaasNewPassword,
9949
10368
  setAbcWaasConfirmPassword
9950
10369
  } = props;
9951
- const [email, setEmail] = useState23("");
10370
+ const [email, setEmail] = useState24("");
9952
10371
  const isGoogleEnabled = typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_GOOGLE_OAUTH_ENABLED === "true" && !!process.env.NEXT_PUBLIC_FIREBASE_API_KEY;
9953
10372
  const isAppleEnabled = typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_APPLE_OAUTH_ENABLED === "true" && !!process.env.NEXT_PUBLIC_APPLE_OAUTH_CLIENT_ID;
9954
10373
  const isKakaoEnabled = typeof process !== "undefined" && process.env && process.env.NEXT_PUBLIC_KAKAO_OAUTH_ENABLED === "true" && !!process.env.NEXT_PUBLIC_KAKAO_JS_KEY;
@@ -10350,37 +10769,37 @@ function AbcWaasAuthSections(props) {
10350
10769
 
10351
10770
  // src/components/ConnectOptions/AbcWaasAuth/hooks/useAbcWaasAuth.ts
10352
10771
  import { getTalkenApiClient as getTalkenApiClient2 } from "@talken/talkenkit";
10353
- import { useState as useState24 } from "react";
10772
+ import { useState as useState25 } from "react";
10354
10773
  function useAbcWaasAuth(props) {
10355
10774
  const { onAuthSuccess, onPinRequired } = props || {};
10356
- const [step, setStep] = useState24("MAIN" /* Main */);
10357
- const [email, setEmail] = useState24("");
10358
- const [password, setPassword] = useState24("");
10359
- const [newPassword, setNewPassword] = useState24("");
10360
- const [confirmPassword, setConfirmPassword] = useState24("");
10361
- const [otp, setOtp] = useState24("");
10362
- const [_userType, setUserType] = useState24("new");
10363
- const [error2, setError] = useState24("");
10364
- const [isLoading, setIsLoading] = useState24(false);
10365
- const [loginData, setLoginData] = useState24(null);
10366
- const STORAGE_PREFIX2 = "talkenkit_abc_";
10775
+ const [step, setStep] = useState25("MAIN" /* Main */);
10776
+ const [email, setEmail] = useState25("");
10777
+ const [password, setPassword] = useState25("");
10778
+ const [newPassword, setNewPassword] = useState25("");
10779
+ const [confirmPassword, setConfirmPassword] = useState25("");
10780
+ const [otp, setOtp] = useState25("");
10781
+ const [_userType, setUserType] = useState25("new");
10782
+ const [error2, setError] = useState25("");
10783
+ const [isLoading, setIsLoading] = useState25(false);
10784
+ const [loginData, setLoginData] = useState25(null);
10785
+ const STORAGE_PREFIX3 = "talkenkit_abc_";
10367
10786
  const clearExpiredEncryptedData = () => {
10368
- const expiresAtStr = localStorage.getItem(`${STORAGE_PREFIX2}expires_at`);
10787
+ const expiresAtStr = localStorage.getItem(`${STORAGE_PREFIX3}expires_at`);
10369
10788
  const hasEncryptedTokens = localStorage.getItem(
10370
- `${STORAGE_PREFIX2}enc_tokens`
10789
+ `${STORAGE_PREFIX3}enc_tokens`
10371
10790
  );
10372
10791
  if (!hasEncryptedTokens)
10373
10792
  return;
10374
10793
  const expiresAt = expiresAtStr ? Number(expiresAtStr) : 0;
10375
10794
  const isExpired = Date.now() >= expiresAt;
10376
10795
  if (isExpired) {
10377
- localStorage.removeItem(`${STORAGE_PREFIX2}enc_tokens`);
10378
- localStorage.removeItem(`${STORAGE_PREFIX2}enc_salt`);
10379
- localStorage.removeItem(`${STORAGE_PREFIX2}auth_state`);
10380
- localStorage.removeItem(`${STORAGE_PREFIX2}user`);
10381
- localStorage.removeItem(`${STORAGE_PREFIX2}wallet`);
10382
- localStorage.removeItem(`${STORAGE_PREFIX2}solana_wallet`);
10383
- localStorage.removeItem(`${STORAGE_PREFIX2}bitcoin_wallet`);
10796
+ localStorage.removeItem(`${STORAGE_PREFIX3}enc_tokens`);
10797
+ localStorage.removeItem(`${STORAGE_PREFIX3}enc_salt`);
10798
+ localStorage.removeItem(`${STORAGE_PREFIX3}auth_state`);
10799
+ localStorage.removeItem(`${STORAGE_PREFIX3}user`);
10800
+ localStorage.removeItem(`${STORAGE_PREFIX3}wallet`);
10801
+ localStorage.removeItem(`${STORAGE_PREFIX3}solana_wallet`);
10802
+ localStorage.removeItem(`${STORAGE_PREFIX3}bitcoin_wallet`);
10384
10803
  }
10385
10804
  };
10386
10805
  const getApi = () => {
@@ -10408,6 +10827,11 @@ function useAbcWaasAuth(props) {
10408
10827
  "[useAbcWaasAuth] Email check failed:",
10409
10828
  checkError.message
10410
10829
  );
10830
+ setError(
10831
+ "Failed to verify email. Please check your network and try again."
10832
+ );
10833
+ setIsLoading(false);
10834
+ return;
10411
10835
  }
10412
10836
  if (isExistingUser) {
10413
10837
  setUserType("existing");
@@ -10438,13 +10862,12 @@ function useAbcWaasAuth(props) {
10438
10862
  setError("");
10439
10863
  try {
10440
10864
  clearExpiredEncryptedData();
10441
- localStorage.removeItem(`${STORAGE_PREFIX2}auth_state`);
10442
- localStorage.removeItem(`${STORAGE_PREFIX2}user`);
10443
- localStorage.removeItem(`${STORAGE_PREFIX2}wallet`);
10444
- localStorage.removeItem(`${STORAGE_PREFIX2}access_token`);
10445
- localStorage.removeItem(`${STORAGE_PREFIX2}refresh_token`);
10446
- localStorage.removeItem(`${STORAGE_PREFIX2}expires_at`);
10447
- localStorage.removeItem(`${STORAGE_PREFIX2}pin_hash`);
10865
+ localStorage.removeItem(`${STORAGE_PREFIX3}auth_state`);
10866
+ localStorage.removeItem(`${STORAGE_PREFIX3}user`);
10867
+ localStorage.removeItem(`${STORAGE_PREFIX3}wallet`);
10868
+ localStorage.removeItem(`${STORAGE_PREFIX3}access_token`);
10869
+ localStorage.removeItem(`${STORAGE_PREFIX3}refresh_token`);
10870
+ localStorage.removeItem(`${STORAGE_PREFIX3}expires_at`);
10448
10871
  const api = getApi();
10449
10872
  const data = await api.auth.loginWithPassword(email, password);
10450
10873
  const legacyData = {
@@ -10470,16 +10893,16 @@ function useAbcWaasAuth(props) {
10470
10893
  expiresAt
10471
10894
  };
10472
10895
  localStorage.setItem(
10473
- `${STORAGE_PREFIX2}auth_state`,
10896
+ `${STORAGE_PREFIX3}auth_state`,
10474
10897
  JSON.stringify(authState)
10475
10898
  );
10476
10899
  localStorage.setItem(
10477
- `${STORAGE_PREFIX2}user`,
10900
+ `${STORAGE_PREFIX3}user`,
10478
10901
  JSON.stringify(authState.user)
10479
10902
  );
10480
- localStorage.setItem(`${STORAGE_PREFIX2}access_token`, data.accessToken);
10481
- localStorage.setItem(`${STORAGE_PREFIX2}refresh_token`, data.refreshToken);
10482
- localStorage.setItem(`${STORAGE_PREFIX2}expires_at`, String(expiresAt));
10903
+ localStorage.setItem(`${STORAGE_PREFIX3}access_token`, data.accessToken);
10904
+ localStorage.setItem(`${STORAGE_PREFIX3}refresh_token`, data.refreshToken);
10905
+ localStorage.setItem(`${STORAGE_PREFIX3}expires_at`, String(expiresAt));
10483
10906
  if (onPinRequired) {
10484
10907
  onPinRequired(legacyData);
10485
10908
  } else if (onAuthSuccess) {
@@ -10606,7 +11029,7 @@ function useAbcWaasAuth(props) {
10606
11029
  }
10607
11030
 
10608
11031
  // src/components/ConnectOptions/AbcWaasAuth/hooks/useAbcWaasSocial.ts
10609
- import { useState as useState25 } from "react";
11032
+ import { useState as useState26 } from "react";
10610
11033
 
10611
11034
  // src/services/AbcAuthService.ts
10612
11035
  import { getTalkenApiClient as getTalkenApiClient3 } from "@talken/talkenkit";
@@ -11115,20 +11538,14 @@ async function performSnsLogin(token, service, email) {
11115
11538
  if (!api) {
11116
11539
  throw new Error("TalkenApiClient not initialized");
11117
11540
  }
11118
- try {
11119
- const res = await api.auth.loginWithSns({ token, service });
11120
- return {
11121
- uid: res.uid,
11122
- access_token: res.accessToken,
11123
- refresh_token: res.refreshToken,
11124
- email: res.email || email,
11125
- user_type: res.isNewUser ? "new" : "existing"
11126
- };
11127
- } catch (err) {
11128
- if (err.name === "TalkenApiError" && err.details?.code === 618) {
11129
- }
11130
- throw err;
11131
- }
11541
+ const res = await api.auth.loginWithSns({ token, service });
11542
+ return {
11543
+ uid: res.uid,
11544
+ access_token: res.accessToken,
11545
+ refresh_token: res.refreshToken,
11546
+ email: res.email || email,
11547
+ user_type: res.isNewUser ? "new" : "existing"
11548
+ };
11132
11549
  }
11133
11550
  async function googleLogin2(_config) {
11134
11551
  initializeFirebase();
@@ -11154,26 +11571,26 @@ async function kakaoLogin2(_config) {
11154
11571
  // src/components/ConnectOptions/AbcWaasAuth/hooks/useAbcWaasSocial.ts
11155
11572
  function useAbcWaasSocial(props) {
11156
11573
  const { onPinRequired, onEmailSet } = props;
11157
- const [isLoading, setIsLoading] = useState25(false);
11158
- const [error2, setError] = useState25("");
11159
- const STORAGE_PREFIX2 = "talkenkit_abc_";
11574
+ const [isLoading, setIsLoading] = useState26(false);
11575
+ const [error2, setError] = useState26("");
11576
+ const STORAGE_PREFIX3 = "talkenkit_abc_";
11160
11577
  const clearExpiredEncryptedData = () => {
11161
- const expiresAtStr = localStorage.getItem(`${STORAGE_PREFIX2}expires_at`);
11578
+ const expiresAtStr = localStorage.getItem(`${STORAGE_PREFIX3}expires_at`);
11162
11579
  const hasEncryptedTokens = localStorage.getItem(
11163
- `${STORAGE_PREFIX2}enc_tokens`
11580
+ `${STORAGE_PREFIX3}enc_tokens`
11164
11581
  );
11165
11582
  if (!hasEncryptedTokens)
11166
11583
  return;
11167
11584
  const expiresAt = expiresAtStr ? Number(expiresAtStr) : 0;
11168
11585
  const isExpired = Date.now() >= expiresAt;
11169
11586
  if (isExpired) {
11170
- localStorage.removeItem(`${STORAGE_PREFIX2}enc_tokens`);
11171
- localStorage.removeItem(`${STORAGE_PREFIX2}enc_salt`);
11172
- localStorage.removeItem(`${STORAGE_PREFIX2}auth_state`);
11173
- localStorage.removeItem(`${STORAGE_PREFIX2}user`);
11174
- localStorage.removeItem(`${STORAGE_PREFIX2}wallet`);
11175
- localStorage.removeItem(`${STORAGE_PREFIX2}solana_wallet`);
11176
- localStorage.removeItem(`${STORAGE_PREFIX2}bitcoin_wallet`);
11587
+ localStorage.removeItem(`${STORAGE_PREFIX3}enc_tokens`);
11588
+ localStorage.removeItem(`${STORAGE_PREFIX3}enc_salt`);
11589
+ localStorage.removeItem(`${STORAGE_PREFIX3}auth_state`);
11590
+ localStorage.removeItem(`${STORAGE_PREFIX3}user`);
11591
+ localStorage.removeItem(`${STORAGE_PREFIX3}wallet`);
11592
+ localStorage.removeItem(`${STORAGE_PREFIX3}solana_wallet`);
11593
+ localStorage.removeItem(`${STORAGE_PREFIX3}bitcoin_wallet`);
11177
11594
  }
11178
11595
  };
11179
11596
  const saveAuthState = (response, provider) => {
@@ -11191,23 +11608,23 @@ function useAbcWaasSocial(props) {
11191
11608
  expiresAt: Date.now() + ((response.expires_in || response.expiresIn || 3600) > 0 ? response.expires_in || response.expiresIn || 3600 : 3600) * 1e3
11192
11609
  };
11193
11610
  localStorage.setItem(
11194
- `${STORAGE_PREFIX2}auth_state`,
11611
+ `${STORAGE_PREFIX3}auth_state`,
11195
11612
  JSON.stringify(authState)
11196
11613
  );
11197
11614
  localStorage.setItem(
11198
- `${STORAGE_PREFIX2}user`,
11615
+ `${STORAGE_PREFIX3}user`,
11199
11616
  JSON.stringify(authState.user)
11200
11617
  );
11201
11618
  localStorage.setItem(
11202
- `${STORAGE_PREFIX2}access_token`,
11619
+ `${STORAGE_PREFIX3}access_token`,
11203
11620
  response.access_token
11204
11621
  );
11205
11622
  localStorage.setItem(
11206
- `${STORAGE_PREFIX2}refresh_token`,
11623
+ `${STORAGE_PREFIX3}refresh_token`,
11207
11624
  response.refresh_token
11208
11625
  );
11209
11626
  localStorage.setItem(
11210
- `${STORAGE_PREFIX2}expires_at`,
11627
+ `${STORAGE_PREFIX3}expires_at`,
11211
11628
  String(authState.expiresAt)
11212
11629
  );
11213
11630
  };
@@ -11215,11 +11632,8 @@ function useAbcWaasSocial(props) {
11215
11632
  onEmailSet?.(response.email);
11216
11633
  clearExpiredEncryptedData();
11217
11634
  saveAuthState(response, provider);
11218
- const pinMapStr = localStorage.getItem(`${STORAGE_PREFIX2}pin_map`) || "{}";
11219
- const pinMap = JSON.parse(pinMapStr);
11220
- const hasPinInMap = !!pinMap[response.email];
11221
- const hasEncryptedTokens = !!(localStorage.getItem(`${STORAGE_PREFIX2}enc_tokens`) && localStorage.getItem(`${STORAGE_PREFIX2}enc_salt`));
11222
- onPinRequired(response, response.email, hasPinInMap && hasEncryptedTokens);
11635
+ const hasEncryptedTokens = !!(localStorage.getItem(`${STORAGE_PREFIX3}enc_tokens`) && localStorage.getItem(`${STORAGE_PREFIX3}enc_salt`));
11636
+ onPinRequired(response, response.email, hasEncryptedTokens);
11223
11637
  };
11224
11638
  const handleGoogleLogin = async () => {
11225
11639
  setIsLoading(true);
@@ -11284,15 +11698,11 @@ function AbcWaasAuthFlow({
11284
11698
  onPinVerifyRequired,
11285
11699
  compact = false
11286
11700
  }) {
11287
- const STORAGE_PREFIX2 = "talkenkit_abc_";
11701
+ const STORAGE_PREFIX3 = "talkenkit_abc_";
11288
11702
  const abcAuth = useAbcWaasAuth({
11289
- onPinRequired: (loginData) => {
11703
+ onPinRequired: async (loginData) => {
11290
11704
  console.log("[AbcWaasAuthFlow] \u{1F510} PIN required for email login");
11291
- const pinMapStr = localStorage.getItem(`${STORAGE_PREFIX2}pin_map`) || "{}";
11292
- const pinMap = JSON.parse(pinMapStr);
11293
- const hasPinInMap = !!pinMap[abcAuth.email];
11294
- const hasEncryptedTokens = !!(localStorage.getItem(`${STORAGE_PREFIX2}enc_tokens`) && localStorage.getItem(`${STORAGE_PREFIX2}enc_salt`));
11295
- const canVerifyPin = hasPinInMap && hasEncryptedTokens;
11705
+ const canVerifyPin = !!(localStorage.getItem(`${STORAGE_PREFIX3}enc_tokens`) && localStorage.getItem(`${STORAGE_PREFIX3}enc_salt`));
11296
11706
  console.log("[AbcWaasAuthFlow] \u{1F50D} PIN verification check:", {
11297
11707
  result: canVerifyPin ? "Verify PIN" : "Create new PIN"
11298
11708
  });
@@ -11300,11 +11710,8 @@ function AbcWaasAuthFlow({
11300
11710
  console.log(
11301
11711
  "[AbcWaasAuthFlow] \u2705 PIN verification possible - routing to verify modal"
11302
11712
  );
11303
- localStorage.setItem(
11304
- `${STORAGE_PREFIX2}pin_hash`,
11305
- pinMap[abcAuth.email]
11306
- );
11307
- localStorage.setItem(`${STORAGE_PREFIX2}saved_email`, abcAuth.email);
11713
+ const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-DDHLW2IH.js");
11714
+ getCredentialManager2().setEmail(abcAuth.email);
11308
11715
  onPinVerifyRequired(loginData);
11309
11716
  } else {
11310
11717
  console.log(
@@ -11373,7 +11780,7 @@ function AbcWaasAuthFlow({
11373
11780
  }
11374
11781
 
11375
11782
  // src/components/ConnectOptions/ConnectDetails.tsx
11376
- import React83, { useContext as useContext19, useEffect as useEffect23 } from "react";
11783
+ import React83, { useContext as useContext19, useEffect as useEffect24 } from "react";
11377
11784
 
11378
11785
  // src/utils/colors.ts
11379
11786
  var convertHexToRGBA = (hexCode, opacity = 1) => {
@@ -11792,7 +12199,7 @@ function ConnectDetail({
11792
12199
  } : null;
11793
12200
  const { width: windowWidth } = useWindowSize();
11794
12201
  const smallWindow = windowWidth && windowWidth < 768;
11795
- useEffect23(() => {
12202
+ useEffect24(() => {
11796
12203
  preloadBrowserIcon();
11797
12204
  preloadPlatformIcon();
11798
12205
  }, []);
@@ -12149,7 +12556,7 @@ function DownloadOptionsDetail({
12149
12556
  mobileDownloadUrl
12150
12557
  } = wallet;
12151
12558
  const { i18n: i18n2 } = useContext19(I18nContext);
12152
- useEffect23(() => {
12559
+ useEffect24(() => {
12153
12560
  preloadCreateIcon();
12154
12561
  preloadScanIcon();
12155
12562
  preloadRefreshIcon();
@@ -12245,7 +12652,7 @@ function DownloadDetail({
12245
12652
  }) {
12246
12653
  const { downloadUrls, qrCode } = wallet;
12247
12654
  const { i18n: i18n2 } = useContext19(I18nContext);
12248
- useEffect23(() => {
12655
+ useEffect24(() => {
12249
12656
  preloadCreateIcon();
12250
12657
  preloadScanIcon();
12251
12658
  }, []);
@@ -12577,12 +12984,12 @@ import React85, { Fragment as Fragment2 } from "react";
12577
12984
  import React84 from "react";
12578
12985
 
12579
12986
  // src/components/RainbowKitProvider/useCoolMode.ts
12580
- import { useContext as useContext20, useEffect as useEffect24, useRef as useRef12 } from "react";
12987
+ import { useContext as useContext20, useEffect as useEffect25, useRef as useRef12 } from "react";
12581
12988
  var useCoolMode = (imageUrl) => {
12582
12989
  const ref = useRef12(null);
12583
12990
  const coolModeEnabled = useContext20(CoolModeContext);
12584
12991
  const resolvedImageUrl = useAsyncImage(imageUrl);
12585
- useEffect24(() => {
12992
+ useEffect25(() => {
12586
12993
  if (coolModeEnabled && ref.current && resolvedImageUrl) {
12587
12994
  return makeElementCool(ref.current, resolvedImageUrl);
12588
12995
  }
@@ -13024,7 +13431,7 @@ function PopularWalletList({
13024
13431
  PopularWalletList.displayName = "PopularWalletList";
13025
13432
 
13026
13433
  // src/components/ConnectOptions/ExternalWallets/hooks/useWalletConnection.ts
13027
- import { useEffect as useEffect25, useState as useState26 } from "react";
13434
+ import { useEffect as useEffect26, useState as useState27 } from "react";
13028
13435
 
13029
13436
  // src/wallets/latestWalletId.ts
13030
13437
  var storageKey6 = "rk-latest-id";
@@ -13043,10 +13450,10 @@ function useWalletConnection({
13043
13450
  onSuccess,
13044
13451
  initialWallet
13045
13452
  }) {
13046
- const [selectedWallet, setSelectedWallet] = useState26(initialWallet);
13047
- const [qrCodeUri, setQrCodeUri] = useState26();
13048
- const [connectionError, setConnectionError] = useState26(false);
13049
- useEffect25(() => {
13453
+ const [selectedWallet, setSelectedWallet] = useState27(initialWallet);
13454
+ const [qrCodeUri, setQrCodeUri] = useState27();
13455
+ const [connectionError, setConnectionError] = useState27(false);
13456
+ useEffect26(() => {
13050
13457
  setConnectionError(false);
13051
13458
  }, []);
13052
13459
  const getQrCode = async (wallet) => {
@@ -13115,13 +13522,13 @@ function useWalletConnection({
13115
13522
 
13116
13523
  // src/components/ConnectOptions/PinAuth/PinAuthFlow.tsx
13117
13524
  import React89, {
13118
- useState as useState31,
13525
+ useState as useState32,
13119
13526
  forwardRef,
13120
13527
  useImperativeHandle
13121
13528
  } from "react";
13122
13529
 
13123
13530
  // src/components/AbcAuth/PinInputModal.tsx
13124
- import React88, { useState as useState27, useEffect as useEffect26, useMemo as useMemo17 } from "react";
13531
+ import React88, { useState as useState28, useEffect as useEffect27, useMemo as useMemo17 } from "react";
13125
13532
 
13126
13533
  // src/components/AbcAuth/PinInputModal.css.ts
13127
13534
  var actions4 = "_1qacwvac";
@@ -13175,14 +13582,14 @@ function PinInputModal({
13175
13582
  loadingMessage: loadingMessage2 = "Creating wallet...",
13176
13583
  progressSteps: progressSteps2
13177
13584
  }) {
13178
- const [pin, setPin] = useState27("");
13179
- const [error2, setError] = useState27("");
13180
- const [isLoading, setIsLoading] = useState27(false);
13585
+ const [pin, setPin] = useState28("");
13586
+ const [error2, setError] = useState28("");
13587
+ const [isLoading, setIsLoading] = useState28(false);
13181
13588
  const _isActuallyLoading = isLoading || externalLoading;
13182
13589
  const keypadNumbers = useMemo17(() => {
13183
13590
  return shuffleArray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
13184
13591
  }, []);
13185
- useEffect26(() => {
13592
+ useEffect27(() => {
13186
13593
  if (isOpen) {
13187
13594
  setPin("");
13188
13595
  setIsLoading(false);
@@ -13190,7 +13597,7 @@ function PinInputModal({
13190
13597
  setError("");
13191
13598
  }
13192
13599
  }, [isOpen]);
13193
- useEffect26(() => {
13600
+ useEffect27(() => {
13194
13601
  if (errorMessage) {
13195
13602
  setError(errorMessage);
13196
13603
  }
@@ -13381,13 +13788,13 @@ function PinInputModal({
13381
13788
  }
13382
13789
 
13383
13790
  // src/components/ConnectOptions/PinAuth/hooks/usePinCreation.ts
13384
- import { useState as useState28 } from "react";
13791
+ import { useState as useState29 } from "react";
13385
13792
  function usePinCreation(props) {
13386
13793
  const { onPinConfirmed, onShowConfirmModal } = props;
13387
- const [pin, setPin] = useState28("");
13388
- const [confirmPin, setConfirmPin] = useState28("");
13389
- const [error2, setError] = useState28("");
13390
- const [isCreating, setIsCreating] = useState28(false);
13794
+ const [pin, setPin] = useState29("");
13795
+ const [confirmPin, setConfirmPin] = useState29("");
13796
+ const [error2, setError] = useState29("");
13797
+ const [isCreating, setIsCreating] = useState29(false);
13391
13798
  const handlePinCreate = async (createdPin) => {
13392
13799
  console.log("[PinCreation] = Creating PIN");
13393
13800
  setPin(createdPin);
@@ -13436,7 +13843,7 @@ function usePinCreation(props) {
13436
13843
  }
13437
13844
 
13438
13845
  // src/components/ConnectOptions/PinAuth/hooks/usePinVerification.ts
13439
- import { useState as useState29 } from "react";
13846
+ import { useState as useState30 } from "react";
13440
13847
  function usePinVerification(props) {
13441
13848
  const {
13442
13849
  email,
@@ -13444,9 +13851,9 @@ function usePinVerification(props) {
13444
13851
  onSessionExpired,
13445
13852
  storagePrefix = "talkenkit_abc_"
13446
13853
  } = props;
13447
- const [isVerifying, setIsVerifying] = useState29(false);
13448
- const [error2, setError] = useState29("");
13449
- const [progress, setProgress] = useState29([]);
13854
+ const [isVerifying, setIsVerifying] = useState30(false);
13855
+ const [error2, setError] = useState30("");
13856
+ const [progress, setProgress] = useState30([]);
13450
13857
  const handlePinVerify = async (pin) => {
13451
13858
  console.log("[PinVerification] = Verifying PIN");
13452
13859
  setProgress([
@@ -13542,7 +13949,10 @@ function usePinVerification(props) {
13542
13949
  const newSensitiveData = {
13543
13950
  accessToken: newAccessToken,
13544
13951
  refreshToken: newRefreshToken,
13545
- expiresAt: newExpiresAt
13952
+ expiresAt: newExpiresAt,
13953
+ solanaWallet: sensitiveData.solanaWallet,
13954
+ bitcoinWallet: sensitiveData.bitcoinWallet,
13955
+ tronWallet: sensitiveData.tronWallet
13546
13956
  };
13547
13957
  const saltBytes = new Uint8Array(
13548
13958
  (saltHex || "").match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || []
@@ -13582,7 +13992,6 @@ function usePinVerification(props) {
13582
13992
  localStorage.removeItem(`${storagePrefix}enc_salt`);
13583
13993
  localStorage.removeItem(`${storagePrefix}user`);
13584
13994
  localStorage.removeItem(`${storagePrefix}wallet`);
13585
- localStorage.removeItem(`${storagePrefix}pin_hash`);
13586
13995
  localStorage.removeItem(`${storagePrefix}access_token`);
13587
13996
  localStorage.removeItem(`${storagePrefix}refresh_token`);
13588
13997
  onSessionExpired?.();
@@ -13594,27 +14003,24 @@ function usePinVerification(props) {
13594
14003
  }
13595
14004
  }
13596
14005
  const userStr = localStorage.getItem(`${storagePrefix}user`);
14006
+ if (sensitiveData.solanaWallet)
14007
+ authState.solanaWallet = sensitiveData.solanaWallet;
14008
+ if (sensitiveData.bitcoinWallet)
14009
+ authState.bitcoinWallet = sensitiveData.bitcoinWallet;
14010
+ if (sensitiveData.tronWallet)
14011
+ authState.tronWallet = sensitiveData.tronWallet;
13597
14012
  const walletStr = localStorage.getItem(`${storagePrefix}wallet`);
13598
- const solanaWalletStr = localStorage.getItem(
13599
- `${storagePrefix}solana_wallet`
13600
- );
13601
- const bitcoinWalletStr = localStorage.getItem(
13602
- `${storagePrefix}bitcoin_wallet`
13603
- );
13604
- if (userStr)
13605
- authState.user = JSON.parse(userStr);
13606
14013
  if (walletStr)
13607
14014
  authState.wallet = JSON.parse(walletStr);
13608
- if (solanaWalletStr)
13609
- authState.solanaWallet = JSON.parse(solanaWalletStr);
13610
- if (bitcoinWalletStr)
13611
- authState.bitcoinWallet = JSON.parse(bitcoinWalletStr);
14015
+ if (userStr)
14016
+ authState.user = JSON.parse(userStr);
13612
14017
  localStorage.setItem(
13613
14018
  `${storagePrefix}auth_state`,
13614
14019
  JSON.stringify(authState)
13615
14020
  );
13616
- localStorage.setItem(`${storagePrefix}pin_hash`, hashedPin);
13617
- localStorage.setItem(`${storagePrefix}saved_email`, email);
14021
+ const credMgr = getCredentialManager();
14022
+ credMgr.setPinHash(hashedPin);
14023
+ credMgr.setEmail(email);
13618
14024
  setProgress([
13619
14025
  { label: "Verifying PIN...", status: "completed" },
13620
14026
  { label: "Restoring wallet data...", status: "completed" }
@@ -13645,7 +14051,7 @@ function usePinVerification(props) {
13645
14051
  }
13646
14052
 
13647
14053
  // src/components/ConnectOptions/PinAuth/hooks/useWalletGeneration.ts
13648
- import { useState as useState30 } from "react";
14054
+ import { useState as useState31 } from "react";
13649
14055
  function useWalletGeneration(props) {
13650
14056
  const {
13651
14057
  connectors,
@@ -13653,9 +14059,9 @@ function useWalletGeneration(props) {
13653
14059
  onSuccess,
13654
14060
  storagePrefix: _storagePrefix = "talkenkit_abc_"
13655
14061
  } = props;
13656
- const [isGenerating, setIsGenerating] = useState30(false);
13657
- const [progress, setProgress] = useState30([]);
13658
- const [statusMessage, setStatusMessage] = useState30("");
14062
+ const [isGenerating, setIsGenerating] = useState31(false);
14063
+ const [progress, setProgress] = useState31([]);
14064
+ const [statusMessage, setStatusMessage] = useState31("");
13659
14065
  const generateWallets = async ({
13660
14066
  hashedPin,
13661
14067
  email,
@@ -13715,6 +14121,22 @@ function useWalletGeneration(props) {
13715
14121
  const evmAccount = accounts[0] || infoResponse || {};
13716
14122
  const pubkey = evmAccount.pubkey || genResponse.pubkey || "";
13717
14123
  const sid = evmAccount.sid || evmAddress;
14124
+ let btcAddress = genResponse.btcAddress || "";
14125
+ let trxAddress = genResponse.trxAddress || "";
14126
+ if ((!btcAddress || !trxAddress) && pubkey) {
14127
+ try {
14128
+ const addrResponse = await api.wallet.getAddressForChain("all");
14129
+ if (!btcAddress)
14130
+ btcAddress = addrResponse?.btc || addrResponse?.btcAddress || "";
14131
+ if (!trxAddress)
14132
+ trxAddress = addrResponse?.trx || addrResponse?.trxAddress || "";
14133
+ } catch (err) {
14134
+ console.warn(
14135
+ "[useWalletGeneration] Failed to derive BTC/TRX addresses:",
14136
+ err
14137
+ );
14138
+ }
14139
+ }
13718
14140
  const solMaterial = genResponse.solana;
13719
14141
  const solanaWallet = genResponse.solAddress ? {
13720
14142
  uid,
@@ -13727,32 +14149,39 @@ function useWalletGeneration(props) {
13727
14149
  secretStore: solMaterial?.secretStore || "",
13728
14150
  network: getSolanaNetwork()
13729
14151
  } : null;
13730
- const bitcoinWallet = genResponse.btcAddress ? {
14152
+ const bitcoinWallet = btcAddress ? {
13731
14153
  uid,
13732
14154
  sessionId: "",
13733
14155
  shareId: "",
13734
14156
  publicKey: pubkey,
13735
- address: genResponse.btcAddress,
14157
+ address: btcAddress,
13736
14158
  keyId: "",
13737
14159
  encryptedShare: "",
13738
14160
  addressType: "bech32",
13739
14161
  network: getBitcoinNetwork()
13740
14162
  } : null;
13741
- const tronWallet = genResponse.trxAddress ? {
14163
+ const tronWallet = trxAddress ? {
13742
14164
  uid,
13743
14165
  sessionId: "",
13744
14166
  shareId: "",
13745
14167
  publicKey: pubkey,
13746
- address: genResponse.trxAddress,
14168
+ address: trxAddress,
13747
14169
  keyId: "",
13748
14170
  encryptedShare: "",
13749
14171
  network: getTronNetwork()
13750
14172
  } : null;
13751
- const pinMapStr = localStorage.getItem(`${storagePrefix}pin_map`) || "{}";
13752
- const pinMap = JSON.parse(pinMapStr);
13753
- pinMap[email] = hashedPin;
13754
- localStorage.setItem(`${storagePrefix}pin_map`, JSON.stringify(pinMap));
13755
- localStorage.setItem(`${storagePrefix}pin_hash`, hashedPin);
14173
+ getCredentialManager().setPinHash(hashedPin);
14174
+ const pvencstr = evmAccount.pvencstr || "";
14175
+ const encryptDevicePassword = evmAccount.encryptDevicePassword || "";
14176
+ if (uid && genResponse.wid && sid && pvencstr && encryptDevicePassword) {
14177
+ getCredentialManager().setEvmSigningCredentials({
14178
+ uid,
14179
+ wid: String(genResponse.wid),
14180
+ sid,
14181
+ pvencstr: String(pvencstr),
14182
+ encryptDevicePassword: String(encryptDevicePassword)
14183
+ });
14184
+ }
13756
14185
  const authState = {
13757
14186
  isAuthenticated: true,
13758
14187
  user: {
@@ -13773,7 +14202,6 @@ function useWalletGeneration(props) {
13773
14202
  solanaWallet,
13774
14203
  bitcoinWallet,
13775
14204
  tronWallet,
13776
- pin: hashedPin,
13777
14205
  accessToken: loginData.access_token,
13778
14206
  refreshToken: loginData.refresh_token,
13779
14207
  expiresAt
@@ -13813,7 +14241,9 @@ function useWalletGeneration(props) {
13813
14241
  accessToken: loginData.access_token,
13814
14242
  refreshToken: loginData.refresh_token || "",
13815
14243
  expiresAt: authState.expiresAt,
13816
- solanaWallet: authState.solanaWallet
14244
+ solanaWallet: authState.solanaWallet,
14245
+ bitcoinWallet: authState.bitcoinWallet,
14246
+ tronWallet: authState.tronWallet
13817
14247
  });
13818
14248
  const encrypted = await encryptWithPin(sensitiveData, hashedPin, salt);
13819
14249
  localStorage.setItem(
@@ -13858,9 +14288,9 @@ var PinAuthFlow = forwardRef(
13858
14288
  connect,
13859
14289
  storagePrefix = "talkenkit_abc_"
13860
14290
  } = props;
13861
- const [isPinCreateModalOpen, setIsPinCreateModalOpen] = useState31(false);
13862
- const [isPinConfirmModalOpen, setIsPinConfirmModalOpen] = useState31(false);
13863
- const [isPinVerifyModalOpen, setIsPinVerifyModalOpen] = useState31(false);
14291
+ const [isPinCreateModalOpen, setIsPinCreateModalOpen] = useState32(false);
14292
+ const [isPinConfirmModalOpen, setIsPinConfirmModalOpen] = useState32(false);
14293
+ const [isPinVerifyModalOpen, setIsPinVerifyModalOpen] = useState32(false);
13864
14294
  const walletGeneration = useWalletGeneration({
13865
14295
  connectors,
13866
14296
  connect,
@@ -13891,9 +14321,10 @@ var PinAuthFlow = forwardRef(
13891
14321
  setIsPinVerifyModalOpen(false);
13892
14322
  const authStateStr = localStorage.getItem(`${storagePrefix}auth_state`);
13893
14323
  const authState = authStateStr ? JSON.parse(authStateStr) : null;
13894
- const needsWalletGeneration = authState && (!authState.wallet || !authState.solanaWallet);
14324
+ const needsWalletGeneration = authState && (!authState.wallet || !authState.solanaWallet || !authState.bitcoinWallet || !authState.tronWallet);
13895
14325
  if (needsWalletGeneration) {
13896
- const pinHash = localStorage.getItem(`${storagePrefix}pin_hash`);
14326
+ const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-DDHLW2IH.js");
14327
+ const pinHash = getCredentialManager2().getPinHash();
13897
14328
  if (pinHash) {
13898
14329
  await walletGeneration.generateWallets({
13899
14330
  hashedPin: pinHash,
@@ -13997,9 +14428,9 @@ function ConnectOptionsModal({
13997
14428
  const compactModeEnabled = modalSize === ModalSizeOptions.COMPACT;
13998
14429
  const { disclaimer: Disclaimer } = useContext21(AppContext);
13999
14430
  const { i18n: i18n2 } = useContext21(I18nContext);
14000
- const STORAGE_PREFIX2 = "talkenkit_abc_";
14001
- const [abcWaasLoginData, setAbcWaasLoginData] = useState32(null);
14002
- const [email, setEmail] = useState32("");
14431
+ const STORAGE_PREFIX3 = "talkenkit_abc_";
14432
+ const [abcWaasLoginData, setAbcWaasLoginData] = useState33(null);
14433
+ const [email, setEmail] = useState33("");
14003
14434
  const initialized = useRef13(false);
14004
14435
  const pinAuthFlowRef = useRef13(null);
14005
14436
  const { connector } = useContext21(WalletButtonContext);
@@ -14023,7 +14454,7 @@ function ConnectOptionsModal({
14023
14454
  "Others",
14024
14455
  "Installed"
14025
14456
  ];
14026
- useEffect28(() => {
14457
+ useEffect29(() => {
14027
14458
  if (connector && !initialized.current) {
14028
14459
  changeWalletStep("CONNECT" /* Connect */);
14029
14460
  walletConnection.selectWallet(connector);
@@ -14061,10 +14492,10 @@ function ConnectOptionsModal({
14061
14492
  }
14062
14493
  setWalletStep(newWalletStep);
14063
14494
  };
14064
- const [initialWalletStep, setInitialWalletStep] = useState32(
14495
+ const [initialWalletStep, setInitialWalletStep] = useState33(
14065
14496
  compactModeEnabled ? "NONE" /* None */ : "LEARN_COMPACT" /* LearnCompact */
14066
14497
  );
14067
- const [walletStep, setWalletStep] = useState32(
14498
+ const [walletStep, setWalletStep] = useState33(
14068
14499
  compactModeEnabled ? "NONE" /* None */ : "LEARN_COMPACT" /* LearnCompact */
14069
14500
  );
14070
14501
  let walletContent = null;
@@ -14212,7 +14643,7 @@ function ConnectOptionsModal({
14212
14643
  },
14213
14644
  connectors,
14214
14645
  connect,
14215
- storagePrefix: STORAGE_PREFIX2
14646
+ storagePrefix: STORAGE_PREFIX3
14216
14647
  }
14217
14648
  ));
14218
14649
  }
@@ -14437,7 +14868,7 @@ function ConnectOptionsModal({
14437
14868
  },
14438
14869
  connectors,
14439
14870
  connect,
14440
- storagePrefix: STORAGE_PREFIX2
14871
+ storagePrefix: STORAGE_PREFIX3
14441
14872
  }
14442
14873
  )
14443
14874
  );
@@ -14447,9 +14878,9 @@ function ConnectOptionsModal({
14447
14878
  import React91, {
14448
14879
  useCallback as useCallback21,
14449
14880
  useContext as useContext22,
14450
- useEffect as useEffect29,
14881
+ useEffect as useEffect30,
14451
14882
  useRef as useRef14,
14452
- useState as useState33
14883
+ useState as useState34
14453
14884
  } from "react";
14454
14885
 
14455
14886
  // src/components/ConnectOptions/MobileOptions.css.ts
@@ -14530,7 +14961,7 @@ function WalletButton({
14530
14961
  }
14531
14962
  connect?.();
14532
14963
  }, [connect, getMobileUri, showWalletConnectModal, onClose, name, id]);
14533
- useEffect29(() => {
14964
+ useEffect30(() => {
14534
14965
  if (connecting && !initialized.current) {
14535
14966
  onConnect();
14536
14967
  initialized.current = true;
@@ -14605,7 +15036,7 @@ function MobileOptions({ onClose }) {
14605
15036
  let walletContent = null;
14606
15037
  let headerBackgroundContrast = false;
14607
15038
  let headerBackButtonLink = null;
14608
- const [walletStep, setWalletStep] = useState33(
15039
+ const [walletStep, setWalletStep] = useState34(
14609
15040
  "CONNECT" /* Connect */
14610
15041
  );
14611
15042
  const { i18n: i18n2 } = useContext22(I18nContext);
@@ -14923,8 +15354,8 @@ function ConnectOptions({ onClose }) {
14923
15354
  };
14924
15355
  }
14925
15356
  }, [walletContext, multiChainContext]);
14926
- const [connectingWallet, setConnectingWallet] = useState34(null);
14927
- const [shouldCloseOnConnect, setShouldCloseOnConnect] = useState34(false);
15357
+ const [connectingWallet, setConnectingWallet] = useState35(null);
15358
+ const [shouldCloseOnConnect, setShouldCloseOnConnect] = useState35(false);
14928
15359
  React93.useEffect(() => {
14929
15360
  if (shouldCloseOnConnect && multiChainContext?.solanaConnected) {
14930
15361
  setShouldCloseOnConnect(false);
@@ -15028,8 +15459,8 @@ function ConnectOptions({ onClose }) {
15028
15459
  }
15029
15460
 
15030
15461
  // src/components/ConnectOptions/MultiChainConnectOptions.tsx
15031
- import { useWallet as useWallet5 } from "@solana/wallet-adapter-react";
15032
- import React96, { useContext as useContext25, useCallback as useCallback24, useState as useState36 } from "react";
15462
+ import { useWallet as useWallet6 } from "@solana/wallet-adapter-react";
15463
+ import React96, { useContext as useContext25, useCallback as useCallback24, useState as useState37 } from "react";
15033
15464
 
15034
15465
  // src/components/ChainSelector/ChainSelector.tsx
15035
15466
  import clsx3 from "clsx";
@@ -15094,8 +15525,8 @@ function ChainSelector({
15094
15525
  }
15095
15526
 
15096
15527
  // src/components/SolanaWalletList/SolanaWalletList.tsx
15097
- import { useWallet as useWallet4 } from "@solana/wallet-adapter-react";
15098
- import React95, { useCallback as useCallback23, useState as useState35 } from "react";
15528
+ import { useWallet as useWallet5 } from "@solana/wallet-adapter-react";
15529
+ import React95, { useCallback as useCallback23, useState as useState36 } from "react";
15099
15530
 
15100
15531
  // src/components/SolanaWalletList/SolanaWalletList.css.ts
15101
15532
  var installButton = "lkxkyzc kwh1ip19 kwh1ip1f";
@@ -15111,8 +15542,8 @@ function SolanaWalletList2({
15111
15542
  onConnect,
15112
15543
  onError
15113
15544
  }) {
15114
- const { wallets, select, connect, connecting } = useWallet4();
15115
- const [connectingWallet, setConnectingWallet] = useState35(null);
15545
+ const { wallets, select, connect, connecting } = useWallet5();
15546
+ const [connectingWallet, setConnectingWallet] = useState36(null);
15116
15547
  const handleWalletClick = useCallback23(
15117
15548
  async (walletName2) => {
15118
15549
  try {
@@ -15214,9 +15645,9 @@ function MultiChainConnectOptions({
15214
15645
  return /* @__PURE__ */ React96.createElement(UnifiedWalletList, { onClose });
15215
15646
  }
15216
15647
  function UnifiedWalletList({ onClose }) {
15217
- const { wallets: solanaWallets, select, connecting } = useWallet5();
15648
+ const { wallets: solanaWallets, select, connecting } = useWallet6();
15218
15649
  const _multiChainContext = useContext25(MultiChainContext);
15219
- const [connectingWallet, setConnectingWallet] = useState36(null);
15650
+ const [connectingWallet, setConnectingWallet] = useState37(null);
15220
15651
  const handleSolanaWalletClick = useCallback24(
15221
15652
  async (walletName2) => {
15222
15653
  try {
@@ -15301,7 +15732,7 @@ function ConnectModal({ onClose, open }) {
15301
15732
  const connectionStatus = useConnectionStatus();
15302
15733
  const multiChainContext = useContext26(MultiChainContext);
15303
15734
  const { disconnect } = useDisconnect3();
15304
- const { isConnecting, isConnected } = useAccount15();
15735
+ const { isConnecting, isConnected } = useAccount16();
15305
15736
  React97.useEffect(() => {
15306
15737
  if (isConnected && open) {
15307
15738
  onClose();
@@ -15339,7 +15770,7 @@ function ConnectModal({ onClose, open }) {
15339
15770
 
15340
15771
  // src/components/RainbowKitProvider/ModalContext.tsx
15341
15772
  function useModalStateValue() {
15342
- const [isModalOpen, setModalOpen] = useState37(false);
15773
+ const [isModalOpen, setModalOpen] = useState38(false);
15343
15774
  return {
15344
15775
  closeModal: useCallback25(() => setModalOpen(false), []),
15345
15776
  isModalOpen,
@@ -15370,9 +15801,9 @@ function ModalProvider({ children }) {
15370
15801
  isModalOpen: chainModalOpen,
15371
15802
  openModal: openChainModal
15372
15803
  } = useModalStateValue();
15373
- const [isWalletConnectModalOpen, setIsWalletConnectModalOpen] = useState37(false);
15804
+ const [isWalletConnectModalOpen, setIsWalletConnectModalOpen] = useState38(false);
15374
15805
  const connectionStatus = useConnectionStatus();
15375
- const { chainId } = useAccount16();
15806
+ const { chainId } = useAccount17();
15376
15807
  const { chains } = useConfig3();
15377
15808
  const isCurrentChainSupported = chains.some((chain) => chain.id === chainId);
15378
15809
  const multiChainContext = useContext27(MultiChainContext);
@@ -15392,7 +15823,7 @@ function ModalProvider({ children }) {
15392
15823
  onConnect: () => closeModals({ keepConnectModalOpen: isUnauthenticated }),
15393
15824
  onDisconnect: () => closeModals()
15394
15825
  });
15395
- useEffect30(() => {
15826
+ useEffect31(() => {
15396
15827
  if (isUnauthenticated)
15397
15828
  closeModals();
15398
15829
  }, [isUnauthenticated, closeModals]);
@@ -15466,8 +15897,8 @@ function ConnectButtonRenderer({
15466
15897
  children
15467
15898
  }) {
15468
15899
  const isMounted = useIsMounted();
15469
- const { address } = useAccount17();
15470
- const { chainId } = useAccount17();
15900
+ const { address } = useAccount18();
15901
+ const { chainId } = useAccount18();
15471
15902
  const { chains: wagmiChains } = useConfig4();
15472
15903
  const isCurrentChainSupported = wagmiChains.some(
15473
15904
  (chain) => chain.id === chainId
@@ -15559,21 +15990,21 @@ function ConnectButton({
15559
15990
  const chains = useRainbowKitChains();
15560
15991
  const connectionStatus = useConnectionStatus();
15561
15992
  const { setShowBalance } = useShowBalance();
15562
- const [ready, setReady] = useState38(false);
15993
+ const [ready, setReady] = useState39(false);
15563
15994
  const { i18n: i18n2 } = useContext29(I18nContext);
15564
15995
  const bitcoinWallet = useBitcoinWallet();
15565
- const [rollingChainIndex, setRollingChainIndex] = useState38(0);
15996
+ const [rollingChainIndex, setRollingChainIndex] = useState39(0);
15566
15997
  const chainTypes = [
15567
15998
  "evm",
15568
15999
  "bitcoin",
15569
16000
  "solana"
15570
16001
  ];
15571
- useEffect31(() => {
16002
+ useEffect32(() => {
15572
16003
  setShowBalance(showBalance);
15573
16004
  if (!ready)
15574
16005
  setReady(true);
15575
16006
  }, [showBalance, setShowBalance]);
15576
- useEffect31(() => {
16007
+ useEffect32(() => {
15577
16008
  const interval = setInterval(() => {
15578
16009
  setRollingChainIndex((prev) => (prev + 1) % chainTypes.length);
15579
16010
  }, 1e4);
@@ -15855,11 +16286,11 @@ var maxWidth = "hk857q1";
15855
16286
  // src/components/WalletButton/WalletButtonRenderer.tsx
15856
16287
  import React101, {
15857
16288
  useContext as useContext30,
15858
- useEffect as useEffect32,
16289
+ useEffect as useEffect33,
15859
16290
  useMemo as useMemo20,
15860
- useState as useState39
16291
+ useState as useState40
15861
16292
  } from "react";
15862
- import { useAccount as useAccount18, useAccountEffect as useAccountEffect4 } from "wagmi";
16293
+ import { useAccount as useAccount19, useAccountEffect as useAccountEffect4 } from "wagmi";
15863
16294
  function WalletButtonRenderer({
15864
16295
  // Wallet is the same as `connector.id` which is injected into
15865
16296
  // wagmi connectors
@@ -15875,14 +16306,14 @@ function WalletButtonRenderer({
15875
16306
  throw new Error("Connector not found");
15876
16307
  }
15877
16308
  const connectionStatus = useConnectionStatus();
15878
- const [loading, setLoading] = useState39(false);
15879
- const [isError, setIsError] = useState39(false);
16309
+ const [loading, setLoading] = useState40(false);
16310
+ const [isError, setIsError] = useState40(false);
15880
16311
  const mobile = isMobile();
15881
- useEffect32(() => {
16312
+ useEffect33(() => {
15882
16313
  if (!connectModalOpen && connector)
15883
16314
  setConnector(null);
15884
16315
  }, [connectModalOpen, connector, setConnector]);
15885
- const { isConnected, isConnecting } = useAccount18();
16316
+ const { isConnected, isConnecting } = useAccount19();
15886
16317
  useAccountEffect4({
15887
16318
  onConnect: () => {
15888
16319
  if (isError)
@@ -16782,10 +17213,10 @@ function getDefaultWallets(parameters) {
16782
17213
 
16783
17214
  // src/transactions/useAddRecentTransaction.ts
16784
17215
  import { useCallback as useCallback26 } from "react";
16785
- import { useAccount as useAccount19 } from "wagmi";
17216
+ import { useAccount as useAccount20 } from "wagmi";
16786
17217
  function useAddRecentTransaction() {
16787
17218
  const store = useTransactionStore();
16788
- const { address } = useAccount19();
17219
+ const { address } = useAccount20();
16789
17220
  const chainId = useChainId();
16790
17221
  return useCallback26(
16791
17222
  (transaction) => {
@@ -16807,7 +17238,7 @@ var __private__ = {
16807
17238
  };
16808
17239
 
16809
17240
  // src/hooks/useDeviceType.ts
16810
- import { useEffect as useEffect33, useState as useState40 } from "react";
17241
+ import { useEffect as useEffect34, useState as useState41 } from "react";
16811
17242
  var BREAKPOINTS = {
16812
17243
  mobile: 1024,
16813
17244
  // 0-1024px (includes phones and tablets)
@@ -16826,13 +17257,13 @@ function getDeviceState(width) {
16826
17257
  };
16827
17258
  }
16828
17259
  function useDeviceType() {
16829
- const [state, setState] = useState40(() => {
17260
+ const [state, setState] = useState41(() => {
16830
17261
  if (typeof window === "undefined") {
16831
17262
  return getDeviceState(1920);
16832
17263
  }
16833
17264
  return getDeviceState(window.innerWidth);
16834
17265
  });
16835
- useEffect33(() => {
17266
+ useEffect34(() => {
16836
17267
  setState(getDeviceState(window.innerWidth));
16837
17268
  function handleResize() {
16838
17269
  setState(getDeviceState(window.innerWidth));
@@ -16844,8 +17275,8 @@ function useDeviceType() {
16844
17275
  }
16845
17276
 
16846
17277
  // src/hooks/useWalletCapabilities.ts
16847
- import { useCallback as useCallback27, useEffect as useEffect34, useState as useState41 } from "react";
16848
- import { useAccount as useAccount20, useWalletClient } from "wagmi";
17278
+ import { useCallback as useCallback27, useEffect as useEffect35, useState as useState42 } from "react";
17279
+ import { useAccount as useAccount21, useWalletClient } from "wagmi";
16849
17280
 
16850
17281
  // src/wallets/capabilities/requestWalletAction.ts
16851
17282
  import { parseSignature, toHex as toHex2 } from "viem";
@@ -17028,10 +17459,10 @@ async function detectCapabilities(params) {
17028
17459
 
17029
17460
  // src/hooks/useWalletCapabilities.ts
17030
17461
  function useWalletCapabilities() {
17031
- const { connector, address, isConnected } = useAccount20();
17462
+ const { connector, address, isConnected } = useAccount21();
17032
17463
  const { data: walletClient } = useWalletClient();
17033
- const [capabilities, setCapabilities] = useState41(null);
17034
- const [isLoading, setIsLoading] = useState41(false);
17464
+ const [capabilities, setCapabilities] = useState42(null);
17465
+ const [isLoading, setIsLoading] = useState42(false);
17035
17466
  const refresh = useCallback27(async () => {
17036
17467
  if (!isConnected || !walletClient) {
17037
17468
  setCapabilities(null);
@@ -17049,7 +17480,7 @@ function useWalletCapabilities() {
17049
17480
  setIsLoading(false);
17050
17481
  }
17051
17482
  }, [connector?.id, connector?.name, isConnected, walletClient]);
17052
- useEffect34(() => {
17483
+ useEffect35(() => {
17053
17484
  void refresh();
17054
17485
  }, [refresh]);
17055
17486
  const signAuthorization = useCallback27(
@@ -17140,34 +17571,26 @@ function getSolanaConfig(options = {}) {
17140
17571
  }
17141
17572
 
17142
17573
  // src/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.tsx
17143
- import { useEffect as useEffect35, useRef as useRef15 } from "react";
17144
- import { useAccount as useAccount21, useConnect as useConnect3 } from "wagmi";
17574
+ import { useEffect as useEffect36, useRef as useRef15 } from "react";
17575
+ import { useAccount as useAccount22, useConnect as useConnect3 } from "wagmi";
17145
17576
  function AbcEvmAutoConnector() {
17146
17577
  const { connectors, connect } = useConnect3();
17147
- const { isConnected } = useAccount21();
17578
+ const { isConnected } = useAccount22();
17148
17579
  const hasAttemptedRef = useRef15(false);
17149
- useEffect35(() => {
17580
+ useEffect36(() => {
17150
17581
  if (isConnected || hasAttemptedRef.current) {
17151
17582
  return;
17152
17583
  }
17153
- const authState = localStorage.getItem("talkenkit_abc_auth_state");
17154
- if (!authState) {
17584
+ const authData = loadAuthState();
17585
+ if (!authData?.wallet?.address) {
17155
17586
  return;
17156
17587
  }
17157
- try {
17158
- const authData = JSON.parse(authState);
17159
- if (!authData.wallet || !authData.wallet.address) {
17160
- return;
17161
- }
17162
- const abcConnector = connectors.find((c) => c.name === "ABC Wallet");
17163
- if (!abcConnector) {
17164
- return;
17165
- }
17166
- hasAttemptedRef.current = true;
17167
- connect({ connector: abcConnector });
17168
- } catch (error2) {
17169
- console.error("[AbcEvmAutoConnector] Failed to auto-connect:", error2);
17588
+ const abcConnector = connectors.find((c) => c.name === "ABC Wallet");
17589
+ if (!abcConnector) {
17590
+ return;
17170
17591
  }
17592
+ hasAttemptedRef.current = true;
17593
+ connect({ connector: abcConnector });
17171
17594
  }, [connectors, connect, isConnected]);
17172
17595
  return null;
17173
17596
  }
@@ -17217,12 +17640,12 @@ function ChainIndicator({
17217
17640
  import React104, {
17218
17641
  createContext as createContext17,
17219
17642
  useContext as useContext32,
17220
- useState as useState42,
17221
- useEffect as useEffect36,
17643
+ useState as useState43,
17644
+ useEffect as useEffect37,
17222
17645
  useCallback as useCallback28
17223
17646
  } from "react";
17224
17647
  var DEBUG = true;
17225
- var STORAGE_PREFIX = "talkenkit_abc_";
17648
+ var STORAGE_PREFIX2 = "talkenkit_abc_";
17226
17649
  var AbcAuthContext = createContext17(null);
17227
17650
  function useAbcAuth() {
17228
17651
  const context = useContext32(AbcAuthContext);
@@ -17232,7 +17655,7 @@ function useAbcAuth() {
17232
17655
  return context;
17233
17656
  }
17234
17657
  function AbcAuthProvider({ children }) {
17235
- const [state, setState] = useState42({
17658
+ const [state, setState] = useState43({
17236
17659
  isAuthenticated: false,
17237
17660
  user: {
17238
17661
  email: null,
@@ -17245,7 +17668,9 @@ function AbcAuthProvider({ children }) {
17245
17668
  },
17246
17669
  wallets: {
17247
17670
  evm: null,
17248
- solana: null
17671
+ solana: null,
17672
+ bitcoin: null,
17673
+ tron: null
17249
17674
  },
17250
17675
  pinHash: null
17251
17676
  });
@@ -17281,14 +17706,14 @@ function AbcAuthProvider({ children }) {
17281
17706
  expiresAt
17282
17707
  }
17283
17708
  }));
17284
- localStorage.setItem(`${STORAGE_PREFIX}access_token`, res.accessToken);
17709
+ localStorage.setItem(`${STORAGE_PREFIX2}access_token`, res.accessToken);
17285
17710
  if (res.refreshToken) {
17286
17711
  localStorage.setItem(
17287
- `${STORAGE_PREFIX}refresh_token`,
17712
+ `${STORAGE_PREFIX2}refresh_token`,
17288
17713
  res.refreshToken
17289
17714
  );
17290
17715
  }
17291
- localStorage.setItem(`${STORAGE_PREFIX}expires_at`, String(expiresAt));
17716
+ localStorage.setItem(`${STORAGE_PREFIX2}expires_at`, String(expiresAt));
17292
17717
  if (DEBUG)
17293
17718
  console.log("[AbcAuthProvider] \u2705 Token refreshed");
17294
17719
  return true;
@@ -17304,10 +17729,11 @@ function AbcAuthProvider({ children }) {
17304
17729
  const unlockWithPin = useCallback28(async (pin) => {
17305
17730
  try {
17306
17731
  const encryptedTokens = localStorage.getItem(
17307
- `${STORAGE_PREFIX}enc_tokens`
17732
+ `${STORAGE_PREFIX2}enc_tokens`
17308
17733
  );
17309
- const saltHex = localStorage.getItem(`${STORAGE_PREFIX}enc_salt`);
17310
- const storedPinHash = localStorage.getItem(`${STORAGE_PREFIX}pin_hash`);
17734
+ const saltHex = localStorage.getItem(`${STORAGE_PREFIX2}enc_salt`);
17735
+ const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-DDHLW2IH.js");
17736
+ const storedPinHash = getCredentialManager2().getPinHash();
17311
17737
  if (!encryptedTokens || !saltHex || !storedPinHash) {
17312
17738
  throw new Error("No encrypted data found");
17313
17739
  }
@@ -17334,7 +17760,9 @@ function AbcAuthProvider({ children }) {
17334
17760
  },
17335
17761
  wallets: {
17336
17762
  evm: sensitiveData.evmWallet || null,
17337
- solana: sensitiveData.solanaWallet || null
17763
+ solana: sensitiveData.solanaWallet || null,
17764
+ bitcoin: sensitiveData.bitcoinWallet || null,
17765
+ tron: sensitiveData.tronWallet || null
17338
17766
  },
17339
17767
  pinHash: hashedPin
17340
17768
  }));
@@ -17351,11 +17779,11 @@ function AbcAuthProvider({ children }) {
17351
17779
  isAuthenticated: false,
17352
17780
  user: { email: null, uid: null },
17353
17781
  tokens: { accessToken: null, refreshToken: null, expiresAt: null },
17354
- wallets: { evm: null, solana: null },
17782
+ wallets: { evm: null, solana: null, bitcoin: null, tron: null },
17355
17783
  pinHash: null
17356
17784
  });
17357
17785
  const keys = Object.keys(localStorage).filter(
17358
- (key) => key.startsWith(STORAGE_PREFIX)
17786
+ (key) => key.startsWith(STORAGE_PREFIX2)
17359
17787
  );
17360
17788
  for (const key of keys) {
17361
17789
  localStorage.removeItem(key);
@@ -17366,23 +17794,22 @@ function AbcAuthProvider({ children }) {
17366
17794
  const setAuthState = useCallback28((partial) => {
17367
17795
  setState((prev) => ({ ...prev, ...partial }));
17368
17796
  }, []);
17369
- useEffect36(() => {
17797
+ useEffect37(() => {
17370
17798
  const restoreSession = async () => {
17371
17799
  try {
17372
17800
  const authStateStr = localStorage.getItem(
17373
- `${STORAGE_PREFIX}auth_state`
17801
+ `${STORAGE_PREFIX2}auth_state`
17374
17802
  );
17375
17803
  const accessToken = localStorage.getItem(
17376
- `${STORAGE_PREFIX}access_token`
17804
+ `${STORAGE_PREFIX2}access_token`
17377
17805
  );
17378
17806
  const refreshToken2 = localStorage.getItem(
17379
- `${STORAGE_PREFIX}refresh_token`
17807
+ `${STORAGE_PREFIX2}refresh_token`
17380
17808
  );
17381
17809
  const expiresAtStr = localStorage.getItem(
17382
- `${STORAGE_PREFIX}expires_at`
17810
+ `${STORAGE_PREFIX2}expires_at`
17383
17811
  );
17384
- const pinHash = localStorage.getItem(`${STORAGE_PREFIX}pin_hash`);
17385
- if (authStateStr && accessToken && pinHash) {
17812
+ if (authStateStr && accessToken) {
17386
17813
  const authState = JSON.parse(authStateStr);
17387
17814
  const expiresAt = expiresAtStr ? Number(expiresAtStr) : null;
17388
17815
  setState({
@@ -17398,9 +17825,11 @@ function AbcAuthProvider({ children }) {
17398
17825
  },
17399
17826
  wallets: {
17400
17827
  evm: authState.evmWallet || authState.wallet || null,
17401
- solana: authState.solanaWallet || null
17828
+ solana: authState.solanaWallet || null,
17829
+ bitcoin: authState.bitcoinWallet || null,
17830
+ tron: authState.tronWallet || null
17402
17831
  },
17403
- pinHash
17832
+ pinHash: null
17404
17833
  });
17405
17834
  if (DEBUG)
17406
17835
  console.log("[AbcAuthProvider] \u2705 Session restored", {
@@ -17426,7 +17855,7 @@ function AbcAuthProvider({ children }) {
17426
17855
  );
17427
17856
  };
17428
17857
  }, []);
17429
- useEffect36(() => {
17858
+ useEffect37(() => {
17430
17859
  if (!state.tokens.refreshToken || !state.tokens.expiresAt)
17431
17860
  return;
17432
17861
  const checkAndRefresh = () => {
@@ -17455,16 +17884,16 @@ function AbcAuthProvider({ children }) {
17455
17884
  import React105, {
17456
17885
  createContext as createContext18,
17457
17886
  useContext as useContext33,
17458
- useState as useState43,
17887
+ useState as useState44,
17459
17888
  useCallback as useCallback29
17460
17889
  } from "react";
17461
17890
  var PinContext = createContext18(null);
17462
17891
  function PinProvider({ children }) {
17463
- const [isModalOpen, setIsModalOpen] = useState43(false);
17464
- const [purpose, setPurpose] = useState43("transaction");
17465
- const [pinResolver, setPinResolver] = useState43(null);
17466
- const [pinRejecter, setPinRejecter] = useState43(null);
17467
- const [error2, setError] = useState43("");
17892
+ const [isModalOpen, setIsModalOpen] = useState44(false);
17893
+ const [purpose, setPurpose] = useState44("transaction");
17894
+ const [pinResolver, setPinResolver] = useState44(null);
17895
+ const [pinRejecter, setPinRejecter] = useState44(null);
17896
+ const [error2, setError] = useState44("");
17468
17897
  const requestPin = useCallback29(
17469
17898
  (requestPurpose = "transaction") => {
17470
17899
  return new Promise((resolve, reject) => {
@@ -17482,8 +17911,8 @@ function PinProvider({ children }) {
17482
17911
  if (!pinResolver) {
17483
17912
  return;
17484
17913
  }
17485
- const STORAGE_PREFIX2 = "talkenkit_abc_";
17486
- const storedPinHash = localStorage.getItem(`${STORAGE_PREFIX2}pin_hash`);
17914
+ const { getCredentialManager: getCredentialManager2 } = await import("./AbcCredentialManager-DDHLW2IH.js");
17915
+ const storedPinHash = getCredentialManager2().getPinHash();
17487
17916
  if (!storedPinHash) {
17488
17917
  throw new Error("PIN not set. Please login again.");
17489
17918
  }
@@ -17542,430 +17971,52 @@ function usePin() {
17542
17971
  return context;
17543
17972
  }
17544
17973
 
17545
- // src/hooks/useSolanaWallet.ts
17546
- import { useWallet as useWallet6 } from "@solana/wallet-adapter-react";
17547
- import { useEffect as useEffect37, useState as useState44 } from "react";
17548
- import { useAccount as useAccount22 } from "wagmi";
17549
- function useSolanaWallet() {
17550
- const { isConnected: evmConnected, connector } = useAccount22();
17551
- const { requestInterceptor } = useNonEvmConfirmation();
17552
- const externalWallet = useWallet6();
17553
- const [abcWallet, setAbcWallet] = useState44({
17554
- address: null,
17555
- publicKey: null,
17556
- network: null,
17557
- isConnected: false,
17558
- provider: null
17559
- });
17560
- const [isLoading, setIsLoading] = useState44(false);
17561
- const [error2, setError] = useState44(null);
17562
- const refreshAbcWallet = async () => {
17563
- if (!evmConnected || !connector || connector.id !== "abc") {
17564
- setAbcWallet({
17565
- address: null,
17566
- publicKey: null,
17567
- network: null,
17568
- isConnected: false,
17569
- provider: null
17570
- });
17571
- return;
17572
- }
17573
- try {
17574
- setIsLoading(true);
17575
- setError(null);
17576
- const authState = localStorage.getItem("talkenkit_abc_auth_state");
17577
- if (!authState) {
17578
- setAbcWallet({
17579
- address: null,
17580
- publicKey: null,
17581
- network: null,
17582
- isConnected: false,
17583
- provider: null
17584
- });
17585
- return;
17586
- }
17587
- const authData = JSON.parse(authState);
17588
- const solanaWallet = authData.solanaWallet;
17589
- if (!solanaWallet || !solanaWallet.address) {
17590
- setAbcWallet({
17591
- address: null,
17592
- publicKey: null,
17593
- network: null,
17594
- isConnected: false,
17595
- provider: null
17596
- });
17597
- return;
17598
- }
17599
- const { AbcSolanaProvider } = await import("./abcWallet-O4GH6RHS.js");
17600
- const solanaProvider = new AbcSolanaProvider();
17601
- solanaProvider.setWallet(solanaWallet);
17602
- if (requestInterceptor) {
17603
- solanaProvider.setRequestInterceptor(requestInterceptor);
17604
- }
17605
- setAbcWallet({
17606
- address: solanaWallet.address,
17607
- publicKey: solanaWallet.publicKey,
17608
- network: solanaWallet.network || "solana_devnet",
17609
- isConnected: true,
17610
- provider: solanaProvider
17611
- });
17612
- } catch (err) {
17613
- setError(err);
17614
- setAbcWallet({
17615
- address: null,
17616
- publicKey: null,
17617
- network: null,
17618
- isConnected: false,
17619
- provider: null
17620
- });
17621
- } finally {
17622
- setIsLoading(false);
17623
- }
17624
- };
17625
- const refresh = refreshAbcWallet;
17626
- useEffect37(() => {
17627
- refreshAbcWallet();
17628
- }, [evmConnected, connector?.id]);
17629
- useEffect37(() => {
17630
- if (abcWallet.provider) {
17631
- abcWallet.provider.setRequestInterceptor(requestInterceptor ?? void 0);
17632
- }
17633
- }, [requestInterceptor]);
17634
- const activeWallet = abcWallet.isConnected ? {
17635
- ...abcWallet,
17636
- type: "abc",
17637
- walletName: "ABC Wallet"
17638
- } : externalWallet.connected ? {
17639
- address: externalWallet.publicKey?.toBase58() || null,
17640
- publicKey: externalWallet.publicKey?.toBase58() || null,
17641
- network: process.env.NEXT_PUBLIC_ENVIRONMENT === "production" ? "solana" : "solana_devnet",
17642
- isConnected: true,
17643
- type: "external",
17644
- walletName: externalWallet.wallet?.adapter.name || "External Wallet",
17645
- provider: null
17646
- } : {
17647
- address: null,
17648
- publicKey: null,
17649
- network: null,
17650
- isConnected: false,
17651
- type: null,
17652
- walletName: null,
17653
- provider: null
17654
- };
17655
- const signMessage = async (params) => {
17656
- if (activeWallet.type === "abc") {
17657
- if (!abcWallet.provider) {
17658
- throw new Error("ABC Solana provider not available");
17659
- }
17660
- const encodedMessage = new TextEncoder().encode(params.message);
17661
- const result = await abcWallet.provider.signMessage(
17662
- encodedMessage,
17663
- "utf8"
17664
- );
17665
- const signatureHex = Array.from(result.signature).map((b) => b.toString(16).padStart(2, "0")).join("");
17666
- return { signature: signatureHex };
17667
- }
17668
- if (activeWallet.type === "external") {
17669
- if (!externalWallet.signMessage) {
17670
- throw new Error("Wallet does not support message signing");
17671
- }
17672
- const encodedMessage = new TextEncoder().encode(params.message);
17673
- const signature = await externalWallet.signMessage(encodedMessage);
17674
- const bs58 = await import("bs58");
17675
- const signatureBase58 = bs58.default.encode(signature);
17676
- return { signature: signatureBase58 };
17677
- }
17678
- throw new Error("No Solana wallet connected");
17679
- };
17680
- const transfer = async (params) => {
17681
- if (activeWallet.type === "abc") {
17682
- if (!abcWallet.provider) {
17683
- throw new Error("ABC Solana provider not available");
17684
- }
17685
- return await abcWallet.provider.transfer(params);
17686
- }
17687
- if (activeWallet.type === "external") {
17688
- if (!externalWallet.publicKey || !externalWallet.sendTransaction) {
17689
- throw new Error("Wallet does not support transactions");
17690
- }
17691
- const isMainnet = process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
17692
- const rpcUrl = 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";
17693
- if (params.mintAddress) {
17694
- const { Connection: Connection3, PublicKey: PublicKey3, Transaction: Transaction3 } = await import("@solana/web3.js");
17695
- const {
17696
- getAssociatedTokenAddress,
17697
- createAssociatedTokenAccountInstruction,
17698
- createTransferInstruction,
17699
- TOKEN_PROGRAM_ID
17700
- } = await import("@solana/spl-token");
17701
- const connection2 = new Connection3(rpcUrl, "confirmed");
17702
- const mintPubkey = new PublicKey3(params.mintAddress);
17703
- const fromPubkey2 = externalWallet.publicKey;
17704
- const toPubkey2 = new PublicKey3(params.toAddress);
17705
- const mintInfo = await connection2.getParsedAccountInfo(mintPubkey);
17706
- const decimals = mintInfo.value?.data?.parsed?.info?.decimals || 0;
17707
- const fromTokenAccount = await getAssociatedTokenAddress(
17708
- mintPubkey,
17709
- fromPubkey2,
17710
- false,
17711
- TOKEN_PROGRAM_ID
17712
- );
17713
- const toTokenAccount = await getAssociatedTokenAddress(
17714
- mintPubkey,
17715
- toPubkey2,
17716
- false,
17717
- TOKEN_PROGRAM_ID
17718
- );
17719
- const transaction2 = new Transaction3();
17720
- const accountInfo = await connection2.getAccountInfo(toTokenAccount);
17721
- if (!accountInfo) {
17722
- transaction2.add(
17723
- createAssociatedTokenAccountInstruction(
17724
- fromPubkey2,
17725
- toTokenAccount,
17726
- toPubkey2,
17727
- mintPubkey,
17728
- TOKEN_PROGRAM_ID
17729
- )
17730
- );
17731
- }
17732
- const rawAmount = Math.floor(params.amount * 10 ** decimals);
17733
- transaction2.add(
17734
- createTransferInstruction(
17735
- fromTokenAccount,
17736
- toTokenAccount,
17737
- fromPubkey2,
17738
- rawAmount,
17739
- [],
17740
- TOKEN_PROGRAM_ID
17741
- )
17742
- );
17743
- const { blockhash: blockhash2, lastValidBlockHeight: lastValidBlockHeight2 } = await connection2.getLatestBlockhash();
17744
- transaction2.recentBlockhash = blockhash2;
17745
- transaction2.feePayer = fromPubkey2;
17746
- const signature2 = await externalWallet.sendTransaction(
17747
- transaction2,
17748
- connection2
17749
- );
17750
- await connection2.confirmTransaction({
17751
- signature: signature2,
17752
- blockhash: blockhash2,
17753
- lastValidBlockHeight: lastValidBlockHeight2
17754
- });
17755
- return { signature: signature2 };
17756
- }
17757
- const {
17758
- Connection: Connection2,
17759
- PublicKey: PublicKey2,
17760
- SystemProgram,
17761
- Transaction: Transaction2,
17762
- LAMPORTS_PER_SOL
17763
- } = await import("@solana/web3.js");
17764
- const connection = new Connection2(rpcUrl, "confirmed");
17765
- const fromPubkey = externalWallet.publicKey;
17766
- const toPubkey = new PublicKey2(params.toAddress);
17767
- const transaction = new Transaction2().add(
17768
- SystemProgram.transfer({
17769
- fromPubkey,
17770
- toPubkey,
17771
- lamports: params.amount * LAMPORTS_PER_SOL
17772
- })
17773
- );
17774
- const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
17775
- transaction.recentBlockhash = blockhash;
17776
- transaction.feePayer = fromPubkey;
17777
- const signature = await externalWallet.sendTransaction(
17778
- transaction,
17779
- connection
17780
- );
17781
- await connection.confirmTransaction({
17782
- signature,
17783
- blockhash,
17784
- lastValidBlockHeight
17785
- });
17786
- return { signature };
17787
- }
17788
- throw new Error("No Solana wallet connected");
17789
- };
17790
- const getTokenBalance = async (mintAddress) => {
17791
- if (activeWallet.type === "abc") {
17792
- if (!abcWallet.provider) {
17793
- throw new Error("ABC Solana provider not available");
17794
- }
17795
- return await abcWallet.provider.getTokenBalance(mintAddress);
17796
- }
17797
- if (activeWallet.type === "external") {
17798
- if (!externalWallet.publicKey) {
17799
- throw new Error("Wallet not connected");
17800
- }
17801
- const { Connection: Connection2, PublicKey: PublicKey2 } = await import("@solana/web3.js");
17802
- const { getAssociatedTokenAddress, TOKEN_PROGRAM_ID } = await import("@solana/spl-token");
17803
- const isMainnet = process.env.NEXT_PUBLIC_ENVIRONMENT === "production";
17804
- const rpcUrl = 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";
17805
- const connection = new Connection2(rpcUrl, "confirmed");
17806
- const mintPubkey = new PublicKey2(mintAddress);
17807
- const tokenAccount = await getAssociatedTokenAddress(
17808
- mintPubkey,
17809
- externalWallet.publicKey,
17810
- false,
17811
- TOKEN_PROGRAM_ID
17812
- );
17813
- const balance = await connection.getTokenAccountBalance(tokenAccount);
17814
- return {
17815
- amount: balance.value.amount,
17816
- decimals: balance.value.decimals,
17817
- uiAmount: balance.value.uiAmount || 0
17818
- };
17819
- }
17820
- throw new Error("No Solana wallet connected");
17821
- };
17822
- const signTransaction = async (transaction) => {
17823
- if (activeWallet.type === "abc") {
17824
- if (!abcWallet.provider) {
17825
- throw new Error("ABC Solana provider not available");
17826
- }
17827
- return await abcWallet.provider.signTransaction(transaction);
17828
- }
17829
- if (activeWallet.type === "external") {
17830
- if (!externalWallet.signTransaction) {
17831
- throw new Error("Wallet does not support transaction signing");
17832
- }
17833
- return await externalWallet.signTransaction(transaction);
17834
- }
17835
- throw new Error("No Solana wallet connected");
17836
- };
17837
- const signAllTransactions = async (transactions) => {
17838
- if (activeWallet.type === "abc") {
17839
- if (!abcWallet.provider) {
17840
- throw new Error("ABC Solana provider not available");
17841
- }
17842
- return await abcWallet.provider.signAllTransactions(transactions);
17843
- }
17844
- if (activeWallet.type === "external") {
17845
- if (!externalWallet.signAllTransactions) {
17846
- throw new Error("Wallet does not support batch signing");
17847
- }
17848
- return await externalWallet.signAllTransactions(transactions);
17849
- }
17850
- throw new Error("No Solana wallet connected");
17851
- };
17852
- const sendTransactionUniversal = async (transaction, connection, options) => {
17853
- if (activeWallet.type === "abc") {
17854
- throw new Error(
17855
- "sendTransactionUniversal for ABC Wallet not yet implemented. Use sendTransaction for SOL transfers."
17856
- );
17857
- }
17858
- if (activeWallet.type === "external") {
17859
- if (!externalWallet.sendTransaction) {
17860
- throw new Error("Wallet does not support transactions");
17861
- }
17862
- return await externalWallet.sendTransaction(
17863
- transaction,
17864
- connection,
17865
- options
17866
- );
17867
- }
17868
- throw new Error("No Solana wallet connected");
17869
- };
17870
- return {
17871
- address: activeWallet.address,
17872
- publicKey: activeWallet.publicKey,
17873
- network: activeWallet.network,
17874
- isConnected: activeWallet.isConnected,
17875
- type: activeWallet.type,
17876
- walletName: activeWallet.walletName,
17877
- isLoading,
17878
- error: error2,
17879
- signMessage,
17880
- transfer,
17881
- getTokenBalance,
17882
- signTransaction,
17883
- signAllTransactions,
17884
- sendTransactionUniversal,
17885
- refresh
17886
- };
17887
- }
17888
-
17889
17974
  // src/hooks/useTronWallet.ts
17890
17975
  import { useEffect as useEffect38, useState as useState45 } from "react";
17891
17976
  import { useAccount as useAccount23 } from "wagmi";
17892
17977
  function useTronWallet() {
17893
17978
  const { isConnected: evmConnected, connector } = useAccount23();
17894
17979
  const { requestInterceptor } = useNonEvmConfirmation();
17895
- const [wallet, setWallet] = useState45({
17980
+ const emptyWalletState = {
17896
17981
  address: null,
17897
17982
  publicKey: null,
17898
17983
  network: null,
17899
17984
  isConnected: false,
17900
17985
  provider: null
17901
- });
17986
+ };
17987
+ const [wallet, setWallet] = useState45(emptyWalletState);
17902
17988
  const [isLoading, setIsLoading] = useState45(false);
17903
17989
  const [error2, setError] = useState45(null);
17904
17990
  const refresh = async () => {
17905
- if (!evmConnected || !connector || connector.id !== "abc") {
17906
- setWallet({
17907
- address: null,
17908
- publicKey: null,
17909
- network: null,
17910
- isConnected: false,
17911
- provider: null
17912
- });
17913
- return;
17914
- }
17915
17991
  try {
17916
17992
  setIsLoading(true);
17917
17993
  setError(null);
17918
- const authState = localStorage.getItem("talkenkit_abc_auth_state");
17919
- if (!authState) {
17920
- setWallet({
17921
- address: null,
17922
- publicKey: null,
17923
- network: null,
17924
- isConnected: false,
17925
- provider: null
17926
- });
17927
- return;
17928
- }
17929
- const authData = JSON.parse(authState);
17930
- const tronWallet = authData.tronWallet;
17931
- if (!tronWallet || !tronWallet.address) {
17932
- setWallet({
17933
- address: null,
17934
- publicKey: null,
17935
- network: null,
17936
- isConnected: false,
17937
- provider: null
17938
- });
17939
- return;
17940
- }
17941
- const { AbcTronProvider } = await import("./abcWallet-O4GH6RHS.js");
17942
- const tronProvider = new AbcTronProvider();
17943
- tronProvider.setWallet(tronWallet);
17944
- if (requestInterceptor) {
17945
- tronProvider.setRequestInterceptor(requestInterceptor);
17946
- }
17947
- setWallet({
17948
- address: tronWallet.address,
17949
- publicKey: tronWallet.publicKey,
17950
- network: tronWallet.network || "tron",
17951
- isConnected: true,
17952
- provider: tronProvider
17994
+ const tronWallet = loadEmbeddedWalletFromAuthState("tronWallet");
17995
+ const nextState = await restoreEmbeddedWalletState({
17996
+ enabled: hasAbcEmbeddedSession(evmConnected, connector),
17997
+ wallet: tronWallet,
17998
+ emptyState: emptyWalletState,
17999
+ requestInterceptor,
18000
+ importProvider: async () => (await import("./abcWallet-MWUFO3JQ.js")).AbcTronProvider,
18001
+ mapState: (nextWallet, provider) => ({
18002
+ address: nextWallet.address,
18003
+ publicKey: nextWallet.publicKey,
18004
+ network: nextWallet.network || "tron",
18005
+ isConnected: true,
18006
+ provider
18007
+ })
17953
18008
  });
18009
+ setWallet(nextState);
17954
18010
  } catch (err) {
17955
18011
  setError(err);
17956
- setWallet({
17957
- address: null,
17958
- publicKey: null,
17959
- network: null,
17960
- isConnected: false,
17961
- provider: null
17962
- });
18012
+ setWallet(emptyWalletState);
17963
18013
  } finally {
17964
18014
  setIsLoading(false);
17965
18015
  }
17966
18016
  };
17967
18017
  useEffect38(() => {
17968
- refresh();
18018
+ void refresh();
18019
+ return subscribeToAbcStorageUpdates(refresh);
17969
18020
  }, [evmConnected, connector?.id]);
17970
18021
  useEffect38(() => {
17971
18022
  if (wallet.provider) {
@@ -18179,6 +18230,7 @@ export {
18179
18230
  AbcWalletName,
18180
18231
  ChainIndicator,
18181
18232
  ChainSelector,
18233
+ ConfigApi,
18182
18234
  ConnectButton,
18183
18235
  GasApi,
18184
18236
  Logger,
@@ -18193,9 +18245,11 @@ export {
18193
18245
  RainbowKitProvider,
18194
18246
  SessionExpiredError,
18195
18247
  SignConfirmationProvider,
18248
+ SolanaApi,
18196
18249
  SolanaWalletList2 as SolanaWalletList,
18197
18250
  TalkenApiClient,
18198
18251
  RainbowKitProvider as TalkenKitProvider,
18252
+ TokenApi,
18199
18253
  WalletButton2 as WalletButton,
18200
18254
  WalletscanApi,
18201
18255
  __private__,
@@ -18264,6 +18318,5 @@ export {
18264
18318
  useTronWallet,
18265
18319
  useWalletCapabilities,
18266
18320
  verifyOtpCode,
18267
- verifyPin,
18268
18321
  wagmiToEmbeddedTx
18269
18322
  };