astra-modal-test 1.0.5 → 1.0.7
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.
- package/.github/workflows/code-quality.yml +43 -0
- package/.github/workflows/publish.yml +64 -0
- package/README.md +204 -0
- package/dist/SwapController-CsNqEWIM.js +447 -0
- package/dist/add-Dm_oSEbv.js +19 -0
- package/dist/all-wallets-DfLlzQJ3.js +10 -0
- package/dist/app-store-BMdJkp6P.js +21 -0
- package/dist/apple-BetlVMKw.js +22 -0
- package/dist/arrow-bottom-BddPptxy.js +12 -0
- package/dist/arrow-bottom-circle-CvdJJniv.js +15 -0
- package/dist/arrow-left-Bbq-z1nQ.js +12 -0
- package/dist/arrow-right-Bu4_SVLC.js +12 -0
- package/dist/arrow-top-CynlXB-M.js +12 -0
- package/dist/astra-sdk.es.js +4 -4
- package/dist/bank-B9QscNnS.js +18 -0
- package/dist/bin-v-tshf8_.js +8 -0
- package/dist/bitcoin-C01gkYyN.js +17 -0
- package/dist/browser-9uNaCY31.js +18 -0
- package/dist/card-hKR9lRzU.js +18 -0
- package/dist/{ccip-oZOrZYR9.js → ccip-CUCziAPw.js} +52 -49
- package/dist/checkmark-D1M40aM5.js +15 -0
- package/dist/checkmark-bold-1_UGl24m.js +12 -0
- package/dist/chevron-bottom-BleoRNRL.js +12 -0
- package/dist/chevron-left-C9JMU-3B.js +12 -0
- package/dist/chevron-right-Daue4WBx.js +12 -0
- package/dist/chevron-top-yuXekbUC.js +12 -0
- package/dist/chrome-store-BsUFRR7F.js +65 -0
- package/dist/circle-BCxdhM5X.js +8 -0
- package/dist/clock-7a-DWZQa.js +12 -0
- package/dist/close-DMQYuJ0z.js +12 -0
- package/dist/clsx.m-DCYaa4RU.js +20 -0
- package/dist/coinPlaceholder-DjQ-HnSH.js +12 -0
- package/dist/compass-AMecXNVm.js +12 -0
- package/dist/copy-CgIPGYbU.js +19 -0
- package/dist/cursor-DpYbTNcO.js +7 -0
- package/dist/cursor-transparent-C8iPJkn8.js +16 -0
- package/dist/desktop-BWVQVGng.js +13 -0
- package/dist/disconnect-C6IQRrtF.js +12 -0
- package/dist/discord-gH3i-QsC.js +21 -0
- package/dist/email-BxYwJC5T.js +10 -0
- package/dist/embedded-wallet-DCcVNgkc.js +464 -0
- package/dist/ethereum-CGWsmZaC.js +14 -0
- package/dist/etherscan-D4EFsAJ4.js +10 -0
- package/dist/exclamation-triangle-DNwQ1Xq6.js +8 -0
- package/dist/extension-DxQPsN2z.js +12 -0
- package/dist/external-link-BeEzrdgR.js +12 -0
- package/dist/facebook-B2Ix8_d3.js +30 -0
- package/dist/farcaster-BB83p8dC.js +16 -0
- package/dist/filters-PzdIomB1.js +12 -0
- package/dist/github-gcp1rxX0.js +22 -0
- package/dist/google-Qv9lTZcz.js +22 -0
- package/dist/help-circle-BLXTMjzX.js +16 -0
- package/dist/id-BHg2CRhj.js +16 -0
- package/dist/image-DWi1V30x.js +8 -0
- package/dist/index-4lbsZ6RQ.js +33 -0
- package/dist/index-64U3D9_n.js +21034 -0
- package/dist/index-CRU49I0g.js +15911 -0
- package/dist/index-ChxXyuZj.js +572 -0
- package/dist/index-ClS956E1.js +74511 -0
- package/dist/index-Cs4fWw01.js +386 -0
- package/dist/index-DfWqgW4h.js +709 -0
- package/dist/index-VYNI76FM.js +315 -0
- package/dist/index-qfkTLN90.js +10785 -0
- package/dist/index-r2ztgVN2.js +1060 -0
- package/dist/index-wvh7Yd5J.js +70 -0
- package/dist/info-Bl5tmiBJ.js +7 -0
- package/dist/info-circle-D2uYywg-.js +16 -0
- package/dist/lightbulb-HvXH2AVF.js +7 -0
- package/dist/mail-DXOPfnog.js +12 -0
- package/dist/mobile-Dd0Gj4vZ.js +13 -0
- package/dist/more-DYcnClbB.js +15 -0
- package/dist/network-placeholder-CfRZGQfi.js +18 -0
- package/dist/nftPlaceholder-DHmFkY55.js +12 -0
- package/dist/off-CG2Y30qN.js +8 -0
- package/dist/onramp-DoAMTeNm.js +917 -0
- package/dist/play-store-B5EYBQto.js +36 -0
- package/dist/plus-DPo25_zL.js +17 -0
- package/dist/qr-code-BRTO19PL.js +10 -0
- package/dist/receive-BvclNdV_.js +179 -0
- package/dist/recycle-horizontal-ng_b2eJV.js +13 -0
- package/dist/refresh-3kiwRV0w.js +12 -0
- package/dist/reown-logo-_9cuIfJD.js +16 -0
- package/dist/search-CoJvIxpi.js +12 -0
- package/dist/secp256k1-wZyK2iIX.js +1257 -0
- package/dist/send-BVKGSR-Z.js +19 -0
- package/dist/send-Bkj5YtHe.js +1039 -0
- package/dist/socials-DL42HlL5.js +589 -0
- package/dist/solana-BjP-_Ioa.js +17 -0
- package/dist/swapHorizontal-Do3uBbum.js +12 -0
- package/dist/swapHorizontalBold-D7N75BE-.js +12 -0
- package/dist/swapHorizontalMedium-BahEVO2x.js +20 -0
- package/dist/swapHorizontalRoundedBold-D6Hoi132.js +12 -0
- package/dist/swapVertical-P-fnrADh.js +12 -0
- package/dist/swaps-DZgbVJZ2.js +1713 -0
- package/dist/telegram-DmaL2iB8.js +20 -0
- package/dist/three-dots-oXyAsUA6.js +9 -0
- package/dist/transactions-BjB5yZN7.js +35 -0
- package/dist/twitch-0UGrMr2K.js +22 -0
- package/dist/twitterIcon-B97KAbaJ.js +10 -0
- package/dist/ui-r6nnVhBA.js +812 -0
- package/dist/user-BG1yp56Q.js +7 -0
- package/dist/verify-CgzkMSuV.js +12 -0
- package/dist/verify-filled-D-TRpWtN.js +12 -0
- package/dist/w3m-modal-Drsibcs0.js +1041 -0
- package/dist/wallet-CAHsZdfj.js +12 -0
- package/dist/wallet-placeholder-agbbreqw.js +18 -0
- package/dist/walletconnect-Yd8iXqY9.js +36 -0
- package/dist/warning-circle-C0hqC6h_.js +16 -0
- package/dist/x-mark-D9_ai2sI.js +7 -0
- package/dist/x-z6v1Jegg.js +16 -0
- package/eslint.config.mjs +1 -1
- package/package.json +14 -13
- package/src/apis/lspApi.js +47 -24
- package/src/assets/ln.png +0 -0
- package/src/assets/network/Arbitrum.png +0 -0
- package/src/assets/network/Polygon.png +0 -0
- package/src/assets/network/Solana.png +0 -0
- package/src/assets/network/botanix.png +0 -0
- package/src/assets/network/bsc.svg +13 -0
- package/src/assets/pay.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +17 -3
- package/src/comps/AstraModal.jsx +22 -16
- package/src/comps/AstraModalLogo.jsx +9 -9
- package/src/comps/AstraNetwork.jsx +174 -45
- package/src/comps/CheckErc20Button.jsx +1 -1
- package/src/comps/CommonStyle.jsx +4 -0
- package/src/comps/ConnectButton.jsx +16 -33
- package/src/comps/ResultModal.jsx +45 -39
- package/src/comps/ToLightning.jsx +207 -80
- package/src/comps/ToToken.jsx +278 -217
- package/src/constants/index.js +20 -4
- package/src/hooks/useContract.js +164 -125
- package/src/hooks/useGetMinAndMax.js +48 -0
- package/src/hooks/useLspApi.js +56 -39
- package/src/hooks/useParseInvoice.js +82 -72
- package/src/index.jsx +43 -10
- package/src/main.jsx +36 -5
- package/src/utils/index.js +136 -24
- package/vite.config.js +7 -1
- package/dist/astra-sdk.umd.js +0 -12578
- package/dist/hooks.module-BBZfodGH.js +0 -506
- package/dist/index-BKKAfRrw.js +0 -87520
- package/dist/index-C2MAIRET.js +0 -2929
- package/dist/index-CsRxokSv.js +0 -445
- package/dist/index-DQ6iiHxJ.js +0 -13720
- package/dist/index-SJhlkSif.js +0 -133
- package/dist/w3m-modal-CYJpmgnf.js +0 -267
- package/src/constants/contracts/abi/bridge.js +0 -1281
- package/src/constants/contracts/abi/index.js +0 -3
- package/src/constants/contracts/abi/usdt.js +0 -130
- package/src/constants/contracts/abi/watcher.js +0 -437
- package/src/constants/contracts/index.js +0 -37
|
@@ -0,0 +1,917 @@
|
|
|
1
|
+
import { E as P, J as y, aY as l, aZ as $, aE as j, aB as _, au as h, K as u, aI as C, av as c, I as b, H as p, V as I, ar as Y, Q as E, T as z, U as V, R as W, Y as U, O as F, at as K, S as B } from "./index-ClS956E1.js";
|
|
2
|
+
const N = P`
|
|
3
|
+
:host > wui-grid {
|
|
4
|
+
max-height: 360px;
|
|
5
|
+
overflow: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
wui-flex {
|
|
9
|
+
transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md);
|
|
10
|
+
will-change: opacity;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
wui-grid::-webkit-scrollbar {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
wui-flex.disabled {
|
|
18
|
+
opacity: 0.3;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
user-select: none;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
var A = function(s, e, t, r) {
|
|
24
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
25
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
26
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
27
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
28
|
+
};
|
|
29
|
+
let R = class extends y {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(), this.unsubscribe = [], this.selectedCurrency = l.state.paymentCurrency, this.currencies = l.state.paymentCurrencies, this.currencyImages = $.state.currencyImages, this.checked = j.state.isLegalCheckboxChecked, this.unsubscribe.push(l.subscribe((e) => {
|
|
32
|
+
this.selectedCurrency = e.paymentCurrency, this.currencies = e.paymentCurrencies;
|
|
33
|
+
}), $.subscribeKey("currencyImages", (e) => this.currencyImages = e), j.subscribeKey("isLegalCheckboxChecked", (e) => {
|
|
34
|
+
this.checked = e;
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
disconnectedCallback() {
|
|
38
|
+
this.unsubscribe.forEach((e) => e());
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
var a;
|
|
42
|
+
const { termsConditionsUrl: e, privacyPolicyUrl: t } = _.state, r = (a = _.state.features) == null ? void 0 : a.legalCheckbox, n = !!(e || t) && !!r && !this.checked;
|
|
43
|
+
return u`
|
|
44
|
+
<w3m-legal-checkbox></w3m-legal-checkbox>
|
|
45
|
+
<wui-flex
|
|
46
|
+
flexDirection="column"
|
|
47
|
+
.padding=${["0", "s", "s", "s"]}
|
|
48
|
+
gap="xs"
|
|
49
|
+
class=${h(n ? "disabled" : void 0)}
|
|
50
|
+
>
|
|
51
|
+
${this.currenciesTemplate(n)}
|
|
52
|
+
</wui-flex>
|
|
53
|
+
<w3m-legal-footer></w3m-legal-footer>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
currenciesTemplate(e = !1) {
|
|
57
|
+
return this.currencies.map((t) => {
|
|
58
|
+
var r;
|
|
59
|
+
return u`
|
|
60
|
+
<wui-list-item
|
|
61
|
+
imageSrc=${h((r = this.currencyImages) == null ? void 0 : r[t.id])}
|
|
62
|
+
@click=${() => this.selectCurrency(t)}
|
|
63
|
+
variant="image"
|
|
64
|
+
tabIdx=${h(e ? -1 : void 0)}
|
|
65
|
+
>
|
|
66
|
+
<wui-text variant="paragraph-500" color="fg-100">${t.id}</wui-text>
|
|
67
|
+
</wui-list-item>
|
|
68
|
+
`;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
selectCurrency(e) {
|
|
72
|
+
e && (l.setPaymentCurrency(e), C.close());
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
R.styles = N;
|
|
76
|
+
A([
|
|
77
|
+
c()
|
|
78
|
+
], R.prototype, "selectedCurrency", void 0);
|
|
79
|
+
A([
|
|
80
|
+
c()
|
|
81
|
+
], R.prototype, "currencies", void 0);
|
|
82
|
+
A([
|
|
83
|
+
c()
|
|
84
|
+
], R.prototype, "currencyImages", void 0);
|
|
85
|
+
A([
|
|
86
|
+
c()
|
|
87
|
+
], R.prototype, "checked", void 0);
|
|
88
|
+
R = A([
|
|
89
|
+
b("w3m-onramp-fiat-select-view")
|
|
90
|
+
], R);
|
|
91
|
+
const q = P`
|
|
92
|
+
button {
|
|
93
|
+
padding: var(--wui-spacing-s);
|
|
94
|
+
border-radius: var(--wui-border-radius-xs);
|
|
95
|
+
border: none;
|
|
96
|
+
outline: none;
|
|
97
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
98
|
+
width: 100%;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: flex-start;
|
|
102
|
+
gap: var(--wui-spacing-s);
|
|
103
|
+
transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md);
|
|
104
|
+
will-change: background-color;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
button:hover {
|
|
108
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.provider-image {
|
|
112
|
+
width: var(--wui-spacing-3xl);
|
|
113
|
+
min-width: var(--wui-spacing-3xl);
|
|
114
|
+
height: var(--wui-spacing-3xl);
|
|
115
|
+
border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2));
|
|
116
|
+
position: relative;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.provider-image::after {
|
|
121
|
+
content: '';
|
|
122
|
+
display: block;
|
|
123
|
+
width: 100%;
|
|
124
|
+
height: 100%;
|
|
125
|
+
position: absolute;
|
|
126
|
+
inset: 0;
|
|
127
|
+
border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2));
|
|
128
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.network-icon {
|
|
132
|
+
width: var(--wui-spacing-m);
|
|
133
|
+
height: var(--wui-spacing-m);
|
|
134
|
+
border-radius: calc(var(--wui-spacing-m) / 2);
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
box-shadow:
|
|
137
|
+
0 0 0 3px var(--wui-color-gray-glass-002),
|
|
138
|
+
0 0 0 3px var(--wui-color-modal-bg);
|
|
139
|
+
transition: box-shadow var(--wui-ease-out-power-1) var(--wui-duration-md);
|
|
140
|
+
will-change: box-shadow;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
button:hover .network-icon {
|
|
144
|
+
box-shadow:
|
|
145
|
+
0 0 0 3px var(--wui-color-gray-glass-005),
|
|
146
|
+
0 0 0 3px var(--wui-color-modal-bg);
|
|
147
|
+
}
|
|
148
|
+
`;
|
|
149
|
+
var v = function(s, e, t, r) {
|
|
150
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
151
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
152
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
153
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
154
|
+
};
|
|
155
|
+
let m = class extends y {
|
|
156
|
+
constructor() {
|
|
157
|
+
super(...arguments), this.disabled = !1, this.color = "inherit", this.label = "", this.feeRange = "", this.loading = !1, this.onClick = null;
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
return u`
|
|
161
|
+
<button ?disabled=${this.disabled} @click=${this.onClick} ontouchstart>
|
|
162
|
+
<wui-visual name=${h(this.name)} class="provider-image"></wui-visual>
|
|
163
|
+
<wui-flex flexDirection="column" gap="4xs">
|
|
164
|
+
<wui-text variant="paragraph-500" color="fg-100">${this.label}</wui-text>
|
|
165
|
+
<wui-flex alignItems="center" justifyContent="flex-start" gap="l">
|
|
166
|
+
<wui-text variant="tiny-500" color="fg-100">
|
|
167
|
+
<wui-text variant="tiny-400" color="fg-200">Fees</wui-text>
|
|
168
|
+
${this.feeRange}
|
|
169
|
+
</wui-text>
|
|
170
|
+
<wui-flex gap="xxs">
|
|
171
|
+
<wui-icon name="bank" size="xs" color="fg-150"></wui-icon>
|
|
172
|
+
<wui-icon name="card" size="xs" color="fg-150"></wui-icon>
|
|
173
|
+
</wui-flex>
|
|
174
|
+
${this.networksTemplate()}
|
|
175
|
+
</wui-flex>
|
|
176
|
+
</wui-flex>
|
|
177
|
+
${this.loading ? u`<wui-loading-spinner color="fg-200" size="md"></wui-loading-spinner>` : u`<wui-icon name="chevronRight" color="fg-200" size="sm"></wui-icon>`}
|
|
178
|
+
</button>
|
|
179
|
+
`;
|
|
180
|
+
}
|
|
181
|
+
networksTemplate() {
|
|
182
|
+
var r;
|
|
183
|
+
const e = I.getAllRequestedCaipNetworks(), t = (r = e == null ? void 0 : e.filter((o) => {
|
|
184
|
+
var i;
|
|
185
|
+
return (i = o == null ? void 0 : o.assets) == null ? void 0 : i.imageId;
|
|
186
|
+
})) == null ? void 0 : r.slice(0, 5);
|
|
187
|
+
return u`
|
|
188
|
+
<wui-flex class="networks">
|
|
189
|
+
${t == null ? void 0 : t.map((o) => u`
|
|
190
|
+
<wui-flex class="network-icon">
|
|
191
|
+
<wui-image src=${h(Y.getNetworkImage(o))}></wui-image>
|
|
192
|
+
</wui-flex>
|
|
193
|
+
`)}
|
|
194
|
+
</wui-flex>
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
m.styles = [q];
|
|
199
|
+
v([
|
|
200
|
+
p({ type: Boolean })
|
|
201
|
+
], m.prototype, "disabled", void 0);
|
|
202
|
+
v([
|
|
203
|
+
p()
|
|
204
|
+
], m.prototype, "color", void 0);
|
|
205
|
+
v([
|
|
206
|
+
p()
|
|
207
|
+
], m.prototype, "name", void 0);
|
|
208
|
+
v([
|
|
209
|
+
p()
|
|
210
|
+
], m.prototype, "label", void 0);
|
|
211
|
+
v([
|
|
212
|
+
p()
|
|
213
|
+
], m.prototype, "feeRange", void 0);
|
|
214
|
+
v([
|
|
215
|
+
p({ type: Boolean })
|
|
216
|
+
], m.prototype, "loading", void 0);
|
|
217
|
+
v([
|
|
218
|
+
p()
|
|
219
|
+
], m.prototype, "onClick", void 0);
|
|
220
|
+
m = v([
|
|
221
|
+
b("w3m-onramp-provider-item")
|
|
222
|
+
], m);
|
|
223
|
+
const H = P`
|
|
224
|
+
wui-flex {
|
|
225
|
+
border-top: 1px solid var(--wui-color-gray-glass-005);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
a {
|
|
229
|
+
text-decoration: none;
|
|
230
|
+
color: var(--wui-color-fg-175);
|
|
231
|
+
font-weight: 500;
|
|
232
|
+
display: flex;
|
|
233
|
+
align-items: center;
|
|
234
|
+
justify-content: center;
|
|
235
|
+
gap: var(--wui-spacing-3xs);
|
|
236
|
+
}
|
|
237
|
+
`;
|
|
238
|
+
var Q = function(s, e, t, r) {
|
|
239
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
240
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
241
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
242
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
243
|
+
};
|
|
244
|
+
let S = class extends y {
|
|
245
|
+
render() {
|
|
246
|
+
const { termsConditionsUrl: e, privacyPolicyUrl: t } = _.state;
|
|
247
|
+
return !e && !t ? null : u`
|
|
248
|
+
<wui-flex
|
|
249
|
+
.padding=${["m", "s", "s", "s"]}
|
|
250
|
+
flexDirection="column"
|
|
251
|
+
alignItems="center"
|
|
252
|
+
justifyContent="center"
|
|
253
|
+
gap="s"
|
|
254
|
+
>
|
|
255
|
+
<wui-text color="fg-250" variant="small-400" align="center">
|
|
256
|
+
We work with the best providers to give you the lowest fees and best support. More options
|
|
257
|
+
coming soon!
|
|
258
|
+
</wui-text>
|
|
259
|
+
|
|
260
|
+
${this.howDoesItWorkTemplate()}
|
|
261
|
+
</wui-flex>
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
howDoesItWorkTemplate() {
|
|
265
|
+
return u` <wui-link @click=${this.onWhatIsBuy.bind(this)}>
|
|
266
|
+
<wui-icon size="xs" color="accent-100" slot="iconLeft" name="helpCircle"></wui-icon>
|
|
267
|
+
How does it work?
|
|
268
|
+
</wui-link>`;
|
|
269
|
+
}
|
|
270
|
+
onWhatIsBuy() {
|
|
271
|
+
E.sendEvent({
|
|
272
|
+
type: "track",
|
|
273
|
+
event: "SELECT_WHAT_IS_A_BUY",
|
|
274
|
+
properties: {
|
|
275
|
+
isSmartAccount: z(I.state.activeChain) === V.ACCOUNT_TYPES.SMART_ACCOUNT
|
|
276
|
+
}
|
|
277
|
+
}), W.push("WhatIsABuy");
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
S.styles = [H];
|
|
281
|
+
S = Q([
|
|
282
|
+
b("w3m-onramp-providers-footer")
|
|
283
|
+
], S);
|
|
284
|
+
var M = function(s, e, t, r) {
|
|
285
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
286
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
287
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
288
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
289
|
+
};
|
|
290
|
+
let D = class extends y {
|
|
291
|
+
constructor() {
|
|
292
|
+
super(), this.unsubscribe = [], this.providers = l.state.providers, this.unsubscribe.push(l.subscribeKey("providers", (e) => {
|
|
293
|
+
this.providers = e;
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
render() {
|
|
297
|
+
return u`
|
|
298
|
+
<wui-flex flexDirection="column" .padding=${["0", "s", "s", "s"]} gap="xs">
|
|
299
|
+
${this.onRampProvidersTemplate()}
|
|
300
|
+
</wui-flex>
|
|
301
|
+
<w3m-onramp-providers-footer></w3m-onramp-providers-footer>
|
|
302
|
+
`;
|
|
303
|
+
}
|
|
304
|
+
onRampProvidersTemplate() {
|
|
305
|
+
return this.providers.filter((e) => e.supportedChains.includes(I.state.activeChain ?? "eip155")).map((e) => u`
|
|
306
|
+
<w3m-onramp-provider-item
|
|
307
|
+
label=${e.label}
|
|
308
|
+
name=${e.name}
|
|
309
|
+
feeRange=${e.feeRange}
|
|
310
|
+
@click=${() => {
|
|
311
|
+
this.onClickProvider(e);
|
|
312
|
+
}}
|
|
313
|
+
?disabled=${!e.url}
|
|
314
|
+
data-testid=${`onramp-provider-${e.name}`}
|
|
315
|
+
></w3m-onramp-provider-item>
|
|
316
|
+
`);
|
|
317
|
+
}
|
|
318
|
+
onClickProvider(e) {
|
|
319
|
+
var t;
|
|
320
|
+
l.setSelectedProvider(e), W.push("BuyInProgress"), U.openHref(((t = l.state.selectedProvider) == null ? void 0 : t.url) || e.url, "popupWindow", "width=600,height=800,scrollbars=yes"), E.sendEvent({
|
|
321
|
+
type: "track",
|
|
322
|
+
event: "SELECT_BUY_PROVIDER",
|
|
323
|
+
properties: {
|
|
324
|
+
provider: e.name,
|
|
325
|
+
isSmartAccount: z(I.state.activeChain) === V.ACCOUNT_TYPES.SMART_ACCOUNT
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
M([
|
|
331
|
+
c()
|
|
332
|
+
], D.prototype, "providers", void 0);
|
|
333
|
+
D = M([
|
|
334
|
+
b("w3m-onramp-providers-view")
|
|
335
|
+
], D);
|
|
336
|
+
const X = P`
|
|
337
|
+
:host > wui-grid {
|
|
338
|
+
max-height: 360px;
|
|
339
|
+
overflow: auto;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
wui-flex {
|
|
343
|
+
transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md);
|
|
344
|
+
will-change: opacity;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
wui-grid::-webkit-scrollbar {
|
|
348
|
+
display: none;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
wui-flex.disabled {
|
|
352
|
+
opacity: 0.3;
|
|
353
|
+
pointer-events: none;
|
|
354
|
+
user-select: none;
|
|
355
|
+
}
|
|
356
|
+
`;
|
|
357
|
+
var T = function(s, e, t, r) {
|
|
358
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
359
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
360
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
361
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
362
|
+
};
|
|
363
|
+
let k = class extends y {
|
|
364
|
+
constructor() {
|
|
365
|
+
super(), this.unsubscribe = [], this.selectedCurrency = l.state.purchaseCurrencies, this.tokens = l.state.purchaseCurrencies, this.tokenImages = $.state.tokenImages, this.checked = j.state.isLegalCheckboxChecked, this.unsubscribe.push(l.subscribe((e) => {
|
|
366
|
+
this.selectedCurrency = e.purchaseCurrencies, this.tokens = e.purchaseCurrencies;
|
|
367
|
+
}), $.subscribeKey("tokenImages", (e) => this.tokenImages = e), j.subscribeKey("isLegalCheckboxChecked", (e) => {
|
|
368
|
+
this.checked = e;
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
371
|
+
disconnectedCallback() {
|
|
372
|
+
this.unsubscribe.forEach((e) => e());
|
|
373
|
+
}
|
|
374
|
+
render() {
|
|
375
|
+
var a;
|
|
376
|
+
const { termsConditionsUrl: e, privacyPolicyUrl: t } = _.state, r = (a = _.state.features) == null ? void 0 : a.legalCheckbox, n = !!(e || t) && !!r && !this.checked;
|
|
377
|
+
return u`
|
|
378
|
+
<w3m-legal-checkbox></w3m-legal-checkbox>
|
|
379
|
+
<wui-flex
|
|
380
|
+
flexDirection="column"
|
|
381
|
+
.padding=${["0", "s", "s", "s"]}
|
|
382
|
+
gap="xs"
|
|
383
|
+
class=${h(n ? "disabled" : void 0)}
|
|
384
|
+
>
|
|
385
|
+
${this.currenciesTemplate(n)}
|
|
386
|
+
</wui-flex>
|
|
387
|
+
<w3m-legal-footer></w3m-legal-footer>
|
|
388
|
+
`;
|
|
389
|
+
}
|
|
390
|
+
currenciesTemplate(e = !1) {
|
|
391
|
+
return this.tokens.map((t) => {
|
|
392
|
+
var r;
|
|
393
|
+
return u`
|
|
394
|
+
<wui-list-item
|
|
395
|
+
imageSrc=${h((r = this.tokenImages) == null ? void 0 : r[t.symbol])}
|
|
396
|
+
@click=${() => this.selectToken(t)}
|
|
397
|
+
variant="image"
|
|
398
|
+
tabIdx=${h(e ? -1 : void 0)}
|
|
399
|
+
>
|
|
400
|
+
<wui-flex gap="3xs" alignItems="center">
|
|
401
|
+
<wui-text variant="paragraph-500" color="fg-100">${t.name}</wui-text>
|
|
402
|
+
<wui-text variant="small-400" color="fg-200">${t.symbol}</wui-text>
|
|
403
|
+
</wui-flex>
|
|
404
|
+
</wui-list-item>
|
|
405
|
+
`;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
selectToken(e) {
|
|
409
|
+
e && (l.setPurchaseCurrency(e), C.close());
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
k.styles = X;
|
|
413
|
+
T([
|
|
414
|
+
c()
|
|
415
|
+
], k.prototype, "selectedCurrency", void 0);
|
|
416
|
+
T([
|
|
417
|
+
c()
|
|
418
|
+
], k.prototype, "tokens", void 0);
|
|
419
|
+
T([
|
|
420
|
+
c()
|
|
421
|
+
], k.prototype, "tokenImages", void 0);
|
|
422
|
+
T([
|
|
423
|
+
c()
|
|
424
|
+
], k.prototype, "checked", void 0);
|
|
425
|
+
k = T([
|
|
426
|
+
b("w3m-onramp-token-select-view")
|
|
427
|
+
], k);
|
|
428
|
+
const G = P`
|
|
429
|
+
@keyframes shake {
|
|
430
|
+
0% {
|
|
431
|
+
transform: translateX(0);
|
|
432
|
+
}
|
|
433
|
+
25% {
|
|
434
|
+
transform: translateX(3px);
|
|
435
|
+
}
|
|
436
|
+
50% {
|
|
437
|
+
transform: translateX(-3px);
|
|
438
|
+
}
|
|
439
|
+
75% {
|
|
440
|
+
transform: translateX(3px);
|
|
441
|
+
}
|
|
442
|
+
100% {
|
|
443
|
+
transform: translateX(0);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
wui-flex:first-child:not(:only-child) {
|
|
448
|
+
position: relative;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
wui-loading-thumbnail {
|
|
452
|
+
position: absolute;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
wui-visual {
|
|
456
|
+
width: var(--wui-wallet-image-size-lg);
|
|
457
|
+
height: var(--wui-wallet-image-size-lg);
|
|
458
|
+
border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
|
|
459
|
+
position: relative;
|
|
460
|
+
overflow: hidden;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
wui-visual::after {
|
|
464
|
+
content: '';
|
|
465
|
+
display: block;
|
|
466
|
+
width: 100%;
|
|
467
|
+
height: 100%;
|
|
468
|
+
position: absolute;
|
|
469
|
+
inset: 0;
|
|
470
|
+
border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
|
|
471
|
+
box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
wui-icon-box {
|
|
475
|
+
position: absolute;
|
|
476
|
+
right: calc(var(--wui-spacing-3xs) * -1);
|
|
477
|
+
bottom: calc(var(--wui-spacing-3xs) * -1);
|
|
478
|
+
opacity: 0;
|
|
479
|
+
transform: scale(0.5);
|
|
480
|
+
transition:
|
|
481
|
+
opacity var(--wui-ease-out-power-2) var(--wui-duration-lg),
|
|
482
|
+
transform var(--wui-ease-out-power-2) var(--wui-duration-lg);
|
|
483
|
+
will-change: opacity, transform;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
wui-text[align='center'] {
|
|
487
|
+
width: 100%;
|
|
488
|
+
padding: 0px var(--wui-spacing-l);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
[data-error='true'] wui-icon-box {
|
|
492
|
+
opacity: 1;
|
|
493
|
+
transform: scale(1);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
[data-error='true'] > wui-flex:first-child {
|
|
497
|
+
animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
[data-retry='false'] wui-link {
|
|
501
|
+
display: none;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
[data-retry='true'] wui-link {
|
|
505
|
+
display: block;
|
|
506
|
+
opacity: 1;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
wui-link {
|
|
510
|
+
padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs);
|
|
511
|
+
}
|
|
512
|
+
`;
|
|
513
|
+
var f = function(s, e, t, r) {
|
|
514
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
515
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
516
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
517
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
518
|
+
};
|
|
519
|
+
let d = class extends y {
|
|
520
|
+
constructor() {
|
|
521
|
+
super(), this.unsubscribe = [], this.selectedOnRampProvider = l.state.selectedProvider, this.uri = F.state.wcUri, this.ready = !1, this.showRetry = !1, this.buffering = !1, this.error = !1, this.isMobile = !1, this.onRetry = void 0, this.unsubscribe.push(l.subscribeKey("selectedProvider", (e) => {
|
|
522
|
+
this.selectedOnRampProvider = e;
|
|
523
|
+
}));
|
|
524
|
+
}
|
|
525
|
+
disconnectedCallback() {
|
|
526
|
+
this.intervalId && clearInterval(this.intervalId);
|
|
527
|
+
}
|
|
528
|
+
render() {
|
|
529
|
+
var r, o;
|
|
530
|
+
let e = "Continue in external window";
|
|
531
|
+
this.error ? e = "Buy failed" : this.selectedOnRampProvider && (e = `Buy in ${(r = this.selectedOnRampProvider) == null ? void 0 : r.label}`);
|
|
532
|
+
const t = this.error ? "Buy can be declined from your side or due to and error on the provider app" : "We’ll notify you once your Buy is processed";
|
|
533
|
+
return u`
|
|
534
|
+
<wui-flex
|
|
535
|
+
data-error=${h(this.error)}
|
|
536
|
+
data-retry=${this.showRetry}
|
|
537
|
+
flexDirection="column"
|
|
538
|
+
alignItems="center"
|
|
539
|
+
.padding=${["3xl", "xl", "xl", "xl"]}
|
|
540
|
+
gap="xl"
|
|
541
|
+
>
|
|
542
|
+
<wui-flex justifyContent="center" alignItems="center">
|
|
543
|
+
<wui-visual
|
|
544
|
+
name=${h((o = this.selectedOnRampProvider) == null ? void 0 : o.name)}
|
|
545
|
+
size="lg"
|
|
546
|
+
class="provider-image"
|
|
547
|
+
>
|
|
548
|
+
</wui-visual>
|
|
549
|
+
|
|
550
|
+
${this.error ? null : this.loaderTemplate()}
|
|
551
|
+
|
|
552
|
+
<wui-icon-box
|
|
553
|
+
backgroundColor="error-100"
|
|
554
|
+
background="opaque"
|
|
555
|
+
iconColor="error-100"
|
|
556
|
+
icon="close"
|
|
557
|
+
size="sm"
|
|
558
|
+
border
|
|
559
|
+
borderColor="wui-color-bg-125"
|
|
560
|
+
></wui-icon-box>
|
|
561
|
+
</wui-flex>
|
|
562
|
+
|
|
563
|
+
<wui-flex flexDirection="column" alignItems="center" gap="xs">
|
|
564
|
+
<wui-text variant="paragraph-500" color=${this.error ? "error-100" : "fg-100"}>
|
|
565
|
+
${e}
|
|
566
|
+
</wui-text>
|
|
567
|
+
<wui-text align="center" variant="small-500" color="fg-200">${t}</wui-text>
|
|
568
|
+
</wui-flex>
|
|
569
|
+
|
|
570
|
+
${this.error ? this.tryAgainTemplate() : null}
|
|
571
|
+
</wui-flex>
|
|
572
|
+
|
|
573
|
+
<wui-flex .padding=${["0", "xl", "xl", "xl"]} justifyContent="center">
|
|
574
|
+
<wui-link @click=${this.onCopyUri} color="fg-200">
|
|
575
|
+
<wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
|
|
576
|
+
Copy link
|
|
577
|
+
</wui-link>
|
|
578
|
+
</wui-flex>
|
|
579
|
+
`;
|
|
580
|
+
}
|
|
581
|
+
onTryAgain() {
|
|
582
|
+
this.selectedOnRampProvider && (this.error = !1, U.openHref(this.selectedOnRampProvider.url, "popupWindow", "width=600,height=800,scrollbars=yes"));
|
|
583
|
+
}
|
|
584
|
+
tryAgainTemplate() {
|
|
585
|
+
var e;
|
|
586
|
+
return (e = this.selectedOnRampProvider) != null && e.url ? u`<wui-button size="md" variant="accent" @click=${this.onTryAgain.bind(this)}>
|
|
587
|
+
<wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
|
|
588
|
+
Try again
|
|
589
|
+
</wui-button>` : null;
|
|
590
|
+
}
|
|
591
|
+
loaderTemplate() {
|
|
592
|
+
const e = K.state.themeVariables["--w3m-border-radius-master"], t = e ? parseInt(e.replace("px", ""), 10) : 4;
|
|
593
|
+
return u`<wui-loading-thumbnail radius=${t * 9}></wui-loading-thumbnail>`;
|
|
594
|
+
}
|
|
595
|
+
onCopyUri() {
|
|
596
|
+
var e;
|
|
597
|
+
if (!((e = this.selectedOnRampProvider) != null && e.url)) {
|
|
598
|
+
B.showError("No link found"), W.goBack();
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
try {
|
|
602
|
+
U.copyToClopboard(this.selectedOnRampProvider.url), B.showSuccess("Link copied");
|
|
603
|
+
} catch {
|
|
604
|
+
B.showError("Failed to copy");
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
d.styles = G;
|
|
609
|
+
f([
|
|
610
|
+
c()
|
|
611
|
+
], d.prototype, "intervalId", void 0);
|
|
612
|
+
f([
|
|
613
|
+
c()
|
|
614
|
+
], d.prototype, "selectedOnRampProvider", void 0);
|
|
615
|
+
f([
|
|
616
|
+
c()
|
|
617
|
+
], d.prototype, "uri", void 0);
|
|
618
|
+
f([
|
|
619
|
+
c()
|
|
620
|
+
], d.prototype, "ready", void 0);
|
|
621
|
+
f([
|
|
622
|
+
c()
|
|
623
|
+
], d.prototype, "showRetry", void 0);
|
|
624
|
+
f([
|
|
625
|
+
c()
|
|
626
|
+
], d.prototype, "buffering", void 0);
|
|
627
|
+
f([
|
|
628
|
+
c()
|
|
629
|
+
], d.prototype, "error", void 0);
|
|
630
|
+
f([
|
|
631
|
+
p({ type: Boolean })
|
|
632
|
+
], d.prototype, "isMobile", void 0);
|
|
633
|
+
f([
|
|
634
|
+
p()
|
|
635
|
+
], d.prototype, "onRetry", void 0);
|
|
636
|
+
d = f([
|
|
637
|
+
b("w3m-buy-in-progress-view")
|
|
638
|
+
], d);
|
|
639
|
+
var J = function(s, e, t, r) {
|
|
640
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
641
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
642
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
643
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
644
|
+
};
|
|
645
|
+
let L = class extends y {
|
|
646
|
+
render() {
|
|
647
|
+
return u`
|
|
648
|
+
<wui-flex
|
|
649
|
+
flexDirection="column"
|
|
650
|
+
.padding=${["xxl", "3xl", "xl", "3xl"]}
|
|
651
|
+
alignItems="center"
|
|
652
|
+
gap="xl"
|
|
653
|
+
>
|
|
654
|
+
<wui-visual name="onrampCard"></wui-visual>
|
|
655
|
+
<wui-flex flexDirection="column" gap="xs" alignItems="center">
|
|
656
|
+
<wui-text align="center" variant="paragraph-500" color="fg-100">
|
|
657
|
+
Quickly and easily buy digital assets!
|
|
658
|
+
</wui-text>
|
|
659
|
+
<wui-text align="center" variant="small-400" color="fg-200">
|
|
660
|
+
Simply select your preferred onramp provider and add digital assets to your account
|
|
661
|
+
using your credit card or bank transfer
|
|
662
|
+
</wui-text>
|
|
663
|
+
</wui-flex>
|
|
664
|
+
<wui-button @click=${W.goBack}>
|
|
665
|
+
<wui-icon size="sm" color="inherit" name="add" slot="iconLeft"></wui-icon>
|
|
666
|
+
Buy
|
|
667
|
+
</wui-button>
|
|
668
|
+
</wui-flex>
|
|
669
|
+
`;
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
L = J([
|
|
673
|
+
b("w3m-what-is-a-buy-view")
|
|
674
|
+
], L);
|
|
675
|
+
const Z = P`
|
|
676
|
+
:host {
|
|
677
|
+
width: 100%;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
wui-loading-spinner {
|
|
681
|
+
position: absolute;
|
|
682
|
+
top: 50%;
|
|
683
|
+
right: 20px;
|
|
684
|
+
transform: translateY(-50%);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.currency-container {
|
|
688
|
+
position: absolute;
|
|
689
|
+
top: 50%;
|
|
690
|
+
transform: translateY(-50%);
|
|
691
|
+
right: var(--wui-spacing-1xs);
|
|
692
|
+
height: 40px;
|
|
693
|
+
padding: var(--wui-spacing-xs) var(--wui-spacing-1xs) var(--wui-spacing-xs)
|
|
694
|
+
var(--wui-spacing-xs);
|
|
695
|
+
min-width: 95px;
|
|
696
|
+
border-radius: var(--FULL, 1000px);
|
|
697
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
698
|
+
background: var(--wui-color-gray-glass-002);
|
|
699
|
+
cursor: pointer;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
.currency-container > wui-image {
|
|
703
|
+
height: 24px;
|
|
704
|
+
width: 24px;
|
|
705
|
+
border-radius: 50%;
|
|
706
|
+
}
|
|
707
|
+
`;
|
|
708
|
+
var O = function(s, e, t, r) {
|
|
709
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
710
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
711
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
712
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
713
|
+
};
|
|
714
|
+
let g = class extends y {
|
|
715
|
+
constructor() {
|
|
716
|
+
var e;
|
|
717
|
+
super(), this.unsubscribe = [], this.type = "Token", this.value = 0, this.currencies = [], this.selectedCurrency = (e = this.currencies) == null ? void 0 : e[0], this.currencyImages = $.state.currencyImages, this.tokenImages = $.state.tokenImages, this.unsubscribe.push(l.subscribeKey("purchaseCurrency", (t) => {
|
|
718
|
+
!t || this.type === "Fiat" || (this.selectedCurrency = this.formatPurchaseCurrency(t));
|
|
719
|
+
}), l.subscribeKey("paymentCurrency", (t) => {
|
|
720
|
+
!t || this.type === "Token" || (this.selectedCurrency = this.formatPaymentCurrency(t));
|
|
721
|
+
}), l.subscribe((t) => {
|
|
722
|
+
this.type === "Fiat" ? this.currencies = t.purchaseCurrencies.map(this.formatPurchaseCurrency) : this.currencies = t.paymentCurrencies.map(this.formatPaymentCurrency);
|
|
723
|
+
}), $.subscribe((t) => {
|
|
724
|
+
this.currencyImages = { ...t.currencyImages }, this.tokenImages = { ...t.tokenImages };
|
|
725
|
+
}));
|
|
726
|
+
}
|
|
727
|
+
firstUpdated() {
|
|
728
|
+
l.getAvailableCurrencies();
|
|
729
|
+
}
|
|
730
|
+
disconnectedCallback() {
|
|
731
|
+
this.unsubscribe.forEach((e) => e());
|
|
732
|
+
}
|
|
733
|
+
render() {
|
|
734
|
+
var r;
|
|
735
|
+
const e = ((r = this.selectedCurrency) == null ? void 0 : r.symbol) || "", t = this.currencyImages[e] || this.tokenImages[e];
|
|
736
|
+
return u`<wui-input-text type="number" size="lg" value=${this.value}>
|
|
737
|
+
${this.selectedCurrency ? u` <wui-flex
|
|
738
|
+
class="currency-container"
|
|
739
|
+
justifyContent="space-between"
|
|
740
|
+
alignItems="center"
|
|
741
|
+
gap="xxs"
|
|
742
|
+
@click=${() => C.open({ view: `OnRamp${this.type}Select` })}
|
|
743
|
+
>
|
|
744
|
+
<wui-image src=${h(t)}></wui-image>
|
|
745
|
+
<wui-text color="fg-100">${this.selectedCurrency.symbol}</wui-text>
|
|
746
|
+
</wui-flex>` : u`<wui-loading-spinner></wui-loading-spinner>`}
|
|
747
|
+
</wui-input-text>`;
|
|
748
|
+
}
|
|
749
|
+
formatPaymentCurrency(e) {
|
|
750
|
+
return {
|
|
751
|
+
name: e.id,
|
|
752
|
+
symbol: e.id
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
formatPurchaseCurrency(e) {
|
|
756
|
+
return {
|
|
757
|
+
name: e.name,
|
|
758
|
+
symbol: e.symbol
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
g.styles = Z;
|
|
763
|
+
O([
|
|
764
|
+
p({ type: String })
|
|
765
|
+
], g.prototype, "type", void 0);
|
|
766
|
+
O([
|
|
767
|
+
p({ type: Number })
|
|
768
|
+
], g.prototype, "value", void 0);
|
|
769
|
+
O([
|
|
770
|
+
c()
|
|
771
|
+
], g.prototype, "currencies", void 0);
|
|
772
|
+
O([
|
|
773
|
+
c()
|
|
774
|
+
], g.prototype, "selectedCurrency", void 0);
|
|
775
|
+
O([
|
|
776
|
+
c()
|
|
777
|
+
], g.prototype, "currencyImages", void 0);
|
|
778
|
+
O([
|
|
779
|
+
c()
|
|
780
|
+
], g.prototype, "tokenImages", void 0);
|
|
781
|
+
g = O([
|
|
782
|
+
b("w3m-onramp-input")
|
|
783
|
+
], g);
|
|
784
|
+
const ee = P`
|
|
785
|
+
:host > wui-flex {
|
|
786
|
+
width: 100%;
|
|
787
|
+
max-width: 360px;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
:host > wui-flex > wui-flex {
|
|
791
|
+
border-radius: var(--wui-border-radius-l);
|
|
792
|
+
width: 100%;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
.amounts-container {
|
|
796
|
+
width: 100%;
|
|
797
|
+
}
|
|
798
|
+
`;
|
|
799
|
+
var x = function(s, e, t, r) {
|
|
800
|
+
var o = arguments.length, i = o < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, n;
|
|
801
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(s, e, t, r);
|
|
802
|
+
else for (var a = s.length - 1; a >= 0; a--) (n = s[a]) && (i = (o < 3 ? n(i) : o > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
803
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
804
|
+
};
|
|
805
|
+
const te = {
|
|
806
|
+
USD: "$",
|
|
807
|
+
EUR: "€",
|
|
808
|
+
GBP: "£"
|
|
809
|
+
}, ie = [100, 250, 500, 1e3];
|
|
810
|
+
let w = class extends y {
|
|
811
|
+
constructor() {
|
|
812
|
+
super(), this.unsubscribe = [], this.disabled = !1, this.caipAddress = I.state.activeCaipAddress, this.loading = C.state.loading, this.paymentCurrency = l.state.paymentCurrency, this.paymentAmount = l.state.paymentAmount, this.purchaseAmount = l.state.purchaseAmount, this.quoteLoading = l.state.quotesLoading, this.unsubscribe.push(I.subscribeKey("activeCaipAddress", (e) => this.caipAddress = e), C.subscribeKey("loading", (e) => {
|
|
813
|
+
this.loading = e;
|
|
814
|
+
}), l.subscribe((e) => {
|
|
815
|
+
this.paymentCurrency = e.paymentCurrency, this.paymentAmount = e.paymentAmount, this.purchaseAmount = e.purchaseAmount, this.quoteLoading = e.quotesLoading;
|
|
816
|
+
}));
|
|
817
|
+
}
|
|
818
|
+
disconnectedCallback() {
|
|
819
|
+
this.unsubscribe.forEach((e) => e());
|
|
820
|
+
}
|
|
821
|
+
render() {
|
|
822
|
+
return u`
|
|
823
|
+
<wui-flex flexDirection="column" justifyContent="center" alignItems="center">
|
|
824
|
+
<wui-flex flexDirection="column" alignItems="center" gap="xs">
|
|
825
|
+
<w3m-onramp-input
|
|
826
|
+
type="Fiat"
|
|
827
|
+
@inputChange=${this.onPaymentAmountChange.bind(this)}
|
|
828
|
+
.value=${this.paymentAmount || 0}
|
|
829
|
+
></w3m-onramp-input>
|
|
830
|
+
<w3m-onramp-input
|
|
831
|
+
type="Token"
|
|
832
|
+
.value=${this.purchaseAmount || 0}
|
|
833
|
+
.loading=${this.quoteLoading}
|
|
834
|
+
></w3m-onramp-input>
|
|
835
|
+
<wui-flex justifyContent="space-evenly" class="amounts-container" gap="xs">
|
|
836
|
+
${ie.map((e) => {
|
|
837
|
+
var t;
|
|
838
|
+
return u`<wui-button
|
|
839
|
+
variant=${this.paymentAmount === e ? "accent" : "neutral"}
|
|
840
|
+
size="md"
|
|
841
|
+
textVariant="paragraph-600"
|
|
842
|
+
fullWidth
|
|
843
|
+
@click=${() => this.selectPresetAmount(e)}
|
|
844
|
+
>${`${te[((t = this.paymentCurrency) == null ? void 0 : t.id) || "USD"]} ${e}`}</wui-button
|
|
845
|
+
>`;
|
|
846
|
+
})}
|
|
847
|
+
</wui-flex>
|
|
848
|
+
${this.templateButton()}
|
|
849
|
+
</wui-flex>
|
|
850
|
+
</wui-flex>
|
|
851
|
+
`;
|
|
852
|
+
}
|
|
853
|
+
templateButton() {
|
|
854
|
+
return this.caipAddress ? u`<wui-button
|
|
855
|
+
@click=${this.getQuotes.bind(this)}
|
|
856
|
+
variant="main"
|
|
857
|
+
fullWidth
|
|
858
|
+
size="lg"
|
|
859
|
+
borderRadius="xs"
|
|
860
|
+
>
|
|
861
|
+
Get quotes
|
|
862
|
+
</wui-button>` : u`<wui-button
|
|
863
|
+
@click=${this.openModal.bind(this)}
|
|
864
|
+
variant="accent"
|
|
865
|
+
fullWidth
|
|
866
|
+
size="lg"
|
|
867
|
+
borderRadius="xs"
|
|
868
|
+
>
|
|
869
|
+
Connect wallet
|
|
870
|
+
</wui-button>`;
|
|
871
|
+
}
|
|
872
|
+
getQuotes() {
|
|
873
|
+
this.loading || C.open({ view: "OnRampProviders" });
|
|
874
|
+
}
|
|
875
|
+
openModal() {
|
|
876
|
+
C.open({ view: "Connect" });
|
|
877
|
+
}
|
|
878
|
+
async onPaymentAmountChange(e) {
|
|
879
|
+
l.setPaymentAmount(Number(e.detail)), await l.getQuote();
|
|
880
|
+
}
|
|
881
|
+
async selectPresetAmount(e) {
|
|
882
|
+
l.setPaymentAmount(e), await l.getQuote();
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
w.styles = ee;
|
|
886
|
+
x([
|
|
887
|
+
p({ type: Boolean })
|
|
888
|
+
], w.prototype, "disabled", void 0);
|
|
889
|
+
x([
|
|
890
|
+
c()
|
|
891
|
+
], w.prototype, "caipAddress", void 0);
|
|
892
|
+
x([
|
|
893
|
+
c()
|
|
894
|
+
], w.prototype, "loading", void 0);
|
|
895
|
+
x([
|
|
896
|
+
c()
|
|
897
|
+
], w.prototype, "paymentCurrency", void 0);
|
|
898
|
+
x([
|
|
899
|
+
c()
|
|
900
|
+
], w.prototype, "paymentAmount", void 0);
|
|
901
|
+
x([
|
|
902
|
+
c()
|
|
903
|
+
], w.prototype, "purchaseAmount", void 0);
|
|
904
|
+
x([
|
|
905
|
+
c()
|
|
906
|
+
], w.prototype, "quoteLoading", void 0);
|
|
907
|
+
w = x([
|
|
908
|
+
b("w3m-onramp-widget")
|
|
909
|
+
], w);
|
|
910
|
+
export {
|
|
911
|
+
d as W3mBuyInProgressView,
|
|
912
|
+
D as W3mOnRampProvidersView,
|
|
913
|
+
R as W3mOnrampFiatSelectView,
|
|
914
|
+
k as W3mOnrampTokensView,
|
|
915
|
+
w as W3mOnrampWidget,
|
|
916
|
+
L as W3mWhatIsABuyView
|
|
917
|
+
};
|