@reown/appkit-cdn 1.8.15-ea982070c1d274f5971447c430b6d77717082e78.0 → 1.8.15-viem-upgrade.0

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 (429) hide show
  1. package/package.json +10 -10
  2. package/dist/ConstantsUtil-BTJjr2qs.js +0 -24
  3. package/dist/ConstantsUtil-BTJjr2qs.js.map +0 -1
  4. package/dist/ExchangeController-CncqkHeT.js +0 -265
  5. package/dist/ExchangeController-CncqkHeT.js.map +0 -1
  6. package/dist/HelpersUtil-CwxnHyjS.js +0 -141
  7. package/dist/HelpersUtil-CwxnHyjS.js.map +0 -1
  8. package/dist/NavigationUtil-Ci15WS4K.js +0 -9
  9. package/dist/NavigationUtil-Ci15WS4K.js.map +0 -1
  10. package/dist/PhArrowCircleDown-B41iUlWV.js +0 -74
  11. package/dist/PhArrowCircleDown-B41iUlWV.js.map +0 -1
  12. package/dist/PhArrowClockwise-BY8u5n41.js +0 -74
  13. package/dist/PhArrowClockwise-BY8u5n41.js.map +0 -1
  14. package/dist/PhArrowDown-ClD8GZ65.js +0 -74
  15. package/dist/PhArrowDown-ClD8GZ65.js.map +0 -1
  16. package/dist/PhArrowLeft-B8MXUz60.js +0 -74
  17. package/dist/PhArrowLeft-B8MXUz60.js.map +0 -1
  18. package/dist/PhArrowRight-Cewa_Slb.js +0 -74
  19. package/dist/PhArrowRight-Cewa_Slb.js.map +0 -1
  20. package/dist/PhArrowSquareOut-whgWh-lD.js +0 -74
  21. package/dist/PhArrowSquareOut-whgWh-lD.js.map +0 -1
  22. package/dist/PhArrowUp-B1HXBxie.js +0 -74
  23. package/dist/PhArrowUp-B1HXBxie.js.map +0 -1
  24. package/dist/PhArrowUpRight-CfFYe4FP.js +0 -74
  25. package/dist/PhArrowUpRight-CfFYe4FP.js.map +0 -1
  26. package/dist/PhArrowsClockwise-gL1Gkrtx.js +0 -74
  27. package/dist/PhArrowsClockwise-gL1Gkrtx.js.map +0 -1
  28. package/dist/PhArrowsDownUp-BqUEdUQr.js +0 -74
  29. package/dist/PhArrowsDownUp-BqUEdUQr.js.map +0 -1
  30. package/dist/PhArrowsLeftRight-BlZU63eY.js +0 -74
  31. package/dist/PhArrowsLeftRight-BlZU63eY.js.map +0 -1
  32. package/dist/PhBank-gbg_jlI7.js +0 -74
  33. package/dist/PhBank-gbg_jlI7.js.map +0 -1
  34. package/dist/PhBrowser-CMlD-YJw.js +0 -74
  35. package/dist/PhBrowser-CMlD-YJw.js.map +0 -1
  36. package/dist/PhCaretDown-3agTO8Jp.js +0 -74
  37. package/dist/PhCaretDown-3agTO8Jp.js.map +0 -1
  38. package/dist/PhCaretLeft-_MTni7Z5.js +0 -74
  39. package/dist/PhCaretLeft-_MTni7Z5.js.map +0 -1
  40. package/dist/PhCaretRight-Ci9fAHPG.js +0 -74
  41. package/dist/PhCaretRight-Ci9fAHPG.js.map +0 -1
  42. package/dist/PhCaretUp-vFG4Fame.js +0 -74
  43. package/dist/PhCaretUp-vFG4Fame.js.map +0 -1
  44. package/dist/PhCheck-mChGK6K_.js +0 -74
  45. package/dist/PhCheck-mChGK6K_.js.map +0 -1
  46. package/dist/PhCircleHalf-DZ7-vfxf.js +0 -74
  47. package/dist/PhCircleHalf-DZ7-vfxf.js.map +0 -1
  48. package/dist/PhClock-Bc5XWXb6.js +0 -74
  49. package/dist/PhClock-Bc5XWXb6.js.map +0 -1
  50. package/dist/PhCompass-Cu2MB-55.js +0 -74
  51. package/dist/PhCompass-Cu2MB-55.js.map +0 -1
  52. package/dist/PhCopy-BGUjyTts.js +0 -74
  53. package/dist/PhCopy-BGUjyTts.js.map +0 -1
  54. package/dist/PhCreditCard-vxFWID4B.js +0 -74
  55. package/dist/PhCreditCard-vxFWID4B.js.map +0 -1
  56. package/dist/PhCurrencyDollar-BfOoDhJr.js +0 -74
  57. package/dist/PhCurrencyDollar-BfOoDhJr.js.map +0 -1
  58. package/dist/PhDesktop-Cq6jwzbS.js +0 -74
  59. package/dist/PhDesktop-Cq6jwzbS.js.map +0 -1
  60. package/dist/PhDeviceMobile-BCtTp6jj.js +0 -74
  61. package/dist/PhDeviceMobile-BCtTp6jj.js.map +0 -1
  62. package/dist/PhDotsThree-BGgD-WIO.js +0 -74
  63. package/dist/PhDotsThree-BGgD-WIO.js.map +0 -1
  64. package/dist/PhEnvelope-CQiV0-zG.js +0 -74
  65. package/dist/PhEnvelope-CQiV0-zG.js.map +0 -1
  66. package/dist/PhFunnelSimple-BHGtxTNf.js +0 -74
  67. package/dist/PhFunnelSimple-BHGtxTNf.js.map +0 -1
  68. package/dist/PhGlobe-Q8oVkf6X.js +0 -74
  69. package/dist/PhGlobe-Q8oVkf6X.js.map +0 -1
  70. package/dist/PhIdentificationCard-Cz9LzvVR.js +0 -74
  71. package/dist/PhIdentificationCard-Cz9LzvVR.js.map +0 -1
  72. package/dist/PhImage-CP5_qKk-.js +0 -74
  73. package/dist/PhImage-CP5_qKk-.js.map +0 -1
  74. package/dist/PhInfo-CTlE1X9Z.js +0 -74
  75. package/dist/PhInfo-CTlE1X9Z.js.map +0 -1
  76. package/dist/PhLightbulb-CcLpnAAb.js +0 -74
  77. package/dist/PhLightbulb-CcLpnAAb.js.map +0 -1
  78. package/dist/PhMagnifyingGlass-n58GUAck.js +0 -74
  79. package/dist/PhMagnifyingGlass-n58GUAck.js.map +0 -1
  80. package/dist/PhPaperPlaneRight-C0sf2XV8.js +0 -74
  81. package/dist/PhPaperPlaneRight-C0sf2XV8.js.map +0 -1
  82. package/dist/PhPlus-BJxvt7Uc.js +0 -74
  83. package/dist/PhPlus-BJxvt7Uc.js.map +0 -1
  84. package/dist/PhPower-BvktxO2-.js +0 -74
  85. package/dist/PhPower-BvktxO2-.js.map +0 -1
  86. package/dist/PhPuzzlePiece-CDDyUPYo.js +0 -74
  87. package/dist/PhPuzzlePiece-CDDyUPYo.js.map +0 -1
  88. package/dist/PhQrCode-BlGI8529.js +0 -74
  89. package/dist/PhQrCode-BlGI8529.js.map +0 -1
  90. package/dist/PhQuestion-DGZj6iDZ.js +0 -74
  91. package/dist/PhQuestion-DGZj6iDZ.js.map +0 -1
  92. package/dist/PhQuestionMark-CTmeI7MQ.js +0 -74
  93. package/dist/PhQuestionMark-CTmeI7MQ.js.map +0 -1
  94. package/dist/PhSealCheck-BSlqkxnH.js +0 -74
  95. package/dist/PhSealCheck-BSlqkxnH.js.map +0 -1
  96. package/dist/PhSignOut-CEXxlRk3.js +0 -74
  97. package/dist/PhSignOut-CEXxlRk3.js.map +0 -1
  98. package/dist/PhSpinner-Do1pY8fG.js +0 -74
  99. package/dist/PhSpinner-Do1pY8fG.js.map +0 -1
  100. package/dist/PhTrash-JNKavmpg.js +0 -74
  101. package/dist/PhTrash-JNKavmpg.js.map +0 -1
  102. package/dist/PhUser-BW7E-xYg.js +0 -74
  103. package/dist/PhUser-BW7E-xYg.js.map +0 -1
  104. package/dist/PhVault-mzxUgBYN.js +0 -74
  105. package/dist/PhVault-mzxUgBYN.js.map +0 -1
  106. package/dist/PhWallet-BR9JThKU.js +0 -74
  107. package/dist/PhWallet-BR9JThKU.js.map +0 -1
  108. package/dist/PhWarning-DxuQ70WM.js +0 -74
  109. package/dist/PhWarning-DxuQ70WM.js.map +0 -1
  110. package/dist/PhWarningCircle-DCI0JC1F.js +0 -74
  111. package/dist/PhWarningCircle-DCI0JC1F.js.map +0 -1
  112. package/dist/PhX-CWNXqpGn.js +0 -74
  113. package/dist/PhX-CWNXqpGn.js.map +0 -1
  114. package/dist/SwapController-DsYbP4IS.js +0 -684
  115. package/dist/SwapController-DsYbP4IS.js.map +0 -1
  116. package/dist/WebCryptoP256-Czt7ZkJ7.js +0 -3299
  117. package/dist/WebCryptoP256-Czt7ZkJ7.js.map +0 -1
  118. package/dist/add-UkulHTXi.js +0 -20
  119. package/dist/add-UkulHTXi.js.map +0 -1
  120. package/dist/all-wallets-DhJCVmL_.js +0 -11
  121. package/dist/all-wallets-DhJCVmL_.js.map +0 -1
  122. package/dist/app-store-Ern3I2La.js +0 -22
  123. package/dist/app-store-Ern3I2La.js.map +0 -1
  124. package/dist/appkit-ppmICUF1.js +0 -118106
  125. package/dist/appkit-ppmICUF1.js.map +0 -1
  126. package/dist/appkit.js +0 -11
  127. package/dist/appkit.js.map +0 -1
  128. package/dist/apple-_SZ-XSIx.js +0 -23
  129. package/dist/apple-_SZ-XSIx.js.map +0 -1
  130. package/dist/arrow-bottom-D7Qlu6xE.js +0 -13
  131. package/dist/arrow-bottom-D7Qlu6xE.js.map +0 -1
  132. package/dist/arrow-bottom-circle-Cel-TDaT.js +0 -16
  133. package/dist/arrow-bottom-circle-Cel-TDaT.js.map +0 -1
  134. package/dist/arrow-left-ByNxCvA_.js +0 -13
  135. package/dist/arrow-left-ByNxCvA_.js.map +0 -1
  136. package/dist/arrow-right-yep9R_ud.js +0 -13
  137. package/dist/arrow-right-yep9R_ud.js.map +0 -1
  138. package/dist/arrow-top-C1WlBAfk.js +0 -13
  139. package/dist/arrow-top-C1WlBAfk.js.map +0 -1
  140. package/dist/async-directive-C9EnweIr.js +0 -73
  141. package/dist/async-directive-C9EnweIr.js.map +0 -1
  142. package/dist/bank-Dm8zmIr0.js +0 -19
  143. package/dist/bank-Dm8zmIr0.js.map +0 -1
  144. package/dist/basic-UB459qAF.js +0 -4914
  145. package/dist/basic-UB459qAF.js.map +0 -1
  146. package/dist/browser-5XoTmr4n.js +0 -1991
  147. package/dist/browser-5XoTmr4n.js.map +0 -1
  148. package/dist/browser-LYv8PF5c.js +0 -19
  149. package/dist/browser-LYv8PF5c.js.map +0 -1
  150. package/dist/card-CEQLkIir.js +0 -19
  151. package/dist/card-CEQLkIir.js.map +0 -1
  152. package/dist/ccip-Dj8tRQd7.js +0 -164
  153. package/dist/ccip-Dj8tRQd7.js.map +0 -1
  154. package/dist/checkmark-DPFC_0yn.js +0 -16
  155. package/dist/checkmark-DPFC_0yn.js.map +0 -1
  156. package/dist/checkmark-bold-Hwfezlkn.js +0 -13
  157. package/dist/checkmark-bold-Hwfezlkn.js.map +0 -1
  158. package/dist/chevron-bottom-qsPvhQDo.js +0 -13
  159. package/dist/chevron-bottom-qsPvhQDo.js.map +0 -1
  160. package/dist/chevron-left-CA4SOr_F.js +0 -13
  161. package/dist/chevron-left-CA4SOr_F.js.map +0 -1
  162. package/dist/chevron-right-TeVZyORZ.js +0 -13
  163. package/dist/chevron-right-TeVZyORZ.js.map +0 -1
  164. package/dist/chevron-top-B7LCiM2n.js +0 -13
  165. package/dist/chevron-top-B7LCiM2n.js.map +0 -1
  166. package/dist/chrome-store-CU7w_5QC.js +0 -66
  167. package/dist/chrome-store-CU7w_5QC.js.map +0 -1
  168. package/dist/class-map-B814K2ej.js +0 -101
  169. package/dist/class-map-B814K2ej.js.map +0 -1
  170. package/dist/clock-DcbItfiJ.js +0 -13
  171. package/dist/clock-DcbItfiJ.js.map +0 -1
  172. package/dist/close-B22QsrS0.js +0 -13
  173. package/dist/close-B22QsrS0.js.map +0 -1
  174. package/dist/clsx.m-D57qXwfE.js +0 -21
  175. package/dist/clsx.m-D57qXwfE.js.map +0 -1
  176. package/dist/coinPlaceholder-BNrjpg6-.js +0 -13
  177. package/dist/coinPlaceholder-BNrjpg6-.js.map +0 -1
  178. package/dist/compass-C7GRFU39.js +0 -13
  179. package/dist/compass-C7GRFU39.js.map +0 -1
  180. package/dist/copy-BcrOhyLL.js +0 -20
  181. package/dist/copy-BcrOhyLL.js.map +0 -1
  182. package/dist/core-BI_Ap4BF.js +0 -16288
  183. package/dist/core-BI_Ap4BF.js.map +0 -1
  184. package/dist/cursor-AJkpyAWk.js +0 -8
  185. package/dist/cursor-AJkpyAWk.js.map +0 -1
  186. package/dist/cursor-transparent-C1dF4GFm.js +0 -17
  187. package/dist/cursor-transparent-C1dF4GFm.js.map +0 -1
  188. package/dist/data-capture-CqwQ1053.js +0 -549
  189. package/dist/data-capture-CqwQ1053.js.map +0 -1
  190. package/dist/desktop-C60oOo59.js +0 -14
  191. package/dist/desktop-C60oOo59.js.map +0 -1
  192. package/dist/disconnect-DqS517fE.js +0 -13
  193. package/dist/disconnect-DqS517fE.js.map +0 -1
  194. package/dist/discord-D1qNpgLJ.js +0 -22
  195. package/dist/discord-D1qNpgLJ.js.map +0 -1
  196. package/dist/email-UK97sxf8.js +0 -421
  197. package/dist/email-UK97sxf8.js.map +0 -1
  198. package/dist/embedded-wallet-f8ft4R2q.js +0 -952
  199. package/dist/embedded-wallet-f8ft4R2q.js.map +0 -1
  200. package/dist/etherscan-BWSY3GuJ.js +0 -11
  201. package/dist/etherscan-BWSY3GuJ.js.map +0 -1
  202. package/dist/exclamation-triangle-nypPoZ5T.js +0 -9
  203. package/dist/exclamation-triangle-nypPoZ5T.js.map +0 -1
  204. package/dist/extension-BuFHuaRl.js +0 -13
  205. package/dist/extension-BuFHuaRl.js.map +0 -1
  206. package/dist/external-link-L3QQJwck.js +0 -13
  207. package/dist/external-link-L3QQJwck.js.map +0 -1
  208. package/dist/facebook-BbbjiGyt.js +0 -31
  209. package/dist/facebook-BbbjiGyt.js.map +0 -1
  210. package/dist/farcaster-CDar3vjq.js +0 -17
  211. package/dist/farcaster-CDar3vjq.js.map +0 -1
  212. package/dist/features-Dne1ZyJy.js +0 -319
  213. package/dist/features-Dne1ZyJy.js.map +0 -1
  214. package/dist/filters-BprVfwTM.js +0 -13
  215. package/dist/filters-BprVfwTM.js.map +0 -1
  216. package/dist/github-BFRFSS65.js +0 -23
  217. package/dist/github-BFRFSS65.js.map +0 -1
  218. package/dist/google-DX3b-tuu.js +0 -23
  219. package/dist/google-DX3b-tuu.js.map +0 -1
  220. package/dist/hashTypedData-MEx8_Z-J.js +0 -262
  221. package/dist/hashTypedData-MEx8_Z-J.js.map +0 -1
  222. package/dist/help-circle-PtWG4XV9.js +0 -17
  223. package/dist/help-circle-PtWG4XV9.js.map +0 -1
  224. package/dist/id-BKzsrqpW.js +0 -17
  225. package/dist/id-BKzsrqpW.js.map +0 -1
  226. package/dist/if-defined-CyuCf775.js +0 -11
  227. package/dist/if-defined-CyuCf775.js.map +0 -1
  228. package/dist/image-2qjHFSqv.js +0 -9
  229. package/dist/image-2qjHFSqv.js.map +0 -1
  230. package/dist/index-57er67ch.js +0 -131
  231. package/dist/index-57er67ch.js.map +0 -1
  232. package/dist/index-B-MpJOWW.js +0 -3987
  233. package/dist/index-B-MpJOWW.js.map +0 -1
  234. package/dist/index-B2f4UbAK.js +0 -257
  235. package/dist/index-B2f4UbAK.js.map +0 -1
  236. package/dist/index-B4xD2s69.js +0 -62
  237. package/dist/index-B4xD2s69.js.map +0 -1
  238. package/dist/index-BF4uePO9.js +0 -126
  239. package/dist/index-BF4uePO9.js.map +0 -1
  240. package/dist/index-BG3007yu.js +0 -542
  241. package/dist/index-BG3007yu.js.map +0 -1
  242. package/dist/index-BPqsyCu1.js +0 -249
  243. package/dist/index-BPqsyCu1.js.map +0 -1
  244. package/dist/index-BTFeMb7h.js +0 -2277
  245. package/dist/index-BTFeMb7h.js.map +0 -1
  246. package/dist/index-B_z_MPZ-.js +0 -180
  247. package/dist/index-B_z_MPZ-.js.map +0 -1
  248. package/dist/index-Biw_bFmP.js +0 -70
  249. package/dist/index-Biw_bFmP.js.map +0 -1
  250. package/dist/index-BnY1urGu.js +0 -441
  251. package/dist/index-BnY1urGu.js.map +0 -1
  252. package/dist/index-C1OrBJOZ.js +0 -218
  253. package/dist/index-C1OrBJOZ.js.map +0 -1
  254. package/dist/index-CHvzOG0E.js +0 -1372
  255. package/dist/index-CHvzOG0E.js.map +0 -1
  256. package/dist/index-CKaIBA_q.js +0 -153
  257. package/dist/index-CKaIBA_q.js.map +0 -1
  258. package/dist/index-CLefivQ6.js +0 -124
  259. package/dist/index-CLefivQ6.js.map +0 -1
  260. package/dist/index-COvWUE72.js +0 -716
  261. package/dist/index-COvWUE72.js.map +0 -1
  262. package/dist/index-CRhk6ovx.js +0 -198
  263. package/dist/index-CRhk6ovx.js.map +0 -1
  264. package/dist/index-CfTNvhZC.js +0 -967
  265. package/dist/index-CfTNvhZC.js.map +0 -1
  266. package/dist/index-CjCwufpz.js +0 -120
  267. package/dist/index-CjCwufpz.js.map +0 -1
  268. package/dist/index-Ck3zz_LE.js +0 -984
  269. package/dist/index-Ck3zz_LE.js.map +0 -1
  270. package/dist/index-CqVDx2Ua.js +0 -9350
  271. package/dist/index-CqVDx2Ua.js.map +0 -1
  272. package/dist/index-CrF2nCtM.js +0 -211
  273. package/dist/index-CrF2nCtM.js.map +0 -1
  274. package/dist/index-Crnbnlbl.js +0 -8825
  275. package/dist/index-Crnbnlbl.js.map +0 -1
  276. package/dist/index-D7bwcPcO.js +0 -147
  277. package/dist/index-D7bwcPcO.js.map +0 -1
  278. package/dist/index-DAmhDlFG.js +0 -985
  279. package/dist/index-DAmhDlFG.js.map +0 -1
  280. package/dist/index-DF9XlWjQ.js +0 -456
  281. package/dist/index-DF9XlWjQ.js.map +0 -1
  282. package/dist/index-DGtLnlsD.js +0 -521
  283. package/dist/index-DGtLnlsD.js.map +0 -1
  284. package/dist/index-DIDlQZ9c.js +0 -1582
  285. package/dist/index-DIDlQZ9c.js.map +0 -1
  286. package/dist/index-DJe9wj3q.js +0 -136
  287. package/dist/index-DJe9wj3q.js.map +0 -1
  288. package/dist/index-DPlE9Qgr.js +0 -73
  289. package/dist/index-DPlE9Qgr.js.map +0 -1
  290. package/dist/index-DVXtgl7V.js +0 -7481
  291. package/dist/index-DVXtgl7V.js.map +0 -1
  292. package/dist/index-DWLAu0nH.js +0 -110
  293. package/dist/index-DWLAu0nH.js.map +0 -1
  294. package/dist/index-DXCwyaz_.js +0 -147
  295. package/dist/index-DXCwyaz_.js.map +0 -1
  296. package/dist/index-D_NteNrS.js +0 -198
  297. package/dist/index-D_NteNrS.js.map +0 -1
  298. package/dist/index-Dg65-p7m.js +0 -7258
  299. package/dist/index-Dg65-p7m.js.map +0 -1
  300. package/dist/index-Du7PdWv1.js +0 -181
  301. package/dist/index-Du7PdWv1.js.map +0 -1
  302. package/dist/index-HOjNYM_k.js +0 -92
  303. package/dist/index-HOjNYM_k.js.map +0 -1
  304. package/dist/index-MwW0rp8T.js +0 -286
  305. package/dist/index-MwW0rp8T.js.map +0 -1
  306. package/dist/index-OCzLDbWt.js +0 -18322
  307. package/dist/index-OCzLDbWt.js.map +0 -1
  308. package/dist/index-Sf3UCmHB.js +0 -611
  309. package/dist/index-Sf3UCmHB.js.map +0 -1
  310. package/dist/index-Zt_Jj4gf.js +0 -520
  311. package/dist/index-Zt_Jj4gf.js.map +0 -1
  312. package/dist/index-kb6zqfNt.js +0 -1178
  313. package/dist/index-kb6zqfNt.js.map +0 -1
  314. package/dist/index-rYPftA0P.js +0 -52
  315. package/dist/index-rYPftA0P.js.map +0 -1
  316. package/dist/index-tdPUUHj0.js +0 -281
  317. package/dist/index-tdPUUHj0.js.map +0 -1
  318. package/dist/index-wVp4UjVg.js +0 -182
  319. package/dist/index-wVp4UjVg.js.map +0 -1
  320. package/dist/index-ywRnp0Bi.js +0 -109
  321. package/dist/index-ywRnp0Bi.js.map +0 -1
  322. package/dist/index.es-BrfaQK0n.js +0 -8391
  323. package/dist/index.es-BrfaQK0n.js.map +0 -1
  324. package/dist/info-BhM-vMtG.js +0 -8
  325. package/dist/info-BhM-vMtG.js.map +0 -1
  326. package/dist/info-circle-DwGnsKMj.js +0 -17
  327. package/dist/info-circle-DwGnsKMj.js.map +0 -1
  328. package/dist/jsxRuntime.module-BW0yCO8A.js +0 -14
  329. package/dist/jsxRuntime.module-BW0yCO8A.js.map +0 -1
  330. package/dist/lightbulb-BvGmXMuo.js +0 -8
  331. package/dist/lightbulb-BvGmXMuo.js.map +0 -1
  332. package/dist/localBatchGatewayRequest-CLL1gABv.js +0 -103
  333. package/dist/localBatchGatewayRequest-CLL1gABv.js.map +0 -1
  334. package/dist/mail-Cl70v1Dx.js +0 -13
  335. package/dist/mail-Cl70v1Dx.js.map +0 -1
  336. package/dist/metamask-sdk-BzQ933Ju.js +0 -16699
  337. package/dist/metamask-sdk-BzQ933Ju.js.map +0 -1
  338. package/dist/mobile-BCINjy0Y.js +0 -14
  339. package/dist/mobile-BCINjy0Y.js.map +0 -1
  340. package/dist/more-Cozw6-SQ.js +0 -16
  341. package/dist/more-Cozw6-SQ.js.map +0 -1
  342. package/dist/native-Dc_5StoC.js +0 -17
  343. package/dist/native-Dc_5StoC.js.map +0 -1
  344. package/dist/network-placeholder-o2Dz_YnK.js +0 -19
  345. package/dist/network-placeholder-o2Dz_YnK.js.map +0 -1
  346. package/dist/nftPlaceholder-Bjf9SAC-.js +0 -13
  347. package/dist/nftPlaceholder-Bjf9SAC-.js.map +0 -1
  348. package/dist/off-BsVJ8v6H.js +0 -13
  349. package/dist/off-BsVJ8v6H.js.map +0 -1
  350. package/dist/onramp-C4DqYEmw.js +0 -979
  351. package/dist/onramp-C4DqYEmw.js.map +0 -1
  352. package/dist/parseAbiParameters-DfJcIE_w.js +0 -757
  353. package/dist/parseAbiParameters-DfJcIE_w.js.map +0 -1
  354. package/dist/parseSignature-MJforcG6.js +0 -4690
  355. package/dist/parseSignature-MJforcG6.js.map +0 -1
  356. package/dist/pay-with-exchange-DC29BzBo.js +0 -603
  357. package/dist/pay-with-exchange-DC29BzBo.js.map +0 -1
  358. package/dist/play-store-DIOK4cBW.js +0 -37
  359. package/dist/play-store-DIOK4cBW.js.map +0 -1
  360. package/dist/plus-Cxls3O6G.js +0 -18
  361. package/dist/plus-Cxls3O6G.js.map +0 -1
  362. package/dist/property-8UcTqffH.js +0 -623
  363. package/dist/property-8UcTqffH.js.map +0 -1
  364. package/dist/qr-code-Cp6lpAcY.js +0 -11
  365. package/dist/qr-code-Cp6lpAcY.js.map +0 -1
  366. package/dist/receive-BLI57snb.js +0 -262
  367. package/dist/receive-BLI57snb.js.map +0 -1
  368. package/dist/recycle-horizontal-AEJ_nbSP.js +0 -14
  369. package/dist/recycle-horizontal-AEJ_nbSP.js.map +0 -1
  370. package/dist/ref-BobNUvS_.js +0 -43
  371. package/dist/ref-BobNUvS_.js.map +0 -1
  372. package/dist/refresh-7roUeD2M.js +0 -13
  373. package/dist/refresh-7roUeD2M.js.map +0 -1
  374. package/dist/reown-logo-xggoIKX2.js +0 -17
  375. package/dist/reown-logo-xggoIKX2.js.map +0 -1
  376. package/dist/search-DgzcpMUb.js +0 -13
  377. package/dist/search-DgzcpMUb.js.map +0 -1
  378. package/dist/secp256k1-D_j0Z4BY.js +0 -2031
  379. package/dist/secp256k1-D_j0Z4BY.js.map +0 -1
  380. package/dist/send-D7M2-Upc.js +0 -20
  381. package/dist/send-D7M2-Upc.js.map +0 -1
  382. package/dist/send-TAzhXOOa.js +0 -1365
  383. package/dist/send-TAzhXOOa.js.map +0 -1
  384. package/dist/socials-BXTq602s.js +0 -796
  385. package/dist/socials-BXTq602s.js.map +0 -1
  386. package/dist/swapHorizontal-2gzDDUNF.js +0 -13
  387. package/dist/swapHorizontal-2gzDDUNF.js.map +0 -1
  388. package/dist/swapHorizontalBold-C1cHwAjU.js +0 -13
  389. package/dist/swapHorizontalBold-C1cHwAjU.js.map +0 -1
  390. package/dist/swapHorizontalMedium-BQno5vep.js +0 -21
  391. package/dist/swapHorizontalMedium-BQno5vep.js.map +0 -1
  392. package/dist/swapHorizontalRoundedBold-CYmZDeQ5.js +0 -13
  393. package/dist/swapHorizontalRoundedBold-CYmZDeQ5.js.map +0 -1
  394. package/dist/swapVertical-BhRPysBs.js +0 -13
  395. package/dist/swapVertical-BhRPysBs.js.map +0 -1
  396. package/dist/swaps-DQ-uUZvX.js +0 -2121
  397. package/dist/swaps-DQ-uUZvX.js.map +0 -1
  398. package/dist/telegram-B-YOyhte.js +0 -21
  399. package/dist/telegram-B-YOyhte.js.map +0 -1
  400. package/dist/three-dots-8mr70UzU.js +0 -10
  401. package/dist/three-dots-8mr70UzU.js.map +0 -1
  402. package/dist/transactions-C4p83vMQ.js +0 -38
  403. package/dist/transactions-C4p83vMQ.js.map +0 -1
  404. package/dist/twitch-C2ccExfT.js +0 -23
  405. package/dist/twitch-C2ccExfT.js.map +0 -1
  406. package/dist/twitterIcon-IkT5wPxq.js +0 -11
  407. package/dist/twitterIcon-IkT5wPxq.js.map +0 -1
  408. package/dist/vanilla-CgG5xMJO.js +0 -448
  409. package/dist/vanilla-CgG5xMJO.js.map +0 -1
  410. package/dist/verify-BfilAaob.js +0 -13
  411. package/dist/verify-BfilAaob.js.map +0 -1
  412. package/dist/verify-filled-COkWKgPo.js +0 -13
  413. package/dist/verify-filled-COkWKgPo.js.map +0 -1
  414. package/dist/w3m-modal-9MzgEqm3.js +0 -1725
  415. package/dist/w3m-modal-9MzgEqm3.js.map +0 -1
  416. package/dist/w3m-modal-DBQU256b.js +0 -2008
  417. package/dist/w3m-modal-DBQU256b.js.map +0 -1
  418. package/dist/wallet-9D5svrZj.js +0 -13
  419. package/dist/wallet-9D5svrZj.js.map +0 -1
  420. package/dist/wallet-placeholder-CfLGKG93.js +0 -19
  421. package/dist/wallet-placeholder-CfLGKG93.js.map +0 -1
  422. package/dist/wallet-standard-CkMoUaGA.js +0 -523
  423. package/dist/wallet-standard-CkMoUaGA.js.map +0 -1
  424. package/dist/walletconnect-MtAz2u7z.js +0 -39
  425. package/dist/walletconnect-MtAz2u7z.js.map +0 -1
  426. package/dist/warning-circle-Cf2AJecu.js +0 -17
  427. package/dist/warning-circle-Cf2AJecu.js.map +0 -1
  428. package/dist/x-B0KhGb39.js +0 -17
  429. package/dist/x-B0KhGb39.js.map +0 -1
