@deloraprotocol/widget 1.0.0 → 1.0.1
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 +23 -20
- package/dist/index.d.ts +4 -2
- package/dist/index.js +471 -451
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ut = Object.defineProperty;
|
|
2
2
|
var He = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var b = (t, e, n) => (
|
|
8
|
-
import { jsxs as
|
|
9
|
-
import { useState as U, useEffect as oe, useCallback as D, useRef as se, useLayoutEffect as
|
|
10
|
-
const
|
|
5
|
+
var ft = (t, e, n) => e in t ? ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
6
|
+
var Ce = (t, e, n) => ft(t, typeof e != "symbol" ? e + "" : e, n), Ie = (t, e, n) => e.has(t) || He("Cannot " + n);
|
|
7
|
+
var b = (t, e, n) => (Ie(t, e, "read from private field"), n ? n.call(t) : e.get(t)), ge = (t, e, n) => e.has(t) ? He("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), ye = (t, e, n, r) => (Ie(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), E = (t, e, n) => (Ie(t, e, "access private method"), n);
|
|
8
|
+
import { jsxs as A, jsx as d, Fragment as ht } from "react/jsx-runtime";
|
|
9
|
+
import { useState as U, useEffect as oe, useCallback as D, useRef as se, useLayoutEffect as pt, useMemo as ie } from "react";
|
|
10
|
+
const mt = {
|
|
11
11
|
bg: "#ffffff",
|
|
12
12
|
fg: "#111216",
|
|
13
13
|
accent: "#7ca7f5",
|
|
@@ -27,7 +27,7 @@ const pt = {
|
|
|
27
27
|
fontSize: "13px",
|
|
28
28
|
lineHeight: "1.2",
|
|
29
29
|
letterSpacing: "-0.05em"
|
|
30
|
-
},
|
|
30
|
+
}, gt = {
|
|
31
31
|
bg: "#090909",
|
|
32
32
|
fg: "#ffffff",
|
|
33
33
|
accent: "#7ca7f5",
|
|
@@ -47,14 +47,14 @@ const pt = {
|
|
|
47
47
|
fontSize: "13px",
|
|
48
48
|
lineHeight: "1.2",
|
|
49
49
|
letterSpacing: "-0.05em"
|
|
50
|
-
},
|
|
51
|
-
light:
|
|
52
|
-
dark:
|
|
50
|
+
}, bt = {
|
|
51
|
+
light: mt,
|
|
52
|
+
dark: gt
|
|
53
53
|
};
|
|
54
54
|
function et(t, e) {
|
|
55
|
-
return { ...
|
|
55
|
+
return { ...bt[t], ...e };
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const xt = {
|
|
58
58
|
bg: "--dw-bg",
|
|
59
59
|
fg: "--dw-fg",
|
|
60
60
|
accent: "--dw-accent",
|
|
@@ -78,12 +78,12 @@ const bt = {
|
|
|
78
78
|
function tt(t) {
|
|
79
79
|
const e = {};
|
|
80
80
|
for (const [n, r] of Object.entries(t)) {
|
|
81
|
-
const s =
|
|
81
|
+
const s = xt[n];
|
|
82
82
|
s && r != null && (e[s] = r);
|
|
83
83
|
}
|
|
84
84
|
return e;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function mn(t) {
|
|
87
87
|
const {
|
|
88
88
|
theme: e = "light",
|
|
89
89
|
vars: n,
|
|
@@ -94,7 +94,7 @@ function hn(t) {
|
|
|
94
94
|
...tt(i),
|
|
95
95
|
...s
|
|
96
96
|
};
|
|
97
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ A(
|
|
98
98
|
"div",
|
|
99
99
|
{
|
|
100
100
|
"data-delora-widget-root": !0,
|
|
@@ -116,124 +116,145 @@ function hn(t) {
|
|
|
116
116
|
}
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
const ke = "https://api.delora.build", nt = "0x1111111111111111111111111111111111111111", rt = "11111111111111111111111111111111", ot = "1111111111111111111111111111111111111111111111111111111111111111";
|
|
120
|
+
function st(t) {
|
|
121
|
+
return (t || ke).replace(/\/$/, "");
|
|
122
|
+
}
|
|
123
|
+
function At(t, e, n) {
|
|
124
|
+
if (!t) return;
|
|
125
|
+
const r = t.replace(/\/+$/, "");
|
|
126
|
+
return r.includes("/token/") || r.includes("/coin/") ? `${r}/` : e === "MVM" || n === "sui" ? `${r}/coin/` : `${r}/token/`;
|
|
127
|
+
}
|
|
128
|
+
function vt(t) {
|
|
129
|
+
var e, n, r;
|
|
130
|
+
return {
|
|
131
|
+
id: t.id,
|
|
132
|
+
name: t.name,
|
|
133
|
+
rpcUrls: t.rpcUrls ?? [],
|
|
134
|
+
logoURI: t.logoURI,
|
|
135
|
+
idHex: t.idHex,
|
|
136
|
+
chainType: t.chainType,
|
|
137
|
+
explorerUrl: At(
|
|
138
|
+
t.blockExplorerUrls,
|
|
139
|
+
t.chainType,
|
|
140
|
+
t.key
|
|
141
|
+
),
|
|
142
|
+
key: t.key,
|
|
143
|
+
nativeCurrency: {
|
|
144
|
+
name: ((e = t.nativeToken) == null ? void 0 : e.name) ?? t.name,
|
|
145
|
+
symbol: ((n = t.nativeToken) == null ? void 0 : n.symbol) ?? "",
|
|
146
|
+
decimals: ((r = t.nativeToken) == null ? void 0 : r.decimals) ?? 18
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function yt(t) {
|
|
120
151
|
return {
|
|
121
152
|
symbol: t.symbol,
|
|
122
153
|
name: t.name,
|
|
123
154
|
contractAddress: t.address,
|
|
124
155
|
chainId: t.chainId,
|
|
125
|
-
imageUrl: t.logoURI,
|
|
156
|
+
imageUrl: t.logoURI ?? "",
|
|
126
157
|
decimals: t.decimals,
|
|
127
158
|
priceUSD: t.priceUSD
|
|
128
159
|
};
|
|
129
160
|
}
|
|
130
|
-
async function
|
|
131
|
-
const e = t
|
|
161
|
+
async function kt(t) {
|
|
162
|
+
const e = st(t), n = await fetch(`${e}/v1/chains`);
|
|
132
163
|
if (!n.ok) throw new Error(`Failed to fetch networks: ${n.status}`);
|
|
133
|
-
return n.json();
|
|
164
|
+
return ((await n.json()).chains ?? []).map(vt);
|
|
134
165
|
}
|
|
135
|
-
async function
|
|
136
|
-
const e = t
|
|
166
|
+
async function Nt(t) {
|
|
167
|
+
const e = st(t), n = await fetch(`${e}/v1/tokens`);
|
|
137
168
|
if (!n.ok) throw new Error(`Failed to fetch tokens: ${n.status}`);
|
|
138
|
-
return n.json();
|
|
139
|
-
}
|
|
140
|
-
async function kt(t) {
|
|
141
|
-
const e = t || (typeof window < "u" ? window.location.origin : ""), n = await fetch(`${e}/data/tokens_search.json`);
|
|
142
|
-
if (!n.ok) throw new Error(`Failed to fetch tokens_search: ${n.status}`);
|
|
143
|
-
return n.json();
|
|
169
|
+
return { byChainId: await n.json() };
|
|
144
170
|
}
|
|
145
171
|
function ae(t, e) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return (r.length ? r : s.length ? s : a.length ? a : []).map(xt);
|
|
172
|
+
const n = String(e);
|
|
173
|
+
return (t.byChainId[n] ?? []).map(yt);
|
|
149
174
|
}
|
|
150
|
-
function
|
|
175
|
+
function St(t, e) {
|
|
151
176
|
return ae(t, e);
|
|
152
177
|
}
|
|
153
|
-
function
|
|
178
|
+
function Ct(t) {
|
|
154
179
|
const e = "0x0000000000000000000000000000000000000000", n = "11111111111111111111111111111111", r = "1111111111111111111111111111111111111111111111111111111111111111";
|
|
155
180
|
return t.find(
|
|
156
181
|
(s) => s.contractAddress === e || s.contractAddress === n || s.contractAddress === r
|
|
157
182
|
) ?? t[0];
|
|
158
183
|
}
|
|
159
|
-
function
|
|
160
|
-
const [e, n] = U([]), [r, s] = U(null), [a, i] = U(null), [w, h] = U(!0), [p,
|
|
184
|
+
function It(t) {
|
|
185
|
+
const [e, n] = U([]), [r, s] = U(null), [a, i] = U(null), [w, h] = U(!0), [p, k] = U(null), [x, m] = U(), [u, v] = U(), [o, M] = U(), [R, O] = U();
|
|
161
186
|
oe(() => {
|
|
162
187
|
let c = !1;
|
|
163
|
-
return h(!0),
|
|
164
|
-
|
|
165
|
-
vt(t.dataBaseUrl),
|
|
166
|
-
kt(t.dataBaseUrl)
|
|
167
|
-
]).then(([f, C, A]) => {
|
|
168
|
-
c || (n(f), s(C), i(A), f.length >= 2 ? (m(f[0]), k(f[1])) : f.length === 1 && (m(f[0]), k(f[0])));
|
|
188
|
+
return h(!0), k(null), Promise.all([kt(t.apiBase), Nt(t.apiBase)]).then(([f, S]) => {
|
|
189
|
+
c || (n(f), s(S), i(S), f.length >= 2 ? (m(f[0]), v(f[1])) : f.length === 1 && (m(f[0]), v(f[0])));
|
|
169
190
|
}).catch((f) => {
|
|
170
|
-
c ||
|
|
191
|
+
c || k((f == null ? void 0 : f.message) ?? "Failed to load data");
|
|
171
192
|
}).finally(() => {
|
|
172
193
|
c || h(!1);
|
|
173
194
|
}), () => {
|
|
174
195
|
c = !0;
|
|
175
196
|
};
|
|
176
|
-
}, [t.
|
|
197
|
+
}, [t.apiBase]), oe(() => {
|
|
177
198
|
if (!x || !r) return;
|
|
178
199
|
const c = ae(r, x.id);
|
|
179
|
-
(c.length && !o || o && !c.some((f) => f.contractAddress === o.contractAddress && f.chainId === o.chainId)) &&
|
|
200
|
+
(c.length && !o || o && !c.some((f) => f.contractAddress === o.contractAddress && f.chainId === o.chainId)) && M(c[0]);
|
|
180
201
|
}, [x, r, o]), oe(() => {
|
|
181
202
|
if (!u || !r) return;
|
|
182
203
|
const c = ae(r, u.id);
|
|
183
|
-
if (c.length && !
|
|
184
|
-
const f = o ? c.find((
|
|
185
|
-
|
|
186
|
-
} else if (
|
|
187
|
-
const f = o ? c.find((
|
|
188
|
-
|
|
204
|
+
if (c.length && !R) {
|
|
205
|
+
const f = o ? c.find((S) => !(S.contractAddress === o.contractAddress && S.chainId === o.chainId)) : void 0;
|
|
206
|
+
O(f ?? c[0]);
|
|
207
|
+
} else if (R && !c.some((f) => f.contractAddress === R.contractAddress && f.chainId === R.chainId)) {
|
|
208
|
+
const f = o ? c.find((S) => !(S.contractAddress === o.contractAddress && S.chainId === o.chainId)) : void 0;
|
|
209
|
+
O(f ?? c[0]);
|
|
189
210
|
}
|
|
190
|
-
}, [u, r,
|
|
211
|
+
}, [u, r, R, o]);
|
|
191
212
|
const L = D(
|
|
192
213
|
(c) => r ? ae(r, c) : [],
|
|
193
214
|
[r]
|
|
194
|
-
),
|
|
195
|
-
(c) => a ?
|
|
215
|
+
), V = D(
|
|
216
|
+
(c) => a ? St(a, c) : ae(r ?? { byChainId: {} }, c),
|
|
196
217
|
[a, r]
|
|
197
|
-
),
|
|
218
|
+
), $ = D(
|
|
198
219
|
(c) => {
|
|
199
|
-
const f = ae(r ?? {
|
|
200
|
-
return
|
|
220
|
+
const f = ae(r ?? { byChainId: {} }, c);
|
|
221
|
+
return Ct(f);
|
|
201
222
|
},
|
|
202
223
|
[r]
|
|
203
224
|
), l = D(
|
|
204
225
|
(c) => e.find((f) => f.id === c),
|
|
205
226
|
[e]
|
|
206
|
-
),
|
|
207
|
-
const f = e.find((
|
|
227
|
+
), C = D((c) => {
|
|
228
|
+
const f = e.find((S) => S.id === c);
|
|
208
229
|
f && m(f);
|
|
209
230
|
}, [e]), g = D((c) => {
|
|
210
|
-
const f = e.find((
|
|
211
|
-
f &&
|
|
231
|
+
const f = e.find((S) => S.id === c);
|
|
232
|
+
f && v(f);
|
|
212
233
|
}, [e]), y = D((c) => {
|
|
213
|
-
|
|
234
|
+
v(c);
|
|
214
235
|
}, []);
|
|
215
236
|
return {
|
|
216
237
|
networks: e,
|
|
217
238
|
networkSell: x,
|
|
218
239
|
networkBuy: u,
|
|
219
240
|
sellToken: o,
|
|
220
|
-
buyToken:
|
|
221
|
-
setSellToken:
|
|
222
|
-
setBuyToken:
|
|
241
|
+
buyToken: R,
|
|
242
|
+
setSellToken: M,
|
|
243
|
+
setBuyToken: O,
|
|
223
244
|
setNetworkSell: (c) => m(c),
|
|
224
245
|
setNetworkBuy: y,
|
|
225
|
-
updateNetworkSell:
|
|
246
|
+
updateNetworkSell: C,
|
|
226
247
|
updateNetworkBuy: g,
|
|
227
248
|
getTokensForNetworkId: L,
|
|
228
|
-
getAllTokensForNetworkId:
|
|
229
|
-
getNativeToken:
|
|
249
|
+
getAllTokensForNetworkId: V,
|
|
250
|
+
getNativeToken: $,
|
|
230
251
|
getNetworkById: l,
|
|
231
252
|
loading: w,
|
|
232
253
|
error: p
|
|
233
254
|
};
|
|
234
255
|
}
|
|
235
|
-
const
|
|
236
|
-
function
|
|
256
|
+
const Bt = "6.16.0";
|
|
257
|
+
function Ee(t, e, n) {
|
|
237
258
|
for (let r in e) {
|
|
238
259
|
let s = e[r];
|
|
239
260
|
Object.defineProperty(t, r, { enumerable: !0, value: s, writable: !1 });
|
|
@@ -274,7 +295,7 @@ function le(t, e) {
|
|
|
274
295
|
}
|
|
275
296
|
return "[ COULD NOT SERIALIZE ]";
|
|
276
297
|
}
|
|
277
|
-
function
|
|
298
|
+
function Tt(t, e, n) {
|
|
278
299
|
let r = t;
|
|
279
300
|
{
|
|
280
301
|
const a = [];
|
|
@@ -288,7 +309,7 @@ function It(t, e, n) {
|
|
|
288
309
|
a.push(i + "=" + le(w));
|
|
289
310
|
}
|
|
290
311
|
}
|
|
291
|
-
a.push(`code=${e}`), a.push(`version=${
|
|
312
|
+
a.push(`code=${e}`), a.push(`version=${Bt}`), a.length && (t += " (" + a.join(", ") + ")");
|
|
292
313
|
}
|
|
293
314
|
let s;
|
|
294
315
|
switch (e) {
|
|
@@ -302,14 +323,14 @@ function It(t, e, n) {
|
|
|
302
323
|
default:
|
|
303
324
|
s = new Error(t);
|
|
304
325
|
}
|
|
305
|
-
return
|
|
326
|
+
return Ee(s, { code: e }), n && Object.assign(s, n), s.shortMessage == null && Ee(s, { shortMessage: r }), s;
|
|
306
327
|
}
|
|
307
|
-
function
|
|
328
|
+
function z(t, e, n, r) {
|
|
308
329
|
if (!t)
|
|
309
|
-
throw
|
|
330
|
+
throw Tt(e, n, r);
|
|
310
331
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
332
|
+
function j(t, e, n, r) {
|
|
333
|
+
z(t, e, "INVALID_ARGUMENT", { argument: n, value: r });
|
|
313
334
|
}
|
|
314
335
|
["NFD", "NFC", "NFKD", "NFKC"].reduce((t, e) => {
|
|
315
336
|
try {
|
|
@@ -322,15 +343,15 @@ function P(t, e, n, r) {
|
|
|
322
343
|
}
|
|
323
344
|
return t;
|
|
324
345
|
}, []);
|
|
325
|
-
function
|
|
346
|
+
function Ut(t, e, n) {
|
|
326
347
|
if (t !== e) {
|
|
327
348
|
let r = n, s = "new";
|
|
328
|
-
r += ".", s += " " + n,
|
|
349
|
+
r += ".", s += " " + n, z(!1, `private constructor; use ${r}from* methods`, "UNSUPPORTED_OPERATION", {
|
|
329
350
|
operation: s
|
|
330
351
|
});
|
|
331
352
|
}
|
|
332
353
|
}
|
|
333
|
-
function
|
|
354
|
+
function Ft(t, e, n) {
|
|
334
355
|
if (t instanceof Uint8Array)
|
|
335
356
|
return t;
|
|
336
357
|
if (typeof t == "string" && t.length % 2 === 0 && t.match(/^0x[0-9a-f]*$/i)) {
|
|
@@ -340,15 +361,15 @@ function Tt(t, e, n) {
|
|
|
340
361
|
r[a] = parseInt(t.substring(s, s + 2), 16), s += 2;
|
|
341
362
|
return r;
|
|
342
363
|
}
|
|
343
|
-
|
|
364
|
+
j(!1, "invalid BytesLike value", e, t);
|
|
344
365
|
}
|
|
345
|
-
function
|
|
346
|
-
return
|
|
366
|
+
function Rt(t, e) {
|
|
367
|
+
return Ft(t, e);
|
|
347
368
|
}
|
|
348
|
-
const
|
|
349
|
-
function
|
|
350
|
-
const n =
|
|
351
|
-
if (
|
|
369
|
+
const dt = BigInt(0), ce = BigInt(1), we = 9007199254740991;
|
|
370
|
+
function Le(t, e) {
|
|
371
|
+
const n = at(t, "value"), r = BigInt(Ae(e, "width"));
|
|
372
|
+
if (z(n >> r === dt, "overflow", "NUMERIC_FAULT", {
|
|
352
373
|
operation: "fromTwos",
|
|
353
374
|
fault: "overflow",
|
|
354
375
|
value: t
|
|
@@ -358,63 +379,63 @@ function Ee(t, e) {
|
|
|
358
379
|
}
|
|
359
380
|
return n;
|
|
360
381
|
}
|
|
361
|
-
function
|
|
362
|
-
const n =
|
|
382
|
+
function ze(t, e) {
|
|
383
|
+
const n = at(t, "value"), r = BigInt(Ae(e, "bits"));
|
|
363
384
|
return n & (ce << r) - ce;
|
|
364
385
|
}
|
|
365
|
-
function
|
|
386
|
+
function Ve(t, e) {
|
|
366
387
|
switch (typeof t) {
|
|
367
388
|
case "bigint":
|
|
368
389
|
return t;
|
|
369
390
|
case "number":
|
|
370
|
-
return
|
|
391
|
+
return j(Number.isInteger(t), "underflow", e || "value", t), j(t >= -we && t <= we, "overflow", e || "value", t), BigInt(t);
|
|
371
392
|
case "string":
|
|
372
393
|
try {
|
|
373
394
|
if (t === "")
|
|
374
395
|
throw new Error("empty string");
|
|
375
396
|
return t[0] === "-" && t[1] !== "-" ? -BigInt(t.substring(1)) : BigInt(t);
|
|
376
397
|
} catch (n) {
|
|
377
|
-
|
|
398
|
+
j(!1, `invalid BigNumberish string: ${n.message}`, e || "value", t);
|
|
378
399
|
}
|
|
379
400
|
}
|
|
380
|
-
|
|
401
|
+
j(!1, "invalid BigNumberish value", e || "value", t);
|
|
381
402
|
}
|
|
382
|
-
function
|
|
383
|
-
const n =
|
|
384
|
-
return
|
|
403
|
+
function at(t, e) {
|
|
404
|
+
const n = Ve(t, e);
|
|
405
|
+
return z(n >= dt, "unsigned value cannot be negative", "NUMERIC_FAULT", {
|
|
385
406
|
fault: "overflow",
|
|
386
407
|
operation: "getUint",
|
|
387
408
|
value: t
|
|
388
409
|
}), n;
|
|
389
410
|
}
|
|
390
|
-
const
|
|
391
|
-
function
|
|
411
|
+
const Ye = "0123456789abcdef";
|
|
412
|
+
function Mt(t) {
|
|
392
413
|
if (t instanceof Uint8Array) {
|
|
393
414
|
let e = "0x0";
|
|
394
415
|
for (const n of t)
|
|
395
|
-
e +=
|
|
416
|
+
e += Ye[n >> 4], e += Ye[n & 15];
|
|
396
417
|
return BigInt(e);
|
|
397
418
|
}
|
|
398
|
-
return
|
|
419
|
+
return Ve(t);
|
|
399
420
|
}
|
|
400
421
|
function Ae(t, e) {
|
|
401
422
|
switch (typeof t) {
|
|
402
423
|
case "bigint":
|
|
403
|
-
return
|
|
424
|
+
return j(t >= -we && t <= we, "overflow", e || "value", t), Number(t);
|
|
404
425
|
case "number":
|
|
405
|
-
return
|
|
426
|
+
return j(Number.isInteger(t), "underflow", e || "value", t), j(t >= -we && t <= we, "overflow", e || "value", t), t;
|
|
406
427
|
case "string":
|
|
407
428
|
try {
|
|
408
429
|
if (t === "")
|
|
409
430
|
throw new Error("empty string");
|
|
410
431
|
return Ae(BigInt(t), e);
|
|
411
432
|
} catch (n) {
|
|
412
|
-
|
|
433
|
+
j(!1, `invalid numeric string: ${n.message}`, e || "value", t);
|
|
413
434
|
}
|
|
414
435
|
}
|
|
415
|
-
|
|
436
|
+
j(!1, "invalid numeric value", e || "value", t);
|
|
416
437
|
}
|
|
417
|
-
const
|
|
438
|
+
const Et = BigInt(-1), K = BigInt(0), ue = BigInt(1), Lt = BigInt(5), de = {};
|
|
418
439
|
let fe = "0000";
|
|
419
440
|
for (; fe.length < 80; )
|
|
420
441
|
fe += fe;
|
|
@@ -428,14 +449,14 @@ function be(t, e, n) {
|
|
|
428
449
|
const r = BigInt(e.width);
|
|
429
450
|
if (e.signed) {
|
|
430
451
|
const s = ue << r - ue;
|
|
431
|
-
|
|
452
|
+
z(n == null || t >= -s && t < s, "overflow", "NUMERIC_FAULT", {
|
|
432
453
|
operation: n,
|
|
433
454
|
fault: "overflow",
|
|
434
455
|
value: t
|
|
435
|
-
}), t >
|
|
456
|
+
}), t > K ? t = Le(ze(t, r), r) : t = -Le(ze(-t, r), r);
|
|
436
457
|
} else {
|
|
437
458
|
const s = ue << r;
|
|
438
|
-
|
|
459
|
+
z(n == null || t >= 0 && t < s, "overflow", "NUMERIC_FAULT", {
|
|
439
460
|
operation: n,
|
|
440
461
|
fault: "overflow",
|
|
441
462
|
value: t
|
|
@@ -443,7 +464,7 @@ function be(t, e, n) {
|
|
|
443
464
|
}
|
|
444
465
|
return t;
|
|
445
466
|
}
|
|
446
|
-
function
|
|
467
|
+
function Be(t) {
|
|
447
468
|
typeof t == "number" && (t = `fixed128x${t}`);
|
|
448
469
|
let e = !0, n = 128, r = 18;
|
|
449
470
|
if (typeof t == "string") {
|
|
@@ -451,19 +472,19 @@ function Ie(t) {
|
|
|
451
472
|
e = !1;
|
|
452
473
|
else {
|
|
453
474
|
const a = t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
|
454
|
-
|
|
475
|
+
j(a, "invalid fixed format", "format", t), e = a[1] !== "u", n = parseInt(a[2]), r = parseInt(a[3]);
|
|
455
476
|
}
|
|
456
477
|
} else if (t) {
|
|
457
|
-
const a = t, i = (w, h, p) => a[w] == null ? p : (
|
|
478
|
+
const a = t, i = (w, h, p) => a[w] == null ? p : (j(typeof a[w] === h, "invalid fixed format (" + w + " not " + h + ")", "format." + w, a[w]), a[w]);
|
|
458
479
|
e = i("signed", "boolean", e), n = i("width", "number", n), r = i("decimals", "number", r);
|
|
459
480
|
}
|
|
460
|
-
|
|
481
|
+
j(n % 8 === 0, "invalid FixedNumber width (not byte aligned)", "format.width", n), j(r <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", r);
|
|
461
482
|
const s = (e ? "" : "u") + "fixed" + String(n) + "x" + String(r);
|
|
462
483
|
return { signed: e, width: n, decimals: r, name: s };
|
|
463
484
|
}
|
|
464
|
-
function
|
|
485
|
+
function Dt(t, e) {
|
|
465
486
|
let n = "";
|
|
466
|
-
t <
|
|
487
|
+
t < K && (n = "-", t *= Et);
|
|
467
488
|
let r = t.toString();
|
|
468
489
|
if (e === 0)
|
|
469
490
|
return n + r;
|
|
@@ -476,7 +497,7 @@ function Et(t, e) {
|
|
|
476
497
|
r = r.substring(0, r.length - 1);
|
|
477
498
|
return n + r;
|
|
478
499
|
}
|
|
479
|
-
var q, F, Q, B, ne, _,
|
|
500
|
+
var q, F, Q, B, ne, _, Oe, $e, Pe, je;
|
|
480
501
|
const Z = class Z {
|
|
481
502
|
// Use this when changing this file to get some typing info,
|
|
482
503
|
// but then switch to any to mask the internal type
|
|
@@ -489,7 +510,7 @@ const Z = class Z {
|
|
|
489
510
|
/**
|
|
490
511
|
* The specific fixed-point arithmetic field for this value.
|
|
491
512
|
*/
|
|
492
|
-
|
|
513
|
+
Ce(this, "format");
|
|
493
514
|
ge(this, q);
|
|
494
515
|
// The actual value (accounting for decimals)
|
|
495
516
|
ge(this, F);
|
|
@@ -500,10 +521,10 @@ const Z = class Z {
|
|
|
500
521
|
*
|
|
501
522
|
* @private
|
|
502
523
|
*/
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
const s =
|
|
506
|
-
|
|
524
|
+
Ce(this, "_value");
|
|
525
|
+
Ut(e, de, "FixedNumber"), ye(this, F, n), ye(this, q, r);
|
|
526
|
+
const s = Dt(n, r.decimals);
|
|
527
|
+
Ee(this, { format: r.name, _value: s }), ye(this, Q, te(r.decimals));
|
|
507
528
|
}
|
|
508
529
|
/**
|
|
509
530
|
* If true, negative values are permitted, otherwise only
|
|
@@ -536,7 +557,7 @@ const Z = class Z {
|
|
|
536
557
|
* to %%other%%, ignoring overflow.
|
|
537
558
|
*/
|
|
538
559
|
addUnsafe(e) {
|
|
539
|
-
return E(this, B,
|
|
560
|
+
return E(this, B, Oe).call(this, e);
|
|
540
561
|
}
|
|
541
562
|
/**
|
|
542
563
|
* Returns a new [[FixedNumber]] with the result of %%this%% added
|
|
@@ -544,14 +565,14 @@ const Z = class Z {
|
|
|
544
565
|
* occurs.
|
|
545
566
|
*/
|
|
546
567
|
add(e) {
|
|
547
|
-
return E(this, B,
|
|
568
|
+
return E(this, B, Oe).call(this, e, "add");
|
|
548
569
|
}
|
|
549
570
|
/**
|
|
550
571
|
* Returns a new [[FixedNumber]] with the result of %%other%% subtracted
|
|
551
572
|
* from %%this%%, ignoring overflow.
|
|
552
573
|
*/
|
|
553
574
|
subUnsafe(e) {
|
|
554
|
-
return E(this, B,
|
|
575
|
+
return E(this, B, $e).call(this, e);
|
|
555
576
|
}
|
|
556
577
|
/**
|
|
557
578
|
* Returns a new [[FixedNumber]] with the result of %%other%% subtracted
|
|
@@ -559,14 +580,14 @@ const Z = class Z {
|
|
|
559
580
|
* occurs.
|
|
560
581
|
*/
|
|
561
582
|
sub(e) {
|
|
562
|
-
return E(this, B,
|
|
583
|
+
return E(this, B, $e).call(this, e, "sub");
|
|
563
584
|
}
|
|
564
585
|
/**
|
|
565
586
|
* Returns a new [[FixedNumber]] with the result of %%this%% multiplied
|
|
566
587
|
* by %%other%%, ignoring overflow and underflow (precision loss).
|
|
567
588
|
*/
|
|
568
589
|
mulUnsafe(e) {
|
|
569
|
-
return E(this, B,
|
|
590
|
+
return E(this, B, Pe).call(this, e);
|
|
570
591
|
}
|
|
571
592
|
/**
|
|
572
593
|
* Returns a new [[FixedNumber]] with the result of %%this%% multiplied
|
|
@@ -574,7 +595,7 @@ const Z = class Z {
|
|
|
574
595
|
* occurs.
|
|
575
596
|
*/
|
|
576
597
|
mul(e) {
|
|
577
|
-
return E(this, B,
|
|
598
|
+
return E(this, B, Pe).call(this, e, "mul");
|
|
578
599
|
}
|
|
579
600
|
/**
|
|
580
601
|
* Returns a new [[FixedNumber]] with the result of %%this%% multiplied
|
|
@@ -584,7 +605,7 @@ const Z = class Z {
|
|
|
584
605
|
mulSignal(e) {
|
|
585
606
|
E(this, B, ne).call(this, e);
|
|
586
607
|
const n = b(this, F) * b(e, F);
|
|
587
|
-
return
|
|
608
|
+
return z(n % b(this, Q) === K, "precision lost during signalling mul", "NUMERIC_FAULT", {
|
|
588
609
|
operation: "mulSignal",
|
|
589
610
|
fault: "underflow",
|
|
590
611
|
value: this
|
|
@@ -596,7 +617,7 @@ const Z = class Z {
|
|
|
596
617
|
* [[NumericFaultError]] is thrown if overflow occurs.
|
|
597
618
|
*/
|
|
598
619
|
divUnsafe(e) {
|
|
599
|
-
return E(this, B,
|
|
620
|
+
return E(this, B, je).call(this, e);
|
|
600
621
|
}
|
|
601
622
|
/**
|
|
602
623
|
* Returns a new [[FixedNumber]] with the result of %%this%% divided
|
|
@@ -604,7 +625,7 @@ const Z = class Z {
|
|
|
604
625
|
* [[NumericFaultError]] is thrown if overflow occurs.
|
|
605
626
|
*/
|
|
606
627
|
div(e) {
|
|
607
|
-
return E(this, B,
|
|
628
|
+
return E(this, B, je).call(this, e, "div");
|
|
608
629
|
}
|
|
609
630
|
/**
|
|
610
631
|
* Returns a new [[FixedNumber]] with the result of %%this%% divided
|
|
@@ -612,13 +633,13 @@ const Z = class Z {
|
|
|
612
633
|
* (precision loss) occurs.
|
|
613
634
|
*/
|
|
614
635
|
divSignal(e) {
|
|
615
|
-
|
|
636
|
+
z(b(e, F) !== K, "division by zero", "NUMERIC_FAULT", {
|
|
616
637
|
operation: "div",
|
|
617
638
|
fault: "divide-by-zero",
|
|
618
639
|
value: this
|
|
619
640
|
}), E(this, B, ne).call(this, e);
|
|
620
641
|
const n = b(this, F) * b(this, Q);
|
|
621
|
-
return
|
|
642
|
+
return z(n % b(e, F) === K, "precision lost during signalling div", "NUMERIC_FAULT", {
|
|
622
643
|
operation: "divSignal",
|
|
623
644
|
fault: "underflow",
|
|
624
645
|
value: this
|
|
@@ -674,7 +695,7 @@ const Z = class Z {
|
|
|
674
695
|
*/
|
|
675
696
|
floor() {
|
|
676
697
|
let e = b(this, F);
|
|
677
|
-
return b(this, F) <
|
|
698
|
+
return b(this, F) < K && (e -= b(this, Q) - ue), e = b(this, F) / b(this, Q) * b(this, Q), E(this, B, _).call(this, e, "floor");
|
|
678
699
|
}
|
|
679
700
|
/**
|
|
680
701
|
* Returns a new [[FixedNumber]] which is the smallest **integer**
|
|
@@ -684,7 +705,7 @@ const Z = class Z {
|
|
|
684
705
|
*/
|
|
685
706
|
ceiling() {
|
|
686
707
|
let e = b(this, F);
|
|
687
|
-
return b(this, F) >
|
|
708
|
+
return b(this, F) > K && (e += b(this, Q) - ue), e = b(this, F) / b(this, Q) * b(this, Q), E(this, B, _).call(this, e, "ceiling");
|
|
688
709
|
}
|
|
689
710
|
/**
|
|
690
711
|
* Returns a new [[FixedNumber]] with the decimal component
|
|
@@ -693,7 +714,7 @@ const Z = class Z {
|
|
|
693
714
|
round(e) {
|
|
694
715
|
if (e == null && (e = 0), e >= this.decimals)
|
|
695
716
|
return this;
|
|
696
|
-
const n = this.decimals - e, r =
|
|
717
|
+
const n = this.decimals - e, r = Lt * te(n - 1);
|
|
697
718
|
let s = this.value + r;
|
|
698
719
|
const a = te(n);
|
|
699
720
|
return s = s / a * a, be(s, b(this, q), "round"), new Z(de, s, b(this, q));
|
|
@@ -702,13 +723,13 @@ const Z = class Z {
|
|
|
702
723
|
* Returns true if %%this%% is equal to ``0``.
|
|
703
724
|
*/
|
|
704
725
|
isZero() {
|
|
705
|
-
return b(this, F) ===
|
|
726
|
+
return b(this, F) === K;
|
|
706
727
|
}
|
|
707
728
|
/**
|
|
708
729
|
* Returns true if %%this%% is less than ``0``.
|
|
709
730
|
*/
|
|
710
731
|
isNegative() {
|
|
711
|
-
return b(this, F) <
|
|
732
|
+
return b(this, F) < K;
|
|
712
733
|
}
|
|
713
734
|
/**
|
|
714
735
|
* Returns the string representation of %%this%%.
|
|
@@ -744,12 +765,12 @@ const Z = class Z {
|
|
|
744
765
|
* or underflow (precision loss).
|
|
745
766
|
*/
|
|
746
767
|
static fromValue(e, n, r) {
|
|
747
|
-
const s = n == null ? 0 : Ae(n), a =
|
|
748
|
-
let i =
|
|
768
|
+
const s = n == null ? 0 : Ae(n), a = Be(r);
|
|
769
|
+
let i = Ve(e, "value");
|
|
749
770
|
const w = s - a.decimals;
|
|
750
771
|
if (w > 0) {
|
|
751
772
|
const h = te(w);
|
|
752
|
-
|
|
773
|
+
z(i % h === K, "value loses precision for format", "NUMERIC_FAULT", {
|
|
753
774
|
operation: "fromValue",
|
|
754
775
|
fault: "underflow",
|
|
755
776
|
value: e
|
|
@@ -765,12 +786,12 @@ const Z = class Z {
|
|
|
765
786
|
*/
|
|
766
787
|
static fromString(e, n) {
|
|
767
788
|
const r = e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);
|
|
768
|
-
|
|
769
|
-
const s =
|
|
789
|
+
j(r && r[2].length + r[3].length > 0, "invalid FixedNumber string value", "value", e);
|
|
790
|
+
const s = Be(n);
|
|
770
791
|
let a = r[2] || "0", i = r[3] || "";
|
|
771
792
|
for (; i.length < s.decimals; )
|
|
772
793
|
i += fe;
|
|
773
|
-
|
|
794
|
+
z(i.substring(s.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", {
|
|
774
795
|
operation: "fromString",
|
|
775
796
|
fault: "underflow",
|
|
776
797
|
value: e
|
|
@@ -786,30 +807,30 @@ const Z = class Z {
|
|
|
786
807
|
* in %%format%% due to overflow.
|
|
787
808
|
*/
|
|
788
809
|
static fromBytes(e, n) {
|
|
789
|
-
let r =
|
|
790
|
-
const s =
|
|
791
|
-
return s.signed && (r =
|
|
810
|
+
let r = Mt(Rt(e, "value"));
|
|
811
|
+
const s = Be(n);
|
|
812
|
+
return s.signed && (r = Le(r, s.width)), be(r, s, "fromBytes"), new Z(de, r, s);
|
|
792
813
|
}
|
|
793
814
|
};
|
|
794
815
|
q = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), B = new WeakSet(), ne = function(e) {
|
|
795
|
-
|
|
816
|
+
j(this.format === e.format, "incompatible format; use fixedNumber.toFormat", "other", e);
|
|
796
817
|
}, _ = function(e, n) {
|
|
797
818
|
return e = be(e, b(this, q), n), new Z(de, e, b(this, q));
|
|
798
|
-
},
|
|
819
|
+
}, Oe = function(e, n) {
|
|
799
820
|
return E(this, B, ne).call(this, e), E(this, B, _).call(this, b(this, F) + b(e, F), n);
|
|
800
|
-
},
|
|
821
|
+
}, $e = function(e, n) {
|
|
801
822
|
return E(this, B, ne).call(this, e), E(this, B, _).call(this, b(this, F) - b(e, F), n);
|
|
802
|
-
},
|
|
823
|
+
}, Pe = function(e, n) {
|
|
803
824
|
return E(this, B, ne).call(this, e), E(this, B, _).call(this, b(this, F) * b(e, F) / b(this, Q), n);
|
|
804
|
-
},
|
|
805
|
-
return
|
|
825
|
+
}, je = function(e, n) {
|
|
826
|
+
return z(b(e, F) !== K, "division by zero", "NUMERIC_FAULT", {
|
|
806
827
|
operation: "div",
|
|
807
828
|
fault: "divide-by-zero",
|
|
808
829
|
value: this
|
|
809
830
|
}), E(this, B, ne).call(this, e), E(this, B, _).call(this, b(this, F) * b(this, Q) / b(e, F), n);
|
|
810
831
|
};
|
|
811
|
-
let
|
|
812
|
-
const
|
|
832
|
+
let De = Z;
|
|
833
|
+
const Ot = [
|
|
813
834
|
"wei",
|
|
814
835
|
"kwei",
|
|
815
836
|
"mwei",
|
|
@@ -818,20 +839,20 @@ const Lt = [
|
|
|
818
839
|
"finney",
|
|
819
840
|
"ether"
|
|
820
841
|
];
|
|
821
|
-
function
|
|
822
|
-
|
|
842
|
+
function $t(t, e) {
|
|
843
|
+
j(typeof t == "string", "value must be a string", "value", t);
|
|
823
844
|
let n = 18;
|
|
824
845
|
if (typeof e == "string") {
|
|
825
|
-
const r =
|
|
826
|
-
|
|
846
|
+
const r = Ot.indexOf(e);
|
|
847
|
+
j(r >= 0, "invalid unit", "unit", e), n = 3 * r;
|
|
827
848
|
} else e != null && (n = Ae(e, "unit"));
|
|
828
|
-
return
|
|
849
|
+
return De.fromString(t, { decimals: n, width: 512 }).value;
|
|
829
850
|
}
|
|
830
|
-
const
|
|
831
|
-
function
|
|
851
|
+
const Pt = "0x0000000000000000000000000000000000000000";
|
|
852
|
+
function Te(t, e) {
|
|
832
853
|
return (Number(t) / Math.pow(10, e)).toString();
|
|
833
854
|
}
|
|
834
|
-
async function jt(t, e =
|
|
855
|
+
async function jt(t, e = ke) {
|
|
835
856
|
const n = new URLSearchParams({
|
|
836
857
|
senderAddress: t.senderAddress,
|
|
837
858
|
receiverAddress: t.receiverAddress ?? t.senderAddress,
|
|
@@ -849,41 +870,41 @@ async function jt(t, e = $e) {
|
|
|
849
870
|
}
|
|
850
871
|
return s.json();
|
|
851
872
|
}
|
|
852
|
-
function
|
|
873
|
+
function Vt(t, e) {
|
|
853
874
|
if (e < 0 || !t.includes(".")) return t;
|
|
854
875
|
const [n, r] = t.split(".");
|
|
855
876
|
if (!r || r.length <= e) return t;
|
|
856
877
|
const s = r.slice(0, e);
|
|
857
878
|
return s ? `${n}.${s}` : n || "0";
|
|
858
879
|
}
|
|
859
|
-
function
|
|
860
|
-
const [t, e] = U(null), [n, r] = U(""), [s, a] = U(""), [i, w] = U(0), [h, p] = U(null), [
|
|
861
|
-
var
|
|
862
|
-
(
|
|
880
|
+
function Wt() {
|
|
881
|
+
const [t, e] = U(null), [n, r] = U(""), [s, a] = U(""), [i, w] = U(0), [h, p] = U(null), [k, x] = U(), [m, u] = U(), [v, o] = U("swap"), M = se(null), R = se(0), O = D(() => {
|
|
882
|
+
var $;
|
|
883
|
+
($ = M.current) == null || $.abort(), M.current = null;
|
|
863
884
|
}, []), L = D(() => {
|
|
864
885
|
e(null), o("finding");
|
|
865
|
-
}, []),
|
|
866
|
-
(
|
|
867
|
-
|
|
868
|
-
const l = ++
|
|
869
|
-
|
|
886
|
+
}, []), V = D(
|
|
887
|
+
($) => {
|
|
888
|
+
O();
|
|
889
|
+
const l = ++R.current, C = new AbortController();
|
|
890
|
+
M.current = C;
|
|
870
891
|
const {
|
|
871
892
|
sellNetworkId: g,
|
|
872
893
|
buyNetworkId: y,
|
|
873
894
|
sellToken: c,
|
|
874
895
|
buyToken: f,
|
|
875
|
-
sellAmountStr:
|
|
876
|
-
slippage:
|
|
896
|
+
sellAmountStr: S,
|
|
897
|
+
slippage: N,
|
|
877
898
|
fromAddress: T,
|
|
878
|
-
toAddress:
|
|
879
|
-
apiBase: J =
|
|
880
|
-
} =
|
|
881
|
-
|
|
899
|
+
toAddress: P,
|
|
900
|
+
apiBase: J = ke
|
|
901
|
+
} = $, G = Vt(
|
|
902
|
+
S || "0",
|
|
882
903
|
c.decimals
|
|
883
904
|
);
|
|
884
905
|
let H;
|
|
885
906
|
try {
|
|
886
|
-
H =
|
|
907
|
+
H = $t(G, c.decimals);
|
|
887
908
|
} catch {
|
|
888
909
|
o("swap");
|
|
889
910
|
return;
|
|
@@ -893,7 +914,7 @@ function Pt() {
|
|
|
893
914
|
return;
|
|
894
915
|
}
|
|
895
916
|
o("finding"), e(null), x(void 0), u(void 0);
|
|
896
|
-
const ve =
|
|
917
|
+
const ve = P && P !== "" ? P : void 0;
|
|
897
918
|
jt(
|
|
898
919
|
{
|
|
899
920
|
originChainId: g,
|
|
@@ -903,54 +924,54 @@ function Pt() {
|
|
|
903
924
|
amount: H.toString(),
|
|
904
925
|
senderAddress: T,
|
|
905
926
|
receiverAddress: ve,
|
|
906
|
-
slippage:
|
|
927
|
+
slippage: N ?? 5e-3
|
|
907
928
|
},
|
|
908
929
|
J
|
|
909
930
|
).then((I) => {
|
|
910
|
-
var ee, W,
|
|
911
|
-
if (l !==
|
|
912
|
-
const
|
|
931
|
+
var ee, W, Ne, X, he, pe;
|
|
932
|
+
if (l !== R.current) return;
|
|
933
|
+
const Y = (W = (ee = I == null ? void 0 : I.fees) == null ? void 0 : ee.breakdown) == null ? void 0 : W.find(
|
|
913
934
|
(me) => me.type === "gas"
|
|
914
935
|
);
|
|
915
|
-
if (
|
|
936
|
+
if (Y && (u(String(Y.amount)), Y.gasPrice !== void 0 && x(String(Y.gasPrice))), I != null && I.calldata) {
|
|
916
937
|
const me = I.outputAmount ?? "0", We = (String(me).includes(".") ? Number(me) : Number(
|
|
917
|
-
|
|
938
|
+
Te(
|
|
918
939
|
String(me),
|
|
919
940
|
f.decimals
|
|
920
941
|
)
|
|
921
942
|
)).toFixed(f.decimals).replace(/\.?0+$/, "");
|
|
922
943
|
r(We), a(We);
|
|
923
|
-
const
|
|
924
|
-
((X = (
|
|
925
|
-
),
|
|
944
|
+
const it = Number(
|
|
945
|
+
((X = (Ne = I.fees) == null ? void 0 : Ne.total) == null ? void 0 : X.amount) || "0"
|
|
946
|
+
), lt = Number(
|
|
926
947
|
((pe = (he = I.fees) == null ? void 0 : he.total) == null ? void 0 : pe.decimals) ?? 18
|
|
927
|
-
),
|
|
948
|
+
), Se = it / Math.pow(10, lt);
|
|
928
949
|
p(
|
|
929
|
-
|
|
950
|
+
Se <= 0 ? null : Se < 0.01 ? "$<0.01" : `$${Se.toFixed(2)}`
|
|
930
951
|
);
|
|
931
952
|
const Qe = parseFloat(
|
|
932
|
-
|
|
953
|
+
Te(
|
|
933
954
|
I.inputAmount ?? "0",
|
|
934
955
|
c.decimals
|
|
935
956
|
)
|
|
936
|
-
),
|
|
937
|
-
|
|
957
|
+
), ct = parseFloat(
|
|
958
|
+
Te(
|
|
938
959
|
I.outputAmount ?? "0",
|
|
939
960
|
f.decimals
|
|
940
961
|
)
|
|
941
962
|
);
|
|
942
|
-
Qe > 0 && w(Number((
|
|
943
|
-
const
|
|
944
|
-
o(
|
|
963
|
+
Qe > 0 && w(Number((ct / Qe).toFixed(3))), e(I.calldata ?? null);
|
|
964
|
+
const wt = c.contractAddress === "0x0000000000000000000000000000000000000000";
|
|
965
|
+
o(wt ? "swap" : "approve");
|
|
945
966
|
}
|
|
946
967
|
}).catch((I) => {
|
|
947
968
|
var W;
|
|
948
|
-
if (l !==
|
|
949
|
-
const
|
|
950
|
-
|
|
969
|
+
if (l !== R.current || (I == null ? void 0 : I.name) === "AbortError") return;
|
|
970
|
+
const Y = String(((W = I == null ? void 0 : I.error) == null ? void 0 : W.message) ?? (I == null ? void 0 : I.message) ?? ""), ee = (I == null ? void 0 : I.statusCode) ?? (I == null ? void 0 : I.status);
|
|
971
|
+
Y.includes("No available quotes") || ee === 422 ? o("no-available-quotes") : Y.includes("Invalid toAddress") || Y.includes("Invalid fromAddress") ? o("wrong-address") : ee === 429 || Y.includes("Rate limit") ? o("rate-limit") : o("no-available-quotes");
|
|
951
972
|
});
|
|
952
973
|
},
|
|
953
|
-
[
|
|
974
|
+
[O]
|
|
954
975
|
);
|
|
955
976
|
return {
|
|
956
977
|
txData: t,
|
|
@@ -960,38 +981,38 @@ function Pt() {
|
|
|
960
981
|
setBuyAmountForInput: a,
|
|
961
982
|
price: i,
|
|
962
983
|
gasCostUSD: h,
|
|
963
|
-
gasPriceRaw:
|
|
984
|
+
gasPriceRaw: k,
|
|
964
985
|
gasLimitRaw: m,
|
|
965
|
-
buttonState:
|
|
986
|
+
buttonState: v,
|
|
966
987
|
setButtonState: o,
|
|
967
|
-
fetchQuote:
|
|
968
|
-
cancelRequest:
|
|
988
|
+
fetchQuote: V,
|
|
989
|
+
cancelRequest: O,
|
|
969
990
|
invalidateQuote: L
|
|
970
991
|
};
|
|
971
992
|
}
|
|
972
|
-
const
|
|
973
|
-
function
|
|
974
|
-
const [t, e] = U(0), [n, r] = U(""), [s, a] = U(
|
|
993
|
+
const Ue = "delora-slippage-selectedIndex", Fe = "delora-slippage-customValue", Ke = "delora-slippage-value", qe = ["Auto", "0.1%", "0.5%"], Re = 5e-3;
|
|
994
|
+
function Qt() {
|
|
995
|
+
const [t, e] = U(0), [n, r] = U(""), [s, a] = U(Re);
|
|
975
996
|
oe(() => {
|
|
976
|
-
const p = localStorage.getItem(
|
|
977
|
-
p !== null && e(JSON.parse(p)),
|
|
997
|
+
const p = localStorage.getItem(Ue), k = localStorage.getItem(Fe);
|
|
998
|
+
p !== null && e(JSON.parse(p)), k && r(k);
|
|
978
999
|
}, []);
|
|
979
1000
|
const i = D((p) => {
|
|
980
|
-
e(p), r(""), localStorage.setItem(
|
|
1001
|
+
e(p), r(""), localStorage.setItem(Ue, JSON.stringify(p)), localStorage.setItem(Fe, ""), a(p === 0 ? Re : parseFloat(qe[p].replace("%", "")) / 100);
|
|
981
1002
|
}, []), w = D((p) => {
|
|
982
|
-
e(null), r(p), localStorage.setItem(
|
|
983
|
-
const
|
|
984
|
-
!isNaN(
|
|
1003
|
+
e(null), r(p), localStorage.setItem(Ue, "null"), localStorage.setItem(Fe, p);
|
|
1004
|
+
const k = parseFloat(p.replace("%", ""));
|
|
1005
|
+
!isNaN(k) && k <= 49.9 && a(k / 100);
|
|
985
1006
|
}, []), h = D(
|
|
986
1007
|
(p) => {
|
|
987
1008
|
if (p === "Auto") {
|
|
988
|
-
const m =
|
|
989
|
-
return a(m), localStorage.setItem(
|
|
1009
|
+
const m = Re;
|
|
1010
|
+
return a(m), localStorage.setItem(Ke, p), m;
|
|
990
1011
|
}
|
|
991
|
-
const
|
|
992
|
-
if (
|
|
993
|
-
const x =
|
|
994
|
-
return a(x), localStorage.setItem(
|
|
1012
|
+
const k = parseFloat(p.replace("%", ""));
|
|
1013
|
+
if (k > 49.9) throw new Error("Slippage is too high!");
|
|
1014
|
+
const x = k / 100;
|
|
1015
|
+
return a(x), localStorage.setItem(Ke, p), x;
|
|
995
1016
|
},
|
|
996
1017
|
[]
|
|
997
1018
|
);
|
|
@@ -1005,18 +1026,18 @@ function $t() {
|
|
|
1005
1026
|
save: h
|
|
1006
1027
|
};
|
|
1007
1028
|
}
|
|
1008
|
-
const
|
|
1029
|
+
const Ht = 1e3;
|
|
1009
1030
|
function xe(t, e) {
|
|
1010
1031
|
if (!t.includes(".")) return t;
|
|
1011
1032
|
const [n, r] = t.split(".");
|
|
1012
1033
|
return `${n}.${(r ?? "").slice(0, e)}`;
|
|
1013
1034
|
}
|
|
1014
1035
|
function Je(t) {
|
|
1015
|
-
return t === "EVM" ?
|
|
1036
|
+
return t === "EVM" ? nt : t === "SVM" ? rt : ot;
|
|
1016
1037
|
}
|
|
1017
|
-
function
|
|
1018
|
-
var $,
|
|
1019
|
-
const e =
|
|
1038
|
+
function zt(t) {
|
|
1039
|
+
var V, $, l, C;
|
|
1040
|
+
const e = It({ apiBase: t.apiBase }), n = Wt(), r = Qt(), [s, a] = U(""), [i, w] = U(0), [h, p] = U(!1), k = se(null), x = 0, m = 0, u = !!e.sellToken && !!e.buyToken && i > 0, v = D(() => {
|
|
1020
1041
|
if (!e.networkSell || !e.networkBuy || !e.sellToken || !e.buyToken || i <= 0 || h)
|
|
1021
1042
|
return;
|
|
1022
1043
|
const g = Je(e.networkSell.chainType), y = Je(e.networkBuy.chainType);
|
|
@@ -1029,7 +1050,7 @@ function Qt(t) {
|
|
|
1029
1050
|
slippage: r.slippage,
|
|
1030
1051
|
fromAddress: g,
|
|
1031
1052
|
toAddress: y,
|
|
1032
|
-
apiBase: t.apiBase ??
|
|
1053
|
+
apiBase: t.apiBase ?? ke
|
|
1033
1054
|
});
|
|
1034
1055
|
}, [
|
|
1035
1056
|
e.networkSell,
|
|
@@ -1048,13 +1069,13 @@ function Qt(t) {
|
|
|
1048
1069
|
n.cancelRequest(), n.setBuyAmount(""), n.setBuyAmountForInput(""), n.setButtonState("swap");
|
|
1049
1070
|
return;
|
|
1050
1071
|
}
|
|
1051
|
-
|
|
1072
|
+
v();
|
|
1052
1073
|
}, [
|
|
1053
1074
|
u,
|
|
1054
|
-
(
|
|
1055
|
-
(
|
|
1075
|
+
(V = e.networkSell) == null ? void 0 : V.id,
|
|
1076
|
+
($ = e.networkBuy) == null ? void 0 : $.id,
|
|
1056
1077
|
(l = e.sellToken) == null ? void 0 : l.contractAddress,
|
|
1057
|
-
(
|
|
1078
|
+
(C = e.buyToken) == null ? void 0 : C.contractAddress,
|
|
1058
1079
|
i,
|
|
1059
1080
|
s,
|
|
1060
1081
|
r.slippage,
|
|
@@ -1064,24 +1085,24 @@ function Qt(t) {
|
|
|
1064
1085
|
}, [i]);
|
|
1065
1086
|
const o = D((g) => {
|
|
1066
1087
|
const y = g.replace(/[^0-9.]/g, "").replace(/\.+/g, ".").replace(/^(\.)/g, ""), c = xe(y, 6), f = Number(c);
|
|
1067
|
-
a(c), w(isNaN(f) ? 0 : f), p(!0), n.invalidateQuote(),
|
|
1068
|
-
p(!1),
|
|
1069
|
-
},
|
|
1070
|
-
}, [n]),
|
|
1071
|
-
a(String(x)), w(x), p(!1), u &&
|
|
1072
|
-
}, [x, u,
|
|
1088
|
+
a(c), w(isNaN(f) ? 0 : f), p(!0), n.invalidateQuote(), k.current && clearTimeout(k.current), k.current = setTimeout(() => {
|
|
1089
|
+
p(!1), k.current = null;
|
|
1090
|
+
}, Ht);
|
|
1091
|
+
}, [n]), M = D(() => {
|
|
1092
|
+
a(String(x)), w(x), p(!1), u && v();
|
|
1093
|
+
}, [x, u, v]), R = D(
|
|
1073
1094
|
(g) => {
|
|
1074
1095
|
const y = x * g / 100, c = xe(String(y), 6);
|
|
1075
|
-
a(c), w(y), p(!1), u &&
|
|
1096
|
+
a(c), w(y), p(!1), u && v();
|
|
1076
1097
|
},
|
|
1077
|
-
[x, u,
|
|
1078
|
-
),
|
|
1098
|
+
[x, u, v]
|
|
1099
|
+
), O = D(() => {
|
|
1079
1100
|
const g = e.sellToken, y = e.buyToken;
|
|
1080
1101
|
if (!g || !y) return;
|
|
1081
1102
|
const c = s || "0", f = n.buyAmountForInput || n.buyAmount || "0";
|
|
1082
1103
|
if (n.cancelRequest(), n.invalidateQuote(), e.updateNetworkSell(y.chainId), e.updateNetworkBuy(g.chainId), e.setSellToken(y), e.setBuyToken(g), f !== "0" && f !== "0.0") {
|
|
1083
|
-
const
|
|
1084
|
-
a(
|
|
1104
|
+
const S = xe(f, 6);
|
|
1105
|
+
a(S), w(Number(S));
|
|
1085
1106
|
} else
|
|
1086
1107
|
a(""), w(0);
|
|
1087
1108
|
c !== "0" && c !== "0.0" ? (n.setBuyAmount(xe(c, 6)), n.setBuyAmountForInput(xe(c, 6))) : (n.setBuyAmount(""), n.setBuyAmountForInput(""));
|
|
@@ -1094,9 +1115,9 @@ function Qt(t) {
|
|
|
1094
1115
|
setSellAmountForInput: a,
|
|
1095
1116
|
validatedSellAmount: i,
|
|
1096
1117
|
processSellInput: o,
|
|
1097
|
-
setMaxSellAmount:
|
|
1098
|
-
setSellAmountByPercent:
|
|
1099
|
-
swapTokens:
|
|
1118
|
+
setMaxSellAmount: M,
|
|
1119
|
+
setSellAmountByPercent: R,
|
|
1120
|
+
swapTokens: O,
|
|
1100
1121
|
balance: x,
|
|
1101
1122
|
balanceBuy: m,
|
|
1102
1123
|
allFieldsReady: u,
|
|
@@ -1104,7 +1125,7 @@ function Qt(t) {
|
|
|
1104
1125
|
isSameToken: (g, y) => !!g && !!y && g.contractAddress === y.contractAddress && g.chainId === y.chainId
|
|
1105
1126
|
};
|
|
1106
1127
|
}
|
|
1107
|
-
const
|
|
1128
|
+
const Yt = {
|
|
1108
1129
|
trade: {
|
|
1109
1130
|
possibleChars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+{}:"<>?|',
|
|
1110
1131
|
glitchChars: '!@#$%^&*()_+{}:"<>?|\\',
|
|
@@ -1120,7 +1141,7 @@ const Ht = {
|
|
|
1120
1141
|
animationSpeed: 25
|
|
1121
1142
|
}
|
|
1122
1143
|
};
|
|
1123
|
-
function
|
|
1144
|
+
function Kt({
|
|
1124
1145
|
ref: t,
|
|
1125
1146
|
text: e,
|
|
1126
1147
|
enabled: n,
|
|
@@ -1129,7 +1150,7 @@ function Yt({
|
|
|
1129
1150
|
onAnimationEnd: a
|
|
1130
1151
|
}) {
|
|
1131
1152
|
const i = se(null);
|
|
1132
|
-
|
|
1153
|
+
pt(() => {
|
|
1133
1154
|
const w = t.current;
|
|
1134
1155
|
w && (!n || !e || e === "0" || e === "0.0") && (w.textContent = e);
|
|
1135
1156
|
}, [t, e, n]), oe(() => {
|
|
@@ -1139,42 +1160,42 @@ function Yt({
|
|
|
1139
1160
|
w.textContent = e;
|
|
1140
1161
|
return;
|
|
1141
1162
|
}
|
|
1142
|
-
const { possibleChars: h, glitchChars: p, cyberChars:
|
|
1163
|
+
const { possibleChars: h, glitchChars: p, cyberChars: k, animationFrames: x, animationSpeed: m } = Yt[r], u = String(e);
|
|
1143
1164
|
i.current && (clearTimeout(i.current), i.current = null);
|
|
1144
|
-
let
|
|
1145
|
-
const o = Array(u.length).fill(!1),
|
|
1165
|
+
let v = 0;
|
|
1166
|
+
const o = Array(u.length).fill(!1), M = Array(u.length).fill(!1), R = () => {
|
|
1146
1167
|
if (!t.current) return;
|
|
1147
|
-
if (
|
|
1168
|
+
if (v >= x) {
|
|
1148
1169
|
t.current.textContent = u, i.current = null, a == null || a();
|
|
1149
1170
|
return;
|
|
1150
1171
|
}
|
|
1151
|
-
|
|
1172
|
+
v === 0 && (s == null || s());
|
|
1152
1173
|
let L = "";
|
|
1153
|
-
const
|
|
1174
|
+
const V = v / x, $ = Math.pow(V, 0.6), l = Math.floor(u.length * $);
|
|
1154
1175
|
for (let g = 0; g < l; g++)
|
|
1155
|
-
|
|
1156
|
-
if (
|
|
1157
|
-
const g = 0.05 +
|
|
1176
|
+
M[g] || (M[g] = !0);
|
|
1177
|
+
if (v % 2 === 0) {
|
|
1178
|
+
const g = 0.05 + V * 0.1;
|
|
1158
1179
|
for (let y = 0; y < u.length; y++)
|
|
1159
1180
|
Math.random() < g && (o[y] = !o[y]);
|
|
1160
1181
|
}
|
|
1161
1182
|
for (let g = 0; g < u.length; g++)
|
|
1162
|
-
if (
|
|
1163
|
-
o[g] &&
|
|
1183
|
+
if (M[g])
|
|
1184
|
+
o[g] && v < x * 0.95 && u[g] !== " " ? Math.random() < 0.3 ? L += k[Math.floor(Math.random() * k.length)] : L += p[Math.floor(Math.random() * p.length)] : L += u[g];
|
|
1164
1185
|
else if (u[g] === " ")
|
|
1165
1186
|
L += " ";
|
|
1166
1187
|
else {
|
|
1167
1188
|
const y = Math.random();
|
|
1168
|
-
y < 0.2 ? L += p[Math.floor(Math.random() * p.length)] : y < 0.4 ? L +=
|
|
1189
|
+
y < 0.2 ? L += p[Math.floor(Math.random() * p.length)] : y < 0.4 ? L += k[Math.floor(Math.random() * k.length)] : L += h[Math.floor(Math.random() * h.length)];
|
|
1169
1190
|
}
|
|
1170
|
-
t.current.textContent = L,
|
|
1171
|
-
let
|
|
1172
|
-
|
|
1173
|
-
},
|
|
1174
|
-
t.current &&
|
|
1191
|
+
t.current.textContent = L, v++;
|
|
1192
|
+
let C = m;
|
|
1193
|
+
V < 0.3 ? C = m * 0.8 : V > 0.7 ? C = m * 0.7 : C = m * 1.2, i.current = setTimeout(R, C);
|
|
1194
|
+
}, O = setTimeout(() => {
|
|
1195
|
+
t.current && R();
|
|
1175
1196
|
}, 0);
|
|
1176
1197
|
return () => {
|
|
1177
|
-
clearTimeout(
|
|
1198
|
+
clearTimeout(O), i.current && (clearTimeout(i.current), i.current = null), a == null || a();
|
|
1178
1199
|
};
|
|
1179
1200
|
}, [t, e, n, r]);
|
|
1180
1201
|
}
|
|
@@ -1185,7 +1206,7 @@ function re(t, e) {
|
|
|
1185
1206
|
const n = (e == null ? void 0 : e.replace(/\/$/, "")) ?? "";
|
|
1186
1207
|
return t.startsWith("/") ? `${n}${t}` : `${n}/${t}`;
|
|
1187
1208
|
}
|
|
1188
|
-
const
|
|
1209
|
+
const qt = "data:image/svg+xml,%3csvg%20width='27'%20height='27'%20viewBox='0%200%2027%2027'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.42142%203.29834C6.61961%203.29834%205.85064%203.61686%205.28367%204.18383C4.71671%204.75079%204.39819%205.51976%204.39819%206.32158V22.5371H4.12335C3.90467%2022.5371%203.69495%2022.624%203.54032%2022.7786C3.3857%2022.9332%203.29883%2023.143%203.29883%2023.3616C3.29883%2023.5803%203.3857%2023.79%203.54032%2023.9447C3.69495%2024.0993%203.90467%2024.1862%204.12335%2024.1862H18.9647C19.1834%2024.1862%2019.3931%2024.0993%2019.5477%2023.9447C19.7023%2023.79%2019.7892%2023.5803%2019.7892%2023.3616C19.7892%2023.143%2019.7023%2022.9332%2019.5477%2022.7786C19.3931%2022.624%2019.1834%2022.5371%2018.9647%2022.5371H18.6899V20.555C19.1499%2020.7915%2019.6631%2020.9058%2020.1801%2020.8868C20.697%2020.8679%2021.2005%2020.7163%2021.642%2020.4468C22.0835%2020.1772%2022.4484%2019.7987%2022.7015%2019.3475C22.9546%2018.8963%2023.0874%2018.3877%2023.0873%2017.8703V11.4523C23.0873%2010.7981%2022.8751%2010.1617%2022.4826%209.63834L21.2733%208.02558C21.1421%207.85064%2020.9468%207.73499%2020.7303%207.70406C20.5139%207.67314%2020.294%207.72947%2020.119%207.86068C19.9441%207.99189%2019.8284%208.18721%2019.7975%208.40369C19.7666%208.62017%2019.8229%208.84007%2019.9541%209.01501L21.1634%2010.6278C21.3415%2010.8652%2021.4383%2011.1555%2021.4383%2011.4523V17.8703C21.4383%2018.0501%2021.4028%2018.2281%2021.3341%2018.3941C21.2653%2018.5602%2021.1645%2018.7111%2021.0374%2018.8382C20.9103%2018.9653%2020.7594%2019.0661%2020.5933%2019.1349C20.4273%2019.2036%2020.2493%2019.239%2020.0695%2019.239C19.8898%2019.239%2019.7118%2019.2036%2019.5458%2019.1349C19.3797%2019.0661%2019.2288%2018.9653%2019.1017%2018.8382C18.9746%2018.7111%2018.8738%2018.5602%2018.805%2018.3941C18.7363%2018.2281%2018.7008%2018.0501%2018.7008%2017.8703V15.941C18.6999%2015.8964%2018.6962%2015.852%2018.6899%2015.8079V6.32158C18.6899%205.92456%2018.6117%205.53143%2018.4597%205.16463C18.3078%204.79784%2018.0851%204.46456%2017.8044%204.18383C17.5236%203.90309%2017.1904%203.6804%2016.8236%203.52847C16.4568%203.37654%2016.0636%203.29834%2015.6666%203.29834H7.42142ZM7.69626%207.42094C7.69626%207.20226%207.78313%206.99254%207.93776%206.83791C8.09239%206.68329%208.30211%206.59642%208.52078%206.59642H14.5673C14.7859%206.59642%2014.9957%206.68329%2015.1503%206.83791C15.3049%206.99254%2015.3918%207.20226%2015.3918%207.42094V11.2687C15.3918%2011.4874%2015.3049%2011.6971%2015.1503%2011.8517C14.9957%2012.0063%2014.7859%2012.0932%2014.5673%2012.0932H8.52078C8.30211%2012.0932%208.09239%2012.0063%207.93776%2011.8517C7.78313%2011.6971%207.69626%2011.4874%207.69626%2011.2687V7.42094Z'%20fill='white'/%3e%3c/svg%3e", Jt = {
|
|
1189
1210
|
swap: "Swap",
|
|
1190
1211
|
finding: "Finding Routes...",
|
|
1191
1212
|
approve: "Approve",
|
|
@@ -1195,7 +1216,7 @@ const Kt = "data:image/svg+xml,%3csvg%20width='27'%20height='27'%20viewBox='0%20
|
|
|
1195
1216
|
"wrong-address": "Wrong address",
|
|
1196
1217
|
"rate-limit": "Try later"
|
|
1197
1218
|
};
|
|
1198
|
-
function
|
|
1219
|
+
function Gt(t) {
|
|
1199
1220
|
const {
|
|
1200
1221
|
sellToken: e,
|
|
1201
1222
|
buyToken: n,
|
|
@@ -1206,38 +1227,38 @@ function qt(t) {
|
|
|
1206
1227
|
buyAmountForInput: w,
|
|
1207
1228
|
onSellAmountChange: h,
|
|
1208
1229
|
onSellInputProcess: p,
|
|
1209
|
-
onOpenSellToken:
|
|
1230
|
+
onOpenSellToken: k,
|
|
1210
1231
|
onOpenBuyToken: x,
|
|
1211
1232
|
onSwapTokens: m,
|
|
1212
1233
|
onRefresh: u,
|
|
1213
|
-
onOpenSettings:
|
|
1234
|
+
onOpenSettings: v,
|
|
1214
1235
|
balance: o,
|
|
1215
|
-
balanceBuy:
|
|
1216
|
-
sellPriceUsd:
|
|
1217
|
-
buyPriceUsd:
|
|
1236
|
+
balanceBuy: M,
|
|
1237
|
+
sellPriceUsd: R,
|
|
1238
|
+
buyPriceUsd: O,
|
|
1218
1239
|
onMaxClick: L,
|
|
1219
|
-
onSet50Percent:
|
|
1220
|
-
onSet25Percent:
|
|
1240
|
+
onSet50Percent: V,
|
|
1241
|
+
onSet25Percent: $,
|
|
1221
1242
|
buttonState: l,
|
|
1222
|
-
txData:
|
|
1243
|
+
txData: C,
|
|
1223
1244
|
loading: g,
|
|
1224
1245
|
price: y,
|
|
1225
1246
|
gasCostUSD: c,
|
|
1226
1247
|
truncateTo6Decimals: f,
|
|
1227
|
-
isWalletConnected:
|
|
1228
|
-
onConnectWallet:
|
|
1229
|
-
} = t, T = !!i && Number(i) > 0,
|
|
1248
|
+
isWalletConnected: S = !1,
|
|
1249
|
+
onConnectWallet: N
|
|
1250
|
+
} = t, T = !!i && Number(i) > 0, P = l === "insufficient" || l === "no-available-quotes" || l === "wrong-address", J = !T || g || S && !C && l !== "finding" || l === "no-available-quotes" || l === "insufficient", G = se(null), H = se(null), ve = se(0), I = () => {
|
|
1230
1251
|
u(), ve.current += 1;
|
|
1231
1252
|
const W = H.current;
|
|
1232
1253
|
W && (W.style.transform = `rotate(${ve.current * -720}deg)`);
|
|
1233
1254
|
};
|
|
1234
|
-
|
|
1255
|
+
Kt({
|
|
1235
1256
|
ref: G,
|
|
1236
1257
|
text: w || "0.0",
|
|
1237
1258
|
enabled: !!(n != null && n.symbol) && Number(i) > 0 && !!w && w !== "0" && w !== "0.0",
|
|
1238
1259
|
preset: "trade"
|
|
1239
1260
|
});
|
|
1240
|
-
const
|
|
1261
|
+
const Y = (W) => {
|
|
1241
1262
|
if ([",", ".", "/", "б", "ю"].includes(W.key)) {
|
|
1242
1263
|
W.preventDefault();
|
|
1243
1264
|
const X = W.target;
|
|
@@ -1245,11 +1266,11 @@ function qt(t) {
|
|
|
1245
1266
|
const he = X.selectionStart ?? X.value.length, pe = X.value.slice(0, he) + "." + X.value.slice(he);
|
|
1246
1267
|
h(pe), p(pe);
|
|
1247
1268
|
}
|
|
1248
|
-
}, ee =
|
|
1249
|
-
return /* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1269
|
+
}, ee = S ? `dw-w-full dw-h-[38px] dw-rounded-[var(--dw-radius)] dw-border dw-text-[13px] dw-font-normal dw-transition-colors ${P ? "dw-bg-[var(--dw-danger)] dw-border-[var(--dw-danger)] dw-text-white" : J ? "dw-bg-[var(--dw-surface-hover)] dw-border-[var(--dw-border)] dw-text-[var(--dw-muted)]" : "dw-bg-[var(--dw-accent)] dw-border-[var(--dw-accent)] dw-text-white hover:dw-bg-[var(--dw-accent-hover)] hover:dw-border-[var(--dw-accent-hover)]"}` : "dw-w-full dw-h-[38px] dw-rounded-[var(--dw-radius)] dw-border dw-border-[var(--dw-accent)] dw-text-[13px] dw-font-normal dw-transition-colors dw-bg-[var(--dw-accent)] dw-text-white hover:dw-bg-[var(--dw-accent-hover)] hover:dw-border-[var(--dw-accent-hover)]";
|
|
1270
|
+
return /* @__PURE__ */ A("div", { className: "dw-widget-shell dw-elevated-surface dw-flex dw-flex-col dw-gap-1.5 dw-font-mono", children: [
|
|
1271
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-justify-between dw-mb-0.5", children: [
|
|
1251
1272
|
/* @__PURE__ */ d("h3", { className: "dw-text-[14px] dw-font-normal dw-text-[var(--dw-fg)]", children: "Trade" }),
|
|
1252
|
-
/* @__PURE__ */
|
|
1273
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-gap-1", children: [
|
|
1253
1274
|
/* @__PURE__ */ d(
|
|
1254
1275
|
"button",
|
|
1255
1276
|
{
|
|
@@ -1263,7 +1284,7 @@ function qt(t) {
|
|
|
1263
1284
|
ref: H,
|
|
1264
1285
|
className: "dw-w-full dw-h-full dw-flex dw-items-center dw-justify-center",
|
|
1265
1286
|
style: { transition: "transform 1s ease-in-out" },
|
|
1266
|
-
children: /* @__PURE__ */ d(
|
|
1287
|
+
children: /* @__PURE__ */ d(Zt, {})
|
|
1267
1288
|
}
|
|
1268
1289
|
)
|
|
1269
1290
|
}
|
|
@@ -1273,14 +1294,14 @@ function qt(t) {
|
|
|
1273
1294
|
{
|
|
1274
1295
|
type: "button",
|
|
1275
1296
|
className: "dw-icon-button dw-w-4 dw-h-4 dw-flex dw-items-center dw-justify-center dw-rounded-[4px] dw-cursor-pointer dw-opacity-70",
|
|
1276
|
-
onClick:
|
|
1297
|
+
onClick: v,
|
|
1277
1298
|
"aria-label": "Settings",
|
|
1278
|
-
children: /* @__PURE__ */ d(
|
|
1299
|
+
children: /* @__PURE__ */ d(en, {})
|
|
1279
1300
|
}
|
|
1280
1301
|
)
|
|
1281
1302
|
] })
|
|
1282
1303
|
] }),
|
|
1283
|
-
/* @__PURE__ */
|
|
1304
|
+
/* @__PURE__ */ A("div", { className: "dw-relative dw-flex dw-flex-col dw-gap-1.5", children: [
|
|
1284
1305
|
/* @__PURE__ */ d(
|
|
1285
1306
|
"button",
|
|
1286
1307
|
{
|
|
@@ -1288,7 +1309,7 @@ function qt(t) {
|
|
|
1288
1309
|
className: "dw-widget-section dw-group dw-w-[30px] dw-h-[30px] dw-absolute dw-left-1/2 dw-top-1/2 dw-z-10 dw--translate-x-1/2 dw--translate-y-1/2 dw-cursor-pointer dw-flex dw-justify-center dw-items-center",
|
|
1289
1310
|
onClick: m,
|
|
1290
1311
|
"aria-label": "Swap tokens",
|
|
1291
|
-
children: /* @__PURE__ */ d(
|
|
1312
|
+
children: /* @__PURE__ */ d(Xt, {})
|
|
1292
1313
|
}
|
|
1293
1314
|
),
|
|
1294
1315
|
/* @__PURE__ */ d(
|
|
@@ -1301,18 +1322,18 @@ function qt(t) {
|
|
|
1301
1322
|
assetBaseUrl: a,
|
|
1302
1323
|
amount: i,
|
|
1303
1324
|
amountPlaceholder: "0.0",
|
|
1304
|
-
usdValue:
|
|
1325
|
+
usdValue: R || "$0.000",
|
|
1305
1326
|
balance: f(o),
|
|
1306
|
-
onOpenToken:
|
|
1327
|
+
onOpenToken: k,
|
|
1307
1328
|
onInputChange: (W) => {
|
|
1308
1329
|
h(W), p(W);
|
|
1309
1330
|
},
|
|
1310
|
-
onKeyDown:
|
|
1311
|
-
amountToneClassName:
|
|
1312
|
-
quickActions: /* @__PURE__ */
|
|
1331
|
+
onKeyDown: Y,
|
|
1332
|
+
amountToneClassName: P ? "dw-text-[var(--dw-danger)]" : "dw-text-[var(--dw-fg)]",
|
|
1333
|
+
quickActions: /* @__PURE__ */ A(ht, { children: [
|
|
1313
1334
|
/* @__PURE__ */ d(Me, { label: "MAX", onClick: L }),
|
|
1314
|
-
/* @__PURE__ */ d(Me, { label: "50%", onClick:
|
|
1315
|
-
/* @__PURE__ */ d(Me, { label: "25%", onClick:
|
|
1335
|
+
/* @__PURE__ */ d(Me, { label: "50%", onClick: V }),
|
|
1336
|
+
/* @__PURE__ */ d(Me, { label: "25%", onClick: $ })
|
|
1316
1337
|
] })
|
|
1317
1338
|
}
|
|
1318
1339
|
),
|
|
@@ -1325,8 +1346,8 @@ function qt(t) {
|
|
|
1325
1346
|
networkLogo: s,
|
|
1326
1347
|
assetBaseUrl: a,
|
|
1327
1348
|
amount: w || "0.0",
|
|
1328
|
-
usdValue:
|
|
1329
|
-
balance: f(
|
|
1349
|
+
usdValue: O || "$0.000",
|
|
1350
|
+
balance: f(M),
|
|
1330
1351
|
onOpenToken: x,
|
|
1331
1352
|
amountRef: G,
|
|
1332
1353
|
readOnly: !0
|
|
@@ -1337,18 +1358,18 @@ function qt(t) {
|
|
|
1337
1358
|
{
|
|
1338
1359
|
type: "button",
|
|
1339
1360
|
className: ee,
|
|
1340
|
-
disabled:
|
|
1341
|
-
onClick:
|
|
1342
|
-
} :
|
|
1343
|
-
children:
|
|
1361
|
+
disabled: S ? J : !1,
|
|
1362
|
+
onClick: S ? () => {
|
|
1363
|
+
} : N,
|
|
1364
|
+
children: S ? Jt[l] : "Connect Wallet"
|
|
1344
1365
|
}
|
|
1345
1366
|
),
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */ d("img", { src:
|
|
1349
|
-
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-fg)]", children:
|
|
1367
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-justify-between dw-min-h-[12px] dw-px-0.5", children: [
|
|
1368
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-gap-1 dw-min-w-0", children: [
|
|
1369
|
+
/* @__PURE__ */ d("img", { src: qt, alt: "", className: "dw-w-[10px] dw-h-[10px]" }),
|
|
1370
|
+
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-fg)]", children: C ? c ?? "—" : "$<0.01" })
|
|
1350
1371
|
] }),
|
|
1351
|
-
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-text-subtle)] dw-truncate dw-ml-3", children:
|
|
1372
|
+
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-text-subtle)] dw-truncate dw-ml-3", children: C && (e != null && e.symbol) && (n != null && n.symbol) ? `1 ${e.symbol} = ${y} ${n.symbol}` : "" })
|
|
1352
1373
|
] })
|
|
1353
1374
|
] })
|
|
1354
1375
|
] });
|
|
@@ -1364,17 +1385,17 @@ function Ge(t) {
|
|
|
1364
1385
|
amountPlaceholder: w = "0.0",
|
|
1365
1386
|
usdValue: h,
|
|
1366
1387
|
balance: p,
|
|
1367
|
-
onOpenToken:
|
|
1388
|
+
onOpenToken: k,
|
|
1368
1389
|
onInputChange: x,
|
|
1369
1390
|
onKeyDown: m,
|
|
1370
1391
|
amountToneClassName: u = "dw-text-[var(--dw-fg)]",
|
|
1371
|
-
amountRef:
|
|
1392
|
+
amountRef: v,
|
|
1372
1393
|
readOnly: o = !1,
|
|
1373
|
-
quickActions:
|
|
1394
|
+
quickActions: M
|
|
1374
1395
|
} = t;
|
|
1375
|
-
return /* @__PURE__ */
|
|
1376
|
-
/* @__PURE__ */
|
|
1377
|
-
/* @__PURE__ */
|
|
1396
|
+
return /* @__PURE__ */ A("div", { className: "dw-widget-section dw-relative dw-flex dw-flex-col dw-w-full dw-min-h-[91px] dw-px-4 dw-py-3", children: [
|
|
1397
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-start dw-justify-between", children: [
|
|
1398
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-flex-col dw-gap-2", children: [
|
|
1378
1399
|
/* @__PURE__ */ d(
|
|
1379
1400
|
"h6",
|
|
1380
1401
|
{
|
|
@@ -1382,15 +1403,15 @@ function Ge(t) {
|
|
|
1382
1403
|
children: e
|
|
1383
1404
|
}
|
|
1384
1405
|
),
|
|
1385
|
-
/* @__PURE__ */
|
|
1406
|
+
/* @__PURE__ */ A(
|
|
1386
1407
|
"button",
|
|
1387
1408
|
{
|
|
1388
1409
|
type: "button",
|
|
1389
1410
|
className: "dw-flex dw-items-center dw-gap-2 dw-cursor-pointer",
|
|
1390
|
-
onClick:
|
|
1411
|
+
onClick: k,
|
|
1391
1412
|
children: [
|
|
1392
1413
|
/* @__PURE__ */ d(
|
|
1393
|
-
|
|
1414
|
+
_t,
|
|
1394
1415
|
{
|
|
1395
1416
|
token: r,
|
|
1396
1417
|
networkLogo: s,
|
|
@@ -1405,11 +1426,11 @@ function Ge(t) {
|
|
|
1405
1426
|
}
|
|
1406
1427
|
)
|
|
1407
1428
|
] }),
|
|
1408
|
-
/* @__PURE__ */
|
|
1429
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-flex-col dw-items-end dw-min-w-0", children: [
|
|
1409
1430
|
o ? /* @__PURE__ */ d(
|
|
1410
1431
|
"p",
|
|
1411
1432
|
{
|
|
1412
|
-
ref:
|
|
1433
|
+
ref: v,
|
|
1413
1434
|
className: `dw-font-normal dw-text-[20px] dw-min-w-[70px] dw-max-w-[124px] dw-text-right dw-truncate ${u}`,
|
|
1414
1435
|
children: i || w
|
|
1415
1436
|
}
|
|
@@ -1419,7 +1440,7 @@ function Ge(t) {
|
|
|
1419
1440
|
type: "text",
|
|
1420
1441
|
placeholder: w,
|
|
1421
1442
|
value: i,
|
|
1422
|
-
onChange: (
|
|
1443
|
+
onChange: (R) => x == null ? void 0 : x(R.target.value),
|
|
1423
1444
|
onKeyDown: m,
|
|
1424
1445
|
className: `dw-h-[28px] dw-w-[124px] dw-font-normal dw-text-right dw-bg-transparent dw-outline-none dw-border-none dw-text-[20px] ${u}`
|
|
1425
1446
|
}
|
|
@@ -1427,9 +1448,9 @@ function Ge(t) {
|
|
|
1427
1448
|
/* @__PURE__ */ d("p", { className: "dw-mt-1 dw-text-[10px] dw-text-[var(--dw-text-subtle)]", children: h })
|
|
1428
1449
|
] })
|
|
1429
1450
|
] }),
|
|
1430
|
-
/* @__PURE__ */ d("div", { className: "dw-w-full dw-flex dw-items-center dw-justify-between dw-mt-2 dw-min-h-[12px]", children: /* @__PURE__ */
|
|
1451
|
+
/* @__PURE__ */ d("div", { className: "dw-w-full dw-flex dw-items-center dw-justify-between dw-mt-2 dw-min-h-[12px]", children: /* @__PURE__ */ A("div", { className: "dw-flex dw-gap-2 dw-items-center dw-min-w-0", children: [
|
|
1431
1452
|
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-text-subtle)]", children: p }),
|
|
1432
|
-
|
|
1453
|
+
M
|
|
1433
1454
|
] }) })
|
|
1434
1455
|
] });
|
|
1435
1456
|
}
|
|
@@ -1444,7 +1465,7 @@ function Me(t) {
|
|
|
1444
1465
|
}
|
|
1445
1466
|
);
|
|
1446
1467
|
}
|
|
1447
|
-
function
|
|
1468
|
+
function _t(t) {
|
|
1448
1469
|
var h;
|
|
1449
1470
|
const {
|
|
1450
1471
|
token: e,
|
|
@@ -1462,7 +1483,7 @@ function Jt(t) {
|
|
|
1462
1483
|
}
|
|
1463
1484
|
);
|
|
1464
1485
|
const i = re(e.imageUrl, r), w = re(n, r);
|
|
1465
|
-
return /* @__PURE__ */
|
|
1486
|
+
return /* @__PURE__ */ A("div", { className: "dw-relative", children: [
|
|
1466
1487
|
/* @__PURE__ */ d(
|
|
1467
1488
|
"div",
|
|
1468
1489
|
{
|
|
@@ -1480,9 +1501,9 @@ function Jt(t) {
|
|
|
1480
1501
|
)
|
|
1481
1502
|
] });
|
|
1482
1503
|
}
|
|
1483
|
-
function
|
|
1484
|
-
return /* @__PURE__ */
|
|
1485
|
-
/* @__PURE__ */
|
|
1504
|
+
function Xt() {
|
|
1505
|
+
return /* @__PURE__ */ A("div", { className: "dw-flex dw-flex-row dw-justify-center dw-items-center dw-w-[14px] dw-h-[14px] dw-gap-0", children: [
|
|
1506
|
+
/* @__PURE__ */ A(
|
|
1486
1507
|
"svg",
|
|
1487
1508
|
{
|
|
1488
1509
|
className: "dw-w-[7px] dw-h-[10px] dw-flex-shrink-0 dw-transition-[transform] dw-duration-200 group-hover:dw-translate-y-[-1px] dw-text-[var(--dw-fg)]",
|
|
@@ -1506,7 +1527,7 @@ function Gt() {
|
|
|
1506
1527
|
]
|
|
1507
1528
|
}
|
|
1508
1529
|
),
|
|
1509
|
-
/* @__PURE__ */
|
|
1530
|
+
/* @__PURE__ */ A(
|
|
1510
1531
|
"svg",
|
|
1511
1532
|
{
|
|
1512
1533
|
className: "dw-w-[7px] dw-h-[10px] dw-flex-shrink-0 dw-transition-[transform] dw-duration-200 group-hover:dw-translate-y-[1px] dw-text-[var(--dw-fg)]",
|
|
@@ -1540,7 +1561,7 @@ function Gt() {
|
|
|
1540
1561
|
)
|
|
1541
1562
|
] });
|
|
1542
1563
|
}
|
|
1543
|
-
function
|
|
1564
|
+
function Zt() {
|
|
1544
1565
|
return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ d(
|
|
1545
1566
|
"path",
|
|
1546
1567
|
{
|
|
@@ -1552,7 +1573,7 @@ function _t() {
|
|
|
1552
1573
|
}
|
|
1553
1574
|
) });
|
|
1554
1575
|
}
|
|
1555
|
-
function
|
|
1576
|
+
function en() {
|
|
1556
1577
|
return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ d(
|
|
1557
1578
|
"path",
|
|
1558
1579
|
{
|
|
@@ -1564,7 +1585,7 @@ function Xt() {
|
|
|
1564
1585
|
}
|
|
1565
1586
|
) });
|
|
1566
1587
|
}
|
|
1567
|
-
const
|
|
1588
|
+
const tn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHaSURBVHgB7Zj/dYIwEMcPX/+vGzRuYDewG3QD7QS1G3SDugF0go4AG+gG4ASywfUi4XnEBAkJ4h983ruXQMjlm19ADuDBicARRJxTMgdHoigqIDRSDNmWLCbL0Z+YTEAIyNE72QmHYd1VR2QR90nJzlKnVOaK0K7faNozcEVOgdbbnOybbInV+uuF8pszv/su9SKDo5iSjbosyF6pp6WtUXBDkP3BZZO5j6LWy5VWJkfhB8NsmHp24s4dVdNYc9LK1jjcppEYN86Tds3X2IGPHCWJoX4B/TC9SxNq59g65fTAhvUoZvdTbE7LCj02jPI5V35y5ju9VWnLHt4xRxwBAcHrt0aj4zPteV5Y79wlu5eF/mQpfxm7teLlM7iNYPkChuHI8q0jaEJYHIWktLTXSeA9sH46H0WglUmgL5NAXyaBvkwCfZkE+qIL5N9Erx/SUOgCDyy/Dv1z2oeGQHUeqEXKEZS/4C8wIqY1+MXyAi5nZMndp/1KoBrFD8vzzzAMguULXmDcxSQyoWRB9tviKCR8GRXgwtinuq5O0rHOxZ0irFjFaEyH6r6hOFuUdtH7WIvNqENoZMxnA75gtV5kDGWPYcixij0KW5vOQXRNcK+A+rnhIYLqY/APHpl3hlZpXEMAAAAASUVORK5CYII=", nn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAERSURBVHgB7dShDoMwEAbgK0EgJiYmEAgEAjGx93+KCR4AMTkxMYEgYXdJSbqOo4WVgrg/uRRo034pTQEkEolk3yiInGEYMmyuWNS2SqmH2Z9AxGjMDeuElWKV9phoIAOTGZ972APEYDqsuz128zM0h8Hz00FMEGLorIwH2InZFKQxtDOpL2Yz0FoMJeEm1P8+KoaiJiassCn0K11cLUTCUKZ2qDCeS1ykhEgYDvSy3p2oUBgO1GC9wRMVEkNRzCI0Od0fZ6vr60zhuBybKhSGBRkL1tjkMIHSmNrqo51t1mKcoBnUE+sCvxjamR7+iNfFyKCCY7xBDlQwzCIQgwqKWQzSqPEmp/uqCYmRSCSSI+QD+pyUWCGG+FwAAAAASUVORK5CYII=", rn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAwCAYAAAAhOEsMAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAABZSURBVHgB7c7RCQAgCEVRa5JGbONGKT8KgtQsCPp4FwQRDkh0WRhL5eigSC/jZxJPqVOnqLiggNIWSqjfdaghE1pIhTskQg9aoBdJMHvQAidsIoQQQgj9VgNcp//kKP+JUgAAAABJRU5ErkJggg==";
|
|
1568
1589
|
function _e(t) {
|
|
1569
1590
|
const {
|
|
1570
1591
|
mode: e,
|
|
@@ -1576,23 +1597,23 @@ function _e(t) {
|
|
|
1576
1597
|
onSelectToken: w,
|
|
1577
1598
|
onSelectNetwork: h,
|
|
1578
1599
|
onOpenNetworkSelector: p,
|
|
1579
|
-
onClose:
|
|
1600
|
+
onClose: k,
|
|
1580
1601
|
assetBaseUrl: x,
|
|
1581
1602
|
displayedNetworks: m,
|
|
1582
1603
|
additionalNetworksCount: u
|
|
1583
|
-
} = t, [
|
|
1604
|
+
} = t, [v, o] = U(""), [M, R] = U(
|
|
1584
1605
|
/* @__PURE__ */ new Set()
|
|
1585
|
-
),
|
|
1606
|
+
), O = D(
|
|
1586
1607
|
(l) => {
|
|
1587
|
-
const
|
|
1588
|
-
return
|
|
1608
|
+
const C = i(l.chainId);
|
|
1609
|
+
return C ? C.chainType === "SVM" ? l.symbol === "SOL" : C.chainType === "MVM" ? l.symbol === "SUI" : l.contractAddress === Pt : !1;
|
|
1589
1610
|
},
|
|
1590
1611
|
[i]
|
|
1591
1612
|
), L = D(
|
|
1592
|
-
(l,
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1613
|
+
(l, C) => {
|
|
1614
|
+
C.stopPropagation(), navigator.clipboard.writeText(l).then(() => {
|
|
1615
|
+
R((g) => new Set(g).add(l)), setTimeout(() => {
|
|
1616
|
+
R((g) => {
|
|
1596
1617
|
const y = new Set(g);
|
|
1597
1618
|
return y.delete(l), y;
|
|
1598
1619
|
});
|
|
@@ -1600,49 +1621,49 @@ function _e(t) {
|
|
|
1600
1621
|
}).catch(() => console.error("Failed to copy to clipboard"));
|
|
1601
1622
|
},
|
|
1602
1623
|
[]
|
|
1603
|
-
),
|
|
1624
|
+
), $ = ie(() => {
|
|
1604
1625
|
var y;
|
|
1605
1626
|
const l = n ?? ((y = m[0]) == null ? void 0 : y.id);
|
|
1606
1627
|
if (!l) return [];
|
|
1607
|
-
const
|
|
1608
|
-
if (!
|
|
1609
|
-
return
|
|
1628
|
+
const C = a(l);
|
|
1629
|
+
if (!v.trim())
|
|
1630
|
+
return C.filter(
|
|
1610
1631
|
(c) => !s || !(c.contractAddress === s.contractAddress && c.chainId === s.chainId)
|
|
1611
1632
|
);
|
|
1612
|
-
const g =
|
|
1613
|
-
return
|
|
1633
|
+
const g = v.toLowerCase();
|
|
1634
|
+
return C.filter(
|
|
1614
1635
|
(c) => {
|
|
1615
|
-
var f,
|
|
1616
|
-
return (((f = c.symbol) == null ? void 0 : f.toLowerCase().includes(g)) || ((
|
|
1636
|
+
var f, S;
|
|
1637
|
+
return (((f = c.symbol) == null ? void 0 : f.toLowerCase().includes(g)) || ((S = c.contractAddress) == null ? void 0 : S.toLowerCase().includes(g))) && (!s || !(c.contractAddress === s.contractAddress && c.chainId === s.chainId));
|
|
1617
1638
|
}
|
|
1618
1639
|
);
|
|
1619
1640
|
}, [
|
|
1620
1641
|
n,
|
|
1621
1642
|
a,
|
|
1622
|
-
|
|
1643
|
+
v,
|
|
1623
1644
|
s,
|
|
1624
1645
|
m
|
|
1625
1646
|
]);
|
|
1626
|
-
return /* @__PURE__ */ d("div", { className: "dw-popup-backdrop dw-absolute dw-top-0 dw-left-1/2 dw--translate-x-1/2 dw-max-h-[420px] dw-h-full dw-z-50 dw-flex dw-items-start dw-justify-center", children: /* @__PURE__ */
|
|
1647
|
+
return /* @__PURE__ */ d("div", { className: "dw-popup-backdrop dw-absolute dw-top-0 dw-left-1/2 dw--translate-x-1/2 dw-max-h-[420px] dw-h-full dw-z-50 dw-flex dw-items-start dw-justify-center", children: /* @__PURE__ */ A(
|
|
1627
1648
|
"div",
|
|
1628
1649
|
{
|
|
1629
1650
|
className: "dw-modal-surface dw-popup-content dw-w-[304px] dw-h-full dw-flex dw-flex-col dw-rounded-[var(--dw-radius)] dw-p-3 dw-overflow-hidden",
|
|
1630
1651
|
onClick: (l) => l.stopPropagation(),
|
|
1631
1652
|
children: [
|
|
1632
|
-
/* @__PURE__ */
|
|
1653
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-justify-between", children: [
|
|
1633
1654
|
/* @__PURE__ */ d("h3", { className: "dw-text-[14px] dw-font-normal dw-text-[var(--dw-fg)]", children: e === "sell" ? "Exchange from" : "Exchange to" }),
|
|
1634
1655
|
/* @__PURE__ */ d(
|
|
1635
1656
|
"button",
|
|
1636
1657
|
{
|
|
1637
1658
|
type: "button",
|
|
1638
1659
|
className: "dw-icon-button dw-w-4 dw-h-4 dw-rounded-[4px] dw-opacity-70 dw-cursor-pointer",
|
|
1639
|
-
onClick:
|
|
1660
|
+
onClick: k,
|
|
1640
1661
|
"aria-label": "Close",
|
|
1641
|
-
children: /* @__PURE__ */ d(
|
|
1662
|
+
children: /* @__PURE__ */ d(on, {})
|
|
1642
1663
|
}
|
|
1643
1664
|
)
|
|
1644
1665
|
] }),
|
|
1645
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-gap-1 dw-mt-3 dw-flex-wrap", children: [
|
|
1646
1667
|
m.map((l) => /* @__PURE__ */ d(
|
|
1647
1668
|
"button",
|
|
1648
1669
|
{
|
|
@@ -1668,41 +1689,41 @@ function _e(t) {
|
|
|
1668
1689
|
className: "dw-min-w-[34px] dw-h-[34px] dw-px-2 dw-flex dw-items-center dw-justify-center dw-rounded-[6px] dw-border dw-border-[var(--dw-border)] dw-bg-[var(--dw-surface-alt)] hover:dw-bg-[var(--dw-surface-hover)] dw-transition dw-cursor-pointer",
|
|
1669
1690
|
onClick: p,
|
|
1670
1691
|
title: "More networks",
|
|
1671
|
-
children: /* @__PURE__ */
|
|
1692
|
+
children: /* @__PURE__ */ A("p", { className: "dw-font-normal dw-text-[11px] dw-text-[var(--dw-fg)]", children: [
|
|
1672
1693
|
u,
|
|
1673
1694
|
"+"
|
|
1674
1695
|
] })
|
|
1675
1696
|
}
|
|
1676
1697
|
)
|
|
1677
1698
|
] }),
|
|
1678
|
-
/* @__PURE__ */
|
|
1699
|
+
/* @__PURE__ */ A("div", { className: "dw-field-shell dw-flex dw-items-center dw-gap-2 dw-h-[34px] dw-mt-3 dw-rounded-[6px] dw-px-3", children: [
|
|
1679
1700
|
/* @__PURE__ */ d(
|
|
1680
1701
|
"input",
|
|
1681
1702
|
{
|
|
1682
1703
|
type: "text",
|
|
1683
1704
|
placeholder: "Search by name or contract address",
|
|
1684
|
-
value:
|
|
1705
|
+
value: v,
|
|
1685
1706
|
onChange: (l) => o(l.target.value),
|
|
1686
1707
|
className: "dw-flex-1 dw-h-5 dw-font-normal dw-text-[11px] dw-text-[var(--dw-fg)] dw-bg-transparent dw-outline-none dw-border-none"
|
|
1687
1708
|
}
|
|
1688
1709
|
),
|
|
1689
|
-
/* @__PURE__ */ d(
|
|
1710
|
+
/* @__PURE__ */ d(sn, {})
|
|
1690
1711
|
] }),
|
|
1691
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-justify-between dw-mt-2.5 dw-px-0.5", children: [
|
|
1692
1713
|
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[11px] dw-text-[var(--dw-text-subtle)]", children: "Token list" }),
|
|
1693
1714
|
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[11px] dw-text-[var(--dw-text-subtle)]", children: "Contracts" })
|
|
1694
1715
|
] }),
|
|
1695
|
-
/* @__PURE__ */ d("div", { className: "dw-widget-list dw-flex-1 dw-overflow-y-auto dw-mt-2 dw-pr-1 dw-flex dw-flex-col dw-gap-1", children:
|
|
1696
|
-
var
|
|
1697
|
-
const
|
|
1698
|
-
return /* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ d("div", { className: "dw-widget-list dw-flex-1 dw-overflow-y-auto dw-mt-2 dw-pr-1 dw-flex dw-flex-col dw-gap-1", children: $.map((l) => {
|
|
1717
|
+
var N;
|
|
1718
|
+
const C = i(l.chainId), y = `${(C == null ? void 0 : C.explorerUrl) ?? "https://etherscan.io/token/"}${l.contractAddress}`, c = l.contractAddress.length > 10 ? `${l.contractAddress.slice(0, 4)}…${l.contractAddress.slice(-3)}` : l.contractAddress, f = M.has(l.contractAddress), S = !O(l);
|
|
1719
|
+
return /* @__PURE__ */ A(
|
|
1699
1720
|
"button",
|
|
1700
1721
|
{
|
|
1701
1722
|
type: "button",
|
|
1702
1723
|
className: `dw-w-full dw-min-h-[48px] dw-flex dw-items-center dw-justify-between dw-rounded-[6px] dw-px-3 dw-py-2 dw-text-left dw-transition dw-cursor-pointer dw-border ${(r == null ? void 0 : r.contractAddress) === l.contractAddress && (r == null ? void 0 : r.chainId) === l.chainId ? "dw-bg-[var(--dw-surface-hover)] dw-border-[var(--dw-accent)]" : "dw-bg-transparent dw-border-transparent hover:dw-bg-[var(--dw-surface-alt)] hover:dw-border-[var(--dw-border)]"}`,
|
|
1703
1724
|
onClick: () => w(l),
|
|
1704
1725
|
children: [
|
|
1705
|
-
/* @__PURE__ */
|
|
1726
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-gap-2 dw-min-w-0", children: [
|
|
1706
1727
|
/* @__PURE__ */ d(
|
|
1707
1728
|
"div",
|
|
1708
1729
|
{
|
|
@@ -1713,29 +1734,29 @@ function _e(t) {
|
|
|
1713
1734
|
x
|
|
1714
1735
|
) ? `url(${re(l.imageUrl, x)})` : "none"
|
|
1715
1736
|
},
|
|
1716
|
-
children: !re(l.imageUrl, x) && /* @__PURE__ */ d("span", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-fg)]", children: ((
|
|
1737
|
+
children: !re(l.imageUrl, x) && /* @__PURE__ */ d("span", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-fg)]", children: ((N = l.symbol[0]) == null ? void 0 : N.toUpperCase()) ?? "?" })
|
|
1717
1738
|
}
|
|
1718
1739
|
),
|
|
1719
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ A("div", { className: "dw-min-w-0", children: [
|
|
1720
1741
|
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[12px] dw-text-[var(--dw-fg)] dw-truncate", children: l.symbol }),
|
|
1721
1742
|
l.name && /* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-text-subtle)] dw-truncate", children: l.name })
|
|
1722
1743
|
] })
|
|
1723
1744
|
] }),
|
|
1724
|
-
/* @__PURE__ */
|
|
1725
|
-
|
|
1745
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-flex-col dw-items-end dw-gap-1 dw-flex-shrink-0", children: [
|
|
1746
|
+
S && /* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-gap-2.5", children: [
|
|
1726
1747
|
/* @__PURE__ */ d(
|
|
1727
1748
|
"button",
|
|
1728
1749
|
{
|
|
1729
1750
|
type: "button",
|
|
1730
1751
|
className: `dw-w-[12px] dw-h-[12px] dw-flex-shrink-0 dw-bg-cover dw-bg-no-repeat dw-cursor-pointer dw-transition-opacity hover:dw-opacity-100 ${f ? "dw-opacity-100" : "dw-opacity-50"}`,
|
|
1731
1752
|
style: {
|
|
1732
|
-
backgroundImage: `url(${f ?
|
|
1753
|
+
backgroundImage: `url(${f ? nn : tn})`
|
|
1733
1754
|
},
|
|
1734
1755
|
onClick: (T) => L(l.contractAddress, T),
|
|
1735
1756
|
"aria-label": "Copy address"
|
|
1736
1757
|
}
|
|
1737
1758
|
),
|
|
1738
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ A(
|
|
1739
1760
|
"a",
|
|
1740
1761
|
{
|
|
1741
1762
|
href: y,
|
|
@@ -1749,14 +1770,14 @@ function _e(t) {
|
|
|
1749
1770
|
"span",
|
|
1750
1771
|
{
|
|
1751
1772
|
className: "dw-w-[6px] dw-h-[10px] dw-flex-shrink-0 dw-bg-cover dw-bg-no-repeat",
|
|
1752
|
-
style: { backgroundImage: `url(${
|
|
1773
|
+
style: { backgroundImage: `url(${rn})` }
|
|
1753
1774
|
}
|
|
1754
1775
|
)
|
|
1755
1776
|
]
|
|
1756
1777
|
}
|
|
1757
1778
|
)
|
|
1758
1779
|
] }),
|
|
1759
|
-
!
|
|
1780
|
+
!S && /* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[10px] dw-text-[var(--dw-text-subtle)]", children: "Native" })
|
|
1760
1781
|
] })
|
|
1761
1782
|
]
|
|
1762
1783
|
},
|
|
@@ -1767,10 +1788,10 @@ function _e(t) {
|
|
|
1767
1788
|
}
|
|
1768
1789
|
) });
|
|
1769
1790
|
}
|
|
1770
|
-
function
|
|
1791
|
+
function on() {
|
|
1771
1792
|
return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ d("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) });
|
|
1772
1793
|
}
|
|
1773
|
-
function
|
|
1794
|
+
function sn() {
|
|
1774
1795
|
return /* @__PURE__ */ d("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ d(
|
|
1775
1796
|
"path",
|
|
1776
1797
|
{
|
|
@@ -1788,13 +1809,13 @@ function Xe(t) {
|
|
|
1788
1809
|
const h = a.toLowerCase();
|
|
1789
1810
|
return e.filter((p) => p.name.toLowerCase().includes(h));
|
|
1790
1811
|
}, [e, a]);
|
|
1791
|
-
return /* @__PURE__ */ d("div", { className: "dw-popup-backdrop dw-absolute dw-top-0 dw-left-1/2 dw--translate-x-1/2 dw-max-h-[420px] dw-h-full dw-z-[60] dw-flex dw-items-start dw-justify-center", children: /* @__PURE__ */
|
|
1812
|
+
return /* @__PURE__ */ d("div", { className: "dw-popup-backdrop dw-absolute dw-top-0 dw-left-1/2 dw--translate-x-1/2 dw-max-h-[420px] dw-h-full dw-z-[60] dw-flex dw-items-start dw-justify-center", children: /* @__PURE__ */ A(
|
|
1792
1813
|
"div",
|
|
1793
1814
|
{
|
|
1794
1815
|
className: "dw-modal-surface dw-popup-content dw-w-[304px] dw-h-full dw-flex dw-flex-col dw-rounded-[var(--dw-radius)] dw-p-3 dw-overflow-hidden",
|
|
1795
1816
|
onClick: (h) => h.stopPropagation(),
|
|
1796
1817
|
children: [
|
|
1797
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-justify-between", children: [
|
|
1798
1819
|
/* @__PURE__ */ d("h3", { className: "dw-text-[14px] dw-font-normal dw-text-[var(--dw-fg)]", children: "Select ecosystem" }),
|
|
1799
1820
|
/* @__PURE__ */ d(
|
|
1800
1821
|
"button",
|
|
@@ -1803,11 +1824,11 @@ function Xe(t) {
|
|
|
1803
1824
|
className: "dw-icon-button dw-w-4 dw-h-4 dw-rounded-[4px] dw-opacity-70 dw-cursor-pointer",
|
|
1804
1825
|
onClick: r,
|
|
1805
1826
|
"aria-label": "Close",
|
|
1806
|
-
children: /* @__PURE__ */ d(
|
|
1827
|
+
children: /* @__PURE__ */ d(dn, {})
|
|
1807
1828
|
}
|
|
1808
1829
|
)
|
|
1809
1830
|
] }),
|
|
1810
|
-
/* @__PURE__ */
|
|
1831
|
+
/* @__PURE__ */ A("div", { className: "dw-field-shell dw-flex dw-items-center dw-gap-2 dw-h-[34px] dw-mt-3 dw-rounded-[6px] dw-px-3", children: [
|
|
1811
1832
|
/* @__PURE__ */ d(
|
|
1812
1833
|
"input",
|
|
1813
1834
|
{
|
|
@@ -1818,9 +1839,9 @@ function Xe(t) {
|
|
|
1818
1839
|
className: "dw-flex-1 dw-h-5 dw-font-normal dw-text-[11px] dw-text-[var(--dw-fg)] dw-bg-transparent dw-outline-none dw-border-none"
|
|
1819
1840
|
}
|
|
1820
1841
|
),
|
|
1821
|
-
/* @__PURE__ */ d(
|
|
1842
|
+
/* @__PURE__ */ d(an, {})
|
|
1822
1843
|
] }),
|
|
1823
|
-
/* @__PURE__ */ d("div", { className: "dw-widget-list dw-flex-1 dw-overflow-y-auto dw-mt-3 dw-pr-1 dw-grid dw-grid-cols-2 dw-gap-1.5", children: w.map((h) => /* @__PURE__ */
|
|
1844
|
+
/* @__PURE__ */ d("div", { className: "dw-widget-list dw-flex-1 dw-overflow-y-auto dw-mt-3 dw-pr-1 dw-grid dw-grid-cols-2 dw-gap-1.5", children: w.map((h) => /* @__PURE__ */ A(
|
|
1824
1845
|
"button",
|
|
1825
1846
|
{
|
|
1826
1847
|
type: "button",
|
|
@@ -1845,10 +1866,10 @@ function Xe(t) {
|
|
|
1845
1866
|
}
|
|
1846
1867
|
) });
|
|
1847
1868
|
}
|
|
1848
|
-
function
|
|
1869
|
+
function dn() {
|
|
1849
1870
|
return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ d("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) });
|
|
1850
1871
|
}
|
|
1851
|
-
function
|
|
1872
|
+
function an() {
|
|
1852
1873
|
return /* @__PURE__ */ d("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ d(
|
|
1853
1874
|
"path",
|
|
1854
1875
|
{
|
|
@@ -1860,8 +1881,8 @@ function sn() {
|
|
|
1860
1881
|
}
|
|
1861
1882
|
) });
|
|
1862
1883
|
}
|
|
1863
|
-
const
|
|
1864
|
-
function
|
|
1884
|
+
const ln = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIFSURBVHgB7Vf/VcMgEL5MYJxAnMBuIBvYDewIbtJukG5QnSB1AusEwQkaJzjvBF5ICg1Jaf/ie+979KUHHNwvDiAj47ooIDEQsaRhQXwhCvNbOCItURl+EvdFURzGFl0QBcxTSBIr4hGnoyGuQguvHcHKbFSOKCOIb8Qa02Bn1y6cTTCwP1+zvX4La56zihu0DsHMESFhMmvfvRKemk1ZEVcYcAv6XqK2CN9248z98gmzWbY4H7XZKOYWh3vL4dzCdxoaJHFJfAJtNh/YNGxmG1l7SIiodOExSUuKtJCRMY7kJcnC+KUEnbcezMh++Qtd4Bxu4qsm7Nc4rSzVeCbn8aKvqJNdxRtAJFAnyxRlqWEd7LpuSWqgXyoUdHlqWP1ZzuY4CenAaeh+qNgR4mpfLPbEb9CHUoP/+EDPcPokUqTYY0/S2LnBy1DjxLKE2i+3OPL0EUbBOl6Xf0ff4AS/jEEwXWD3EmWWhnegw12BDnmukQoyMsK4WkmyML7ai9IYv7xG+yZB5ygebeD4cDD8AB1EbWhBW1okTFcmRVmq0Fcv6ePOEWqskhhIltjlvArn9ZI+1Hb92JKkoN9+lRDfuvFct9YKM9fbS/jat0s6pN6pUd+2gDNAbf7lYN9NSHhuvbS9pIQZQO0WvRssAoL2OcPRJeC061agzfNDfIdbvUQzMhLiDyT6chuOT10RAAAAAElFTkSuQmCC";
|
|
1885
|
+
function cn(t) {
|
|
1865
1886
|
const {
|
|
1866
1887
|
options: e,
|
|
1867
1888
|
selectedIndex: n,
|
|
@@ -1870,11 +1891,11 @@ function an(t) {
|
|
|
1870
1891
|
onCustomChange: a,
|
|
1871
1892
|
onSave: i,
|
|
1872
1893
|
onClose: w
|
|
1873
|
-
} = t, [h, p] = U(r),
|
|
1894
|
+
} = t, [h, p] = U(r), k = (m) => {
|
|
1874
1895
|
let u = m.target.value.replace(/,/g, ".");
|
|
1875
1896
|
u.startsWith(".") && (u = "0" + u), u = u.replace(/[^0-9.]/g, "");
|
|
1876
|
-
const
|
|
1877
|
-
|
|
1897
|
+
const v = u.indexOf(".");
|
|
1898
|
+
v >= 0 && (u = u.slice(0, v + 1) + u.slice(v + 1).replace(/\./g, "")), u = u.slice(0, 4), p(u), a(u);
|
|
1878
1899
|
}, x = () => {
|
|
1879
1900
|
let m;
|
|
1880
1901
|
if (n !== null)
|
|
@@ -1889,13 +1910,13 @@ function an(t) {
|
|
|
1889
1910
|
console.error(u);
|
|
1890
1911
|
}
|
|
1891
1912
|
};
|
|
1892
|
-
return /* @__PURE__ */ d("div", { className: "dw-popup-backdrop dw-absolute dw-inset-0 dw-z-50 dw-flex dw-items-center dw-justify-center", children: /* @__PURE__ */
|
|
1913
|
+
return /* @__PURE__ */ d("div", { className: "dw-popup-backdrop dw-absolute dw-inset-0 dw-z-50 dw-flex dw-items-center dw-justify-center", children: /* @__PURE__ */ A(
|
|
1893
1914
|
"div",
|
|
1894
1915
|
{
|
|
1895
1916
|
className: "dw-modal-surface dw-popup-content dw-w-[304px] dw-flex dw-flex-col dw-rounded-[var(--dw-radius)] dw-p-3",
|
|
1896
1917
|
onClick: (m) => m.stopPropagation(),
|
|
1897
1918
|
children: [
|
|
1898
|
-
/* @__PURE__ */
|
|
1919
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-justify-between", children: [
|
|
1899
1920
|
/* @__PURE__ */ d("h3", { className: "dw-font-normal dw-text-[14px] dw-text-[var(--dw-fg)]", children: "Settings" }),
|
|
1900
1921
|
/* @__PURE__ */ d(
|
|
1901
1922
|
"button",
|
|
@@ -1904,22 +1925,22 @@ function an(t) {
|
|
|
1904
1925
|
className: "dw-icon-button dw-w-4 dw-h-4 dw-rounded-[4px] dw-opacity-70 dw-cursor-pointer",
|
|
1905
1926
|
onClick: w,
|
|
1906
1927
|
"aria-label": "Close",
|
|
1907
|
-
children: /* @__PURE__ */ d(
|
|
1928
|
+
children: /* @__PURE__ */ d(wn, {})
|
|
1908
1929
|
}
|
|
1909
1930
|
)
|
|
1910
1931
|
] }),
|
|
1911
|
-
/* @__PURE__ */
|
|
1932
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-gap-2 dw-mt-3", children: [
|
|
1912
1933
|
/* @__PURE__ */ d(
|
|
1913
1934
|
"img",
|
|
1914
1935
|
{
|
|
1915
|
-
src:
|
|
1936
|
+
src: ln,
|
|
1916
1937
|
alt: "",
|
|
1917
1938
|
className: "dw-w-[14px] dw-h-[14px] dw-object-cover"
|
|
1918
1939
|
}
|
|
1919
1940
|
),
|
|
1920
1941
|
/* @__PURE__ */ d("p", { className: "dw-font-normal dw-text-[12px] dw-text-[var(--dw-fg)]", children: "Slippage limit" })
|
|
1921
1942
|
] }),
|
|
1922
|
-
/* @__PURE__ */
|
|
1943
|
+
/* @__PURE__ */ A("div", { className: "dw-flex dw-items-center dw-gap-1 dw-mt-3 dw-flex-wrap", children: [
|
|
1923
1944
|
e.map((m, u) => /* @__PURE__ */ d(
|
|
1924
1945
|
"button",
|
|
1925
1946
|
{
|
|
@@ -1930,7 +1951,7 @@ function an(t) {
|
|
|
1930
1951
|
},
|
|
1931
1952
|
m
|
|
1932
1953
|
)),
|
|
1933
|
-
/* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ A(
|
|
1934
1955
|
"div",
|
|
1935
1956
|
{
|
|
1936
1957
|
className: `dw-relative dw-w-[72px] dw-h-[30px] dw-flex dw-items-center dw-justify-center dw-rounded-[6px] dw-border ${n === null && h ? "dw-border-[var(--dw-accent)] dw-bg-[var(--dw-surface-hover)]" : "dw-border-[var(--dw-border)] dw-bg-[var(--dw-surface-alt)]"}`,
|
|
@@ -1941,7 +1962,7 @@ function an(t) {
|
|
|
1941
1962
|
type: "text",
|
|
1942
1963
|
placeholder: "Custom",
|
|
1943
1964
|
value: h,
|
|
1944
|
-
onChange:
|
|
1965
|
+
onChange: k,
|
|
1945
1966
|
onFocus: () => a(""),
|
|
1946
1967
|
maxLength: 4,
|
|
1947
1968
|
className: "dw-w-10 dw-font-normal dw-text-[11px] dw-text-[var(--dw-fg)] dw-bg-transparent dw-border-none dw-outline-none dw-text-center"
|
|
@@ -1965,14 +1986,14 @@ function an(t) {
|
|
|
1965
1986
|
}
|
|
1966
1987
|
) });
|
|
1967
1988
|
}
|
|
1968
|
-
function
|
|
1989
|
+
function wn() {
|
|
1969
1990
|
return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ d("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) });
|
|
1970
1991
|
}
|
|
1971
1992
|
function Ze(t) {
|
|
1972
|
-
return t === "EVM" ?
|
|
1993
|
+
return t === "EVM" ? nt : t === "SVM" ? rt : ot;
|
|
1973
1994
|
}
|
|
1974
|
-
function
|
|
1975
|
-
var
|
|
1995
|
+
function gn(t) {
|
|
1996
|
+
var $, l, C, g, y, c, f, S;
|
|
1976
1997
|
const {
|
|
1977
1998
|
theme: e = "dark",
|
|
1978
1999
|
vars: n,
|
|
@@ -1983,28 +2004,27 @@ function pn(t) {
|
|
|
1983
2004
|
} = t, w = et(e, n), p = {
|
|
1984
2005
|
...tt(w),
|
|
1985
2006
|
...s
|
|
1986
|
-
},
|
|
1987
|
-
dataBaseUrl: a.dataBaseUrl,
|
|
2007
|
+
}, k = a.assetBaseUrl ?? a.dataBaseUrl ?? a.apiBase ?? (typeof window < "u" ? window.location.origin : ""), [x, m] = U(null), [u, v] = U(null), o = zt({
|
|
1988
2008
|
apiBase: a.apiBase
|
|
1989
|
-
}),
|
|
2009
|
+
}), M = ie(() => {
|
|
1990
2010
|
var G;
|
|
1991
|
-
const
|
|
1992
|
-
if (!T ||
|
|
1993
|
-
const J =
|
|
1994
|
-
return J ? [...
|
|
1995
|
-
}, [o.networks, (
|
|
1996
|
-
const
|
|
1997
|
-
return o.networks.filter((T) => !
|
|
1998
|
-
}, [o.networks,
|
|
2011
|
+
const N = o.networks, T = (G = o.networkSell) == null ? void 0 : G.id, P = N.slice(0, 6);
|
|
2012
|
+
if (!T || P.some((H) => H.id === T)) return P;
|
|
2013
|
+
const J = N.find((H) => H.id === T);
|
|
2014
|
+
return J ? [...P.slice(0, 5), J] : P;
|
|
2015
|
+
}, [o.networks, ($ = o.networkSell) == null ? void 0 : $.id]), R = ie(() => {
|
|
2016
|
+
const N = new Set(M.map((T) => T.id));
|
|
2017
|
+
return o.networks.filter((T) => !N.has(T.id));
|
|
2018
|
+
}, [o.networks, M]), O = ie(() => {
|
|
1999
2019
|
var G;
|
|
2000
|
-
const
|
|
2001
|
-
if (!T ||
|
|
2002
|
-
const J =
|
|
2003
|
-
return J ? [...
|
|
2020
|
+
const N = o.networks, T = (G = o.networkBuy) == null ? void 0 : G.id, P = N.slice(0, 6);
|
|
2021
|
+
if (!T || P.some((H) => H.id === T)) return P;
|
|
2022
|
+
const J = N.find((H) => H.id === T);
|
|
2023
|
+
return J ? [...P.slice(0, 5), J] : P;
|
|
2004
2024
|
}, [o.networks, (l = o.networkBuy) == null ? void 0 : l.id]), L = ie(() => {
|
|
2005
|
-
const
|
|
2006
|
-
return o.networks.filter((T) => !
|
|
2007
|
-
}, [o.networks,
|
|
2025
|
+
const N = new Set(O.map((T) => T.id));
|
|
2026
|
+
return o.networks.filter((T) => !N.has(T.id));
|
|
2027
|
+
}, [o.networks, O]), V = (N) => Math.trunc(N * 1e6) / 1e6;
|
|
2008
2028
|
return o.loading ? /* @__PURE__ */ d(
|
|
2009
2029
|
"div",
|
|
2010
2030
|
{
|
|
@@ -2023,7 +2043,7 @@ function pn(t) {
|
|
|
2023
2043
|
...i,
|
|
2024
2044
|
children: /* @__PURE__ */ d("p", { className: "dw-text-[#ff7e7e]", children: o.error })
|
|
2025
2045
|
}
|
|
2026
|
-
) : /* @__PURE__ */
|
|
2046
|
+
) : /* @__PURE__ */ A(
|
|
2027
2047
|
"div",
|
|
2028
2048
|
{
|
|
2029
2049
|
"data-delora-widget-root": !0,
|
|
@@ -2032,16 +2052,16 @@ function pn(t) {
|
|
|
2032
2052
|
...i,
|
|
2033
2053
|
children: [
|
|
2034
2054
|
/* @__PURE__ */ d(
|
|
2035
|
-
|
|
2055
|
+
Gt,
|
|
2036
2056
|
{
|
|
2037
|
-
assetBaseUrl:
|
|
2057
|
+
assetBaseUrl: k,
|
|
2038
2058
|
sellToken: o.sellToken,
|
|
2039
2059
|
buyToken: o.buyToken,
|
|
2040
|
-
networkSellLogo: (
|
|
2060
|
+
networkSellLogo: (C = o.networkSell) == null ? void 0 : C.logoURI,
|
|
2041
2061
|
networkBuyLogo: (g = o.networkBuy) == null ? void 0 : g.logoURI,
|
|
2042
2062
|
sellAmountForInput: o.sellAmountForInput,
|
|
2043
2063
|
buyAmountForInput: o.buyAmountForInput,
|
|
2044
|
-
onSellAmountChange: (
|
|
2064
|
+
onSellAmountChange: (N) => o.setSellAmountForInput(N),
|
|
2045
2065
|
onSellInputProcess: o.processSellInput,
|
|
2046
2066
|
onOpenSellToken: () => m("tokenSell"),
|
|
2047
2067
|
onOpenBuyToken: () => m("tokenBuy"),
|
|
@@ -2072,7 +2092,7 @@ function pn(t) {
|
|
|
2072
2092
|
loading: o.buttonState === "finding",
|
|
2073
2093
|
price: o.price,
|
|
2074
2094
|
gasCostUSD: o.gasCostUSD,
|
|
2075
|
-
truncateTo6Decimals:
|
|
2095
|
+
truncateTo6Decimals: V,
|
|
2076
2096
|
isWalletConnected: !!a.isWalletConnected,
|
|
2077
2097
|
onConnectWallet: a.onConnectWallet
|
|
2078
2098
|
}
|
|
@@ -2087,18 +2107,18 @@ function pn(t) {
|
|
|
2087
2107
|
excludeToken: o.buyToken,
|
|
2088
2108
|
getAllTokensForNetwork: o.getAllTokensForNetworkId,
|
|
2089
2109
|
getNetworkById: o.getNetworkById,
|
|
2090
|
-
displayedNetworks:
|
|
2091
|
-
additionalNetworksCount:
|
|
2092
|
-
onOpenNetworkSelector: () =>
|
|
2093
|
-
onSelectToken: (
|
|
2094
|
-
o.setSellToken(
|
|
2110
|
+
displayedNetworks: M,
|
|
2111
|
+
additionalNetworksCount: R.length,
|
|
2112
|
+
onOpenNetworkSelector: () => v("sell"),
|
|
2113
|
+
onSelectToken: (N) => {
|
|
2114
|
+
o.setSellToken(N), o.cancelRequest(), m(null);
|
|
2095
2115
|
},
|
|
2096
|
-
onSelectNetwork: (
|
|
2116
|
+
onSelectNetwork: (N) => {
|
|
2097
2117
|
var T;
|
|
2098
|
-
o.updateNetworkSell(
|
|
2118
|
+
o.updateNetworkSell(N.id), ((T = o.networkBuy) == null ? void 0 : T.id) !== N.id && o.setNetworkBuy(N);
|
|
2099
2119
|
},
|
|
2100
2120
|
onClose: () => m(null),
|
|
2101
|
-
assetBaseUrl:
|
|
2121
|
+
assetBaseUrl: k
|
|
2102
2122
|
}
|
|
2103
2123
|
),
|
|
2104
2124
|
x === "tokenBuy" && /* @__PURE__ */ d(
|
|
@@ -2106,57 +2126,57 @@ function pn(t) {
|
|
|
2106
2126
|
{
|
|
2107
2127
|
mode: "buy",
|
|
2108
2128
|
networks: o.networks,
|
|
2109
|
-
selectedNetworkId: (
|
|
2129
|
+
selectedNetworkId: (S = o.networkBuy) == null ? void 0 : S.id,
|
|
2110
2130
|
selectedToken: o.buyToken,
|
|
2111
2131
|
excludeToken: o.sellToken,
|
|
2112
2132
|
getAllTokensForNetwork: o.getAllTokensForNetworkId,
|
|
2113
2133
|
getNetworkById: o.getNetworkById,
|
|
2114
|
-
displayedNetworks:
|
|
2134
|
+
displayedNetworks: O,
|
|
2115
2135
|
additionalNetworksCount: L.length,
|
|
2116
|
-
onOpenNetworkSelector: () =>
|
|
2117
|
-
onSelectToken: (
|
|
2118
|
-
o.setBuyToken(
|
|
2136
|
+
onOpenNetworkSelector: () => v("buy"),
|
|
2137
|
+
onSelectToken: (N) => {
|
|
2138
|
+
o.setBuyToken(N), o.cancelRequest(), m(null);
|
|
2119
2139
|
},
|
|
2120
|
-
onSelectNetwork: (
|
|
2121
|
-
o.setNetworkBuy(
|
|
2140
|
+
onSelectNetwork: (N) => {
|
|
2141
|
+
o.setNetworkBuy(N);
|
|
2122
2142
|
},
|
|
2123
2143
|
onClose: () => m(null),
|
|
2124
|
-
assetBaseUrl:
|
|
2144
|
+
assetBaseUrl: k
|
|
2125
2145
|
}
|
|
2126
2146
|
),
|
|
2127
2147
|
u === "sell" && x === "tokenSell" && /* @__PURE__ */ d(
|
|
2128
2148
|
Xe,
|
|
2129
2149
|
{
|
|
2130
|
-
networks:
|
|
2131
|
-
assetBaseUrl:
|
|
2132
|
-
onSelectNetwork: (
|
|
2150
|
+
networks: R,
|
|
2151
|
+
assetBaseUrl: k,
|
|
2152
|
+
onSelectNetwork: (N) => {
|
|
2133
2153
|
var T;
|
|
2134
|
-
o.updateNetworkSell(
|
|
2154
|
+
o.updateNetworkSell(N.id), ((T = o.networkBuy) == null ? void 0 : T.id) !== N.id && o.setNetworkBuy(N), v(null);
|
|
2135
2155
|
},
|
|
2136
|
-
onClose: () =>
|
|
2156
|
+
onClose: () => v(null)
|
|
2137
2157
|
}
|
|
2138
2158
|
),
|
|
2139
2159
|
u === "buy" && x === "tokenBuy" && /* @__PURE__ */ d(
|
|
2140
2160
|
Xe,
|
|
2141
2161
|
{
|
|
2142
2162
|
networks: L,
|
|
2143
|
-
assetBaseUrl:
|
|
2144
|
-
onSelectNetwork: (
|
|
2145
|
-
o.setNetworkBuy(
|
|
2163
|
+
assetBaseUrl: k,
|
|
2164
|
+
onSelectNetwork: (N) => {
|
|
2165
|
+
o.setNetworkBuy(N), v(null);
|
|
2146
2166
|
},
|
|
2147
|
-
onClose: () =>
|
|
2167
|
+
onClose: () => v(null)
|
|
2148
2168
|
}
|
|
2149
2169
|
),
|
|
2150
2170
|
x === "settings" && /* @__PURE__ */ d(
|
|
2151
|
-
|
|
2171
|
+
cn,
|
|
2152
2172
|
{
|
|
2153
2173
|
options: o.slippage.options,
|
|
2154
2174
|
selectedIndex: o.slippage.selectedIndex,
|
|
2155
2175
|
customValue: o.slippage.customValue,
|
|
2156
2176
|
onSelectOption: o.slippage.selectOption,
|
|
2157
2177
|
onCustomChange: o.slippage.setCustom,
|
|
2158
|
-
onSave: (
|
|
2159
|
-
o.slippage.save(
|
|
2178
|
+
onSave: (N) => {
|
|
2179
|
+
o.slippage.save(N), m(null);
|
|
2160
2180
|
},
|
|
2161
2181
|
onClose: () => m(null)
|
|
2162
2182
|
}
|
|
@@ -2166,7 +2186,7 @@ function pn(t) {
|
|
|
2166
2186
|
);
|
|
2167
2187
|
}
|
|
2168
2188
|
export {
|
|
2169
|
-
|
|
2170
|
-
|
|
2189
|
+
mn as MyWidget,
|
|
2190
|
+
gn as TradeWidget
|
|
2171
2191
|
};
|
|
2172
2192
|
//# sourceMappingURL=index.js.map
|