@directcryptopay/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +357 -0
  2. package/dist/ConstantsUtil-B-_-u8aQ.js +6 -0
  3. package/dist/add-KF4m4jFK.js +19 -0
  4. package/dist/all-wallets-D6NAjQgX.js +10 -0
  5. package/dist/app-store-D7TTn-EO.js +21 -0
  6. package/dist/apple-DjX2E2hE.js +22 -0
  7. package/dist/arrow-bottom-C0YrNJYB.js +12 -0
  8. package/dist/arrow-bottom-circle-Dlxvx_XG.js +15 -0
  9. package/dist/arrow-left-x8_-lUyK.js +12 -0
  10. package/dist/arrow-right-BTZybj80.js +12 -0
  11. package/dist/arrow-top-LzH7iLCp.js +12 -0
  12. package/dist/bank-23jp-IV_.js +18 -0
  13. package/dist/browser-EjoorDid.js +18 -0
  14. package/dist/card-DGgWwtwC.js +18 -0
  15. package/dist/ccip-BMANewTU.js +150 -0
  16. package/dist/checkmark-B1qcQhBo.js +15 -0
  17. package/dist/checkmark-bold-Cyc4IEEJ.js +12 -0
  18. package/dist/chevron-bottom-ClHs08rB.js +12 -0
  19. package/dist/chevron-left-O8h_551_.js +12 -0
  20. package/dist/chevron-right-DP3xpyIA.js +12 -0
  21. package/dist/chevron-top-CuwkBUs9.js +12 -0
  22. package/dist/chrome-store-zfT_aJ3R.js +65 -0
  23. package/dist/clock-DHZqivIS.js +12 -0
  24. package/dist/close-Cp9rNAw4.js +12 -0
  25. package/dist/coinPlaceholder-U7-T1KKQ.js +12 -0
  26. package/dist/compass-Ds5-PRSR.js +12 -0
  27. package/dist/copy-Jg4HdIMf.js +19 -0
  28. package/dist/core/api.d.ts +30 -0
  29. package/dist/core/config.d.ts +59 -0
  30. package/dist/core/logic.d.ts +2 -0
  31. package/dist/core/wallet.d.ts +34 -0
  32. package/dist/cursor-DmMevduB.js +7 -0
  33. package/dist/cursor-transparent-Dn9-1SV8.js +16 -0
  34. package/dist/dcp-sdk.umd.js +12000 -0
  35. package/dist/dcp.d.ts +10 -0
  36. package/dist/desktop-C4udXXlZ.js +13 -0
  37. package/dist/disconnect-wd1BYLxt.js +12 -0
  38. package/dist/discord-DthxuCAP.js +21 -0
  39. package/dist/email-B3jSnUFE.js +696 -0
  40. package/dist/embedded-wallet-CJHmoBI2.js +468 -0
  41. package/dist/etherscan-Cjp4xfMW.js +10 -0
  42. package/dist/exclamation-triangle-CRNR5WOy.js +8 -0
  43. package/dist/extension-Cydk0mZt.js +12 -0
  44. package/dist/external-link-CuPTAoq9.js +12 -0
  45. package/dist/facebook-CghqXmdf.js +30 -0
  46. package/dist/farcaster-BREqMX4y.js +16 -0
  47. package/dist/filters-Dn_Ys7ew.js +12 -0
  48. package/dist/github-C-A7JmIY.js +22 -0
  49. package/dist/google-CCdM_naE.js +22 -0
  50. package/dist/hashTypedData-D2Qmzscs.js +197 -0
  51. package/dist/help-circle-DIH4vyj3.js +16 -0
  52. package/dist/id-DkJ0gBuy.js +16 -0
  53. package/dist/if-defined-BciplFKz.js +744 -0
  54. package/dist/image-qMjyiXM0.js +8 -0
  55. package/dist/index--3Zp0jAb.js +45 -0
  56. package/dist/index-1adX-Fit.js +65 -0
  57. package/dist/index-AvC0IGDl.js +7864 -0
  58. package/dist/index-B2-vKLd8.js +276 -0
  59. package/dist/index-B2iDt0TJ.js +146 -0
  60. package/dist/index-B5zkXsLJ.js +320 -0
  61. package/dist/index-B7K86vWu.js +1742 -0
  62. package/dist/index-BBkcvSiY.js +511 -0
  63. package/dist/index-BdjxQs66.js +181 -0
  64. package/dist/index-Bijd4_Ns.js +294 -0
  65. package/dist/index-BpXOsxzU.js +387 -0
  66. package/dist/index-C1QEJL-2.js +572 -0
  67. package/dist/index-C27dwOyE.js +243 -0
  68. package/dist/index-C4BX3QW8.js +58 -0
  69. package/dist/index-CMPIqsB1.js +170 -0
  70. package/dist/index-CTYngdl0.js +21991 -0
  71. package/dist/index-CUdQyyFn.js +51 -0
  72. package/dist/index-CX60z_g2.js +573 -0
  73. package/dist/index-CppCc1n8.js +65 -0
  74. package/dist/index-CqVegmN4.js +559 -0
  75. package/dist/index-CuiyMA8F.js +78 -0
  76. package/dist/index-CwB_qRfM.js +305 -0
  77. package/dist/index-CxOF7GqE.js +265 -0
  78. package/dist/index-D-IzHD_8.js +54 -0
  79. package/dist/index-DRNiFv9I.js +218 -0
  80. package/dist/index-Da8oZh8H.js +838 -0
  81. package/dist/index-DiHImG4L.js +44236 -0
  82. package/dist/index-DmOMXRG1.js +181 -0
  83. package/dist/index-DoSYqTQg.js +199 -0
  84. package/dist/index-DpHXq5_E.js +603 -0
  85. package/dist/index-DtCsAVBg.js +78 -0
  86. package/dist/index-Ij6XA6_4.js +77 -0
  87. package/dist/index-SzyBYfzA.js +8490 -0
  88. package/dist/index-eW8y-mXH.js +257 -0
  89. package/dist/index-fxzIDZsb.js +75 -0
  90. package/dist/index-lbhz9evJ.js +97 -0
  91. package/dist/index.d.ts +3 -0
  92. package/dist/index.js +4 -0
  93. package/dist/info-DMIGgjkL.js +7 -0
  94. package/dist/info-circle-CJuIKZSx.js +16 -0
  95. package/dist/lightbulb-qFT6WEWV.js +7 -0
  96. package/dist/localBatchGatewayRequest-CsMVMFBc.js +91 -0
  97. package/dist/mail-DoYgQvOt.js +12 -0
  98. package/dist/mobile-URtsh7o-.js +13 -0
  99. package/dist/more-DoQd10TF.js +15 -0
  100. package/dist/network-placeholder-BBA2Ue6C.js +18 -0
  101. package/dist/nftPlaceholder-C9RXWz9k.js +12 -0
  102. package/dist/off-YcuDQczT.js +12 -0
  103. package/dist/onramp-BfqDIx4o.js +1279 -0
  104. package/dist/parseSignature-280HB24T.js +3560 -0
  105. package/dist/play-store-sFaloG_r.js +36 -0
  106. package/dist/plus-l0wekSht.js +17 -0
  107. package/dist/qr-code-CihrUU4G.js +10 -0
  108. package/dist/receive-dfY1Cu-g.js +186 -0
  109. package/dist/recycle-horizontal-nXu6YaPw.js +13 -0
  110. package/dist/ref-huAzXCX0.js +41 -0
  111. package/dist/refresh-D2ZbVeNC.js +12 -0
  112. package/dist/reown-logo-BMaTMJmc.js +16 -0
  113. package/dist/search-YVM9q3J-.js +12 -0
  114. package/dist/secp256k1-BrysY3Sv.js +1302 -0
  115. package/dist/secp256k1-DPQgTBwQ.js +1510 -0
  116. package/dist/send-BwQZPKxI.js +19 -0
  117. package/dist/send-GyetMVu1.js +1038 -0
  118. package/dist/socials-B0W91J9k.js +574 -0
  119. package/dist/swapHorizontal-Dy_oQEkp.js +12 -0
  120. package/dist/swapHorizontalBold-C4JpaMpc.js +12 -0
  121. package/dist/swapHorizontalMedium-D5NuVZFh.js +20 -0
  122. package/dist/swapHorizontalRoundedBold-Bq4P2MCj.js +12 -0
  123. package/dist/swapVertical-CVQ8Mg03.js +12 -0
  124. package/dist/swaps-CA04SSdK.js +1637 -0
  125. package/dist/telegram-BP4SgW_L.js +20 -0
  126. package/dist/three-dots-BJYGJ-dQ.js +9 -0
  127. package/dist/transactions-Bq-98Tsg.js +37 -0
  128. package/dist/twitch-DTATWo9M.js +22 -0
  129. package/dist/twitterIcon-D5UWPInb.js +10 -0
  130. package/dist/types.d.ts +128 -0
  131. package/dist/ui/Modal.d.ts +9 -0
  132. package/dist/ui/index.d.ts +6 -0
  133. package/dist/verify-Byvj8Wi1.js +12 -0
  134. package/dist/verify-filled-B40taNm0.js +12 -0
  135. package/dist/w3m-modal-HV6SE74G.js +1037 -0
  136. package/dist/wallet-Cp-6Kk88.js +12 -0
  137. package/dist/wallet-placeholder-C3juwA9o.js +18 -0
  138. package/dist/walletconnect-CRkIiLCx.js +36 -0
  139. package/dist/warning-circle-DtvCLwG4.js +16 -0
  140. package/dist/x-Cqyx5eCt.js +16 -0
  141. package/package.json +70 -0
