@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,1166 +0,0 @@
1
- import { cU as x, cX as b, cG as D, cE as w, d1 as j, dE as l, cY as c, d0 as h, cN as F, df as L, cH as y, cL as J, d7 as G, dh as M, cV as q, cW as K, dI as Q, dJ as X, d2 as Z, cF as ee } from "./index-DeL88Lwc.js";
2
- import { n as d, r as u, c as v, U as E } from "./index-DuTny38n.js";
3
- import "./index-BmFs6nb7.js";
4
- import "./index-Cg_o-i9X.js";
5
- import "./index-DrWVlf8b.js";
6
- import { e as z, n as H } from "./ref-SOwYtCZb.js";
7
- import "./index-CNGEqX3D.js";
8
- import "./index-DcYjZV4H.js";
9
- import "./index-BjOhprVS.js";
10
- import { S as Y } from "./SwapController-Ch0FFTEt.js";
11
- import "./index-9vLw53Xl.js";
12
- import "./index-B5wUyynz.js";
13
- import "./index-DFi8TiHc.js";
14
- import "./index-cbQHN7GC.js";
15
- import { o as te } from "./if-defined-k21LutCn.js";
16
- const ie = x`
17
- :host {
18
- width: 100%;
19
- height: 100px;
20
- border-radius: ${({ borderRadius: e }) => e[5]};
21
- border: 1px solid ${({ tokens: e }) => e.theme.foregroundPrimary};
22
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
23
- transition: background-color ${({ durations: e }) => e.lg}
24
- ${({ easings: e }) => e["ease-out-power-1"]};
25
- will-change: background-color;
26
- position: relative;
27
- }
28
-
29
- :host(:hover) {
30
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
31
- }
32
-
33
- wui-flex {
34
- width: 100%;
35
- height: fit-content;
36
- }
37
-
38
- wui-button {
39
- display: ruby;
40
- color: ${({ tokens: e }) => e.theme.textPrimary};
41
- margin: 0 ${({ spacing: e }) => e[2]};
42
- }
43
-
44
- .instruction {
45
- position: absolute;
46
- top: 50%;
47
- transform: translateY(-50%);
48
- z-index: 2;
49
- }
50
-
51
- .paste {
52
- display: inline-flex;
53
- }
54
-
55
- textarea {
56
- background: transparent;
57
- width: 100%;
58
- font-family: ${({ fontFamily: e }) => e.regular};
59
- font-style: normal;
60
- font-size: ${({ textSize: e }) => e.large};
61
- font-weight: ${({ fontWeight: e }) => e.regular};
62
- line-height: ${({ typography: e }) => e["lg-regular"].lineHeight};
63
- letter-spacing: ${({ typography: e }) => e["lg-regular"].letterSpacing};
64
- color: ${({ tokens: e }) => e.theme.textSecondary};
65
- caret-color: ${({ tokens: e }) => e.core.backgroundAccentPrimary};
66
- box-sizing: border-box;
67
- -webkit-appearance: none;
68
- -moz-appearance: textfield;
69
- padding: 0px;
70
- border: none;
71
- outline: none;
72
- appearance: none;
73
- resize: none;
74
- overflow: hidden;
75
- }
76
- `;
77
- var P = function(e, t, i, r) {
78
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
79
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
80
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
81
- return o > 3 && n && Object.defineProperty(t, i, n), n;
82
- };
83
- let $ = class extends b {
84
- constructor() {
85
- super(...arguments), this.inputElementRef = z(), this.instructionElementRef = z(), this.readOnly = !1, this.instructionHidden = !!this.value, this.pasting = !1, this.onDebouncedSearch = D.debounce(async (t) => {
86
- if (!t.length) {
87
- this.setReceiverAddress("");
88
- return;
89
- }
90
- const i = w.state.activeChain;
91
- if (D.isAddress(t, i)) {
92
- this.setReceiverAddress(t);
93
- return;
94
- }
95
- try {
96
- const o = await j.getEnsAddress(t);
97
- if (o) {
98
- l.setReceiverProfileName(t), l.setReceiverAddress(o);
99
- const n = await j.getEnsAvatar(t);
100
- l.setReceiverProfileImageUrl(n || void 0);
101
- }
102
- } catch {
103
- this.setReceiverAddress(t);
104
- } finally {
105
- l.setLoading(!1);
106
- }
107
- });
108
- }
109
- firstUpdated() {
110
- this.value && (this.instructionHidden = !0), this.checkHidden();
111
- }
112
- render() {
113
- return this.readOnly ? c` <wui-flex
114
- flexDirection="column"
115
- justifyContent="center"
116
- gap="01"
117
- .padding=${["8", "4", "5", "4"]}
118
- >
119
- <textarea
120
- spellcheck="false"
121
- ?disabled=${!0}
122
- autocomplete="off"
123
- .value=${this.value ?? ""}
124
- >
125
- ${this.value ?? ""}</textarea
126
- >
127
- </wui-flex>` : c` <wui-flex
128
- @click=${this.onBoxClick.bind(this)}
129
- flexDirection="column"
130
- justifyContent="center"
131
- gap="01"
132
- .padding=${["8", "4", "5", "4"]}
133
- >
134
- <wui-text
135
- ${H(this.instructionElementRef)}
136
- class="instruction"
137
- color="secondary"
138
- variant="md-medium"
139
- >
140
- Type or
141
- <wui-button
142
- class="paste"
143
- size="md"
144
- variant="neutral-secondary"
145
- iconLeft="copy"
146
- @click=${this.onPasteClick.bind(this)}
147
- >
148
- <wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
149
- Paste
150
- </wui-button>
151
- address
152
- </wui-text>
153
- <textarea
154
- spellcheck="false"
155
- ?disabled=${!this.instructionHidden}
156
- ${H(this.inputElementRef)}
157
- @input=${this.onInputChange.bind(this)}
158
- @blur=${this.onBlur.bind(this)}
159
- .value=${this.value ?? ""}
160
- autocomplete="off"
161
- >
162
- ${this.value ?? ""}</textarea
163
- >
164
- </wui-flex>`;
165
- }
166
- async focusInput() {
167
- var t;
168
- this.instructionElementRef.value && (this.instructionHidden = !0, await this.toggleInstructionFocus(!1), this.instructionElementRef.value.style.pointerEvents = "none", (t = this.inputElementRef.value) == null || t.focus(), this.inputElementRef.value && (this.inputElementRef.value.selectionStart = this.inputElementRef.value.selectionEnd = this.inputElementRef.value.value.length));
169
- }
170
- async focusInstruction() {
171
- var t;
172
- this.instructionElementRef.value && (this.instructionHidden = !1, await this.toggleInstructionFocus(!0), this.instructionElementRef.value.style.pointerEvents = "auto", (t = this.inputElementRef.value) == null || t.blur());
173
- }
174
- async toggleInstructionFocus(t) {
175
- this.instructionElementRef.value && await this.instructionElementRef.value.animate([{ opacity: t ? 0 : 1 }, { opacity: t ? 1 : 0 }], {
176
- duration: 100,
177
- easing: "ease",
178
- fill: "forwards"
179
- }).finished;
180
- }
181
- onBoxClick() {
182
- !this.value && !this.instructionHidden && this.focusInput();
183
- }
184
- onBlur() {
185
- !this.value && this.instructionHidden && !this.pasting && this.focusInstruction();
186
- }
187
- checkHidden() {
188
- this.instructionHidden && this.focusInput();
189
- }
190
- async onPasteClick() {
191
- this.pasting = !0;
192
- const t = await navigator.clipboard.readText();
193
- l.setReceiverAddress(t), this.focusInput();
194
- }
195
- onInputChange(t) {
196
- var r;
197
- const i = t.target;
198
- this.pasting = !1, this.value = (r = t.target) == null ? void 0 : r.value, i.value && !this.instructionHidden && this.focusInput(), l.setLoading(!0), this.onDebouncedSearch(i.value);
199
- }
200
- setReceiverAddress(t) {
201
- l.setReceiverAddress(t), l.setReceiverProfileName(void 0), l.setReceiverProfileImageUrl(void 0), l.setLoading(!1);
202
- }
203
- };
204
- $.styles = ie;
205
- P([
206
- d()
207
- ], $.prototype, "value", void 0);
208
- P([
209
- d({ type: Boolean })
210
- ], $.prototype, "readOnly", void 0);
211
- P([
212
- u()
213
- ], $.prototype, "instructionHidden", void 0);
214
- P([
215
- u()
216
- ], $.prototype, "pasting", void 0);
217
- $ = P([
218
- v("w3m-input-address")
219
- ], $);
220
- const ne = x`
221
- :host {
222
- width: 100%;
223
- height: 100px;
224
- border-radius: ${({ borderRadius: e }) => e[5]};
225
- border: 1px solid ${({ tokens: e }) => e.theme.foregroundPrimary};
226
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
227
- transition: background-color ${({ durations: e }) => e.lg}
228
- ${({ easings: e }) => e["ease-out-power-1"]};
229
- will-change: background-color;
230
- transition: all ${({ easings: e }) => e["ease-out-power-1"]}
231
- ${({ durations: e }) => e.lg};
232
- }
233
-
234
- :host(:hover) {
235
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
236
- }
237
-
238
- wui-flex {
239
- width: 100%;
240
- height: fit-content;
241
- }
242
-
243
- wui-button {
244
- width: 100%;
245
- display: flex;
246
- justify-content: flex-end;
247
- }
248
-
249
- wui-input-amount {
250
- mask-image: linear-gradient(
251
- 270deg,
252
- transparent 0px,
253
- transparent 8px,
254
- black 24px,
255
- black 25px,
256
- black 32px,
257
- black 100%
258
- );
259
- }
260
-
261
- .totalValue {
262
- width: 100%;
263
- }
264
- `;
265
- var R = function(e, t, i, r) {
266
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
267
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
268
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
269
- return o > 3 && n && Object.defineProperty(t, i, n), n;
270
- };
271
- let A = class extends b {
272
- constructor() {
273
- super(...arguments), this.readOnly = !1, this.isInsufficientBalance = !1;
274
- }
275
- render() {
276
- const t = this.readOnly || !this.token;
277
- return c` <wui-flex
278
- flexDirection="column"
279
- gap="01"
280
- .padding=${["5", "3", "4", "3"]}
281
- >
282
- <wui-flex alignItems="center">
283
- <wui-input-amount
284
- @inputChange=${this.onInputChange.bind(this)}
285
- ?disabled=${t}
286
- .value=${this.sendTokenAmount ? String(this.sendTokenAmount) : ""}
287
- ?error=${!!this.isInsufficientBalance}
288
- ></wui-input-amount>
289
- ${this.buttonTemplate()}
290
- </wui-flex>
291
- ${this.bottomTemplate()}
292
- </wui-flex>`;
293
- }
294
- buttonTemplate() {
295
- return this.token ? c`<wui-token-button
296
- text=${this.token.symbol}
297
- imageSrc=${this.token.iconUrl}
298
- @click=${this.handleSelectButtonClick.bind(this)}
299
- >
300
- </wui-token-button>` : c`<wui-button
301
- size="md"
302
- variant="neutral-secondary"
303
- @click=${this.handleSelectButtonClick.bind(this)}
304
- >Select token</wui-button
305
- >`;
306
- }
307
- handleSelectButtonClick() {
308
- this.readOnly || h.push("WalletSendSelectToken");
309
- }
310
- sendValueTemplate() {
311
- if (!this.readOnly && this.token && this.sendTokenAmount) {
312
- const i = this.token.price * this.sendTokenAmount;
313
- return c`<wui-text class="totalValue" variant="sm-regular" color="secondary"
314
- >${i ? `$${F.formatNumberToLocalString(i, 2)}` : "Incorrect value"}</wui-text
315
- >`;
316
- }
317
- return null;
318
- }
319
- maxAmountTemplate() {
320
- return this.token ? c` <wui-text variant="sm-regular" color="secondary">
321
- ${E.roundNumber(Number(this.token.quantity.numeric), 6, 5)}
322
- </wui-text>` : null;
323
- }
324
- actionTemplate() {
325
- return this.token ? c`<wui-link @click=${this.onMaxClick.bind(this)}>Max</wui-link>` : null;
326
- }
327
- bottomTemplate() {
328
- return this.readOnly ? null : c`<wui-flex alignItems="center" justifyContent="space-between">
329
- ${this.sendValueTemplate()}
330
- <wui-flex alignItems="center" gap="01" justifyContent="flex-end">
331
- ${this.maxAmountTemplate()} ${this.actionTemplate()}
332
- </wui-flex>
333
- </wui-flex>`;
334
- }
335
- onInputChange(t) {
336
- l.setTokenAmount(t.detail);
337
- }
338
- onMaxClick() {
339
- if (this.token) {
340
- const t = F.bigNumber(this.token.quantity.numeric);
341
- l.setTokenAmount(Number(t.toFixed(20)));
342
- }
343
- }
344
- };
345
- A.styles = ne;
346
- R([
347
- d({ type: Object })
348
- ], A.prototype, "token", void 0);
349
- R([
350
- d({ type: Boolean })
351
- ], A.prototype, "readOnly", void 0);
352
- R([
353
- d({ type: Number })
354
- ], A.prototype, "sendTokenAmount", void 0);
355
- R([
356
- d({ type: Boolean })
357
- ], A.prototype, "isInsufficientBalance", void 0);
358
- A = R([
359
- v("w3m-input-token")
360
- ], A);
361
- const re = x`
362
- :host {
363
- display: block;
364
- }
365
-
366
- wui-flex {
367
- position: relative;
368
- }
369
-
370
- wui-icon-box {
371
- width: 32px;
372
- height: 32px;
373
- border-radius: ${({ borderRadius: e }) => e[10]} !important;
374
- border: 4px solid ${({ tokens: e }) => e.theme.backgroundPrimary};
375
- background: ${({ tokens: e }) => e.theme.foregroundPrimary};
376
- position: absolute;
377
- top: 50%;
378
- left: 50%;
379
- transform: translate(-50%, -50%);
380
- z-index: 3;
381
- }
382
-
383
- wui-button {
384
- --local-border-radius: ${({ borderRadius: e }) => e[4]} !important;
385
- }
386
-
387
- .inputContainer {
388
- height: fit-content;
389
- }
390
- `;
391
- var g = function(e, t, i, r) {
392
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
393
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
394
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
395
- return o > 3 && n && Object.defineProperty(t, i, n), n;
396
- };
397
- const p = {
398
- INSUFFICIENT_FUNDS: "Insufficient Funds",
399
- INCORRECT_VALUE: "Incorrect Value",
400
- INVALID_ADDRESS: "Invalid Address",
401
- ADD_ADDRESS: "Add Address",
402
- ADD_AMOUNT: "Add Amount",
403
- SELECT_TOKEN: "Select Token",
404
- PREVIEW_SEND: "Preview Send"
405
- };
406
- let f = class extends b {
407
- constructor() {
408
- var i, r;
409
- super(), this.unsubscribe = [], this.isTryingToChooseDifferentWallet = !1, this.token = l.state.token, this.sendTokenAmount = l.state.sendTokenAmount, this.receiverAddress = l.state.receiverAddress, this.receiverProfileName = l.state.receiverProfileName, this.loading = l.state.loading, this.params = (i = h.state.data) == null ? void 0 : i.send, this.caipAddress = (r = w.getAccountData()) == null ? void 0 : r.caipAddress, this.message = p.PREVIEW_SEND, this.disconnecting = !1, this.token && !this.params && (this.fetchBalances(), this.fetchNetworkPrice());
410
- const t = w.subscribeKey("activeCaipAddress", (o) => {
411
- !o && this.isTryingToChooseDifferentWallet && (this.isTryingToChooseDifferentWallet = !1, L.open({
412
- view: "Connect",
413
- data: {
414
- redirectView: "WalletSend"
415
- }
416
- }).catch(() => null), t());
417
- });
418
- this.unsubscribe.push(w.subscribeAccountStateProp("caipAddress", (o) => {
419
- this.caipAddress = o;
420
- }), l.subscribe((o) => {
421
- this.token = o.token, this.sendTokenAmount = o.sendTokenAmount, this.receiverAddress = o.receiverAddress, this.receiverProfileName = o.receiverProfileName, this.loading = o.loading;
422
- }));
423
- }
424
- disconnectedCallback() {
425
- this.unsubscribe.forEach((t) => t());
426
- }
427
- async firstUpdated() {
428
- await this.handleSendParameters();
429
- }
430
- render() {
431
- this.getMessage();
432
- const t = !!this.params;
433
- return c` <wui-flex flexDirection="column" .padding=${["0", "4", "4", "4"]}>
434
- <wui-flex class="inputContainer" gap="2" flexDirection="column">
435
- <w3m-input-token
436
- .token=${this.token}
437
- .sendTokenAmount=${this.sendTokenAmount}
438
- ?readOnly=${t}
439
- ?isInsufficientBalance=${this.message === p.INSUFFICIENT_FUNDS}
440
- ></w3m-input-token>
441
- <wui-icon-box size="md" variant="secondary" icon="arrowBottom"></wui-icon-box>
442
- <w3m-input-address
443
- ?readOnly=${t}
444
- .value=${this.receiverProfileName ? this.receiverProfileName : this.receiverAddress}
445
- ></w3m-input-address>
446
- </wui-flex>
447
- ${this.buttonTemplate()}
448
- </wui-flex>`;
449
- }
450
- async fetchBalances() {
451
- await l.fetchTokenBalance(), l.fetchNetworkBalance();
452
- }
453
- async fetchNetworkPrice() {
454
- await Y.getNetworkTokenPrice();
455
- }
456
- onButtonClick() {
457
- h.push("WalletSendPreview", {
458
- send: this.params
459
- });
460
- }
461
- onFundWalletClick() {
462
- h.push("FundWallet", {
463
- redirectView: "WalletSend"
464
- });
465
- }
466
- async onConnectDifferentWalletClick() {
467
- try {
468
- this.isTryingToChooseDifferentWallet = !0, this.disconnecting = !0, await j.disconnect();
469
- } finally {
470
- this.disconnecting = !1;
471
- }
472
- }
473
- getMessage() {
474
- var t;
475
- this.message = p.PREVIEW_SEND, this.receiverAddress && !D.isAddress(this.receiverAddress, w.state.activeChain) && (this.message = p.INVALID_ADDRESS), this.receiverAddress || (this.message = p.ADD_ADDRESS), this.sendTokenAmount && this.token && this.sendTokenAmount > Number(this.token.quantity.numeric) && (this.message = p.INSUFFICIENT_FUNDS), this.sendTokenAmount || (this.message = p.ADD_AMOUNT), this.sendTokenAmount && ((t = this.token) != null && t.price) && (this.sendTokenAmount * this.token.price || (this.message = p.INCORRECT_VALUE)), this.token || (this.message = p.SELECT_TOKEN);
476
- }
477
- buttonTemplate() {
478
- const t = !this.message.startsWith(p.PREVIEW_SEND), i = this.message === p.INSUFFICIENT_FUNDS, r = !!this.params;
479
- return i && !r ? c`
480
- <wui-flex .margin=${["4", "0", "0", "0"]} flexDirection="column" gap="4">
481
- <wui-button
482
- @click=${this.onFundWalletClick.bind(this)}
483
- size="lg"
484
- variant="accent-secondary"
485
- fullWidth
486
- >
487
- Fund Wallet
488
- </wui-button>
489
-
490
- <wui-separator data-testid="wui-separator" text="or"></wui-separator>
491
-
492
- <wui-button
493
- @click=${this.onConnectDifferentWalletClick.bind(this)}
494
- size="lg"
495
- variant="neutral-secondary"
496
- fullWidth
497
- ?loading=${this.disconnecting}
498
- >
499
- Connect a different wallet
500
- </wui-button>
501
- </wui-flex>
502
- ` : c`<wui-flex .margin=${["4", "0", "0", "0"]}>
503
- <wui-button
504
- @click=${this.onButtonClick.bind(this)}
505
- ?disabled=${t}
506
- size="lg"
507
- variant="accent-primary"
508
- ?loading=${this.loading}
509
- fullWidth
510
- >
511
- ${this.message}
512
- </wui-button>
513
- </wui-flex>`;
514
- }
515
- async handleSendParameters() {
516
- if (this.loading = !0, !this.params) {
517
- this.loading = !1;
518
- return;
519
- }
520
- const t = Number(this.params.amount);
521
- if (isNaN(t)) {
522
- y.showError("Invalid amount"), this.loading = !1;
523
- return;
524
- }
525
- const { namespace: i, chainId: r, assetAddress: o } = this.params;
526
- if (!J.SEND_PARAMS_SUPPORTED_CHAINS.includes(i)) {
527
- y.showError(`Chain "${i}" is not supported for send parameters`), this.loading = !1;
528
- return;
529
- }
530
- const n = w.getCaipNetworkById(r, i);
531
- if (!n) {
532
- y.showError(`Network with id "${r}" not found`), this.loading = !1;
533
- return;
534
- }
535
- try {
536
- const { balance: s, name: a, symbol: W, decimals: V } = await G.fetchERC20Balance({
537
- caipAddress: this.caipAddress,
538
- assetAddress: o,
539
- caipNetwork: n
540
- });
541
- if (!a || !W || !V || !s) {
542
- y.showError("Token not found");
543
- return;
544
- }
545
- l.setToken({
546
- name: a,
547
- symbol: W,
548
- chainId: n.id.toString(),
549
- address: `${n.chainNamespace}:${n.id}:${o}`,
550
- value: 0,
551
- price: 0,
552
- quantity: {
553
- decimals: V.toString(),
554
- numeric: s.toString()
555
- },
556
- iconUrl: M.getTokenImage(W) ?? ""
557
- }), l.setTokenAmount(t), l.setReceiverAddress(this.params.to);
558
- } catch (s) {
559
- console.error("Failed to load token information:", s), y.showError("Failed to load token information");
560
- } finally {
561
- this.loading = !1;
562
- }
563
- }
564
- };
565
- f.styles = re;
566
- g([
567
- u()
568
- ], f.prototype, "token", void 0);
569
- g([
570
- u()
571
- ], f.prototype, "sendTokenAmount", void 0);
572
- g([
573
- u()
574
- ], f.prototype, "receiverAddress", void 0);
575
- g([
576
- u()
577
- ], f.prototype, "receiverProfileName", void 0);
578
- g([
579
- u()
580
- ], f.prototype, "loading", void 0);
581
- g([
582
- u()
583
- ], f.prototype, "params", void 0);
584
- g([
585
- u()
586
- ], f.prototype, "caipAddress", void 0);
587
- g([
588
- u()
589
- ], f.prototype, "message", void 0);
590
- g([
591
- u()
592
- ], f.prototype, "disconnecting", void 0);
593
- f = g([
594
- v("w3m-wallet-send-view")
595
- ], f);
596
- const oe = x`
597
- .contentContainer {
598
- height: 440px;
599
- overflow: scroll;
600
- scrollbar-width: none;
601
- }
602
-
603
- .contentContainer::-webkit-scrollbar {
604
- display: none;
605
- }
606
-
607
- wui-icon-box {
608
- width: 40px;
609
- height: 40px;
610
- border-radius: ${({ borderRadius: e }) => e[3]};
611
- }
612
- `;
613
- var I = function(e, t, i, r) {
614
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
615
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
616
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
617
- return o > 3 && n && Object.defineProperty(t, i, n), n;
618
- };
619
- let C = class extends b {
620
- constructor() {
621
- super(), this.unsubscribe = [], this.tokenBalances = l.state.tokenBalances, this.search = "", this.onDebouncedSearch = D.debounce((t) => {
622
- this.search = t;
623
- }), this.fetchBalancesAndNetworkPrice(), this.unsubscribe.push(l.subscribe((t) => {
624
- this.tokenBalances = t.tokenBalances;
625
- }));
626
- }
627
- disconnectedCallback() {
628
- this.unsubscribe.forEach((t) => t());
629
- }
630
- render() {
631
- return c`
632
- <wui-flex flexDirection="column">
633
- ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
634
- </wui-flex>
635
- `;
636
- }
637
- async fetchBalancesAndNetworkPrice() {
638
- var t;
639
- (!this.tokenBalances || ((t = this.tokenBalances) == null ? void 0 : t.length) === 0) && (await this.fetchBalances(), await this.fetchNetworkPrice());
640
- }
641
- async fetchBalances() {
642
- await l.fetchTokenBalance(), l.fetchNetworkBalance();
643
- }
644
- async fetchNetworkPrice() {
645
- await Y.getNetworkTokenPrice();
646
- }
647
- templateSearchInput() {
648
- return c`
649
- <wui-flex gap="2" padding="3">
650
- <wui-input-text
651
- @inputChange=${this.onInputChange.bind(this)}
652
- class="network-search-input"
653
- size="sm"
654
- placeholder="Search token"
655
- icon="search"
656
- ></wui-input-text>
657
- </wui-flex>
658
- `;
659
- }
660
- templateTokens() {
661
- var t, i;
662
- return this.tokens = (t = this.tokenBalances) == null ? void 0 : t.filter((r) => {
663
- var o;
664
- return r.chainId === ((o = w.state.activeCaipNetwork) == null ? void 0 : o.caipNetworkId);
665
- }), this.search ? this.filteredTokens = (i = this.tokenBalances) == null ? void 0 : i.filter((r) => r.name.toLowerCase().includes(this.search.toLowerCase())) : this.filteredTokens = this.tokens, c`
666
- <wui-flex
667
- class="contentContainer"
668
- flexDirection="column"
669
- .padding=${["0", "3", "0", "3"]}
670
- >
671
- <wui-flex justifyContent="flex-start" .padding=${["4", "3", "3", "3"]}>
672
- <wui-text variant="md-medium" color="secondary">Your tokens</wui-text>
673
- </wui-flex>
674
- <wui-flex flexDirection="column" gap="2">
675
- ${this.filteredTokens && this.filteredTokens.length > 0 ? this.filteredTokens.map((r) => c`<wui-list-token
676
- @click=${this.handleTokenClick.bind(this, r)}
677
- ?clickable=${!0}
678
- tokenName=${r.name}
679
- tokenImageUrl=${r.iconUrl}
680
- tokenAmount=${r.quantity.numeric}
681
- tokenValue=${r.value}
682
- tokenCurrency=${r.symbol}
683
- ></wui-list-token>`) : c`<wui-flex
684
- .padding=${["20", "0", "0", "0"]}
685
- alignItems="center"
686
- flexDirection="column"
687
- gap="4"
688
- >
689
- <wui-icon-box icon="coinPlaceholder" color="default" size="lg"></wui-icon-box>
690
- <wui-flex
691
- class="textContent"
692
- gap="2"
693
- flexDirection="column"
694
- justifyContent="center"
695
- flexDirection="column"
696
- >
697
- <wui-text variant="lg-medium" align="center" color="primary">
698
- No tokens found
699
- </wui-text>
700
- <wui-text variant="lg-regular" align="center" color="secondary">
701
- Your tokens will appear here
702
- </wui-text>
703
- </wui-flex>
704
- <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
705
- </wui-flex>`}
706
- </wui-flex>
707
- </wui-flex>
708
- `;
709
- }
710
- onBuyClick() {
711
- h.push("OnRampProviders");
712
- }
713
- onInputChange(t) {
714
- this.onDebouncedSearch(t.detail);
715
- }
716
- handleTokenClick(t) {
717
- l.setToken(t), l.setTokenAmount(void 0), h.goBack();
718
- }
719
- };
720
- C.styles = oe;
721
- I([
722
- u()
723
- ], C.prototype, "tokenBalances", void 0);
724
- I([
725
- u()
726
- ], C.prototype, "tokens", void 0);
727
- I([
728
- u()
729
- ], C.prototype, "filteredTokens", void 0);
730
- I([
731
- u()
732
- ], C.prototype, "search", void 0);
733
- C = I([
734
- v("w3m-wallet-send-select-token-view")
735
- ], C);
736
- const se = x`
737
- :host {
738
- height: 32px;
739
- display: flex;
740
- align-items: center;
741
- gap: ${({ spacing: e }) => e[1]};
742
- border-radius: ${({ borderRadius: e }) => e[32]};
743
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
744
- padding: ${({ spacing: e }) => e[1]};
745
- padding-left: ${({ spacing: e }) => e[2]};
746
- }
747
-
748
- wui-avatar,
749
- wui-image {
750
- width: 24px;
751
- height: 24px;
752
- border-radius: ${({ borderRadius: e }) => e[16]};
753
- }
754
-
755
- wui-icon {
756
- border-radius: ${({ borderRadius: e }) => e[16]};
757
- }
758
- `;
759
- var _ = function(e, t, i, r) {
760
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
761
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
762
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
763
- return o > 3 && n && Object.defineProperty(t, i, n), n;
764
- };
765
- let T = class extends b {
766
- constructor() {
767
- super(...arguments), this.text = "";
768
- }
769
- render() {
770
- return c`<wui-text variant="lg-regular" color="primary">${this.text}</wui-text>
771
- ${this.imageTemplate()}`;
772
- }
773
- imageTemplate() {
774
- return this.address ? c`<wui-avatar address=${this.address} .imageSrc=${this.imageSrc}></wui-avatar>` : this.imageSrc ? c`<wui-image src=${this.imageSrc}></wui-image>` : c`<wui-icon size="lg" color="inverse" name="networkPlaceholder"></wui-icon>`;
775
- }
776
- };
777
- T.styles = [q, K, se];
778
- _([
779
- d({ type: String })
780
- ], T.prototype, "text", void 0);
781
- _([
782
- d({ type: String })
783
- ], T.prototype, "address", void 0);
784
- _([
785
- d({ type: String })
786
- ], T.prototype, "imageSrc", void 0);
787
- T = _([
788
- v("wui-preview-item")
789
- ], T);
790
- const ae = x`
791
- :host {
792
- display: flex;
793
- padding: ${({ spacing: e }) => e[4]} ${({ spacing: e }) => e[3]};
794
- width: 100%;
795
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
796
- border-radius: ${({ borderRadius: e }) => e[4]};
797
- }
798
-
799
- wui-image {
800
- width: 20px;
801
- height: 20px;
802
- border-radius: ${({ borderRadius: e }) => e[16]};
803
- }
804
-
805
- wui-icon {
806
- width: 20px;
807
- height: 20px;
808
- }
809
- `;
810
- var B = function(e, t, i, r) {
811
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
812
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
813
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
814
- return o > 3 && n && Object.defineProperty(t, i, n), n;
815
- };
816
- let S = class extends b {
817
- constructor() {
818
- super(...arguments), this.imageSrc = void 0, this.textTitle = "", this.textValue = void 0;
819
- }
820
- render() {
821
- return c`
822
- <wui-flex justifyContent="space-between" alignItems="center">
823
- <wui-text variant="lg-regular" color="primary"> ${this.textTitle} </wui-text>
824
- ${this.templateContent()}
825
- </wui-flex>
826
- `;
827
- }
828
- templateContent() {
829
- return this.imageSrc ? c`<wui-image src=${this.imageSrc} alt=${this.textTitle}></wui-image>` : this.textValue ? c` <wui-text variant="md-regular" color="secondary"> ${this.textValue} </wui-text>` : c`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`;
830
- }
831
- };
832
- S.styles = [q, K, ae];
833
- B([
834
- d()
835
- ], S.prototype, "imageSrc", void 0);
836
- B([
837
- d()
838
- ], S.prototype, "textTitle", void 0);
839
- B([
840
- d()
841
- ], S.prototype, "textValue", void 0);
842
- S = B([
843
- v("wui-list-content")
844
- ], S);
845
- const le = x`
846
- :host {
847
- display: flex;
848
- width: auto;
849
- flex-direction: column;
850
- gap: ${({ spacing: e }) => e[1]};
851
- border-radius: ${({ borderRadius: e }) => e[5]};
852
- background: ${({ tokens: e }) => e.theme.foregroundPrimary};
853
- padding: ${({ spacing: e }) => e[3]} ${({ spacing: e }) => e[2]}
854
- ${({ spacing: e }) => e[2]} ${({ spacing: e }) => e[2]};
855
- }
856
-
857
- wui-list-content {
858
- width: -webkit-fill-available !important;
859
- }
860
-
861
- wui-text {
862
- padding: 0 ${({ spacing: e }) => e[2]};
863
- }
864
-
865
- wui-flex {
866
- margin-top: ${({ spacing: e }) => e[2]};
867
- }
868
-
869
- .network {
870
- cursor: pointer;
871
- transition: background-color ${({ durations: e }) => e.lg}
872
- ${({ easings: e }) => e["ease-out-power-1"]};
873
- will-change: background-color;
874
- }
875
-
876
- .network:focus-visible {
877
- border: 1px solid ${({ tokens: e }) => e.core.textAccentPrimary};
878
- background-color: ${({ tokens: e }) => e.core.glass010};
879
- -webkit-box-shadow: 0px 0px 0px 4px ${({ tokens: e }) => e.core.foregroundAccent010};
880
- -moz-box-shadow: 0px 0px 0px 4px ${({ tokens: e }) => e.core.foregroundAccent010};
881
- box-shadow: 0px 0px 0px 4px ${({ tokens: e }) => e.core.foregroundAccent010};
882
- }
883
-
884
- .network:hover {
885
- background-color: ${({ tokens: e }) => e.core.glass010};
886
- }
887
-
888
- .network:active {
889
- background-color: ${({ tokens: e }) => e.core.glass010};
890
- }
891
- `;
892
- var O = function(e, t, i, r) {
893
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
894
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
895
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
896
- return o > 3 && n && Object.defineProperty(t, i, n), n;
897
- };
898
- let N = class extends b {
899
- constructor() {
900
- var t;
901
- super(...arguments), this.params = (t = h.state.data) == null ? void 0 : t.send;
902
- }
903
- render() {
904
- return c` <wui-text variant="sm-regular" color="secondary">Details</wui-text>
905
- <wui-flex flexDirection="column" gap="1">
906
- <wui-list-content
907
- textTitle="Address"
908
- textValue=${E.getTruncateString({
909
- string: this.receiverAddress ?? "",
910
- charsStart: 4,
911
- charsEnd: 4,
912
- truncate: "middle"
913
- })}
914
- >
915
- </wui-list-content>
916
- ${this.networkTemplate()}
917
- </wui-flex>`;
918
- }
919
- networkTemplate() {
920
- var t;
921
- return (t = this.caipNetwork) != null && t.name ? c` <wui-list-content
922
- @click=${() => this.onNetworkClick(this.caipNetwork)}
923
- class="network"
924
- textTitle="Network"
925
- imageSrc=${te(M.getNetworkImage(this.caipNetwork))}
926
- ></wui-list-content>` : null;
927
- }
928
- onNetworkClick(t) {
929
- t && !this.params && h.push("Networks", { network: t });
930
- }
931
- };
932
- N.styles = le;
933
- O([
934
- d()
935
- ], N.prototype, "receiverAddress", void 0);
936
- O([
937
- d({ type: Object })
938
- ], N.prototype, "caipNetwork", void 0);
939
- O([
940
- u()
941
- ], N.prototype, "params", void 0);
942
- N = O([
943
- v("w3m-wallet-send-details")
944
- ], N);
945
- const ce = x`
946
- wui-avatar,
947
- wui-image {
948
- display: ruby;
949
- width: 32px;
950
- height: 32px;
951
- border-radius: ${({ borderRadius: e }) => e[20]};
952
- }
953
-
954
- .sendButton {
955
- width: 70%;
956
- --local-width: 100% !important;
957
- --local-border-radius: ${({ borderRadius: e }) => e[4]} !important;
958
- }
959
-
960
- .cancelButton {
961
- width: 30%;
962
- --local-width: 100% !important;
963
- --local-border-radius: ${({ borderRadius: e }) => e[4]} !important;
964
- }
965
- `;
966
- var k = function(e, t, i, r) {
967
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
968
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
969
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
970
- return o > 3 && n && Object.defineProperty(t, i, n), n;
971
- };
972
- let m = class extends b {
973
- constructor() {
974
- var t;
975
- super(), this.unsubscribe = [], this.token = l.state.token, this.sendTokenAmount = l.state.sendTokenAmount, this.receiverAddress = l.state.receiverAddress, this.receiverProfileName = l.state.receiverProfileName, this.receiverProfileImageUrl = l.state.receiverProfileImageUrl, this.caipNetwork = w.state.activeCaipNetwork, this.loading = l.state.loading, this.params = (t = h.state.data) == null ? void 0 : t.send, this.unsubscribe.push(l.subscribe((i) => {
976
- this.token = i.token, this.sendTokenAmount = i.sendTokenAmount, this.receiverAddress = i.receiverAddress, this.receiverProfileName = i.receiverProfileName, this.receiverProfileImageUrl = i.receiverProfileImageUrl, this.loading = i.loading;
977
- }), w.subscribeKey("activeCaipNetwork", (i) => this.caipNetwork = i));
978
- }
979
- disconnectedCallback() {
980
- this.unsubscribe.forEach((t) => t());
981
- }
982
- render() {
983
- var t, i;
984
- return c` <wui-flex flexDirection="column" .padding=${["0", "4", "4", "4"]}>
985
- <wui-flex gap="2" flexDirection="column" .padding=${["0", "2", "0", "2"]}>
986
- <wui-flex alignItems="center" justifyContent="space-between">
987
- <wui-flex flexDirection="column" gap="01">
988
- <wui-text variant="sm-regular" color="secondary">Send</wui-text>
989
- ${this.sendValueTemplate()}
990
- </wui-flex>
991
- <wui-preview-item
992
- text="${this.sendTokenAmount ? E.roundNumber(this.sendTokenAmount, 6, 5) : "unknown"} ${(t = this.token) == null ? void 0 : t.symbol}"
993
- .imageSrc=${(i = this.token) == null ? void 0 : i.iconUrl}
994
- ></wui-preview-item>
995
- </wui-flex>
996
- <wui-flex>
997
- <wui-icon color="default" size="md" name="arrowBottom"></wui-icon>
998
- </wui-flex>
999
- <wui-flex alignItems="center" justifyContent="space-between">
1000
- <wui-text variant="sm-regular" color="secondary">To</wui-text>
1001
- <wui-preview-item
1002
- text="${this.receiverProfileName ? E.getTruncateString({
1003
- string: this.receiverProfileName,
1004
- charsStart: 20,
1005
- charsEnd: 0,
1006
- truncate: "end"
1007
- }) : E.getTruncateString({
1008
- string: this.receiverAddress ? this.receiverAddress : "",
1009
- charsStart: 4,
1010
- charsEnd: 4,
1011
- truncate: "middle"
1012
- })}"
1013
- address=${this.receiverAddress ?? ""}
1014
- .imageSrc=${this.receiverProfileImageUrl ?? void 0}
1015
- .isAddress=${!0}
1016
- ></wui-preview-item>
1017
- </wui-flex>
1018
- </wui-flex>
1019
- <wui-flex flexDirection="column" .padding=${["6", "0", "0", "0"]}>
1020
- <w3m-wallet-send-details
1021
- .caipNetwork=${this.caipNetwork}
1022
- .receiverAddress=${this.receiverAddress}
1023
- ></w3m-wallet-send-details>
1024
- <wui-flex justifyContent="center" gap="1" .padding=${["3", "0", "0", "0"]}>
1025
- <wui-icon size="sm" color="default" name="warningCircle"></wui-icon>
1026
- <wui-text variant="sm-regular" color="secondary">Review transaction carefully</wui-text>
1027
- </wui-flex>
1028
- <wui-flex justifyContent="center" gap="3" .padding=${["4", "0", "0", "0"]}>
1029
- <wui-button
1030
- class="cancelButton"
1031
- @click=${this.onCancelClick.bind(this)}
1032
- size="lg"
1033
- variant="neutral-secondary"
1034
- >
1035
- Cancel
1036
- </wui-button>
1037
- <wui-button
1038
- class="sendButton"
1039
- @click=${this.onSendClick.bind(this)}
1040
- size="lg"
1041
- variant="accent-primary"
1042
- .loading=${this.loading}
1043
- >
1044
- Send
1045
- </wui-button>
1046
- </wui-flex>
1047
- </wui-flex></wui-flex
1048
- >`;
1049
- }
1050
- sendValueTemplate() {
1051
- if (!this.params && this.token && this.sendTokenAmount) {
1052
- const i = this.token.price * this.sendTokenAmount;
1053
- return c`<wui-text variant="md-regular" color="primary"
1054
- >$${i.toFixed(2)}</wui-text
1055
- >`;
1056
- }
1057
- return null;
1058
- }
1059
- async onSendClick() {
1060
- if (!this.sendTokenAmount || !this.receiverAddress) {
1061
- y.showError("Please enter a valid amount and receiver address");
1062
- return;
1063
- }
1064
- try {
1065
- await l.sendToken(), this.params ? h.reset("WalletSendConfirmed") : (y.showSuccess("Transaction started"), h.replace("Account"));
1066
- } catch (t) {
1067
- let i = "Failed to send transaction. Please try again.";
1068
- const r = t instanceof Q && t.originalName === X.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST;
1069
- (w.state.activeChain === Z.CHAIN.SOLANA || r) && t instanceof Error && (i = t.message), ee.sendEvent({
1070
- type: "track",
1071
- event: r ? "SEND_REJECTED" : "SEND_ERROR",
1072
- properties: l.getSdkEventProperties(t)
1073
- }), y.showError(i);
1074
- }
1075
- }
1076
- onCancelClick() {
1077
- h.goBack();
1078
- }
1079
- };
1080
- m.styles = ce;
1081
- k([
1082
- u()
1083
- ], m.prototype, "token", void 0);
1084
- k([
1085
- u()
1086
- ], m.prototype, "sendTokenAmount", void 0);
1087
- k([
1088
- u()
1089
- ], m.prototype, "receiverAddress", void 0);
1090
- k([
1091
- u()
1092
- ], m.prototype, "receiverProfileName", void 0);
1093
- k([
1094
- u()
1095
- ], m.prototype, "receiverProfileImageUrl", void 0);
1096
- k([
1097
- u()
1098
- ], m.prototype, "caipNetwork", void 0);
1099
- k([
1100
- u()
1101
- ], m.prototype, "loading", void 0);
1102
- k([
1103
- u()
1104
- ], m.prototype, "params", void 0);
1105
- m = k([
1106
- v("w3m-wallet-send-preview-view")
1107
- ], m);
1108
- const ue = x`
1109
- .icon-box {
1110
- width: 64px;
1111
- height: 64px;
1112
- border-radius: 16px;
1113
- background-color: ${({ spacing: e }) => e[16]};
1114
- border: 8px solid ${({ tokens: e }) => e.theme.borderPrimary};
1115
- border-radius: ${({ borderRadius: e }) => e.round};
1116
- }
1117
- `;
1118
- var de = function(e, t, i, r) {
1119
- var o = arguments.length, n = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
1120
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, i, r);
1121
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (n = (o < 3 ? s(n) : o > 3 ? s(t, i, n) : s(t, i)) || n);
1122
- return o > 3 && n && Object.defineProperty(t, i, n), n;
1123
- };
1124
- let U = class extends b {
1125
- constructor() {
1126
- super(), this.unsubscribe = [], this.unsubscribe.push();
1127
- }
1128
- render() {
1129
- return c`
1130
- <wui-flex
1131
- flexDirection="column"
1132
- alignItems="center"
1133
- gap="4"
1134
- .padding="${["1", "3", "4", "3"]}"
1135
- >
1136
- <wui-flex justifyContent="center" alignItems="center" class="icon-box">
1137
- <wui-icon size="xxl" color="success" name="checkmark"></wui-icon>
1138
- </wui-flex>
1139
-
1140
- <wui-text variant="h6-medium" color="primary">You successfully sent asset</wui-text>
1141
-
1142
- <wui-button
1143
- fullWidth
1144
- @click=${this.onCloseClick.bind(this)}
1145
- size="lg"
1146
- variant="neutral-secondary"
1147
- >
1148
- Close
1149
- </wui-button>
1150
- </wui-flex>
1151
- `;
1152
- }
1153
- onCloseClick() {
1154
- L.close();
1155
- }
1156
- };
1157
- U.styles = ue;
1158
- U = de([
1159
- v("w3m-send-confirmed-view")
1160
- ], U);
1161
- export {
1162
- U as W3mSendConfirmedView,
1163
- C as W3mSendSelectTokenView,
1164
- m as W3mWalletSendPreviewView,
1165
- f as W3mWalletSendView
1166
- };