0xtrails 0.0.1 → 0.0.2

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 (359) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +42 -0
  3. package/dist/abi.d.ts +37 -0
  4. package/dist/abi.d.ts.map +1 -0
  5. package/dist/abi.js +36 -0
  6. package/dist/apiClient.d.ts +9 -0
  7. package/dist/apiClient.d.ts.map +1 -0
  8. package/dist/apiClient.js +18 -0
  9. package/dist/buffer.d.ts +3 -0
  10. package/dist/buffer.d.ts.map +1 -0
  11. package/dist/buffer.js +8 -0
  12. package/dist/cctp.d.ts +84 -0
  13. package/dist/cctp.d.ts.map +1 -0
  14. package/dist/cctp.js +401 -0
  15. package/dist/chainSwitch.d.ts +7 -0
  16. package/dist/chainSwitch.d.ts.map +1 -0
  17. package/dist/chainSwitch.js +33 -0
  18. package/dist/chains.d.ts +13 -0
  19. package/dist/chains.d.ts.map +1 -0
  20. package/dist/chains.js +95 -0
  21. package/dist/constants.d.ts +11 -0
  22. package/dist/constants.d.ts.map +1 -0
  23. package/dist/constants.js +16 -0
  24. package/dist/encoders.d.ts +7 -0
  25. package/dist/encoders.d.ts.map +1 -0
  26. package/dist/encoders.js +8 -0
  27. package/dist/error.d.ts +2 -0
  28. package/dist/error.d.ts.map +1 -0
  29. package/dist/error.js +12 -0
  30. package/dist/explorer.d.ts +12 -0
  31. package/dist/explorer.d.ts.map +1 -0
  32. package/dist/explorer.js +18 -0
  33. package/dist/gasless.d.ts +116 -0
  34. package/dist/gasless.d.ts.map +1 -0
  35. package/dist/gasless.js +297 -0
  36. package/dist/index.d.ts +13 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +9 -0
  39. package/dist/indexerClient.d.ts +9 -0
  40. package/dist/indexerClient.d.ts.map +1 -0
  41. package/dist/indexerClient.js +18 -0
  42. package/dist/intents.d.ts +83 -0
  43. package/dist/intents.d.ts.map +1 -0
  44. package/dist/intents.js +288 -0
  45. package/dist/metaTxnMonitor.d.ts +14 -0
  46. package/dist/metaTxnMonitor.d.ts.map +1 -0
  47. package/dist/metaTxnMonitor.js +121 -0
  48. package/dist/metaTxns.d.ts +6 -0
  49. package/dist/metaTxns.d.ts.map +1 -0
  50. package/dist/metaTxns.js +4 -0
  51. package/dist/paymasterSend.d.ts +90 -0
  52. package/dist/paymasterSend.d.ts.map +1 -0
  53. package/dist/paymasterSend.js +329 -0
  54. package/dist/preconditions.d.ts +11 -0
  55. package/dist/preconditions.d.ts.map +1 -0
  56. package/dist/preconditions.js +29 -0
  57. package/dist/prepareSend.d.ts +102 -0
  58. package/dist/prepareSend.d.ts.map +1 -0
  59. package/dist/prepareSend.js +1080 -0
  60. package/dist/prices.d.ts +18 -0
  61. package/dist/prices.d.ts.map +1 -0
  62. package/dist/prices.js +142 -0
  63. package/dist/queryParams.d.ts +9 -0
  64. package/dist/queryParams.d.ts.map +1 -0
  65. package/dist/queryParams.js +66 -0
  66. package/dist/relaySdk.d.ts +65 -0
  67. package/dist/relaySdk.d.ts.map +1 -0
  68. package/dist/relaySdk.js +314 -0
  69. package/dist/relayer.d.ts +23 -0
  70. package/dist/relayer.d.ts.map +1 -0
  71. package/dist/relayer.js +230 -0
  72. package/dist/sendUserOp.d.ts +140 -0
  73. package/dist/sendUserOp.d.ts.map +1 -0
  74. package/dist/sendUserOp.js +388 -0
  75. package/dist/sequenceWallet.d.ts +79 -0
  76. package/dist/sequenceWallet.d.ts.map +1 -0
  77. package/dist/sequenceWallet.js +374 -0
  78. package/dist/theme.d.ts +3 -0
  79. package/dist/theme.d.ts.map +1 -0
  80. package/dist/theme.js +1 -0
  81. package/dist/toSimpleSmartAccount.d.ts +95 -0
  82. package/dist/toSimpleSmartAccount.d.ts.map +1 -0
  83. package/dist/toSimpleSmartAccount.js +373 -0
  84. package/dist/tokenBalances.d.ts +118 -0
  85. package/dist/tokenBalances.d.ts.map +1 -0
  86. package/dist/tokenBalances.js +492 -0
  87. package/dist/tokens.d.ts +50 -0
  88. package/dist/tokens.d.ts.map +1 -0
  89. package/dist/tokens.js +356 -0
  90. package/dist/trails.d.ts +128 -0
  91. package/dist/trails.d.ts.map +1 -0
  92. package/dist/trails.js +1031 -0
  93. package/dist/umd/trails.min.js +12610 -0
  94. package/dist/umd/trails.min.js.map +1 -0
  95. package/dist/umd.d.ts +24 -0
  96. package/dist/umd.d.ts.map +1 -0
  97. package/dist/utils.d.ts +5 -0
  98. package/dist/utils.d.ts.map +1 -0
  99. package/dist/utils.js +9 -0
  100. package/dist/widget/ConstantsUtil-B-_-u8aQ.js +6 -0
  101. package/dist/widget/add-hVLs3ldJ.js +20 -0
  102. package/dist/widget/all-wallets-Cwxnx4BT.js +11 -0
  103. package/dist/widget/app-store-CAAVQjW0.js +22 -0
  104. package/dist/widget/apple-C3BSbglw.js +23 -0
  105. package/dist/widget/arrow-bottom-circle-BGU9MmsZ.js +16 -0
  106. package/dist/widget/arrow-bottom-hS_SA8Gp.js +13 -0
  107. package/dist/widget/arrow-left-CJZanWz7.js +13 -0
  108. package/dist/widget/arrow-right-C1qL8EMd.js +13 -0
  109. package/dist/widget/arrow-top-CbuCmbQs.js +13 -0
  110. package/dist/widget/bank-CXBEEGbb.js +19 -0
  111. package/dist/widget/bin-Dqzv3zCZ.js +9 -0
  112. package/dist/widget/bitcoin-4y3sovZp.js +18 -0
  113. package/dist/widget/browser-DyOl4_8m.js +1413 -0
  114. package/dist/widget/browser-t7Fh0sEU.js +19 -0
  115. package/dist/widget/card-Bo4CZkTs.js +19 -0
  116. package/dist/widget/ccip-BynehMIN.js +232 -0
  117. package/dist/widget/checkmark-DV6OKvnY.js +16 -0
  118. package/dist/widget/checkmark-bold-CAp1-IQ2.js +13 -0
  119. package/dist/widget/chevron-bottom-BjzsVzk9.js +13 -0
  120. package/dist/widget/chevron-left-CQZBDCiR.js +13 -0
  121. package/dist/widget/chevron-right-Dhg4zeZM.js +13 -0
  122. package/dist/widget/chevron-top-CDQmfJef.js +13 -0
  123. package/dist/widget/chrome-store-BNaC_b6w.js +66 -0
  124. package/dist/widget/circle-BC_GBj91.js +9 -0
  125. package/dist/widget/clock-BmF8-4a0.js +13 -0
  126. package/dist/widget/close-Bf61nZ8o.js +13 -0
  127. package/dist/widget/coinPlaceholder-7cZW2058.js +13 -0
  128. package/dist/widget/compass-CFC3yhnW.js +13 -0
  129. package/dist/widget/components/ChainImage.d.ts +8 -0
  130. package/dist/widget/components/ChainImage.d.ts.map +1 -0
  131. package/dist/widget/components/ChainImage.js +6 -0
  132. package/dist/widget/components/ConnectWallet.d.ts +18 -0
  133. package/dist/widget/components/ConnectWallet.d.ts.map +1 -0
  134. package/dist/widget/components/ConnectWallet.js +66 -0
  135. package/dist/widget/components/DebugScreensDropdown.d.ts +9 -0
  136. package/dist/widget/components/DebugScreensDropdown.d.ts.map +1 -0
  137. package/dist/widget/components/DebugScreensDropdown.js +40 -0
  138. package/dist/widget/components/FeeOptions.d.ts +17 -0
  139. package/dist/widget/components/FeeOptions.d.ts.map +1 -0
  140. package/dist/widget/components/FeeOptions.js +65 -0
  141. package/dist/widget/components/Footer.d.ts +9 -0
  142. package/dist/widget/components/Footer.d.ts.map +1 -0
  143. package/dist/widget/components/Footer.js +13 -0
  144. package/dist/widget/components/GreenCheckAnimation.d.ts +2 -0
  145. package/dist/widget/components/GreenCheckAnimation.d.ts.map +1 -0
  146. package/dist/widget/components/GreenCheckAnimation.js +74 -0
  147. package/dist/widget/components/Modal.d.ts +11 -0
  148. package/dist/widget/components/Modal.d.ts.map +1 -0
  149. package/dist/widget/components/Modal.js +36 -0
  150. package/dist/widget/components/Receipt.d.ts +13 -0
  151. package/dist/widget/components/Receipt.d.ts.map +1 -0
  152. package/dist/widget/components/Receipt.js +36 -0
  153. package/dist/widget/components/SendForm.d.ts +44 -0
  154. package/dist/widget/components/SendForm.d.ts.map +1 -0
  155. package/dist/widget/components/SendForm.js +177 -0
  156. package/dist/widget/components/TokenImage.d.ts +10 -0
  157. package/dist/widget/components/TokenImage.d.ts.map +1 -0
  158. package/dist/widget/components/TokenImage.js +8 -0
  159. package/dist/widget/components/TokenList.d.ts +16 -0
  160. package/dist/widget/components/TokenList.d.ts.map +1 -0
  161. package/dist/widget/components/TokenList.js +39 -0
  162. package/dist/widget/components/TransferPending.d.ts +11 -0
  163. package/dist/widget/components/TransferPending.d.ts.map +1 -0
  164. package/dist/widget/components/TransferPending.js +77 -0
  165. package/dist/widget/components/TransferPendingVertical.d.ts +18 -0
  166. package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -0
  167. package/dist/widget/components/TransferPendingVertical.js +183 -0
  168. package/dist/widget/components/WalletConfirmation.d.ts +18 -0
  169. package/dist/widget/components/WalletConfirmation.d.ts.map +1 -0
  170. package/dist/widget/components/WalletConfirmation.js +22 -0
  171. package/dist/widget/config.d.ts +4 -0
  172. package/dist/widget/config.d.ts.map +1 -0
  173. package/dist/widget/config.js +3 -0
  174. package/dist/widget/copy-e0xXvKN0.js +20 -0
  175. package/dist/widget/cursor-CqM3v0xJ.js +8 -0
  176. package/dist/widget/cursor-transparent-CUQpdsCG.js +17 -0
  177. package/dist/widget/desktop-DUDGIRpM.js +14 -0
  178. package/dist/widget/disconnect-DUFST9QQ.js +13 -0
  179. package/dist/widget/discord-C1cj365Z.js +22 -0
  180. package/dist/widget/email-BHhmb_lX.js +703 -0
  181. package/dist/widget/embedded-wallet-CuuC4eah.js +467 -0
  182. package/dist/widget/ethereum-CfmBVfeB.js +15 -0
  183. package/dist/widget/etherscan-BSiynDhW.js +11 -0
  184. package/dist/widget/exclamation-triangle-DEiFNpHw.js +9 -0
  185. package/dist/widget/extension-mRmfCDxo.js +13 -0
  186. package/dist/widget/external-link-B4xMIVnW.js +13 -0
  187. package/dist/widget/facebook-CBAZStBR.js +31 -0
  188. package/dist/widget/farcaster-LHDEDf5S.js +17 -0
  189. package/dist/widget/filters-CBijuvFv.js +13 -0
  190. package/dist/widget/github-C3ILD420.js +23 -0
  191. package/dist/widget/google-CSj73POX.js +23 -0
  192. package/dist/widget/help-circle-2hdG5IdB.js +17 -0
  193. package/dist/widget/hooks/useAmountUsd.d.ts +13 -0
  194. package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -0
  195. package/dist/widget/hooks/useAmountUsd.js +35 -0
  196. package/dist/widget/hooks/useSendForm.d.ts +125 -0
  197. package/dist/widget/hooks/useSendForm.d.ts.map +1 -0
  198. package/dist/widget/hooks/useSendForm.js +450 -0
  199. package/dist/widget/hooks/useTokenList.d.ts +52 -0
  200. package/dist/widget/hooks/useTokenList.d.ts.map +1 -0
  201. package/dist/widget/hooks/useTokenList.js +252 -0
  202. package/dist/widget/id-ByYSrwsd.js +17 -0
  203. package/dist/widget/if-defined-DRXJEhv7.js +752 -0
  204. package/dist/widget/image-C90L4Rf6.js +9 -0
  205. package/dist/widget/index-B3SlQ9v3.js +46 -0
  206. package/dist/widget/index-B8LPuLXQ.js +78 -0
  207. package/dist/widget/index-BDbworWA.js +171 -0
  208. package/dist/widget/index-BTlDgFSK.js +98 -0
  209. package/dist/widget/index-BUCcjXbd.js +306 -0
  210. package/dist/widget/index-BZ34edi2.js +1055 -0
  211. package/dist/widget/index-BiCU29wK.js +147 -0
  212. package/dist/widget/index-BlmqIKsY.js +266 -0
  213. package/dist/widget/index-BlviH5nG.js +55 -0
  214. package/dist/widget/index-Bwd5X3fS.js +8306 -0
  215. package/dist/widget/index-C5gmknHK.js +78 -0
  216. package/dist/widget/index-CD6dBcRj.js +76 -0
  217. package/dist/widget/index-CDlhy529.js +63 -0
  218. package/dist/widget/index-CHXa5ke-.js +59 -0
  219. package/dist/widget/index-CK94R-H7.js +22498 -0
  220. package/dist/widget/index-CQzo3m3x.js +182 -0
  221. package/dist/widget/index-CRT8cAwG.js +325 -0
  222. package/dist/widget/index-CY7Lt2Yu.js +310 -0
  223. package/dist/widget/index-CiKfAu1E.js +79 -0
  224. package/dist/widget/index-CkCu6rMi.js +258 -0
  225. package/dist/widget/index-CngLTu_R.js +517 -0
  226. package/dist/widget/index-CsMV8-em.js +2577 -0
  227. package/dist/widget/index-Cu2Wva8v.js +200 -0
  228. package/dist/widget/index-DKBxLTEF.js +240 -0
  229. package/dist/widget/index-DQEVT3dx.js +511 -0
  230. package/dist/widget/index-DU2HcCis.js +200 -0
  231. package/dist/widget/index-DutZGWNW.js +321 -0
  232. package/dist/widget/index-O0glArmc.js +182 -0
  233. package/dist/widget/index-O8FmRjKe.js +63719 -0
  234. package/dist/widget/index-RtKXrB6I.js +576 -0
  235. package/dist/widget/index-TIYtS0gE.js +88 -0
  236. package/dist/widget/index-dQNJvWHs.js +66 -0
  237. package/dist/widget/index-wmEwdsq7.js +909 -0
  238. package/dist/widget/index.d.ts +3 -0
  239. package/dist/widget/index.d.ts.map +1 -0
  240. package/dist/widget/index.js +2 -0
  241. package/dist/widget/info-DMPChDjV.js +8 -0
  242. package/dist/widget/info-circle-DAvS_7nY.js +17 -0
  243. package/dist/widget/lightbulb-DnZ9mNEs.js +8 -0
  244. package/dist/widget/lit-html-BRjl1r6K.js +243 -0
  245. package/dist/widget/mail-DpaVSOP8.js +13 -0
  246. package/dist/widget/mobile-CRvdyu7I.js +14 -0
  247. package/dist/widget/more-C5VqW9PR.js +16 -0
  248. package/dist/widget/network-placeholder-CZ0vApma.js +19 -0
  249. package/dist/widget/nftPlaceholder-7jjIK2bT.js +13 -0
  250. package/dist/widget/off-4mHjJLLX.js +9 -0
  251. package/dist/widget/onramp-Bc0ozVsw.js +929 -0
  252. package/dist/widget/play-store-Uocul8nC.js +37 -0
  253. package/dist/widget/plus-DrYF7siO.js +18 -0
  254. package/dist/widget/prepareSend-BQJmzM5B.js +54987 -0
  255. package/dist/widget/qr-code-DcnGMUB3.js +11 -0
  256. package/dist/widget/receive-fvIVd7R_.js +184 -0
  257. package/dist/widget/recycle-horizontal-DrDwXC4D.js +14 -0
  258. package/dist/widget/ref-CXNmEjML.js +41 -0
  259. package/dist/widget/refresh-OK9lIPLS.js +13 -0
  260. package/dist/widget/reown-logo-C-Qn7mS3.js +17 -0
  261. package/dist/widget/search-DZqv1oKg.js +13 -0
  262. package/dist/widget/send-CJlmI-xe.js +1039 -0
  263. package/dist/widget/send-otoEC8uU.js +20 -0
  264. package/dist/widget/socials-BJciurWF.js +599 -0
  265. package/dist/widget/solana-Bv5Hs_0T.js +18 -0
  266. package/dist/widget/swapHorizontal-BzOPGV37.js +13 -0
  267. package/dist/widget/swapHorizontalBold-axyHnSmj.js +13 -0
  268. package/dist/widget/swapHorizontalMedium-C6YOPfPz.js +21 -0
  269. package/dist/widget/swapHorizontalRoundedBold-yVcLbWNT.js +13 -0
  270. package/dist/widget/swapVertical-BDjxt9pE.js +13 -0
  271. package/dist/widget/swaps-DEWNj4kd.js +1637 -0
  272. package/dist/widget/telegram-BQJD7dlP.js +21 -0
  273. package/dist/widget/three-dots-DW9jmSMG.js +10 -0
  274. package/dist/widget/transactions-uCseGQQt.js +38 -0
  275. package/dist/widget/twitch-XugxDfOE.js +23 -0
  276. package/dist/widget/twitterIcon-DQVObQUL.js +11 -0
  277. package/dist/widget/types.d.ts +51 -0
  278. package/dist/widget/types.d.ts.map +1 -0
  279. package/dist/widget/types.js +1 -0
  280. package/dist/widget/verify-DpMYHxLf.js +13 -0
  281. package/dist/widget/verify-filled-KpEL6ZJ_.js +13 -0
  282. package/dist/widget/w3m-modal-C8e-6Kba.js +1047 -0
  283. package/dist/widget/wallet-D8ssEB0o.js +13 -0
  284. package/dist/widget/wallet-placeholder-HtAy21Wc.js +19 -0
  285. package/dist/widget/walletconnect-Bp_4XfrY.js +37 -0
  286. package/dist/widget/warning-circle-FgYS7P7n.js +17 -0
  287. package/dist/widget/widget/index.js +7 -0
  288. package/dist/widget/widget.d.ts +47 -0
  289. package/dist/widget/widget.d.ts.map +1 -0
  290. package/dist/widget/widget.js +932 -0
  291. package/dist/widget/x-DlZBoP9k.js +17 -0
  292. package/dist/widget/x-mark-Ba9pt-_h.js +8 -0
  293. package/package.json +102 -8
  294. package/src/abi.ts +38 -0
  295. package/src/apiClient.ts +32 -0
  296. package/src/buffer.ts +10 -0
  297. package/src/cctp.ts +579 -0
  298. package/src/chainSwitch.ts +55 -0
  299. package/src/chains.ts +124 -0
  300. package/src/constants.ts +26 -0
  301. package/src/encoders.ts +20 -0
  302. package/src/error.ts +15 -0
  303. package/src/explorer.ts +37 -0
  304. package/src/gasless.ts +545 -0
  305. package/src/index.ts +48 -0
  306. package/src/indexerClient.ts +36 -0
  307. package/src/intents.ts +537 -0
  308. package/src/metaTxnMonitor.ts +163 -0
  309. package/src/metaTxns.ts +21 -0
  310. package/src/paymasterSend.ts +503 -0
  311. package/src/preconditions.ts +52 -0
  312. package/src/prepareSend.ts +1849 -0
  313. package/src/prices.ts +186 -0
  314. package/src/queryParams.ts +80 -0
  315. package/src/relaySdk.ts +481 -0
  316. package/src/relayer.ts +255 -0
  317. package/src/sendUserOp.ts +570 -0
  318. package/src/sequenceWallet.ts +579 -0
  319. package/src/theme.ts +2 -0
  320. package/src/toSimpleSmartAccount.ts +567 -0
  321. package/src/tokenBalances.ts +760 -0
  322. package/src/tokens.ts +471 -0
  323. package/src/trails.ts +1591 -0
  324. package/src/types.d.ts +11 -0
  325. package/src/umd.tsx +49 -0
  326. package/src/utils.ts +16 -0
  327. package/src/vite-env.d.ts +4 -0
  328. package/src/widget/assets/MetaMask-icon-fox-with-margins.svg +31 -0
  329. package/src/widget/assets/MetaMask-icon-fox.svg +26 -0
  330. package/src/widget/assets/MetaMask-logo-black.svg +3 -0
  331. package/src/widget/assets/MetaMask-logo-white.svg +16 -0
  332. package/src/widget/assets/Privy_Brandmark_Black.svg +9 -0
  333. package/src/widget/assets/Privy_Brandmark_White.svg +9 -0
  334. package/src/widget/assets/Trails-logo-black.svg +11 -0
  335. package/src/widget/assets/Trails-logo-white.svg +11 -0
  336. package/src/widget/components/ChainImage.tsx +28 -0
  337. package/src/widget/components/ConnectWallet.tsx +206 -0
  338. package/src/widget/components/DebugScreensDropdown.tsx +88 -0
  339. package/src/widget/components/FeeOptions.tsx +199 -0
  340. package/src/widget/components/Footer.tsx +51 -0
  341. package/src/widget/components/GreenCheckAnimation.tsx +119 -0
  342. package/src/widget/components/Modal.tsx +97 -0
  343. package/src/widget/components/Receipt.tsx +237 -0
  344. package/src/widget/components/SendForm.tsx +695 -0
  345. package/src/widget/components/TokenImage.tsx +37 -0
  346. package/src/widget/components/TokenList.tsx +287 -0
  347. package/src/widget/components/TransferPending.tsx +204 -0
  348. package/src/widget/components/TransferPendingVertical.tsx +412 -0
  349. package/src/widget/components/WalletConfirmation.tsx +172 -0
  350. package/src/widget/config.ts +5 -0
  351. package/src/widget/hooks/useAmountUsd.ts +59 -0
  352. package/src/widget/hooks/useSendForm.ts +715 -0
  353. package/src/widget/hooks/useTokenList.ts +397 -0
  354. package/src/widget/index.css +2 -0
  355. package/src/widget/index.tsx +8 -0
  356. package/src/widget/types/svg.d.ts +8 -0
  357. package/src/widget/types.ts +59 -0
  358. package/src/widget/widget.tsx +1438 -0
  359. package/index.js +0 -1