@@ -0,0 +1,1279 @@
1
+ import { cz as T, cA as w, cB as c, dM as J, dS as l, dc as U, dL as x, cS as S, dd as j, cN as I, cT as O, cV as Z, d3 as G, cX as H, cE as B, cY as V, d6 as M, d0 as X, d1 as ee, cU as L, cW as te } from "./index-DiHImG4L.js";
2
+ import { n as d, c as g, o as h, r as u } from "./if-defined-BciplFKz.js";
3
+ import { D as ie, T as re } from "./index-BBkcvSiY.js";
4
+ import "./index-fxzIDZsb.js";
5
+ import "./index-CUdQyyFn.js";
6
+ import "./index-lbhz9evJ.js";
7
+ import "./index-BdjxQs66.js";
8
+ import { O as z } from "./index-CwB_qRfM.js";
9
+ import "./index-DpHXq5_E.js";
10
+ import "./index-D-IzHD_8.js";
11
+ import "./index-Bijd4_Ns.js";
12
+ import "./index-CppCc1n8.js";
13
+ import "./index-CxOF7GqE.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 D = 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 A = class extends w {
204
+ constructor() {
205
+ super(), this.unsubscribe = [], this.selectedOnRampProvider = l.state.selectedProvider, this.loading = !1, this.coinbaseTransactions = U.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
+ }, U.subscribe((e) => {
210
+ this.coinbaseTransactions = { ...e.coinbaseTransactions };
211
+ })), U.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 U.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 U.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
+ A.styles = se;
293
+ D([
294
+ u()
295
+ ], A.prototype, "selectedOnRampProvider", void 0);
296
+ D([
297
+ u()
298
+ ], A.prototype, "loading", void 0);
299
+ D([
300
+ u()
301
+ ], A.prototype, "coinbaseTransactions", void 0);
302
+ D([
303
+ u()
304
+ ], A.prototype, "tokenImages", void 0);
305
+ A = D([
306
+ g("w3m-onramp-activity-view")
307
+ ], A);
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 P = 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
+ P.styles = ae;
382
+ W([
383
+ u()
384
+ ], P.prototype, "selectedCurrency", void 0);
385
+ W([
386
+ u()
387
+ ], P.prototype, "currencies", void 0);
388
+ W([
389
+ u()
390
+ ], P.prototype, "currencyImages", void 0);
391
+ W([
392
+ u()
393
+ ], P.prototype, "checked", void 0);
394
+ P = W([
395
+ g("w3m-onramp-fiat-select-view")
396
+ ], P);
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
+ }), B.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), B.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), B.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"), B.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=${B.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
+ A as W3mOnRampActivityView,
1274
+ K as W3mOnRampProvidersView,
1275
+ P as W3mOnrampFiatSelectView,
1276
+ _ as W3mOnrampTokensView,
1277
+ v as W3mOnrampWidget,
1278
+ q as W3mWhatIsABuyView
1279
+ };