@m0-foundation/swap-component 0.0.1

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 (240) hide show
  1. package/dist/m0-swap-component/ConstantsUtil-btJ3XIXu.js +28 -0
  2. package/dist/m0-swap-component/ConstantsUtil-btJ3XIXu.js.map +1 -0
  3. package/dist/m0-swap-component/HelpersUtil-5wkO4kIW.js +142 -0
  4. package/dist/m0-swap-component/HelpersUtil-5wkO4kIW.js.map +1 -0
  5. package/dist/m0-swap-component/PhArrowCircleDown-BiDIiYXi.js +76 -0
  6. package/dist/m0-swap-component/PhArrowCircleDown-BiDIiYXi.js.map +1 -0
  7. package/dist/m0-swap-component/PhArrowClockwise-BRnlxNUR.js +76 -0
  8. package/dist/m0-swap-component/PhArrowClockwise-BRnlxNUR.js.map +1 -0
  9. package/dist/m0-swap-component/PhArrowDown-Co2hyXIs.js +76 -0
  10. package/dist/m0-swap-component/PhArrowDown-Co2hyXIs.js.map +1 -0
  11. package/dist/m0-swap-component/PhArrowLeft-Cb8ijwK6.js +76 -0
  12. package/dist/m0-swap-component/PhArrowLeft-Cb8ijwK6.js.map +1 -0
  13. package/dist/m0-swap-component/PhArrowRight-B9t--Gmh.js +76 -0
  14. package/dist/m0-swap-component/PhArrowRight-B9t--Gmh.js.map +1 -0
  15. package/dist/m0-swap-component/PhArrowSquareOut-eGBMEr5T.js +76 -0
  16. package/dist/m0-swap-component/PhArrowSquareOut-eGBMEr5T.js.map +1 -0
  17. package/dist/m0-swap-component/PhArrowUp-CjSpT-xh.js +76 -0
  18. package/dist/m0-swap-component/PhArrowUp-CjSpT-xh.js.map +1 -0
  19. package/dist/m0-swap-component/PhArrowUpRight-B8u6wk-A.js +76 -0
  20. package/dist/m0-swap-component/PhArrowUpRight-B8u6wk-A.js.map +1 -0
  21. package/dist/m0-swap-component/PhArrowsClockwise-CBcfV6j6.js +76 -0
  22. package/dist/m0-swap-component/PhArrowsClockwise-CBcfV6j6.js.map +1 -0
  23. package/dist/m0-swap-component/PhArrowsDownUp-CMVR84b1.js +76 -0
  24. package/dist/m0-swap-component/PhArrowsDownUp-CMVR84b1.js.map +1 -0
  25. package/dist/m0-swap-component/PhArrowsLeftRight-CmXk8rs2.js +76 -0
  26. package/dist/m0-swap-component/PhArrowsLeftRight-CmXk8rs2.js.map +1 -0
  27. package/dist/m0-swap-component/PhBank-BigtjnS8.js +76 -0
  28. package/dist/m0-swap-component/PhBank-BigtjnS8.js.map +1 -0
  29. package/dist/m0-swap-component/PhBrowser-BOulLD8D.js +76 -0
  30. package/dist/m0-swap-component/PhBrowser-BOulLD8D.js.map +1 -0
  31. package/dist/m0-swap-component/PhCaretDown-BvvZ65ad.js +76 -0
  32. package/dist/m0-swap-component/PhCaretDown-BvvZ65ad.js.map +1 -0
  33. package/dist/m0-swap-component/PhCaretLeft-DtwjZbZ7.js +76 -0
  34. package/dist/m0-swap-component/PhCaretLeft-DtwjZbZ7.js.map +1 -0
  35. package/dist/m0-swap-component/PhCaretRight-C8LuSZkO.js +76 -0
  36. package/dist/m0-swap-component/PhCaretRight-C8LuSZkO.js.map +1 -0
  37. package/dist/m0-swap-component/PhCaretUp-B2lAObip.js +76 -0
  38. package/dist/m0-swap-component/PhCaretUp-B2lAObip.js.map +1 -0
  39. package/dist/m0-swap-component/PhCheck-DQtuVrQf.js +76 -0
  40. package/dist/m0-swap-component/PhCheck-DQtuVrQf.js.map +1 -0
  41. package/dist/m0-swap-component/PhCircleHalf-CXfZ0QZv.js +76 -0
  42. package/dist/m0-swap-component/PhCircleHalf-CXfZ0QZv.js.map +1 -0
  43. package/dist/m0-swap-component/PhClock-CXsmuc_a.js +76 -0
  44. package/dist/m0-swap-component/PhClock-CXsmuc_a.js.map +1 -0
  45. package/dist/m0-swap-component/PhCompass-Cg-qnMon.js +76 -0
  46. package/dist/m0-swap-component/PhCompass-Cg-qnMon.js.map +1 -0
  47. package/dist/m0-swap-component/PhCopy-kGRKcvb4.js +76 -0
  48. package/dist/m0-swap-component/PhCopy-kGRKcvb4.js.map +1 -0
  49. package/dist/m0-swap-component/PhCreditCard-jYFausLO.js +76 -0
  50. package/dist/m0-swap-component/PhCreditCard-jYFausLO.js.map +1 -0
  51. package/dist/m0-swap-component/PhCurrencyDollar-C8vSY3fy.js +76 -0
  52. package/dist/m0-swap-component/PhCurrencyDollar-C8vSY3fy.js.map +1 -0
  53. package/dist/m0-swap-component/PhDesktop-AczlBCho.js +76 -0
  54. package/dist/m0-swap-component/PhDesktop-AczlBCho.js.map +1 -0
  55. package/dist/m0-swap-component/PhDeviceMobile-3rFbdWLA.js +76 -0
  56. package/dist/m0-swap-component/PhDeviceMobile-3rFbdWLA.js.map +1 -0
  57. package/dist/m0-swap-component/PhDotsThree-cJsXXsvY.js +76 -0
  58. package/dist/m0-swap-component/PhDotsThree-cJsXXsvY.js.map +1 -0
  59. package/dist/m0-swap-component/PhEnvelope-C1bxHVXw.js +76 -0
  60. package/dist/m0-swap-component/PhEnvelope-C1bxHVXw.js.map +1 -0
  61. package/dist/m0-swap-component/PhFunnelSimple-DhqB9fsu.js +76 -0
  62. package/dist/m0-swap-component/PhFunnelSimple-DhqB9fsu.js.map +1 -0
  63. package/dist/m0-swap-component/PhGlobe-BFp6kx95.js +76 -0
  64. package/dist/m0-swap-component/PhGlobe-BFp6kx95.js.map +1 -0
  65. package/dist/m0-swap-component/PhIdentificationCard-BdYxckWB.js +76 -0
  66. package/dist/m0-swap-component/PhIdentificationCard-BdYxckWB.js.map +1 -0
  67. package/dist/m0-swap-component/PhImage-CXxX5oq3.js +76 -0
  68. package/dist/m0-swap-component/PhImage-CXxX5oq3.js.map +1 -0
  69. package/dist/m0-swap-component/PhInfo-BcuP36hY.js +76 -0
  70. package/dist/m0-swap-component/PhInfo-BcuP36hY.js.map +1 -0
  71. package/dist/m0-swap-component/PhLightbulb-DkWwRl94.js +76 -0
  72. package/dist/m0-swap-component/PhLightbulb-DkWwRl94.js.map +1 -0
  73. package/dist/m0-swap-component/PhMagnifyingGlass-B_fFjslY.js +76 -0
  74. package/dist/m0-swap-component/PhMagnifyingGlass-B_fFjslY.js.map +1 -0
  75. package/dist/m0-swap-component/PhPaperPlaneRight-BIzGG3QW.js +76 -0
  76. package/dist/m0-swap-component/PhPaperPlaneRight-BIzGG3QW.js.map +1 -0
  77. package/dist/m0-swap-component/PhPlus-BGosT2zu.js +76 -0
  78. package/dist/m0-swap-component/PhPlus-BGosT2zu.js.map +1 -0
  79. package/dist/m0-swap-component/PhPower-BMqDnP1n.js +76 -0
  80. package/dist/m0-swap-component/PhPower-BMqDnP1n.js.map +1 -0
  81. package/dist/m0-swap-component/PhPuzzlePiece-DNMpiJNU.js +76 -0
  82. package/dist/m0-swap-component/PhPuzzlePiece-DNMpiJNU.js.map +1 -0
  83. package/dist/m0-swap-component/PhQrCode-DrHkqrU4.js +76 -0
  84. package/dist/m0-swap-component/PhQrCode-DrHkqrU4.js.map +1 -0
  85. package/dist/m0-swap-component/PhQuestion-zTfvwqNz.js +76 -0
  86. package/dist/m0-swap-component/PhQuestion-zTfvwqNz.js.map +1 -0
  87. package/dist/m0-swap-component/PhQuestionMark-h3Nk1Yf1.js +76 -0
  88. package/dist/m0-swap-component/PhQuestionMark-h3Nk1Yf1.js.map +1 -0
  89. package/dist/m0-swap-component/PhSealCheck-DPPqSt6G.js +76 -0
  90. package/dist/m0-swap-component/PhSealCheck-DPPqSt6G.js.map +1 -0
  91. package/dist/m0-swap-component/PhSignOut-CJgnrE_v.js +76 -0
  92. package/dist/m0-swap-component/PhSignOut-CJgnrE_v.js.map +1 -0
  93. package/dist/m0-swap-component/PhSpinner-CMTEIWbw.js +76 -0
  94. package/dist/m0-swap-component/PhSpinner-CMTEIWbw.js.map +1 -0
  95. package/dist/m0-swap-component/PhTrash-CeDVW4am.js +76 -0
  96. package/dist/m0-swap-component/PhTrash-CeDVW4am.js.map +1 -0
  97. package/dist/m0-swap-component/PhUser-lQ9WUtAV.js +76 -0
  98. package/dist/m0-swap-component/PhUser-lQ9WUtAV.js.map +1 -0
  99. package/dist/m0-swap-component/PhVault-EnLnS_IQ.js +76 -0
  100. package/dist/m0-swap-component/PhVault-EnLnS_IQ.js.map +1 -0
  101. package/dist/m0-swap-component/PhWallet-CUeDZydd.js +76 -0
  102. package/dist/m0-swap-component/PhWallet-CUeDZydd.js.map +1 -0
  103. package/dist/m0-swap-component/PhWarning-CokeGZs2.js +76 -0
  104. package/dist/m0-swap-component/PhWarning-CokeGZs2.js.map +1 -0
  105. package/dist/m0-swap-component/PhWarningCircle-vWtA7S0R.js +76 -0
  106. package/dist/m0-swap-component/PhWarningCircle-vWtA7S0R.js.map +1 -0
  107. package/dist/m0-swap-component/PhX-DwCRIvoc.js +76 -0
  108. package/dist/m0-swap-component/PhX-DwCRIvoc.js.map +1 -0
  109. package/dist/m0-swap-component/data-capture-BmovBbKV.js +573 -0
  110. package/dist/m0-swap-component/data-capture-BmovBbKV.js.map +1 -0
  111. package/dist/m0-swap-component/email-B4niz3Ms.js +445 -0
  112. package/dist/m0-swap-component/email-B4niz3Ms.js.map +1 -0
  113. package/dist/m0-swap-component/embedded-wallet-D6bzjX_K.js +988 -0
  114. package/dist/m0-swap-component/embedded-wallet-D6bzjX_K.js.map +1 -0
  115. package/dist/m0-swap-component/features-EhJNVE-M.js +355 -0
  116. package/dist/m0-swap-component/features-EhJNVE-M.js.map +1 -0
  117. package/dist/m0-swap-component/if-defined-2CMpVr2R.js +12 -0
  118. package/dist/m0-swap-component/if-defined-2CMpVr2R.js.map +1 -0
  119. package/dist/m0-swap-component/index-B4xuj7uR.js +965 -0
  120. package/dist/m0-swap-component/index-B4xuj7uR.js.map +1 -0
  121. package/dist/m0-swap-component/index-BVZ66GYf.js +206 -0
  122. package/dist/m0-swap-component/index-BVZ66GYf.js.map +1 -0
  123. package/dist/m0-swap-component/index-BZXyMieH.js +150 -0
  124. package/dist/m0-swap-component/index-BZXyMieH.js.map +1 -0
  125. package/dist/m0-swap-component/index-Bj5sA_Ri.js +252 -0
  126. package/dist/m0-swap-component/index-Bj5sA_Ri.js.map +1 -0
  127. package/dist/m0-swap-component/index-Bs-pPJYj.js +129 -0
  128. package/dist/m0-swap-component/index-Bs-pPJYj.js.map +1 -0
  129. package/dist/m0-swap-component/index-CMS76VPf.js +474 -0
  130. package/dist/m0-swap-component/index-CMS76VPf.js.map +1 -0
  131. package/dist/m0-swap-component/index-CoMTkqee.js +95 -0
  132. package/dist/m0-swap-component/index-CoMTkqee.js.map +1 -0
  133. package/dist/m0-swap-component/index-DE0OtbL2.js +3566 -0
  134. package/dist/m0-swap-component/index-DE0OtbL2.js.map +1 -0
  135. package/dist/m0-swap-component/index-DEG-YczD.js +231 -0
  136. package/dist/m0-swap-component/index-DEG-YczD.js.map +1 -0
  137. package/dist/m0-swap-component/index-DY_Ijq_4.js +4345 -0
  138. package/dist/m0-swap-component/index-DY_Ijq_4.js.map +1 -0
  139. package/dist/m0-swap-component/index-IRpGhIhy.js +9394 -0
  140. package/dist/m0-swap-component/index-IRpGhIhy.js.map +1 -0
  141. package/dist/m0-swap-component/index-Z70nBYWG.js +113 -0
  142. package/dist/m0-swap-component/index-Z70nBYWG.js.map +1 -0
  143. package/dist/m0-swap-component/index-iNFotRMa.js +73 -0
  144. package/dist/m0-swap-component/index-iNFotRMa.js.map +1 -0
  145. package/dist/m0-swap-component/index-n1fooC-v.js +37757 -0
  146. package/dist/m0-swap-component/index-n1fooC-v.js.map +1 -0
  147. package/dist/m0-swap-component/index.esm.js +2 -0
  148. package/dist/m0-swap-component/index.esm.js.map +1 -0
  149. package/dist/m0-swap-component/loader.esm.js.map +1 -0
  150. package/dist/m0-swap-component/m0-swap-component.esm.js +48 -0
  151. package/dist/m0-swap-component/m0-swap-component.esm.js.map +1 -0
  152. package/dist/m0-swap-component/native-CPtqJIn7.js +18 -0
  153. package/dist/m0-swap-component/native-CPtqJIn7.js.map +1 -0
  154. package/dist/m0-swap-component/onramp-BppY2eDR.js +1003 -0
  155. package/dist/m0-swap-component/onramp-BppY2eDR.js.map +1 -0
  156. package/dist/m0-swap-component/pay-with-exchange-BJYQgTMB.js +639 -0
  157. package/dist/m0-swap-component/pay-with-exchange-BJYQgTMB.js.map +1 -0
  158. package/dist/m0-swap-component/property-BN-VaT99.js +625 -0
  159. package/dist/m0-swap-component/property-BN-VaT99.js.map +1 -0
  160. package/dist/m0-swap-component/receive-BptRM_5_.js +281 -0
  161. package/dist/m0-swap-component/receive-BptRM_5_.js.map +1 -0
  162. package/dist/m0-swap-component/ref-3xALOvo5.js +25 -0
  163. package/dist/m0-swap-component/ref-3xALOvo5.js.map +1 -0
  164. package/dist/m0-swap-component/send-BCyHM4Zr.js +1408 -0
  165. package/dist/m0-swap-component/send-BCyHM4Zr.js.map +1 -0
  166. package/dist/m0-swap-component/socials-BbajCSWV.js +824 -0
  167. package/dist/m0-swap-component/socials-BbajCSWV.js.map +1 -0
  168. package/dist/m0-swap-component/swap-module-5ZLM-vAV.js +140887 -0
  169. package/dist/m0-swap-component/swap-module-5ZLM-vAV.js.map +1 -0
  170. package/dist/m0-swap-component/swap-module.entry.esm.js.map +1 -0
  171. package/dist/m0-swap-component/swap-module.entry.js +15 -0
  172. package/dist/m0-swap-component/swaps-DyGe65DR.js +2121 -0
  173. package/dist/m0-swap-component/swaps-DyGe65DR.js.map +1 -0
  174. package/dist/m0-swap-component/transactions-BZ9l4zt5.js +60 -0
  175. package/dist/m0-swap-component/transactions-BZ9l4zt5.js.map +1 -0
  176. package/dist/m0-swap-component/utils-RCeZbvdb.js +95 -0
  177. package/dist/m0-swap-component/utils-RCeZbvdb.js.map +1 -0
  178. package/dist/m0-swap-component/w3m-modal-D0HWVPsj.js +2097 -0
  179. package/dist/m0-swap-component/w3m-modal-D0HWVPsj.js.map +1 -0
  180. package/dist/m0-swap-component/wui-button-BeTWD3Va.js +223 -0
  181. package/dist/m0-swap-component/wui-button-BeTWD3Va.js.map +1 -0
  182. package/dist/m0-swap-component/wui-email-input-CgnfUH0c.js +65 -0
  183. package/dist/m0-swap-component/wui-email-input-CgnfUH0c.js.map +1 -0
  184. package/dist/m0-swap-component/wui-icon-B0uTDhW-.js +4 -0
  185. package/dist/m0-swap-component/wui-icon-B0uTDhW-.js.map +1 -0
  186. package/dist/m0-swap-component/wui-icon-box-s87lODBB.js +4 -0
  187. package/dist/m0-swap-component/wui-icon-box-s87lODBB.js.map +1 -0
  188. package/dist/m0-swap-component/wui-icon-link-BFpV9kPE.js +127 -0
  189. package/dist/m0-swap-component/wui-icon-link-BFpV9kPE.js.map +1 -0
  190. package/dist/m0-swap-component/wui-image-BvjxoR51.js +4 -0
  191. package/dist/m0-swap-component/wui-image-BvjxoR51.js.map +1 -0
  192. package/dist/m0-swap-component/wui-input-amount-CWQfP3RO.js +182 -0
  193. package/dist/m0-swap-component/wui-input-amount-CWQfP3RO.js.map +1 -0
  194. package/dist/m0-swap-component/wui-input-text-g0sN4B2y.js +4 -0
  195. package/dist/m0-swap-component/wui-input-text-g0sN4B2y.js.map +1 -0
  196. package/dist/m0-swap-component/wui-link-VqM3wLny.js +123 -0
  197. package/dist/m0-swap-component/wui-link-VqM3wLny.js.map +1 -0
  198. package/dist/m0-swap-component/wui-list-item-BIijofqN.js +170 -0
  199. package/dist/m0-swap-component/wui-list-item-BIijofqN.js.map +1 -0
  200. package/dist/m0-swap-component/wui-list-social-C7GhkRc8.js +119 -0
  201. package/dist/m0-swap-component/wui-list-social-C7GhkRc8.js.map +1 -0
  202. package/dist/m0-swap-component/wui-list-token-C94lmAbT.js +134 -0
  203. package/dist/m0-swap-component/wui-list-token-C94lmAbT.js.map +1 -0
  204. package/dist/m0-swap-component/wui-list-wallet-C7fnQvCW.js +622 -0
  205. package/dist/m0-swap-component/wui-list-wallet-C7fnQvCW.js.map +1 -0
  206. package/dist/m0-swap-component/wui-loading-spinner-CW2_5SKA.js +4 -0
  207. package/dist/m0-swap-component/wui-loading-spinner-CW2_5SKA.js.map +1 -0
  208. package/dist/m0-swap-component/wui-loading-thumbnail-y3sGkT5j.js +337 -0
  209. package/dist/m0-swap-component/wui-loading-thumbnail-y3sGkT5j.js.map +1 -0
  210. package/dist/m0-swap-component/wui-qr-code-DekJTDGf.js +3412 -0
  211. package/dist/m0-swap-component/wui-qr-code-DekJTDGf.js.map +1 -0
  212. package/dist/m0-swap-component/wui-separator-DMZIL_Av.js +67 -0
  213. package/dist/m0-swap-component/wui-separator-DMZIL_Av.js.map +1 -0
  214. package/dist/m0-swap-component/wui-shimmer-CVFC8fMx.js +4 -0
  215. package/dist/m0-swap-component/wui-shimmer-CVFC8fMx.js.map +1 -0
  216. package/dist/m0-swap-component/wui-text-BS_lZKY4.js +1127 -0
  217. package/dist/m0-swap-component/wui-text-BS_lZKY4.js.map +1 -0
  218. package/dist/m0-swap-component/wui-token-button-CsOFoNJG.js +214 -0
  219. package/dist/m0-swap-component/wui-token-button-CsOFoNJG.js.map +1 -0
  220. package/dist/m0-swap-component/wui-visual-hU2Mkyrv.js +565 -0
  221. package/dist/m0-swap-component/wui-visual-hU2Mkyrv.js.map +1 -0
  222. package/dist/m0-swap-component/wui-wallet-switch-CWbdtfbN.js +459 -0
  223. package/dist/m0-swap-component/wui-wallet-switch-CWbdtfbN.js.map +1 -0
  224. package/dist/types/components/swap-module/balances.d.ts +16 -0
  225. package/dist/types/components/swap-module/chains.d.ts +16 -0
  226. package/dist/types/components/swap-module/store.d.ts +34 -0
  227. package/dist/types/components/swap-module/swap-module.d.ts +113 -0
  228. package/dist/types/components/swap-module/utils/constants.d.ts +7 -0
  229. package/dist/types/components/swap-module/utils/formatters.d.ts +23 -0
  230. package/dist/types/components/swap-module/utils/reown.d.ts +59 -0
  231. package/dist/types/components/swap-module/utils/wallet.d.ts +83 -0
  232. package/dist/types/components.d.ts +165 -0
  233. package/dist/types/index.d.ts +1 -0
  234. package/dist/types/stencil-public-runtime.d.ts +1732 -0
  235. package/loader/cdn.js +1 -0
  236. package/loader/index.cjs.js +1 -0
  237. package/loader/index.d.ts +24 -0
  238. package/loader/index.es2017.js +1 -0
  239. package/loader/index.js +2 -0
  240. package/package.json +60 -0
