@directcryptopay/sdk 0.2.4 → 0.3.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 (127) hide show
  1. package/README.md +51 -87
  2. package/dist/core/config.d.ts +9 -46
  3. package/dist/core/iframe.d.ts +16 -0
  4. package/dist/dcp-sdk.umd.js +1 -12811
  5. package/dist/dcp.d.ts +12 -5
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +219 -2
  8. package/dist/types.d.ts +26 -164
  9. package/package.json +3 -13
  10. package/dist/ExchangeController-CbO41bcH.js +0 -217
  11. package/dist/HelpersUtil-DHm6EVSE.js +0 -120
  12. package/dist/NavigationUtil-kj9LEOOd.js +0 -8
  13. package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
  14. package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
  15. package/dist/PhArrowDown-C9AkNvLs.js +0 -73
  16. package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
  17. package/dist/PhArrowRight-DM1tna0G.js +0 -73
  18. package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
  19. package/dist/PhArrowUp-DmktzOWy.js +0 -73
  20. package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
  21. package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
  22. package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
  23. package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
  24. package/dist/PhBank-4_9QzqIB.js +0 -73
  25. package/dist/PhBrowser-B-JSznId.js +0 -73
  26. package/dist/PhCaretDown-vV5oHMNi.js +0 -73
  27. package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
  28. package/dist/PhCaretRight-CqQN4TT3.js +0 -73
  29. package/dist/PhCaretUp-Df7UCAHy.js +0 -73
  30. package/dist/PhCheck-gtpfK4ed.js +0 -73
  31. package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
  32. package/dist/PhClock-SDCW-NmF.js +0 -73
  33. package/dist/PhCompass-B7hgtdx-.js +0 -73
  34. package/dist/PhCopy-BcnhyXCy.js +0 -73
  35. package/dist/PhCreditCard-BJjByVgu.js +0 -73
  36. package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
  37. package/dist/PhDesktop-B3VKPuJx.js +0 -73
  38. package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
  39. package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
  40. package/dist/PhEnvelope-67uzHbI9.js +0 -73
  41. package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
  42. package/dist/PhGlobe-TMm_6qGk.js +0 -73
  43. package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
  44. package/dist/PhImage-gY96WtHR.js +0 -73
  45. package/dist/PhInfo-DRQM_ZDP.js +0 -73
  46. package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
  47. package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
  48. package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
  49. package/dist/PhPlus-BfTsQnUz.js +0 -73
  50. package/dist/PhPower-CxYUGOWn.js +0 -73
  51. package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
  52. package/dist/PhQrCode-BuJ97NYJ.js +0 -73
  53. package/dist/PhQuestion-kJoP8Mja.js +0 -73
  54. package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
  55. package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
  56. package/dist/PhSignOut-jk97OSVt.js +0 -73
  57. package/dist/PhSpinner-CiYOhwMg.js +0 -73
  58. package/dist/PhTrash-pxerMqzd.js +0 -73
  59. package/dist/PhUser-BMg0VV4A.js +0 -73
  60. package/dist/PhVault-DYQvx5A-.js +0 -73
  61. package/dist/PhWarning-NLC5Mj87.js +0 -73
  62. package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
  63. package/dist/PhX-Bx4wpwm3.js +0 -73
  64. package/dist/SwapController-Ch0FFTEt.js +0 -457
  65. package/dist/ccip-BrGhNXIM.js +0 -150
  66. package/dist/core/api.d.ts +0 -39
  67. package/dist/core/logic.d.ts +0 -2
  68. package/dist/core/wallet.d.ts +0 -55
  69. package/dist/data-capture-CpafmuCb.js +0 -490
  70. package/dist/email-Dcg4jlai.js +0 -344
  71. package/dist/embedded-wallet-DeoRdAPw.js +0 -820
  72. package/dist/features-B9Nde43h.js +0 -274
  73. package/dist/hashTypedData-a7b8tdkO.js +0 -197
  74. package/dist/if-defined-k21LutCn.js +0 -10
  75. package/dist/index-9vLw53Xl.js +0 -228
  76. package/dist/index-B5wUyynz.js +0 -107
  77. package/dist/index-B8LkUrww.js +0 -86
  78. package/dist/index-BA0VwKg0.js +0 -8189
  79. package/dist/index-BB9JJ24N.js +0 -125
  80. package/dist/index-BCkEvPQ6.js +0 -172
  81. package/dist/index-BDeO_csr.js +0 -171
  82. package/dist/index-Bb7babLF.js +0 -1281
  83. package/dist/index-BjOhprVS.js +0 -199
  84. package/dist/index-BjyMgZsf.js +0 -218
  85. package/dist/index-BkThIDLX.js +0 -159
  86. package/dist/index-BmFs6nb7.js +0 -209
  87. package/dist/index-C1QEJL-2.js +0 -572
  88. package/dist/index-C4qc4PdD.js +0 -387
  89. package/dist/index-CAPvUh14.js +0 -1750
  90. package/dist/index-CBMU3PTE.js +0 -65
  91. package/dist/index-CGwPkJLF.js +0 -355
  92. package/dist/index-CNGEqX3D.js +0 -153
  93. package/dist/index-CRlCq6IB.js +0 -7981
  94. package/dist/index-Cg_o-i9X.js +0 -118
  95. package/dist/index-D1BvhCbI.js +0 -62
  96. package/dist/index-DFi8TiHc.js +0 -128
  97. package/dist/index-DLwuveL9.js +0 -555
  98. package/dist/index-DMn7ktUQ.js +0 -56
  99. package/dist/index-DOXwtuwa.js +0 -117
  100. package/dist/index-DPPOW_Tp.js +0 -118
  101. package/dist/index-DQpzHpW-.js +0 -517
  102. package/dist/index-DXHg5C-W.js +0 -276
  103. package/dist/index-DcYjZV4H.js +0 -110
  104. package/dist/index-DeL88Lwc.js +0 -41655
  105. package/dist/index-DrWVlf8b.js +0 -46
  106. package/dist/index-Dsfuc4rB.js +0 -123
  107. package/dist/index-DuTny38n.js +0 -1175
  108. package/dist/index-Nfjb6bV0.js +0 -21991
  109. package/dist/index-WwwdQSN2.js +0 -85
  110. package/dist/index-Yha9Afch.js +0 -174
  111. package/dist/index-cbQHN7GC.js +0 -100
  112. package/dist/index-hyG3cYsv.js +0 -1083
  113. package/dist/index-qLxmmPaL.js +0 -257
  114. package/dist/localBatchGatewayRequest-vfcvRH0G.js +0 -91
  115. package/dist/onramp-BSiyOX4L.js +0 -855
  116. package/dist/parseSignature-CdCMAPZN.js +0 -3304
  117. package/dist/pay-with-exchange-CduNoMEz.js +0 -525
  118. package/dist/property-Bd8U3_QP.js +0 -618
  119. package/dist/receive-CrmptJlq.js +0 -232
  120. package/dist/ref-SOwYtCZb.js +0 -107
  121. package/dist/send-oMcHMEr6.js +0 -1166
  122. package/dist/socials-C0A4-FbY.js +0 -620
  123. package/dist/swaps-CbJJ9Ciu.js +0 -1760
  124. package/dist/transactions-BDfCoBS5.js +0 -37
  125. package/dist/ui/Modal.d.ts +0 -9
  126. package/dist/ui/index.d.ts +0 -6
  127. package/dist/w3m-modal-BjsTkny7.js +0 -1706
