@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,820 +0,0 @@
1
- import { c_ as Y, cX as g, df as W, cM as K, cY as c, d8 as _, di as V, dC as G, cU as R, cV as z, cW as B, cL as N, cE as m, dD as j, d2 as k, d3 as C, d4 as h, d1 as L, dE as X, dF as v, cG as D, cF as O, cH as q, d0 as Q } from "./index-DeL88Lwc.js";
2
- import { r as l, c as w, n as d } from "./index-DuTny38n.js";
3
- import "./index-DFi8TiHc.js";
4
- import { e as Z, n as J } from "./ref-SOwYtCZb.js";
5
- import "./index-B8LkUrww.js";
6
- import { H as I } from "./HelpersUtil-DHm6EVSE.js";
7
- import { o as ee } from "./if-defined-k21LutCn.js";
8
- import "./index-9vLw53Xl.js";
9
- import "./index-DOXwtuwa.js";
10
- import "./index-BmFs6nb7.js";
11
- import "./index-Cg_o-i9X.js";
12
- import "./index-DcYjZV4H.js";
13
- import { N as te } from "./NavigationUtil-kj9LEOOd.js";
14
- const ie = Y`
15
- div {
16
- width: 100%;
17
- }
18
-
19
- [data-ready='false'] {
20
- transform: scale(1.05);
21
- }
22
-
23
- @media (max-width: 430px) {
24
- [data-ready='false'] {
25
- transform: translateY(-50px);
26
- }
27
- }
28
- `;
29
- var F = function(e, t, i, r) {
30
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
31
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
32
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
33
- return n > 3 && o && Object.defineProperty(t, i, o), o;
34
- };
35
- const P = 600, M = 360, oe = 64;
36
- let E = class extends g {
37
- constructor() {
38
- super(), this.bodyObserver = void 0, this.unsubscribe = [], this.iframe = document.getElementById("w3m-iframe"), this.ready = !1, this.unsubscribe.push(W.subscribeKey("open", (t) => {
39
- t || this.onHideIframe();
40
- }), W.subscribeKey("shake", (t) => {
41
- t ? this.iframe.style.animation = "w3m-shake 500ms var(--apkt-easings-ease-out-power-2)" : this.iframe.style.animation = "none";
42
- }));
43
- }
44
- disconnectedCallback() {
45
- var t;
46
- this.onHideIframe(), this.unsubscribe.forEach((i) => i()), (t = this.bodyObserver) == null || t.unobserve(window.document.body);
47
- }
48
- async firstUpdated() {
49
- var i;
50
- await this.syncTheme(), this.iframe.style.display = "block";
51
- const t = (i = this == null ? void 0 : this.renderRoot) == null ? void 0 : i.querySelector("div");
52
- this.bodyObserver = new ResizeObserver((r) => {
53
- var s, a;
54
- const n = (s = r == null ? void 0 : r[0]) == null ? void 0 : s.contentBoxSize, o = (a = n == null ? void 0 : n[0]) == null ? void 0 : a.inlineSize;
55
- this.iframe.style.height = `${P}px`, t.style.height = `${P}px`, K.state.enableEmbedded ? this.updateFrameSizeForEmbeddedMode() : o && o <= 430 ? (this.iframe.style.width = "100%", this.iframe.style.left = "0px", this.iframe.style.bottom = "0px", this.iframe.style.top = "unset", this.onShowIframe()) : (this.iframe.style.width = `${M}px`, this.iframe.style.left = `calc(50% - ${M / 2}px)`, this.iframe.style.top = `calc(50% - ${P / 2}px + ${oe / 2}px)`, this.iframe.style.bottom = "unset", this.onShowIframe());
56
- }), this.bodyObserver.observe(window.document.body);
57
- }
58
- render() {
59
- return c`<div data-ready=${this.ready} id="w3m-frame-container"></div>`;
60
- }
61
- onShowIframe() {
62
- const t = window.innerWidth <= 430;
63
- this.ready = !0, this.iframe.style.animation = t ? "w3m-iframe-zoom-in-mobile 200ms var(--apkt-easings-ease-out-power-2)" : "w3m-iframe-zoom-in 200ms var(--apkt-easings-ease-out-power-2)";
64
- }
65
- onHideIframe() {
66
- this.iframe.style.display = "none", this.iframe.style.animation = "w3m-iframe-fade-out 200ms var(--apkt-easings-ease-out-power-2)";
67
- }
68
- async syncTheme() {
69
- const t = _.getAuthConnector();
70
- if (t) {
71
- const i = V.getSnapshot().themeMode, r = V.getSnapshot().themeVariables;
72
- await t.provider.syncTheme({
73
- themeVariables: r,
74
- w3mThemeVariables: G(r, i)
75
- });
76
- }
77
- }
78
- async updateFrameSizeForEmbeddedMode() {
79
- var r;
80
- const t = (r = this == null ? void 0 : this.renderRoot) == null ? void 0 : r.querySelector("div");
81
- await new Promise((n) => {
82
- setTimeout(n, 300);
83
- });
84
- const i = this.getBoundingClientRect();
85
- t.style.width = "100%", this.iframe.style.left = `${i.left}px`, this.iframe.style.top = `${i.top}px`, this.iframe.style.width = `${i.width}px`, this.iframe.style.height = `${i.height}px`, this.onShowIframe();
86
- }
87
- };
88
- E.styles = ie;
89
- F([
90
- l()
91
- ], E.prototype, "ready", void 0);
92
- E = F([
93
- w("w3m-approve-transaction-view")
94
- ], E);
95
- const re = R`
96
- a {
97
- border: none;
98
- border-radius: ${({ borderRadius: e }) => e[20]};
99
- display: flex;
100
- flex-direction: row;
101
- align-items: center;
102
- padding: ${({ spacing: e }) => e[1]};
103
- transition:
104
- background-color ${({ durations: e }) => e.lg}
105
- ${({ easings: e }) => e["ease-out-power-2"]},
106
- box-shadow ${({ durations: e }) => e.lg}
107
- ${({ easings: e }) => e["ease-out-power-2"]},
108
- border ${({ durations: e }) => e.lg} ${({ easings: e }) => e["ease-out-power-2"]};
109
- will-change: background-color, box-shadow, border;
110
- }
111
-
112
- /* -- Variants --------------------------------------------------------------- */
113
- a[data-type='success'] {
114
- background-color: ${({ tokens: e }) => e.core.backgroundSuccess};
115
- color: ${({ tokens: e }) => e.core.textSuccess};
116
- }
117
-
118
- a[data-type='error'] {
119
- background-color: ${({ tokens: e }) => e.core.backgroundError};
120
- color: ${({ tokens: e }) => e.core.textError};
121
- }
122
-
123
- a[data-type='warning'] {
124
- background-color: ${({ tokens: e }) => e.core.backgroundWarning};
125
- color: ${({ tokens: e }) => e.core.textWarning};
126
- }
127
-
128
- /* -- Sizes --------------------------------------------------------------- */
129
- a[data-size='sm'] {
130
- height: 24px;
131
- }
132
-
133
- a[data-size='md'] {
134
- height: 28px;
135
- }
136
-
137
- a[data-size='lg'] {
138
- height: 32px;
139
- }
140
-
141
- a[data-size='sm'] > wui-image,
142
- a[data-size='sm'] > wui-icon {
143
- width: 16px;
144
- height: 16px;
145
- }
146
-
147
- a[data-size='md'] > wui-image,
148
- a[data-size='md'] > wui-icon {
149
- width: 20px;
150
- height: 20px;
151
- }
152
-
153
- a[data-size='lg'] > wui-image,
154
- a[data-size='lg'] > wui-icon {
155
- width: 24px;
156
- height: 24px;
157
- }
158
-
159
- wui-text {
160
- padding-left: ${({ spacing: e }) => e[1]};
161
- padding-right: ${({ spacing: e }) => e[1]};
162
- }
163
-
164
- wui-image {
165
- border-radius: ${({ borderRadius: e }) => e[3]};
166
- overflow: hidden;
167
- user-drag: none;
168
- user-select: none;
169
- -moz-user-select: none;
170
- -webkit-user-drag: none;
171
- -webkit-user-select: none;
172
- -ms-user-select: none;
173
- }
174
-
175
- /* -- States --------------------------------------------------------------- */
176
- @media (hover: hover) and (pointer: fine) {
177
- a[data-type='success']:not(:disabled):hover {
178
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
179
- box-shadow: 0px 0px 0px 1px ${({ tokens: e }) => e.core.borderSuccess};
180
- }
181
-
182
- a[data-type='error']:not(:disabled):hover {
183
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
184
- box-shadow: 0px 0px 0px 1px ${({ tokens: e }) => e.core.borderError};
185
- }
186
-
187
- a[data-type='warning']:not(:disabled):hover {
188
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
189
- box-shadow: 0px 0px 0px 1px ${({ tokens: e }) => e.core.borderWarning};
190
- }
191
- }
192
-
193
- a[data-type='success']:not(:disabled):focus-visible {
194
- box-shadow:
195
- 0px 0px 0px 1px ${({ tokens: e }) => e.core.backgroundAccentPrimary},
196
- 0px 0px 0px 4px ${({ tokens: e }) => e.core.foregroundAccent020};
197
- }
198
-
199
- a[data-type='error']:not(:disabled):focus-visible {
200
- box-shadow:
201
- 0px 0px 0px 1px ${({ tokens: e }) => e.core.backgroundAccentPrimary},
202
- 0px 0px 0px 4px ${({ tokens: e }) => e.core.foregroundAccent020};
203
- }
204
-
205
- a[data-type='warning']:not(:disabled):focus-visible {
206
- box-shadow:
207
- 0px 0px 0px 1px ${({ tokens: e }) => e.core.backgroundAccentPrimary},
208
- 0px 0px 0px 4px ${({ tokens: e }) => e.core.foregroundAccent020};
209
- }
210
-
211
- a:disabled {
212
- opacity: 0.5;
213
- }
214
- `;
215
- var y = function(e, t, i, r) {
216
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
217
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
218
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
219
- return n > 3 && o && Object.defineProperty(t, i, o), o;
220
- };
221
- const ne = {
222
- sm: "md-regular",
223
- md: "lg-regular",
224
- lg: "lg-regular"
225
- }, se = {
226
- success: "sealCheck",
227
- error: "warning",
228
- warning: "exclamationCircle"
229
- };
230
- let u = class extends g {
231
- constructor() {
232
- super(...arguments), this.type = "success", this.size = "md", this.imageSrc = void 0, this.disabled = !1, this.href = "", this.text = void 0;
233
- }
234
- render() {
235
- return c`
236
- <a
237
- rel="noreferrer"
238
- target="_blank"
239
- href=${this.href}
240
- class=${this.disabled ? "disabled" : ""}
241
- data-type=${this.type}
242
- data-size=${this.size}
243
- >
244
- ${this.imageTemplate()}
245
- <wui-text variant=${ne[this.size]} color="inherit">${this.text}</wui-text>
246
- </a>
247
- `;
248
- }
249
- imageTemplate() {
250
- return this.imageSrc ? c`<wui-image src=${this.imageSrc} size="inherit"></wui-image>` : c`<wui-icon
251
- name=${se[this.type]}
252
- weight="fill"
253
- color="inherit"
254
- size="inherit"
255
- class="image-icon"
256
- ></wui-icon>`;
257
- }
258
- };
259
- u.styles = [z, B, re];
260
- y([
261
- d()
262
- ], u.prototype, "type", void 0);
263
- y([
264
- d()
265
- ], u.prototype, "size", void 0);
266
- y([
267
- d()
268
- ], u.prototype, "imageSrc", void 0);
269
- y([
270
- d({ type: Boolean })
271
- ], u.prototype, "disabled", void 0);
272
- y([
273
- d()
274
- ], u.prototype, "href", void 0);
275
- y([
276
- d()
277
- ], u.prototype, "text", void 0);
278
- u = y([
279
- w("wui-semantic-chip")
280
- ], u);
281
- var ae = function(e, t, i, r) {
282
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
283
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
284
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
285
- return n > 3 && o && Object.defineProperty(t, i, o), o;
286
- };
287
- let H = class extends g {
288
- render() {
289
- return c`
290
- <wui-flex flexDirection="column" alignItems="center" gap="5" padding="5">
291
- <wui-text variant="md-regular" color="primary">Follow the instructions on</wui-text>
292
- <wui-semantic-chip
293
- icon="externalLink"
294
- variant="fill"
295
- text=${N.SECURE_SITE_DASHBOARD}
296
- href=${N.SECURE_SITE_DASHBOARD}
297
- imageSrc=${N.SECURE_SITE_FAVICON}
298
- data-testid="w3m-secure-website-button"
299
- >
300
- </wui-semantic-chip>
301
- <wui-text variant="sm-regular" color="secondary">
302
- You will have to reconnect for security reasons
303
- </wui-text>
304
- </wui-flex>
305
- `;
306
- }
307
- };
308
- H = ae([
309
- w("w3m-upgrade-wallet-view")
310
- ], H);
311
- var A = function(e, t, i, r) {
312
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
313
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
314
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
315
- return n > 3 && o && Object.defineProperty(t, i, o), o;
316
- };
317
- let $ = class extends g {
318
- constructor() {
319
- super(...arguments), this.loading = !1, this.switched = !1, this.text = "", this.network = m.state.activeCaipNetwork;
320
- }
321
- render() {
322
- return c`
323
- <wui-flex flexDirection="column" gap="2" .padding=${["6", "4", "3", "4"]}>
324
- ${this.togglePreferredAccountTypeTemplate()} ${this.toggleSmartAccountVersionTemplate()}
325
- </wui-flex>
326
- `;
327
- }
328
- toggleSmartAccountVersionTemplate() {
329
- return c`
330
- <w3m-tooltip-trigger text="Changing the smart account version will reload the page">
331
- <wui-list-item
332
- icon=${this.isV6() ? "arrowTop" : "arrowBottom"}
333
- ?rounded=${!0}
334
- ?chevron=${!0}
335
- data-testid="account-toggle-smart-account-version"
336
- @click=${this.toggleSmartAccountVersion.bind(this)}
337
- >
338
- <wui-text variant="lg-regular" color="primary"
339
- >Force Smart Account Version ${this.isV6() ? "7" : "6"}</wui-text
340
- >
341
- </wui-list-item>
342
- </w3m-tooltip-trigger>
343
- `;
344
- }
345
- isV6() {
346
- return (j.get("dapp_smart_account_version") || "v6") === "v6";
347
- }
348
- toggleSmartAccountVersion() {
349
- var t;
350
- j.set("dapp_smart_account_version", this.isV6() ? "v7" : "v6"), typeof window < "u" && ((t = window == null ? void 0 : window.location) == null || t.reload());
351
- }
352
- togglePreferredAccountTypeTemplate() {
353
- var o;
354
- const t = (o = this.network) == null ? void 0 : o.chainNamespace, i = m.checkIfSmartAccountEnabled(), r = _.getConnectorId(t);
355
- return !_.getAuthConnector() || r !== k.CONNECTOR_ID.AUTH || !i ? null : (this.switched || (this.text = C(t) === h.ACCOUNT_TYPES.SMART_ACCOUNT ? "Switch to your EOA" : "Switch to your Smart Account"), c`
356
- <wui-list-item
357
- icon="swapHorizontal"
358
- ?rounded=${!0}
359
- ?chevron=${!0}
360
- ?loading=${this.loading}
361
- @click=${this.changePreferredAccountType.bind(this)}
362
- data-testid="account-toggle-preferred-account-type"
363
- >
364
- <wui-text variant="lg-regular" color="primary">${this.text}</wui-text>
365
- </wui-list-item>
366
- `);
367
- }
368
- async changePreferredAccountType() {
369
- var o;
370
- const t = (o = this.network) == null ? void 0 : o.chainNamespace, i = m.checkIfSmartAccountEnabled(), r = C(t) === h.ACCOUNT_TYPES.SMART_ACCOUNT || !i ? h.ACCOUNT_TYPES.EOA : h.ACCOUNT_TYPES.SMART_ACCOUNT;
371
- _.getAuthConnector() && (this.loading = !0, await L.setPreferredAccountType(r, t), this.text = r === h.ACCOUNT_TYPES.SMART_ACCOUNT ? "Switch to your EOA" : "Switch to your Smart Account", this.switched = !0, X.resetSend(), this.loading = !1, this.requestUpdate());
372
- }
373
- };
374
- A([
375
- l()
376
- ], $.prototype, "loading", void 0);
377
- A([
378
- l()
379
- ], $.prototype, "switched", void 0);
380
- A([
381
- l()
382
- ], $.prototype, "text", void 0);
383
- A([
384
- l()
385
- ], $.prototype, "network", void 0);
386
- $ = A([
387
- w("w3m-smart-account-settings-view")
388
- ], $);
389
- const ce = R`
390
- :host {
391
- width: 100%;
392
- }
393
-
394
- button {
395
- width: 100%;
396
- display: flex;
397
- justify-content: space-between;
398
- align-items: center;
399
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
400
- border-radius: ${({ borderRadius: e }) => e[4]};
401
- padding: ${({ spacing: e }) => e[4]};
402
- }
403
-
404
- .name {
405
- max-width: 75%;
406
- overflow: hidden;
407
- text-overflow: ellipsis;
408
- white-space: nowrap;
409
- }
410
-
411
- @media (hover: hover) and (pointer: fine) {
412
- button:hover:enabled {
413
- cursor: pointer;
414
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
415
- border-radius: ${({ borderRadius: e }) => e[6]};
416
- }
417
- }
418
-
419
- button:disabled {
420
- opacity: 0.5;
421
- cursor: default;
422
- }
423
-
424
- button:focus-visible:enabled {
425
- box-shadow: 0 0 0 4px ${({ tokens: e }) => e.core.foregroundAccent040};
426
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
427
- }
428
- `;
429
- var T = function(e, t, i, r) {
430
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
431
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
432
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
433
- return n > 3 && o && Object.defineProperty(t, i, o), o;
434
- };
435
- let b = class extends g {
436
- constructor() {
437
- super(...arguments), this.name = "", this.registered = !1, this.loading = !1, this.disabled = !1;
438
- }
439
- render() {
440
- return c`
441
- <button ?disabled=${this.disabled}>
442
- <wui-text class="name" color="primary" variant="md-regular">${this.name}</wui-text>
443
- ${this.templateRightContent()}
444
- </button>
445
- `;
446
- }
447
- templateRightContent() {
448
- return this.loading ? c`<wui-loading-spinner size="lg" color="primary"></wui-loading-spinner>` : this.registered ? c`<wui-tag variant="info" size="sm">Registered</wui-tag>` : c`<wui-tag variant="success" size="sm">Available</wui-tag>`;
449
- }
450
- };
451
- b.styles = [z, B, ce];
452
- T([
453
- d()
454
- ], b.prototype, "name", void 0);
455
- T([
456
- d({ type: Boolean })
457
- ], b.prototype, "registered", void 0);
458
- T([
459
- d({ type: Boolean })
460
- ], b.prototype, "loading", void 0);
461
- T([
462
- d({ type: Boolean })
463
- ], b.prototype, "disabled", void 0);
464
- b = T([
465
- w("wui-account-name-suggestion-item")
466
- ], b);
467
- const de = R`
468
- :host {
469
- position: relative;
470
- width: 100%;
471
- display: inline-block;
472
- }
473
-
474
- :host([disabled]) {
475
- opacity: 0.5;
476
- cursor: not-allowed;
477
- }
478
-
479
- .base-name {
480
- position: absolute;
481
- right: ${({ spacing: e }) => e[4]};
482
- top: 50%;
483
- transform: translateY(-50%);
484
- text-align: right;
485
- padding: ${({ spacing: e }) => e[1]};
486
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
487
- border-radius: ${({ borderRadius: e }) => e[1]};
488
- }
489
- `;
490
- var S = function(e, t, i, r) {
491
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
492
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
493
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
494
- return n > 3 && o && Object.defineProperty(t, i, o), o;
495
- };
496
- let f = class extends g {
497
- constructor() {
498
- super(...arguments), this.disabled = !1, this.loading = !1;
499
- }
500
- render() {
501
- return c`
502
- <wui-input-text
503
- value=${ee(this.value)}
504
- ?disabled=${this.disabled}
505
- .value=${this.value || ""}
506
- data-testid="wui-ens-input"
507
- icon="search"
508
- inputRightPadding="5xl"
509
- .onKeyDown=${this.onKeyDown}
510
- ></wui-input-text>
511
- `;
512
- }
513
- };
514
- f.styles = [z, de];
515
- S([
516
- d()
517
- ], f.prototype, "errorMessage", void 0);
518
- S([
519
- d({ type: Boolean })
520
- ], f.prototype, "disabled", void 0);
521
- S([
522
- d()
523
- ], f.prototype, "value", void 0);
524
- S([
525
- d({ type: Boolean })
526
- ], f.prototype, "loading", void 0);
527
- S([
528
- d({ attribute: !1 })
529
- ], f.prototype, "onKeyDown", void 0);
530
- f = S([
531
- w("wui-ens-input")
532
- ], f);
533
- const le = R`
534
- wui-flex {
535
- width: 100%;
536
- }
537
-
538
- .suggestion {
539
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
540
- border-radius: ${({ borderRadius: e }) => e[4]};
541
- }
542
-
543
- .suggestion:hover:not(:disabled) {
544
- cursor: pointer;
545
- border: none;
546
- width: 100%;
547
- display: flex;
548
- justify-content: space-between;
549
- align-items: center;
550
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
551
- border-radius: ${({ borderRadius: e }) => e[6]};
552
- padding: ${({ spacing: e }) => e[4]};
553
- }
554
-
555
- .suggestion:disabled {
556
- opacity: 0.5;
557
- cursor: default;
558
- }
559
-
560
- .suggestion:focus-visible:not(:disabled) {
561
- box-shadow: 0 0 0 4px ${({ tokens: e }) => e.core.foregroundAccent040};
562
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
563
- }
564
-
565
- .suggested-name {
566
- max-width: 75%;
567
- overflow: hidden;
568
- text-overflow: ellipsis;
569
- white-space: nowrap;
570
- }
571
-
572
- form {
573
- width: 100%;
574
- position: relative;
575
- }
576
-
577
- .input-submit-button,
578
- .input-loading-spinner {
579
- position: absolute;
580
- top: 22px;
581
- transform: translateY(-50%);
582
- right: 10px;
583
- }
584
- `;
585
- var x = function(e, t, i, r) {
586
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
587
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
588
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
589
- return n > 3 && o && Object.defineProperty(t, i, o), o;
590
- };
591
- let p = class extends g {
592
- constructor() {
593
- var t;
594
- super(), this.formRef = Z(), this.usubscribe = [], this.name = "", this.error = "", this.loading = v.state.loading, this.suggestions = v.state.suggestions, this.profileName = (t = m.getAccountData()) == null ? void 0 : t.profileName, this.onDebouncedNameInputChange = D.debounce((i) => {
595
- i.length < 4 ? this.error = "Name must be at least 4 characters long" : I.isValidReownName(i) ? (this.error = "", v.getSuggestions(i)) : this.error = "The value is not a valid username";
596
- }), this.usubscribe.push(v.subscribe((i) => {
597
- this.suggestions = i.suggestions, this.loading = i.loading;
598
- }), m.subscribeChainProp("accountState", (i) => {
599
- this.profileName = i == null ? void 0 : i.profileName, i != null && i.profileName && (this.error = "You already own a name");
600
- }));
601
- }
602
- firstUpdated() {
603
- var t;
604
- (t = this.formRef.value) == null || t.addEventListener("keydown", this.onEnterKey.bind(this));
605
- }
606
- disconnectedCallback() {
607
- var t;
608
- super.disconnectedCallback(), this.usubscribe.forEach((i) => i()), (t = this.formRef.value) == null || t.removeEventListener("keydown", this.onEnterKey.bind(this));
609
- }
610
- render() {
611
- return c`
612
- <wui-flex
613
- flexDirection="column"
614
- alignItems="center"
615
- gap="4"
616
- .padding=${["1", "3", "4", "3"]}
617
- >
618
- <form ${J(this.formRef)} @submit=${this.onSubmitName.bind(this)}>
619
- <wui-ens-input
620
- @inputChange=${this.onNameInputChange.bind(this)}
621
- .errorMessage=${this.error}
622
- .value=${this.name}
623
- .onKeyDown=${this.onKeyDown.bind(this)}
624
- >
625
- </wui-ens-input>
626
- ${this.submitButtonTemplate()}
627
- <input type="submit" hidden />
628
- </form>
629
- ${this.templateSuggestions()}
630
- </wui-flex>
631
- `;
632
- }
633
- submitButtonTemplate() {
634
- const t = this.suggestions.find((r) => {
635
- var n, o;
636
- return ((o = (n = r.name) == null ? void 0 : n.split(".")) == null ? void 0 : o[0]) === this.name && r.registered;
637
- });
638
- if (this.loading)
639
- return c`<wui-loading-spinner
640
- class="input-loading-spinner"
641
- color="secondary"
642
- ></wui-loading-spinner>`;
643
- const i = `${this.name}${k.WC_NAME_SUFFIX}`;
644
- return c`
645
- <wui-icon-link
646
- ?disabled=${!!t}
647
- class="input-submit-button"
648
- size="sm"
649
- icon="chevronRight"
650
- iconColor=${t ? "default" : "accent-primary"}
651
- @click=${() => this.onSubmitName(i)}
652
- >
653
- </wui-icon-link>
654
- `;
655
- }
656
- onNameInputChange(t) {
657
- const i = I.validateReownName(t.detail || "");
658
- this.name = i, this.onDebouncedNameInputChange(i);
659
- }
660
- onKeyDown(t) {
661
- t.key.length === 1 && !I.isValidReownName(t.key) && t.preventDefault();
662
- }
663
- templateSuggestions() {
664
- return !this.name || this.name.length < 4 || this.error ? null : c`<wui-flex flexDirection="column" gap="1" alignItems="center">
665
- ${this.suggestions.map((t) => c`<wui-account-name-suggestion-item
666
- name=${t.name}
667
- ?registered=${t.registered}
668
- ?loading=${this.loading}
669
- ?disabled=${t.registered || this.loading}
670
- data-testid="account-name-suggestion"
671
- @click=${() => this.onSubmitName(t.name)}
672
- ></wui-account-name-suggestion-item>`)}
673
- </wui-flex>`;
674
- }
675
- isAllowedToSubmit(t) {
676
- var n;
677
- const i = (n = t.split(".")) == null ? void 0 : n[0], r = this.suggestions.find((o) => {
678
- var s, a;
679
- return ((a = (s = o.name) == null ? void 0 : s.split(".")) == null ? void 0 : a[0]) === i && o.registered;
680
- });
681
- return !this.loading && !this.error && !this.profileName && i && v.validateName(i) && !r;
682
- }
683
- async onSubmitName(t) {
684
- try {
685
- if (!this.isAllowedToSubmit(t))
686
- return;
687
- O.sendEvent({
688
- type: "track",
689
- event: "REGISTER_NAME_INITIATED",
690
- properties: {
691
- isSmartAccount: C(m.state.activeChain) === h.ACCOUNT_TYPES.SMART_ACCOUNT,
692
- ensName: t
693
- }
694
- }), await v.registerName(t), O.sendEvent({
695
- type: "track",
696
- event: "REGISTER_NAME_SUCCESS",
697
- properties: {
698
- isSmartAccount: C(m.state.activeChain) === h.ACCOUNT_TYPES.SMART_ACCOUNT,
699
- ensName: t
700
- }
701
- });
702
- } catch (i) {
703
- q.showError(i.message), O.sendEvent({
704
- type: "track",
705
- event: "REGISTER_NAME_ERROR",
706
- properties: {
707
- isSmartAccount: C(m.state.activeChain) === h.ACCOUNT_TYPES.SMART_ACCOUNT,
708
- ensName: t,
709
- error: D.parseError(i)
710
- }
711
- });
712
- }
713
- }
714
- onEnterKey(t) {
715
- if (t.key === "Enter" && this.name && this.isAllowedToSubmit(this.name)) {
716
- const i = `${this.name}${k.WC_NAME_SUFFIX}`;
717
- this.onSubmitName(i);
718
- }
719
- }
720
- };
721
- p.styles = le;
722
- x([
723
- d()
724
- ], p.prototype, "errorMessage", void 0);
725
- x([
726
- l()
727
- ], p.prototype, "name", void 0);
728
- x([
729
- l()
730
- ], p.prototype, "error", void 0);
731
- x([
732
- l()
733
- ], p.prototype, "loading", void 0);
734
- x([
735
- l()
736
- ], p.prototype, "suggestions", void 0);
737
- x([
738
- l()
739
- ], p.prototype, "profileName", void 0);
740
- p = x([
741
- w("w3m-register-account-name-view")
742
- ], p);
743
- const ue = Y`
744
- .continue-button-container {
745
- width: 100%;
746
- }
747
- `;
748
- var pe = function(e, t, i, r) {
749
- var n = arguments.length, o = n < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, i) : r, s;
750
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, i, r);
751
- else for (var a = e.length - 1; a >= 0; a--) (s = e[a]) && (o = (n < 3 ? s(o) : n > 3 ? s(t, i, o) : s(t, i)) || o);
752
- return n > 3 && o && Object.defineProperty(t, i, o), o;
753
- };
754
- let U = class extends g {
755
- render() {
756
- return c`
757
- <wui-flex
758
- flexDirection="column"
759
- alignItems="center"
760
- gap="6"
761
- .padding=${["0", "0", "4", "0"]}
762
- >
763
- ${this.onboardingTemplate()} ${this.buttonsTemplate()}
764
- <wui-link
765
- @click=${() => {
766
- D.openHref(te.URLS.FAQ, "_blank");
767
- }}
768
- >
769
- Learn more
770
- <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon>
771
- </wui-link>
772
- </wui-flex>
773
- `;
774
- }
775
- onboardingTemplate() {
776
- return c` <wui-flex
777
- flexDirection="column"
778
- gap="6"
779
- alignItems="center"
780
- .padding=${["0", "6", "0", "6"]}
781
- >
782
- <wui-flex gap="3" alignItems="center" justifyContent="center">
783
- <wui-icon-box size="xl" color="success" icon="checkmark"></wui-icon-box>
784
- </wui-flex>
785
- <wui-flex flexDirection="column" alignItems="center" gap="3">
786
- <wui-text align="center" variant="md-medium" color="primary">
787
- Account name chosen successfully
788
- </wui-text>
789
- <wui-text align="center" variant="md-regular" color="primary">
790
- You can now fund your account and trade crypto
791
- </wui-text>
792
- </wui-flex>
793
- </wui-flex>`;
794
- }
795
- buttonsTemplate() {
796
- return c`<wui-flex
797
- .padding=${["0", "4", "0", "4"]}
798
- gap="3"
799
- class="continue-button-container"
800
- >
801
- <wui-button fullWidth size="lg" borderRadius="xs" @click=${this.redirectToAccount.bind(this)}
802
- >Let's Go!
803
- </wui-button>
804
- </wui-flex>`;
805
- }
806
- redirectToAccount() {
807
- Q.replace("Account");
808
- }
809
- };
810
- U.styles = ue;
811
- U = pe([
812
- w("w3m-register-account-name-success-view")
813
- ], U);
814
- export {
815
- E as W3mApproveTransactionView,
816
- U as W3mRegisterAccountNameSuccess,
817
- p as W3mRegisterAccountNameView,
818
- $ as W3mSmartAccountSettingsView,
819
- H as W3mUpgradeWalletView
820
- };