@directcryptopay/sdk 0.2.1 → 0.2.3

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 (228) hide show
  1. package/dist/ExchangeController-CPMQq6Q-.js +217 -0
  2. package/dist/HelpersUtil-DfMFC7Bf.js +120 -0
  3. package/dist/NavigationUtil-kj9LEOOd.js +8 -0
  4. package/dist/PhArrowCircleDown-lsK25DCk.js +73 -0
  5. package/dist/PhArrowClockwise-NeKHZ1co.js +73 -0
  6. package/dist/PhArrowDown-C9AkNvLs.js +73 -0
  7. package/dist/PhArrowLeft-RNfIQP1X.js +73 -0
  8. package/dist/PhArrowRight-DM1tna0G.js +73 -0
  9. package/dist/PhArrowSquareOut-S5XYbAZj.js +73 -0
  10. package/dist/PhArrowUp-DmktzOWy.js +73 -0
  11. package/dist/PhArrowUpRight-BkNeW_5i.js +73 -0
  12. package/dist/PhArrowsClockwise-CQ4pG76b.js +73 -0
  13. package/dist/PhArrowsDownUp-H6gxaNM6.js +73 -0
  14. package/dist/PhArrowsLeftRight-DZSsfMR6.js +73 -0
  15. package/dist/PhBank-4_9QzqIB.js +73 -0
  16. package/dist/PhBrowser-B-JSznId.js +73 -0
  17. package/dist/PhCaretDown-vV5oHMNi.js +73 -0
  18. package/dist/PhCaretLeft-BLo6Y_f4.js +73 -0
  19. package/dist/PhCaretRight-CqQN4TT3.js +73 -0
  20. package/dist/PhCaretUp-Df7UCAHy.js +73 -0
  21. package/dist/PhCheck-gtpfK4ed.js +73 -0
  22. package/dist/PhCircleHalf-Uq7dwDYw.js +73 -0
  23. package/dist/PhClock-SDCW-NmF.js +73 -0
  24. package/dist/PhCompass-B7hgtdx-.js +73 -0
  25. package/dist/PhCopy-BcnhyXCy.js +73 -0
  26. package/dist/PhCreditCard-BJjByVgu.js +73 -0
  27. package/dist/PhCurrencyDollar-B7ZXqXBy.js +73 -0
  28. package/dist/PhDesktop-B3VKPuJx.js +73 -0
  29. package/dist/PhDeviceMobile-Bnd0TYEH.js +73 -0
  30. package/dist/PhDotsThree-yyMWyZ-R.js +73 -0
  31. package/dist/PhEnvelope-67uzHbI9.js +73 -0
  32. package/dist/PhFunnelSimple-B-DCsloI.js +73 -0
  33. package/dist/PhGlobe-TMm_6qGk.js +73 -0
  34. package/dist/PhIdentificationCard-CePPD2xc.js +73 -0
  35. package/dist/PhImage-gY96WtHR.js +73 -0
  36. package/dist/PhInfo-DRQM_ZDP.js +73 -0
  37. package/dist/PhLightbulb-B0TxPfZ1.js +73 -0
  38. package/dist/PhMagnifyingGlass-B8si5_6W.js +73 -0
  39. package/dist/PhPaperPlaneRight-DVu5PLYd.js +73 -0
  40. package/dist/PhPlus-BfTsQnUz.js +73 -0
  41. package/dist/PhPower-CxYUGOWn.js +73 -0
  42. package/dist/PhPuzzlePiece-CQ4wh0gV.js +73 -0
  43. package/dist/PhQrCode-BuJ97NYJ.js +73 -0
  44. package/dist/PhQuestion-kJoP8Mja.js +73 -0
  45. package/dist/PhQuestionMark-C46ZkFpu.js +73 -0
  46. package/dist/PhSealCheck-Eh8jVqSN.js +73 -0
  47. package/dist/PhSignOut-jk97OSVt.js +73 -0
  48. package/dist/PhSpinner-CiYOhwMg.js +73 -0
  49. package/dist/PhTrash-pxerMqzd.js +73 -0
  50. package/dist/PhUser-BMg0VV4A.js +73 -0
  51. package/dist/PhVault-DYQvx5A-.js +73 -0
  52. package/dist/PhWarning-NLC5Mj87.js +73 -0
  53. package/dist/PhWarningCircle-Ch2jU9fA.js +73 -0
  54. package/dist/PhX-Bx4wpwm3.js +73 -0
  55. package/dist/SwapController-Cti0Cyxa.js +457 -0
  56. package/dist/{ccip-BIGqktC1.js → ccip-CKZd2XJ7.js} +4 -4
  57. package/dist/data-capture-7D5CL385.js +490 -0
  58. package/dist/dcp-sdk.umd.js +7400 -6589
  59. package/dist/email-AmK0INbZ.js +344 -0
  60. package/dist/embedded-wallet-Pn0I_XLn.js +820 -0
  61. package/dist/features-x8XNprEe.js +274 -0
  62. package/dist/{hashTypedData-ZH9ZnWu3.js → hashTypedData-B50-z0AA.js} +6 -6
  63. package/dist/if-defined-CdZSZ6UL.js +10 -0
  64. package/dist/index-4ewUtPPp.js +7981 -0
  65. package/dist/{index-D6h-qfpt.js → index-51l86yqx.js} +5 -5
  66. package/dist/index-B6K56LF_.js +85 -0
  67. package/dist/index-BAmv9PxJ.js +257 -0
  68. package/dist/index-BEswjY9r.js +117 -0
  69. package/dist/index-BSKRq56S.js +355 -0
  70. package/dist/index-BaygXQxx.js +172 -0
  71. package/dist/index-BcPxaHr5.js +118 -0
  72. package/dist/index-Bjt7nGaJ.js +199 -0
  73. package/dist/{index-D5r0iSq4.js → index-BkTSyAJb.js} +1 -1
  74. package/dist/index-Bmnl7l2U.js +555 -0
  75. package/dist/index-BvPvouSq.js +56 -0
  76. package/dist/index-C-6iznUO.js +174 -0
  77. package/dist/index-C4M5s_AM.js +228 -0
  78. package/dist/index-CEqcN8QP.js +1175 -0
  79. package/dist/{index-CPTcEPbD.js → index-CM3YaYca.js} +296 -298
  80. package/dist/{index-f3LXSfM5.js → index-CclBLA5r.js} +56 -142
  81. package/dist/index-ChTxJOiF.js +46 -0
  82. package/dist/index-CmAv0Tzr.js +86 -0
  83. package/dist/index-CmvoKY4x.js +125 -0
  84. package/dist/{index-BdSIrl-R.js → index-D7PmdQ9B.js} +578 -570
  85. package/dist/{index-DobBVPe4.js → index-D7k2Pc4e.js} +481 -236
  86. package/dist/index-D7lmgqUR.js +153 -0
  87. package/dist/index-DG_-qYze.js +107 -0
  88. package/dist/{index-Dy4NyE6l.js → index-DHot9Fdb.js} +7 -7
  89. package/dist/index-DV2LrPtU.js +123 -0
  90. package/dist/index-DYBaJQ2W.js +65 -0
  91. package/dist/{index-BJ7cbG3N.js → index-D_8VUmn1.js} +36688 -40208
  92. package/dist/index-D_gLn3rT.js +100 -0
  93. package/dist/index-DqcVUSC9.js +62 -0
  94. package/dist/index-I7VDqINw.js +128 -0
  95. package/dist/index-Oz72I9VP.js +209 -0
  96. package/dist/index-UclsHkJ0.js +118 -0
  97. package/dist/index-X8zir_1j.js +110 -0
  98. package/dist/index-XvlWKGCu.js +1281 -0
  99. package/dist/index-dO97xPlt.js +171 -0
  100. package/dist/{index-5mp7WkhV.js → index-uBeF6OAB.js} +2 -2
  101. package/dist/index-zeA_RiCV.js +159 -0
  102. package/dist/index.js +1 -1
  103. package/dist/{localBatchGatewayRequest-CjGcn5nM.js → localBatchGatewayRequest-BUZHGdjw.js} +1 -1
  104. package/dist/onramp-CdnBuF0r.js +855 -0
  105. package/dist/{parseSignature-S8VEpRHC.js → parseSignature-CcyTNGr4.js} +2312 -2313
  106. package/dist/pay-with-exchange-CSM6WCOV.js +525 -0
  107. package/dist/property-Bd8U3_QP.js +618 -0
  108. package/dist/receive-DooMu4Dx.js +232 -0
  109. package/dist/ref-CpgjXAw7.js +107 -0
  110. package/dist/send-3T7CyYic.js +1166 -0
  111. package/dist/socials-Dt-iHL17.js +620 -0
  112. package/dist/swaps-CjA9Es42.js +1760 -0
  113. package/dist/{transactions-DujFkB-M.js → transactions-nRm9DVzn.js} +10 -10
  114. package/dist/w3m-modal-NV25AXhM.js +1706 -0
  115. package/package.json +3 -3
  116. package/dist/ConstantsUtil-B-_-u8aQ.js +0 -6
  117. package/dist/add-sji6scSD.js +0 -19
  118. package/dist/all-wallets-B4H-890E.js +0 -10
  119. package/dist/app-store-Z433s97G.js +0 -21
  120. package/dist/apple-b8Lxj7nb.js +0 -22
  121. package/dist/arrow-bottom-M9oWWo_9.js +0 -12
  122. package/dist/arrow-bottom-circle-N9c4CXY1.js +0 -15
  123. package/dist/arrow-left-Dw8AKfwf.js +0 -12
  124. package/dist/arrow-right-DwLQZSC_.js +0 -12
  125. package/dist/arrow-top-zhUjkBe1.js +0 -12
  126. package/dist/bank-CbQdnILK.js +0 -18
  127. package/dist/browser-xAqNwt7z.js +0 -18
  128. package/dist/card-Dr1QBmWp.js +0 -18
  129. package/dist/checkmark-BhT1dTgG.js +0 -15
  130. package/dist/checkmark-bold-CPB29wqQ.js +0 -12
  131. package/dist/chevron-bottom-BhNyx2II.js +0 -12
  132. package/dist/chevron-left-CGuEjQlY.js +0 -12
  133. package/dist/chevron-right-CvIRRsqZ.js +0 -12
  134. package/dist/chevron-top-RSzCqjBd.js +0 -12
  135. package/dist/chrome-store-Cs8dAgs0.js +0 -65
  136. package/dist/clock-fhZO5otC.js +0 -12
  137. package/dist/close-BPuztrdR.js +0 -12
  138. package/dist/coinPlaceholder-C8X2i7Kh.js +0 -12
  139. package/dist/compass-WMc5huk0.js +0 -12
  140. package/dist/copy-DVAeT17y.js +0 -19
  141. package/dist/cursor-BJ4YLXfy.js +0 -7
  142. package/dist/cursor-transparent-DN2fLQN4.js +0 -16
  143. package/dist/desktop-6avxisBw.js +0 -13
  144. package/dist/disconnect-AReVI8Gk.js +0 -12
  145. package/dist/discord-CxrI30BZ.js +0 -21
  146. package/dist/email-B8dIIaay.js +0 -696
  147. package/dist/embedded-wallet-C_5hF7rM.js +0 -468
  148. package/dist/etherscan-BnAy8cIF.js +0 -10
  149. package/dist/exclamation-triangle-Bu7nHwx9.js +0 -8
  150. package/dist/extension-F0LIhvcf.js +0 -12
  151. package/dist/external-link-CP6phyaM.js +0 -12
  152. package/dist/facebook-BtQ-Io2y.js +0 -30
  153. package/dist/farcaster-BmaN1ugd.js +0 -16
  154. package/dist/filters-DpEwoOmy.js +0 -12
  155. package/dist/github-q7qO9V-b.js +0 -22
  156. package/dist/google-DH_ZE8bW.js +0 -22
  157. package/dist/help-circle-BAQVmKas.js +0 -16
  158. package/dist/id-Cj68Zwgo.js +0 -16
  159. package/dist/if-defined-CNte9B3N.js +0 -744
  160. package/dist/image-BKJDw6N-.js +0 -8
  161. package/dist/index-7toZMdtG.js +0 -573
  162. package/dist/index-B1uKzdvN.js +0 -170
  163. package/dist/index-BHFZVF-b.js +0 -257
  164. package/dist/index-BKwa5JSA.js +0 -559
  165. package/dist/index-BP4B9VUt.js +0 -54
  166. package/dist/index-BVdzXHpO.js +0 -181
  167. package/dist/index-BYND0GJ9.js +0 -146
  168. package/dist/index-BaJ0zEbh.js +0 -97
  169. package/dist/index-Bh0MPFwP.js +0 -58
  170. package/dist/index-Bsh7_qTp.js +0 -511
  171. package/dist/index-BwnXTNNg.js +0 -199
  172. package/dist/index-C0kPDbg_.js +0 -77
  173. package/dist/index-CKikVKe2.js +0 -75
  174. package/dist/index-ChVh0Hkp.js +0 -243
  175. package/dist/index-Cle_NnnS.js +0 -305
  176. package/dist/index-CmWdvIFT.js +0 -51
  177. package/dist/index-D2AMA8Bu.js +0 -65
  178. package/dist/index-DAUM8CO4.js +0 -65
  179. package/dist/index-DGjZW6uR.js +0 -78
  180. package/dist/index-DQe94z7X.js +0 -265
  181. package/dist/index-DTo6w99t.js +0 -7864
  182. package/dist/index-DYdXjap2.js +0 -320
  183. package/dist/index-DceCxNV5.js +0 -181
  184. package/dist/index-Uw9cSw0q.js +0 -294
  185. package/dist/index-qiuyrukh.js +0 -45
  186. package/dist/index-zddvaohA.js +0 -78
  187. package/dist/info-RfPsmroW.js +0 -7
  188. package/dist/info-circle-DFKHB_ZN.js +0 -16
  189. package/dist/lightbulb-B-Bykj9X.js +0 -7
  190. package/dist/mail-mBAgGuw5.js +0 -12
  191. package/dist/mobile-Dhh3ndkf.js +0 -13
  192. package/dist/more-D1h7UTvg.js +0 -15
  193. package/dist/network-placeholder-Dqynvc-t.js +0 -18
  194. package/dist/nftPlaceholder-Df7MW4MM.js +0 -12
  195. package/dist/off-BmG3cHTX.js +0 -12
  196. package/dist/onramp-C401Aenb.js +0 -1279
  197. package/dist/play-store-4q1fzL_P.js +0 -36
  198. package/dist/plus-603Gs3yG.js +0 -17
  199. package/dist/qr-code-Dgwhf6M1.js +0 -10
  200. package/dist/receive-CYXbbEUR.js +0 -186
  201. package/dist/recycle-horizontal-Bu8zZ563.js +0 -13
  202. package/dist/ref-DpmKRWBK.js +0 -41
  203. package/dist/refresh-BMZFu0mu.js +0 -12
  204. package/dist/reown-logo-BXph7ThY.js +0 -16
  205. package/dist/search-Cm_V42Y_.js +0 -12
  206. package/dist/secp256k1-C0iX1TUr.js +0 -1510
  207. package/dist/secp256k1-DOQBqE4Z.js +0 -1302
  208. package/dist/send-BSMYxDuP.js +0 -19
  209. package/dist/send-C8EeIzRB.js +0 -1038
  210. package/dist/socials-DQrHQajs.js +0 -574
  211. package/dist/swapHorizontal-98rnJewS.js +0 -12
  212. package/dist/swapHorizontalBold-C299FjEt.js +0 -12
  213. package/dist/swapHorizontalMedium-Cqm6i4WJ.js +0 -20
  214. package/dist/swapHorizontalRoundedBold-De7hFfqZ.js +0 -12
  215. package/dist/swapVertical-DSL75l8L.js +0 -12
  216. package/dist/swaps-BuTNp65Y.js +0 -1637
  217. package/dist/telegram-cJP7hgUb.js +0 -20
  218. package/dist/three-dots-DHnEh28O.js +0 -9
  219. package/dist/twitch-CR2iGcBo.js +0 -22
  220. package/dist/twitterIcon-E5TAQjOn.js +0 -10
  221. package/dist/verify-DEukUJp0.js +0 -12
  222. package/dist/verify-filled-BXsx1i_p.js +0 -12
  223. package/dist/w3m-modal-Bm7BqVng.js +0 -1037
  224. package/dist/wallet-CzyyvdrT.js +0 -12
  225. package/dist/wallet-placeholder-BrcmyGEe.js +0 -18
  226. package/dist/walletconnect-BSYogWiE.js +0 -36
  227. package/dist/warning-circle-Cgp2BW3m.js +0 -16
  228. package/dist/x-BJinLpTw.js +0 -16