@@ -1,2121 +0,0 @@
1
- import { m as css, o as i, C as ChainController, N as NumberUtil, x, d as ConstantsUtil, E as EventsController, R as RouterController, a as CoreHelperUtil, a3 as ModalController, y as getPreferredAccountType, W as W3mFrameRpcConstants, r as resetStyles, n as elementStyles } from "./appkit-ppmICUF1.js";
2
- import { r, n } from "./class-map-B814K2ej.js";
3
- import { c as customElement } from "./index-kb6zqfNt.js";
4
- import "./index-C1OrBJOZ.js";
5
- import "./index-BF4uePO9.js";
6
- import { M as MathUtil } from "./index-ywRnp0Bi.js";
7
- import "./index-wVp4UjVg.js";
8
- import { S as SwapController } from "./SwapController-DsYbP4IS.js";
9
- import "./index-Biw_bFmP.js";
10
- import "./index-CrF2nCtM.js";
11
- import "./index-BPqsyCu1.js";
12
- import "./index-D7bwcPcO.js";
13
- const InputUtil = {
14
- numericInputKeyDown(event, currentValue, onChange) {
15
- const allowedKeys = [
16
- "Backspace",
17
- "Meta",
18
- "Ctrl",
19
- "a",
20
- "A",
21
- "c",
22
- "C",
23
- "x",
24
- "X",
25
- "v",
26
- "V",
27
- "ArrowLeft",
28
- "ArrowRight",
29
- "Tab"
30
- ];
31
- const controlPressed = event.metaKey || event.ctrlKey;
32
- const eventKey = event.key;
33
- const lowercaseEventKey = eventKey.toLocaleLowerCase();
34
- const selectAll = lowercaseEventKey === "a";
35
- const copyKey = lowercaseEventKey === "c";
36
- const pasteKey = lowercaseEventKey === "v";
37
- const cutKey = lowercaseEventKey === "x";
38
- const isComma = eventKey === ",";
39
- const isDot = eventKey === ".";
40
- const isNumericKey = eventKey >= "0" && eventKey <= "9";
41
- if (!controlPressed && (selectAll || copyKey || pasteKey || cutKey)) {
42
- event.preventDefault();
43
- }
44
- if (currentValue === "0" && !isComma && !isDot && eventKey === "0") {
45
- event.preventDefault();
46
- }
47
- if (currentValue === "0" && isNumericKey) {
48
- onChange(eventKey);
49
- event.preventDefault();
50
- }
51
- if (isComma || isDot) {
52
- if (!currentValue) {
53
- onChange("0.");
54
- event.preventDefault();
55
- }
56
- if ((currentValue == null ? void 0 : currentValue.includes(".")) || (currentValue == null ? void 0 : currentValue.includes(","))) {
57
- event.preventDefault();
58
- }
59
- }
60
- if (!isNumericKey && !allowedKeys.includes(eventKey) && !isDot && !isComma) {
61
- event.preventDefault();
62
- }
63
- }
64
- };
65
- const styles$7 = css`
66
- :host {
67
- width: 100%;
68
- }
69
-
70
- .details-container > wui-flex {
71
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
72
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
73
- width: 100%;
74
- }
75
-
76
- .details-container > wui-flex > button {
77
- border: none;
78
- background: none;
79
- padding: ${({ spacing }) => spacing["3"]};
80
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
81
- cursor: pointer;
82
- }
83
-
84
- .details-content-container {
85
- padding: ${({ spacing }) => spacing["2"]};
86
- padding-top: 0px;
87
- display: flex;
88
- align-items: center;
89
- justify-content: center;
90
- }
91
-
92
- .details-content-container > wui-flex {
93
- width: 100%;
94
- }
95
-
96
- .details-row {
97
- width: 100%;
98
- padding: ${({ spacing }) => spacing["3"]};
99
- padding-left: ${({ spacing }) => spacing["3"]};
100
- padding-right: ${({ spacing }) => spacing["2"]};
101
- border-radius: calc(
102
- ${({ borderRadius }) => borderRadius["1"]} + ${({ borderRadius }) => borderRadius["1"]}
103
- );
104
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
105
- }
106
-
107
- .details-row-title {
108
- white-space: nowrap;
109
- }
110
-
111
- .details-row.provider-free-row {
112
- padding-right: ${({ spacing }) => spacing["2"]};
113
- }
114
- `;
115
- var __decorate$7 = function(decorators, target, key, desc) {
116
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
117
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
118
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
119
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
120
- };
121
- const slippageRate = ConstantsUtil.CONVERT_SLIPPAGE_TOLERANCE;
122
- let WuiSwapDetails = class WuiSwapDetails2 extends i {
123
- constructor() {
124
- var _a;
125
- super();
126
- this.unsubscribe = [];
127
- this.networkName = (_a = ChainController.state.activeCaipNetwork) == null ? void 0 : _a.name;
128
- this.detailsOpen = false;
129
- this.sourceToken = SwapController.state.sourceToken;
130
- this.toToken = SwapController.state.toToken;
131
- this.toTokenAmount = SwapController.state.toTokenAmount;
132
- this.sourceTokenPriceInUSD = SwapController.state.sourceTokenPriceInUSD;
133
- this.toTokenPriceInUSD = SwapController.state.toTokenPriceInUSD;
134
- this.priceImpact = SwapController.state.priceImpact;
135
- this.maxSlippage = SwapController.state.maxSlippage;
136
- this.networkTokenSymbol = SwapController.state.networkTokenSymbol;
137
- this.inputError = SwapController.state.inputError;
138
- this.unsubscribe.push(...[
139
- SwapController.subscribe((newState) => {
140
- this.sourceToken = newState.sourceToken;
141
- this.toToken = newState.toToken;
142
- this.toTokenAmount = newState.toTokenAmount;
143
- this.priceImpact = newState.priceImpact;
144
- this.maxSlippage = newState.maxSlippage;
145
- this.sourceTokenPriceInUSD = newState.sourceTokenPriceInUSD;
146
- this.toTokenPriceInUSD = newState.toTokenPriceInUSD;
147
- this.inputError = newState.inputError;
148
- })
149
- ]);
150
- }
151
- render() {
152
- const minReceivedAmount = this.toTokenAmount && this.maxSlippage ? NumberUtil.bigNumber(this.toTokenAmount).minus(this.maxSlippage).toString() : null;
153
- if (!this.sourceToken || !this.toToken || this.inputError) {
154
- return null;
155
- }
156
- const toTokenSwappedAmount = this.sourceTokenPriceInUSD && this.toTokenPriceInUSD ? 1 / this.toTokenPriceInUSD * this.sourceTokenPriceInUSD : 0;
157
- return x`
158
- <wui-flex flexDirection="column" alignItems="center" gap="01" class="details-container">
159
- <wui-flex flexDirection="column">
160
- <button @click=${this.toggleDetails.bind(this)}>
161
- <wui-flex justifyContent="space-between" .padding=${["0", "2", "0", "2"]}>
162
- <wui-flex justifyContent="flex-start" flexGrow="1" gap="2">
163
- <wui-text variant="sm-regular" color="primary">
164
- 1 ${this.sourceToken.symbol} =
165
- ${NumberUtil.formatNumberToLocalString(toTokenSwappedAmount, 3)}
166
- ${this.toToken.symbol}
167
- </wui-text>
168
- <wui-text variant="sm-regular" color="secondary">
169
- $${NumberUtil.formatNumberToLocalString(this.sourceTokenPriceInUSD)}
170
- </wui-text>
171
- </wui-flex>
172
- <wui-icon name="chevronBottom"></wui-icon>
173
- </wui-flex>
174
- </button>
175
- ${this.detailsOpen ? x`
176
- <wui-flex flexDirection="column" gap="2" class="details-content-container">
177
- ${this.priceImpact ? x` <wui-flex flexDirection="column" gap="2">
178
- <wui-flex
179
- justifyContent="space-between"
180
- alignItems="center"
181
- class="details-row"
182
- >
183
- <wui-flex alignItems="center" gap="2">
184
- <wui-text
185
- class="details-row-title"
186
- variant="sm-regular"
187
- color="secondary"
188
- >
189
- Price impact
190
- </wui-text>
191
- <w3m-tooltip-trigger
192
- text="Price impact reflects the change in market price due to your trade"
193
- >
194
- <wui-icon size="sm" color="default" name="info"></wui-icon>
195
- </w3m-tooltip-trigger>
196
- </wui-flex>
197
- <wui-flex>
198
- <wui-text variant="sm-regular" color="secondary">
199
- ${NumberUtil.formatNumberToLocalString(this.priceImpact, 3)}%
200
- </wui-text>
201
- </wui-flex>
202
- </wui-flex>
203
- </wui-flex>` : null}
204
- ${this.maxSlippage && this.sourceToken.symbol ? x`<wui-flex flexDirection="column" gap="2">
205
- <wui-flex
206
- justifyContent="space-between"
207
- alignItems="center"
208
- class="details-row"
209
- >
210
- <wui-flex alignItems="center" gap="2">
211
- <wui-text
212
- class="details-row-title"
213
- variant="sm-regular"
214
- color="secondary"
215
- >
216
- Max. slippage
217
- </wui-text>
218
- <w3m-tooltip-trigger
219
- text=${`Max slippage sets the minimum amount you must receive for the transaction to proceed. ${minReceivedAmount ? `Transaction will be reversed if you receive less than ${NumberUtil.formatNumberToLocalString(minReceivedAmount, 6)} ${this.toToken.symbol} due to price changes.` : ""}`}
220
- >
221
- <wui-icon size="sm" color="default" name="info"></wui-icon>
222
- </w3m-tooltip-trigger>
223
- </wui-flex>
224
- <wui-flex>
225
- <wui-text variant="sm-regular" color="secondary">
226
- ${NumberUtil.formatNumberToLocalString(this.maxSlippage, 6)}
227
- ${this.toToken.symbol} ${slippageRate}%
228
- </wui-text>
229
- </wui-flex>
230
- </wui-flex>
231
- </wui-flex>` : null}
232
- <wui-flex flexDirection="column" gap="2">
233
- <wui-flex
234
- justifyContent="space-between"
235
- alignItems="center"
236
- class="details-row provider-free-row"
237
- >
238
- <wui-flex alignItems="center" gap="2">
239
- <wui-text class="details-row-title" variant="sm-regular" color="secondary">
240
- Provider fee
241
- </wui-text>
242
- </wui-flex>
243
- <wui-flex>
244
- <wui-text variant="sm-regular" color="secondary">0.85%</wui-text>
245
- </wui-flex>
246
- </wui-flex>
247
- </wui-flex>
248
- </wui-flex>
249
- ` : null}
250
- </wui-flex>
251
- </wui-flex>
252
- `;
253
- }
254
- toggleDetails() {
255
- this.detailsOpen = !this.detailsOpen;
256
- }
257
- };
258
- WuiSwapDetails.styles = [styles$7];
259
- __decorate$7([
260
- r()
261
- ], WuiSwapDetails.prototype, "networkName", void 0);
262
- __decorate$7([
263
- n()
264
- ], WuiSwapDetails.prototype, "detailsOpen", void 0);
265
- __decorate$7([
266
- r()
267
- ], WuiSwapDetails.prototype, "sourceToken", void 0);
268
- __decorate$7([
269
- r()
270
- ], WuiSwapDetails.prototype, "toToken", void 0);
271
- __decorate$7([
272
- r()
273
- ], WuiSwapDetails.prototype, "toTokenAmount", void 0);
274
- __decorate$7([
275
- r()
276
- ], WuiSwapDetails.prototype, "sourceTokenPriceInUSD", void 0);
277
- __decorate$7([
278
- r()
279
- ], WuiSwapDetails.prototype, "toTokenPriceInUSD", void 0);
280
- __decorate$7([
281
- r()
282
- ], WuiSwapDetails.prototype, "priceImpact", void 0);
283
- __decorate$7([
284
- r()
285
- ], WuiSwapDetails.prototype, "maxSlippage", void 0);
286
- __decorate$7([
287
- r()
288
- ], WuiSwapDetails.prototype, "networkTokenSymbol", void 0);
289
- __decorate$7([
290
- r()
291
- ], WuiSwapDetails.prototype, "inputError", void 0);
292
- WuiSwapDetails = __decorate$7([
293
- customElement("w3m-swap-details")
294
- ], WuiSwapDetails);
295
- const styles$6 = css`
296
- :host {
297
- width: 100%;
298
- }
299
-
300
- :host > wui-flex {
301
- display: flex;
302
- flex-direction: row;
303
- justify-content: space-between;
304
- align-items: center;
305
- border-radius: ${({ borderRadius }) => borderRadius["5"]};
306
- padding: ${({ spacing }) => spacing["5"]};
307
- padding-right: ${({ spacing }) => spacing["3"]};
308
- background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
309
- box-shadow: inset 0px 0px 0px 1px ${({ tokens }) => tokens.theme.foregroundPrimary};
310
- width: 100%;
311
- height: 100px;
312
- box-sizing: border-box;
313
- position: relative;
314
- }
315
-
316
- wui-shimmer.market-value {
317
- opacity: 0;
318
- }
319
-
320
- :host > wui-flex > svg.input_mask {
321
- position: absolute;
322
- inset: 0;
323
- z-index: 5;
324
- }
325
-
326
- :host wui-flex .input_mask__border,
327
- :host wui-flex .input_mask__background {
328
- transition: fill ${({ durations }) => durations["md"]}
329
- ${({ easings }) => easings["ease-out-power-1"]};
330
- will-change: fill;
331
- }
332
-
333
- :host wui-flex .input_mask__border {
334
- fill: ${({ tokens }) => tokens.core.glass010};
335
- }
336
-
337
- :host wui-flex .input_mask__background {
338
- fill: ${({ tokens }) => tokens.theme.foregroundPrimary};
339
- }
340
- `;
341
- var __decorate$6 = function(decorators, target, key, desc) {
342
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
343
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
344
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
345
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
346
- };
347
- let W3mSwapInputSkeleton = class W3mSwapInputSkeleton2 extends i {
348
- constructor() {
349
- super(...arguments);
350
- this.target = "sourceToken";
351
- }
352
- render() {
353
- return x`
354
- <wui-flex class justifyContent="space-between">
355
- <wui-flex
356
- flex="1"
357
- flexDirection="column"
358
- alignItems="flex-start"
359
- justifyContent="center"
360
- class="swap-input"
361
- gap="1"
362
- >
363
- <wui-shimmer width="80px" height="40px" rounded variant="light"></wui-shimmer>
364
- </wui-flex>
365
- ${this.templateTokenSelectButton()}
366
- </wui-flex>
367
- `;
368
- }
369
- templateTokenSelectButton() {
370
- return x`
371
- <wui-flex
372
- class="swap-token-button"
373
- flexDirection="column"
374
- alignItems="flex-end"
375
- justifyContent="center"
376
- gap="1"
377
- >
378
- <wui-shimmer width="80px" height="40px" rounded variant="light"></wui-shimmer>
379
- </wui-flex>
380
- `;
381
- }
382
- };
383
- W3mSwapInputSkeleton.styles = [styles$6];
384
- __decorate$6([
385
- n()
386
- ], W3mSwapInputSkeleton.prototype, "target", void 0);
387
- W3mSwapInputSkeleton = __decorate$6([
388
- customElement("w3m-swap-input-skeleton")
389
- ], W3mSwapInputSkeleton);
390
- const styles$5 = css`
391
- :host > wui-flex {
392
- display: flex;
393
- flex-direction: row;
394
- justify-content: space-between;
395
- align-items: center;
396
- border-radius: ${({ borderRadius }) => borderRadius["5"]};
397
- background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
398
- padding: ${({ spacing }) => spacing["5"]};
399
- padding-right: ${({ spacing }) => spacing["3"]};
400
- width: 100%;
401
- height: 100px;
402
- box-sizing: border-box;
403
- box-shadow: inset 0px 0px 0px 1px ${({ tokens }) => tokens.theme.foregroundPrimary};
404
- position: relative;
405
- transition: box-shadow ${({ easings }) => easings["ease-out-power-1"]}
406
- ${({ durations }) => durations["lg"]};
407
- will-change: background-color;
408
- }
409
-
410
- :host wui-flex.focus {
411
- box-shadow: inset 0px 0px 0px 1px ${({ tokens }) => tokens.core.glass010};
412
- }
413
-
414
- :host > wui-flex .swap-input,
415
- :host > wui-flex .swap-token-button {
416
- z-index: 10;
417
- }
418
-
419
- :host > wui-flex .swap-input {
420
- -webkit-mask-image: linear-gradient(
421
- 270deg,
422
- transparent 0px,
423
- transparent 8px,
424
- black 24px,
425
- black 25px,
426
- black 32px,
427
- black 100%
428
- );
429
- mask-image: linear-gradient(
430
- 270deg,
431
- transparent 0px,
432
- transparent 8px,
433
- black 24px,
434
- black 25px,
435
- black 32px,
436
- black 100%
437
- );
438
- }
439
-
440
- :host > wui-flex .swap-input input {
441
- background: none;
442
- border: none;
443
- height: 42px;
444
- width: 100%;
445
- font-size: 32px;
446
- font-style: normal;
447
- font-weight: 400;
448
- line-height: 130%;
449
- letter-spacing: -1.28px;
450
- outline: none;
451
- caret-color: ${({ tokens }) => tokens.core.textAccentPrimary};
452
- color: ${({ tokens }) => tokens.theme.textPrimary};
453
- padding: 0px;
454
- }
455
-
456
- :host > wui-flex .swap-input input:focus-visible {
457
- outline: none;
458
- }
459
-
460
- :host > wui-flex .swap-input input::-webkit-outer-spin-button,
461
- :host > wui-flex .swap-input input::-webkit-inner-spin-button {
462
- -webkit-appearance: none;
463
- margin: 0;
464
- }
465
-
466
- .max-value-button {
467
- background-color: transparent;
468
- border: none;
469
- cursor: pointer;
470
- color: ${({ tokens }) => tokens.core.glass010};
471
- padding-left: 0px;
472
- }
473
-
474
- .market-value {
475
- min-height: 18px;
476
- }
477
- `;
478
- var __decorate$5 = function(decorators, target, key, desc) {
479
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
480
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
481
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
482
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
483
- };
484
- const MINIMUM_USD_VALUE_TO_CONVERT = 5e-5;
485
- let W3mSwapInput = class W3mSwapInput2 extends i {
486
- constructor() {
487
- super(...arguments);
488
- this.focused = false;
489
- this.price = 0;
490
- this.target = "sourceToken";
491
- this.onSetAmount = null;
492
- this.onSetMaxValue = null;
493
- }
494
- render() {
495
- const marketValue = this.marketValue || "0";
496
- const isMarketValueGreaterThanZero = NumberUtil.bigNumber(marketValue).gt("0");
497
- return x`
498
- <wui-flex
499
- class="${this.focused ? "focus" : ""}"
500
- justifyContent="space-between"
501
- alignItems="center"
502
- >
503
- <wui-flex
504
- flex="1"
505
- flexDirection="column"
506
- alignItems="flex-start"
507
- justifyContent="center"
508
- class="swap-input"
509
- >
510
- <input
511
- data-testid="swap-input-${this.target}"
512
- @focusin=${() => this.onFocusChange(true)}
513
- @focusout=${() => this.onFocusChange(false)}
514
- ?disabled=${this.disabled}
515
- value=${this.value || ""}
516
- @input=${this.dispatchInputChangeEvent}
517
- @keydown=${this.handleKeydown}
518
- placeholder="0"
519
- type="text"
520
- inputmode="decimal"
521
- pattern="[0-9,.]*"
522
- />
523
- <wui-text class="market-value" variant="sm-regular" color="secondary">
524
- ${isMarketValueGreaterThanZero ? `$${NumberUtil.formatNumberToLocalString(this.marketValue, 2)}` : null}
525
- </wui-text>
526
- </wui-flex>
527
- ${this.templateTokenSelectButton()}
528
- </wui-flex>
529
- `;
530
- }
531
- handleKeydown(event) {
532
- return InputUtil.numericInputKeyDown(event, this.value, (value) => {
533
- var _a;
534
- return (_a = this.onSetAmount) == null ? void 0 : _a.call(this, this.target, value);
535
- });
536
- }
537
- dispatchInputChangeEvent(event) {
538
- if (!this.onSetAmount) {
539
- return;
540
- }
541
- const value = event.target.value.replace(/[^0-9.]/gu, "");
542
- if (value === "," || value === ".") {
543
- this.onSetAmount(this.target, "0.");
544
- } else if (value.endsWith(",")) {
545
- this.onSetAmount(this.target, value.replace(",", "."));
546
- } else {
547
- this.onSetAmount(this.target, value);
548
- }
549
- }
550
- setMaxValueToInput() {
551
- var _a;
552
- (_a = this.onSetMaxValue) == null ? void 0 : _a.call(this, this.target, this.balance);
553
- }
554
- templateTokenSelectButton() {
555
- if (!this.token) {
556
- return x` <wui-button
557
- data-testid="swap-select-token-button-${this.target}"
558
- class="swap-token-button"
559
- size="md"
560
- variant="neutral-secondary"
561
- @click=${this.onSelectToken.bind(this)}
562
- >
563
- Select token
564
- </wui-button>`;
565
- }
566
- return x`
567
- <wui-flex
568
- class="swap-token-button"
569
- flexDirection="column"
570
- alignItems="flex-end"
571
- justifyContent="center"
572
- gap="1"
573
- >
574
- <wui-token-button
575
- data-testid="swap-input-token-${this.target}"
576
- text=${this.token.symbol}
577
- imageSrc=${this.token.logoUri}
578
- @click=${this.onSelectToken.bind(this)}
579
- >
580
- </wui-token-button>
581
- <wui-flex alignItems="center" gap="1"> ${this.tokenBalanceTemplate()} </wui-flex>
582
- </wui-flex>
583
- `;
584
- }
585
- tokenBalanceTemplate() {
586
- const balanceValueInUSD = NumberUtil.multiply(this.balance, this.price);
587
- const haveBalance = balanceValueInUSD ? balanceValueInUSD == null ? void 0 : balanceValueInUSD.gt(MINIMUM_USD_VALUE_TO_CONVERT) : false;
588
- return x`
589
- ${haveBalance ? x`<wui-text variant="sm-regular" color="secondary">
590
- ${NumberUtil.formatNumberToLocalString(this.balance, 2)}
591
- </wui-text>` : null}
592
- ${this.target === "sourceToken" ? this.tokenActionButtonTemplate(haveBalance) : null}
593
- `;
594
- }
595
- tokenActionButtonTemplate(haveBalance) {
596
- if (haveBalance) {
597
- return x` <button class="max-value-button" @click=${this.setMaxValueToInput.bind(this)}>
598
- <wui-text color="accent-primary" variant="sm-medium">Max</wui-text>
599
- </button>`;
600
- }
601
- return x` <button class="max-value-button" @click=${this.onBuyToken.bind(this)}>
602
- <wui-text color="accent-primary" variant="sm-medium">Buy</wui-text>
603
- </button>`;
604
- }
605
- onFocusChange(state) {
606
- this.focused = state;
607
- }
608
- onSelectToken() {
609
- EventsController.sendEvent({ type: "track", event: "CLICK_SELECT_TOKEN_TO_SWAP" });
610
- RouterController.push("SwapSelectToken", {
611
- target: this.target
612
- });
613
- }
614
- onBuyToken() {
615
- RouterController.push("OnRampProviders");
616
- }
617
- };
618
- W3mSwapInput.styles = [styles$5];
619
- __decorate$5([
620
- n()
621
- ], W3mSwapInput.prototype, "focused", void 0);
622
- __decorate$5([
623
- n()
624
- ], W3mSwapInput.prototype, "balance", void 0);
625
- __decorate$5([
626
- n()
627
- ], W3mSwapInput.prototype, "value", void 0);
628
- __decorate$5([
629
- n()
630
- ], W3mSwapInput.prototype, "price", void 0);
631
- __decorate$5([
632
- n()
633
- ], W3mSwapInput.prototype, "marketValue", void 0);
634
- __decorate$5([
635
- n()
636
- ], W3mSwapInput.prototype, "disabled", void 0);
637
- __decorate$5([
638
- n()
639
- ], W3mSwapInput.prototype, "target", void 0);
640
- __decorate$5([
641
- n()
642
- ], W3mSwapInput.prototype, "token", void 0);
643
- __decorate$5([
644
- n()
645
- ], W3mSwapInput.prototype, "onSetAmount", void 0);
646
- __decorate$5([
647
- n()
648
- ], W3mSwapInput.prototype, "onSetMaxValue", void 0);
649
- W3mSwapInput = __decorate$5([
650
- customElement("w3m-swap-input")
651
- ], W3mSwapInput);
652
- const styles$4 = css`
653
- :host > wui-flex:first-child {
654
- overflow-y: auto;
655
- overflow-x: hidden;
656
- scrollbar-width: none;
657
- }
658
-
659
- :host > wui-flex:first-child::-webkit-scrollbar {
660
- display: none;
661
- }
662
-
663
- wui-loading-hexagon {
664
- position: absolute;
665
- }
666
-
667
- .action-button {
668
- width: 100%;
669
- border-radius: ${({ borderRadius }) => borderRadius["4"]};
670
- }
671
-
672
- .action-button:disabled {
673
- border-color: 1px solid ${({ tokens }) => tokens.core.glass010};
674
- }
675
-
676
- .swap-inputs-container {
677
- position: relative;
678
- }
679
-
680
- wui-icon-box {
681
- width: 32px;
682
- height: 32px;
683
- border-radius: ${({ borderRadius }) => borderRadius["10"]} !important;
684
- border: 4px solid ${({ tokens }) => tokens.theme.backgroundPrimary};
685
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
686
- position: absolute;
687
- top: 50%;
688
- left: 50%;
689
- transform: translate(-50%, -50%);
690
- z-index: 3;
691
- }
692
-
693
- .replace-tokens-button-container {
694
- display: flex;
695
- justify-content: center;
696
- align-items: center;
697
- position: absolute;
698
- top: 50%;
699
- left: 50%;
700
- transform: translate(-50%, -50%);
701
- gap: ${({ spacing }) => spacing["2"]};
702
- border-radius: ${({ borderRadius }) => borderRadius["4"]};
703
- background-color: ${({ tokens }) => tokens.theme.backgroundPrimary};
704
- padding: ${({ spacing }) => spacing["2"]};
705
- }
706
-
707
- .details-container > wui-flex {
708
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
709
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
710
- width: 100%;
711
- }
712
-
713
- .details-container > wui-flex > button {
714
- border: none;
715
- background: none;
716
- padding: ${({ spacing }) => spacing["3"]};
717
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
718
- transition: background ${({ durations }) => durations["lg"]}
719
- ${({ easings }) => easings["ease-out-power-2"]};
720
- will-change: background;
721
- }
722
-
723
- .details-container > wui-flex > button:hover {
724
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
725
- }
726
-
727
- .details-content-container {
728
- padding: ${({ spacing }) => spacing["2"]};
729
- display: flex;
730
- align-items: center;
731
- justify-content: center;
732
- }
733
-
734
- .details-content-container > wui-flex {
735
- width: 100%;
736
- }
737
-
738
- .details-row {
739
- width: 100%;
740
- padding: ${({ spacing }) => spacing["3"]} ${({ spacing }) => spacing["5"]};
741
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
742
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
743
- }
744
- `;
745
- var __decorate$4 = function(decorators, target, key, desc) {
746
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
747
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
748
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
749
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
750
- };
751
- let W3mSwapView = class W3mSwapView2 extends i {
752
- subscribe({ resetSwapState, initializeSwapState }) {
753
- return () => {
754
- ChainController.subscribeKey("activeCaipNetwork", (newCaipNetwork) => this.onCaipNetworkChange({
755
- newCaipNetwork,
756
- resetSwapState,
757
- initializeSwapState
758
- }));
759
- ChainController.subscribeChainProp("accountState", (val) => {
760
- this.onCaipAddressChange({
761
- newCaipAddress: val == null ? void 0 : val.caipAddress,
762
- resetSwapState,
763
- initializeSwapState
764
- });
765
- });
766
- };
767
- }
768
- constructor() {
769
- var _a, _b, _c;
770
- super();
771
- this.unsubscribe = [];
772
- this.initialParams = (_a = RouterController.state.data) == null ? void 0 : _a.swap;
773
- this.detailsOpen = false;
774
- this.caipAddress = (_b = ChainController.getAccountData()) == null ? void 0 : _b.caipAddress;
775
- this.caipNetworkId = (_c = ChainController.state.activeCaipNetwork) == null ? void 0 : _c.caipNetworkId;
776
- this.initialized = SwapController.state.initialized;
777
- this.loadingQuote = SwapController.state.loadingQuote;
778
- this.loadingPrices = SwapController.state.loadingPrices;
779
- this.loadingTransaction = SwapController.state.loadingTransaction;
780
- this.sourceToken = SwapController.state.sourceToken;
781
- this.sourceTokenAmount = SwapController.state.sourceTokenAmount;
782
- this.sourceTokenPriceInUSD = SwapController.state.sourceTokenPriceInUSD;
783
- this.toToken = SwapController.state.toToken;
784
- this.toTokenAmount = SwapController.state.toTokenAmount;
785
- this.toTokenPriceInUSD = SwapController.state.toTokenPriceInUSD;
786
- this.inputError = SwapController.state.inputError;
787
- this.fetchError = SwapController.state.fetchError;
788
- this.lastTokenPriceUpdate = 0;
789
- this.minTokenPriceUpdateInterval = 1e4;
790
- this.visibilityChangeHandler = () => {
791
- if (document == null ? void 0 : document.hidden) {
792
- clearInterval(this.interval);
793
- this.interval = void 0;
794
- } else {
795
- this.startTokenPriceInterval();
796
- }
797
- };
798
- this.startTokenPriceInterval = () => {
799
- if (this.interval && Date.now() - this.lastTokenPriceUpdate < this.minTokenPriceUpdateInterval) {
800
- return;
801
- }
802
- if (this.lastTokenPriceUpdate && Date.now() - this.lastTokenPriceUpdate > this.minTokenPriceUpdateInterval) {
803
- this.fetchTokensAndValues();
804
- }
805
- clearInterval(this.interval);
806
- this.interval = setInterval(() => {
807
- this.fetchTokensAndValues();
808
- }, this.minTokenPriceUpdateInterval);
809
- };
810
- this.watchTokensAndValues = () => {
811
- if (!this.sourceToken || !this.toToken) {
812
- return;
813
- }
814
- this.subscribeToVisibilityChange();
815
- this.startTokenPriceInterval();
816
- };
817
- this.onDebouncedGetSwapCalldata = CoreHelperUtil.debounce(async () => {
818
- await SwapController.swapTokens();
819
- }, 200);
820
- this.subscribe({ resetSwapState: true, initializeSwapState: false })();
821
- this.unsubscribe.push(...[
822
- this.subscribe({ resetSwapState: false, initializeSwapState: true }),
823
- ModalController.subscribeKey("open", (isOpen) => {
824
- if (!isOpen) {
825
- SwapController.resetState();
826
- }
827
- }),
828
- RouterController.subscribeKey("view", (newRoute) => {
829
- if (!newRoute.includes("Swap")) {
830
- SwapController.resetValues();
831
- }
832
- }),
833
- SwapController.subscribe((newState) => {
834
- this.initialized = newState.initialized;
835
- this.loadingQuote = newState.loadingQuote;
836
- this.loadingPrices = newState.loadingPrices;
837
- this.loadingTransaction = newState.loadingTransaction;
838
- this.sourceToken = newState.sourceToken;
839
- this.sourceTokenAmount = newState.sourceTokenAmount;
840
- this.sourceTokenPriceInUSD = newState.sourceTokenPriceInUSD;
841
- this.toToken = newState.toToken;
842
- this.toTokenAmount = newState.toTokenAmount;
843
- this.toTokenPriceInUSD = newState.toTokenPriceInUSD;
844
- this.inputError = newState.inputError;
845
- this.fetchError = newState.fetchError;
846
- if (newState.sourceToken && newState.toToken) {
847
- this.watchTokensAndValues();
848
- }
849
- })
850
- ]);
851
- }
852
- async firstUpdated() {
853
- SwapController.initializeState();
854
- this.watchTokensAndValues();
855
- await this.handleSwapParameters();
856
- }
857
- disconnectedCallback() {
858
- this.unsubscribe.forEach((unsubscribe) => unsubscribe == null ? void 0 : unsubscribe());
859
- clearInterval(this.interval);
860
- document == null ? void 0 : document.removeEventListener("visibilitychange", this.visibilityChangeHandler);
861
- }
862
- render() {
863
- return x`
864
- <wui-flex flexDirection="column" .padding=${["0", "4", "4", "4"]} gap="3">
865
- ${this.initialized ? this.templateSwap() : this.templateLoading()}
866
- </wui-flex>
867
- `;
868
- }
869
- subscribeToVisibilityChange() {
870
- document == null ? void 0 : document.removeEventListener("visibilitychange", this.visibilityChangeHandler);
871
- document == null ? void 0 : document.addEventListener("visibilitychange", this.visibilityChangeHandler);
872
- }
873
- fetchTokensAndValues() {
874
- SwapController.getNetworkTokenPrice();
875
- SwapController.getMyTokensWithBalance();
876
- SwapController.swapTokens();
877
- this.lastTokenPriceUpdate = Date.now();
878
- }
879
- templateSwap() {
880
- return x`
881
- <wui-flex flexDirection="column" gap="3">
882
- <wui-flex flexDirection="column" alignItems="center" gap="2" class="swap-inputs-container">
883
- ${this.templateTokenInput("sourceToken", this.sourceToken)}
884
- ${this.templateTokenInput("toToken", this.toToken)} ${this.templateReplaceTokensButton()}
885
- </wui-flex>
886
- ${this.templateDetails()} ${this.templateActionButton()}
887
- </wui-flex>
888
- `;
889
- }
890
- actionButtonLabel() {
891
- const haveNoAmount = !this.sourceTokenAmount || this.sourceTokenAmount === "0";
892
- if (this.fetchError) {
893
- return "Swap";
894
- }
895
- if (!this.sourceToken || !this.toToken) {
896
- return "Select token";
897
- }
898
- if (haveNoAmount) {
899
- return "Enter amount";
900
- }
901
- if (this.inputError) {
902
- return this.inputError;
903
- }
904
- return "Review swap";
905
- }
906
- templateReplaceTokensButton() {
907
- return x`
908
- <wui-flex class="replace-tokens-button-container">
909
- <wui-icon-box
910
- @click=${this.onSwitchTokens.bind(this)}
911
- icon="recycleHorizontal"
912
- size="md"
913
- variant="default"
914
- ></wui-icon-box>
915
- </wui-flex>
916
- `;
917
- }
918
- templateLoading() {
919
- return x`
920
- <wui-flex flexDirection="column" gap="4">
921
- <wui-flex flexDirection="column" alignItems="center" gap="2" class="swap-inputs-container">
922
- <w3m-swap-input-skeleton target="sourceToken"></w3m-swap-input-skeleton>
923
- <w3m-swap-input-skeleton target="toToken"></w3m-swap-input-skeleton>
924
- ${this.templateReplaceTokensButton()}
925
- </wui-flex>
926
- ${this.templateActionButton()}
927
- </wui-flex>
928
- `;
929
- }
930
- templateTokenInput(target, token) {
931
- var _a, _b;
932
- const myToken = (_a = SwapController.state.myTokensWithBalance) == null ? void 0 : _a.find((ct) => (ct == null ? void 0 : ct.address) === (token == null ? void 0 : token.address));
933
- const amount = target === "toToken" ? this.toTokenAmount : this.sourceTokenAmount;
934
- const price = target === "toToken" ? this.toTokenPriceInUSD : this.sourceTokenPriceInUSD;
935
- const marketValue = NumberUtil.parseLocalStringToNumber(amount) * price;
936
- return x`<w3m-swap-input
937
- .value=${target === "toToken" ? this.toTokenAmount : this.sourceTokenAmount}
938
- .disabled=${target === "toToken"}
939
- .onSetAmount=${this.handleChangeAmount.bind(this)}
940
- target=${target}
941
- .token=${token}
942
- .balance=${(_b = myToken == null ? void 0 : myToken.quantity) == null ? void 0 : _b.numeric}
943
- .price=${myToken == null ? void 0 : myToken.price}
944
- .marketValue=${marketValue}
945
- .onSetMaxValue=${this.onSetMaxValue.bind(this)}
946
- ></w3m-swap-input>`;
947
- }
948
- onSetMaxValue(target, balance) {
949
- const maxValue = NumberUtil.bigNumber(balance || "0");
950
- this.handleChangeAmount(target, maxValue.gt(0) ? maxValue.toFixed(20) : "0");
951
- }
952
- templateDetails() {
953
- if (!this.sourceToken || !this.toToken || this.inputError) {
954
- return null;
955
- }
956
- return x`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`;
957
- }
958
- handleChangeAmount(target, value) {
959
- SwapController.clearError();
960
- if (target === "sourceToken") {
961
- SwapController.setSourceTokenAmount(value);
962
- } else {
963
- SwapController.setToTokenAmount(value);
964
- }
965
- this.onDebouncedGetSwapCalldata();
966
- }
967
- templateActionButton() {
968
- const haveNoTokenSelected = !this.toToken || !this.sourceToken;
969
- const haveNoAmount = !this.sourceTokenAmount || this.sourceTokenAmount === "0";
970
- const loading = this.loadingQuote || this.loadingPrices || this.loadingTransaction;
971
- const disabled = loading || haveNoTokenSelected || haveNoAmount || this.inputError;
972
- return x` <wui-flex gap="2">
973
- <wui-button
974
- data-testid="swap-action-button"
975
- class="action-button"
976
- fullWidth
977
- size="lg"
978
- borderRadius="xs"
979
- variant="accent-primary"
980
- ?loading=${Boolean(loading)}
981
- ?disabled=${Boolean(disabled)}
982
- @click=${this.onSwapPreview.bind(this)}
983
- >
984
- ${this.actionButtonLabel()}
985
- </wui-button>
986
- </wui-flex>`;
987
- }
988
- async onSwitchTokens() {
989
- await SwapController.switchTokens();
990
- }
991
- async onSwapPreview() {
992
- var _a, _b;
993
- if (this.fetchError) {
994
- await SwapController.swapTokens();
995
- }
996
- EventsController.sendEvent({
997
- type: "track",
998
- event: "INITIATE_SWAP",
999
- properties: {
1000
- network: this.caipNetworkId || "",
1001
- swapFromToken: ((_a = this.sourceToken) == null ? void 0 : _a.symbol) || "",
1002
- swapToToken: ((_b = this.toToken) == null ? void 0 : _b.symbol) || "",
1003
- swapFromAmount: this.sourceTokenAmount || "",
1004
- swapToAmount: this.toTokenAmount || "",
1005
- isSmartAccount: getPreferredAccountType(ChainController.state.activeChain) === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT
1006
- }
1007
- });
1008
- RouterController.push("SwapPreview");
1009
- }
1010
- async handleSwapParameters() {
1011
- if (!this.initialParams) {
1012
- return;
1013
- }
1014
- if (!SwapController.state.initialized) {
1015
- const waitForInitialization = new Promise((resolve) => {
1016
- const unsubscribe = SwapController.subscribeKey("initialized", (initialized) => {
1017
- if (initialized) {
1018
- unsubscribe == null ? void 0 : unsubscribe();
1019
- resolve();
1020
- }
1021
- });
1022
- });
1023
- await waitForInitialization;
1024
- }
1025
- await this.setSwapParameters(this.initialParams);
1026
- }
1027
- async setSwapParameters({ amount, fromToken, toToken }) {
1028
- if (!SwapController.state.tokens || !SwapController.state.myTokensWithBalance) {
1029
- const waitForTokens = new Promise((resolve) => {
1030
- const unsubscribe = SwapController.subscribeKey("myTokensWithBalance", (tokens) => {
1031
- if (tokens && tokens.length > 0) {
1032
- unsubscribe == null ? void 0 : unsubscribe();
1033
- resolve();
1034
- }
1035
- });
1036
- setTimeout(() => {
1037
- unsubscribe == null ? void 0 : unsubscribe();
1038
- resolve();
1039
- }, 5e3);
1040
- });
1041
- await waitForTokens;
1042
- }
1043
- const allTokens = [
1044
- ...SwapController.state.tokens || [],
1045
- ...SwapController.state.myTokensWithBalance || []
1046
- ];
1047
- if (fromToken) {
1048
- const token = allTokens.find((t) => t.symbol.toLowerCase() === fromToken.toLowerCase());
1049
- if (token) {
1050
- SwapController.setSourceToken(token);
1051
- }
1052
- }
1053
- if (toToken) {
1054
- const token = allTokens.find((t) => t.symbol.toLowerCase() === toToken.toLowerCase());
1055
- if (token) {
1056
- SwapController.setToToken(token);
1057
- }
1058
- }
1059
- if (amount && !isNaN(Number(amount))) {
1060
- SwapController.setSourceTokenAmount(amount);
1061
- }
1062
- }
1063
- onCaipAddressChange({ newCaipAddress, resetSwapState, initializeSwapState }) {
1064
- if (this.caipAddress !== newCaipAddress) {
1065
- this.caipAddress = newCaipAddress;
1066
- if (resetSwapState) {
1067
- SwapController.resetState();
1068
- }
1069
- if (initializeSwapState) {
1070
- SwapController.initializeState();
1071
- }
1072
- }
1073
- }
1074
- onCaipNetworkChange({ newCaipNetwork, resetSwapState, initializeSwapState }) {
1075
- if (this.caipNetworkId !== (newCaipNetwork == null ? void 0 : newCaipNetwork.caipNetworkId)) {
1076
- this.caipNetworkId = newCaipNetwork == null ? void 0 : newCaipNetwork.caipNetworkId;
1077
- if (resetSwapState) {
1078
- SwapController.resetState();
1079
- }
1080
- if (initializeSwapState) {
1081
- SwapController.initializeState();
1082
- }
1083
- }
1084
- }
1085
- };
1086
- W3mSwapView.styles = styles$4;
1087
- __decorate$4([
1088
- n({ type: Object })
1089
- ], W3mSwapView.prototype, "initialParams", void 0);
1090
- __decorate$4([
1091
- r()
1092
- ], W3mSwapView.prototype, "interval", void 0);
1093
- __decorate$4([
1094
- r()
1095
- ], W3mSwapView.prototype, "detailsOpen", void 0);
1096
- __decorate$4([
1097
- r()
1098
- ], W3mSwapView.prototype, "caipAddress", void 0);
1099
- __decorate$4([
1100
- r()
1101
- ], W3mSwapView.prototype, "caipNetworkId", void 0);
1102
- __decorate$4([
1103
- r()
1104
- ], W3mSwapView.prototype, "initialized", void 0);
1105
- __decorate$4([
1106
- r()
1107
- ], W3mSwapView.prototype, "loadingQuote", void 0);
1108
- __decorate$4([
1109
- r()
1110
- ], W3mSwapView.prototype, "loadingPrices", void 0);
1111
- __decorate$4([
1112
- r()
1113
- ], W3mSwapView.prototype, "loadingTransaction", void 0);
1114
- __decorate$4([
1115
- r()
1116
- ], W3mSwapView.prototype, "sourceToken", void 0);
1117
- __decorate$4([
1118
- r()
1119
- ], W3mSwapView.prototype, "sourceTokenAmount", void 0);
1120
- __decorate$4([
1121
- r()
1122
- ], W3mSwapView.prototype, "sourceTokenPriceInUSD", void 0);
1123
- __decorate$4([
1124
- r()
1125
- ], W3mSwapView.prototype, "toToken", void 0);
1126
- __decorate$4([
1127
- r()
1128
- ], W3mSwapView.prototype, "toTokenAmount", void 0);
1129
- __decorate$4([
1130
- r()
1131
- ], W3mSwapView.prototype, "toTokenPriceInUSD", void 0);
1132
- __decorate$4([
1133
- r()
1134
- ], W3mSwapView.prototype, "inputError", void 0);
1135
- __decorate$4([
1136
- r()
1137
- ], W3mSwapView.prototype, "fetchError", void 0);
1138
- __decorate$4([
1139
- r()
1140
- ], W3mSwapView.prototype, "lastTokenPriceUpdate", void 0);
1141
- W3mSwapView = __decorate$4([
1142
- customElement("w3m-swap-view")
1143
- ], W3mSwapView);
1144
- const styles$3 = css`
1145
- :host > wui-flex:first-child {
1146
- overflow-y: auto;
1147
- overflow-x: hidden;
1148
- scrollbar-width: none;
1149
- }
1150
-
1151
- :host > wui-flex:first-child::-webkit-scrollbar {
1152
- display: none;
1153
- }
1154
-
1155
- .preview-container,
1156
- .details-container {
1157
- width: 100%;
1158
- }
1159
-
1160
- .token-image {
1161
- width: 24px;
1162
- height: 24px;
1163
- box-shadow: 0 0 0 2px ${({ tokens }) => tokens.core.glass010};
1164
- border-radius: 12px;
1165
- }
1166
-
1167
- wui-loading-hexagon {
1168
- position: absolute;
1169
- }
1170
-
1171
- .token-item {
1172
- display: flex;
1173
- align-items: center;
1174
- justify-content: center;
1175
- gap: ${({ spacing }) => spacing["2"]};
1176
- padding: ${({ spacing }) => spacing["2"]};
1177
- height: 40px;
1178
- border: none;
1179
- border-radius: 80px;
1180
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1181
- box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.theme.foregroundPrimary};
1182
- cursor: pointer;
1183
- transition: background ${({ durations }) => durations["lg"]}
1184
- ${({ easings }) => easings["ease-out-power-2"]};
1185
- will-change: background;
1186
- }
1187
-
1188
- .token-item:hover {
1189
- background: ${({ tokens }) => tokens.core.glass010};
1190
- }
1191
-
1192
- .preview-token-details-container {
1193
- width: 100%;
1194
- }
1195
-
1196
- .details-row {
1197
- width: 100%;
1198
- padding: ${({ spacing }) => spacing["3"]} ${({ spacing }) => spacing["5"]};
1199
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
1200
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1201
- }
1202
-
1203
- .action-buttons-container {
1204
- width: 100%;
1205
- gap: ${({ spacing }) => spacing["2"]};
1206
- }
1207
-
1208
- .action-buttons-container > button {
1209
- display: flex;
1210
- align-items: center;
1211
- justify-content: center;
1212
- background: transparent;
1213
- height: 48px;
1214
- border-radius: ${({ borderRadius }) => borderRadius["4"]};
1215
- border: none;
1216
- box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1217
- }
1218
-
1219
- .action-buttons-container > button:disabled {
1220
- opacity: 0.8;
1221
- cursor: not-allowed;
1222
- }
1223
-
1224
- .action-button > wui-loading-spinner {
1225
- display: inline-block;
1226
- }
1227
-
1228
- .cancel-button:hover,
1229
- .action-button:hover {
1230
- cursor: pointer;
1231
- }
1232
-
1233
- .action-buttons-container > wui-button.cancel-button {
1234
- flex: 2;
1235
- }
1236
-
1237
- .action-buttons-container > wui-button.action-button {
1238
- flex: 4;
1239
- }
1240
-
1241
- .action-buttons-container > button.action-button > wui-text {
1242
- color: white;
1243
- }
1244
-
1245
- .details-container > wui-flex {
1246
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1247
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
1248
- width: 100%;
1249
- }
1250
-
1251
- .details-container > wui-flex > button {
1252
- border: none;
1253
- background: none;
1254
- padding: ${({ spacing }) => spacing["3"]};
1255
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
1256
- transition: background ${({ durations }) => durations["lg"]}
1257
- ${({ easings }) => easings["ease-out-power-2"]};
1258
- will-change: background;
1259
- }
1260
-
1261
- .details-container > wui-flex > button:hover {
1262
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1263
- }
1264
-
1265
- .details-content-container {
1266
- padding: ${({ spacing }) => spacing["2"]};
1267
- display: flex;
1268
- align-items: center;
1269
- justify-content: center;
1270
- }
1271
-
1272
- .details-content-container > wui-flex {
1273
- width: 100%;
1274
- }
1275
-
1276
- .details-row {
1277
- width: 100%;
1278
- padding: ${({ spacing }) => spacing["3"]} ${({ spacing }) => spacing["5"]};
1279
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
1280
- background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1281
- }
1282
- `;
1283
- var __decorate$3 = function(decorators, target, key, desc) {
1284
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1285
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1286
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1287
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1288
- };
1289
- let W3mSwapPreviewView = class W3mSwapPreviewView2 extends i {
1290
- constructor() {
1291
- var _a;
1292
- super();
1293
- this.unsubscribe = [];
1294
- this.detailsOpen = true;
1295
- this.approvalTransaction = SwapController.state.approvalTransaction;
1296
- this.swapTransaction = SwapController.state.swapTransaction;
1297
- this.sourceToken = SwapController.state.sourceToken;
1298
- this.sourceTokenAmount = SwapController.state.sourceTokenAmount ?? "";
1299
- this.sourceTokenPriceInUSD = SwapController.state.sourceTokenPriceInUSD;
1300
- this.balanceSymbol = (_a = ChainController.getAccountData()) == null ? void 0 : _a.balanceSymbol;
1301
- this.toToken = SwapController.state.toToken;
1302
- this.toTokenAmount = SwapController.state.toTokenAmount ?? "";
1303
- this.toTokenPriceInUSD = SwapController.state.toTokenPriceInUSD;
1304
- this.caipNetwork = ChainController.state.activeCaipNetwork;
1305
- this.inputError = SwapController.state.inputError;
1306
- this.loadingQuote = SwapController.state.loadingQuote;
1307
- this.loadingApprovalTransaction = SwapController.state.loadingApprovalTransaction;
1308
- this.loadingBuildTransaction = SwapController.state.loadingBuildTransaction;
1309
- this.loadingTransaction = SwapController.state.loadingTransaction;
1310
- this.unsubscribe.push(...[
1311
- ChainController.subscribeChainProp("accountState", (val) => {
1312
- if ((val == null ? void 0 : val.balanceSymbol) !== this.balanceSymbol) {
1313
- RouterController.goBack();
1314
- }
1315
- }),
1316
- ChainController.subscribeKey("activeCaipNetwork", (newCaipNetwork) => {
1317
- if (this.caipNetwork !== newCaipNetwork) {
1318
- this.caipNetwork = newCaipNetwork;
1319
- }
1320
- }),
1321
- SwapController.subscribe((newState) => {
1322
- this.approvalTransaction = newState.approvalTransaction;
1323
- this.swapTransaction = newState.swapTransaction;
1324
- this.sourceToken = newState.sourceToken;
1325
- this.toToken = newState.toToken;
1326
- this.toTokenPriceInUSD = newState.toTokenPriceInUSD;
1327
- this.sourceTokenAmount = newState.sourceTokenAmount ?? "";
1328
- this.toTokenAmount = newState.toTokenAmount ?? "";
1329
- this.inputError = newState.inputError;
1330
- if (newState.inputError) {
1331
- RouterController.goBack();
1332
- }
1333
- this.loadingQuote = newState.loadingQuote;
1334
- this.loadingApprovalTransaction = newState.loadingApprovalTransaction;
1335
- this.loadingBuildTransaction = newState.loadingBuildTransaction;
1336
- this.loadingTransaction = newState.loadingTransaction;
1337
- })
1338
- ]);
1339
- }
1340
- firstUpdated() {
1341
- SwapController.getTransaction();
1342
- this.refreshTransaction();
1343
- }
1344
- disconnectedCallback() {
1345
- this.unsubscribe.forEach((unsubscribe) => unsubscribe == null ? void 0 : unsubscribe());
1346
- clearInterval(this.interval);
1347
- }
1348
- render() {
1349
- return x`
1350
- <wui-flex flexDirection="column" .padding=${["0", "4", "4", "4"]} gap="3">
1351
- ${this.templateSwap()}
1352
- </wui-flex>
1353
- `;
1354
- }
1355
- refreshTransaction() {
1356
- this.interval = setInterval(() => {
1357
- if (!SwapController.getApprovalLoadingState()) {
1358
- SwapController.getTransaction();
1359
- }
1360
- }, 1e4);
1361
- }
1362
- templateSwap() {
1363
- var _a, _b, _c, _d;
1364
- const sourceTokenText = `${NumberUtil.formatNumberToLocalString(parseFloat(this.sourceTokenAmount))} ${(_a = this.sourceToken) == null ? void 0 : _a.symbol}`;
1365
- const toTokenText = `${NumberUtil.formatNumberToLocalString(parseFloat(this.toTokenAmount))} ${(_b = this.toToken) == null ? void 0 : _b.symbol}`;
1366
- const sourceTokenValue = parseFloat(this.sourceTokenAmount) * this.sourceTokenPriceInUSD;
1367
- const toTokenValue = parseFloat(this.toTokenAmount) * this.toTokenPriceInUSD;
1368
- const sentPrice = NumberUtil.formatNumberToLocalString(sourceTokenValue);
1369
- const receivePrice = NumberUtil.formatNumberToLocalString(toTokenValue);
1370
- const loading = this.loadingQuote || this.loadingBuildTransaction || this.loadingTransaction || this.loadingApprovalTransaction;
1371
- return x`
1372
- <wui-flex flexDirection="column" alignItems="center" gap="4">
1373
- <wui-flex class="preview-container" flexDirection="column" alignItems="flex-start" gap="4">
1374
- <wui-flex
1375
- class="preview-token-details-container"
1376
- alignItems="center"
1377
- justifyContent="space-between"
1378
- gap="4"
1379
- >
1380
- <wui-flex flexDirection="column" alignItems="flex-start" gap="01">
1381
- <wui-text variant="sm-regular" color="secondary">Send</wui-text>
1382
- <wui-text variant="md-regular" color="primary">$${sentPrice}</wui-text>
1383
- </wui-flex>
1384
- <wui-token-button
1385
- flexDirection="row-reverse"
1386
- text=${sourceTokenText}
1387
- imageSrc=${(_c = this.sourceToken) == null ? void 0 : _c.logoUri}
1388
- >
1389
- </wui-token-button>
1390
- </wui-flex>
1391
- <wui-icon name="recycleHorizontal" color="default" size="md"></wui-icon>
1392
- <wui-flex
1393
- class="preview-token-details-container"
1394
- alignItems="center"
1395
- justifyContent="space-between"
1396
- gap="4"
1397
- >
1398
- <wui-flex flexDirection="column" alignItems="flex-start" gap="01">
1399
- <wui-text variant="sm-regular" color="secondary">Receive</wui-text>
1400
- <wui-text variant="md-regular" color="primary">$${receivePrice}</wui-text>
1401
- </wui-flex>
1402
- <wui-token-button
1403
- flexDirection="row-reverse"
1404
- text=${toTokenText}
1405
- imageSrc=${(_d = this.toToken) == null ? void 0 : _d.logoUri}
1406
- >
1407
- </wui-token-button>
1408
- </wui-flex>
1409
- </wui-flex>
1410
-
1411
- ${this.templateDetails()}
1412
-
1413
- <wui-flex flexDirection="row" alignItems="center" justifyContent="center" gap="2">
1414
- <wui-icon size="sm" color="default" name="info"></wui-icon>
1415
- <wui-text variant="sm-regular" color="secondary">Review transaction carefully</wui-text>
1416
- </wui-flex>
1417
-
1418
- <wui-flex
1419
- class="action-buttons-container"
1420
- flexDirection="row"
1421
- alignItems="center"
1422
- justifyContent="space-between"
1423
- gap="2"
1424
- >
1425
- <wui-button
1426
- class="cancel-button"
1427
- fullWidth
1428
- size="lg"
1429
- borderRadius="xs"
1430
- variant="neutral-secondary"
1431
- @click=${this.onCancelTransaction.bind(this)}
1432
- >
1433
- <wui-text variant="md-medium" color="secondary">Cancel</wui-text>
1434
- </wui-button>
1435
- <wui-button
1436
- class="action-button"
1437
- fullWidth
1438
- size="lg"
1439
- borderRadius="xs"
1440
- variant="accent-primary"
1441
- ?loading=${loading}
1442
- ?disabled=${loading}
1443
- @click=${this.onSendTransaction.bind(this)}
1444
- >
1445
- <wui-text variant="md-medium" color="invert"> ${this.actionButtonLabel()} </wui-text>
1446
- </wui-button>
1447
- </wui-flex>
1448
- </wui-flex>
1449
- `;
1450
- }
1451
- templateDetails() {
1452
- if (!this.sourceToken || !this.toToken || this.inputError) {
1453
- return null;
1454
- }
1455
- return x`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`;
1456
- }
1457
- actionButtonLabel() {
1458
- if (this.loadingApprovalTransaction) {
1459
- return "Approving...";
1460
- }
1461
- if (this.approvalTransaction) {
1462
- return "Approve";
1463
- }
1464
- return "Swap";
1465
- }
1466
- onCancelTransaction() {
1467
- RouterController.goBack();
1468
- }
1469
- onSendTransaction() {
1470
- if (this.approvalTransaction) {
1471
- SwapController.sendTransactionForApproval(this.approvalTransaction);
1472
- } else {
1473
- SwapController.sendTransactionForSwap(this.swapTransaction);
1474
- }
1475
- }
1476
- };
1477
- W3mSwapPreviewView.styles = styles$3;
1478
- __decorate$3([
1479
- r()
1480
- ], W3mSwapPreviewView.prototype, "interval", void 0);
1481
- __decorate$3([
1482
- r()
1483
- ], W3mSwapPreviewView.prototype, "detailsOpen", void 0);
1484
- __decorate$3([
1485
- r()
1486
- ], W3mSwapPreviewView.prototype, "approvalTransaction", void 0);
1487
- __decorate$3([
1488
- r()
1489
- ], W3mSwapPreviewView.prototype, "swapTransaction", void 0);
1490
- __decorate$3([
1491
- r()
1492
- ], W3mSwapPreviewView.prototype, "sourceToken", void 0);
1493
- __decorate$3([
1494
- r()
1495
- ], W3mSwapPreviewView.prototype, "sourceTokenAmount", void 0);
1496
- __decorate$3([
1497
- r()
1498
- ], W3mSwapPreviewView.prototype, "sourceTokenPriceInUSD", void 0);
1499
- __decorate$3([
1500
- r()
1501
- ], W3mSwapPreviewView.prototype, "balanceSymbol", void 0);
1502
- __decorate$3([
1503
- r()
1504
- ], W3mSwapPreviewView.prototype, "toToken", void 0);
1505
- __decorate$3([
1506
- r()
1507
- ], W3mSwapPreviewView.prototype, "toTokenAmount", void 0);
1508
- __decorate$3([
1509
- r()
1510
- ], W3mSwapPreviewView.prototype, "toTokenPriceInUSD", void 0);
1511
- __decorate$3([
1512
- r()
1513
- ], W3mSwapPreviewView.prototype, "caipNetwork", void 0);
1514
- __decorate$3([
1515
- r()
1516
- ], W3mSwapPreviewView.prototype, "inputError", void 0);
1517
- __decorate$3([
1518
- r()
1519
- ], W3mSwapPreviewView.prototype, "loadingQuote", void 0);
1520
- __decorate$3([
1521
- r()
1522
- ], W3mSwapPreviewView.prototype, "loadingApprovalTransaction", void 0);
1523
- __decorate$3([
1524
- r()
1525
- ], W3mSwapPreviewView.prototype, "loadingBuildTransaction", void 0);
1526
- __decorate$3([
1527
- r()
1528
- ], W3mSwapPreviewView.prototype, "loadingTransaction", void 0);
1529
- W3mSwapPreviewView = __decorate$3([
1530
- customElement("w3m-swap-preview-view")
1531
- ], W3mSwapPreviewView);
1532
- const styles$2 = css`
1533
- :host {
1534
- width: 100%;
1535
- height: 60px;
1536
- min-height: 60px;
1537
- }
1538
-
1539
- :host > wui-flex {
1540
- cursor: pointer;
1541
- height: 100%;
1542
- display: flex;
1543
- column-gap: ${({ spacing }) => spacing["3"]};
1544
- padding: ${({ spacing }) => spacing["2"]};
1545
- padding-right: ${({ spacing }) => spacing["4"]};
1546
- width: 100%;
1547
- background-color: transparent;
1548
- border-radius: ${({ borderRadius }) => borderRadius["4"]};
1549
- color: ${({ tokens }) => tokens.theme.foregroundSecondary};
1550
- transition:
1551
- background-color ${({ durations }) => durations["lg"]}
1552
- ${({ easings }) => easings["ease-out-power-2"]},
1553
- opacity ${({ durations }) => durations["lg"]} ${({ easings }) => easings["ease-out-power-2"]};
1554
- will-change: background-color, opacity;
1555
- }
1556
-
1557
- @media (hover: hover) and (pointer: fine) {
1558
- :host > wui-flex:hover {
1559
- background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
1560
- }
1561
-
1562
- :host > wui-flex:active {
1563
- background-color: ${({ tokens }) => tokens.core.glass010};
1564
- }
1565
- }
1566
-
1567
- :host([disabled]) > wui-flex {
1568
- opacity: 0.6;
1569
- }
1570
-
1571
- :host([disabled]) > wui-flex:hover {
1572
- background-color: transparent;
1573
- }
1574
-
1575
- :host > wui-flex > wui-flex {
1576
- flex: 1;
1577
- }
1578
-
1579
- :host > wui-flex > wui-image,
1580
- :host > wui-flex > .token-item-image-placeholder {
1581
- width: 40px;
1582
- max-width: 40px;
1583
- height: 40px;
1584
- border-radius: ${({ borderRadius }) => borderRadius["20"]};
1585
- position: relative;
1586
- }
1587
-
1588
- :host > wui-flex > .token-item-image-placeholder {
1589
- display: flex;
1590
- align-items: center;
1591
- justify-content: center;
1592
- }
1593
-
1594
- :host > wui-flex > wui-image::after,
1595
- :host > wui-flex > .token-item-image-placeholder::after {
1596
- position: absolute;
1597
- content: '';
1598
- inset: 0;
1599
- box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1600
- border-radius: ${({ borderRadius }) => borderRadius["8"]};
1601
- }
1602
-
1603
- button > wui-icon-box[data-variant='square-blue'] {
1604
- border-radius: ${({ borderRadius }) => borderRadius["2"]};
1605
- position: relative;
1606
- border: none;
1607
- width: 36px;
1608
- height: 36px;
1609
- }
1610
- `;
1611
- var __decorate$2 = function(decorators, target, key, desc) {
1612
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1613
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1614
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1615
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1616
- };
1617
- let WuiTokenListItem = class WuiTokenListItem2 extends i {
1618
- constructor() {
1619
- super();
1620
- this.observer = new IntersectionObserver(() => void 0);
1621
- this.imageSrc = void 0;
1622
- this.name = void 0;
1623
- this.symbol = void 0;
1624
- this.price = void 0;
1625
- this.amount = void 0;
1626
- this.visible = false;
1627
- this.imageError = false;
1628
- this.observer = new IntersectionObserver((entries) => {
1629
- entries.forEach((entry) => {
1630
- if (entry.isIntersecting) {
1631
- this.visible = true;
1632
- } else {
1633
- this.visible = false;
1634
- }
1635
- });
1636
- }, { threshold: 0.1 });
1637
- }
1638
- firstUpdated() {
1639
- this.observer.observe(this);
1640
- }
1641
- disconnectedCallback() {
1642
- this.observer.disconnect();
1643
- }
1644
- render() {
1645
- var _a;
1646
- if (!this.visible) {
1647
- return null;
1648
- }
1649
- const value = this.amount && this.price ? (_a = NumberUtil.multiply(this.price, this.amount)) == null ? void 0 : _a.toFixed(3) : null;
1650
- return x`
1651
- <wui-flex alignItems="center">
1652
- ${this.visualTemplate()}
1653
- <wui-flex flexDirection="column" gap="1">
1654
- <wui-flex justifyContent="space-between">
1655
- <wui-text variant="md-medium" color="primary" lineClamp="1">${this.name}</wui-text>
1656
- ${value ? x`
1657
- <wui-text variant="md-medium" color="primary">
1658
- $${NumberUtil.formatNumberToLocalString(value, 3)}
1659
- </wui-text>
1660
- ` : null}
1661
- </wui-flex>
1662
- <wui-flex justifyContent="space-between">
1663
- <wui-text variant="sm-regular" color="secondary" lineClamp="1">${this.symbol}</wui-text>
1664
- ${this.amount ? x`<wui-text variant="sm-regular" color="secondary">
1665
- ${NumberUtil.formatNumberToLocalString(this.amount, 5)}
1666
- </wui-text>` : null}
1667
- </wui-flex>
1668
- </wui-flex>
1669
- </wui-flex>
1670
- `;
1671
- }
1672
- visualTemplate() {
1673
- if (this.imageError) {
1674
- return x`<wui-flex class="token-item-image-placeholder">
1675
- <wui-icon name="image" color="inherit"></wui-icon>
1676
- </wui-flex>`;
1677
- }
1678
- if (this.imageSrc) {
1679
- return x`<wui-image
1680
- width="40"
1681
- height="40"
1682
- src=${this.imageSrc}
1683
- @onLoadError=${this.imageLoadError}
1684
- ></wui-image>`;
1685
- }
1686
- return null;
1687
- }
1688
- imageLoadError() {
1689
- this.imageError = true;
1690
- }
1691
- };
1692
- WuiTokenListItem.styles = [resetStyles, elementStyles, styles$2];
1693
- __decorate$2([
1694
- n()
1695
- ], WuiTokenListItem.prototype, "imageSrc", void 0);
1696
- __decorate$2([
1697
- n()
1698
- ], WuiTokenListItem.prototype, "name", void 0);
1699
- __decorate$2([
1700
- n()
1701
- ], WuiTokenListItem.prototype, "symbol", void 0);
1702
- __decorate$2([
1703
- n()
1704
- ], WuiTokenListItem.prototype, "price", void 0);
1705
- __decorate$2([
1706
- n()
1707
- ], WuiTokenListItem.prototype, "amount", void 0);
1708
- __decorate$2([
1709
- r()
1710
- ], WuiTokenListItem.prototype, "visible", void 0);
1711
- __decorate$2([
1712
- r()
1713
- ], WuiTokenListItem.prototype, "imageError", void 0);
1714
- WuiTokenListItem = __decorate$2([
1715
- customElement("wui-token-list-item")
1716
- ], WuiTokenListItem);
1717
- const styles$1 = css`
1718
- :host {
1719
- width: 100%;
1720
- }
1721
-
1722
- :host > wui-flex {
1723
- cursor: pointer;
1724
- height: 100%;
1725
- width: 100%;
1726
- display: flex;
1727
- column-gap: ${({ spacing }) => spacing["3"]};
1728
- padding: ${({ spacing }) => spacing["2"]};
1729
- padding-right: ${({ spacing }) => spacing["4"]};
1730
- }
1731
-
1732
- wui-flex {
1733
- display: flex;
1734
- flex: 1;
1735
- }
1736
- `;
1737
- var __decorate$1 = function(decorators, target, key, desc) {
1738
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1739
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1740
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1741
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1742
- };
1743
- let WuiTokenListItemLoader = class WuiTokenListItemLoader2 extends i {
1744
- render() {
1745
- return x`
1746
- <wui-flex alignItems="center">
1747
- <wui-shimmer width="40px" height="40px"></wui-shimmer>
1748
- <wui-flex flexDirection="column" gap="1">
1749
- <wui-shimmer width="72px" height="16px" borderRadius="4xs"></wui-shimmer>
1750
- <wui-shimmer width="148px" height="14px" borderRadius="4xs"></wui-shimmer>
1751
- </wui-flex>
1752
- <wui-flex flexDirection="column" gap="1" alignItems="flex-end">
1753
- <wui-shimmer width="24px" height="12px" borderRadius="4xs"></wui-shimmer>
1754
- <wui-shimmer width="32px" height="12px" borderRadius="4xs"></wui-shimmer>
1755
- </wui-flex>
1756
- </wui-flex>
1757
- `;
1758
- }
1759
- };
1760
- WuiTokenListItemLoader.styles = [resetStyles, styles$1];
1761
- WuiTokenListItemLoader = __decorate$1([
1762
- customElement("wui-token-list-item-loader")
1763
- ], WuiTokenListItemLoader);
1764
- const styles = css`
1765
- :host {
1766
- --tokens-scroll--top-opacity: 0;
1767
- --tokens-scroll--bottom-opacity: 1;
1768
- --suggested-tokens-scroll--left-opacity: 0;
1769
- --suggested-tokens-scroll--right-opacity: 1;
1770
- }
1771
-
1772
- :host > wui-flex:first-child {
1773
- overflow-y: hidden;
1774
- overflow-x: hidden;
1775
- scrollbar-width: none;
1776
- scrollbar-height: none;
1777
- }
1778
-
1779
- :host > wui-flex:first-child::-webkit-scrollbar {
1780
- display: none;
1781
- }
1782
-
1783
- wui-loading-hexagon {
1784
- position: absolute;
1785
- }
1786
-
1787
- .suggested-tokens-container {
1788
- overflow-x: auto;
1789
- mask-image: linear-gradient(
1790
- to right,
1791
- rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 0px,
1792
- rgba(200, 200, 200, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 1px,
1793
- black 50px,
1794
- black 90px,
1795
- black calc(100% - 90px),
1796
- black calc(100% - 50px),
1797
- rgba(155, 155, 155, calc(1 - var(--suggested-tokens-scroll--right-opacity))) calc(100% - 1px),
1798
- rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--right-opacity))) 100%
1799
- );
1800
- }
1801
-
1802
- .suggested-tokens-container::-webkit-scrollbar {
1803
- display: none;
1804
- }
1805
-
1806
- .tokens-container {
1807
- border-top: 1px solid ${({ tokens }) => tokens.core.glass010};
1808
- height: 100%;
1809
- max-height: 390px;
1810
- }
1811
-
1812
- .tokens {
1813
- width: 100%;
1814
- overflow-y: auto;
1815
- mask-image: linear-gradient(
1816
- to bottom,
1817
- rgba(0, 0, 0, calc(1 - var(--tokens-scroll--top-opacity))) 0px,
1818
- rgba(200, 200, 200, calc(1 - var(--tokens-scroll--top-opacity))) 1px,
1819
- black 50px,
1820
- black 90px,
1821
- black calc(100% - 90px),
1822
- black calc(100% - 50px),
1823
- rgba(155, 155, 155, calc(1 - var(--tokens-scroll--bottom-opacity))) calc(100% - 1px),
1824
- rgba(0, 0, 0, calc(1 - var(--tokens-scroll--bottom-opacity))) 100%
1825
- );
1826
- }
1827
-
1828
- .network-search-input,
1829
- .select-network-button {
1830
- height: 40px;
1831
- }
1832
-
1833
- .select-network-button {
1834
- border: none;
1835
- display: flex;
1836
- flex-direction: row;
1837
- align-items: center;
1838
- justify-content: center;
1839
- gap: ${({ spacing }) => spacing["2"]};
1840
- box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1841
- background-color: transparent;
1842
- border-radius: ${({ borderRadius }) => borderRadius["3"]};
1843
- padding: ${({ spacing }) => spacing["2"]};
1844
- align-items: center;
1845
- transition: background-color ${({ durations }) => durations["lg"]}
1846
- ${({ easings }) => easings["ease-out-power-2"]};
1847
- will-change: background-color;
1848
- }
1849
-
1850
- .select-network-button:hover {
1851
- background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
1852
- }
1853
-
1854
- .select-network-button > wui-image {
1855
- width: 26px;
1856
- height: 26px;
1857
- border-radius: ${({ borderRadius }) => borderRadius["4"]};
1858
- box-shadow: inset 0 0 0 1px ${({ tokens }) => tokens.core.glass010};
1859
- }
1860
- `;
1861
- var __decorate = function(decorators, target, key, desc) {
1862
- var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1863
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
1864
- else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
1865
- return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
1866
- };
1867
- let W3mSwapSelectTokenView = class W3mSwapSelectTokenView2 extends i {
1868
- constructor() {
1869
- var _a;
1870
- super();
1871
- this.unsubscribe = [];
1872
- this.targetToken = (_a = RouterController.state.data) == null ? void 0 : _a.target;
1873
- this.sourceToken = SwapController.state.sourceToken;
1874
- this.sourceTokenAmount = SwapController.state.sourceTokenAmount;
1875
- this.toToken = SwapController.state.toToken;
1876
- this.myTokensWithBalance = SwapController.state.myTokensWithBalance;
1877
- this.popularTokens = SwapController.state.popularTokens;
1878
- this.suggestedTokens = SwapController.state.suggestedTokens;
1879
- this.tokensLoading = SwapController.state.tokensLoading;
1880
- this.searchValue = "";
1881
- this.unsubscribe.push(SwapController.subscribe((newState) => {
1882
- this.sourceToken = newState.sourceToken;
1883
- this.toToken = newState.toToken;
1884
- this.myTokensWithBalance = newState.myTokensWithBalance;
1885
- this.popularTokens = newState.popularTokens;
1886
- this.suggestedTokens = newState.suggestedTokens;
1887
- this.tokensLoading = newState.tokensLoading;
1888
- }));
1889
- }
1890
- async firstUpdated() {
1891
- await SwapController.getTokenList();
1892
- }
1893
- updated() {
1894
- var _a, _b;
1895
- const suggestedTokensContainer = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".suggested-tokens-container");
1896
- suggestedTokensContainer == null ? void 0 : suggestedTokensContainer.addEventListener("scroll", this.handleSuggestedTokensScroll.bind(this));
1897
- const tokensList = (_b = this.renderRoot) == null ? void 0 : _b.querySelector(".tokens");
1898
- tokensList == null ? void 0 : tokensList.addEventListener("scroll", this.handleTokenListScroll.bind(this));
1899
- }
1900
- disconnectedCallback() {
1901
- var _a, _b;
1902
- super.disconnectedCallback();
1903
- const suggestedTokensContainer = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".suggested-tokens-container");
1904
- const tokensList = (_b = this.renderRoot) == null ? void 0 : _b.querySelector(".tokens");
1905
- suggestedTokensContainer == null ? void 0 : suggestedTokensContainer.removeEventListener("scroll", this.handleSuggestedTokensScroll.bind(this));
1906
- tokensList == null ? void 0 : tokensList.removeEventListener("scroll", this.handleTokenListScroll.bind(this));
1907
- clearInterval(this.interval);
1908
- }
1909
- render() {
1910
- return x`
1911
- <wui-flex flexDirection="column" gap="3">
1912
- ${this.templateSearchInput()} ${this.templateSuggestedTokens()} ${this.templateTokens()}
1913
- </wui-flex>
1914
- `;
1915
- }
1916
- onSelectToken(token) {
1917
- if (this.targetToken === "sourceToken") {
1918
- SwapController.setSourceToken(token);
1919
- } else {
1920
- SwapController.setToToken(token);
1921
- if (this.sourceToken && this.sourceTokenAmount) {
1922
- SwapController.swapTokens();
1923
- }
1924
- }
1925
- RouterController.goBack();
1926
- }
1927
- templateSearchInput() {
1928
- return x`
1929
- <wui-flex .padding=${["1", "3", "0", "3"]} gap="2">
1930
- <wui-input-text
1931
- data-testid="swap-select-token-search-input"
1932
- class="network-search-input"
1933
- size="sm"
1934
- placeholder="Search token"
1935
- icon="search"
1936
- .value=${this.searchValue}
1937
- @inputChange=${this.onSearchInputChange.bind(this)}
1938
- ></wui-input-text>
1939
- </wui-flex>
1940
- `;
1941
- }
1942
- templateMyTokens() {
1943
- const yourTokens = this.myTokensWithBalance ? Object.values(this.myTokensWithBalance) : [];
1944
- const filteredYourTokens = this.filterTokensWithText(yourTokens, this.searchValue);
1945
- if ((filteredYourTokens == null ? void 0 : filteredYourTokens.length) > 0) {
1946
- return x`<wui-flex justifyContent="flex-start" padding="2">
1947
- <wui-text variant="md-medium" color="secondary">Your tokens</wui-text>
1948
- </wui-flex>
1949
- ${filteredYourTokens.map((token) => {
1950
- var _a, _b, _c;
1951
- const selected = token.symbol === ((_a = this.sourceToken) == null ? void 0 : _a.symbol) || token.symbol === ((_b = this.toToken) == null ? void 0 : _b.symbol);
1952
- return x`
1953
- <wui-token-list-item
1954
- data-testid="swap-select-token-item-${token.symbol}"
1955
- name=${token.name}
1956
- ?disabled=${selected}
1957
- symbol=${token.symbol}
1958
- price=${token == null ? void 0 : token.price}
1959
- amount=${(_c = token == null ? void 0 : token.quantity) == null ? void 0 : _c.numeric}
1960
- imageSrc=${token.logoUri}
1961
- @click=${() => {
1962
- if (!selected) {
1963
- this.onSelectToken(token);
1964
- }
1965
- }}
1966
- >
1967
- </wui-token-list-item>
1968
- `;
1969
- })}`;
1970
- }
1971
- return null;
1972
- }
1973
- templateAllTokens() {
1974
- const tokens = this.popularTokens ? this.popularTokens : [];
1975
- const filteredTokens = this.filterTokensWithText(tokens, this.searchValue);
1976
- if (this.tokensLoading) {
1977
- return x`
1978
- <wui-token-list-item-loader></wui-token-list-item-loader>
1979
- <wui-token-list-item-loader></wui-token-list-item-loader>
1980
- <wui-token-list-item-loader></wui-token-list-item-loader>
1981
- <wui-token-list-item-loader></wui-token-list-item-loader>
1982
- <wui-token-list-item-loader></wui-token-list-item-loader>
1983
- `;
1984
- }
1985
- if ((filteredTokens == null ? void 0 : filteredTokens.length) > 0) {
1986
- return x`
1987
- ${filteredTokens.map((token) => x`
1988
- <wui-token-list-item
1989
- data-testid="swap-select-token-item-${token.symbol}"
1990
- name=${token.name}
1991
- symbol=${token.symbol}
1992
- imageSrc=${token.logoUri}
1993
- @click=${() => this.onSelectToken(token)}
1994
- >
1995
- </wui-token-list-item>
1996
- `)}
1997
- `;
1998
- }
1999
- return null;
2000
- }
2001
- templateTokens() {
2002
- return x`
2003
- <wui-flex class="tokens-container">
2004
- <wui-flex class="tokens" .padding=${["0", "2", "2", "2"]} flexDirection="column">
2005
- ${this.templateMyTokens()}
2006
- <wui-flex justifyContent="flex-start" padding="3">
2007
- <wui-text variant="md-medium" color="secondary">Tokens</wui-text>
2008
- </wui-flex>
2009
- ${this.templateAllTokens()}
2010
- </wui-flex>
2011
- </wui-flex>
2012
- `;
2013
- }
2014
- templateSuggestedTokens() {
2015
- const tokens = this.suggestedTokens ? this.suggestedTokens.slice(0, 8) : null;
2016
- if (this.tokensLoading) {
2017
- return x`
2018
- <wui-flex
2019
- class="suggested-tokens-container"
2020
- .padding=${["0", "3", "0", "3"]}
2021
- gap="2"
2022
- >
2023
- <wui-token-button loading></wui-token-button>
2024
- <wui-token-button loading></wui-token-button>
2025
- <wui-token-button loading></wui-token-button>
2026
- <wui-token-button loading></wui-token-button>
2027
- <wui-token-button loading></wui-token-button>
2028
- </wui-flex>
2029
- `;
2030
- }
2031
- if (!tokens) {
2032
- return null;
2033
- }
2034
- return x`
2035
- <wui-flex
2036
- class="suggested-tokens-container"
2037
- .padding=${["0", "3", "0", "3"]}
2038
- gap="2"
2039
- >
2040
- ${tokens.map((token) => x`
2041
- <wui-token-button
2042
- text=${token.symbol}
2043
- imageSrc=${token.logoUri}
2044
- @click=${() => this.onSelectToken(token)}
2045
- >
2046
- </wui-token-button>
2047
- `)}
2048
- </wui-flex>
2049
- `;
2050
- }
2051
- onSearchInputChange(event) {
2052
- this.searchValue = event.detail;
2053
- }
2054
- handleSuggestedTokensScroll() {
2055
- var _a;
2056
- const container = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".suggested-tokens-container");
2057
- if (!container) {
2058
- return;
2059
- }
2060
- container.style.setProperty("--suggested-tokens-scroll--left-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollLeft).toString());
2061
- container.style.setProperty("--suggested-tokens-scroll--right-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollWidth - container.scrollLeft - container.offsetWidth).toString());
2062
- }
2063
- handleTokenListScroll() {
2064
- var _a;
2065
- const container = (_a = this.renderRoot) == null ? void 0 : _a.querySelector(".tokens");
2066
- if (!container) {
2067
- return;
2068
- }
2069
- container.style.setProperty("--tokens-scroll--top-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollTop).toString());
2070
- container.style.setProperty("--tokens-scroll--bottom-opacity", MathUtil.interpolate([0, 100], [0, 1], container.scrollHeight - container.scrollTop - container.offsetHeight).toString());
2071
- }
2072
- filterTokensWithText(tokens, text) {
2073
- return tokens.filter((token) => `${token.symbol} ${token.name} ${token.address}`.toLowerCase().includes(text.toLowerCase())).sort((a, b) => {
2074
- const aText = `${a.symbol} ${a.name} ${a.address}`.toLowerCase();
2075
- const bText = `${b.symbol} ${b.name} ${b.address}`.toLowerCase();
2076
- const aIndex = aText.indexOf(text.toLowerCase());
2077
- const bIndex = bText.indexOf(text.toLowerCase());
2078
- return aIndex - bIndex;
2079
- });
2080
- }
2081
- };
2082
- W3mSwapSelectTokenView.styles = styles;
2083
- __decorate([
2084
- r()
2085
- ], W3mSwapSelectTokenView.prototype, "interval", void 0);
2086
- __decorate([
2087
- r()
2088
- ], W3mSwapSelectTokenView.prototype, "targetToken", void 0);
2089
- __decorate([
2090
- r()
2091
- ], W3mSwapSelectTokenView.prototype, "sourceToken", void 0);
2092
- __decorate([
2093
- r()
2094
- ], W3mSwapSelectTokenView.prototype, "sourceTokenAmount", void 0);
2095
- __decorate([
2096
- r()
2097
- ], W3mSwapSelectTokenView.prototype, "toToken", void 0);
2098
- __decorate([
2099
- r()
2100
- ], W3mSwapSelectTokenView.prototype, "myTokensWithBalance", void 0);
2101
- __decorate([
2102
- r()
2103
- ], W3mSwapSelectTokenView.prototype, "popularTokens", void 0);
2104
- __decorate([
2105
- r()
2106
- ], W3mSwapSelectTokenView.prototype, "suggestedTokens", void 0);
2107
- __decorate([
2108
- r()
2109
- ], W3mSwapSelectTokenView.prototype, "tokensLoading", void 0);
2110
- __decorate([
2111
- r()
2112
- ], W3mSwapSelectTokenView.prototype, "searchValue", void 0);
2113
- W3mSwapSelectTokenView = __decorate([
2114
- customElement("w3m-swap-select-token-view")
2115
- ], W3mSwapSelectTokenView);
2116
- export {
2117
- W3mSwapPreviewView,
2118
- W3mSwapSelectTokenView,
2119
- W3mSwapView
2120
- };
2121
- //# sourceMappingURL=swaps-DQ-uUZvX.js.map