@@ -0,0 +1,1408 @@
1
+ import { d as css, a as i, n as CoreHelperUtil, h as ChainController, m as ConnectionController, S as SendController, b, c as customElement, R as RouterController, y as NumberUtil, U as UiHelperUtil, M as ModalController, x as SwapController, p as SnackController, f as ConstantsUtil, B as BalanceUtil, D as AssetUtil, r as resetStyles, e as elementStyles, F as AppKitError, G as ErrorUtil, j as ConstantsUtil$1, o as EventsController } from './swap-module-5ZLM-vAV.js';
2
+ import { n as n$1, r } from './wui-text-BS_lZKY4.js';
3
+ import './utils-RCeZbvdb.js';
4
+ import './wui-button-BeTWD3Va.js';
5
+ import './wui-icon-box-s87lODBB.js';
6
+ import './wui-separator-DMZIL_Av.js';
7
+ import { e, n } from './ref-3xALOvo5.js';
8
+ import './wui-icon-B0uTDhW-.js';
9
+ import './wui-input-amount-CWQfP3RO.js';
10
+ import './wui-link-VqM3wLny.js';
11
+ import './wui-token-button-CsOFoNJG.js';
12
+ import './wui-input-text-g0sN4B2y.js';
13
+ import './wui-list-token-C94lmAbT.js';
14
+ import './index-BZXyMieH.js';
15
+ import './index-Z70nBYWG.js';
16
+ import { o } from './if-defined-2CMpVr2R.js';
17
+ import './index-DY_Ijq_4.js';
18
+ import 'buffer';
19
+ import 'ox/BlockOverrides';
20
+ import 'ox/erc8010';
21
+ import 'ox/AbiConstructor';
22
+ import 'ox/AbiFunction';
23
+ import 'ox/erc6492';
24
+ import 'events';
25
+ import 'ox';
26
+ import 'ox/tempo';
27
+ import 'ox/Hex';
28
+ import 'ox/Secp256k1';
29
+ import 'ox/Signature';
30
+ import './index-CoMTkqee.js';
31
+ import './index-Bs-pPJYj.js';
32
+ import './index-iNFotRMa.js';
33
+ import './index-Bj5sA_Ri.js';
34
+
35
+ var styles$8 = css `
36
+ :host {
37
+ width: 100%;
38
+ height: 100px;
39
+ border-radius: ${({ borderRadius }) => borderRadius['5']};
40
+ border: 1px solid ${({ tokens }) => tokens.theme.foregroundPrimary};
41
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
42
+ transition: background-color ${({ durations }) => durations['lg']}
43
+ ${({ easings }) => easings['ease-out-power-1']};
44
+ will-change: background-color;
45
+ position: relative;
46
+ }
47
+
48
+ :host(:hover) {
49
+ background-color: ${({ tokens }) => tokens.theme.foregroundSecondary};
50
+ }
51
+
52
+ wui-flex {
53
+ width: 100%;
54
+ height: fit-content;
55
+ }
56
+
57
+ wui-button {
58
+ display: ruby;
59
+ color: ${({ tokens }) => tokens.theme.textPrimary};
60
+ margin: 0 ${({ spacing }) => spacing['2']};
61
+ }
62
+
63
+ .instruction {
64
+ position: absolute;
65
+ top: 50%;
66
+ transform: translateY(-50%);
67
+ z-index: 2;
68
+ }
69
+
70
+ .paste {
71
+ display: inline-flex;
72
+ }
73
+
74
+ textarea {
75
+ background: transparent;
76
+ width: 100%;
77
+ font-family: ${({ fontFamily }) => fontFamily.regular};
78
+ font-style: normal;
79
+ font-size: ${({ textSize }) => textSize.large};
80
+ font-weight: ${({ fontWeight }) => fontWeight.regular};
81
+ line-height: ${({ typography }) => typography['lg-regular'].lineHeight};
82
+ letter-spacing: ${({ typography }) => typography['lg-regular'].letterSpacing};
83
+ color: ${({ tokens }) => tokens.theme.textSecondary};
84
+ caret-color: ${({ tokens }) => tokens.core.backgroundAccentPrimary};
85
+ box-sizing: border-box;
86
+ -webkit-appearance: none;
87
+ -moz-appearance: textfield;
88
+ padding: 0px;
89
+ border: none;
90
+ outline: none;
91
+ appearance: none;
92
+ resize: none;
93
+ overflow: hidden;
94
+ }
95
+ `;
96
+
97
+ var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
98
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
99
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
100
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
101
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
102
+ };
103
+ let W3mInputAddress = class W3mInputAddress extends i {
104
+ constructor() {
105
+ super(...arguments);
106
+ this.inputElementRef = e();
107
+ this.instructionElementRef = e();
108
+ this.readOnly = false;
109
+ this.instructionHidden = Boolean(this.value);
110
+ this.pasting = false;
111
+ this.onDebouncedSearch = CoreHelperUtil.debounce(async (value) => {
112
+ if (!value.length) {
113
+ this.setReceiverAddress('');
114
+ return;
115
+ }
116
+ const activeChain = ChainController.state.activeChain;
117
+ const isValidAddress = CoreHelperUtil.isAddress(value, activeChain);
118
+ if (isValidAddress) {
119
+ this.setReceiverAddress(value);
120
+ return;
121
+ }
122
+ try {
123
+ const resolvedAddress = await ConnectionController.getEnsAddress(value);
124
+ if (resolvedAddress) {
125
+ SendController.setReceiverProfileName(value);
126
+ SendController.setReceiverAddress(resolvedAddress);
127
+ const avatar = await ConnectionController.getEnsAvatar(value);
128
+ SendController.setReceiverProfileImageUrl(avatar || undefined);
129
+ }
130
+ }
131
+ catch (error) {
132
+ this.setReceiverAddress(value);
133
+ }
134
+ finally {
135
+ SendController.setLoading(false);
136
+ }
137
+ });
138
+ }
139
+ firstUpdated() {
140
+ if (this.value) {
141
+ this.instructionHidden = true;
142
+ }
143
+ this.checkHidden();
144
+ }
145
+ render() {
146
+ if (this.readOnly) {
147
+ return b ` <wui-flex
148
+ flexDirection="column"
149
+ justifyContent="center"
150
+ gap="01"
151
+ .padding=${['8', '4', '5', '4']}
152
+ >
153
+ <textarea
154
+ spellcheck="false"
155
+ ?disabled=${true}
156
+ autocomplete="off"
157
+ .value=${this.value ?? ''}
158
+ >
159
+ ${this.value ?? ''}</textarea
160
+ >
161
+ </wui-flex>`;
162
+ }
163
+ return b ` <wui-flex
164
+ @click=${this.onBoxClick.bind(this)}
165
+ flexDirection="column"
166
+ justifyContent="center"
167
+ gap="01"
168
+ .padding=${['8', '4', '5', '4']}
169
+ >
170
+ <wui-text
171
+ ${n(this.instructionElementRef)}
172
+ class="instruction"
173
+ color="secondary"
174
+ variant="md-medium"
175
+ >
176
+ Type or
177
+ <wui-button
178
+ class="paste"
179
+ size="md"
180
+ variant="neutral-secondary"
181
+ iconLeft="copy"
182
+ @click=${this.onPasteClick.bind(this)}
183
+ >
184
+ <wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
185
+ Paste
186
+ </wui-button>
187
+ address
188
+ </wui-text>
189
+ <textarea
190
+ spellcheck="false"
191
+ ?disabled=${!this.instructionHidden}
192
+ ${n(this.inputElementRef)}
193
+ @input=${this.onInputChange.bind(this)}
194
+ @blur=${this.onBlur.bind(this)}
195
+ .value=${this.value ?? ''}
196
+ autocomplete="off"
197
+ >
198
+ ${this.value ?? ''}</textarea
199
+ >
200
+ </wui-flex>`;
201
+ }
202
+ async focusInput() {
203
+ if (this.instructionElementRef.value) {
204
+ this.instructionHidden = true;
205
+ await this.toggleInstructionFocus(false);
206
+ this.instructionElementRef.value.style.pointerEvents = 'none';
207
+ this.inputElementRef.value?.focus();
208
+ if (this.inputElementRef.value) {
209
+ this.inputElementRef.value.selectionStart = this.inputElementRef.value.selectionEnd =
210
+ this.inputElementRef.value.value.length;
211
+ }
212
+ }
213
+ }
214
+ async focusInstruction() {
215
+ if (this.instructionElementRef.value) {
216
+ this.instructionHidden = false;
217
+ await this.toggleInstructionFocus(true);
218
+ this.instructionElementRef.value.style.pointerEvents = 'auto';
219
+ this.inputElementRef.value?.blur();
220
+ }
221
+ }
222
+ async toggleInstructionFocus(focus) {
223
+ if (this.instructionElementRef.value) {
224
+ await this.instructionElementRef.value.animate([{ opacity: focus ? 0 : 1 }, { opacity: focus ? 1 : 0 }], {
225
+ duration: 100,
226
+ easing: 'ease',
227
+ fill: 'forwards'
228
+ }).finished;
229
+ }
230
+ }
231
+ onBoxClick() {
232
+ if (!this.value && !this.instructionHidden) {
233
+ this.focusInput();
234
+ }
235
+ }
236
+ onBlur() {
237
+ if (!this.value && this.instructionHidden && !this.pasting) {
238
+ this.focusInstruction();
239
+ }
240
+ }
241
+ checkHidden() {
242
+ if (this.instructionHidden) {
243
+ this.focusInput();
244
+ }
245
+ }
246
+ async onPasteClick() {
247
+ this.pasting = true;
248
+ const text = await navigator.clipboard.readText();
249
+ SendController.setReceiverAddress(text);
250
+ this.focusInput();
251
+ }
252
+ onInputChange(e) {
253
+ const element = e.target;
254
+ this.pasting = false;
255
+ this.value = e.target?.value;
256
+ if (element.value && !this.instructionHidden) {
257
+ this.focusInput();
258
+ }
259
+ SendController.setLoading(true);
260
+ this.onDebouncedSearch(element.value);
261
+ }
262
+ setReceiverAddress(address) {
263
+ SendController.setReceiverAddress(address);
264
+ SendController.setReceiverProfileName(undefined);
265
+ SendController.setReceiverProfileImageUrl(undefined);
266
+ SendController.setLoading(false);
267
+ }
268
+ };
269
+ W3mInputAddress.styles = styles$8;
270
+ __decorate$8([
271
+ n$1()
272
+ ], W3mInputAddress.prototype, "value", void 0);
273
+ __decorate$8([
274
+ n$1({ type: Boolean })
275
+ ], W3mInputAddress.prototype, "readOnly", void 0);
276
+ __decorate$8([
277
+ r()
278
+ ], W3mInputAddress.prototype, "instructionHidden", void 0);
279
+ __decorate$8([
280
+ r()
281
+ ], W3mInputAddress.prototype, "pasting", void 0);
282
+ W3mInputAddress = __decorate$8([
283
+ customElement('w3m-input-address')
284
+ ], W3mInputAddress);
285
+
286
+ var styles$7 = css `
287
+ :host {
288
+ width: 100%;
289
+ height: 100px;
290
+ border-radius: ${({ borderRadius }) => borderRadius['5']};
291
+ border: 1px solid ${({ tokens }) => tokens.theme.foregroundPrimary};
292
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
293
+ transition: background-color ${({ durations }) => durations['lg']}
294
+ ${({ easings }) => easings['ease-out-power-1']};
295
+ will-change: background-color;
296
+ transition: all ${({ easings }) => easings['ease-out-power-1']}
297
+ ${({ durations }) => durations['lg']};
298
+ }
299
+
300
+ :host(:hover) {
301
+ background-color: ${({ tokens }) => tokens.theme.foregroundSecondary};
302
+ }
303
+
304
+ wui-flex {
305
+ width: 100%;
306
+ height: fit-content;
307
+ }
308
+
309
+ wui-button {
310
+ width: 100%;
311
+ display: flex;
312
+ justify-content: flex-end;
313
+ }
314
+
315
+ wui-input-amount {
316
+ mask-image: linear-gradient(
317
+ 270deg,
318
+ transparent 0px,
319
+ transparent 8px,
320
+ black 24px,
321
+ black 25px,
322
+ black 32px,
323
+ black 100%
324
+ );
325
+ }
326
+
327
+ .totalValue {
328
+ width: 100%;
329
+ }
330
+ `;
331
+
332
+ var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
333
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
334
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
335
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
336
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
337
+ };
338
+ let W3mInputToken = class W3mInputToken extends i {
339
+ constructor() {
340
+ super(...arguments);
341
+ this.readOnly = false;
342
+ this.isInsufficientBalance = false;
343
+ }
344
+ render() {
345
+ const isDisabled = this.readOnly || !this.token;
346
+ return b ` <wui-flex
347
+ flexDirection="column"
348
+ gap="01"
349
+ .padding=${['5', '3', '4', '3']}
350
+ >
351
+ <wui-flex alignItems="center">
352
+ <wui-input-amount
353
+ @inputChange=${this.onInputChange.bind(this)}
354
+ ?disabled=${isDisabled}
355
+ .value=${this.sendTokenAmount ? String(this.sendTokenAmount) : ''}
356
+ ?error=${Boolean(this.isInsufficientBalance)}
357
+ ></wui-input-amount>
358
+ ${this.buttonTemplate()}
359
+ </wui-flex>
360
+ ${this.bottomTemplate()}
361
+ </wui-flex>`;
362
+ }
363
+ buttonTemplate() {
364
+ if (this.token) {
365
+ return b `<wui-token-button
366
+ text=${this.token.symbol}
367
+ imageSrc=${this.token.iconUrl}
368
+ @click=${this.handleSelectButtonClick.bind(this)}
369
+ >
370
+ </wui-token-button>`;
371
+ }
372
+ return b `<wui-button
373
+ size="md"
374
+ variant="neutral-secondary"
375
+ @click=${this.handleSelectButtonClick.bind(this)}
376
+ >Select token</wui-button
377
+ >`;
378
+ }
379
+ handleSelectButtonClick() {
380
+ if (!this.readOnly) {
381
+ RouterController.push('WalletSendSelectToken');
382
+ }
383
+ }
384
+ sendValueTemplate() {
385
+ if (!this.readOnly && this.token && this.sendTokenAmount) {
386
+ const price = this.token.price;
387
+ const totalValue = price * this.sendTokenAmount;
388
+ return b `<wui-text class="totalValue" variant="sm-regular" color="secondary"
389
+ >${totalValue
390
+ ? `$${NumberUtil.formatNumberToLocalString(totalValue, 2)}`
391
+ : 'Incorrect value'}</wui-text
392
+ >`;
393
+ }
394
+ return null;
395
+ }
396
+ maxAmountTemplate() {
397
+ if (this.token) {
398
+ return b ` <wui-text variant="sm-regular" color="secondary">
399
+ ${UiHelperUtil.roundNumber(Number(this.token.quantity.numeric), 6, 5)}
400
+ </wui-text>`;
401
+ }
402
+ return null;
403
+ }
404
+ actionTemplate() {
405
+ if (this.token) {
406
+ return b `<wui-link @click=${this.onMaxClick.bind(this)}>Max</wui-link>`;
407
+ }
408
+ return null;
409
+ }
410
+ bottomTemplate() {
411
+ if (this.readOnly) {
412
+ return null;
413
+ }
414
+ return b `<wui-flex alignItems="center" justifyContent="space-between">
415
+ ${this.sendValueTemplate()}
416
+ <wui-flex alignItems="center" gap="01" justifyContent="flex-end">
417
+ ${this.maxAmountTemplate()} ${this.actionTemplate()}
418
+ </wui-flex>
419
+ </wui-flex>`;
420
+ }
421
+ onInputChange(event) {
422
+ SendController.setTokenAmount(event.detail);
423
+ }
424
+ onMaxClick() {
425
+ if (this.token) {
426
+ const maxValue = NumberUtil.bigNumber(this.token.quantity.numeric);
427
+ SendController.setTokenAmount(Number(maxValue.toFixed(20)));
428
+ }
429
+ }
430
+ };
431
+ W3mInputToken.styles = styles$7;
432
+ __decorate$7([
433
+ n$1({ type: Object })
434
+ ], W3mInputToken.prototype, "token", void 0);
435
+ __decorate$7([
436
+ n$1({ type: Boolean })
437
+ ], W3mInputToken.prototype, "readOnly", void 0);
438
+ __decorate$7([
439
+ n$1({ type: Number })
440
+ ], W3mInputToken.prototype, "sendTokenAmount", void 0);
441
+ __decorate$7([
442
+ n$1({ type: Boolean })
443
+ ], W3mInputToken.prototype, "isInsufficientBalance", void 0);
444
+ W3mInputToken = __decorate$7([
445
+ customElement('w3m-input-token')
446
+ ], W3mInputToken);
447
+
448
+ var styles$6 = css `
449
+ :host {
450
+ display: block;
451
+ }
452
+
453
+ wui-flex {
454
+ position: relative;
455
+ }
456
+
457
+ wui-icon-box {
458
+ width: 32px;
459
+ height: 32px;
460
+ border-radius: ${({ borderRadius }) => borderRadius['10']} !important;
461
+ border: 4px solid ${({ tokens }) => tokens.theme.backgroundPrimary};
462
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
463
+ position: absolute;
464
+ top: 50%;
465
+ left: 50%;
466
+ transform: translate(-50%, -50%);
467
+ z-index: 3;
468
+ }
469
+
470
+ wui-button {
471
+ --local-border-radius: ${({ borderRadius }) => borderRadius['4']} !important;
472
+ }
473
+
474
+ .inputContainer {
475
+ height: fit-content;
476
+ }
477
+ `;
478
+
479
+ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
480
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
481
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
482
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
483
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
484
+ };
485
+ const SEND_BUTTON_MESSAGE = {
486
+ INSUFFICIENT_FUNDS: 'Insufficient Funds',
487
+ INCORRECT_VALUE: 'Incorrect Value',
488
+ INVALID_ADDRESS: 'Invalid Address',
489
+ ADD_ADDRESS: 'Add Address',
490
+ ADD_AMOUNT: 'Add Amount',
491
+ SELECT_TOKEN: 'Select Token',
492
+ PREVIEW_SEND: 'Preview Send'
493
+ };
494
+ let W3mWalletSendView = class W3mWalletSendView extends i {
495
+ constructor() {
496
+ super();
497
+ this.unsubscribe = [];
498
+ this.isTryingToChooseDifferentWallet = false;
499
+ this.token = SendController.state.token;
500
+ this.sendTokenAmount = SendController.state.sendTokenAmount;
501
+ this.receiverAddress = SendController.state.receiverAddress;
502
+ this.receiverProfileName = SendController.state.receiverProfileName;
503
+ this.loading = SendController.state.loading;
504
+ this.params = RouterController.state.data?.send;
505
+ this.caipAddress = ChainController.getAccountData()?.caipAddress;
506
+ this.message = SEND_BUTTON_MESSAGE.PREVIEW_SEND;
507
+ this.disconnecting = false;
508
+ if (this.token && !this.params) {
509
+ this.fetchBalances();
510
+ this.fetchNetworkPrice();
511
+ }
512
+ const unsubscribe = ChainController.subscribeKey('activeCaipAddress', val => {
513
+ if (!val && this.isTryingToChooseDifferentWallet) {
514
+ this.isTryingToChooseDifferentWallet = false;
515
+ ModalController.open({
516
+ view: 'Connect',
517
+ data: {
518
+ redirectView: 'WalletSend'
519
+ }
520
+ }).catch(() => null);
521
+ unsubscribe();
522
+ }
523
+ });
524
+ this.unsubscribe.push(...[
525
+ ChainController.subscribeAccountStateProp('caipAddress', val => {
526
+ this.caipAddress = val;
527
+ }),
528
+ SendController.subscribe(val => {
529
+ this.token = val.token;
530
+ this.sendTokenAmount = val.sendTokenAmount;
531
+ this.receiverAddress = val.receiverAddress;
532
+ this.receiverProfileName = val.receiverProfileName;
533
+ this.loading = val.loading;
534
+ })
535
+ ]);
536
+ }
537
+ disconnectedCallback() {
538
+ this.unsubscribe.forEach(unsubscribe => unsubscribe());
539
+ }
540
+ async firstUpdated() {
541
+ await this.handleSendParameters();
542
+ }
543
+ render() {
544
+ this.getMessage();
545
+ const isReadOnly = Boolean(this.params);
546
+ return b ` <wui-flex flexDirection="column" .padding=${['0', '4', '4', '4']}>
547
+ <wui-flex class="inputContainer" gap="2" flexDirection="column">
548
+ <w3m-input-token
549
+ .token=${this.token}
550
+ .sendTokenAmount=${this.sendTokenAmount}
551
+ ?readOnly=${isReadOnly}
552
+ ?isInsufficientBalance=${this.message === SEND_BUTTON_MESSAGE.INSUFFICIENT_FUNDS}
553
+ ></w3m-input-token>
554
+ <wui-icon-box size="md" variant="secondary" icon="arrowBottom"></wui-icon-box>
555
+ <w3m-input-address
556
+ ?readOnly=${isReadOnly}
557
+ .value=${this.receiverProfileName ? this.receiverProfileName : this.receiverAddress}
558
+ ></w3m-input-address>
559
+ </wui-flex>
560
+ ${this.buttonTemplate()}
561
+ </wui-flex>`;
562
+ }
563
+ async fetchBalances() {
564
+ await SendController.fetchTokenBalance();
565
+ SendController.fetchNetworkBalance();
566
+ }
567
+ async fetchNetworkPrice() {
568
+ await SwapController.getNetworkTokenPrice();
569
+ }
570
+ onButtonClick() {
571
+ RouterController.push('WalletSendPreview', {
572
+ send: this.params
573
+ });
574
+ }
575
+ onFundWalletClick() {
576
+ RouterController.push('FundWallet', {
577
+ redirectView: 'WalletSend'
578
+ });
579
+ }
580
+ async onConnectDifferentWalletClick() {
581
+ try {
582
+ this.isTryingToChooseDifferentWallet = true;
583
+ this.disconnecting = true;
584
+ await ConnectionController.disconnect();
585
+ }
586
+ finally {
587
+ this.disconnecting = false;
588
+ }
589
+ }
590
+ getMessage() {
591
+ this.message = SEND_BUTTON_MESSAGE.PREVIEW_SEND;
592
+ if (this.receiverAddress &&
593
+ !CoreHelperUtil.isAddress(this.receiverAddress, ChainController.state.activeChain)) {
594
+ this.message = SEND_BUTTON_MESSAGE.INVALID_ADDRESS;
595
+ }
596
+ if (!this.receiverAddress) {
597
+ this.message = SEND_BUTTON_MESSAGE.ADD_ADDRESS;
598
+ }
599
+ if (this.sendTokenAmount &&
600
+ this.token &&
601
+ this.sendTokenAmount > Number(this.token.quantity.numeric)) {
602
+ this.message = SEND_BUTTON_MESSAGE.INSUFFICIENT_FUNDS;
603
+ }
604
+ if (!this.sendTokenAmount) {
605
+ this.message = SEND_BUTTON_MESSAGE.ADD_AMOUNT;
606
+ }
607
+ if (this.sendTokenAmount && this.token?.price) {
608
+ const value = this.sendTokenAmount * this.token.price;
609
+ if (!value) {
610
+ this.message = SEND_BUTTON_MESSAGE.INCORRECT_VALUE;
611
+ }
612
+ }
613
+ if (!this.token) {
614
+ this.message = SEND_BUTTON_MESSAGE.SELECT_TOKEN;
615
+ }
616
+ }
617
+ buttonTemplate() {
618
+ const isDisabled = !this.message.startsWith(SEND_BUTTON_MESSAGE.PREVIEW_SEND);
619
+ const isInsufficientBalance = this.message === SEND_BUTTON_MESSAGE.INSUFFICIENT_FUNDS;
620
+ const isReadOnly = Boolean(this.params);
621
+ if (isInsufficientBalance && !isReadOnly) {
622
+ return b `
623
+ <wui-flex .margin=${['4', '0', '0', '0']} flexDirection="column" gap="4">
624
+ <wui-button
625
+ @click=${this.onFundWalletClick.bind(this)}
626
+ size="lg"
627
+ variant="accent-secondary"
628
+ fullWidth
629
+ >
630
+ Fund Wallet
631
+ </wui-button>
632
+
633
+ <wui-separator data-testid="wui-separator" text="or"></wui-separator>
634
+
635
+ <wui-button
636
+ @click=${this.onConnectDifferentWalletClick.bind(this)}
637
+ size="lg"
638
+ variant="neutral-secondary"
639
+ fullWidth
640
+ ?loading=${this.disconnecting}
641
+ >
642
+ Connect a different wallet
643
+ </wui-button>
644
+ </wui-flex>
645
+ `;
646
+ }
647
+ return b `<wui-flex .margin=${['4', '0', '0', '0']}>
648
+ <wui-button
649
+ @click=${this.onButtonClick.bind(this)}
650
+ ?disabled=${isDisabled}
651
+ size="lg"
652
+ variant="accent-primary"
653
+ ?loading=${this.loading}
654
+ fullWidth
655
+ >
656
+ ${this.message}
657
+ </wui-button>
658
+ </wui-flex>`;
659
+ }
660
+ async handleSendParameters() {
661
+ this.loading = true;
662
+ if (!this.params) {
663
+ this.loading = false;
664
+ return;
665
+ }
666
+ const amount = Number(this.params.amount);
667
+ if (isNaN(amount)) {
668
+ SnackController.showError('Invalid amount');
669
+ this.loading = false;
670
+ return;
671
+ }
672
+ const { namespace, chainId, assetAddress } = this.params;
673
+ if (!ConstantsUtil.SEND_PARAMS_SUPPORTED_CHAINS.includes(namespace)) {
674
+ SnackController.showError(`Chain "${namespace}" is not supported for send parameters`);
675
+ this.loading = false;
676
+ return;
677
+ }
678
+ const caipNetwork = ChainController.getCaipNetworkById(chainId, namespace);
679
+ if (!caipNetwork) {
680
+ SnackController.showError(`Network with id "${chainId}" not found`);
681
+ this.loading = false;
682
+ return;
683
+ }
684
+ try {
685
+ const { balance, name, symbol, decimals } = await BalanceUtil.fetchERC20Balance({
686
+ caipAddress: this.caipAddress,
687
+ assetAddress,
688
+ caipNetwork
689
+ });
690
+ if (!name || !symbol || !decimals || !balance) {
691
+ SnackController.showError('Token not found');
692
+ return;
693
+ }
694
+ SendController.setToken({
695
+ name,
696
+ symbol,
697
+ chainId: caipNetwork.id.toString(),
698
+ address: `${caipNetwork.chainNamespace}:${caipNetwork.id}:${assetAddress}`,
699
+ value: 0,
700
+ price: 0,
701
+ quantity: {
702
+ decimals: decimals.toString(),
703
+ numeric: balance.toString()
704
+ },
705
+ iconUrl: AssetUtil.getTokenImage(symbol) ?? ''
706
+ });
707
+ SendController.setTokenAmount(amount);
708
+ SendController.setReceiverAddress(this.params.to);
709
+ }
710
+ catch (err) {
711
+ console.error('Failed to load token information:', err);
712
+ SnackController.showError('Failed to load token information');
713
+ }
714
+ finally {
715
+ this.loading = false;
716
+ }
717
+ }
718
+ };
719
+ W3mWalletSendView.styles = styles$6;
720
+ __decorate$6([
721
+ r()
722
+ ], W3mWalletSendView.prototype, "token", void 0);
723
+ __decorate$6([
724
+ r()
725
+ ], W3mWalletSendView.prototype, "sendTokenAmount", void 0);
726
+ __decorate$6([
727
+ r()
728
+ ], W3mWalletSendView.prototype, "receiverAddress", void 0);
729
+ __decorate$6([
730
+ r()
731
+ ], W3mWalletSendView.prototype, "receiverProfileName", void 0);
732
+ __decorate$6([
733
+ r()
734
+ ], W3mWalletSendView.prototype, "loading", void 0);
735
+ __decorate$6([
736
+ r()
737
+ ], W3mWalletSendView.prototype, "params", void 0);
738
+ __decorate$6([
739
+ r()
740
+ ], W3mWalletSendView.prototype, "caipAddress", void 0);
741
+ __decorate$6([
742
+ r()
743
+ ], W3mWalletSendView.prototype, "message", void 0);
744
+ __decorate$6([
745
+ r()
746
+ ], W3mWalletSendView.prototype, "disconnecting", void 0);
747
+ W3mWalletSendView = __decorate$6([
748
+ customElement('w3m-wallet-send-view')
749
+ ], W3mWalletSendView);
750
+
751
+ var styles$5 = css `
752
+ .contentContainer {
753
+ height: 440px;
754
+ overflow: scroll;
755
+ scrollbar-width: none;
756
+ }
757
+
758
+ .contentContainer::-webkit-scrollbar {
759
+ display: none;
760
+ }
761
+
762
+ wui-icon-box {
763
+ width: 40px;
764
+ height: 40px;
765
+ border-radius: ${({ borderRadius }) => borderRadius['3']};
766
+ }
767
+ `;
768
+
769
+ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
770
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
771
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
772
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
773
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
774
+ };
775
+ let W3mSendSelectTokenView = class W3mSendSelectTokenView extends i {
776
+ constructor() {
777
+ super();
778
+ this.unsubscribe = [];
779
+ this.tokenBalances = SendController.state.tokenBalances;
780
+ this.search = '';
781
+ this.onDebouncedSearch = CoreHelperUtil.debounce((value) => {
782
+ this.search = value;
783
+ });
784
+ this.fetchBalancesAndNetworkPrice();
785
+ this.unsubscribe.push(...[
786
+ SendController.subscribe(val => {
787
+ this.tokenBalances = val.tokenBalances;
788
+ })
789
+ ]);
790
+ }
791
+ disconnectedCallback() {
792
+ this.unsubscribe.forEach(unsubscribe => unsubscribe());
793
+ }
794
+ render() {
795
+ return b `
796
+ <wui-flex flexDirection="column">
797
+ ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
798
+ </wui-flex>
799
+ `;
800
+ }
801
+ async fetchBalancesAndNetworkPrice() {
802
+ if (!this.tokenBalances || this.tokenBalances?.length === 0) {
803
+ await this.fetchBalances();
804
+ await this.fetchNetworkPrice();
805
+ }
806
+ }
807
+ async fetchBalances() {
808
+ await SendController.fetchTokenBalance();
809
+ SendController.fetchNetworkBalance();
810
+ }
811
+ async fetchNetworkPrice() {
812
+ await SwapController.getNetworkTokenPrice();
813
+ }
814
+ templateSearchInput() {
815
+ return b `
816
+ <wui-flex gap="2" padding="3">
817
+ <wui-input-text
818
+ @inputChange=${this.onInputChange.bind(this)}
819
+ class="network-search-input"
820
+ size="sm"
821
+ placeholder="Search token"
822
+ icon="search"
823
+ ></wui-input-text>
824
+ </wui-flex>
825
+ `;
826
+ }
827
+ templateTokens() {
828
+ this.tokens = this.tokenBalances?.filter(token => token.chainId === ChainController.state.activeCaipNetwork?.caipNetworkId);
829
+ if (this.search) {
830
+ this.filteredTokens = this.tokenBalances?.filter(token => token.name.toLowerCase().includes(this.search.toLowerCase()));
831
+ }
832
+ else {
833
+ this.filteredTokens = this.tokens;
834
+ }
835
+ return b `
836
+ <wui-flex
837
+ class="contentContainer"
838
+ flexDirection="column"
839
+ .padding=${['0', '3', '0', '3']}
840
+ >
841
+ <wui-flex justifyContent="flex-start" .padding=${['4', '3', '3', '3']}>
842
+ <wui-text variant="md-medium" color="secondary">Your tokens</wui-text>
843
+ </wui-flex>
844
+ <wui-flex flexDirection="column" gap="2">
845
+ ${this.filteredTokens && this.filteredTokens.length > 0
846
+ ? this.filteredTokens.map(token => b `<wui-list-token
847
+ @click=${this.handleTokenClick.bind(this, token)}
848
+ ?clickable=${true}
849
+ tokenName=${token.name}
850
+ tokenImageUrl=${token.iconUrl}
851
+ tokenAmount=${token.quantity.numeric}
852
+ tokenValue=${token.value}
853
+ tokenCurrency=${token.symbol}
854
+ ></wui-list-token>`)
855
+ : b `<wui-flex
856
+ .padding=${['20', '0', '0', '0']}
857
+ alignItems="center"
858
+ flexDirection="column"
859
+ gap="4"
860
+ >
861
+ <wui-icon-box icon="coinPlaceholder" color="default" size="lg"></wui-icon-box>
862
+ <wui-flex
863
+ class="textContent"
864
+ gap="2"
865
+ flexDirection="column"
866
+ justifyContent="center"
867
+ flexDirection="column"
868
+ >
869
+ <wui-text variant="lg-medium" align="center" color="primary">
870
+ No tokens found
871
+ </wui-text>
872
+ <wui-text variant="lg-regular" align="center" color="secondary">
873
+ Your tokens will appear here
874
+ </wui-text>
875
+ </wui-flex>
876
+ <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
877
+ </wui-flex>`}
878
+ </wui-flex>
879
+ </wui-flex>
880
+ `;
881
+ }
882
+ onBuyClick() {
883
+ RouterController.push('OnRampProviders');
884
+ }
885
+ onInputChange(event) {
886
+ this.onDebouncedSearch(event.detail);
887
+ }
888
+ handleTokenClick(token) {
889
+ SendController.setToken(token);
890
+ SendController.setTokenAmount(undefined);
891
+ RouterController.goBack();
892
+ }
893
+ };
894
+ W3mSendSelectTokenView.styles = styles$5;
895
+ __decorate$5([
896
+ r()
897
+ ], W3mSendSelectTokenView.prototype, "tokenBalances", void 0);
898
+ __decorate$5([
899
+ r()
900
+ ], W3mSendSelectTokenView.prototype, "tokens", void 0);
901
+ __decorate$5([
902
+ r()
903
+ ], W3mSendSelectTokenView.prototype, "filteredTokens", void 0);
904
+ __decorate$5([
905
+ r()
906
+ ], W3mSendSelectTokenView.prototype, "search", void 0);
907
+ W3mSendSelectTokenView = __decorate$5([
908
+ customElement('w3m-wallet-send-select-token-view')
909
+ ], W3mSendSelectTokenView);
910
+
911
+ var styles$4 = css `
912
+ :host {
913
+ height: 32px;
914
+ display: flex;
915
+ align-items: center;
916
+ gap: ${({ spacing }) => spacing[1]};
917
+ border-radius: ${({ borderRadius }) => borderRadius[32]};
918
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
919
+ padding: ${({ spacing }) => spacing[1]};
920
+ padding-left: ${({ spacing }) => spacing[2]};
921
+ }
922
+
923
+ wui-avatar,
924
+ wui-image {
925
+ width: 24px;
926
+ height: 24px;
927
+ border-radius: ${({ borderRadius }) => borderRadius[16]};
928
+ }
929
+
930
+ wui-icon {
931
+ border-radius: ${({ borderRadius }) => borderRadius[16]};
932
+ }
933
+ `;
934
+
935
+ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
936
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
937
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
938
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
939
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
940
+ };
941
+ let WuiPreviewItem = class WuiPreviewItem extends i {
942
+ constructor() {
943
+ super(...arguments);
944
+ this.text = '';
945
+ }
946
+ render() {
947
+ return b `<wui-text variant="lg-regular" color="primary">${this.text}</wui-text>
948
+ ${this.imageTemplate()}`;
949
+ }
950
+ imageTemplate() {
951
+ if (this.address) {
952
+ return b `<wui-avatar address=${this.address} .imageSrc=${this.imageSrc}></wui-avatar>`;
953
+ }
954
+ else if (this.imageSrc) {
955
+ return b `<wui-image src=${this.imageSrc}></wui-image>`;
956
+ }
957
+ return b `<wui-icon size="lg" color="inverse" name="networkPlaceholder"></wui-icon>`;
958
+ }
959
+ };
960
+ WuiPreviewItem.styles = [resetStyles, elementStyles, styles$4];
961
+ __decorate$4([
962
+ n$1({ type: String })
963
+ ], WuiPreviewItem.prototype, "text", void 0);
964
+ __decorate$4([
965
+ n$1({ type: String })
966
+ ], WuiPreviewItem.prototype, "address", void 0);
967
+ __decorate$4([
968
+ n$1({ type: String })
969
+ ], WuiPreviewItem.prototype, "imageSrc", void 0);
970
+ WuiPreviewItem = __decorate$4([
971
+ customElement('wui-preview-item')
972
+ ], WuiPreviewItem);
973
+
974
+ var styles$3 = css `
975
+ :host {
976
+ display: flex;
977
+ padding: ${({ spacing }) => spacing[4]} ${({ spacing }) => spacing[3]};
978
+ width: 100%;
979
+ background-color: ${({ tokens }) => tokens.theme.foregroundPrimary};
980
+ border-radius: ${({ borderRadius }) => borderRadius[4]};
981
+ }
982
+
983
+ wui-image {
984
+ width: 20px;
985
+ height: 20px;
986
+ border-radius: ${({ borderRadius }) => borderRadius[16]};
987
+ }
988
+
989
+ wui-icon {
990
+ width: 20px;
991
+ height: 20px;
992
+ }
993
+ `;
994
+
995
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
996
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
997
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
998
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
999
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1000
+ };
1001
+ let WuiListContent = class WuiListContent extends i {
1002
+ constructor() {
1003
+ super(...arguments);
1004
+ this.imageSrc = undefined;
1005
+ this.textTitle = '';
1006
+ this.textValue = undefined;
1007
+ }
1008
+ render() {
1009
+ return b `
1010
+ <wui-flex justifyContent="space-between" alignItems="center">
1011
+ <wui-text variant="lg-regular" color="primary"> ${this.textTitle} </wui-text>
1012
+ ${this.templateContent()}
1013
+ </wui-flex>
1014
+ `;
1015
+ }
1016
+ templateContent() {
1017
+ if (this.imageSrc) {
1018
+ return b `<wui-image src=${this.imageSrc} alt=${this.textTitle}></wui-image>`;
1019
+ }
1020
+ else if (this.textValue) {
1021
+ return b ` <wui-text variant="md-regular" color="secondary"> ${this.textValue} </wui-text>`;
1022
+ }
1023
+ return b `<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`;
1024
+ }
1025
+ };
1026
+ WuiListContent.styles = [resetStyles, elementStyles, styles$3];
1027
+ __decorate$3([
1028
+ n$1()
1029
+ ], WuiListContent.prototype, "imageSrc", void 0);
1030
+ __decorate$3([
1031
+ n$1()
1032
+ ], WuiListContent.prototype, "textTitle", void 0);
1033
+ __decorate$3([
1034
+ n$1()
1035
+ ], WuiListContent.prototype, "textValue", void 0);
1036
+ WuiListContent = __decorate$3([
1037
+ customElement('wui-list-content')
1038
+ ], WuiListContent);
1039
+
1040
+ var styles$2 = css `
1041
+ :host {
1042
+ display: flex;
1043
+ width: auto;
1044
+ flex-direction: column;
1045
+ gap: ${({ spacing }) => spacing['1']};
1046
+ border-radius: ${({ borderRadius }) => borderRadius['5']};
1047
+ background: ${({ tokens }) => tokens.theme.foregroundPrimary};
1048
+ padding: ${({ spacing }) => spacing['3']} ${({ spacing }) => spacing['2']}
1049
+ ${({ spacing }) => spacing['2']} ${({ spacing }) => spacing['2']};
1050
+ }
1051
+
1052
+ wui-list-content {
1053
+ width: -webkit-fill-available !important;
1054
+ }
1055
+
1056
+ wui-text {
1057
+ padding: 0 ${({ spacing }) => spacing['2']};
1058
+ }
1059
+
1060
+ wui-flex {
1061
+ margin-top: ${({ spacing }) => spacing['2']};
1062
+ }
1063
+
1064
+ .network {
1065
+ cursor: pointer;
1066
+ transition: background-color ${({ durations }) => durations['lg']}
1067
+ ${({ easings }) => easings['ease-out-power-1']};
1068
+ will-change: background-color;
1069
+ }
1070
+
1071
+ .network:focus-visible {
1072
+ border: 1px solid ${({ tokens }) => tokens.core.textAccentPrimary};
1073
+ background-color: ${({ tokens }) => tokens.core.glass010};
1074
+ -webkit-box-shadow: 0px 0px 0px 4px ${({ tokens }) => tokens.core.foregroundAccent010};
1075
+ -moz-box-shadow: 0px 0px 0px 4px ${({ tokens }) => tokens.core.foregroundAccent010};
1076
+ box-shadow: 0px 0px 0px 4px ${({ tokens }) => tokens.core.foregroundAccent010};
1077
+ }
1078
+
1079
+ .network:hover {
1080
+ background-color: ${({ tokens }) => tokens.core.glass010};
1081
+ }
1082
+
1083
+ .network:active {
1084
+ background-color: ${({ tokens }) => tokens.core.glass010};
1085
+ }
1086
+ `;
1087
+
1088
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1089
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1090
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1091
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1092
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1093
+ };
1094
+ let W3mWalletSendDetails = class W3mWalletSendDetails extends i {
1095
+ constructor() {
1096
+ super(...arguments);
1097
+ this.params = RouterController.state.data?.send;
1098
+ }
1099
+ render() {
1100
+ return b ` <wui-text variant="sm-regular" color="secondary">Details</wui-text>
1101
+ <wui-flex flexDirection="column" gap="1">
1102
+ <wui-list-content
1103
+ textTitle="Address"
1104
+ textValue=${UiHelperUtil.getTruncateString({
1105
+ string: this.receiverAddress ?? '',
1106
+ charsStart: 4,
1107
+ charsEnd: 4,
1108
+ truncate: 'middle'
1109
+ })}
1110
+ >
1111
+ </wui-list-content>
1112
+ ${this.networkTemplate()}
1113
+ </wui-flex>`;
1114
+ }
1115
+ networkTemplate() {
1116
+ if (this.caipNetwork?.name) {
1117
+ return b ` <wui-list-content
1118
+ @click=${() => this.onNetworkClick(this.caipNetwork)}
1119
+ class="network"
1120
+ textTitle="Network"
1121
+ imageSrc=${o(AssetUtil.getNetworkImage(this.caipNetwork))}
1122
+ ></wui-list-content>`;
1123
+ }
1124
+ return null;
1125
+ }
1126
+ onNetworkClick(network) {
1127
+ if (network && !this.params) {
1128
+ RouterController.push('Networks', { network });
1129
+ }
1130
+ }
1131
+ };
1132
+ W3mWalletSendDetails.styles = styles$2;
1133
+ __decorate$2([
1134
+ n$1()
1135
+ ], W3mWalletSendDetails.prototype, "receiverAddress", void 0);
1136
+ __decorate$2([
1137
+ n$1({ type: Object })
1138
+ ], W3mWalletSendDetails.prototype, "caipNetwork", void 0);
1139
+ __decorate$2([
1140
+ r()
1141
+ ], W3mWalletSendDetails.prototype, "params", void 0);
1142
+ W3mWalletSendDetails = __decorate$2([
1143
+ customElement('w3m-wallet-send-details')
1144
+ ], W3mWalletSendDetails);
1145
+
1146
+ var styles$1 = css `
1147
+ wui-avatar,
1148
+ wui-image {
1149
+ display: ruby;
1150
+ width: 32px;
1151
+ height: 32px;
1152
+ border-radius: ${({ borderRadius }) => borderRadius['20']};
1153
+ }
1154
+
1155
+ .sendButton {
1156
+ width: 70%;
1157
+ --local-width: 100% !important;
1158
+ --local-border-radius: ${({ borderRadius }) => borderRadius['4']} !important;
1159
+ }
1160
+
1161
+ .cancelButton {
1162
+ width: 30%;
1163
+ --local-width: 100% !important;
1164
+ --local-border-radius: ${({ borderRadius }) => borderRadius['4']} !important;
1165
+ }
1166
+ `;
1167
+
1168
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1169
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1170
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1171
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1172
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1173
+ };
1174
+ let W3mWalletSendPreviewView = class W3mWalletSendPreviewView extends i {
1175
+ constructor() {
1176
+ super();
1177
+ this.unsubscribe = [];
1178
+ this.token = SendController.state.token;
1179
+ this.sendTokenAmount = SendController.state.sendTokenAmount;
1180
+ this.receiverAddress = SendController.state.receiverAddress;
1181
+ this.receiverProfileName = SendController.state.receiverProfileName;
1182
+ this.receiverProfileImageUrl = SendController.state.receiverProfileImageUrl;
1183
+ this.caipNetwork = ChainController.state.activeCaipNetwork;
1184
+ this.loading = SendController.state.loading;
1185
+ this.params = RouterController.state.data?.send;
1186
+ this.unsubscribe.push(...[
1187
+ SendController.subscribe(val => {
1188
+ this.token = val.token;
1189
+ this.sendTokenAmount = val.sendTokenAmount;
1190
+ this.receiverAddress = val.receiverAddress;
1191
+ this.receiverProfileName = val.receiverProfileName;
1192
+ this.receiverProfileImageUrl = val.receiverProfileImageUrl;
1193
+ this.loading = val.loading;
1194
+ }),
1195
+ ChainController.subscribeKey('activeCaipNetwork', val => (this.caipNetwork = val))
1196
+ ]);
1197
+ }
1198
+ disconnectedCallback() {
1199
+ this.unsubscribe.forEach(unsubscribe => unsubscribe());
1200
+ }
1201
+ render() {
1202
+ return b ` <wui-flex flexDirection="column" .padding=${['0', '4', '4', '4']}>
1203
+ <wui-flex gap="2" flexDirection="column" .padding=${['0', '2', '0', '2']}>
1204
+ <wui-flex alignItems="center" justifyContent="space-between">
1205
+ <wui-flex flexDirection="column" gap="01">
1206
+ <wui-text variant="sm-regular" color="secondary">Send</wui-text>
1207
+ ${this.sendValueTemplate()}
1208
+ </wui-flex>
1209
+ <wui-preview-item
1210
+ text="${this.sendTokenAmount
1211
+ ? UiHelperUtil.roundNumber(this.sendTokenAmount, 6, 5)
1212
+ : 'unknown'} ${this.token?.symbol}"
1213
+ .imageSrc=${this.token?.iconUrl}
1214
+ ></wui-preview-item>
1215
+ </wui-flex>
1216
+ <wui-flex>
1217
+ <wui-icon color="default" size="md" name="arrowBottom"></wui-icon>
1218
+ </wui-flex>
1219
+ <wui-flex alignItems="center" justifyContent="space-between">
1220
+ <wui-text variant="sm-regular" color="secondary">To</wui-text>
1221
+ <wui-preview-item
1222
+ text="${this.receiverProfileName
1223
+ ? UiHelperUtil.getTruncateString({
1224
+ string: this.receiverProfileName,
1225
+ charsStart: 20,
1226
+ charsEnd: 0,
1227
+ truncate: 'end'
1228
+ })
1229
+ : UiHelperUtil.getTruncateString({
1230
+ string: this.receiverAddress ? this.receiverAddress : '',
1231
+ charsStart: 4,
1232
+ charsEnd: 4,
1233
+ truncate: 'middle'
1234
+ })}"
1235
+ address=${this.receiverAddress ?? ''}
1236
+ .imageSrc=${this.receiverProfileImageUrl ?? undefined}
1237
+ .isAddress=${true}
1238
+ ></wui-preview-item>
1239
+ </wui-flex>
1240
+ </wui-flex>
1241
+ <wui-flex flexDirection="column" .padding=${['6', '0', '0', '0']}>
1242
+ <w3m-wallet-send-details
1243
+ .caipNetwork=${this.caipNetwork}
1244
+ .receiverAddress=${this.receiverAddress}
1245
+ ></w3m-wallet-send-details>
1246
+ <wui-flex justifyContent="center" gap="1" .padding=${['3', '0', '0', '0']}>
1247
+ <wui-icon size="sm" color="default" name="warningCircle"></wui-icon>
1248
+ <wui-text variant="sm-regular" color="secondary">Review transaction carefully</wui-text>
1249
+ </wui-flex>
1250
+ <wui-flex justifyContent="center" gap="3" .padding=${['4', '0', '0', '0']}>
1251
+ <wui-button
1252
+ class="cancelButton"
1253
+ @click=${this.onCancelClick.bind(this)}
1254
+ size="lg"
1255
+ variant="neutral-secondary"
1256
+ >
1257
+ Cancel
1258
+ </wui-button>
1259
+ <wui-button
1260
+ class="sendButton"
1261
+ @click=${this.onSendClick.bind(this)}
1262
+ size="lg"
1263
+ variant="accent-primary"
1264
+ .loading=${this.loading}
1265
+ >
1266
+ Send
1267
+ </wui-button>
1268
+ </wui-flex>
1269
+ </wui-flex></wui-flex
1270
+ >`;
1271
+ }
1272
+ sendValueTemplate() {
1273
+ if (!this.params && this.token && this.sendTokenAmount) {
1274
+ const price = this.token.price;
1275
+ const totalValue = price * this.sendTokenAmount;
1276
+ return b `<wui-text variant="md-regular" color="primary"
1277
+ >$${totalValue.toFixed(2)}</wui-text
1278
+ >`;
1279
+ }
1280
+ return null;
1281
+ }
1282
+ async onSendClick() {
1283
+ if (!this.sendTokenAmount || !this.receiverAddress) {
1284
+ SnackController.showError('Please enter a valid amount and receiver address');
1285
+ return;
1286
+ }
1287
+ try {
1288
+ await SendController.sendToken();
1289
+ if (this.params) {
1290
+ RouterController.reset('WalletSendConfirmed');
1291
+ }
1292
+ else {
1293
+ SnackController.showSuccess('Transaction started');
1294
+ RouterController.replace('Account');
1295
+ }
1296
+ }
1297
+ catch (error) {
1298
+ let errMessage = 'Failed to send transaction. Please try again.';
1299
+ const isUserRejectedRequestError = error instanceof AppKitError &&
1300
+ error.originalName === ErrorUtil.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST;
1301
+ if (ChainController.state.activeChain === ConstantsUtil$1.CHAIN.SOLANA ||
1302
+ isUserRejectedRequestError) {
1303
+ if (error instanceof Error) {
1304
+ errMessage = error.message;
1305
+ }
1306
+ }
1307
+ EventsController.sendEvent({
1308
+ type: 'track',
1309
+ event: isUserRejectedRequestError ? 'SEND_REJECTED' : 'SEND_ERROR',
1310
+ properties: SendController.getSdkEventProperties(error)
1311
+ });
1312
+ SnackController.showError(errMessage);
1313
+ }
1314
+ }
1315
+ onCancelClick() {
1316
+ RouterController.goBack();
1317
+ }
1318
+ };
1319
+ W3mWalletSendPreviewView.styles = styles$1;
1320
+ __decorate$1([
1321
+ r()
1322
+ ], W3mWalletSendPreviewView.prototype, "token", void 0);
1323
+ __decorate$1([
1324
+ r()
1325
+ ], W3mWalletSendPreviewView.prototype, "sendTokenAmount", void 0);
1326
+ __decorate$1([
1327
+ r()
1328
+ ], W3mWalletSendPreviewView.prototype, "receiverAddress", void 0);
1329
+ __decorate$1([
1330
+ r()
1331
+ ], W3mWalletSendPreviewView.prototype, "receiverProfileName", void 0);
1332
+ __decorate$1([
1333
+ r()
1334
+ ], W3mWalletSendPreviewView.prototype, "receiverProfileImageUrl", void 0);
1335
+ __decorate$1([
1336
+ r()
1337
+ ], W3mWalletSendPreviewView.prototype, "caipNetwork", void 0);
1338
+ __decorate$1([
1339
+ r()
1340
+ ], W3mWalletSendPreviewView.prototype, "loading", void 0);
1341
+ __decorate$1([
1342
+ r()
1343
+ ], W3mWalletSendPreviewView.prototype, "params", void 0);
1344
+ W3mWalletSendPreviewView = __decorate$1([
1345
+ customElement('w3m-wallet-send-preview-view')
1346
+ ], W3mWalletSendPreviewView);
1347
+
1348
+ var styles = css `
1349
+ .icon-box {
1350
+ width: 64px;
1351
+ height: 64px;
1352
+ border-radius: 16px;
1353
+ background-color: ${({ spacing }) => spacing[16]};
1354
+ border: 8px solid ${({ tokens }) => tokens.theme.borderPrimary};
1355
+ border-radius: ${({ borderRadius }) => borderRadius.round};
1356
+ }
1357
+ `;
1358
+
1359
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1360
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1361
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1362
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1363
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1364
+ };
1365
+ let W3mSendConfirmedView = class W3mSendConfirmedView extends i {
1366
+ constructor() {
1367
+ super();
1368
+ this.unsubscribe = [];
1369
+ this.unsubscribe.push(...[]);
1370
+ }
1371
+ render() {
1372
+ return b `
1373
+ <wui-flex
1374
+ flexDirection="column"
1375
+ alignItems="center"
1376
+ gap="4"
1377
+ .padding="${['1', '3', '4', '3']}"
1378
+ >
1379
+ <wui-flex justifyContent="center" alignItems="center" class="icon-box">
1380
+ <wui-icon size="xxl" color="success" name="checkmark"></wui-icon>
1381
+ </wui-flex>
1382
+
1383
+ <wui-text variant="h6-medium" color="primary">You successfully sent asset</wui-text>
1384
+
1385
+ <wui-button
1386
+ fullWidth
1387
+ @click=${this.onCloseClick.bind(this)}
1388
+ size="lg"
1389
+ variant="neutral-secondary"
1390
+ >
1391
+ Close
1392
+ </wui-button>
1393
+ </wui-flex>
1394
+ `;
1395
+ }
1396
+ onCloseClick() {
1397
+ ModalController.close();
1398
+ }
1399
+ };
1400
+ W3mSendConfirmedView.styles = styles;
1401
+ W3mSendConfirmedView = __decorate([
1402
+ customElement('w3m-send-confirmed-view')
1403
+ ], W3mSendConfirmedView);
1404
+
1405
+ export { W3mSendConfirmedView, W3mSendSelectTokenView, W3mWalletSendPreviewView, W3mWalletSendView };
1406
+ //# sourceMappingURL=send-BCyHM4Zr.js.map
1407
+
1408
+ //# sourceMappingURL=send-BCyHM4Zr.js.map