@@ -1,1279 +0,0 @@
1
- import { cE as T, cF as w, cG as c, dR as J, dX as l, dh as D, dQ as x, cX as S, di as j, cS as I, cY as O, c_ as Z, d8 as G, d0 as H, cJ as U, d1 as V, db as M, d5 as X, d6 as ee, cZ as L, c$ as te } from "./index-BJ7cbG3N.js";
2
- import { n as d, c as g, o as h, r as u } from "./if-defined-CNte9B3N.js";
3
- import { D as ie, T as re } from "./index-Bsh7_qTp.js";
4
- import "./index-CKikVKe2.js";
5
- import "./index-CmWdvIFT.js";
6
- import "./index-BaJ0zEbh.js";
7
- import "./index-DceCxNV5.js";
8
- import { O as z } from "./index-Cle_NnnS.js";
9
- import "./index-f3LXSfM5.js";
10
- import "./index-BP4B9VUt.js";
11
- import "./index-Uw9cSw0q.js";
12
- import "./index-DAUM8CO4.js";
13
- import "./index-DQe94z7X.js";
14
- const oe = T`
15
- :host {
16
- width: 100%;
17
- }
18
-
19
- :host > wui-flex {
20
- width: 100%;
21
- padding: var(--wui-spacing-s);
22
- border-radius: var(--wui-border-radius-xs);
23
- width: 100%;
24
- display: flex;
25
- align-items: center;
26
- justify-content: flex-start;
27
- gap: var(--wui-spacing-s);
28
- }
29
-
30
- :host > wui-flex:hover {
31
- background-color: var(--wui-color-gray-glass-002);
32
- }
33
-
34
- .purchase-image-container {
35
- display: flex;
36
- justify-content: center;
37
- align-items: center;
38
- position: relative;
39
- width: var(--wui-icon-box-size-lg);
40
- height: var(--wui-icon-box-size-lg);
41
- }
42
-
43
- .purchase-image-container wui-image {
44
- width: 100%;
45
- height: 100%;
46
- position: relative;
47
- border-radius: calc(var(--wui-icon-box-size-lg) / 2);
48
- }
49
-
50
- .purchase-image-container wui-image::after {
51
- content: '';
52
- display: block;
53
- width: 100%;
54
- height: 100%;
55
- position: absolute;
56
- inset: 0;
57
- border-radius: calc(var(--wui-icon-box-size-lg) / 2);
58
- box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
59
- }
60
-
61
- .purchase-image-container wui-icon-box {
62
- position: absolute;
63
- right: 0;
64
- bottom: 0;
65
- transform: translate(20%, 20%);
66
- }
67
- `;
68
- var f = function(a, e, t, r) {
69
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
70
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
71
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
72
- return o > 3 && i && Object.defineProperty(e, t, i), i;
73
- };
74
- let p = class extends w {
75
- constructor() {
76
- super(...arguments), this.disabled = !1, this.color = "inherit", this.label = "Bought", this.purchaseValue = "", this.purchaseCurrency = "", this.date = "", this.completed = !1, this.inProgress = !1, this.failed = !1, this.onClick = null, this.symbol = "";
77
- }
78
- firstUpdated() {
79
- this.icon || this.fetchTokenImage();
80
- }
81
- render() {
82
- return c`
83
- <wui-flex>
84
- ${this.imageTemplate()}
85
- <wui-flex flexDirection="column" gap="4xs" flexGrow="1">
86
- <wui-flex gap="xxs" alignItems="center" justifyContent="flex-start">
87
- ${this.statusIconTemplate()}
88
- <wui-text variant="paragraph-500" color="fg-100"> ${this.label}</wui-text>
89
- </wui-flex>
90
- <wui-text variant="small-400" color="fg-200">
91
- + ${this.purchaseValue} ${this.purchaseCurrency}
92
- </wui-text>
93
- </wui-flex>
94
- ${this.inProgress ? c`<wui-loading-spinner color="fg-200" size="md"></wui-loading-spinner>` : c`<wui-text variant="micro-700" color="fg-300"><span>${this.date}</span></wui-text>`}
95
- </wui-flex>
96
- `;
97
- }
98
- async fetchTokenImage() {
99
- await J._fetchTokenImage(this.purchaseCurrency);
100
- }
101
- statusIconTemplate() {
102
- return this.inProgress ? null : this.completed ? this.boughtIconTemplate() : this.errorIconTemplate();
103
- }
104
- errorIconTemplate() {
105
- return c`<wui-icon-box
106
- size="xxs"
107
- iconColor="error-100"
108
- backgroundColor="error-100"
109
- background="opaque"
110
- icon="close"
111
- borderColor="wui-color-bg-125"
112
- ></wui-icon-box>`;
113
- }
114
- imageTemplate() {
115
- const e = this.icon || `https://avatar.vercel.sh/andrew.svg?size=50&text=${this.symbol}`;
116
- return c`<wui-flex class="purchase-image-container">
117
- <wui-image src=${e}></wui-image>
118
- </wui-flex>`;
119
- }
120
- boughtIconTemplate() {
121
- return c`<wui-icon-box
122
- size="xxs"
123
- iconColor="success-100"
124
- backgroundColor="success-100"
125
- background="opaque"
126
- icon="arrowBottom"
127
- borderColor="wui-color-bg-125"
128
- ></wui-icon-box>`;
129
- }
130
- };
131
- p.styles = [oe];
132
- f([
133
- d({ type: Boolean })
134
- ], p.prototype, "disabled", void 0);
135
- f([
136
- d()
137
- ], p.prototype, "color", void 0);
138
- f([
139
- d()
140
- ], p.prototype, "label", void 0);
141
- f([
142
- d()
143
- ], p.prototype, "purchaseValue", void 0);
144
- f([
145
- d()
146
- ], p.prototype, "purchaseCurrency", void 0);
147
- f([
148
- d()
149
- ], p.prototype, "date", void 0);
150
- f([
151
- d({ type: Boolean })
152
- ], p.prototype, "completed", void 0);
153
- f([
154
- d({ type: Boolean })
155
- ], p.prototype, "inProgress", void 0);
156
- f([
157
- d({ type: Boolean })
158
- ], p.prototype, "failed", void 0);
159
- f([
160
- d()
161
- ], p.prototype, "onClick", void 0);
162
- f([
163
- d()
164
- ], p.prototype, "symbol", void 0);
165
- f([
166
- d()
167
- ], p.prototype, "icon", void 0);
168
- p = f([
169
- g("w3m-onramp-activity-item")
170
- ], p);
171
- const se = T`
172
- :host > wui-flex {
173
- height: 500px;
174
- overflow-y: auto;
175
- overflow-x: hidden;
176
- scrollbar-width: none;
177
- padding: var(--wui-spacing-m);
178
- box-sizing: border-box;
179
- display: flex;
180
- align-items: center;
181
- justify-content: flex-start;
182
- }
183
-
184
- :host > wui-flex::-webkit-scrollbar {
185
- display: none;
186
- }
187
-
188
- :host > wui-flex > wui-flex {
189
- width: 100%;
190
- }
191
-
192
- wui-transaction-list-item-loader {
193
- width: 100%;
194
- }
195
- `;
196
- var B = function(a, e, t, r) {
197
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
198
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
199
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
200
- return o > 3 && i && Object.defineProperty(e, t, i), i;
201
- };
202
- const ne = 7;
203
- let P = class extends w {
204
- constructor() {
205
- super(), this.unsubscribe = [], this.selectedOnRampProvider = l.state.selectedProvider, this.loading = !1, this.coinbaseTransactions = D.state.coinbaseTransactions, this.tokenImages = x.state.tokenImages, this.unsubscribe.push(l.subscribeKey("selectedProvider", (e) => {
206
- this.selectedOnRampProvider = e;
207
- }), x.subscribeKey("tokenImages", (e) => this.tokenImages = e), () => {
208
- clearTimeout(this.refetchTimeout);
209
- }, D.subscribe((e) => {
210
- this.coinbaseTransactions = { ...e.coinbaseTransactions };
211
- })), D.clearCursor(), this.fetchTransactions();
212
- }
213
- render() {
214
- return c`
215
- <wui-flex flexDirection="column" .padding=${["0", "s", "s", "s"]} gap="xs">
216
- ${this.loading ? this.templateLoading() : this.templateTransactionsByYear()}
217
- </wui-flex>
218
- `;
219
- }
220
- templateTransactions(e) {
221
- return e == null ? void 0 : e.map((t) => {
222
- var n, N, F;
223
- const r = ie.formatDate((n = t == null ? void 0 : t.metadata) == null ? void 0 : n.minedAt), o = t.transfers[0], i = o == null ? void 0 : o.fungible_info;
224
- if (!i)
225
- return null;
226
- const s = ((N = i == null ? void 0 : i.icon) == null ? void 0 : N.url) || ((F = this.tokenImages) == null ? void 0 : F[i.symbol || ""]);
227
- return c`
228
- <w3m-onramp-activity-item
229
- label="Bought"
230
- .completed=${t.metadata.status === "ONRAMP_TRANSACTION_STATUS_SUCCESS"}
231
- .inProgress=${t.metadata.status === "ONRAMP_TRANSACTION_STATUS_IN_PROGRESS"}
232
- .failed=${t.metadata.status === "ONRAMP_TRANSACTION_STATUS_FAILED"}
233
- purchaseCurrency=${h(i.symbol)}
234
- purchaseValue=${o.quantity.numeric}
235
- date=${r}
236
- icon=${h(s)}
237
- symbol=${h(i.symbol)}
238
- ></w3m-onramp-activity-item>
239
- `;
240
- });
241
- }
242
- templateTransactionsByYear() {
243
- return Object.keys(this.coinbaseTransactions).sort().reverse().map((t) => {
244
- const r = parseInt(t, 10);
245
- return new Array(12).fill(null).map((i, s) => s).reverse().map((i) => {
246
- var N;
247
- const s = re.getTransactionGroupTitle(r, i), n = (N = this.coinbaseTransactions[r]) == null ? void 0 : N[i];
248
- return n ? c`
249
- <wui-flex flexDirection="column">
250
- <wui-flex
251
- alignItems="center"
252
- flexDirection="row"
253
- .padding=${["xs", "s", "s", "s"]}
254
- >
255
- <wui-text variant="paragraph-500" color="fg-200">${s}</wui-text>
256
- </wui-flex>
257
- <wui-flex flexDirection="column" gap="xs">
258
- ${this.templateTransactions(n)}
259
- </wui-flex>
260
- </wui-flex>
261
- ` : null;
262
- });
263
- });
264
- }
265
- async fetchTransactions() {
266
- await this.fetchCoinbaseTransactions();
267
- }
268
- async fetchCoinbaseTransactions() {
269
- const e = S.state.address, t = j.state.projectId;
270
- if (!e)
271
- throw new Error("No address found");
272
- if (!t)
273
- throw new Error("No projectId found");
274
- this.loading = !0, await D.fetchTransactions(e, "coinbase"), this.loading = !1, this.refetchLoadingTransactions();
275
- }
276
- refetchLoadingTransactions() {
277
- var o;
278
- const e = /* @__PURE__ */ new Date();
279
- if ((((o = this.coinbaseTransactions[e.getFullYear()]) == null ? void 0 : o[e.getMonth()]) || []).filter((i) => i.metadata.status === "ONRAMP_TRANSACTION_STATUS_IN_PROGRESS").length === 0) {
280
- clearTimeout(this.refetchTimeout);
281
- return;
282
- }
283
- this.refetchTimeout = setTimeout(async () => {
284
- const i = S.state.address;
285
- await D.fetchTransactions(i, "coinbase"), this.refetchLoadingTransactions();
286
- }, 3e3);
287
- }
288
- templateLoading() {
289
- return Array(ne).fill(c` <wui-transaction-list-item-loader></wui-transaction-list-item-loader> `).map((e) => e);
290
- }
291
- };
292
- P.styles = se;
293
- B([
294
- u()
295
- ], P.prototype, "selectedOnRampProvider", void 0);
296
- B([
297
- u()
298
- ], P.prototype, "loading", void 0);
299
- B([
300
- u()
301
- ], P.prototype, "coinbaseTransactions", void 0);
302
- B([
303
- u()
304
- ], P.prototype, "tokenImages", void 0);
305
- P = B([
306
- g("w3m-onramp-activity-view")
307
- ], P);
308
- const ae = T`
309
- :host > wui-grid {
310
- max-height: 360px;
311
- overflow: auto;
312
- }
313
-
314
- wui-flex {
315
- transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md);
316
- will-change: opacity;
317
- }
318
-
319
- wui-grid::-webkit-scrollbar {
320
- display: none;
321
- }
322
-
323
- wui-flex.disabled {
324
- opacity: 0.3;
325
- pointer-events: none;
326
- user-select: none;
327
- }
328
- `;
329
- var W = function(a, e, t, r) {
330
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
331
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
332
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
333
- return o > 3 && i && Object.defineProperty(e, t, i), i;
334
- };
335
- let A = class extends w {
336
- constructor() {
337
- super(), this.unsubscribe = [], this.selectedCurrency = l.state.paymentCurrency, this.currencies = l.state.paymentCurrencies, this.currencyImages = x.state.currencyImages, this.checked = z.state.isLegalCheckboxChecked, this.unsubscribe.push(l.subscribe((e) => {
338
- this.selectedCurrency = e.paymentCurrency, this.currencies = e.paymentCurrencies;
339
- }), x.subscribeKey("currencyImages", (e) => this.currencyImages = e), z.subscribeKey("isLegalCheckboxChecked", (e) => {
340
- this.checked = e;
341
- }));
342
- }
343
- disconnectedCallback() {
344
- this.unsubscribe.forEach((e) => e());
345
- }
346
- render() {
347
- var n;
348
- const { termsConditionsUrl: e, privacyPolicyUrl: t } = j.state, r = (n = j.state.features) == null ? void 0 : n.legalCheckbox, s = !!(e || t) && !!r && !this.checked;
349
- return c`
350
- <w3m-legal-checkbox></w3m-legal-checkbox>
351
- <wui-flex
352
- flexDirection="column"
353
- .padding=${["0", "s", "s", "s"]}
354
- gap="xs"
355
- class=${h(s ? "disabled" : void 0)}
356
- >
357
- ${this.currenciesTemplate(s)}
358
- </wui-flex>
359
- <w3m-legal-footer></w3m-legal-footer>
360
- `;
361
- }
362
- currenciesTemplate(e = !1) {
363
- return this.currencies.map((t) => {
364
- var r;
365
- return c`
366
- <wui-list-item
367
- imageSrc=${h((r = this.currencyImages) == null ? void 0 : r[t.id])}
368
- @click=${() => this.selectCurrency(t)}
369
- variant="image"
370
- tabIdx=${h(e ? -1 : void 0)}
371
- >
372
- <wui-text variant="paragraph-500" color="fg-100">${t.id}</wui-text>
373
- </wui-list-item>
374
- `;
375
- });
376
- }
377
- selectCurrency(e) {
378
- e && (l.setPaymentCurrency(e), I.close());
379
- }
380
- };
381
- A.styles = ae;
382
- W([
383
- u()
384
- ], A.prototype, "selectedCurrency", void 0);
385
- W([
386
- u()
387
- ], A.prototype, "currencies", void 0);
388
- W([
389
- u()
390
- ], A.prototype, "currencyImages", void 0);
391
- W([
392
- u()
393
- ], A.prototype, "checked", void 0);
394
- A = W([
395
- g("w3m-onramp-fiat-select-view")
396
- ], A);
397
- const ce = T`
398
- button {
399
- padding: var(--wui-spacing-s);
400
- border-radius: var(--wui-border-radius-xs);
401
- border: none;
402
- outline: none;
403
- background-color: var(--wui-color-gray-glass-002);
404
- width: 100%;
405
- display: flex;
406
- align-items: center;
407
- justify-content: flex-start;
408
- gap: var(--wui-spacing-s);
409
- transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md);
410
- will-change: background-color;
411
- }
412
-
413
- button:hover {
414
- background-color: var(--wui-color-gray-glass-005);
415
- }
416
-
417
- .provider-image {
418
- width: var(--wui-spacing-3xl);
419
- min-width: var(--wui-spacing-3xl);
420
- height: var(--wui-spacing-3xl);
421
- border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2));
422
- position: relative;
423
- overflow: hidden;
424
- }
425
-
426
- .provider-image::after {
427
- content: '';
428
- display: block;
429
- width: 100%;
430
- height: 100%;
431
- position: absolute;
432
- inset: 0;
433
- border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2));
434
- box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
435
- }
436
-
437
- .network-icon {
438
- width: var(--wui-spacing-m);
439
- height: var(--wui-spacing-m);
440
- border-radius: calc(var(--wui-spacing-m) / 2);
441
- overflow: hidden;
442
- box-shadow:
443
- 0 0 0 3px var(--wui-color-gray-glass-002),
444
- 0 0 0 3px var(--wui-color-modal-bg);
445
- transition: box-shadow var(--wui-ease-out-power-1) var(--wui-duration-md);
446
- will-change: box-shadow;
447
- }
448
-
449
- button:hover .network-icon {
450
- box-shadow:
451
- 0 0 0 3px var(--wui-color-gray-glass-005),
452
- 0 0 0 3px var(--wui-color-modal-bg);
453
- }
454
- `;
455
- var R = function(a, e, t, r) {
456
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
457
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
458
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
459
- return o > 3 && i && Object.defineProperty(e, t, i), i;
460
- };
461
- let b = class extends w {
462
- constructor() {
463
- super(...arguments), this.disabled = !1, this.color = "inherit", this.label = "", this.feeRange = "", this.loading = !1, this.onClick = null;
464
- }
465
- render() {
466
- return c`
467
- <button ?disabled=${this.disabled} @click=${this.onClick} ontouchstart>
468
- <wui-visual name=${h(this.name)} class="provider-image"></wui-visual>
469
- <wui-flex flexDirection="column" gap="4xs">
470
- <wui-text variant="paragraph-500" color="fg-100">${this.label}</wui-text>
471
- <wui-flex alignItems="center" justifyContent="flex-start" gap="l">
472
- <wui-text variant="tiny-500" color="fg-100">
473
- <wui-text variant="tiny-400" color="fg-200">Fees</wui-text>
474
- ${this.feeRange}
475
- </wui-text>
476
- <wui-flex gap="xxs">
477
- <wui-icon name="bank" size="xs" color="fg-150"></wui-icon>
478
- <wui-icon name="card" size="xs" color="fg-150"></wui-icon>
479
- </wui-flex>
480
- ${this.networksTemplate()}
481
- </wui-flex>
482
- </wui-flex>
483
- ${this.loading ? c`<wui-loading-spinner color="fg-200" size="md"></wui-loading-spinner>` : c`<wui-icon name="chevronRight" color="fg-200" size="sm"></wui-icon>`}
484
- </button>
485
- `;
486
- }
487
- networksTemplate() {
488
- var r;
489
- const e = O.getAllRequestedCaipNetworks(), t = (r = e == null ? void 0 : e.filter((o) => {
490
- var i;
491
- return (i = o == null ? void 0 : o.assets) == null ? void 0 : i.imageId;
492
- })) == null ? void 0 : r.slice(0, 5);
493
- return c`
494
- <wui-flex class="networks">
495
- ${t == null ? void 0 : t.map((o) => c`
496
- <wui-flex class="network-icon">
497
- <wui-image src=${h(Z.getNetworkImage(o))}></wui-image>
498
- </wui-flex>
499
- `)}
500
- </wui-flex>
501
- `;
502
- }
503
- };
504
- b.styles = [ce];
505
- R([
506
- d({ type: Boolean })
507
- ], b.prototype, "disabled", void 0);
508
- R([
509
- d()
510
- ], b.prototype, "color", void 0);
511
- R([
512
- d()
513
- ], b.prototype, "name", void 0);
514
- R([
515
- d()
516
- ], b.prototype, "label", void 0);
517
- R([
518
- d()
519
- ], b.prototype, "feeRange", void 0);
520
- R([
521
- d({ type: Boolean })
522
- ], b.prototype, "loading", void 0);
523
- R([
524
- d()
525
- ], b.prototype, "onClick", void 0);
526
- b = R([
527
- g("w3m-onramp-provider-item")
528
- ], b);
529
- const le = T`
530
- wui-flex {
531
- border-top: 1px solid var(--wui-color-gray-glass-005);
532
- }
533
-
534
- a {
535
- text-decoration: none;
536
- color: var(--wui-color-fg-175);
537
- font-weight: 500;
538
- display: flex;
539
- align-items: center;
540
- justify-content: center;
541
- gap: var(--wui-spacing-3xs);
542
- }
543
- `;
544
- var ue = function(a, e, t, r) {
545
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
546
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
547
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
548
- return o > 3 && i && Object.defineProperty(e, t, i), i;
549
- };
550
- let Y = class extends w {
551
- render() {
552
- const { termsConditionsUrl: e, privacyPolicyUrl: t } = j.state;
553
- return !e && !t ? null : c`
554
- <wui-flex
555
- .padding=${["m", "s", "s", "s"]}
556
- flexDirection="column"
557
- alignItems="center"
558
- justifyContent="center"
559
- gap="s"
560
- >
561
- <wui-text color="fg-250" variant="small-400" align="center">
562
- We work with the best providers to give you the lowest fees and best support. More options
563
- coming soon!
564
- </wui-text>
565
-
566
- ${this.howDoesItWorkTemplate()}
567
- </wui-flex>
568
- `;
569
- }
570
- howDoesItWorkTemplate() {
571
- return c` <wui-link @click=${this.onWhatIsBuy.bind(this)}>
572
- <wui-icon size="xs" color="accent-100" slot="iconLeft" name="helpCircle"></wui-icon>
573
- How does it work?
574
- </wui-link>`;
575
- }
576
- onWhatIsBuy() {
577
- var t;
578
- const e = O.state.activeChain;
579
- G.sendEvent({
580
- type: "track",
581
- event: "SELECT_WHAT_IS_A_BUY",
582
- properties: {
583
- isSmartAccount: ((t = S.state.preferredAccountTypes) == null ? void 0 : t[e]) === H.ACCOUNT_TYPES.SMART_ACCOUNT
584
- }
585
- }), U.push("WhatIsABuy");
586
- }
587
- };
588
- Y.styles = [le];
589
- Y = ue([
590
- g("w3m-onramp-providers-footer")
591
- ], Y);
592
- var Q = function(a, e, t, r) {
593
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
594
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
595
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
596
- return o > 3 && i && Object.defineProperty(e, t, i), i;
597
- };
598
- let K = class extends w {
599
- constructor() {
600
- super(), this.unsubscribe = [], this.providers = l.state.providers, this.unsubscribe.push(l.subscribeKey("providers", (e) => {
601
- this.providers = e;
602
- }));
603
- }
604
- firstUpdated() {
605
- const e = this.providers.map(async (t) => t.name === "coinbase" ? await this.getCoinbaseOnRampURL() : Promise.resolve(t == null ? void 0 : t.url));
606
- Promise.all(e).then((t) => {
607
- this.providers = this.providers.map((r, o) => ({
608
- ...r,
609
- url: t[o] || ""
610
- }));
611
- });
612
- }
613
- render() {
614
- return c`
615
- <wui-flex flexDirection="column" .padding=${["0", "s", "s", "s"]} gap="xs">
616
- ${this.onRampProvidersTemplate()}
617
- </wui-flex>
618
- <w3m-onramp-providers-footer></w3m-onramp-providers-footer>
619
- `;
620
- }
621
- onRampProvidersTemplate() {
622
- return this.providers.filter((e) => e.supportedChains.includes(O.state.activeChain ?? "eip155")).map((e) => c`
623
- <w3m-onramp-provider-item
624
- label=${e.label}
625
- name=${e.name}
626
- feeRange=${e.feeRange}
627
- @click=${() => {
628
- this.onClickProvider(e);
629
- }}
630
- ?disabled=${!e.url}
631
- data-testid=${`onramp-provider-${e.name}`}
632
- ></w3m-onramp-provider-item>
633
- `);
634
- }
635
- onClickProvider(e) {
636
- var r;
637
- const t = O.state.activeChain;
638
- l.setSelectedProvider(e), U.push("BuyInProgress"), V.openHref(e.url, "popupWindow", "width=600,height=800,scrollbars=yes"), G.sendEvent({
639
- type: "track",
640
- event: "SELECT_BUY_PROVIDER",
641
- properties: {
642
- provider: e.name,
643
- isSmartAccount: ((r = S.state.preferredAccountTypes) == null ? void 0 : r[t]) === H.ACCOUNT_TYPES.SMART_ACCOUNT
644
- }
645
- });
646
- }
647
- async getCoinbaseOnRampURL() {
648
- const e = S.state.address, t = O.state.activeCaipNetwork;
649
- if (!e)
650
- throw new Error("No address found");
651
- if (!(t != null && t.name))
652
- throw new Error("No network found");
653
- const r = M.WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP[t.name] ?? M.WC_COINBASE_PAY_SDK_FALLBACK_CHAIN, o = l.state.purchaseCurrency, i = o ? [o.symbol] : l.state.purchaseCurrencies.map((s) => s.symbol);
654
- return await X.generateOnRampURL({
655
- defaultNetwork: r,
656
- destinationWallets: [
657
- { address: e, blockchains: M.WC_COINBASE_PAY_SDK_CHAINS, assets: i }
658
- ],
659
- partnerUserId: e,
660
- purchaseAmount: l.state.purchaseAmount
661
- });
662
- }
663
- };
664
- Q([
665
- u()
666
- ], K.prototype, "providers", void 0);
667
- K = Q([
668
- g("w3m-onramp-providers-view")
669
- ], K);
670
- const de = T`
671
- :host > wui-grid {
672
- max-height: 360px;
673
- overflow: auto;
674
- }
675
-
676
- wui-flex {
677
- transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md);
678
- will-change: opacity;
679
- }
680
-
681
- wui-grid::-webkit-scrollbar {
682
- display: none;
683
- }
684
-
685
- wui-flex.disabled {
686
- opacity: 0.3;
687
- pointer-events: none;
688
- user-select: none;
689
- }
690
- `;
691
- var E = function(a, e, t, r) {
692
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
693
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
694
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
695
- return o > 3 && i && Object.defineProperty(e, t, i), i;
696
- };
697
- let _ = class extends w {
698
- constructor() {
699
- super(), this.unsubscribe = [], this.selectedCurrency = l.state.purchaseCurrencies, this.tokens = l.state.purchaseCurrencies, this.tokenImages = x.state.tokenImages, this.checked = z.state.isLegalCheckboxChecked, this.unsubscribe.push(l.subscribe((e) => {
700
- this.selectedCurrency = e.purchaseCurrencies, this.tokens = e.purchaseCurrencies;
701
- }), x.subscribeKey("tokenImages", (e) => this.tokenImages = e), z.subscribeKey("isLegalCheckboxChecked", (e) => {
702
- this.checked = e;
703
- }));
704
- }
705
- disconnectedCallback() {
706
- this.unsubscribe.forEach((e) => e());
707
- }
708
- render() {
709
- var n;
710
- const { termsConditionsUrl: e, privacyPolicyUrl: t } = j.state, r = (n = j.state.features) == null ? void 0 : n.legalCheckbox, s = !!(e || t) && !!r && !this.checked;
711
- return c`
712
- <w3m-legal-checkbox></w3m-legal-checkbox>
713
- <wui-flex
714
- flexDirection="column"
715
- .padding=${["0", "s", "s", "s"]}
716
- gap="xs"
717
- class=${h(s ? "disabled" : void 0)}
718
- >
719
- ${this.currenciesTemplate(s)}
720
- </wui-flex>
721
- <w3m-legal-footer></w3m-legal-footer>
722
- `;
723
- }
724
- currenciesTemplate(e = !1) {
725
- return this.tokens.map((t) => {
726
- var r;
727
- return c`
728
- <wui-list-item
729
- imageSrc=${h((r = this.tokenImages) == null ? void 0 : r[t.symbol])}
730
- @click=${() => this.selectToken(t)}
731
- variant="image"
732
- tabIdx=${h(e ? -1 : void 0)}
733
- >
734
- <wui-flex gap="3xs" alignItems="center">
735
- <wui-text variant="paragraph-500" color="fg-100">${t.name}</wui-text>
736
- <wui-text variant="small-400" color="fg-200">${t.symbol}</wui-text>
737
- </wui-flex>
738
- </wui-list-item>
739
- `;
740
- });
741
- }
742
- selectToken(e) {
743
- e && (l.setPurchaseCurrency(e), I.close());
744
- }
745
- };
746
- _.styles = de;
747
- E([
748
- u()
749
- ], _.prototype, "selectedCurrency", void 0);
750
- E([
751
- u()
752
- ], _.prototype, "tokens", void 0);
753
- E([
754
- u()
755
- ], _.prototype, "tokenImages", void 0);
756
- E([
757
- u()
758
- ], _.prototype, "checked", void 0);
759
- _ = E([
760
- g("w3m-onramp-token-select-view")
761
- ], _);
762
- const pe = T`
763
- @keyframes shake {
764
- 0% {
765
- transform: translateX(0);
766
- }
767
- 25% {
768
- transform: translateX(3px);
769
- }
770
- 50% {
771
- transform: translateX(-3px);
772
- }
773
- 75% {
774
- transform: translateX(3px);
775
- }
776
- 100% {
777
- transform: translateX(0);
778
- }
779
- }
780
-
781
- wui-flex:first-child:not(:only-child) {
782
- position: relative;
783
- }
784
-
785
- wui-loading-thumbnail {
786
- position: absolute;
787
- }
788
-
789
- wui-visual {
790
- width: var(--wui-wallet-image-size-lg);
791
- height: var(--wui-wallet-image-size-lg);
792
- border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
793
- position: relative;
794
- overflow: hidden;
795
- }
796
-
797
- wui-visual::after {
798
- content: '';
799
- display: block;
800
- width: 100%;
801
- height: 100%;
802
- position: absolute;
803
- inset: 0;
804
- border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
805
- box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
806
- }
807
-
808
- wui-icon-box {
809
- position: absolute;
810
- right: calc(var(--wui-spacing-3xs) * -1);
811
- bottom: calc(var(--wui-spacing-3xs) * -1);
812
- opacity: 0;
813
- transform: scale(0.5);
814
- transition:
815
- opacity var(--wui-ease-out-power-2) var(--wui-duration-lg),
816
- transform var(--wui-ease-out-power-2) var(--wui-duration-lg);
817
- will-change: opacity, transform;
818
- }
819
-
820
- wui-text[align='center'] {
821
- width: 100%;
822
- padding: 0px var(--wui-spacing-l);
823
- }
824
-
825
- [data-error='true'] wui-icon-box {
826
- opacity: 1;
827
- transform: scale(1);
828
- }
829
-
830
- [data-error='true'] > wui-flex:first-child {
831
- animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
832
- }
833
-
834
- [data-retry='false'] wui-link {
835
- display: none;
836
- }
837
-
838
- [data-retry='true'] wui-link {
839
- display: block;
840
- opacity: 1;
841
- }
842
-
843
- wui-link {
844
- padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs);
845
- }
846
- `;
847
- var y = function(a, e, t, r) {
848
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
849
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
850
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
851
- return o > 3 && i && Object.defineProperty(e, t, i), i;
852
- };
853
- let m = class extends w {
854
- constructor() {
855
- super(), this.unsubscribe = [], this.selectedOnRampProvider = l.state.selectedProvider, this.uri = ee.state.wcUri, this.ready = !1, this.showRetry = !1, this.buffering = !1, this.error = !1, this.startTime = null, this.isMobile = !1, this.onRetry = void 0, this.unsubscribe.push(l.subscribeKey("selectedProvider", (e) => {
856
- this.selectedOnRampProvider = e;
857
- })), this.watchTransactions();
858
- }
859
- disconnectedCallback() {
860
- this.intervalId && clearInterval(this.intervalId);
861
- }
862
- render() {
863
- var r, o;
864
- let e = "Continue in external window";
865
- this.error ? e = "Buy failed" : this.selectedOnRampProvider && (e = `Buy in ${(r = this.selectedOnRampProvider) == null ? void 0 : r.label}`);
866
- const t = this.error ? "Buy can be declined from your side or due to and error on the provider app" : "We’ll notify you once your Buy is processed";
867
- return c`
868
- <wui-flex
869
- data-error=${h(this.error)}
870
- data-retry=${this.showRetry}
871
- flexDirection="column"
872
- alignItems="center"
873
- .padding=${["3xl", "xl", "xl", "xl"]}
874
- gap="xl"
875
- >
876
- <wui-flex justifyContent="center" alignItems="center">
877
- <wui-visual
878
- name=${h((o = this.selectedOnRampProvider) == null ? void 0 : o.name)}
879
- size="lg"
880
- class="provider-image"
881
- >
882
- </wui-visual>
883
-
884
- ${this.error ? null : this.loaderTemplate()}
885
-
886
- <wui-icon-box
887
- backgroundColor="error-100"
888
- background="opaque"
889
- iconColor="error-100"
890
- icon="close"
891
- size="sm"
892
- border
893
- borderColor="wui-color-bg-125"
894
- ></wui-icon-box>
895
- </wui-flex>
896
-
897
- <wui-flex flexDirection="column" alignItems="center" gap="xs">
898
- <wui-text variant="paragraph-500" color=${this.error ? "error-100" : "fg-100"}>
899
- ${e}
900
- </wui-text>
901
- <wui-text align="center" variant="small-500" color="fg-200">${t}</wui-text>
902
- </wui-flex>
903
-
904
- ${this.error ? this.tryAgainTemplate() : null}
905
- </wui-flex>
906
-
907
- <wui-flex .padding=${["0", "xl", "xl", "xl"]} justifyContent="center">
908
- <wui-link @click=${this.onCopyUri} color="fg-200">
909
- <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
910
- Copy link
911
- </wui-link>
912
- </wui-flex>
913
- `;
914
- }
915
- watchTransactions() {
916
- if (this.selectedOnRampProvider)
917
- switch (this.selectedOnRampProvider.name) {
918
- case "coinbase":
919
- this.startTime = Date.now(), this.initializeCoinbaseTransactions();
920
- break;
921
- }
922
- }
923
- async initializeCoinbaseTransactions() {
924
- await this.watchCoinbaseTransactions(), this.intervalId = setInterval(() => this.watchCoinbaseTransactions(), 4e3);
925
- }
926
- async watchCoinbaseTransactions() {
927
- try {
928
- const e = S.state.address;
929
- if (!e)
930
- throw new Error("No address found");
931
- (await X.fetchTransactions({
932
- account: e,
933
- onramp: "coinbase"
934
- })).data.filter((o) => new Date(o.metadata.minedAt) > new Date(this.startTime) || o.metadata.status === "ONRAMP_TRANSACTION_STATUS_IN_PROGRESS").length ? (clearInterval(this.intervalId), U.replace("OnRampActivity")) : this.startTime && Date.now() - this.startTime >= 18e4 && (clearInterval(this.intervalId), this.error = !0);
935
- } catch (e) {
936
- L.showError(e);
937
- }
938
- }
939
- onTryAgain() {
940
- this.selectedOnRampProvider && (this.error = !1, V.openHref(this.selectedOnRampProvider.url, "popupWindow", "width=600,height=800,scrollbars=yes"));
941
- }
942
- tryAgainTemplate() {
943
- var e;
944
- return (e = this.selectedOnRampProvider) != null && e.url ? c`<wui-button size="md" variant="accent" @click=${this.onTryAgain.bind(this)}>
945
- <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
946
- Try again
947
- </wui-button>` : null;
948
- }
949
- loaderTemplate() {
950
- const e = te.state.themeVariables["--w3m-border-radius-master"], t = e ? parseInt(e.replace("px", ""), 10) : 4;
951
- return c`<wui-loading-thumbnail radius=${t * 9}></wui-loading-thumbnail>`;
952
- }
953
- onCopyUri() {
954
- var e;
955
- if (!((e = this.selectedOnRampProvider) != null && e.url)) {
956
- L.showError("No link found"), U.goBack();
957
- return;
958
- }
959
- try {
960
- V.copyToClopboard(this.selectedOnRampProvider.url), L.showSuccess("Link copied");
961
- } catch {
962
- L.showError("Failed to copy");
963
- }
964
- }
965
- };
966
- m.styles = pe;
967
- y([
968
- u()
969
- ], m.prototype, "intervalId", void 0);
970
- y([
971
- u()
972
- ], m.prototype, "selectedOnRampProvider", void 0);
973
- y([
974
- u()
975
- ], m.prototype, "uri", void 0);
976
- y([
977
- u()
978
- ], m.prototype, "ready", void 0);
979
- y([
980
- u()
981
- ], m.prototype, "showRetry", void 0);
982
- y([
983
- u()
984
- ], m.prototype, "buffering", void 0);
985
- y([
986
- u()
987
- ], m.prototype, "error", void 0);
988
- y([
989
- u()
990
- ], m.prototype, "startTime", void 0);
991
- y([
992
- d({ type: Boolean })
993
- ], m.prototype, "isMobile", void 0);
994
- y([
995
- d()
996
- ], m.prototype, "onRetry", void 0);
997
- m = y([
998
- g("w3m-buy-in-progress-view")
999
- ], m);
1000
- var he = function(a, e, t, r) {
1001
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
1002
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
1003
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
1004
- return o > 3 && i && Object.defineProperty(e, t, i), i;
1005
- };
1006
- let q = class extends w {
1007
- render() {
1008
- return c`
1009
- <wui-flex
1010
- flexDirection="column"
1011
- .padding=${["xxl", "3xl", "xl", "3xl"]}
1012
- alignItems="center"
1013
- gap="xl"
1014
- >
1015
- <wui-visual name="onrampCard"></wui-visual>
1016
- <wui-flex flexDirection="column" gap="xs" alignItems="center">
1017
- <wui-text align="center" variant="paragraph-500" color="fg-100">
1018
- Quickly and easily buy digital assets!
1019
- </wui-text>
1020
- <wui-text align="center" variant="small-400" color="fg-200">
1021
- Simply select your preferred onramp provider and add digital assets to your account
1022
- using your credit card or bank transfer
1023
- </wui-text>
1024
- </wui-flex>
1025
- <wui-button @click=${U.goBack}>
1026
- <wui-icon size="sm" color="inherit" name="add" slot="iconLeft"></wui-icon>
1027
- Buy
1028
- </wui-button>
1029
- </wui-flex>
1030
- `;
1031
- }
1032
- };
1033
- q = he([
1034
- g("w3m-what-is-a-buy-view")
1035
- ], q);
1036
- const me = T`
1037
- :host {
1038
- width: 100%;
1039
- }
1040
-
1041
- wui-loading-spinner {
1042
- position: absolute;
1043
- top: 50%;
1044
- right: 20px;
1045
- transform: translateY(-50%);
1046
- }
1047
-
1048
- .currency-container {
1049
- position: absolute;
1050
- top: 50%;
1051
- transform: translateY(-50%);
1052
- right: var(--wui-spacing-1xs);
1053
- height: 40px;
1054
- padding: var(--wui-spacing-xs) var(--wui-spacing-1xs) var(--wui-spacing-xs)
1055
- var(--wui-spacing-xs);
1056
- min-width: 95px;
1057
- border-radius: var(--FULL, 1000px);
1058
- border: 1px solid var(--wui-color-gray-glass-002);
1059
- background: var(--wui-color-gray-glass-002);
1060
- cursor: pointer;
1061
- }
1062
-
1063
- .currency-container > wui-image {
1064
- height: 24px;
1065
- width: 24px;
1066
- border-radius: 50%;
1067
- }
1068
- `;
1069
- var k = function(a, e, t, r) {
1070
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
1071
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
1072
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
1073
- return o > 3 && i && Object.defineProperty(e, t, i), i;
1074
- };
1075
- let C = class extends w {
1076
- constructor() {
1077
- var e;
1078
- super(), this.unsubscribe = [], this.type = "Token", this.value = 0, this.currencies = [], this.selectedCurrency = (e = this.currencies) == null ? void 0 : e[0], this.currencyImages = x.state.currencyImages, this.tokenImages = x.state.tokenImages, this.unsubscribe.push(l.subscribeKey("purchaseCurrency", (t) => {
1079
- !t || this.type === "Fiat" || (this.selectedCurrency = this.formatPurchaseCurrency(t));
1080
- }), l.subscribeKey("paymentCurrency", (t) => {
1081
- !t || this.type === "Token" || (this.selectedCurrency = this.formatPaymentCurrency(t));
1082
- }), l.subscribe((t) => {
1083
- this.type === "Fiat" ? this.currencies = t.purchaseCurrencies.map(this.formatPurchaseCurrency) : this.currencies = t.paymentCurrencies.map(this.formatPaymentCurrency);
1084
- }), x.subscribe((t) => {
1085
- this.currencyImages = { ...t.currencyImages }, this.tokenImages = { ...t.tokenImages };
1086
- }));
1087
- }
1088
- firstUpdated() {
1089
- l.getAvailableCurrencies();
1090
- }
1091
- disconnectedCallback() {
1092
- this.unsubscribe.forEach((e) => e());
1093
- }
1094
- render() {
1095
- var r;
1096
- const e = ((r = this.selectedCurrency) == null ? void 0 : r.symbol) || "", t = this.currencyImages[e] || this.tokenImages[e];
1097
- return c`<wui-input-text type="number" size="lg" value=${this.value}>
1098
- ${this.selectedCurrency ? c` <wui-flex
1099
- class="currency-container"
1100
- justifyContent="space-between"
1101
- alignItems="center"
1102
- gap="xxs"
1103
- @click=${() => I.open({ view: `OnRamp${this.type}Select` })}
1104
- >
1105
- <wui-image src=${h(t)}></wui-image>
1106
- <wui-text color="fg-100">${this.selectedCurrency.symbol}</wui-text>
1107
- </wui-flex>` : c`<wui-loading-spinner></wui-loading-spinner>`}
1108
- </wui-input-text>`;
1109
- }
1110
- formatPaymentCurrency(e) {
1111
- return {
1112
- name: e.id,
1113
- symbol: e.id
1114
- };
1115
- }
1116
- formatPurchaseCurrency(e) {
1117
- return {
1118
- name: e.name,
1119
- symbol: e.symbol
1120
- };
1121
- }
1122
- };
1123
- C.styles = me;
1124
- k([
1125
- d({ type: String })
1126
- ], C.prototype, "type", void 0);
1127
- k([
1128
- d({ type: Number })
1129
- ], C.prototype, "value", void 0);
1130
- k([
1131
- u()
1132
- ], C.prototype, "currencies", void 0);
1133
- k([
1134
- u()
1135
- ], C.prototype, "selectedCurrency", void 0);
1136
- k([
1137
- u()
1138
- ], C.prototype, "currencyImages", void 0);
1139
- k([
1140
- u()
1141
- ], C.prototype, "tokenImages", void 0);
1142
- C = k([
1143
- g("w3m-onramp-input")
1144
- ], C);
1145
- const fe = T`
1146
- :host > wui-flex {
1147
- width: 100%;
1148
- max-width: 360px;
1149
- }
1150
-
1151
- :host > wui-flex > wui-flex {
1152
- border-radius: var(--wui-border-radius-l);
1153
- width: 100%;
1154
- }
1155
-
1156
- .amounts-container {
1157
- width: 100%;
1158
- }
1159
- `;
1160
- var $ = function(a, e, t, r) {
1161
- var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, s;
1162
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, r);
1163
- else for (var n = a.length - 1; n >= 0; n--) (s = a[n]) && (i = (o < 3 ? s(i) : o > 3 ? s(e, t, i) : s(e, t)) || i);
1164
- return o > 3 && i && Object.defineProperty(e, t, i), i;
1165
- };
1166
- const we = {
1167
- USD: "$",
1168
- EUR: "€",
1169
- GBP: "£"
1170
- }, ge = [100, 250, 500, 1e3];
1171
- let v = class extends w {
1172
- constructor() {
1173
- super(), this.unsubscribe = [], this.disabled = !1, this.caipAddress = O.state.activeCaipAddress, this.loading = I.state.loading, this.paymentCurrency = l.state.paymentCurrency, this.paymentAmount = l.state.paymentAmount, this.purchaseAmount = l.state.purchaseAmount, this.quoteLoading = l.state.quotesLoading, this.unsubscribe.push(O.subscribeKey("activeCaipAddress", (e) => this.caipAddress = e), I.subscribeKey("loading", (e) => {
1174
- this.loading = e;
1175
- }), l.subscribe((e) => {
1176
- this.paymentCurrency = e.paymentCurrency, this.paymentAmount = e.paymentAmount, this.purchaseAmount = e.purchaseAmount, this.quoteLoading = e.quotesLoading;
1177
- }));
1178
- }
1179
- disconnectedCallback() {
1180
- this.unsubscribe.forEach((e) => e());
1181
- }
1182
- render() {
1183
- return c`
1184
- <wui-flex flexDirection="column" justifyContent="center" alignItems="center">
1185
- <wui-flex flexDirection="column" alignItems="center" gap="xs">
1186
- <w3m-onramp-input
1187
- type="Fiat"
1188
- @inputChange=${this.onPaymentAmountChange.bind(this)}
1189
- .value=${this.paymentAmount || 0}
1190
- ></w3m-onramp-input>
1191
- <w3m-onramp-input
1192
- type="Token"
1193
- .value=${this.purchaseAmount || 0}
1194
- .loading=${this.quoteLoading}
1195
- ></w3m-onramp-input>
1196
- <wui-flex justifyContent="space-evenly" class="amounts-container" gap="xs">
1197
- ${ge.map((e) => {
1198
- var t;
1199
- return c`<wui-button
1200
- variant=${this.paymentAmount === e ? "accent" : "neutral"}
1201
- size="md"
1202
- textVariant="paragraph-600"
1203
- fullWidth
1204
- @click=${() => this.selectPresetAmount(e)}
1205
- >${`${we[((t = this.paymentCurrency) == null ? void 0 : t.id) || "USD"]} ${e}`}</wui-button
1206
- >`;
1207
- })}
1208
- </wui-flex>
1209
- ${this.templateButton()}
1210
- </wui-flex>
1211
- </wui-flex>
1212
- `;
1213
- }
1214
- templateButton() {
1215
- return this.caipAddress ? c`<wui-button
1216
- @click=${this.getQuotes.bind(this)}
1217
- variant="main"
1218
- fullWidth
1219
- size="lg"
1220
- borderRadius="xs"
1221
- >
1222
- Get quotes
1223
- </wui-button>` : c`<wui-button
1224
- @click=${this.openModal.bind(this)}
1225
- variant="accent"
1226
- fullWidth
1227
- size="lg"
1228
- borderRadius="xs"
1229
- >
1230
- Connect wallet
1231
- </wui-button>`;
1232
- }
1233
- getQuotes() {
1234
- this.loading || I.open({ view: "OnRampProviders" });
1235
- }
1236
- openModal() {
1237
- I.open({ view: "Connect" });
1238
- }
1239
- async onPaymentAmountChange(e) {
1240
- l.setPaymentAmount(Number(e.detail)), await l.getQuote();
1241
- }
1242
- async selectPresetAmount(e) {
1243
- l.setPaymentAmount(e), await l.getQuote();
1244
- }
1245
- };
1246
- v.styles = fe;
1247
- $([
1248
- d({ type: Boolean })
1249
- ], v.prototype, "disabled", void 0);
1250
- $([
1251
- u()
1252
- ], v.prototype, "caipAddress", void 0);
1253
- $([
1254
- u()
1255
- ], v.prototype, "loading", void 0);
1256
- $([
1257
- u()
1258
- ], v.prototype, "paymentCurrency", void 0);
1259
- $([
1260
- u()
1261
- ], v.prototype, "paymentAmount", void 0);
1262
- $([
1263
- u()
1264
- ], v.prototype, "purchaseAmount", void 0);
1265
- $([
1266
- u()
1267
- ], v.prototype, "quoteLoading", void 0);
1268
- v = $([
1269
- g("w3m-onramp-widget")
1270
- ], v);
1271
- export {
1272
- m as W3mBuyInProgressView,
1273
- P as W3mOnRampActivityView,
1274
- K as W3mOnRampProvidersView,
1275
- A as W3mOnrampFiatSelectView,
1276
- _ as W3mOnrampTokensView,
1277
- v as W3mOnrampWidget,
1278
- q as W3mWhatIsABuyView
1279
- };