@@ -0,0 +1,511 @@
1
+ import { N as l, w as V, v as $, R as A, S as g, l as B, c as S, e as x, f as F, W as M, h, B as v, d as W, x as C, A as H, o as j, y as q, b as G, z as Q, C as K, D as Y, F as J, i as X, r as Z, j as ee, a as oe } from "./index-CK94R-H7.js";
2
+ import { x as L } from "./lit-html-BRjl1r6K.js";
3
+ import { n as z, c as ne } from "./if-defined-DRXJEhv7.js";
4
+ import "./index-CDlhy529.js";
5
+ import "./index-CD6dBcRj.js";
6
+ const P = {
7
+ getGasPriceInEther(o, t) {
8
+ const n = t * o;
9
+ return Number(n) / 1e18;
10
+ },
11
+ getGasPriceInUSD(o, t, n) {
12
+ const s = P.getGasPriceInEther(t, n);
13
+ return l.bigNumber(o).times(s).toNumber();
14
+ },
15
+ getPriceImpact({ sourceTokenAmount: o, sourceTokenPriceInUSD: t, toTokenPriceInUSD: n, toTokenAmount: s }) {
16
+ const i = l.bigNumber(o).times(t), r = l.bigNumber(s).times(n);
17
+ return i.minus(r).div(i).times(100).toNumber();
18
+ },
19
+ getMaxSlippage(o, t) {
20
+ const n = l.bigNumber(o).div(100);
21
+ return l.multiply(t, n).toNumber();
22
+ },
23
+ getProviderFee(o, t = 85e-4) {
24
+ return l.bigNumber(o).times(t).toString();
25
+ },
26
+ isInsufficientNetworkTokenForGas(o, t) {
27
+ const n = t || "0";
28
+ return l.bigNumber(o).eq(0) ? !0 : l.bigNumber(l.bigNumber(n)).gt(o);
29
+ },
30
+ isInsufficientSourceTokenForSwap(o, t, n) {
31
+ var r, u;
32
+ const s = (u = (r = n == null ? void 0 : n.find((c) => c.address === t)) == null ? void 0 : r.quantity) == null ? void 0 : u.numeric;
33
+ return l.bigNumber(s || "0").lt(o);
34
+ },
35
+ getToTokenAmount({ sourceToken: o, toToken: t, sourceTokenPrice: n, toTokenPrice: s, sourceTokenAmount: i }) {
36
+ if (i === "0" || !o || !t)
37
+ return "0";
38
+ const r = o.decimals, u = n, c = t.decimals, d = s;
39
+ if (d <= 0)
40
+ return "0";
41
+ const T = l.bigNumber(i).times(85e-4), f = l.bigNumber(i).minus(T).times(l.bigNumber(10).pow(r)), w = l.bigNumber(u).div(d), b = r - c;
42
+ return f.times(w).div(l.bigNumber(10).pow(b)).div(l.bigNumber(10).pow(c)).toFixed(c).toString();
43
+ }
44
+ }, R = 15e4, te = 6, k = {
45
+ // Loading states
46
+ initializing: !1,
47
+ initialized: !1,
48
+ loadingPrices: !1,
49
+ loadingQuote: !1,
50
+ loadingApprovalTransaction: !1,
51
+ loadingBuildTransaction: !1,
52
+ loadingTransaction: !1,
53
+ // Error states
54
+ fetchError: !1,
55
+ // Approval & Swap transaction states
56
+ approvalTransaction: void 0,
57
+ swapTransaction: void 0,
58
+ transactionError: void 0,
59
+ // Input values
60
+ sourceToken: void 0,
61
+ sourceTokenAmount: "",
62
+ sourceTokenPriceInUSD: 0,
63
+ toToken: void 0,
64
+ toTokenAmount: "",
65
+ toTokenPriceInUSD: 0,
66
+ networkPrice: "0",
67
+ networkBalanceInUSD: "0",
68
+ networkTokenSymbol: "",
69
+ inputError: void 0,
70
+ // Request values
71
+ slippage: G.CONVERT_SLIPPAGE_TOLERANCE,
72
+ // Tokens
73
+ tokens: void 0,
74
+ popularTokens: void 0,
75
+ suggestedTokens: void 0,
76
+ foundTokens: void 0,
77
+ myTokensWithBalance: void 0,
78
+ tokensPriceMap: {},
79
+ // Calculations
80
+ gasFee: "0",
81
+ gasPriceInUSD: 0,
82
+ priceImpact: void 0,
83
+ maxSlippage: void 0,
84
+ providerFee: void 0
85
+ }, e = $(k), N = {
86
+ state: e,
87
+ subscribe(o) {
88
+ return J(e, () => o(e));
89
+ },
90
+ subscribeKey(o, t) {
91
+ return Y(e, o, t);
92
+ },
93
+ getParams() {
94
+ var c, d, T, m, f, w, b, I;
95
+ const o = h.state.activeCaipAddress, t = W.getPlainAddress(o), n = Q(), s = K.getConnectorId(h.state.activeChain);
96
+ if (!t)
97
+ throw new Error("No address found to swap the tokens from.");
98
+ const i = !((c = e.toToken) != null && c.address) || !((d = e.toToken) != null && d.decimals), r = !((T = e.sourceToken) != null && T.address) || !((m = e.sourceToken) != null && m.decimals) || !l.bigNumber(e.sourceTokenAmount).gt(0), u = !e.sourceTokenAmount;
99
+ return {
100
+ networkAddress: n,
101
+ fromAddress: t,
102
+ fromCaipAddress: o,
103
+ sourceTokenAddress: (f = e.sourceToken) == null ? void 0 : f.address,
104
+ toTokenAddress: (w = e.toToken) == null ? void 0 : w.address,
105
+ toTokenAmount: e.toTokenAmount,
106
+ toTokenDecimals: (b = e.toToken) == null ? void 0 : b.decimals,
107
+ sourceTokenAmount: e.sourceTokenAmount,
108
+ sourceTokenDecimals: (I = e.sourceToken) == null ? void 0 : I.decimals,
109
+ invalidToToken: i,
110
+ invalidSourceToken: r,
111
+ invalidSourceTokenAmount: u,
112
+ availableToSwap: o && !i && !r && !u,
113
+ isAuthConnector: s === S.CONNECTOR_ID.AUTH
114
+ };
115
+ },
116
+ setSourceToken(o) {
117
+ if (!o) {
118
+ e.sourceToken = o, e.sourceTokenAmount = "", e.sourceTokenPriceInUSD = 0;
119
+ return;
120
+ }
121
+ e.sourceToken = o, a.setTokenPrice(o.address, "sourceToken");
122
+ },
123
+ setSourceTokenAmount(o) {
124
+ e.sourceTokenAmount = o;
125
+ },
126
+ setToToken(o) {
127
+ if (!o) {
128
+ e.toToken = o, e.toTokenAmount = "", e.toTokenPriceInUSD = 0;
129
+ return;
130
+ }
131
+ e.toToken = o, a.setTokenPrice(o.address, "toToken");
132
+ },
133
+ setToTokenAmount(o) {
134
+ e.toTokenAmount = o ? l.formatNumberToLocalString(o, te) : "";
135
+ },
136
+ async setTokenPrice(o, t) {
137
+ let n = e.tokensPriceMap[o] || 0;
138
+ n || (e.loadingPrices = !0, n = await a.getAddressPrice(o)), t === "sourceToken" ? e.sourceTokenPriceInUSD = n : t === "toToken" && (e.toTokenPriceInUSD = n), e.loadingPrices && (e.loadingPrices = !1), a.getParams().availableToSwap && a.swapTokens();
139
+ },
140
+ switchTokens() {
141
+ if (e.initializing || !e.initialized)
142
+ return;
143
+ const o = e.toToken ? { ...e.toToken } : void 0, t = e.sourceToken ? { ...e.sourceToken } : void 0, n = o && e.toTokenAmount === "" ? "1" : e.toTokenAmount;
144
+ a.setSourceToken(o), a.setToToken(t), a.setSourceTokenAmount(n), a.setToTokenAmount(""), a.swapTokens();
145
+ },
146
+ resetState() {
147
+ e.myTokensWithBalance = k.myTokensWithBalance, e.tokensPriceMap = k.tokensPriceMap, e.initialized = k.initialized, e.sourceToken = k.sourceToken, e.sourceTokenAmount = k.sourceTokenAmount, e.sourceTokenPriceInUSD = k.sourceTokenPriceInUSD, e.toToken = k.toToken, e.toTokenAmount = k.toTokenAmount, e.toTokenPriceInUSD = k.toTokenPriceInUSD, e.networkPrice = k.networkPrice, e.networkTokenSymbol = k.networkTokenSymbol, e.networkBalanceInUSD = k.networkBalanceInUSD, e.inputError = k.inputError, e.myTokensWithBalance = k.myTokensWithBalance;
148
+ },
149
+ resetValues() {
150
+ var n;
151
+ const { networkAddress: o } = a.getParams(), t = (n = e.tokens) == null ? void 0 : n.find((s) => s.address === o);
152
+ a.setSourceToken(t), a.setToToken(void 0);
153
+ },
154
+ getApprovalLoadingState() {
155
+ return e.loadingApprovalTransaction;
156
+ },
157
+ clearError() {
158
+ e.transactionError = void 0;
159
+ },
160
+ async initializeState() {
161
+ if (!e.initializing) {
162
+ if (e.initializing = !0, !e.initialized)
163
+ try {
164
+ await a.fetchTokens(), e.initialized = !0;
165
+ } catch {
166
+ e.initialized = !1, g.showError("Failed to initialize swap"), A.goBack();
167
+ }
168
+ e.initializing = !1;
169
+ }
170
+ },
171
+ async fetchTokens() {
172
+ var n;
173
+ const { networkAddress: o } = a.getParams();
174
+ await a.getTokenList(), await a.getNetworkTokenPrice(), await a.getMyTokensWithBalance();
175
+ const t = (n = e.tokens) == null ? void 0 : n.find((s) => s.address === o);
176
+ t && (e.networkTokenSymbol = t.symbol, a.setSourceToken(t), a.setSourceTokenAmount("1"));
177
+ },
178
+ async getTokenList() {
179
+ const o = await C.getTokenList();
180
+ e.tokens = o, e.popularTokens = o.sort((t, n) => t.symbol < n.symbol ? -1 : t.symbol > n.symbol ? 1 : 0), e.suggestedTokens = o.filter((t) => !!G.SWAP_SUGGESTED_TOKENS.includes(t.symbol), {});
181
+ },
182
+ async getAddressPrice(o) {
183
+ var d, T;
184
+ const t = e.tokensPriceMap[o];
185
+ if (t)
186
+ return t;
187
+ const n = await v.fetchTokenPrice({
188
+ addresses: [o]
189
+ }), s = (n == null ? void 0 : n.fungibles) || [], i = [...e.tokens || [], ...e.myTokensWithBalance || []], r = (d = i == null ? void 0 : i.find((m) => m.address === o)) == null ? void 0 : d.symbol, u = ((T = s.find((m) => m.symbol.toLowerCase() === (r == null ? void 0 : r.toLowerCase()))) == null ? void 0 : T.price) || 0, c = parseFloat(u.toString());
190
+ return e.tokensPriceMap[o] = c, c;
191
+ },
192
+ async getNetworkTokenPrice() {
193
+ var i;
194
+ const { networkAddress: o } = a.getParams(), n = (i = (await v.fetchTokenPrice({
195
+ addresses: [o]
196
+ }).catch(() => (g.showError("Failed to fetch network token price"), { fungibles: [] }))).fungibles) == null ? void 0 : i[0], s = (n == null ? void 0 : n.price.toString()) || "0";
197
+ e.tokensPriceMap[o] = parseFloat(s), e.networkTokenSymbol = (n == null ? void 0 : n.symbol) || "", e.networkPrice = s;
198
+ },
199
+ async getMyTokensWithBalance(o) {
200
+ const t = await q.getMyTokensWithBalance(o), n = C.mapBalancesToSwapTokens(t);
201
+ n && (await a.getInitialGasPrice(), a.setBalances(n));
202
+ },
203
+ setBalances(o) {
204
+ const { networkAddress: t } = a.getParams(), n = h.state.activeCaipNetwork;
205
+ if (!n)
206
+ return;
207
+ const s = o.find((i) => i.address === t);
208
+ o.forEach((i) => {
209
+ e.tokensPriceMap[i.address] = i.price || 0;
210
+ }), e.myTokensWithBalance = o.filter((i) => i.address.startsWith(n.caipNetworkId)), e.networkBalanceInUSD = s ? l.multiply(s.quantity.numeric, s.price).toString() : "0";
211
+ },
212
+ async getInitialGasPrice() {
213
+ var t, n;
214
+ const o = await C.fetchGasPrice();
215
+ if (!o)
216
+ return { gasPrice: null, gasPriceInUSD: null };
217
+ switch ((n = (t = h.state) == null ? void 0 : t.activeCaipNetwork) == null ? void 0 : n.chainNamespace) {
218
+ case S.CHAIN.SOLANA:
219
+ return e.gasFee = o.standard ?? "0", e.gasPriceInUSD = l.multiply(o.standard, e.networkPrice).div(1e9).toNumber(), {
220
+ gasPrice: BigInt(e.gasFee),
221
+ gasPriceInUSD: Number(e.gasPriceInUSD)
222
+ };
223
+ case S.CHAIN.EVM:
224
+ default:
225
+ const s = o.standard ?? "0", i = BigInt(s), r = BigInt(R), u = P.getGasPriceInUSD(e.networkPrice, r, i);
226
+ return e.gasFee = s, e.gasPriceInUSD = u, { gasPrice: i, gasPriceInUSD: u };
227
+ }
228
+ },
229
+ // -- Swap -------------------------------------- //
230
+ async swapTokens() {
231
+ var r, u;
232
+ const o = H.state.address, t = e.sourceToken, n = e.toToken, s = l.bigNumber(e.sourceTokenAmount).gt(0);
233
+ if (s || a.setToTokenAmount(""), !n || !t || e.loadingPrices || !s)
234
+ return;
235
+ e.loadingQuote = !0;
236
+ const i = l.bigNumber(e.sourceTokenAmount).times(10 ** t.decimals).round(0);
237
+ try {
238
+ const c = await v.fetchSwapQuote({
239
+ userAddress: o,
240
+ from: t.address,
241
+ to: n.address,
242
+ gasPrice: e.gasFee,
243
+ amount: i.toString()
244
+ });
245
+ e.loadingQuote = !1;
246
+ const d = (u = (r = c == null ? void 0 : c.quotes) == null ? void 0 : r[0]) == null ? void 0 : u.toAmount;
247
+ if (!d) {
248
+ j.open({
249
+ shortMessage: "Incorrect amount",
250
+ longMessage: "Please enter a valid amount"
251
+ }, "error");
252
+ return;
253
+ }
254
+ const T = l.bigNumber(d).div(10 ** n.decimals).toString();
255
+ a.setToTokenAmount(T), a.hasInsufficientToken(e.sourceTokenAmount, t.address) ? e.inputError = "Insufficient balance" : (e.inputError = void 0, a.setTransactionDetails());
256
+ } catch {
257
+ e.loadingQuote = !1, e.inputError = "Insufficient balance";
258
+ }
259
+ },
260
+ // -- Create Transactions -------------------------------------- //
261
+ async getTransaction() {
262
+ const { fromCaipAddress: o, availableToSwap: t } = a.getParams(), n = e.sourceToken, s = e.toToken;
263
+ if (!(!o || !t || !n || !s || e.loadingQuote))
264
+ try {
265
+ e.loadingBuildTransaction = !0;
266
+ const i = await C.fetchSwapAllowance({
267
+ userAddress: o,
268
+ tokenAddress: n.address,
269
+ sourceTokenAmount: e.sourceTokenAmount,
270
+ sourceTokenDecimals: n.decimals
271
+ });
272
+ let r;
273
+ return i ? r = await a.createSwapTransaction() : r = await a.createAllowanceTransaction(), e.loadingBuildTransaction = !1, e.fetchError = !1, r;
274
+ } catch {
275
+ A.goBack(), g.showError("Failed to check allowance"), e.loadingBuildTransaction = !1, e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
276
+ return;
277
+ }
278
+ },
279
+ async createAllowanceTransaction() {
280
+ const { fromCaipAddress: o, sourceTokenAddress: t, toTokenAddress: n } = a.getParams();
281
+ if (!(!o || !n)) {
282
+ if (!t)
283
+ throw new Error("createAllowanceTransaction - No source token address found.");
284
+ try {
285
+ const s = await v.generateApproveCalldata({
286
+ from: t,
287
+ to: n,
288
+ userAddress: o
289
+ }), i = W.getPlainAddress(s.tx.from);
290
+ if (!i)
291
+ throw new Error("SwapController:createAllowanceTransaction - address is required");
292
+ const r = {
293
+ data: s.tx.data,
294
+ to: i,
295
+ gasPrice: BigInt(s.tx.eip155.gasPrice),
296
+ value: BigInt(s.tx.value),
297
+ toAmount: e.toTokenAmount
298
+ };
299
+ return e.swapTransaction = void 0, e.approvalTransaction = {
300
+ data: r.data,
301
+ to: r.to,
302
+ gasPrice: r.gasPrice,
303
+ value: r.value,
304
+ toAmount: r.toAmount
305
+ }, {
306
+ data: r.data,
307
+ to: r.to,
308
+ gasPrice: r.gasPrice,
309
+ value: r.value,
310
+ toAmount: r.toAmount
311
+ };
312
+ } catch {
313
+ A.goBack(), g.showError("Failed to create approval transaction"), e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
314
+ return;
315
+ }
316
+ }
317
+ },
318
+ async createSwapTransaction() {
319
+ var u;
320
+ const { networkAddress: o, fromCaipAddress: t, sourceTokenAmount: n } = a.getParams(), s = e.sourceToken, i = e.toToken;
321
+ if (!t || !n || !s || !i)
322
+ return;
323
+ const r = (u = B.parseUnits(n, s.decimals)) == null ? void 0 : u.toString();
324
+ try {
325
+ const c = await v.generateSwapCalldata({
326
+ userAddress: t,
327
+ from: s.address,
328
+ to: i.address,
329
+ amount: r,
330
+ disableEstimate: !0
331
+ }), d = s.address === o, T = BigInt(c.tx.eip155.gas), m = BigInt(c.tx.eip155.gasPrice), f = W.getPlainAddress(c.tx.to);
332
+ if (!f)
333
+ throw new Error("SwapController:createSwapTransaction - address is required");
334
+ const w = {
335
+ data: c.tx.data,
336
+ to: f,
337
+ gas: T,
338
+ gasPrice: m,
339
+ value: BigInt(d ? r ?? "0" : "0"),
340
+ toAmount: e.toTokenAmount
341
+ };
342
+ return e.gasPriceInUSD = P.getGasPriceInUSD(e.networkPrice, T, m), e.approvalTransaction = void 0, e.swapTransaction = w, w;
343
+ } catch {
344
+ A.goBack(), g.showError("Failed to create transaction"), e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
345
+ return;
346
+ }
347
+ },
348
+ onEmbeddedWalletApprovalSuccess() {
349
+ g.showLoading("Approve limit increase in your wallet"), A.replace("SwapPreview");
350
+ },
351
+ // -- Send Transactions --------------------------------- //
352
+ async sendTransactionForApproval(o) {
353
+ var i, r, u;
354
+ const { fromAddress: t, isAuthConnector: n } = a.getParams();
355
+ e.loadingApprovalTransaction = !0, n ? A.pushTransactionStack({
356
+ onSuccess: a.onEmbeddedWalletApprovalSuccess
357
+ }) : g.showLoading("Approve limit increase in your wallet");
358
+ try {
359
+ await B.sendTransaction({
360
+ address: t,
361
+ to: o.to,
362
+ data: o.data,
363
+ value: o.value,
364
+ chainNamespace: S.CHAIN.EVM
365
+ }), await a.swapTokens(), await a.getTransaction(), e.approvalTransaction = void 0, e.loadingApprovalTransaction = !1;
366
+ } catch (c) {
367
+ const d = c;
368
+ e.transactionError = d == null ? void 0 : d.shortMessage, e.loadingApprovalTransaction = !1, g.showError((d == null ? void 0 : d.shortMessage) || "Transaction error"), x.sendEvent({
369
+ type: "track",
370
+ event: "SWAP_APPROVAL_ERROR",
371
+ properties: {
372
+ message: (d == null ? void 0 : d.shortMessage) || (d == null ? void 0 : d.message) || "Unknown",
373
+ network: ((i = h.state.activeCaipNetwork) == null ? void 0 : i.caipNetworkId) || "",
374
+ swapFromToken: ((r = a.state.sourceToken) == null ? void 0 : r.symbol) || "",
375
+ swapToToken: ((u = a.state.toToken) == null ? void 0 : u.symbol) || "",
376
+ swapFromAmount: a.state.sourceTokenAmount || "",
377
+ swapToAmount: a.state.toTokenAmount || "",
378
+ isSmartAccount: F(S.CHAIN.EVM) === M.ACCOUNT_TYPES.SMART_ACCOUNT
379
+ }
380
+ });
381
+ }
382
+ },
383
+ async sendTransactionForSwap(o) {
384
+ var u, c, d, T, m, f, w, b, I, E, U, O;
385
+ if (!o)
386
+ return;
387
+ const { fromAddress: t, toTokenAmount: n, isAuthConnector: s } = a.getParams();
388
+ e.loadingTransaction = !0;
389
+ const i = `Swapping ${(u = e.sourceToken) == null ? void 0 : u.symbol} to ${l.formatNumberToLocalString(n, 3)} ${(c = e.toToken) == null ? void 0 : c.symbol}`, r = `Swapped ${(d = e.sourceToken) == null ? void 0 : d.symbol} to ${l.formatNumberToLocalString(n, 3)} ${(T = e.toToken) == null ? void 0 : T.symbol}`;
390
+ s ? A.pushTransactionStack({
391
+ onSuccess() {
392
+ A.replace("Account"), g.showLoading(i), N.resetState();
393
+ }
394
+ }) : g.showLoading("Confirm transaction in your wallet");
395
+ try {
396
+ const D = [(m = e.sourceToken) == null ? void 0 : m.address, (f = e.toToken) == null ? void 0 : f.address].join(","), p = await B.sendTransaction({
397
+ address: t,
398
+ to: o.to,
399
+ data: o.data,
400
+ value: o.value,
401
+ chainNamespace: S.CHAIN.EVM
402
+ });
403
+ return e.loadingTransaction = !1, g.showSuccess(r), x.sendEvent({
404
+ type: "track",
405
+ event: "SWAP_SUCCESS",
406
+ properties: {
407
+ network: ((w = h.state.activeCaipNetwork) == null ? void 0 : w.caipNetworkId) || "",
408
+ swapFromToken: ((b = a.state.sourceToken) == null ? void 0 : b.symbol) || "",
409
+ swapToToken: ((I = a.state.toToken) == null ? void 0 : I.symbol) || "",
410
+ swapFromAmount: a.state.sourceTokenAmount || "",
411
+ swapToAmount: a.state.toTokenAmount || "",
412
+ isSmartAccount: F(S.CHAIN.EVM) === M.ACCOUNT_TYPES.SMART_ACCOUNT
413
+ }
414
+ }), N.resetState(), s || A.replace("Account"), N.getMyTokensWithBalance(D), p;
415
+ } catch (D) {
416
+ const p = D;
417
+ e.transactionError = p == null ? void 0 : p.shortMessage, e.loadingTransaction = !1, g.showError((p == null ? void 0 : p.shortMessage) || "Transaction error"), x.sendEvent({
418
+ type: "track",
419
+ event: "SWAP_ERROR",
420
+ properties: {
421
+ message: (p == null ? void 0 : p.shortMessage) || (p == null ? void 0 : p.message) || "Unknown",
422
+ network: ((E = h.state.activeCaipNetwork) == null ? void 0 : E.caipNetworkId) || "",
423
+ swapFromToken: ((U = a.state.sourceToken) == null ? void 0 : U.symbol) || "",
424
+ swapToToken: ((O = a.state.toToken) == null ? void 0 : O.symbol) || "",
425
+ swapFromAmount: a.state.sourceTokenAmount || "",
426
+ swapToAmount: a.state.toTokenAmount || "",
427
+ isSmartAccount: F(S.CHAIN.EVM) === M.ACCOUNT_TYPES.SMART_ACCOUNT
428
+ }
429
+ });
430
+ return;
431
+ }
432
+ },
433
+ // -- Checks -------------------------------------------- //
434
+ hasInsufficientToken(o, t) {
435
+ return P.isInsufficientSourceTokenForSwap(o, t, e.myTokensWithBalance);
436
+ },
437
+ // -- Calculations -------------------------------------- //
438
+ setTransactionDetails() {
439
+ const { toTokenAddress: o, toTokenDecimals: t } = a.getParams();
440
+ !o || !t || (e.gasPriceInUSD = P.getGasPriceInUSD(e.networkPrice, BigInt(e.gasFee), BigInt(R)), e.priceImpact = P.getPriceImpact({
441
+ sourceTokenAmount: e.sourceTokenAmount,
442
+ sourceTokenPriceInUSD: e.sourceTokenPriceInUSD,
443
+ toTokenPriceInUSD: e.toTokenPriceInUSD,
444
+ toTokenAmount: e.toTokenAmount
445
+ }), e.maxSlippage = P.getMaxSlippage(e.slippage, e.toTokenAmount), e.providerFee = P.getProviderFee(e.sourceTokenAmount));
446
+ }
447
+ }, a = V(N), se = X`
448
+ :host {
449
+ display: block;
450
+ }
451
+
452
+ :host > button {
453
+ gap: var(--wui-spacing-xxs);
454
+ padding: var(--wui-spacing-xs);
455
+ padding-right: var(--wui-spacing-1xs);
456
+ height: 40px;
457
+ border-radius: var(--wui-border-radius-l);
458
+ background: var(--wui-color-gray-glass-002);
459
+ border-width: 0px;
460
+ box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002);
461
+ }
462
+
463
+ :host > button wui-image {
464
+ width: 24px;
465
+ height: 24px;
466
+ border-radius: var(--wui-border-radius-s);
467
+ box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010);
468
+ }
469
+ `;
470
+ var _ = function(o, t, n, s) {
471
+ var i = arguments.length, r = i < 3 ? t : s === null ? s = Object.getOwnPropertyDescriptor(t, n) : s, u;
472
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(o, t, n, s);
473
+ else for (var c = o.length - 1; c >= 0; c--) (u = o[c]) && (r = (i < 3 ? u(r) : i > 3 ? u(t, n, r) : u(t, n)) || r);
474
+ return i > 3 && r && Object.defineProperty(t, n, r), r;
475
+ };
476
+ let y = class extends oe {
477
+ constructor() {
478
+ super(...arguments), this.text = "";
479
+ }
480
+ render() {
481
+ return L`
482
+ <button>
483
+ ${this.tokenTemplate()}
484
+ <wui-text variant="paragraph-600" color="fg-100">${this.text}</wui-text>
485
+ </button>
486
+ `;
487
+ }
488
+ tokenTemplate() {
489
+ return this.imageSrc ? L`<wui-image src=${this.imageSrc}></wui-image>` : L`
490
+ <wui-icon-box
491
+ size="sm"
492
+ iconColor="fg-200"
493
+ backgroundColor="fg-300"
494
+ icon="networkPlaceholder"
495
+ ></wui-icon-box>
496
+ `;
497
+ }
498
+ };
499
+ y.styles = [Z, ee, se];
500
+ _([
501
+ z()
502
+ ], y.prototype, "imageSrc", void 0);
503
+ _([
504
+ z()
505
+ ], y.prototype, "text", void 0);
506
+ y = _([
507
+ ne("wui-token-button")
508
+ ], y);
509
+ export {
510
+ a as S
511
+ };