@lnfi-network/nodeflow-sdk 1.0.0-alpha.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.
- package/README.md +276 -0
- package/dist/SwapController-C-2g6oSP.js +447 -0
- package/dist/add-DDBnz1-Q.js +19 -0
- package/dist/all-wallets-XTwjZKGg.js +10 -0
- package/dist/app-store-sCzhkWOo.js +21 -0
- package/dist/apple-C4IG4u61.js +22 -0
- package/dist/arrow-bottom-D5KjiSxX.js +12 -0
- package/dist/arrow-bottom-circle-BwWTHJky.js +15 -0
- package/dist/arrow-left-hn1Ftfvb.js +12 -0
- package/dist/arrow-right-CkV03q5Q.js +12 -0
- package/dist/arrow-top-BFm9X5g1.js +12 -0
- package/dist/bank-BUCrVHdo.js +18 -0
- package/dist/bin-BKleaahE.js +8 -0
- package/dist/bitcoin-C7iWQVuy.js +17 -0
- package/dist/browser-CpOtTIku.js +18 -0
- package/dist/build-info.json +1 -0
- package/dist/card-CJ3tg2Ri.js +18 -0
- package/dist/ccip-DyUNuvL1.js +239 -0
- package/dist/checkmark-CvSC6zeV.js +15 -0
- package/dist/checkmark-bold-DyZJqlJ7.js +12 -0
- package/dist/chevron-bottom-T9v1OvPA.js +12 -0
- package/dist/chevron-left-B4I8A8BR.js +12 -0
- package/dist/chevron-right-DGcVStvL.js +12 -0
- package/dist/chevron-top-BtD7BPVB.js +12 -0
- package/dist/chrome-store-BTKxY14m.js +65 -0
- package/dist/circle-DLLZtCBf.js +8 -0
- package/dist/clock-BNIDUPYZ.js +12 -0
- package/dist/close-BscNWH3j.js +12 -0
- package/dist/coinPlaceholder-JCYCAADZ.js +12 -0
- package/dist/compass-D7B-kHmZ.js +12 -0
- package/dist/copy-DHBc9gJO.js +19 -0
- package/dist/cursor-DKduK293.js +7 -0
- package/dist/cursor-transparent-8DkjrHTm.js +16 -0
- package/dist/desktop-ChlWl7Ma.js +13 -0
- package/dist/disconnect-CML_GEin.js +12 -0
- package/dist/discord-CgAM6i7H.js +21 -0
- package/dist/email-8mepCwp-.js +10 -0
- package/dist/embedded-wallet-scU49N5X.js +464 -0
- package/dist/ethereum-CA-_7cWX.js +14 -0
- package/dist/etherscan-B4h2i8Uc.js +10 -0
- package/dist/exclamation-triangle-ftOWMqSf.js +8 -0
- package/dist/extension-7iqlSonF.js +12 -0
- package/dist/external-link-DAvuMfW6.js +12 -0
- package/dist/facebook-CsyBIxMB.js +30 -0
- package/dist/farcaster-DfetCk1r.js +16 -0
- package/dist/filters-CsU-LYSd.js +12 -0
- package/dist/font/ClashDisplay-Variable.ttf +0 -0
- package/dist/font/ClashDisplay-Variable.woff +0 -0
- package/dist/font/ClashDisplay-Variable.woff2 +0 -0
- package/dist/github-DjxwfOOF.js +22 -0
- package/dist/google--g4VSi6h.js +22 -0
- package/dist/help-circle-BPA985E7.js +16 -0
- package/dist/id-BCUBMri8.js +16 -0
- package/dist/image-gYCDO7su.js +8 -0
- package/dist/index-B9q3HG5u.js +709 -0
- package/dist/index-BEm1bPeX.js +63547 -0
- package/dist/index-CCgAY-U4.js +70 -0
- package/dist/index-CRbuhHbe.js +33 -0
- package/dist/index-DYL5OPkx.js +1060 -0
- package/dist/info-CIaFQJ_e.js +7 -0
- package/dist/info-circle-BPz5hFQa.js +16 -0
- package/dist/lightbulb-BDmHvdbq.js +7 -0
- package/dist/mail-DQiXQ-4_.js +12 -0
- package/dist/mobile-CG_8sNWZ.js +13 -0
- package/dist/more-B1H_I3-I.js +15 -0
- package/dist/network-placeholder-1RWeD7Yp.js +18 -0
- package/dist/nftPlaceholder-Cg-f-eaw.js +12 -0
- package/dist/nodeflow-sdk.es.js +15 -0
- package/dist/off-DB-2L-AT.js +8 -0
- package/dist/onramp-DI5eQmAC.js +917 -0
- package/dist/play-store-DKJRWbqp.js +36 -0
- package/dist/plus-By1Ef8nV.js +17 -0
- package/dist/qr-code-DGuZgP-9.js +10 -0
- package/dist/receive-BEsZr88v.js +179 -0
- package/dist/recycle-horizontal-DubwRDbc.js +13 -0
- package/dist/refresh-Dwfvwy6t.js +12 -0
- package/dist/reown-logo-oDEjOrqY.js +16 -0
- package/dist/search-DX_QdW9h.js +12 -0
- package/dist/send-Bd5bwLNJ.js +1039 -0
- package/dist/send-Dq4B7ftm.js +19 -0
- package/dist/socials-BnnwB5_t.js +589 -0
- package/dist/solana-B7Ds9KBT.js +17 -0
- package/dist/swapHorizontal-CF6_7qU-.js +12 -0
- package/dist/swapHorizontalBold-C-YFgVbc.js +12 -0
- package/dist/swapHorizontalMedium-BGOdc8_e.js +20 -0
- package/dist/swapHorizontalRoundedBold-D_vYgwwO.js +12 -0
- package/dist/swapVertical-j2pWqia1.js +12 -0
- package/dist/swaps-Bh2kuHjL.js +1713 -0
- package/dist/telegram-bh_htnzP.js +20 -0
- package/dist/three-dots-B31D_Ocu.js +9 -0
- package/dist/transactions-Ch56TR3p.js +35 -0
- package/dist/twitch-DUloatpE.js +22 -0
- package/dist/twitterIcon-CNo6b91J.js +10 -0
- package/dist/ui-C7PJmqHY.js +812 -0
- package/dist/user-DqFnAlKR.js +7 -0
- package/dist/verify-BmaaygAV.js +12 -0
- package/dist/verify-filled-BwLeEdJj.js +12 -0
- package/dist/vite.svg +1 -0
- package/dist/w3m-modal-BijXCMl6.js +1041 -0
- package/dist/wallet-DyP6_6JN.js +12 -0
- package/dist/wallet-placeholder-BZC82rR0.js +18 -0
- package/dist/walletconnect-DT69luRK.js +36 -0
- package/dist/warning-circle-CGbg6QZn.js +16 -0
- package/dist/x-BfEtqtAc.js +16 -0
- package/dist/x-mark-CSmIdhvb.js +7 -0
- package/package.json +53 -0
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
import { E as f, H as d, aa as c, I as w, J as m, aP as O, Y as I, V as x, O as H, b1 as l, aR as D, K as u, F as z, G as W, b2 as q, b3 as M, R as g, N as L, a7 as $, a9 as Y, a6 as K, S as _, Q as G, T as J, U as Q } from "./index-BEm1bPeX.js";
|
|
2
|
+
import "./index-CCgAY-U4.js";
|
|
3
|
+
import { S as F } from "./SwapController-C-2g6oSP.js";
|
|
4
|
+
const X = f`
|
|
5
|
+
:host {
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100px;
|
|
8
|
+
border-radius: var(--wui-border-radius-s);
|
|
9
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
10
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
11
|
+
transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
|
|
12
|
+
will-change: background-color;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host(:hover) {
|
|
17
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
wui-flex {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: fit-content;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
wui-button {
|
|
26
|
+
display: ruby;
|
|
27
|
+
color: var(--wui-color-fg-100);
|
|
28
|
+
margin: 0 var(--wui-spacing-xs);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.instruction {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 50%;
|
|
34
|
+
transform: translateY(-50%);
|
|
35
|
+
z-index: 2;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.paste {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
textarea {
|
|
43
|
+
background: transparent;
|
|
44
|
+
width: 100%;
|
|
45
|
+
font-family: var(--w3m-font-family);
|
|
46
|
+
font-size: var(--wui-font-size-medium);
|
|
47
|
+
font-style: normal;
|
|
48
|
+
font-weight: var(--wui-font-weight-light);
|
|
49
|
+
line-height: 130%;
|
|
50
|
+
letter-spacing: var(--wui-letter-spacing-medium);
|
|
51
|
+
color: var(--wui-color-fg-100);
|
|
52
|
+
caret-color: var(--wui-color-accent-100);
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
-webkit-appearance: none;
|
|
55
|
+
-moz-appearance: textfield;
|
|
56
|
+
padding: 0px;
|
|
57
|
+
border: none;
|
|
58
|
+
outline: none;
|
|
59
|
+
appearance: none;
|
|
60
|
+
resize: none;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
var E = function(o, e, i, n) {
|
|
65
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
66
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
67
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
68
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
69
|
+
};
|
|
70
|
+
let A = class extends m {
|
|
71
|
+
constructor() {
|
|
72
|
+
super(...arguments), this.inputElementRef = O(), this.instructionElementRef = O(), this.instructionHidden = !!this.value, this.pasting = !1, this.onDebouncedSearch = I.debounce(async (e) => {
|
|
73
|
+
if (!e.length) {
|
|
74
|
+
this.setReceiverAddress("");
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const i = x.state.activeChain;
|
|
78
|
+
if (I.isAddress(e, i)) {
|
|
79
|
+
this.setReceiverAddress(e);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const r = await H.getEnsAddress(e);
|
|
84
|
+
if (r) {
|
|
85
|
+
l.setReceiverProfileName(e), l.setReceiverAddress(r);
|
|
86
|
+
const t = await H.getEnsAvatar(e);
|
|
87
|
+
l.setReceiverProfileImageUrl(t || void 0);
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
this.setReceiverAddress(e);
|
|
91
|
+
} finally {
|
|
92
|
+
l.setLoading(!1);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
firstUpdated() {
|
|
97
|
+
this.value && (this.instructionHidden = !0), this.checkHidden();
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
return u` <wui-flex
|
|
101
|
+
@click=${this.onBoxClick.bind(this)}
|
|
102
|
+
flexDirection="column"
|
|
103
|
+
justifyContent="center"
|
|
104
|
+
gap="4xs"
|
|
105
|
+
.padding=${["2xl", "l", "xl", "l"]}
|
|
106
|
+
>
|
|
107
|
+
<wui-text
|
|
108
|
+
${D(this.instructionElementRef)}
|
|
109
|
+
class="instruction"
|
|
110
|
+
color="fg-300"
|
|
111
|
+
variant="medium-400"
|
|
112
|
+
>
|
|
113
|
+
Type or
|
|
114
|
+
<wui-button
|
|
115
|
+
class="paste"
|
|
116
|
+
size="md"
|
|
117
|
+
variant="neutral"
|
|
118
|
+
iconLeft="copy"
|
|
119
|
+
@click=${this.onPasteClick.bind(this)}
|
|
120
|
+
>
|
|
121
|
+
<wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
|
|
122
|
+
Paste
|
|
123
|
+
</wui-button>
|
|
124
|
+
address
|
|
125
|
+
</wui-text>
|
|
126
|
+
<textarea
|
|
127
|
+
spellcheck="false"
|
|
128
|
+
?disabled=${!this.instructionHidden}
|
|
129
|
+
${D(this.inputElementRef)}
|
|
130
|
+
@input=${this.onInputChange.bind(this)}
|
|
131
|
+
@blur=${this.onBlur.bind(this)}
|
|
132
|
+
.value=${this.value ?? ""}
|
|
133
|
+
autocomplete="off"
|
|
134
|
+
>
|
|
135
|
+
${this.value ?? ""}</textarea
|
|
136
|
+
>
|
|
137
|
+
</wui-flex>`;
|
|
138
|
+
}
|
|
139
|
+
async focusInput() {
|
|
140
|
+
var e;
|
|
141
|
+
this.instructionElementRef.value && (this.instructionHidden = !0, await this.toggleInstructionFocus(!1), this.instructionElementRef.value.style.pointerEvents = "none", (e = this.inputElementRef.value) == null || e.focus(), this.inputElementRef.value && (this.inputElementRef.value.selectionStart = this.inputElementRef.value.selectionEnd = this.inputElementRef.value.value.length));
|
|
142
|
+
}
|
|
143
|
+
async focusInstruction() {
|
|
144
|
+
var e;
|
|
145
|
+
this.instructionElementRef.value && (this.instructionHidden = !1, await this.toggleInstructionFocus(!0), this.instructionElementRef.value.style.pointerEvents = "auto", (e = this.inputElementRef.value) == null || e.blur());
|
|
146
|
+
}
|
|
147
|
+
async toggleInstructionFocus(e) {
|
|
148
|
+
this.instructionElementRef.value && await this.instructionElementRef.value.animate([{ opacity: e ? 0 : 1 }, { opacity: e ? 1 : 0 }], {
|
|
149
|
+
duration: 100,
|
|
150
|
+
easing: "ease",
|
|
151
|
+
fill: "forwards"
|
|
152
|
+
}).finished;
|
|
153
|
+
}
|
|
154
|
+
onBoxClick() {
|
|
155
|
+
!this.value && !this.instructionHidden && this.focusInput();
|
|
156
|
+
}
|
|
157
|
+
onBlur() {
|
|
158
|
+
!this.value && this.instructionHidden && !this.pasting && this.focusInstruction();
|
|
159
|
+
}
|
|
160
|
+
checkHidden() {
|
|
161
|
+
this.instructionHidden && this.focusInput();
|
|
162
|
+
}
|
|
163
|
+
async onPasteClick() {
|
|
164
|
+
this.pasting = !0;
|
|
165
|
+
const e = await navigator.clipboard.readText();
|
|
166
|
+
l.setReceiverAddress(e), this.focusInput();
|
|
167
|
+
}
|
|
168
|
+
onInputChange(e) {
|
|
169
|
+
var n;
|
|
170
|
+
const i = e.target;
|
|
171
|
+
this.pasting = !1, this.value = (n = e.target) == null ? void 0 : n.value, i.value && !this.instructionHidden && this.focusInput(), l.setLoading(!0), this.onDebouncedSearch(i.value);
|
|
172
|
+
}
|
|
173
|
+
setReceiverAddress(e) {
|
|
174
|
+
l.setReceiverAddress(e), l.setReceiverProfileName(void 0), l.setReceiverProfileImageUrl(void 0), l.setLoading(!1);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
A.styles = X;
|
|
178
|
+
E([
|
|
179
|
+
d()
|
|
180
|
+
], A.prototype, "value", void 0);
|
|
181
|
+
E([
|
|
182
|
+
c()
|
|
183
|
+
], A.prototype, "instructionHidden", void 0);
|
|
184
|
+
E([
|
|
185
|
+
c()
|
|
186
|
+
], A.prototype, "pasting", void 0);
|
|
187
|
+
A = E([
|
|
188
|
+
w("w3m-input-address")
|
|
189
|
+
], A);
|
|
190
|
+
const Z = f`
|
|
191
|
+
:host {
|
|
192
|
+
position: relative;
|
|
193
|
+
display: inline-block;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
input {
|
|
197
|
+
background: transparent;
|
|
198
|
+
width: 100%;
|
|
199
|
+
height: auto;
|
|
200
|
+
font-family: var(--wui-font-family);
|
|
201
|
+
color: var(--wui-color-fg-100);
|
|
202
|
+
|
|
203
|
+
font-feature-settings: 'case' on;
|
|
204
|
+
font-size: 32px;
|
|
205
|
+
font-weight: var(--wui-font-weight-light);
|
|
206
|
+
caret-color: var(--wui-color-accent-100);
|
|
207
|
+
line-height: 130%;
|
|
208
|
+
letter-spacing: -1.28px;
|
|
209
|
+
box-sizing: border-box;
|
|
210
|
+
-webkit-appearance: none;
|
|
211
|
+
-moz-appearance: textfield;
|
|
212
|
+
padding: 0px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
input::-webkit-outer-spin-button,
|
|
216
|
+
input::-webkit-inner-spin-button {
|
|
217
|
+
-webkit-appearance: none;
|
|
218
|
+
margin: 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
input::placeholder {
|
|
222
|
+
color: var(--wui-color-fg-275);
|
|
223
|
+
}
|
|
224
|
+
`;
|
|
225
|
+
var B = function(o, e, i, n) {
|
|
226
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
227
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
228
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
229
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
230
|
+
};
|
|
231
|
+
let C = class extends m {
|
|
232
|
+
constructor() {
|
|
233
|
+
super(...arguments), this.inputElementRef = O(), this.disabled = !1, this.value = "", this.placeholder = "0";
|
|
234
|
+
}
|
|
235
|
+
render() {
|
|
236
|
+
var e;
|
|
237
|
+
return (e = this.inputElementRef) != null && e.value && this.value && (this.inputElementRef.value.value = this.value), u`<input
|
|
238
|
+
${D(this.inputElementRef)}
|
|
239
|
+
type="text"
|
|
240
|
+
inputmode="decimal"
|
|
241
|
+
pattern="[0-9,.]*"
|
|
242
|
+
placeholder=${this.placeholder}
|
|
243
|
+
?disabled=${this.disabled}
|
|
244
|
+
autofocus
|
|
245
|
+
value=${this.value ?? ""}
|
|
246
|
+
@input=${this.dispatchInputChangeEvent.bind(this)}
|
|
247
|
+
/> `;
|
|
248
|
+
}
|
|
249
|
+
dispatchInputChangeEvent(e) {
|
|
250
|
+
var n, r;
|
|
251
|
+
const i = e.data;
|
|
252
|
+
if (i && ((n = this.inputElementRef) != null && n.value))
|
|
253
|
+
if (i === ",") {
|
|
254
|
+
const t = this.inputElementRef.value.value.replace(",", ".");
|
|
255
|
+
this.inputElementRef.value.value = t, this.value = `${this.value}${t}`;
|
|
256
|
+
} else q.test(i) || (this.inputElementRef.value.value = this.value.replace(new RegExp(i.replace(M, "\\$&"), "gu"), ""));
|
|
257
|
+
this.dispatchEvent(new CustomEvent("inputChange", {
|
|
258
|
+
detail: (r = this.inputElementRef.value) == null ? void 0 : r.value,
|
|
259
|
+
bubbles: !0,
|
|
260
|
+
composed: !0
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
C.styles = [z, W, Z];
|
|
265
|
+
B([
|
|
266
|
+
d({ type: Boolean })
|
|
267
|
+
], C.prototype, "disabled", void 0);
|
|
268
|
+
B([
|
|
269
|
+
d({ type: String })
|
|
270
|
+
], C.prototype, "value", void 0);
|
|
271
|
+
B([
|
|
272
|
+
d({ type: String })
|
|
273
|
+
], C.prototype, "placeholder", void 0);
|
|
274
|
+
C = B([
|
|
275
|
+
w("wui-input-amount")
|
|
276
|
+
], C);
|
|
277
|
+
const ee = f`
|
|
278
|
+
:host {
|
|
279
|
+
width: 100%;
|
|
280
|
+
height: 100px;
|
|
281
|
+
border-radius: var(--wui-border-radius-s);
|
|
282
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
283
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
284
|
+
transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
|
|
285
|
+
will-change: background-color;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
:host(:hover) {
|
|
289
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
wui-flex {
|
|
293
|
+
width: 100%;
|
|
294
|
+
height: fit-content;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
wui-button {
|
|
298
|
+
width: 100%;
|
|
299
|
+
display: flex;
|
|
300
|
+
justify-content: flex-end;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
wui-input-amount {
|
|
304
|
+
mask-image: linear-gradient(
|
|
305
|
+
270deg,
|
|
306
|
+
transparent 0px,
|
|
307
|
+
transparent 8px,
|
|
308
|
+
black 24px,
|
|
309
|
+
black 25px,
|
|
310
|
+
black 32px,
|
|
311
|
+
black 100%
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.totalValue {
|
|
316
|
+
width: 100%;
|
|
317
|
+
}
|
|
318
|
+
`;
|
|
319
|
+
var V = function(o, e, i, n) {
|
|
320
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
321
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
322
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
323
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
324
|
+
};
|
|
325
|
+
let R = class extends m {
|
|
326
|
+
render() {
|
|
327
|
+
return u` <wui-flex
|
|
328
|
+
flexDirection="column"
|
|
329
|
+
gap="4xs"
|
|
330
|
+
.padding=${["xl", "s", "l", "l"]}
|
|
331
|
+
>
|
|
332
|
+
<wui-flex alignItems="center">
|
|
333
|
+
<wui-input-amount
|
|
334
|
+
@inputChange=${this.onInputChange.bind(this)}
|
|
335
|
+
?disabled=${!this.token && !0}
|
|
336
|
+
.value=${this.sendTokenAmount ? String(this.sendTokenAmount) : ""}
|
|
337
|
+
></wui-input-amount>
|
|
338
|
+
${this.buttonTemplate()}
|
|
339
|
+
</wui-flex>
|
|
340
|
+
<wui-flex alignItems="center" justifyContent="space-between">
|
|
341
|
+
${this.sendValueTemplate()}
|
|
342
|
+
<wui-flex alignItems="center" gap="4xs" justifyContent="flex-end">
|
|
343
|
+
${this.maxAmountTemplate()} ${this.actionTemplate()}
|
|
344
|
+
</wui-flex>
|
|
345
|
+
</wui-flex>
|
|
346
|
+
</wui-flex>`;
|
|
347
|
+
}
|
|
348
|
+
buttonTemplate() {
|
|
349
|
+
return this.token ? u`<wui-token-button
|
|
350
|
+
text=${this.token.symbol}
|
|
351
|
+
imageSrc=${this.token.iconUrl}
|
|
352
|
+
@click=${this.handleSelectButtonClick.bind(this)}
|
|
353
|
+
>
|
|
354
|
+
</wui-token-button>` : u`<wui-button
|
|
355
|
+
size="md"
|
|
356
|
+
variant="accent"
|
|
357
|
+
@click=${this.handleSelectButtonClick.bind(this)}
|
|
358
|
+
>Select token</wui-button
|
|
359
|
+
>`;
|
|
360
|
+
}
|
|
361
|
+
handleSelectButtonClick() {
|
|
362
|
+
g.push("WalletSendSelectToken");
|
|
363
|
+
}
|
|
364
|
+
sendValueTemplate() {
|
|
365
|
+
if (this.token && this.sendTokenAmount) {
|
|
366
|
+
const i = this.token.price * this.sendTokenAmount;
|
|
367
|
+
return u`<wui-text class="totalValue" variant="small-400" color="fg-200"
|
|
368
|
+
>${i ? `$${L.formatNumberToLocalString(i, 2)}` : "Incorrect value"}</wui-text
|
|
369
|
+
>`;
|
|
370
|
+
}
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
maxAmountTemplate() {
|
|
374
|
+
return this.token ? this.sendTokenAmount && this.sendTokenAmount > Number(this.token.quantity.numeric) ? u` <wui-text variant="small-400" color="error-100">
|
|
375
|
+
${$.roundNumber(Number(this.token.quantity.numeric), 6, 5)}
|
|
376
|
+
</wui-text>` : u` <wui-text variant="small-400" color="fg-200">
|
|
377
|
+
${$.roundNumber(Number(this.token.quantity.numeric), 6, 5)}
|
|
378
|
+
</wui-text>` : null;
|
|
379
|
+
}
|
|
380
|
+
actionTemplate() {
|
|
381
|
+
return this.token ? this.sendTokenAmount && this.sendTokenAmount > Number(this.token.quantity.numeric) ? u`<wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>` : u`<wui-link @click=${this.onMaxClick.bind(this)}>Max</wui-link>` : null;
|
|
382
|
+
}
|
|
383
|
+
onInputChange(e) {
|
|
384
|
+
l.setTokenAmount(e.detail);
|
|
385
|
+
}
|
|
386
|
+
onMaxClick() {
|
|
387
|
+
if (this.token) {
|
|
388
|
+
const e = L.bigNumber(this.token.quantity.numeric);
|
|
389
|
+
l.setTokenAmount(Number(e.toFixed(20)));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
onBuyClick() {
|
|
393
|
+
g.push("OnRampProviders");
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
R.styles = ee;
|
|
397
|
+
V([
|
|
398
|
+
d({ type: Object })
|
|
399
|
+
], R.prototype, "token", void 0);
|
|
400
|
+
V([
|
|
401
|
+
d({ type: Number })
|
|
402
|
+
], R.prototype, "sendTokenAmount", void 0);
|
|
403
|
+
R = V([
|
|
404
|
+
w("w3m-input-token")
|
|
405
|
+
], R);
|
|
406
|
+
const te = f`
|
|
407
|
+
:host {
|
|
408
|
+
display: block;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
wui-flex {
|
|
412
|
+
position: relative;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
wui-icon-box {
|
|
416
|
+
width: 40px;
|
|
417
|
+
height: 40px;
|
|
418
|
+
border-radius: var(--wui-border-radius-xs) !important;
|
|
419
|
+
border: 5px solid var(--wui-color-bg-125);
|
|
420
|
+
background: var(--wui-color-bg-175);
|
|
421
|
+
position: absolute;
|
|
422
|
+
top: 50%;
|
|
423
|
+
left: 50%;
|
|
424
|
+
transform: translate(-50%, -50%);
|
|
425
|
+
z-index: 3;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
wui-button {
|
|
429
|
+
--local-border-radius: var(--wui-border-radius-xs) !important;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.inputContainer {
|
|
433
|
+
height: fit-content;
|
|
434
|
+
}
|
|
435
|
+
`;
|
|
436
|
+
var y = function(o, e, i, n) {
|
|
437
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
438
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
439
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
440
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
441
|
+
};
|
|
442
|
+
let p = class extends m {
|
|
443
|
+
constructor() {
|
|
444
|
+
super(), this.unsubscribe = [], 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.message = "Preview Send", this.token && (this.fetchBalances(), this.fetchNetworkPrice()), this.unsubscribe.push(l.subscribe((e) => {
|
|
445
|
+
this.token = e.token, this.sendTokenAmount = e.sendTokenAmount, this.receiverAddress = e.receiverAddress, this.receiverProfileName = e.receiverProfileName, this.loading = e.loading;
|
|
446
|
+
}));
|
|
447
|
+
}
|
|
448
|
+
disconnectedCallback() {
|
|
449
|
+
this.unsubscribe.forEach((e) => e());
|
|
450
|
+
}
|
|
451
|
+
render() {
|
|
452
|
+
return this.getMessage(), u` <wui-flex flexDirection="column" .padding=${["0", "l", "l", "l"]}>
|
|
453
|
+
<wui-flex class="inputContainer" gap="xs" flexDirection="column">
|
|
454
|
+
<w3m-input-token
|
|
455
|
+
.token=${this.token}
|
|
456
|
+
.sendTokenAmount=${this.sendTokenAmount}
|
|
457
|
+
></w3m-input-token>
|
|
458
|
+
<wui-icon-box
|
|
459
|
+
size="inherit"
|
|
460
|
+
backgroundColor="fg-300"
|
|
461
|
+
iconSize="lg"
|
|
462
|
+
iconColor="fg-250"
|
|
463
|
+
background="opaque"
|
|
464
|
+
icon="arrowBottom"
|
|
465
|
+
></wui-icon-box>
|
|
466
|
+
<w3m-input-address
|
|
467
|
+
.value=${this.receiverProfileName ? this.receiverProfileName : this.receiverAddress}
|
|
468
|
+
></w3m-input-address>
|
|
469
|
+
</wui-flex>
|
|
470
|
+
<wui-flex .margin=${["l", "0", "0", "0"]}>
|
|
471
|
+
<wui-button
|
|
472
|
+
@click=${this.onButtonClick.bind(this)}
|
|
473
|
+
?disabled=${!this.message.startsWith("Preview Send")}
|
|
474
|
+
size="lg"
|
|
475
|
+
variant="main"
|
|
476
|
+
?loading=${this.loading}
|
|
477
|
+
fullWidth
|
|
478
|
+
>
|
|
479
|
+
${this.message}
|
|
480
|
+
</wui-button>
|
|
481
|
+
</wui-flex>
|
|
482
|
+
</wui-flex>`;
|
|
483
|
+
}
|
|
484
|
+
async fetchBalances() {
|
|
485
|
+
await l.fetchTokenBalance(), l.fetchNetworkBalance();
|
|
486
|
+
}
|
|
487
|
+
async fetchNetworkPrice() {
|
|
488
|
+
await F.getNetworkTokenPrice();
|
|
489
|
+
}
|
|
490
|
+
onButtonClick() {
|
|
491
|
+
g.push("WalletSendPreview");
|
|
492
|
+
}
|
|
493
|
+
getMessage() {
|
|
494
|
+
var e;
|
|
495
|
+
this.message = "Preview Send", this.receiverAddress && !I.isAddress(this.receiverAddress, x.state.activeChain) && (this.message = "Invalid Address"), this.receiverAddress || (this.message = "Add Address"), this.sendTokenAmount && this.token && this.sendTokenAmount > Number(this.token.quantity.numeric) && (this.message = "Insufficient Funds"), this.sendTokenAmount || (this.message = "Add Amount"), this.sendTokenAmount && ((e = this.token) != null && e.price) && (this.sendTokenAmount * this.token.price || (this.message = "Incorrect Value")), this.token || (this.message = "Select Token");
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
p.styles = te;
|
|
499
|
+
y([
|
|
500
|
+
c()
|
|
501
|
+
], p.prototype, "token", void 0);
|
|
502
|
+
y([
|
|
503
|
+
c()
|
|
504
|
+
], p.prototype, "sendTokenAmount", void 0);
|
|
505
|
+
y([
|
|
506
|
+
c()
|
|
507
|
+
], p.prototype, "receiverAddress", void 0);
|
|
508
|
+
y([
|
|
509
|
+
c()
|
|
510
|
+
], p.prototype, "receiverProfileName", void 0);
|
|
511
|
+
y([
|
|
512
|
+
c()
|
|
513
|
+
], p.prototype, "loading", void 0);
|
|
514
|
+
y([
|
|
515
|
+
c()
|
|
516
|
+
], p.prototype, "message", void 0);
|
|
517
|
+
p = y([
|
|
518
|
+
w("w3m-wallet-send-view")
|
|
519
|
+
], p);
|
|
520
|
+
const ie = f`
|
|
521
|
+
.contentContainer {
|
|
522
|
+
height: 440px;
|
|
523
|
+
overflow: scroll;
|
|
524
|
+
scrollbar-width: none;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.contentContainer::-webkit-scrollbar {
|
|
528
|
+
display: none;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
wui-icon-box {
|
|
532
|
+
width: 40px;
|
|
533
|
+
height: 40px;
|
|
534
|
+
border-radius: var(--wui-border-radius-xxs);
|
|
535
|
+
}
|
|
536
|
+
`;
|
|
537
|
+
var S = function(o, e, i, n) {
|
|
538
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
539
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
540
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
541
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
542
|
+
};
|
|
543
|
+
let b = class extends m {
|
|
544
|
+
constructor() {
|
|
545
|
+
super(), this.unsubscribe = [], this.tokenBalances = l.state.tokenBalances, this.search = "", this.onDebouncedSearch = I.debounce((e) => {
|
|
546
|
+
this.search = e;
|
|
547
|
+
}), this.fetchBalancesAndNetworkPrice(), this.unsubscribe.push(l.subscribe((e) => {
|
|
548
|
+
this.tokenBalances = e.tokenBalances;
|
|
549
|
+
}));
|
|
550
|
+
}
|
|
551
|
+
disconnectedCallback() {
|
|
552
|
+
this.unsubscribe.forEach((e) => e());
|
|
553
|
+
}
|
|
554
|
+
render() {
|
|
555
|
+
return u`
|
|
556
|
+
<wui-flex flexDirection="column">
|
|
557
|
+
${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
|
|
558
|
+
</wui-flex>
|
|
559
|
+
`;
|
|
560
|
+
}
|
|
561
|
+
async fetchBalancesAndNetworkPrice() {
|
|
562
|
+
var e;
|
|
563
|
+
(!this.tokenBalances || ((e = this.tokenBalances) == null ? void 0 : e.length) === 0) && (await this.fetchBalances(), await this.fetchNetworkPrice());
|
|
564
|
+
}
|
|
565
|
+
async fetchBalances() {
|
|
566
|
+
await l.fetchTokenBalance(), l.fetchNetworkBalance();
|
|
567
|
+
}
|
|
568
|
+
async fetchNetworkPrice() {
|
|
569
|
+
await F.getNetworkTokenPrice();
|
|
570
|
+
}
|
|
571
|
+
templateSearchInput() {
|
|
572
|
+
return u`
|
|
573
|
+
<wui-flex gap="xs" padding="s">
|
|
574
|
+
<wui-input-text
|
|
575
|
+
@inputChange=${this.onInputChange.bind(this)}
|
|
576
|
+
class="network-search-input"
|
|
577
|
+
size="sm"
|
|
578
|
+
placeholder="Search token"
|
|
579
|
+
icon="search"
|
|
580
|
+
></wui-input-text>
|
|
581
|
+
</wui-flex>
|
|
582
|
+
`;
|
|
583
|
+
}
|
|
584
|
+
templateTokens() {
|
|
585
|
+
var e, i;
|
|
586
|
+
return this.tokens = (e = this.tokenBalances) == null ? void 0 : e.filter((n) => {
|
|
587
|
+
var r;
|
|
588
|
+
return n.chainId === ((r = x.state.activeCaipNetwork) == null ? void 0 : r.caipNetworkId);
|
|
589
|
+
}), this.search ? this.filteredTokens = (i = this.tokenBalances) == null ? void 0 : i.filter((n) => n.name.toLowerCase().includes(this.search.toLowerCase())) : this.filteredTokens = this.tokens, u`
|
|
590
|
+
<wui-flex
|
|
591
|
+
class="contentContainer"
|
|
592
|
+
flexDirection="column"
|
|
593
|
+
.padding=${["0", "s", "0", "s"]}
|
|
594
|
+
>
|
|
595
|
+
<wui-flex justifyContent="flex-start" .padding=${["m", "s", "s", "s"]}>
|
|
596
|
+
<wui-text variant="paragraph-500" color="fg-200">Your tokens</wui-text>
|
|
597
|
+
</wui-flex>
|
|
598
|
+
<wui-flex flexDirection="column" gap="xs">
|
|
599
|
+
${this.filteredTokens && this.filteredTokens.length > 0 ? this.filteredTokens.map((n) => u`<wui-list-token
|
|
600
|
+
@click=${this.handleTokenClick.bind(this, n)}
|
|
601
|
+
?clickable=${!0}
|
|
602
|
+
tokenName=${n.name}
|
|
603
|
+
tokenImageUrl=${n.iconUrl}
|
|
604
|
+
tokenAmount=${n.quantity.numeric}
|
|
605
|
+
tokenValue=${n.value}
|
|
606
|
+
tokenCurrency=${n.symbol}
|
|
607
|
+
></wui-list-token>`) : u`<wui-flex
|
|
608
|
+
.padding=${["4xl", "0", "0", "0"]}
|
|
609
|
+
alignItems="center"
|
|
610
|
+
flexDirection="column"
|
|
611
|
+
gap="l"
|
|
612
|
+
>
|
|
613
|
+
<wui-icon-box
|
|
614
|
+
icon="coinPlaceholder"
|
|
615
|
+
size="inherit"
|
|
616
|
+
iconColor="fg-200"
|
|
617
|
+
backgroundColor="fg-200"
|
|
618
|
+
iconSize="lg"
|
|
619
|
+
></wui-icon-box>
|
|
620
|
+
<wui-flex
|
|
621
|
+
class="textContent"
|
|
622
|
+
gap="xs"
|
|
623
|
+
flexDirection="column"
|
|
624
|
+
justifyContent="center"
|
|
625
|
+
flexDirection="column"
|
|
626
|
+
>
|
|
627
|
+
<wui-text variant="paragraph-500" align="center" color="fg-100"
|
|
628
|
+
>No tokens found</wui-text
|
|
629
|
+
>
|
|
630
|
+
<wui-text variant="small-400" align="center" color="fg-200"
|
|
631
|
+
>Your tokens will appear here</wui-text
|
|
632
|
+
>
|
|
633
|
+
</wui-flex>
|
|
634
|
+
<wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
|
|
635
|
+
</wui-flex>`}
|
|
636
|
+
</wui-flex>
|
|
637
|
+
</wui-flex>
|
|
638
|
+
`;
|
|
639
|
+
}
|
|
640
|
+
onBuyClick() {
|
|
641
|
+
g.push("OnRampProviders");
|
|
642
|
+
}
|
|
643
|
+
onInputChange(e) {
|
|
644
|
+
this.onDebouncedSearch(e.detail);
|
|
645
|
+
}
|
|
646
|
+
handleTokenClick(e) {
|
|
647
|
+
l.setToken(e), l.setTokenAmount(void 0), g.goBack();
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
b.styles = ie;
|
|
651
|
+
S([
|
|
652
|
+
c()
|
|
653
|
+
], b.prototype, "tokenBalances", void 0);
|
|
654
|
+
S([
|
|
655
|
+
c()
|
|
656
|
+
], b.prototype, "tokens", void 0);
|
|
657
|
+
S([
|
|
658
|
+
c()
|
|
659
|
+
], b.prototype, "filteredTokens", void 0);
|
|
660
|
+
S([
|
|
661
|
+
c()
|
|
662
|
+
], b.prototype, "search", void 0);
|
|
663
|
+
b = S([
|
|
664
|
+
w("w3m-wallet-send-select-token-view")
|
|
665
|
+
], b);
|
|
666
|
+
const ne = f`
|
|
667
|
+
:host {
|
|
668
|
+
display: flex;
|
|
669
|
+
gap: var(--wui-spacing-xs);
|
|
670
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
671
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
672
|
+
background: var(--wui-color-gray-glass-002);
|
|
673
|
+
padding: var(--wui-spacing-2xs) var(--wui-spacing-xs) var(--wui-spacing-2xs)
|
|
674
|
+
var(--wui-spacing-s);
|
|
675
|
+
align-items: center;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
wui-avatar,
|
|
679
|
+
wui-icon,
|
|
680
|
+
wui-image {
|
|
681
|
+
width: 32px;
|
|
682
|
+
height: 32px;
|
|
683
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
684
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
685
|
+
box-shadow: 0 0 0 2px var(--wui-color-gray-glass-002);
|
|
686
|
+
}
|
|
687
|
+
`;
|
|
688
|
+
var N = function(o, e, i, n) {
|
|
689
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
690
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
691
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
692
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
693
|
+
};
|
|
694
|
+
let k = class extends m {
|
|
695
|
+
constructor() {
|
|
696
|
+
super(...arguments), this.text = "", this.address = "", this.isAddress = !1;
|
|
697
|
+
}
|
|
698
|
+
render() {
|
|
699
|
+
return u`<wui-text variant="large-500" color="fg-100">${this.text}</wui-text>
|
|
700
|
+
${this.imageTemplate()}`;
|
|
701
|
+
}
|
|
702
|
+
imageTemplate() {
|
|
703
|
+
return this.isAddress ? u`<wui-avatar address=${this.address} .imageSrc=${this.imageSrc}></wui-avatar>` : this.imageSrc ? u`<wui-image src=${this.imageSrc}></wui-image>` : u`<wui-icon size="inherit" color="fg-200" name="networkPlaceholder"></wui-icon>`;
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
k.styles = [z, W, ne];
|
|
707
|
+
N([
|
|
708
|
+
d()
|
|
709
|
+
], k.prototype, "text", void 0);
|
|
710
|
+
N([
|
|
711
|
+
d()
|
|
712
|
+
], k.prototype, "address", void 0);
|
|
713
|
+
N([
|
|
714
|
+
d()
|
|
715
|
+
], k.prototype, "imageSrc", void 0);
|
|
716
|
+
N([
|
|
717
|
+
d({ type: Boolean })
|
|
718
|
+
], k.prototype, "isAddress", void 0);
|
|
719
|
+
k = N([
|
|
720
|
+
w("wui-preview-item")
|
|
721
|
+
], k);
|
|
722
|
+
const re = f`
|
|
723
|
+
:host {
|
|
724
|
+
display: flex;
|
|
725
|
+
column-gap: var(--wui-spacing-s);
|
|
726
|
+
padding: 17px 18px 17px var(--wui-spacing-m);
|
|
727
|
+
width: 100%;
|
|
728
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
729
|
+
border-radius: var(--wui-border-radius-xs);
|
|
730
|
+
color: var(--wui-color-fg-250);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
wui-image {
|
|
734
|
+
width: var(--wui-icon-size-lg);
|
|
735
|
+
height: var(--wui-icon-size-lg);
|
|
736
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
wui-icon {
|
|
740
|
+
width: var(--wui-icon-size-lg);
|
|
741
|
+
height: var(--wui-icon-size-lg);
|
|
742
|
+
}
|
|
743
|
+
`;
|
|
744
|
+
var j = function(o, e, i, n) {
|
|
745
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
746
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
747
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
748
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
749
|
+
};
|
|
750
|
+
let T = class extends m {
|
|
751
|
+
constructor() {
|
|
752
|
+
super(...arguments), this.imageSrc = void 0, this.textTitle = "", this.textValue = void 0;
|
|
753
|
+
}
|
|
754
|
+
render() {
|
|
755
|
+
return u`
|
|
756
|
+
<wui-flex justifyContent="space-between" alignItems="center">
|
|
757
|
+
<wui-text variant="paragraph-500" color=${this.textValue ? "fg-200" : "fg-100"}>
|
|
758
|
+
${this.textTitle}
|
|
759
|
+
</wui-text>
|
|
760
|
+
${this.templateContent()}
|
|
761
|
+
</wui-flex>
|
|
762
|
+
`;
|
|
763
|
+
}
|
|
764
|
+
templateContent() {
|
|
765
|
+
return this.imageSrc ? u`<wui-image src=${this.imageSrc} alt=${this.textTitle}></wui-image>` : this.textValue ? u` <wui-text variant="paragraph-400" color="fg-100"> ${this.textValue} </wui-text>` : u`<wui-icon size="inherit" color="fg-200" name="networkPlaceholder"></wui-icon>`;
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
T.styles = [z, W, re];
|
|
769
|
+
j([
|
|
770
|
+
d()
|
|
771
|
+
], T.prototype, "imageSrc", void 0);
|
|
772
|
+
j([
|
|
773
|
+
d()
|
|
774
|
+
], T.prototype, "textTitle", void 0);
|
|
775
|
+
j([
|
|
776
|
+
d()
|
|
777
|
+
], T.prototype, "textValue", void 0);
|
|
778
|
+
T = j([
|
|
779
|
+
w("wui-list-content")
|
|
780
|
+
], T);
|
|
781
|
+
const oe = f`
|
|
782
|
+
:host {
|
|
783
|
+
display: flex;
|
|
784
|
+
width: auto;
|
|
785
|
+
flex-direction: column;
|
|
786
|
+
gap: var(--wui-border-radius-1xs);
|
|
787
|
+
border-radius: var(--wui-border-radius-s);
|
|
788
|
+
background: var(--wui-color-gray-glass-002);
|
|
789
|
+
padding: var(--wui-spacing-s) var(--wui-spacing-1xs) var(--wui-spacing-1xs)
|
|
790
|
+
var(--wui-spacing-1xs);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
wui-text {
|
|
794
|
+
padding: 0 var(--wui-spacing-1xs);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
wui-flex {
|
|
798
|
+
margin-top: var(--wui-spacing-1xs);
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
.network {
|
|
802
|
+
cursor: pointer;
|
|
803
|
+
transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
|
|
804
|
+
will-change: background-color;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
.network:focus-visible {
|
|
808
|
+
border: 1px solid var(--wui-color-accent-100);
|
|
809
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
810
|
+
-webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
811
|
+
-moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
812
|
+
box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
.network:hover {
|
|
816
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
.network:active {
|
|
820
|
+
background-color: var(--wui-color-gray-glass-010);
|
|
821
|
+
}
|
|
822
|
+
`;
|
|
823
|
+
var U = function(o, e, i, n) {
|
|
824
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
825
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
826
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
827
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
828
|
+
};
|
|
829
|
+
let P = class extends m {
|
|
830
|
+
render() {
|
|
831
|
+
return u` <wui-text variant="small-400" color="fg-200">Details</wui-text>
|
|
832
|
+
<wui-flex flexDirection="column" gap="xxs">
|
|
833
|
+
<wui-list-content
|
|
834
|
+
textTitle="Address"
|
|
835
|
+
textValue=${$.getTruncateString({
|
|
836
|
+
string: this.receiverAddress ?? "",
|
|
837
|
+
charsStart: 4,
|
|
838
|
+
charsEnd: 4,
|
|
839
|
+
truncate: "middle"
|
|
840
|
+
})}
|
|
841
|
+
>
|
|
842
|
+
</wui-list-content>
|
|
843
|
+
${this.networkTemplate()}
|
|
844
|
+
</wui-flex>`;
|
|
845
|
+
}
|
|
846
|
+
networkTemplate() {
|
|
847
|
+
var e;
|
|
848
|
+
return (e = this.caipNetwork) != null && e.name ? u` <wui-list-content
|
|
849
|
+
@click=${() => this.onNetworkClick(this.caipNetwork)}
|
|
850
|
+
class="network"
|
|
851
|
+
textTitle="Network"
|
|
852
|
+
imageSrc=${Y(K.getNetworkImage(this.caipNetwork))}
|
|
853
|
+
></wui-list-content>` : null;
|
|
854
|
+
}
|
|
855
|
+
onNetworkClick(e) {
|
|
856
|
+
e && g.push("Networks", { network: e });
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
P.styles = oe;
|
|
860
|
+
U([
|
|
861
|
+
d()
|
|
862
|
+
], P.prototype, "receiverAddress", void 0);
|
|
863
|
+
U([
|
|
864
|
+
d({ type: Object })
|
|
865
|
+
], P.prototype, "caipNetwork", void 0);
|
|
866
|
+
P = U([
|
|
867
|
+
w("w3m-wallet-send-details")
|
|
868
|
+
], P);
|
|
869
|
+
const se = f`
|
|
870
|
+
wui-avatar,
|
|
871
|
+
wui-image {
|
|
872
|
+
display: ruby;
|
|
873
|
+
width: 32px;
|
|
874
|
+
height: 32px;
|
|
875
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
.sendButton {
|
|
879
|
+
width: 70%;
|
|
880
|
+
--local-width: 100% !important;
|
|
881
|
+
--local-border-radius: var(--wui-border-radius-xs) !important;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.cancelButton {
|
|
885
|
+
width: 30%;
|
|
886
|
+
--local-width: 100% !important;
|
|
887
|
+
--local-border-radius: var(--wui-border-radius-xs) !important;
|
|
888
|
+
}
|
|
889
|
+
`;
|
|
890
|
+
var v = function(o, e, i, n) {
|
|
891
|
+
var r = arguments.length, t = r < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, i) : n, s;
|
|
892
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(o, e, i, n);
|
|
893
|
+
else for (var a = o.length - 1; a >= 0; a--) (s = o[a]) && (t = (r < 3 ? s(t) : r > 3 ? s(e, i, t) : s(e, i)) || t);
|
|
894
|
+
return r > 3 && t && Object.defineProperty(e, i, t), t;
|
|
895
|
+
};
|
|
896
|
+
let h = class extends m {
|
|
897
|
+
constructor() {
|
|
898
|
+
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 = x.state.activeCaipNetwork, this.loading = l.state.loading, this.unsubscribe.push(l.subscribe((e) => {
|
|
899
|
+
this.token = e.token, this.sendTokenAmount = e.sendTokenAmount, this.receiverAddress = e.receiverAddress, this.receiverProfileName = e.receiverProfileName, this.receiverProfileImageUrl = e.receiverProfileImageUrl, this.loading = e.loading;
|
|
900
|
+
}), x.subscribeKey("activeCaipNetwork", (e) => this.caipNetwork = e));
|
|
901
|
+
}
|
|
902
|
+
disconnectedCallback() {
|
|
903
|
+
this.unsubscribe.forEach((e) => e());
|
|
904
|
+
}
|
|
905
|
+
render() {
|
|
906
|
+
var e, i;
|
|
907
|
+
return u` <wui-flex flexDirection="column" .padding=${["0", "l", "l", "l"]}>
|
|
908
|
+
<wui-flex gap="xs" flexDirection="column" .padding=${["0", "xs", "0", "xs"]}>
|
|
909
|
+
<wui-flex alignItems="center" justifyContent="space-between">
|
|
910
|
+
<wui-flex flexDirection="column" gap="4xs">
|
|
911
|
+
<wui-text variant="small-400" color="fg-150">Send</wui-text>
|
|
912
|
+
${this.sendValueTemplate()}
|
|
913
|
+
</wui-flex>
|
|
914
|
+
<wui-preview-item
|
|
915
|
+
text="${this.sendTokenAmount ? $.roundNumber(this.sendTokenAmount, 6, 5) : "unknown"} ${(e = this.token) == null ? void 0 : e.symbol}"
|
|
916
|
+
.imageSrc=${(i = this.token) == null ? void 0 : i.iconUrl}
|
|
917
|
+
></wui-preview-item>
|
|
918
|
+
</wui-flex>
|
|
919
|
+
<wui-flex>
|
|
920
|
+
<wui-icon color="fg-200" size="md" name="arrowBottom"></wui-icon>
|
|
921
|
+
</wui-flex>
|
|
922
|
+
<wui-flex alignItems="center" justifyContent="space-between">
|
|
923
|
+
<wui-text variant="small-400" color="fg-150">To</wui-text>
|
|
924
|
+
<wui-preview-item
|
|
925
|
+
text="${this.receiverProfileName ? $.getTruncateString({
|
|
926
|
+
string: this.receiverProfileName,
|
|
927
|
+
charsStart: 20,
|
|
928
|
+
charsEnd: 0,
|
|
929
|
+
truncate: "end"
|
|
930
|
+
}) : $.getTruncateString({
|
|
931
|
+
string: this.receiverAddress ? this.receiverAddress : "",
|
|
932
|
+
charsStart: 4,
|
|
933
|
+
charsEnd: 4,
|
|
934
|
+
truncate: "middle"
|
|
935
|
+
})}"
|
|
936
|
+
address=${this.receiverAddress ?? ""}
|
|
937
|
+
.imageSrc=${this.receiverProfileImageUrl ?? void 0}
|
|
938
|
+
.isAddress=${!0}
|
|
939
|
+
></wui-preview-item>
|
|
940
|
+
</wui-flex>
|
|
941
|
+
</wui-flex>
|
|
942
|
+
<wui-flex flexDirection="column" .padding=${["xxl", "0", "0", "0"]}>
|
|
943
|
+
<w3m-wallet-send-details
|
|
944
|
+
.caipNetwork=${this.caipNetwork}
|
|
945
|
+
.receiverAddress=${this.receiverAddress}
|
|
946
|
+
></w3m-wallet-send-details>
|
|
947
|
+
<wui-flex justifyContent="center" gap="xxs" .padding=${["s", "0", "0", "0"]}>
|
|
948
|
+
<wui-icon size="sm" color="fg-200" name="warningCircle"></wui-icon>
|
|
949
|
+
<wui-text variant="small-400" color="fg-200">Review transaction carefully</wui-text>
|
|
950
|
+
</wui-flex>
|
|
951
|
+
<wui-flex justifyContent="center" gap="s" .padding=${["l", "0", "0", "0"]}>
|
|
952
|
+
<wui-button
|
|
953
|
+
class="cancelButton"
|
|
954
|
+
@click=${this.onCancelClick.bind(this)}
|
|
955
|
+
size="lg"
|
|
956
|
+
variant="neutral"
|
|
957
|
+
>
|
|
958
|
+
Cancel
|
|
959
|
+
</wui-button>
|
|
960
|
+
<wui-button
|
|
961
|
+
class="sendButton"
|
|
962
|
+
@click=${this.onSendClick.bind(this)}
|
|
963
|
+
size="lg"
|
|
964
|
+
variant="main"
|
|
965
|
+
.loading=${this.loading}
|
|
966
|
+
>
|
|
967
|
+
Send
|
|
968
|
+
</wui-button>
|
|
969
|
+
</wui-flex>
|
|
970
|
+
</wui-flex></wui-flex
|
|
971
|
+
>`;
|
|
972
|
+
}
|
|
973
|
+
sendValueTemplate() {
|
|
974
|
+
if (this.token && this.sendTokenAmount) {
|
|
975
|
+
const i = this.token.price * this.sendTokenAmount;
|
|
976
|
+
return u`<wui-text variant="paragraph-400" color="fg-100"
|
|
977
|
+
>$${i.toFixed(2)}</wui-text
|
|
978
|
+
>`;
|
|
979
|
+
}
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
982
|
+
async onSendClick() {
|
|
983
|
+
var e, i;
|
|
984
|
+
if (!this.sendTokenAmount || !this.receiverAddress) {
|
|
985
|
+
_.showError("Please enter a valid amount and receiver address");
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
try {
|
|
989
|
+
await l.sendToken(), _.showSuccess("Transaction started"), g.replace("Account");
|
|
990
|
+
} catch (n) {
|
|
991
|
+
_.showError("Failed to send transaction. Please try again."), console.error("SendController:sendToken - failed to send transaction", n);
|
|
992
|
+
const r = n instanceof Error ? n.message : "Unknown error";
|
|
993
|
+
G.sendEvent({
|
|
994
|
+
type: "track",
|
|
995
|
+
event: "SEND_ERROR",
|
|
996
|
+
properties: {
|
|
997
|
+
message: r,
|
|
998
|
+
isSmartAccount: J(x.state.activeChain) === Q.ACCOUNT_TYPES.SMART_ACCOUNT,
|
|
999
|
+
token: ((e = this.token) == null ? void 0 : e.symbol) || "",
|
|
1000
|
+
amount: this.sendTokenAmount,
|
|
1001
|
+
network: ((i = x.state.activeCaipNetwork) == null ? void 0 : i.caipNetworkId) || ""
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
onCancelClick() {
|
|
1007
|
+
g.goBack();
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
h.styles = se;
|
|
1011
|
+
v([
|
|
1012
|
+
c()
|
|
1013
|
+
], h.prototype, "token", void 0);
|
|
1014
|
+
v([
|
|
1015
|
+
c()
|
|
1016
|
+
], h.prototype, "sendTokenAmount", void 0);
|
|
1017
|
+
v([
|
|
1018
|
+
c()
|
|
1019
|
+
], h.prototype, "receiverAddress", void 0);
|
|
1020
|
+
v([
|
|
1021
|
+
c()
|
|
1022
|
+
], h.prototype, "receiverProfileName", void 0);
|
|
1023
|
+
v([
|
|
1024
|
+
c()
|
|
1025
|
+
], h.prototype, "receiverProfileImageUrl", void 0);
|
|
1026
|
+
v([
|
|
1027
|
+
c()
|
|
1028
|
+
], h.prototype, "caipNetwork", void 0);
|
|
1029
|
+
v([
|
|
1030
|
+
c()
|
|
1031
|
+
], h.prototype, "loading", void 0);
|
|
1032
|
+
h = v([
|
|
1033
|
+
w("w3m-wallet-send-preview-view")
|
|
1034
|
+
], h);
|
|
1035
|
+
export {
|
|
1036
|
+
b as W3mSendSelectTokenView,
|
|
1037
|
+
h as W3mWalletSendPreviewView,
|
|
1038
|
+
p as W3mWalletSendView
|
|
1039
|
+
};
|