@@ -1,525 +0,0 @@
1
- import { cU as A, cV as D, cW as E, cX as $, cY as u, cE as y, d0 as f, dh as z, cH as b, d1 as _, cG as S } from "./index-DeL88Lwc.js";
2
- import { n as h, c as v, r as d } from "./index-DuTny38n.js";
3
- import { o as P } from "./if-defined-k21LutCn.js";
4
- import "./index-DFi8TiHc.js";
5
- import "./index-DOXwtuwa.js";
6
- import "./index-DPPOW_Tp.js";
7
- import "./index-D1BvhCbI.js";
8
- import "./index-BmFs6nb7.js";
9
- import "./index-CNGEqX3D.js";
10
- import "./index-DcYjZV4H.js";
11
- import { E as r } from "./ExchangeController-CbO41bcH.js";
12
- import "./index-Cg_o-i9X.js";
13
- import "./index-9vLw53Xl.js";
14
- import "./index-B5wUyynz.js";
15
- import "./index-DrWVlf8b.js";
16
- const T = A`
17
- button {
18
- border: none;
19
- border-radius: ${({ borderRadius: t }) => t[20]};
20
- display: flex;
21
- flex-direction: row;
22
- align-items: center;
23
- padding: ${({ spacing: t }) => t[1]};
24
- transition:
25
- background-color ${({ durations: t }) => t.lg}
26
- ${({ easings: t }) => t["ease-out-power-2"]},
27
- box-shadow ${({ durations: t }) => t.lg}
28
- ${({ easings: t }) => t["ease-out-power-2"]};
29
- will-change: background-color, box-shadow;
30
- }
31
-
32
- /* -- Variants --------------------------------------------------------------- */
33
- button[data-type='accent'] {
34
- background-color: ${({ tokens: t }) => t.core.backgroundAccentPrimary};
35
- color: ${({ tokens: t }) => t.theme.textPrimary};
36
- }
37
-
38
- button[data-type='neutral'] {
39
- background-color: ${({ tokens: t }) => t.theme.foregroundSecondary};
40
- color: ${({ tokens: t }) => t.theme.textPrimary};
41
- }
42
-
43
- /* -- Sizes --------------------------------------------------------------- */
44
- button[data-size='sm'] {
45
- height: 24px;
46
- }
47
-
48
- button[data-size='md'] {
49
- height: 28px;
50
- }
51
-
52
- button[data-size='lg'] {
53
- height: 32px;
54
- }
55
-
56
- button[data-size='sm'] > wui-image,
57
- button[data-size='sm'] > wui-icon {
58
- width: 16px;
59
- height: 16px;
60
- }
61
-
62
- button[data-size='md'] > wui-image,
63
- button[data-size='md'] > wui-icon {
64
- width: 20px;
65
- height: 20px;
66
- }
67
-
68
- button[data-size='lg'] > wui-image,
69
- button[data-size='lg'] > wui-icon {
70
- width: 24px;
71
- height: 24px;
72
- }
73
-
74
- wui-text {
75
- padding-left: ${({ spacing: t }) => t[1]};
76
- padding-right: ${({ spacing: t }) => t[1]};
77
- }
78
-
79
- wui-image {
80
- border-radius: ${({ borderRadius: t }) => t[3]};
81
- overflow: hidden;
82
- user-drag: none;
83
- user-select: none;
84
- -moz-user-select: none;
85
- -webkit-user-drag: none;
86
- -webkit-user-select: none;
87
- -ms-user-select: none;
88
- }
89
-
90
- /* -- States --------------------------------------------------------------- */
91
- @media (hover: hover) and (pointer: fine) {
92
- button[data-type='accent']:not(:disabled):hover {
93
- background-color: ${({ tokens: t }) => t.core.foregroundAccent060};
94
- }
95
-
96
- button[data-type='neutral']:not(:disabled):hover {
97
- background-color: ${({ tokens: t }) => t.theme.foregroundTertiary};
98
- }
99
- }
100
-
101
- button[data-type='accent']:not(:disabled):focus-visible,
102
- button[data-type='accent']:not(:disabled):active {
103
- box-shadow: 0 0 0 4px ${({ tokens: t }) => t.core.foregroundAccent020};
104
- }
105
-
106
- button[data-type='neutral']:not(:disabled):focus-visible,
107
- button[data-type='neutral']:not(:disabled):active {
108
- box-shadow: 0 0 0 4px ${({ tokens: t }) => t.core.foregroundAccent020};
109
- }
110
-
111
- button:disabled {
112
- opacity: 0.5;
113
- }
114
- `;
115
- var g = function(t, e, o, n) {
116
- var s = arguments.length, i = s < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, o) : n, a;
117
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, n);
118
- else for (var c = t.length - 1; c >= 0; c--) (a = t[c]) && (i = (s < 3 ? a(i) : s > 3 ? a(e, o, i) : a(e, o)) || i);
119
- return s > 3 && i && Object.defineProperty(e, o, i), i;
120
- };
121
- const L = {
122
- sm: "sm-regular",
123
- md: "md-regular",
124
- lg: "lg-regular"
125
- };
126
- let p = class extends $ {
127
- constructor() {
128
- super(...arguments), this.type = "accent", this.size = "md", this.imageSrc = "", this.disabled = !1, this.leftIcon = void 0, this.rightIcon = void 0, this.text = "";
129
- }
130
- render() {
131
- return u`
132
- <button ?disabled=${this.disabled} data-type=${this.type} data-size=${this.size}>
133
- ${this.imageSrc ? u`<wui-image src=${this.imageSrc}></wui-image>` : null}
134
- ${this.leftIcon ? u`<wui-icon name=${this.leftIcon} color="inherit" size="inherit"></wui-icon>` : null}
135
- <wui-text variant=${L[this.size]} color="inherit">${this.text}</wui-text>
136
- ${this.rightIcon ? u`<wui-icon name=${this.rightIcon} color="inherit" size="inherit"></wui-icon>` : null}
137
- </button>
138
- `;
139
- }
140
- };
141
- p.styles = [D, E, T];
142
- g([
143
- h()
144
- ], p.prototype, "type", void 0);
145
- g([
146
- h()
147
- ], p.prototype, "size", void 0);
148
- g([
149
- h()
150
- ], p.prototype, "imageSrc", void 0);
151
- g([
152
- h({ type: Boolean })
153
- ], p.prototype, "disabled", void 0);
154
- g([
155
- h()
156
- ], p.prototype, "leftIcon", void 0);
157
- g([
158
- h()
159
- ], p.prototype, "rightIcon", void 0);
160
- g([
161
- h()
162
- ], p.prototype, "text", void 0);
163
- p = g([
164
- v("wui-chip-button")
165
- ], p);
166
- var I = function(t, e, o, n) {
167
- var s = arguments.length, i = s < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, o) : n, a;
168
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, n);
169
- else for (var c = t.length - 1; c >= 0; c--) (a = t[c]) && (i = (s < 3 ? a(i) : s > 3 ? a(e, o, i) : a(e, o)) || i);
170
- return s > 3 && i && Object.defineProperty(e, o, i), i;
171
- };
172
- let w = class extends $ {
173
- constructor() {
174
- super(...arguments), this.maxDecimals = void 0, this.maxIntegers = void 0;
175
- }
176
- render() {
177
- return u`
178
- <wui-flex alignItems="center" gap="1">
179
- <wui-input-amount
180
- widthVariant="fit"
181
- fontSize="h2"
182
- .maxDecimals=${P(this.maxDecimals)}
183
- .maxIntegers=${P(this.maxIntegers)}
184
- .value=${this.amount ? String(this.amount) : ""}
185
- ></wui-input-amount>
186
- <wui-text variant="md-regular" color="secondary">USD</wui-text>
187
- </wui-flex>
188
- `;
189
- }
190
- };
191
- I([
192
- h({ type: Number })
193
- ], w.prototype, "amount", void 0);
194
- I([
195
- h({ type: Number })
196
- ], w.prototype, "maxDecimals", void 0);
197
- I([
198
- h({ type: Number })
199
- ], w.prototype, "maxIntegers", void 0);
200
- w = I([
201
- v("w3m-fund-input")
202
- ], w);
203
- const R = A`
204
- .amount-input-container {
205
- border-radius: ${({ borderRadius: t }) => t[6]};
206
- border-top-right-radius: 0;
207
- border-top-left-radius: 0;
208
- background-color: ${({ tokens: t }) => t.theme.foregroundPrimary};
209
- padding: ${({ spacing: t }) => t[1]};
210
- }
211
-
212
- .container {
213
- border-radius: 30px;
214
- }
215
- `;
216
- var m = function(t, e, o, n) {
217
- var s = arguments.length, i = s < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, o) : n, a;
218
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, n);
219
- else for (var c = t.length - 1; c >= 0; c--) (a = t[c]) && (i = (s < 3 ? a(i) : s > 3 ? a(e, o, i) : a(e, o)) || i);
220
- return s > 3 && i && Object.defineProperty(e, o, i), i;
221
- };
222
- const C = [10, 50, 100], j = 6, N = 10;
223
- let l = class extends $ {
224
- constructor() {
225
- super(), this.unsubscribe = [], this.network = y.state.activeCaipNetwork, this.exchanges = r.state.exchanges, this.isLoading = r.state.isLoading, this.amount = r.state.amount, this.tokenAmount = r.state.tokenAmount, this.priceLoading = r.state.priceLoading, this.isPaymentInProgress = r.state.isPaymentInProgress, this.currentPayment = r.state.currentPayment, this.paymentId = r.state.paymentId, this.paymentAsset = r.state.paymentAsset, this.unsubscribe.push(y.subscribeKey("activeCaipNetwork", (e) => {
226
- this.network = e, this.setDefaultPaymentAsset();
227
- }), r.subscribe((e) => {
228
- var n, s;
229
- this.exchanges = e.exchanges, this.isLoading = e.isLoading, this.amount = e.amount, this.tokenAmount = e.tokenAmount, this.priceLoading = e.priceLoading, this.paymentId = e.paymentId, this.isPaymentInProgress = e.isPaymentInProgress, this.currentPayment = e.currentPayment, this.paymentAsset = e.paymentAsset, e.isPaymentInProgress && ((n = e.currentPayment) == null ? void 0 : n.exchangeId) && ((s = e.currentPayment) == null ? void 0 : s.sessionId) && e.paymentId && this.handlePaymentInProgress();
230
- }));
231
- }
232
- disconnectedCallback() {
233
- this.unsubscribe.forEach((o) => o()), r.state.isPaymentInProgress || r.reset();
234
- }
235
- async firstUpdated() {
236
- await this.getPaymentAssets(), this.paymentAsset || await this.setDefaultPaymentAsset(), r.setAmount(C[0]), await r.fetchExchanges();
237
- }
238
- render() {
239
- return u`
240
- <wui-flex flexDirection="column" class="container">
241
- ${this.amountInputTemplate()} ${this.exchangesTemplate()}
242
- </wui-flex>
243
- `;
244
- }
245
- exchangesLoadingTemplate() {
246
- return Array.from({ length: 2 }).map(() => u`<wui-shimmer width="100%" height="65px" borderRadius="xxs"></wui-shimmer>`);
247
- }
248
- _exchangesTemplate() {
249
- return this.exchanges.length > 0 ? this.exchanges.map((e) => u`<wui-list-item
250
- @click=${() => this.onExchangeClick(e)}
251
- chevron
252
- variant="image"
253
- imageSrc=${e.imageUrl}
254
- ?loading=${this.isLoading}
255
- >
256
- <wui-text variant="md-regular" color="primary">
257
- Deposit from ${e.name}
258
- </wui-text>
259
- </wui-list-item>`) : u`<wui-flex flexDirection="column" alignItems="center" gap="4" padding="4">
260
- <wui-text variant="lg-medium" align="center" color="primary">
261
- No exchanges support this asset on this network
262
- </wui-text>
263
- </wui-flex>`;
264
- }
265
- exchangesTemplate() {
266
- return u`<wui-flex
267
- flexDirection="column"
268
- gap="2"
269
- .padding=${["3", "3", "3", "3"]}
270
- class="exchanges-container"
271
- >
272
- ${this.isLoading ? this.exchangesLoadingTemplate() : this._exchangesTemplate()}
273
- </wui-flex>`;
274
- }
275
- amountInputTemplate() {
276
- var e, o;
277
- return u`
278
- <wui-flex
279
- flexDirection="column"
280
- .padding=${["0", "3", "3", "3"]}
281
- class="amount-input-container"
282
- >
283
- <wui-flex
284
- justifyContent="space-between"
285
- alignItems="center"
286
- .margin=${["0", "0", "6", "0"]}
287
- >
288
- <wui-text variant="md-medium" color="secondary">Asset</wui-text>
289
- <wui-token-button
290
- data-testid="deposit-from-exchange-asset-button"
291
- flexDirection="row-reverse"
292
- text=${((e = this.paymentAsset) == null ? void 0 : e.metadata.symbol) || ""}
293
- imageSrc=${((o = this.paymentAsset) == null ? void 0 : o.metadata.iconUrl) || ""}
294
- @click=${() => f.push("PayWithExchangeSelectAsset")}
295
- size="lg"
296
- .chainImageSrc=${P(z.getNetworkImage(this.network))}
297
- >
298
- </wui-token-button>
299
- </wui-flex>
300
- <wui-flex
301
- flexDirection="column"
302
- alignItems="center"
303
- justifyContent="center"
304
- .margin=${["0", "0", "4", "0"]}
305
- >
306
- <w3m-fund-input
307
- @inputChange=${this.onAmountChange.bind(this)}
308
- .amount=${this.amount}
309
- .maxDecimals=${j}
310
- .maxIntegers=${N}
311
- >
312
- </w3m-fund-input>
313
- ${this.tokenAmountTemplate()}
314
- </wui-flex>
315
- <wui-flex justifyContent="center" gap="2">
316
- ${C.map((n) => u`<wui-chip-button
317
- @click=${() => r.setAmount(n)}
318
- type="neutral"
319
- size="lg"
320
- text=${`$${n}`}
321
- ></wui-chip-button>`)}
322
- </wui-flex>
323
- </wui-flex>
324
- `;
325
- }
326
- tokenAmountTemplate() {
327
- var e;
328
- return this.priceLoading ? u`<wui-shimmer
329
- width="65px"
330
- height="20px"
331
- borderRadius="xxs"
332
- variant="light"
333
- ></wui-shimmer>` : u`
334
- <wui-text variant="md-regular" color="secondary">
335
- ${this.tokenAmount.toFixed(4)} ${(e = this.paymentAsset) == null ? void 0 : e.metadata.symbol}
336
- </wui-text>
337
- `;
338
- }
339
- async onExchangeClick(e) {
340
- if (!this.amount) {
341
- b.showError("Please enter an amount");
342
- return;
343
- }
344
- await r.handlePayWithExchange(e.id);
345
- }
346
- handlePaymentInProgress() {
347
- var n, s;
348
- const e = y.state.activeChain, { redirectView: o = "Account" } = f.state.data ?? {};
349
- this.isPaymentInProgress && ((n = this.currentPayment) != null && n.exchangeId) && ((s = this.currentPayment) != null && s.sessionId) && this.paymentId && (r.waitUntilComplete({
350
- exchangeId: this.currentPayment.exchangeId,
351
- sessionId: this.currentPayment.sessionId,
352
- paymentId: this.paymentId
353
- }).then((i) => {
354
- i.status === "SUCCESS" ? (b.showSuccess("Deposit completed"), r.reset(), e && (y.fetchTokenBalance(), _.updateBalance(e)), f.replace("Transactions")) : i.status === "FAILED" && b.showError("Deposit failed");
355
- }), b.showLoading("Deposit in progress..."), f.replace(o));
356
- }
357
- onAmountChange({ detail: e }) {
358
- r.setAmount(e ? Number(e) : null);
359
- }
360
- async getPaymentAssets() {
361
- this.network && await r.getAssetsForNetwork(this.network.caipNetworkId);
362
- }
363
- async setDefaultPaymentAsset() {
364
- if (this.network) {
365
- const e = await r.getAssetsForNetwork(this.network.caipNetworkId);
366
- e[0] && r.setPaymentAsset(e[0]);
367
- }
368
- }
369
- };
370
- l.styles = R;
371
- m([
372
- d()
373
- ], l.prototype, "network", void 0);
374
- m([
375
- d()
376
- ], l.prototype, "exchanges", void 0);
377
- m([
378
- d()
379
- ], l.prototype, "isLoading", void 0);
380
- m([
381
- d()
382
- ], l.prototype, "amount", void 0);
383
- m([
384
- d()
385
- ], l.prototype, "tokenAmount", void 0);
386
- m([
387
- d()
388
- ], l.prototype, "priceLoading", void 0);
389
- m([
390
- d()
391
- ], l.prototype, "isPaymentInProgress", void 0);
392
- m([
393
- d()
394
- ], l.prototype, "currentPayment", void 0);
395
- m([
396
- d()
397
- ], l.prototype, "paymentId", void 0);
398
- m([
399
- d()
400
- ], l.prototype, "paymentAsset", void 0);
401
- l = m([
402
- v("w3m-deposit-from-exchange-view")
403
- ], l);
404
- const O = A`
405
- .contentContainer {
406
- height: 440px;
407
- overflow: scroll;
408
- scrollbar-width: none;
409
- }
410
-
411
- .contentContainer::-webkit-scrollbar {
412
- display: none;
413
- }
414
-
415
- wui-icon-box {
416
- width: 40px;
417
- height: 40px;
418
- border-radius: ${({ borderRadius: t }) => t[3]};
419
- }
420
- `;
421
- var k = function(t, e, o, n) {
422
- var s = arguments.length, i = s < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, o) : n, a;
423
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, n);
424
- else for (var c = t.length - 1; c >= 0; c--) (a = t[c]) && (i = (s < 3 ? a(i) : s > 3 ? a(e, o, i) : a(e, o)) || i);
425
- return s > 3 && i && Object.defineProperty(e, o, i), i;
426
- };
427
- let x = class extends $ {
428
- constructor() {
429
- super(), this.unsubscribe = [], this.assets = r.state.assets, this.search = "", this.onDebouncedSearch = S.debounce((e) => {
430
- this.search = e;
431
- }), this.unsubscribe.push(r.subscribe((e) => {
432
- this.assets = e.assets;
433
- }));
434
- }
435
- disconnectedCallback() {
436
- this.unsubscribe.forEach((e) => e());
437
- }
438
- render() {
439
- return u`
440
- <wui-flex flexDirection="column">
441
- ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
442
- </wui-flex>
443
- `;
444
- }
445
- templateSearchInput() {
446
- return u`
447
- <wui-flex gap="2" padding="3">
448
- <wui-input-text
449
- @inputChange=${this.onInputChange.bind(this)}
450
- class="network-search-input"
451
- size="sm"
452
- placeholder="Search token"
453
- icon="search"
454
- ></wui-input-text>
455
- </wui-flex>
456
- `;
457
- }
458
- templateTokens() {
459
- const e = this.assets.filter((n) => n.metadata.name.toLowerCase().includes(this.search.toLowerCase())), o = e.length > 0;
460
- return u`
461
- <wui-flex
462
- class="contentContainer"
463
- flexDirection="column"
464
- .padding=${["0", "3", "0", "3"]}
465
- >
466
- <wui-flex justifyContent="flex-start" .padding=${["4", "3", "3", "3"]}>
467
- <wui-text variant="md-medium" color="secondary">Available tokens</wui-text>
468
- </wui-flex>
469
- <wui-flex flexDirection="column" gap="2">
470
- ${o ? e.map((n) => u`<wui-list-item
471
- .imageSrc=${n.metadata.iconUrl}
472
- ?clickable=${!0}
473
- @click=${this.handleTokenClick.bind(this, n)}
474
- >
475
- <wui-text variant="md-medium" color="primary">${n.metadata.name}</wui-text>
476
- <wui-text variant="md-regular" color="secondary"
477
- >${n.metadata.symbol}</wui-text
478
- >
479
- </wui-list-item>`) : u`<wui-flex
480
- .padding=${["20", "0", "0", "0"]}
481
- alignItems="center"
482
- flexDirection="column"
483
- gap="4"
484
- >
485
- <wui-icon-box icon="coinPlaceholder" color="default" size="lg"></wui-icon-box>
486
- <wui-flex
487
- class="textContent"
488
- gap="2"
489
- flexDirection="column"
490
- justifyContent="center"
491
- >
492
- <wui-text variant="lg-medium" align="center" color="primary">
493
- No tokens found
494
- </wui-text>
495
- </wui-flex>
496
- <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
497
- </wui-flex>`}
498
- </wui-flex>
499
- </wui-flex>
500
- `;
501
- }
502
- onBuyClick() {
503
- f.push("OnRampProviders");
504
- }
505
- onInputChange(e) {
506
- this.onDebouncedSearch(e.detail);
507
- }
508
- handleTokenClick(e) {
509
- r.setPaymentAsset(e), f.goBack();
510
- }
511
- };
512
- x.styles = O;
513
- k([
514
- d()
515
- ], x.prototype, "assets", void 0);
516
- k([
517
- d()
518
- ], x.prototype, "search", void 0);
519
- x = k([
520
- v("w3m-deposit-from-exchange-select-asset-view")
521
- ], x);
522
- export {
523
- x as W3mDepositFromExchangeSelectAssetView,
524
- l as W3mDepositFromExchangeView
525
- };