@orbs-network/spot-react 1.1.39 → 1.1.40
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/dist/spot-react/package.json.d.ts +1 -1
- package/dist/spot-react/src/hooks/order-hooks.d.ts.map +1 -1
- package/dist/spot-react/src/spot-context.d.ts.map +1 -1
- package/dist/spot-react/src/types.d.ts +2 -0
- package/dist/spot-react/src/types.d.ts.map +1 -1
- package/dist/spot-react.js +493 -490
- package/dist/spot-react.umd.cjs +7 -7
- package/package.json +1 -1
package/dist/spot-react.js
CHANGED
|
@@ -4,13 +4,13 @@ var wr = (e) => {
|
|
|
4
4
|
};
|
|
5
5
|
var Hs = (e, t, n) => t in e ? Ks(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6
6
|
var fn = (e, t, n) => Hs(e, typeof t != "symbol" ? t + "" : t, n), _n = (e, t, n) => t.has(e) || wr("Cannot " + n);
|
|
7
|
-
var
|
|
7
|
+
var l = (e, t, n) => (_n(e, t, "read from private field"), n ? n.call(e) : t.get(e)), L = (e, t, n) => t.has(e) ? wr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), I = (e, t, n, r) => (_n(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), W = (e, t, n) => (_n(e, t, "access private method"), n);
|
|
8
8
|
var pn = (e, t, n, r) => ({
|
|
9
9
|
set _(s) {
|
|
10
10
|
I(e, t, s, n);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return
|
|
13
|
+
return l(e, t, r);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
import { jsx as Ne, jsxs as Ws, Fragment as zs } from "react/jsx-runtime";
|
|
@@ -1146,7 +1146,7 @@ var on = /* @__PURE__ */ ((e) => (e.FRESHNESS = "freshness", e.MIN_CHUNK_SIZE_US
|
|
|
1146
1146
|
const Da = "-5", Sa = "10", va = "-10", Pa = "5";
|
|
1147
1147
|
var Oa = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Mn = Math.ceil, Pe = Math.floor, we = "[BigNumber Error] ", Sr = we + "Number primitive has more than 15 significant digits: ", ke = 1e14, H = 14, Ln = 9007199254740991, Nn = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], tt = 1e7, ue = 1e9;
|
|
1148
1148
|
function cs(e) {
|
|
1149
|
-
var t, n, r, s = F.prototype = { constructor: F, toString: null, valueOf: null }, a = new F(1), o = 20, d = 4,
|
|
1149
|
+
var t, n, r, s = F.prototype = { constructor: F, toString: null, valueOf: null }, a = new F(1), o = 20, d = 4, f = -7, h = 21, C = -1e7, y = 1e7, E = !1, S = 1, v = 0, O = {
|
|
1150
1150
|
prefix: "",
|
|
1151
1151
|
groupSize: 3,
|
|
1152
1152
|
secondaryGroupSize: 0,
|
|
@@ -1227,7 +1227,7 @@ function cs(e) {
|
|
|
1227
1227
|
var c, u;
|
|
1228
1228
|
if (i != null)
|
|
1229
1229
|
if (typeof i == "object") {
|
|
1230
|
-
if (i.hasOwnProperty(c = "DECIMAL_PLACES") && (u = i[c], ne(u, 0, ue, c), o = u), i.hasOwnProperty(c = "ROUNDING_MODE") && (u = i[c], ne(u, 0, 8, c), d = u), i.hasOwnProperty(c = "EXPONENTIAL_AT") && (u = i[c], u && u.pop ? (ne(u[0], -ue, 0, c), ne(u[1], 0, ue, c),
|
|
1230
|
+
if (i.hasOwnProperty(c = "DECIMAL_PLACES") && (u = i[c], ne(u, 0, ue, c), o = u), i.hasOwnProperty(c = "ROUNDING_MODE") && (u = i[c], ne(u, 0, 8, c), d = u), i.hasOwnProperty(c = "EXPONENTIAL_AT") && (u = i[c], u && u.pop ? (ne(u[0], -ue, 0, c), ne(u[1], 0, ue, c), f = u[0], h = u[1]) : (ne(u, -ue, ue, c), f = -(h = u < 0 ? -u : u))), i.hasOwnProperty(c = "RANGE"))
|
|
1231
1231
|
if (u = i[c], u && u.pop)
|
|
1232
1232
|
ne(u[0], -ue, -1, c), ne(u[1], 1, ue, c), C = u[0], y = u[1];
|
|
1233
1233
|
else if (ne(u, -ue, ue, c), u)
|
|
@@ -1245,7 +1245,7 @@ function cs(e) {
|
|
|
1245
1245
|
E = u;
|
|
1246
1246
|
else
|
|
1247
1247
|
throw Error(we + c + " not true or false: " + u);
|
|
1248
|
-
if (i.hasOwnProperty(c = "MODULO_MODE") && (u = i[c], ne(u, 0, 9, c), S = u), i.hasOwnProperty(c = "POW_PRECISION") && (u = i[c], ne(u, 0, ue, c),
|
|
1248
|
+
if (i.hasOwnProperty(c = "MODULO_MODE") && (u = i[c], ne(u, 0, 9, c), S = u), i.hasOwnProperty(c = "POW_PRECISION") && (u = i[c], ne(u, 0, ue, c), v = u), i.hasOwnProperty(c = "FORMAT"))
|
|
1249
1249
|
if (u = i[c], typeof u == "object") O = u;
|
|
1250
1250
|
else throw Error(we + c + " not an object: " + u);
|
|
1251
1251
|
if (i.hasOwnProperty(c = "ALPHABET"))
|
|
@@ -1258,11 +1258,11 @@ function cs(e) {
|
|
|
1258
1258
|
return {
|
|
1259
1259
|
DECIMAL_PLACES: o,
|
|
1260
1260
|
ROUNDING_MODE: d,
|
|
1261
|
-
EXPONENTIAL_AT: [
|
|
1261
|
+
EXPONENTIAL_AT: [f, h],
|
|
1262
1262
|
RANGE: [C, y],
|
|
1263
1263
|
CRYPTO: E,
|
|
1264
1264
|
MODULO_MODE: S,
|
|
1265
|
-
POW_PRECISION:
|
|
1265
|
+
POW_PRECISION: v,
|
|
1266
1266
|
FORMAT: O,
|
|
1267
1267
|
ALPHABET: B
|
|
1268
1268
|
};
|
|
@@ -1335,18 +1335,18 @@ function cs(e) {
|
|
|
1335
1335
|
return p.reverse();
|
|
1336
1336
|
}
|
|
1337
1337
|
return function(u, b, m, A, w) {
|
|
1338
|
-
var p, g, T, x,
|
|
1339
|
-
for (re >= 0 && (x =
|
|
1338
|
+
var p, g, T, x, P, U, M, V, re = u.indexOf("."), oe = o, Z = d;
|
|
1339
|
+
for (re >= 0 && (x = v, v = 0, u = u.replace(".", ""), V = new F(b), U = V.pow(u.length - re), v = x, V.c = c(
|
|
1340
1340
|
Ve(ve(U.c), U.e, "0"),
|
|
1341
1341
|
10,
|
|
1342
1342
|
m,
|
|
1343
1343
|
i
|
|
1344
1344
|
), V.e = V.c.length), M = c(u, b, m, w ? (p = B, i) : (p = i, B)), T = x = M.length; M[--x] == 0; M.pop()) ;
|
|
1345
1345
|
if (!M[0]) return p.charAt(0);
|
|
1346
|
-
if (re < 0 ? --T : (U.c = M, U.e = T, U.s = A, U = t(U, V, oe, Z, m), M = U.c,
|
|
1347
|
-
u =
|
|
1346
|
+
if (re < 0 ? --T : (U.c = M, U.e = T, U.s = A, U = t(U, V, oe, Z, m), M = U.c, P = U.r, T = U.e), g = T + oe + 1, re = M[g], x = m / 2, P = P || g < 0 || M[g + 1] != null, P = Z < 4 ? (re != null || P) && (Z == 0 || Z == (U.s < 0 ? 3 : 2)) : re > x || re == x && (Z == 4 || P || Z == 6 && M[g - 1] & 1 || Z == (U.s < 0 ? 8 : 7)), g < 1 || !M[0])
|
|
1347
|
+
u = P ? Ve(p.charAt(1), -oe, p.charAt(0)) : p.charAt(0);
|
|
1348
1348
|
else {
|
|
1349
|
-
if (M.length = g,
|
|
1349
|
+
if (M.length = g, P)
|
|
1350
1350
|
for (--m; ++M[--g] > m; )
|
|
1351
1351
|
M[g] = 0, g || (++T, M = [1].concat(M));
|
|
1352
1352
|
for (x = M.length; !M[--x]; ) ;
|
|
@@ -1357,9 +1357,9 @@ function cs(e) {
|
|
|
1357
1357
|
};
|
|
1358
1358
|
})(), t = /* @__PURE__ */ (function() {
|
|
1359
1359
|
function i(b, m, A) {
|
|
1360
|
-
var w, p, g, T, x = 0,
|
|
1361
|
-
for (b = b.slice();
|
|
1362
|
-
g = b[
|
|
1360
|
+
var w, p, g, T, x = 0, P = b.length, U = m % tt, M = m / tt | 0;
|
|
1361
|
+
for (b = b.slice(); P--; )
|
|
1362
|
+
g = b[P] % tt, T = b[P] / tt | 0, w = M * g + T * U, p = U * g + w % tt * tt + x, x = (p / A | 0) + (w / tt | 0) + M * T, b[P] = p % A;
|
|
1363
1363
|
return x && (b = [x].concat(b)), b;
|
|
1364
1364
|
}
|
|
1365
1365
|
function c(b, m, A, w) {
|
|
@@ -1380,7 +1380,7 @@ function cs(e) {
|
|
|
1380
1380
|
for (; !b[0] && b.length > 1; b.splice(0, 1)) ;
|
|
1381
1381
|
}
|
|
1382
1382
|
return function(b, m, A, w, p) {
|
|
1383
|
-
var g, T, x,
|
|
1383
|
+
var g, T, x, P, U, M, V, re, oe, Z, J, he, ln, Rn, kn, qe, Yt, Se = b.s == m.s ? 1 : -1, ye = b.c, se = m.c;
|
|
1384
1384
|
if (!ye || !ye[0] || !se || !se[0])
|
|
1385
1385
|
return new F(
|
|
1386
1386
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
@@ -1391,7 +1391,7 @@ function cs(e) {
|
|
|
1391
1391
|
);
|
|
1392
1392
|
for (re = new F(Se), oe = re.c = [], T = b.e - m.e, Se = A + T + 1, p || (p = ke, T = Oe(b.e / H) - Oe(m.e / H), Se = Se / H | 0), x = 0; se[x] == (ye[x] || 0); x++) ;
|
|
1393
1393
|
if (se[x] > (ye[x] || 0) && T--, Se < 0)
|
|
1394
|
-
oe.push(1),
|
|
1394
|
+
oe.push(1), P = !0;
|
|
1395
1395
|
else {
|
|
1396
1396
|
for (Rn = ye.length, qe = se.length, x = 0, Se += 2, U = Pe(p / (se[0] + 1)), U > 1 && (se = i(se, U, p), ye = i(ye, U, p), qe = se.length, Rn = ye.length), ln = qe, Z = ye.slice(0, qe), J = Z.length; J < qe; Z[J++] = 0) ;
|
|
1397
1397
|
Yt = se.slice(), Yt = [0].concat(Yt), kn = se[0], se[1] >= p / 2 && kn++;
|
|
@@ -1408,13 +1408,13 @@ function cs(e) {
|
|
|
1408
1408
|
} else g === 0 && (U++, Z = [0]);
|
|
1409
1409
|
oe[x++] = U, Z[0] ? Z[J++] = ye[ln] || 0 : (Z = [ye[ln]], J = 1);
|
|
1410
1410
|
} while ((ln++ < Rn || Z[0] != null) && Se--);
|
|
1411
|
-
|
|
1411
|
+
P = Z[0] != null, oe[0] || oe.splice(0, 1);
|
|
1412
1412
|
}
|
|
1413
1413
|
if (p == ke) {
|
|
1414
1414
|
for (x = 1, Se = oe[0]; Se >= 10; Se /= 10, x++) ;
|
|
1415
|
-
z(re, A + (re.e = x + T * H - 1) + 1, w,
|
|
1415
|
+
z(re, A + (re.e = x + T * H - 1) + 1, w, P);
|
|
1416
1416
|
} else
|
|
1417
|
-
re.e = T, re.r = +
|
|
1417
|
+
re.e = T, re.r = +P;
|
|
1418
1418
|
return re;
|
|
1419
1419
|
};
|
|
1420
1420
|
})();
|
|
@@ -1422,8 +1422,8 @@ function cs(e) {
|
|
|
1422
1422
|
var m, A, w, p, g;
|
|
1423
1423
|
if (u == null ? u = d : ne(u, 0, 8), !i.c) return i.toString();
|
|
1424
1424
|
if (m = i.c[0], w = i.e, c == null)
|
|
1425
|
-
g = ve(i.c), g = b == 1 || b == 2 && (w <=
|
|
1426
|
-
else if (i = z(new F(i), c, u), A = i.e, g = ve(i.c), p = g.length, b == 1 || b == 2 && (c <= A || A <=
|
|
1425
|
+
g = ve(i.c), g = b == 1 || b == 2 && (w <= f || w >= h) ? yn(g, w) : Ve(g, w, "0");
|
|
1426
|
+
else if (i = z(new F(i), c, u), A = i.e, g = ve(i.c), p = g.length, b == 1 || b == 2 && (c <= A || A <= f)) {
|
|
1427
1427
|
for (; p < c; g += "0", p++) ;
|
|
1428
1428
|
g = yn(g, A);
|
|
1429
1429
|
} else if (c -= w + (b === 2 && A > w), g = Ve(g, A, "0"), A + 1 > p) {
|
|
@@ -1449,8 +1449,8 @@ function cs(e) {
|
|
|
1449
1449
|
if (b.test(x))
|
|
1450
1450
|
A.s = isNaN(x) ? null : x < 0 ? -1 : 1;
|
|
1451
1451
|
else {
|
|
1452
|
-
if (!p && (x = x.replace(i, function(
|
|
1453
|
-
return T = (M = M.toLowerCase()) == "x" ? 16 : M == "b" ? 2 : 8, !g || g == T ? U :
|
|
1452
|
+
if (!p && (x = x.replace(i, function(P, U, M) {
|
|
1453
|
+
return T = (M = M.toLowerCase()) == "x" ? 16 : M == "b" ? 2 : 8, !g || g == T ? U : P;
|
|
1454
1454
|
}), g && (T = g, x = x.replace(c, "$1").replace(u, "0.$1")), w != x))
|
|
1455
1455
|
return new F(x, T);
|
|
1456
1456
|
if (F.DEBUG)
|
|
@@ -1461,40 +1461,40 @@ function cs(e) {
|
|
|
1461
1461
|
};
|
|
1462
1462
|
})();
|
|
1463
1463
|
function z(i, c, u, b) {
|
|
1464
|
-
var m, A, w, p, g, T, x,
|
|
1465
|
-
if (
|
|
1464
|
+
var m, A, w, p, g, T, x, P = i.c, U = Nn;
|
|
1465
|
+
if (P) {
|
|
1466
1466
|
e: {
|
|
1467
|
-
for (m = 1, p =
|
|
1467
|
+
for (m = 1, p = P[0]; p >= 10; p /= 10, m++) ;
|
|
1468
1468
|
if (A = c - m, A < 0)
|
|
1469
|
-
A += H, w = c, g =
|
|
1470
|
-
else if (T = Mn((A + 1) / H), T >=
|
|
1469
|
+
A += H, w = c, g = P[T = 0], x = Pe(g / U[m - w - 1] % 10);
|
|
1470
|
+
else if (T = Mn((A + 1) / H), T >= P.length)
|
|
1471
1471
|
if (b) {
|
|
1472
|
-
for (;
|
|
1472
|
+
for (; P.length <= T; P.push(0)) ;
|
|
1473
1473
|
g = x = 0, m = 1, A %= H, w = A - H + 1;
|
|
1474
1474
|
} else
|
|
1475
1475
|
break e;
|
|
1476
1476
|
else {
|
|
1477
|
-
for (g = p =
|
|
1477
|
+
for (g = p = P[T], m = 1; p >= 10; p /= 10, m++) ;
|
|
1478
1478
|
A %= H, w = A - H + m, x = w < 0 ? 0 : Pe(g / U[m - w - 1] % 10);
|
|
1479
1479
|
}
|
|
1480
1480
|
if (b = b || c < 0 || // Are there any non-zero digits after the rounding digit?
|
|
1481
1481
|
// The expression n % pows10[d - j - 1] returns all digits of n to the right
|
|
1482
1482
|
// of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
|
|
1483
|
-
|
|
1484
|
-
(A > 0 ? w > 0 ? g / U[m - w] : 0 :
|
|
1485
|
-
return
|
|
1486
|
-
if (A == 0 ? (
|
|
1483
|
+
P[T + 1] != null || (w < 0 ? g : g % U[m - w - 1]), b = u < 4 ? (x || b) && (u == 0 || u == (i.s < 0 ? 3 : 2)) : x > 5 || x == 5 && (u == 4 || b || u == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
1484
|
+
(A > 0 ? w > 0 ? g / U[m - w] : 0 : P[T - 1]) % 10 & 1 || u == (i.s < 0 ? 8 : 7)), c < 1 || !P[0])
|
|
1485
|
+
return P.length = 0, b ? (c -= i.e + 1, P[0] = U[(H - c % H) % H], i.e = -c || 0) : P[0] = i.e = 0, i;
|
|
1486
|
+
if (A == 0 ? (P.length = T, p = 1, T--) : (P.length = T + 1, p = U[H - A], P[T] = w > 0 ? Pe(g / U[m - w] % U[w]) * p : 0), b)
|
|
1487
1487
|
for (; ; )
|
|
1488
1488
|
if (T == 0) {
|
|
1489
|
-
for (A = 1, w =
|
|
1490
|
-
for (w =
|
|
1491
|
-
A != p && (i.e++,
|
|
1489
|
+
for (A = 1, w = P[0]; w >= 10; w /= 10, A++) ;
|
|
1490
|
+
for (w = P[0] += p, p = 1; w >= 10; w /= 10, p++) ;
|
|
1491
|
+
A != p && (i.e++, P[0] == ke && (P[0] = 1));
|
|
1492
1492
|
break;
|
|
1493
1493
|
} else {
|
|
1494
|
-
if (
|
|
1495
|
-
|
|
1494
|
+
if (P[T] += p, P[T] != ke) break;
|
|
1495
|
+
P[T--] = 0, p = 1;
|
|
1496
1496
|
}
|
|
1497
|
-
for (A =
|
|
1497
|
+
for (A = P.length; P[--A] === 0; P.pop()) ;
|
|
1498
1498
|
}
|
|
1499
1499
|
i.e > y ? i.c = i.e = null : i.e < C && (i.c = [i.e = 0]);
|
|
1500
1500
|
}
|
|
@@ -1502,7 +1502,7 @@ function cs(e) {
|
|
|
1502
1502
|
}
|
|
1503
1503
|
function ie(i) {
|
|
1504
1504
|
var c, u = i.e;
|
|
1505
|
-
return u === null ? i.toString() : (c = ve(i.c), c = u <=
|
|
1505
|
+
return u === null ? i.toString() : (c = ve(i.c), c = u <= f || u >= h ? yn(c, u) : Ve(c, u, "0"), i.s < 0 ? "-" + c : c);
|
|
1506
1506
|
}
|
|
1507
1507
|
return s.absoluteValue = s.abs = function() {
|
|
1508
1508
|
var i = new F(this);
|
|
@@ -1521,22 +1521,22 @@ function cs(e) {
|
|
|
1521
1521
|
}, s.dividedToIntegerBy = s.idiv = function(i, c) {
|
|
1522
1522
|
return t(this, new F(i, c), 0, 1);
|
|
1523
1523
|
}, s.exponentiatedBy = s.pow = function(i, c) {
|
|
1524
|
-
var u, b, m, A, w, p, g, T, x,
|
|
1524
|
+
var u, b, m, A, w, p, g, T, x, P = this;
|
|
1525
1525
|
if (i = new F(i), i.c && !i.isInteger())
|
|
1526
1526
|
throw Error(we + "Exponent not an integer: " + ie(i));
|
|
1527
|
-
if (c != null && (c = new F(c)), p = i.e > 14, !
|
|
1528
|
-
return x = new F(Math.pow(+ie(
|
|
1527
|
+
if (c != null && (c = new F(c)), p = i.e > 14, !P.c || !P.c[0] || P.c[0] == 1 && !P.e && P.c.length == 1 || !i.c || !i.c[0])
|
|
1528
|
+
return x = new F(Math.pow(+ie(P), p ? i.s * (2 - mn(i)) : +ie(i))), c ? x.mod(c) : x;
|
|
1529
1529
|
if (g = i.s < 0, c) {
|
|
1530
1530
|
if (c.c ? !c.c[0] : !c.s) return new F(NaN);
|
|
1531
|
-
b = !g &&
|
|
1531
|
+
b = !g && P.isInteger() && c.isInteger(), b && (P = P.mod(c));
|
|
1532
1532
|
} else {
|
|
1533
|
-
if (i.e > 9 && (
|
|
1534
|
-
return A =
|
|
1535
|
-
|
|
1533
|
+
if (i.e > 9 && (P.e > 0 || P.e < -1 || (P.e == 0 ? P.c[0] > 1 || p && P.c[1] >= 24e7 : P.c[0] < 8e13 || p && P.c[0] <= 9999975e7)))
|
|
1534
|
+
return A = P.s < 0 && mn(i) ? -0 : 0, P.e > -1 && (A = 1 / A), new F(g ? 1 / A : A);
|
|
1535
|
+
v && (A = Mn(v / H + 2));
|
|
1536
1536
|
}
|
|
1537
1537
|
for (p ? (u = new F(0.5), g && (i.s = 1), T = mn(i)) : (m = Math.abs(+ie(i)), T = m % 2), x = new F(a); ; ) {
|
|
1538
1538
|
if (T) {
|
|
1539
|
-
if (x = x.times(
|
|
1539
|
+
if (x = x.times(P), !x.c) break;
|
|
1540
1540
|
A ? x.c.length > A && (x.c.length = A) : b && (x = x.mod(c));
|
|
1541
1541
|
}
|
|
1542
1542
|
if (m) {
|
|
@@ -1548,9 +1548,9 @@ function cs(e) {
|
|
|
1548
1548
|
if (m = +ie(i), m === 0) break;
|
|
1549
1549
|
T = m % 2;
|
|
1550
1550
|
}
|
|
1551
|
-
|
|
1551
|
+
P = P.times(P), A ? P.c && P.c.length > A && (P.c.length = A) : b && (P = P.mod(c));
|
|
1552
1552
|
}
|
|
1553
|
-
return b ? x : (g && (x = a.div(x)), c ? x.mod(c) : A ? z(x,
|
|
1553
|
+
return b ? x : (g && (x = a.div(x)), c ? x.mod(c) : A ? z(x, v, d, w) : x);
|
|
1554
1554
|
}, s.integerValue = function(i) {
|
|
1555
1555
|
var c = new F(this);
|
|
1556
1556
|
return i == null ? i = d : ne(i, 0, 8), z(c, c.e + 1, i);
|
|
@@ -1581,31 +1581,31 @@ function cs(e) {
|
|
|
1581
1581
|
if (i = new F(i, c), c = i.s, !p || !c) return new F(NaN);
|
|
1582
1582
|
if (p != c)
|
|
1583
1583
|
return i.s = -c, w.plus(i);
|
|
1584
|
-
var g = w.e / H, T = i.e / H, x = w.c,
|
|
1584
|
+
var g = w.e / H, T = i.e / H, x = w.c, P = i.c;
|
|
1585
1585
|
if (!g || !T) {
|
|
1586
|
-
if (!x || !
|
|
1587
|
-
if (!x[0] || !
|
|
1588
|
-
return
|
|
1586
|
+
if (!x || !P) return x ? (i.s = -c, i) : new F(P ? w : NaN);
|
|
1587
|
+
if (!x[0] || !P[0])
|
|
1588
|
+
return P[0] ? (i.s = -c, i) : new F(x[0] ? w : (
|
|
1589
1589
|
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
1590
1590
|
d == 3 ? -0 : 0
|
|
1591
1591
|
));
|
|
1592
1592
|
}
|
|
1593
1593
|
if (g = Oe(g), T = Oe(T), x = x.slice(), p = g - T) {
|
|
1594
|
-
for ((A = p < 0) ? (p = -p, m = x) : (T = g, m =
|
|
1594
|
+
for ((A = p < 0) ? (p = -p, m = x) : (T = g, m = P), m.reverse(), c = p; c--; m.push(0)) ;
|
|
1595
1595
|
m.reverse();
|
|
1596
1596
|
} else
|
|
1597
|
-
for (b = (A = (p = x.length) < (c =
|
|
1598
|
-
if (x[c] !=
|
|
1599
|
-
A = x[c] <
|
|
1597
|
+
for (b = (A = (p = x.length) < (c = P.length)) ? p : c, p = c = 0; c < b; c++)
|
|
1598
|
+
if (x[c] != P[c]) {
|
|
1599
|
+
A = x[c] < P[c];
|
|
1600
1600
|
break;
|
|
1601
1601
|
}
|
|
1602
|
-
if (A && (m = x, x =
|
|
1602
|
+
if (A && (m = x, x = P, P = m, i.s = -i.s), c = (b = P.length) - (u = x.length), c > 0) for (; c--; x[u++] = 0) ;
|
|
1603
1603
|
for (c = ke - 1; b > p; ) {
|
|
1604
|
-
if (x[--b] <
|
|
1604
|
+
if (x[--b] < P[b]) {
|
|
1605
1605
|
for (u = b; u && !x[--u]; x[u] = c) ;
|
|
1606
1606
|
--x[u], x[b] += ke;
|
|
1607
1607
|
}
|
|
1608
|
-
x[b] -=
|
|
1608
|
+
x[b] -= P[b];
|
|
1609
1609
|
}
|
|
1610
1610
|
for (; x[0] == 0; x.splice(0, 1), --T) ;
|
|
1611
1611
|
return x[0] ? X(i, x, T) : (i.s = d == 3 ? -1 : 1, i.c = [i.e = 0], i);
|
|
@@ -1613,11 +1613,11 @@ function cs(e) {
|
|
|
1613
1613
|
var u, b, m = this;
|
|
1614
1614
|
return i = new F(i, c), !m.c || !i.s || i.c && !i.c[0] ? new F(NaN) : !i.c || m.c && !m.c[0] ? new F(m) : (S == 9 ? (b = i.s, i.s = 1, u = t(m, i, 0, 3), i.s = b, u.s *= b) : u = t(m, i, 0, S), i = m.minus(u.times(i)), !i.c[0] && S == 1 && (i.s = m.s), i);
|
|
1615
1615
|
}, s.multipliedBy = s.times = function(i, c) {
|
|
1616
|
-
var u, b, m, A, w, p, g, T, x,
|
|
1616
|
+
var u, b, m, A, w, p, g, T, x, P, U, M, V, re, oe, Z = this, J = Z.c, he = (i = new F(i, c)).c;
|
|
1617
1617
|
if (!J || !he || !J[0] || !he[0])
|
|
1618
1618
|
return !Z.s || !i.s || J && !J[0] && !he || he && !he[0] && !J ? i.c = i.e = i.s = null : (i.s *= Z.s, !J || !he ? i.c = i.e = null : (i.c = [0], i.e = 0)), i;
|
|
1619
|
-
for (b = Oe(Z.e / H) + Oe(i.e / H), i.s *= Z.s, g = J.length,
|
|
1620
|
-
for (re = ke, oe = tt, m =
|
|
1619
|
+
for (b = Oe(Z.e / H) + Oe(i.e / H), i.s *= Z.s, g = J.length, P = he.length, g < P && (V = J, J = he, he = V, m = g, g = P, P = m), m = g + P, V = []; m--; V.push(0)) ;
|
|
1620
|
+
for (re = ke, oe = tt, m = P; --m >= 0; ) {
|
|
1621
1621
|
for (u = 0, U = he[m] % oe, M = he[m] / oe | 0, w = g, A = m + w; A > m; )
|
|
1622
1622
|
T = J[--w] % oe, x = J[w] / oe | 0, p = M * T + x * U, T = U * T + p % oe * oe + V[A] + u, u = (T / re | 0) + (p / oe | 0) + M * x, V[A--] = T % re;
|
|
1623
1623
|
V[A] = u;
|
|
@@ -1685,34 +1685,34 @@ function cs(e) {
|
|
|
1685
1685
|
else if (typeof u != "object")
|
|
1686
1686
|
throw Error(we + "Argument not an object: " + u);
|
|
1687
1687
|
if (b = m.toFixed(i, c), m.c) {
|
|
1688
|
-
var A, w = b.split("."), p = +u.groupSize, g = +u.secondaryGroupSize, T = u.groupSeparator || "", x = w[0],
|
|
1688
|
+
var A, w = b.split("."), p = +u.groupSize, g = +u.secondaryGroupSize, T = u.groupSeparator || "", x = w[0], P = w[1], U = m.s < 0, M = U ? x.slice(1) : x, V = M.length;
|
|
1689
1689
|
if (g && (A = p, p = g, g = A, V -= A), p > 0 && V > 0) {
|
|
1690
1690
|
for (A = V % p || p, x = M.substr(0, A); A < V; A += p) x += T + M.substr(A, p);
|
|
1691
1691
|
g > 0 && (x += T + M.slice(A)), U && (x = "-" + x);
|
|
1692
1692
|
}
|
|
1693
|
-
b =
|
|
1693
|
+
b = P ? x + (u.decimalSeparator || "") + ((g = +u.fractionGroupSize) ? P.replace(
|
|
1694
1694
|
new RegExp("\\d{" + g + "}\\B", "g"),
|
|
1695
1695
|
"$&" + (u.fractionGroupSeparator || "")
|
|
1696
|
-
) :
|
|
1696
|
+
) : P) : x;
|
|
1697
1697
|
}
|
|
1698
1698
|
return (u.prefix || "") + b + (u.suffix || "");
|
|
1699
1699
|
}, s.toFraction = function(i) {
|
|
1700
|
-
var c, u, b, m, A, w, p, g, T, x,
|
|
1700
|
+
var c, u, b, m, A, w, p, g, T, x, P, U, M = this, V = M.c;
|
|
1701
1701
|
if (i != null && (p = new F(i), !p.isInteger() && (p.c || p.s !== 1) || p.lt(a)))
|
|
1702
1702
|
throw Error(we + "Argument " + (p.isInteger() ? "out of range: " : "not an integer: ") + ie(p));
|
|
1703
1703
|
if (!V) return new F(M);
|
|
1704
1704
|
for (c = new F(a), T = u = new F(a), b = g = new F(a), U = ve(V), A = c.e = U.length - M.e - 1, c.c[0] = Nn[(w = A % H) < 0 ? H + w : w], i = !i || p.comparedTo(c) > 0 ? A > 0 ? c : T : p, w = y, y = 1 / 0, p = new F(U), g.c[0] = 0; x = t(p, c, 0, 1), m = u.plus(x.times(b)), m.comparedTo(i) != 1; )
|
|
1705
1705
|
u = b, b = m, T = g.plus(x.times(m = T)), g = m, c = p.minus(x.times(m = c)), p = m;
|
|
1706
|
-
return m = t(i.minus(u), b, 0, 1), g = g.plus(m.times(T)), u = u.plus(m.times(b)), g.s = T.s = M.s, A = A * 2,
|
|
1706
|
+
return m = t(i.minus(u), b, 0, 1), g = g.plus(m.times(T)), u = u.plus(m.times(b)), g.s = T.s = M.s, A = A * 2, P = t(T, b, A, d).minus(M).abs().comparedTo(
|
|
1707
1707
|
t(g, u, A, d).minus(M).abs()
|
|
1708
|
-
) < 1 ? [T, b] : [g, u], y = w,
|
|
1708
|
+
) < 1 ? [T, b] : [g, u], y = w, P;
|
|
1709
1709
|
}, s.toNumber = function() {
|
|
1710
1710
|
return +ie(this);
|
|
1711
1711
|
}, s.toPrecision = function(i, c) {
|
|
1712
1712
|
return i != null && ne(i, 1, ue), q(this, i, c, 2);
|
|
1713
1713
|
}, s.toString = function(i) {
|
|
1714
1714
|
var c, u = this, b = u.s, m = u.e;
|
|
1715
|
-
return m === null ? b ? (c = "Infinity", b < 0 && (c = "-" + c)) : c = "NaN" : (i == null ? c = m <=
|
|
1715
|
+
return m === null ? b ? (c = "Infinity", b < 0 && (c = "-" + c)) : c = "NaN" : (i == null ? c = m <= f || m >= h ? yn(ve(u.c), m) : Ve(ve(u.c), m, "0") : i === 10 && k ? (u = z(new F(u), o + m + 1, d), c = Ve(ve(u.c), u.e, "0")) : (ne(i, 2, B.length, "Base"), c = n(Ve(ve(u.c), m, "0"), 10, i, b, !0)), b < 0 && u.c[0] && (c = "-" + c)), c;
|
|
1716
1716
|
}, s.valueOf = s.toJSON = function() {
|
|
1717
1717
|
return ie(this);
|
|
1718
1718
|
}, s._isBigNumber = !0, s[Symbol.toStringTag] = "BigNumber", s[Symbol.for("nodejs.util.inspect.custom")] = s.valueOf, e != null && F.set(e), F;
|
|
@@ -1730,14 +1730,14 @@ function ve(e) {
|
|
|
1730
1730
|
return a.slice(0, s + 1 || 1);
|
|
1731
1731
|
}
|
|
1732
1732
|
function ht(e, t) {
|
|
1733
|
-
var n, r, s = e.c, a = t.c, o = e.s, d = t.s,
|
|
1733
|
+
var n, r, s = e.c, a = t.c, o = e.s, d = t.s, f = e.e, h = t.e;
|
|
1734
1734
|
if (!o || !d) return null;
|
|
1735
1735
|
if (n = s && !s[0], r = a && !a[0], n || r) return n ? r ? 0 : -d : o;
|
|
1736
1736
|
if (o != d) return o;
|
|
1737
|
-
if (n = o < 0, r =
|
|
1738
|
-
if (!r) return
|
|
1739
|
-
for (d = (
|
|
1740
|
-
return
|
|
1737
|
+
if (n = o < 0, r = f == h, !s || !a) return r ? 0 : !s ^ n ? 1 : -1;
|
|
1738
|
+
if (!r) return f > h ^ n ? 1 : -1;
|
|
1739
|
+
for (d = (f = s.length) < (h = a.length) ? f : h, o = 0; o < d; o++) if (s[o] != a[o]) return s[o] > a[o] ^ n ? 1 : -1;
|
|
1740
|
+
return f == h ? 0 : f > h ^ n ? 1 : -1;
|
|
1741
1741
|
}
|
|
1742
1742
|
function ne(e, t, n, r) {
|
|
1743
1743
|
if (e < t || e > n || e !== Pe(e))
|
|
@@ -1808,13 +1808,13 @@ function Ra() {
|
|
|
1808
1808
|
}
|
|
1809
1809
|
function s(a, o) {
|
|
1810
1810
|
if (!a) return;
|
|
1811
|
-
const { dex: d, salt:
|
|
1811
|
+
const { dex: d, salt: f, ...h } = e["*"] ?? {}, C = e[a];
|
|
1812
1812
|
if (!C) return;
|
|
1813
|
-
const { dex: y, salt: E, ...S } = C,
|
|
1814
|
-
if (!O) return
|
|
1813
|
+
const { dex: y, salt: E, ...S } = C, v = { ...h, ...S }, O = o == null ? void 0 : o.trim();
|
|
1814
|
+
if (!O) return v;
|
|
1815
1815
|
const B = d == null ? void 0 : d[O], k = y == null ? void 0 : y[O];
|
|
1816
1816
|
if (!(!B && !k))
|
|
1817
|
-
return { ...
|
|
1817
|
+
return { ...v, ...B, ...k };
|
|
1818
1818
|
}
|
|
1819
1819
|
return qn = { config: s, adapters: r, abis: n, raw: e }, qn;
|
|
1820
1820
|
}
|
|
@@ -2023,12 +2023,12 @@ const Pt = (e) => e ? e.value * e.unit : 0, _a = (e) => !e || e === "NaN" ? "0"
|
|
|
2023
2023
|
return Object.entries(e).filter(([r]) => r !== "*").flatMap(([r, s]) => {
|
|
2024
2024
|
const a = Number(r), o = { ...t, ...(s == null ? void 0 : s.dex) ?? {} };
|
|
2025
2025
|
return !o || typeof o != "object" ? [] : Object.entries(o).flatMap(([d]) => {
|
|
2026
|
-
const
|
|
2027
|
-
return fs(
|
|
2026
|
+
const f = d;
|
|
2027
|
+
return fs(f, a) ? [
|
|
2028
2028
|
{
|
|
2029
2029
|
chainId: a,
|
|
2030
2030
|
name: d,
|
|
2031
|
-
config: ps(
|
|
2031
|
+
config: ps(f, a)
|
|
2032
2032
|
}
|
|
2033
2033
|
] : [];
|
|
2034
2034
|
});
|
|
@@ -2047,12 +2047,12 @@ const Pt = (e) => e ? e.value * e.unit : 0, _a = (e) => !e || e === "NaN" ? "0"
|
|
|
2047
2047
|
limitPriceError: a,
|
|
2048
2048
|
tradesError: o,
|
|
2049
2049
|
fillDelayError: d,
|
|
2050
|
-
durationError:
|
|
2050
|
+
durationError: f,
|
|
2051
2051
|
balanceError: h,
|
|
2052
2052
|
minTradeSizeError: C
|
|
2053
2053
|
}) => {
|
|
2054
2054
|
if (!vn(on.IGNORE_ERRORS) && !(D(e || 0).isZero() || D(t || 0).isZero() || D(n || "0").isZero() || r))
|
|
2055
|
-
return C || s || a || o || d ||
|
|
2055
|
+
return C || s || a || o || d || f || h;
|
|
2056
2056
|
}, di = (e, t) => {
|
|
2057
2057
|
const n = Date.now().toString(), r = parseInt((e / 1e3).toFixed(0)), s = _a(t / 1e3), a = vn(on.FRESHNESS), o = a ? parseInt(a) : 60;
|
|
2058
2058
|
return {
|
|
@@ -2070,13 +2070,13 @@ const Pt = (e) => e ? e.value * e.unit : 0, _a = (e) => !e || e === "NaN" ? "0"
|
|
|
2070
2070
|
fillDelayMillis: a,
|
|
2071
2071
|
slippage: o,
|
|
2072
2072
|
account: d,
|
|
2073
|
-
srcAmountPerTrade:
|
|
2073
|
+
srcAmountPerTrade: f,
|
|
2074
2074
|
dstMinAmountPerTrade: h = "0",
|
|
2075
2075
|
triggerAmountPerTrade: C = "0",
|
|
2076
2076
|
config: y,
|
|
2077
2077
|
module: E
|
|
2078
2078
|
}) => {
|
|
2079
|
-
const { nonce: S, epoch:
|
|
2079
|
+
const { nonce: S, epoch: v, deadline: O, freshness: B } = di(
|
|
2080
2080
|
a,
|
|
2081
2081
|
s
|
|
2082
2082
|
), k = Math.floor(Date.now() / 1e3).toString(), F = h, q = E === $.STOP_LOSS ? C : "0", R = E === $.TAKE_PROFIT ? C : "0", X = {
|
|
@@ -2102,12 +2102,12 @@ const Pt = (e) => e ? e.value * e.unit : 0, _a = (e) => !e || e === "NaN" ? "0"
|
|
|
2102
2102
|
deadline: O,
|
|
2103
2103
|
chainid: e,
|
|
2104
2104
|
exclusivity: 0,
|
|
2105
|
-
epoch:
|
|
2105
|
+
epoch: v,
|
|
2106
2106
|
slippage: o,
|
|
2107
2107
|
freshness: B,
|
|
2108
2108
|
input: {
|
|
2109
2109
|
token: t,
|
|
2110
|
-
amount:
|
|
2110
|
+
amount: f,
|
|
2111
2111
|
maxAmount: r
|
|
2112
2112
|
},
|
|
2113
2113
|
output: {
|
|
@@ -2140,7 +2140,7 @@ function Kn() {
|
|
|
2140
2140
|
return `id_${e + t + n}`;
|
|
2141
2141
|
}
|
|
2142
2142
|
const mi = (e, t, n) => {
|
|
2143
|
-
var r, s, a, o, d,
|
|
2143
|
+
var r, s, a, o, d, f, h, C, y;
|
|
2144
2144
|
return {
|
|
2145
2145
|
spotVersion: dr.version,
|
|
2146
2146
|
partner: e.partner,
|
|
@@ -2161,7 +2161,7 @@ const mi = (e, t, n) => {
|
|
|
2161
2161
|
lensAddress: ((o = e.twapConfig) == null ? void 0 : o.lensAddress) || "",
|
|
2162
2162
|
bidDelaySeconds: ((d = e.twapConfig) == null ? void 0 : d.bidDelaySeconds) || 0,
|
|
2163
2163
|
minChunkSizeUsd: t,
|
|
2164
|
-
name: ((
|
|
2164
|
+
name: ((f = e.twapConfig) == null ? void 0 : f.name) || "",
|
|
2165
2165
|
exchangeAddress: ((h = e.twapConfig) == null ? void 0 : h.exchangeAddress) || "",
|
|
2166
2166
|
exchangeType: ((C = e.twapConfig) == null ? void 0 : C.exchangeType) || "",
|
|
2167
2167
|
pathfinderKey: ((y = e.twapConfig) == null ? void 0 : y.pathfinderKey) || ""
|
|
@@ -2262,13 +2262,13 @@ class yi {
|
|
|
2262
2262
|
dstToken: a,
|
|
2263
2263
|
fromTokenAmount: o,
|
|
2264
2264
|
srcChunkAmount: d,
|
|
2265
|
-
minDstAmountOutPerTrade:
|
|
2265
|
+
minDstAmountOutPerTrade: f = "",
|
|
2266
2266
|
triggerPricePerTrade: h = "",
|
|
2267
2267
|
deadline: C,
|
|
2268
2268
|
fillDelay: y,
|
|
2269
2269
|
slippage: E,
|
|
2270
2270
|
isMarketOrder: S,
|
|
2271
|
-
chunksAmount:
|
|
2271
|
+
chunksAmount: v
|
|
2272
2272
|
}) {
|
|
2273
2273
|
this.updateAndSend({
|
|
2274
2274
|
toTokenAddress: a.address,
|
|
@@ -2276,9 +2276,9 @@ class yi {
|
|
|
2276
2276
|
fromTokenAddress: s.address,
|
|
2277
2277
|
fromTokenSymbol: s.symbol,
|
|
2278
2278
|
fromTokenAmount: o,
|
|
2279
|
-
chunksAmount:
|
|
2279
|
+
chunksAmount: v,
|
|
2280
2280
|
srcChunkAmount: d,
|
|
2281
|
-
minDstAmountOutPerTrade:
|
|
2281
|
+
minDstAmountOutPerTrade: f,
|
|
2282
2282
|
triggerPricePerTrade: h,
|
|
2283
2283
|
deadline: C,
|
|
2284
2284
|
fillDelay: y,
|
|
@@ -2374,7 +2374,7 @@ class yi {
|
|
|
2374
2374
|
}
|
|
2375
2375
|
const fe = new yi(), Ai = (e) => {
|
|
2376
2376
|
var C;
|
|
2377
|
-
const t = D(e.order.witness.output.limit || 0).gt(1), { stop: n, triggerLower: r, triggerUpper: s } = e.order.witness.output, a = D(n || 0).eq(os), o = a || D(s || 0).gt(0), d = !a && D(n || 0).gt(0) || D(r || 0).gt(0),
|
|
2377
|
+
const t = D(e.order.witness.output.limit || 0).gt(1), { stop: n, triggerLower: r, triggerUpper: s } = e.order.witness.output, a = D(n || 0).eq(os), o = a || D(s || 0).gt(0), d = !a && D(n || 0).gt(0) || D(r || 0).gt(0), f = D(e.order.witness.input.amount), h = ((C = e.metadata.chunks) == null ? void 0 : C.length) || (f.gt(0) ? D(e.order.witness.input.maxAmount).div(f).toNumber() : e.metadata.expectedChunks || 1);
|
|
2378
2378
|
return o ? t ? G.TAKE_PROFIT_LIMIT : G.TAKE_PROFIT_MARKET : d ? t ? G.STOP_LOSS_LIMIT : G.STOP_LOSS_MARKET : t ? h > 1 && t ? G.TWAP_LIMIT : t ? G.LIMIT : G.TWAP_MARKET : G.TWAP_MARKET;
|
|
2379
2379
|
}, gi = (e) => {
|
|
2380
2380
|
var s;
|
|
@@ -2467,14 +2467,14 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2467
2467
|
)).json();
|
|
2468
2468
|
if (!S || !Array.isArray(S.orders))
|
|
2469
2469
|
return [];
|
|
2470
|
-
const
|
|
2470
|
+
const v = [];
|
|
2471
2471
|
for (const O of S.orders)
|
|
2472
2472
|
try {
|
|
2473
|
-
|
|
2473
|
+
v.push(hs(O));
|
|
2474
2474
|
} catch {
|
|
2475
2475
|
continue;
|
|
2476
2476
|
}
|
|
2477
|
-
return
|
|
2477
|
+
return v;
|
|
2478
2478
|
} catch {
|
|
2479
2479
|
return [];
|
|
2480
2480
|
}
|
|
@@ -2502,8 +2502,8 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2502
2502
|
body: JSON.stringify(r)
|
|
2503
2503
|
}), a = await s.json().catch(() => ({}));
|
|
2504
2504
|
if (!s.ok || !(a != null && a.success)) {
|
|
2505
|
-
const d = (a == null ? void 0 : a.message) ?? s.statusText ?? "Request failed",
|
|
2506
|
-
throw new Error(`error:${d}, code:${
|
|
2505
|
+
const d = (a == null ? void 0 : a.message) ?? s.statusText ?? "Request failed", f = (a == null ? void 0 : a.code) ?? s.status;
|
|
2506
|
+
throw new Error(`error:${d}, code:${f}`);
|
|
2507
2507
|
}
|
|
2508
2508
|
if (!a.signedOrder || typeof a.signedOrder != "object")
|
|
2509
2509
|
throw new Error("Invalid API response: missing signedOrder");
|
|
@@ -2526,7 +2526,7 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2526
2526
|
}) => {
|
|
2527
2527
|
const d = vi(e);
|
|
2528
2528
|
if (!d) throw new ki();
|
|
2529
|
-
const
|
|
2529
|
+
const f = async (y) => {
|
|
2530
2530
|
let E = 0;
|
|
2531
2531
|
for (; E <= s; )
|
|
2532
2532
|
try {
|
|
@@ -2537,13 +2537,13 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2537
2537
|
headers: { "Content-Type": "application/json" }
|
|
2538
2538
|
});
|
|
2539
2539
|
if (!S.ok) throw new Error(`HTTP error: ${S.status}`);
|
|
2540
|
-
const
|
|
2541
|
-
if (
|
|
2542
|
-
throw new Error(
|
|
2543
|
-
return n(
|
|
2540
|
+
const v = await S.json();
|
|
2541
|
+
if (v.errors)
|
|
2542
|
+
throw new Error(v.errors[0].message);
|
|
2543
|
+
return n(v);
|
|
2544
2544
|
} catch (S) {
|
|
2545
2545
|
if (E === s) throw S;
|
|
2546
|
-
await new Promise((
|
|
2546
|
+
await new Promise((v) => setTimeout(v, 500 * 2 ** E)), E++;
|
|
2547
2547
|
}
|
|
2548
2548
|
return [];
|
|
2549
2549
|
};
|
|
@@ -2552,11 +2552,11 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2552
2552
|
if (o !== void 0) {
|
|
2553
2553
|
const y = t(o, a);
|
|
2554
2554
|
try {
|
|
2555
|
-
return await
|
|
2555
|
+
return await f(y);
|
|
2556
2556
|
} catch {
|
|
2557
2557
|
console.warn(`Page ${o} failed, retrying one final time...`);
|
|
2558
2558
|
try {
|
|
2559
|
-
return await
|
|
2559
|
+
return await f(y);
|
|
2560
2560
|
} catch {
|
|
2561
2561
|
return [];
|
|
2562
2562
|
}
|
|
@@ -2566,11 +2566,11 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2566
2566
|
const y = t(h, a);
|
|
2567
2567
|
let E;
|
|
2568
2568
|
try {
|
|
2569
|
-
E = await
|
|
2569
|
+
E = await f(y);
|
|
2570
2570
|
} catch {
|
|
2571
2571
|
console.warn(`Page ${h} failed, retrying one final time...`);
|
|
2572
2572
|
try {
|
|
2573
|
-
E = await
|
|
2573
|
+
E = await f(y);
|
|
2574
2574
|
} catch {
|
|
2575
2575
|
return C;
|
|
2576
2576
|
}
|
|
@@ -2589,7 +2589,7 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2589
2589
|
return !n && t === 1 ? G.TWAP_MARKET : t > 1 && n ? G.TWAP_LIMIT : n ? G.LIMIT : G.TWAP_MARKET;
|
|
2590
2590
|
}, Pi = (e, t, n, r) => {
|
|
2591
2591
|
var S;
|
|
2592
|
-
const s = ms(n || []), a = new D(e.ask_srcBidAmount || 0), o = a.gt(0) ? new D(e.ask_srcAmount || 0).div(a).integerValue(D.ROUND_FLOOR).toNumber() : 1,
|
|
2592
|
+
const s = ms(n || []), a = new D(e.ask_srcBidAmount || 0), o = a.gt(0) ? new D(e.ask_srcAmount || 0).div(a).integerValue(D.ROUND_FLOOR).toNumber() : 1, f = (n == null ? void 0 : n.length) === o ? (S = n == null ? void 0 : n[(n == null ? void 0 : n.length) - 1]) == null ? void 0 : S.timestamp : void 0, h = s.reduce((v, O) => v.plus(O.inAmount), new D(0)).toFixed(), C = s.reduce((v, O) => v.plus(O.outAmount), new D(0)).toFixed(), y = ys(e.ask_srcAmount, h), E = Or(e.ask_dstMinAmount, o);
|
|
2593
2593
|
return {
|
|
2594
2594
|
repermitDigest: "",
|
|
2595
2595
|
version: 1,
|
|
@@ -2619,7 +2619,7 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2619
2619
|
totalTradesAmount: o,
|
|
2620
2620
|
isMarketPrice: [G.TWAP_MARKET].includes(E),
|
|
2621
2621
|
chainId: t,
|
|
2622
|
-
filledOrderTimestamp:
|
|
2622
|
+
filledOrderTimestamp: f || 0,
|
|
2623
2623
|
status: r,
|
|
2624
2624
|
rawOrder: e
|
|
2625
2625
|
};
|
|
@@ -2647,7 +2647,7 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2647
2647
|
), d = je(
|
|
2648
2648
|
e.transactionHashes,
|
|
2649
2649
|
(E) => `"${E.toLowerCase()}"`
|
|
2650
|
-
),
|
|
2650
|
+
), f = je(e.orderIds, (E) => `"${E}"`), h = n != null && n.length ? "" : je(
|
|
2651
2651
|
(y = e.configs) == null ? void 0 : y.map((E) => E.twapAddress),
|
|
2652
2652
|
(E) => `"${E.toLowerCase()}"`
|
|
2653
2653
|
), C = e.minDollarValueIn;
|
|
@@ -2656,7 +2656,7 @@ const fe = new yi(), Ai = (e) => {
|
|
|
2656
2656
|
h ? `twapAddress_in: [${h.join(", ")}]` : "",
|
|
2657
2657
|
t ? `maker_in: [${t.join(", ")}]` : "",
|
|
2658
2658
|
d ? `transactionHash_in: [${d.join(", ")}]` : "",
|
|
2659
|
-
|
|
2659
|
+
f ? `Contract_id_in: [${f.join(", ")}]` : "",
|
|
2660
2660
|
C ? `dollarValueIn_gte: ${C}` : "",
|
|
2661
2661
|
r ? `srcTokenSymbol_in: [${r.join(", ")}]` : "",
|
|
2662
2662
|
s ? `dstTokenSymbol_in: [${s.join(", ")}]` : "",
|
|
@@ -2681,12 +2681,12 @@ async function Bi({
|
|
|
2681
2681
|
signal: t,
|
|
2682
2682
|
limit: a,
|
|
2683
2683
|
page: n,
|
|
2684
|
-
buildQuery: (
|
|
2684
|
+
buildQuery: (f, h) => `
|
|
2685
2685
|
{
|
|
2686
2686
|
orderCreateds(
|
|
2687
2687
|
${o ? `where: { ${o} }` : ""},
|
|
2688
2688
|
first: ${h},
|
|
2689
|
-
skip: ${
|
|
2689
|
+
skip: ${f * h},
|
|
2690
2690
|
orderBy: timestamp,
|
|
2691
2691
|
orderDirection: desc,
|
|
2692
2692
|
) {
|
|
@@ -2716,9 +2716,9 @@ async function Bi({
|
|
|
2716
2716
|
}
|
|
2717
2717
|
}
|
|
2718
2718
|
`,
|
|
2719
|
-
extractResults: (
|
|
2719
|
+
extractResults: (f) => {
|
|
2720
2720
|
var h;
|
|
2721
|
-
return ((h =
|
|
2721
|
+
return ((h = f.data) == null ? void 0 : h.orderCreateds) || [];
|
|
2722
2722
|
}
|
|
2723
2723
|
});
|
|
2724
2724
|
}
|
|
@@ -2735,11 +2735,11 @@ const Ii = async ({
|
|
|
2735
2735
|
chainId: e,
|
|
2736
2736
|
signal: n,
|
|
2737
2737
|
limit: 1e3,
|
|
2738
|
-
buildQuery: (d,
|
|
2738
|
+
buildQuery: (d, f) => `
|
|
2739
2739
|
{
|
|
2740
2740
|
statusNews(
|
|
2741
|
-
first: ${
|
|
2742
|
-
skip: ${d *
|
|
2741
|
+
first: ${f},
|
|
2742
|
+
skip: ${d * f},
|
|
2743
2743
|
${a}
|
|
2744
2744
|
) {
|
|
2745
2745
|
twapId
|
|
@@ -2749,8 +2749,8 @@ const Ii = async ({
|
|
|
2749
2749
|
}
|
|
2750
2750
|
`,
|
|
2751
2751
|
extractResults: (d) => {
|
|
2752
|
-
var
|
|
2753
|
-
return ((
|
|
2752
|
+
var f;
|
|
2753
|
+
return ((f = d.data) == null ? void 0 : f.statusNews) || [];
|
|
2754
2754
|
}
|
|
2755
2755
|
});
|
|
2756
2756
|
};
|
|
@@ -2821,7 +2821,7 @@ const _i = async ({
|
|
|
2821
2821
|
}), [o, d] = await Promise.all([
|
|
2822
2822
|
Ri({ chainId: e, orders: a, signal: t }),
|
|
2823
2823
|
Ii({ chainId: e, orders: a, signal: t })
|
|
2824
|
-
]),
|
|
2824
|
+
]), f = a.map((C) => {
|
|
2825
2825
|
const y = o == null ? void 0 : o.filter(
|
|
2826
2826
|
(E) => E.TWAP_id === Number(C.Contract_id) && $t(E.exchange, C.exchange) && $t(E.twapAddress, C.twapAddress)
|
|
2827
2827
|
);
|
|
@@ -2832,15 +2832,15 @@ const _i = async ({
|
|
|
2832
2832
|
Ui(C, y || [], d)
|
|
2833
2833
|
);
|
|
2834
2834
|
}).sort((C, y) => y.createdAt - C.createdAt), h = /* @__PURE__ */ new Set();
|
|
2835
|
-
return
|
|
2835
|
+
return f.filter((C) => h.has(C.id) ? !1 : (h.add(C.id), !0));
|
|
2836
2836
|
} catch {
|
|
2837
2837
|
return [];
|
|
2838
2838
|
}
|
|
2839
2839
|
}, Ui = (e, t, n) => {
|
|
2840
2840
|
var d;
|
|
2841
2841
|
const r = (d = n == null ? void 0 : n.find(
|
|
2842
|
-
(
|
|
2843
|
-
)) == null ? void 0 : d.status, a = ms(t).reduce((
|
|
2842
|
+
(f) => f.twapId === e.Contract_id.toString() && $t(f.twapAddress, e.twapAddress)
|
|
2843
|
+
)) == null ? void 0 : d.status, a = ms(t).reduce((f, h) => f.plus(h.inAmount), new D(0)).toFixed(), o = ys(e.ask_srcAmount, a);
|
|
2844
2844
|
return Mi(o, e.ask_deadline * 1e3, r);
|
|
2845
2845
|
}, ys = (e, t) => {
|
|
2846
2846
|
if (!t || !e) return 0;
|
|
@@ -2874,7 +2874,7 @@ const _i = async ({
|
|
|
2874
2874
|
partner: s == null ? void 0 : s.partner,
|
|
2875
2875
|
isDev: o
|
|
2876
2876
|
})
|
|
2877
|
-
]).then(([C, y]) => [...C, ...y])).sort((C, y) => y.createdAt - C.createdAt), Ni = "1.1.
|
|
2877
|
+
]).then(([C, y]) => [...C, ...y])).sort((C, y) => y.createdAt - C.createdAt), Ni = "1.1.40", qi = {
|
|
2878
2878
|
version: Ni
|
|
2879
2879
|
}, Br = (e) => {
|
|
2880
2880
|
let t;
|
|
@@ -2884,7 +2884,7 @@ const _i = async ({
|
|
|
2884
2884
|
const E = t;
|
|
2885
2885
|
t = C ?? (typeof y != "object" || y === null) ? y : Object.assign({}, t, y), n.forEach((S) => S(t, E));
|
|
2886
2886
|
}
|
|
2887
|
-
}, s = () => t, d = { setState: r, getState: s, getInitialState: () =>
|
|
2887
|
+
}, s = () => t, d = { setState: r, getState: s, getInitialState: () => f, subscribe: (h) => (n.add(h), () => n.delete(h)) }, f = t = e(r, s, d);
|
|
2888
2888
|
return d;
|
|
2889
2889
|
}, Ki = ((e) => e ? Br(e) : Br), Hi = (e) => e;
|
|
2890
2890
|
function Wi(e, t = Hi) {
|
|
@@ -3019,8 +3019,8 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3019
3019
|
value: t,
|
|
3020
3020
|
args: { maxChunks: `${t}` }
|
|
3021
3021
|
};
|
|
3022
|
-
const { isError:
|
|
3023
|
-
if (
|
|
3022
|
+
const { isError: f, value: h } = si(o || "", r || "", a || 0);
|
|
3023
|
+
if (f)
|
|
3024
3024
|
return {
|
|
3025
3025
|
type: me.MIN_TRADE_SIZE,
|
|
3026
3026
|
value: h,
|
|
@@ -3028,32 +3028,32 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3028
3028
|
};
|
|
3029
3029
|
}, [e, t, n, o, r, a, s]);
|
|
3030
3030
|
}, $e = () => {
|
|
3031
|
-
const { srcToken: e, srcUsd1Token: t, module: n, minChunkSizeUsd: r } = N(), s = K((
|
|
3031
|
+
const { srcToken: e, srcUsd1Token: t, module: n, minChunkSizeUsd: r } = N(), s = K((v) => v.state.typedChunks), a = K((v) => v.updateState), { amount: o, amountUI: d } = ft(), f = _(
|
|
3032
3032
|
() => $a(d || "", t || "", r || 0),
|
|
3033
3033
|
[d, t, r]
|
|
3034
|
-
), h = _(() => Qa(
|
|
3035
|
-
(
|
|
3036
|
-
typedChunks:
|
|
3034
|
+
), h = _(() => Qa(f, n, s), [f, s, n]), C = te(
|
|
3035
|
+
(v) => a({
|
|
3036
|
+
typedChunks: v
|
|
3037
3037
|
}),
|
|
3038
3038
|
[a]
|
|
3039
3039
|
), y = _(() => Ga(o || "", h), [o, h]), E = jt(e == null ? void 0 : e.decimals, y), S = _(() => t ? D(E || "0").times(t || 0).toString() : "0", [E, t]);
|
|
3040
3040
|
return {
|
|
3041
3041
|
totalTrades: h,
|
|
3042
|
-
maxTrades:
|
|
3042
|
+
maxTrades: f,
|
|
3043
3043
|
amountPerTradeUI: E,
|
|
3044
3044
|
amountPerTrade: y,
|
|
3045
3045
|
amountPerTradeUsd: S,
|
|
3046
3046
|
onChange: C,
|
|
3047
|
-
error: Xi(h,
|
|
3047
|
+
error: Xi(h, f)
|
|
3048
3048
|
};
|
|
3049
3049
|
}, Zi = () => {
|
|
3050
|
-
const { srcToken: e, dstToken: t } = N(), { onChange: n, totalTrades: r, amountPerTradeUsd: s, amountPerTradeUI: a, error: o, maxTrades: d, amountPerTrade:
|
|
3050
|
+
const { srcToken: e, dstToken: t } = N(), { onChange: n, totalTrades: r, amountPerTradeUsd: s, amountPerTradeUI: a, error: o, maxTrades: d, amountPerTrade: f } = $e();
|
|
3051
3051
|
return {
|
|
3052
3052
|
error: o,
|
|
3053
3053
|
maxTrades: d,
|
|
3054
3054
|
totalTrades: r,
|
|
3055
3055
|
amountPerTradeUI: a,
|
|
3056
|
-
amountPerTrade:
|
|
3056
|
+
amountPerTrade: f,
|
|
3057
3057
|
onChange: n,
|
|
3058
3058
|
amountPerTradeUsd: s,
|
|
3059
3059
|
fromToken: e,
|
|
@@ -3128,12 +3128,12 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3128
3128
|
}
|
|
3129
3129
|
}, [e, t, n]);
|
|
3130
3130
|
}, yr = () => {
|
|
3131
|
-
const { module: e, callbacks: t } = N(), n = K((
|
|
3131
|
+
const { module: e, callbacks: t } = N(), n = K((f) => f.state.typedDuration), r = K((f) => f.updateState), s = $e().totalTrades, a = Gt().fillDelay, o = _(() => za(e, s, a, n), [s, a, n, e]), d = eo(o);
|
|
3132
3132
|
return {
|
|
3133
3133
|
duration: o,
|
|
3134
|
-
setDuration: te((
|
|
3134
|
+
setDuration: te((f) => {
|
|
3135
3135
|
var h;
|
|
3136
|
-
r({ typedDuration:
|
|
3136
|
+
r({ typedDuration: f }), (h = t == null ? void 0 : t.onDurationChange) == null || h.call(t, f);
|
|
3137
3137
|
}, [r, t]),
|
|
3138
3138
|
error: d
|
|
3139
3139
|
};
|
|
@@ -3168,7 +3168,7 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3168
3168
|
const t = D(e);
|
|
3169
3169
|
return t.isNaN() || t.isZero() ? "0" : D(1).div(t).toFixed();
|
|
3170
3170
|
}, Pn = () => {
|
|
3171
|
-
const { srcToken: e, dstToken: t } = N(), n = K((
|
|
3171
|
+
const { srcToken: e, dstToken: t } = N(), n = K((f) => f.updateState), r = K((f) => f.state.isInvertedTrade), s = K((f) => f.state.typedTriggerPrice), a = K((f) => f.state.typedLimitPrice), o = K((f) => f.state.isMarketOrder);
|
|
3172
3172
|
return {
|
|
3173
3173
|
onInvert: te(() => {
|
|
3174
3174
|
n({
|
|
@@ -3196,12 +3196,12 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3196
3196
|
return An(t);
|
|
3197
3197
|
const C = Te(e, n);
|
|
3198
3198
|
return !C || D(C || "0").isZero() ? "" : o ? D(1).div(C).toFixed() : C;
|
|
3199
|
-
}, [e, n, o, t]),
|
|
3199
|
+
}, [e, n, o, t]), f = _(() => d ? An(o ? vt(d, r) : e) : "", [e, d, r, o]), h = Qe(
|
|
3200
3200
|
d || "0",
|
|
3201
3201
|
o ? a : s
|
|
3202
3202
|
);
|
|
3203
3203
|
return {
|
|
3204
|
-
amount:
|
|
3204
|
+
amount: f,
|
|
3205
3205
|
amountUI: d,
|
|
3206
3206
|
usd: An(h)
|
|
3207
3207
|
};
|
|
@@ -3223,7 +3223,7 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3223
3223
|
return E.plus(E.multipliedBy(S)).decimalPlaces(0).toFixed();
|
|
3224
3224
|
}
|
|
3225
3225
|
return D(n).gt(0) ? n : "";
|
|
3226
|
-
})()).decimalPlaces(0).toFixed(), [e, r, t, n, o]),
|
|
3226
|
+
})()).decimalPlaces(0).toFixed(), [e, r, t, n, o]), f = te(
|
|
3227
3227
|
(y) => {
|
|
3228
3228
|
s(y), a(null);
|
|
3229
3229
|
},
|
|
@@ -3247,7 +3247,7 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3247
3247
|
amount: D(d).isNaN() ? "" : d,
|
|
3248
3248
|
typedValue: e,
|
|
3249
3249
|
selectedPercentage: C,
|
|
3250
|
-
onChange:
|
|
3250
|
+
onChange: f,
|
|
3251
3251
|
onPercentageChange: h,
|
|
3252
3252
|
isTypedValue: e !== void 0
|
|
3253
3253
|
};
|
|
@@ -3274,16 +3274,16 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3274
3274
|
};
|
|
3275
3275
|
}, [n, e, t, r]);
|
|
3276
3276
|
}, so = (e) => {
|
|
3277
|
-
const { srcToken: t, dstToken: n, module: r, dstUsd1Token: s } = N(), a = $e().amountPerTrade, o = K((h) => h.state.isMarketOrder), d = _(() => Wa(r, a, e, (t == null ? void 0 : t.decimals) || 0), [e, a, o, t == null ? void 0 : t.decimals, r]),
|
|
3277
|
+
const { srcToken: t, dstToken: n, module: r, dstUsd1Token: s } = N(), a = $e().amountPerTrade, o = K((h) => h.state.isMarketOrder), d = _(() => Wa(r, a, e, (t == null ? void 0 : t.decimals) || 0), [e, a, o, t == null ? void 0 : t.decimals, r]), f = jt((n == null ? void 0 : n.decimals) || 0, d);
|
|
3278
3278
|
return {
|
|
3279
3279
|
amount: d,
|
|
3280
|
-
amountUI:
|
|
3281
|
-
usd: Qe(
|
|
3280
|
+
amountUI: f,
|
|
3281
|
+
usd: Qe(f, s)
|
|
3282
3282
|
};
|
|
3283
3283
|
}, It = () => {
|
|
3284
|
-
const { dstToken: e, dstUsd1Token: t, marketPrice: n, module: r, callbacks: s } = N(), a = K((k) => k.updateState), o = no(), d = K((k) => k.state.triggerPricePercent),
|
|
3284
|
+
const { dstToken: e, dstUsd1Token: t, marketPrice: n, module: r, callbacks: s } = N(), a = K((k) => k.updateState), o = no(), d = K((k) => k.state.triggerPricePercent), f = d === void 0 ? o : d, h = r === $.STOP_LOSS || r === $.TAKE_PROFIT, C = Cs({
|
|
3285
3285
|
typedValue: K((k) => k.state.typedTriggerPrice),
|
|
3286
|
-
percentage:
|
|
3286
|
+
percentage: f,
|
|
3287
3287
|
tokenDecimals: (e == null ? void 0 : e.decimals) || 18,
|
|
3288
3288
|
initialPrice: h ? n : void 0,
|
|
3289
3289
|
setValue: te((k) => {
|
|
@@ -3297,16 +3297,16 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3297
3297
|
},
|
|
3298
3298
|
[a, s]
|
|
3299
3299
|
)
|
|
3300
|
-
}), y = ro(C.amount), E = jt((e == null ? void 0 : e.decimals) || 18, C.amount), S = Qe(E, t), { amount:
|
|
3300
|
+
}), y = ro(C.amount), E = jt((e == null ? void 0 : e.decimals) || 18, C.amount), S = Qe(E, t), { amount: v, amountUI: O, usd: B } = so(C.amount);
|
|
3301
3301
|
return _(() => ({
|
|
3302
3302
|
...C,
|
|
3303
3303
|
amountUI: D(E).isNaN() ? "" : E,
|
|
3304
3304
|
usd: D(S).isNaN() ? "" : S,
|
|
3305
3305
|
error: y,
|
|
3306
|
-
pricePerChunk:
|
|
3306
|
+
pricePerChunk: v,
|
|
3307
3307
|
pricePerChunkUI: O,
|
|
3308
3308
|
pricePerChunkUsd: B
|
|
3309
|
-
}), [C, E, S, y,
|
|
3309
|
+
}), [C, E, S, y, v, O, B]);
|
|
3310
3310
|
}, ao = (e) => {
|
|
3311
3311
|
const { module: t, marketPrice: n, typedInputAmount: r } = N(), { amount: s } = It(), a = K((o) => o.state.isMarketOrder);
|
|
3312
3312
|
return _(() => {
|
|
@@ -3329,7 +3329,7 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3329
3329
|
};
|
|
3330
3330
|
}, [e, s, t, a, r, n]);
|
|
3331
3331
|
}, On = () => {
|
|
3332
|
-
const { dstToken: e, dstUsd1Token: t, marketPrice: n, callbacks: r } = N(), s = K((E) => E.updateState), a = Ar(), o = K((E) => E.state.limitPricePercent), d = o === void 0 ? a : o,
|
|
3332
|
+
const { dstToken: e, dstUsd1Token: t, marketPrice: n, callbacks: r } = N(), s = K((E) => E.updateState), a = Ar(), o = K((E) => E.state.limitPricePercent), d = o === void 0 ? a : o, f = Cs({
|
|
3333
3333
|
typedValue: K((E) => E.state.typedLimitPrice),
|
|
3334
3334
|
percentage: d,
|
|
3335
3335
|
tokenDecimals: (e == null ? void 0 : e.decimals) || 18,
|
|
@@ -3345,13 +3345,13 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3345
3345
|
},
|
|
3346
3346
|
[s, r]
|
|
3347
3347
|
)
|
|
3348
|
-
}), h = ao(
|
|
3348
|
+
}), h = ao(f.amount), C = jt((e == null ? void 0 : e.decimals) || 18, f.amount), y = Qe(C, t);
|
|
3349
3349
|
return _(() => ({
|
|
3350
|
-
...
|
|
3350
|
+
...f,
|
|
3351
3351
|
amountUI: D(C).isNaN() ? "" : C,
|
|
3352
3352
|
usd: D(y).isNaN() ? "" : y,
|
|
3353
3353
|
error: h
|
|
3354
|
-
}), [
|
|
3354
|
+
}), [f, C, y, h]);
|
|
3355
3355
|
}, io = () => {
|
|
3356
3356
|
const { module: e } = N(), t = K((d) => d.updateState), n = K((d) => d.state.isMarketOrder), r = Ar(), s = K((d) => d.state.triggerPricePercent) || 0, a = e === $.LIMIT, o = te(() => {
|
|
3357
3357
|
!n && e === $.STOP_LOSS && t({ limitPricePercent: r }), t({ isMarketOrder: !n });
|
|
@@ -3362,7 +3362,7 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3362
3362
|
hide: a
|
|
3363
3363
|
};
|
|
3364
3364
|
}, oo = () => {
|
|
3365
|
-
const { module: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: d, onChange:
|
|
3365
|
+
const { module: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: d, onChange: f, onPercentageChange: h, selectedPercentage: C, error: y, isTypedValue: E } = On(), S = K((z) => z.updateState), v = Ar(), { isLimitPrice: O, toggleLimitPrice: B } = io(), { fromToken: k, toToken: F, isInverted: q } = Pn(), R = xs({
|
|
3366
3366
|
amount: o,
|
|
3367
3367
|
typedValue: d,
|
|
3368
3368
|
amountDecimals: (r == null ? void 0 : r.decimals) || 18,
|
|
@@ -3371,13 +3371,13 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3371
3371
|
invertedAmountUsd: s,
|
|
3372
3372
|
isInverted: q
|
|
3373
3373
|
}), X = te(() => {
|
|
3374
|
-
S({ typedLimitPrice: void 0 }), S({ limitPricePercent:
|
|
3375
|
-
}, [S, e,
|
|
3374
|
+
S({ typedLimitPrice: void 0 }), S({ limitPricePercent: v });
|
|
3375
|
+
}, [S, e, v]);
|
|
3376
3376
|
return {
|
|
3377
3377
|
price: R.amount,
|
|
3378
3378
|
priceUI: R.amountUI,
|
|
3379
3379
|
error: y,
|
|
3380
|
-
onInputChange:
|
|
3380
|
+
onInputChange: f,
|
|
3381
3381
|
onPercentageChange: h,
|
|
3382
3382
|
onReset: X,
|
|
3383
3383
|
usd: R.usd,
|
|
@@ -3392,7 +3392,7 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3392
3392
|
isTypedValue: E
|
|
3393
3393
|
};
|
|
3394
3394
|
}, co = () => {
|
|
3395
|
-
const { marketPrice: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: d, onChange:
|
|
3395
|
+
const { marketPrice: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: d, onChange: f, onPercentageChange: h, selectedPercentage: C, error: y, pricePerChunk: E, pricePerChunkUI: S, pricePerChunkUsd: v, isTypedValue: O } = It(), B = K((z) => z.updateState), { fromToken: k, toToken: F, isInverted: q } = Pn(), R = xs({
|
|
3396
3396
|
amount: o,
|
|
3397
3397
|
typedValue: d,
|
|
3398
3398
|
amountDecimals: (r == null ? void 0 : r.decimals) || 18,
|
|
@@ -3408,9 +3408,9 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3408
3408
|
priceUI: R.amountUI,
|
|
3409
3409
|
amountPerChunk: E,
|
|
3410
3410
|
amountPerChunkUI: S,
|
|
3411
|
-
amountPerChunkUsd:
|
|
3411
|
+
amountPerChunkUsd: v,
|
|
3412
3412
|
error: y,
|
|
3413
|
-
onInputChange:
|
|
3413
|
+
onInputChange: f,
|
|
3414
3414
|
onPercentageChange: h,
|
|
3415
3415
|
percentage: C,
|
|
3416
3416
|
onReset: X,
|
|
@@ -3433,7 +3433,7 @@ const Hc = (e, t) => e ? G.TWAP_MARKET : t === 1 ? G.LIMIT : G.TWAP_LIMIT, bs =
|
|
|
3433
3433
|
usd: Qe(o, n)
|
|
3434
3434
|
};
|
|
3435
3435
|
}, gr = () => {
|
|
3436
|
-
const { srcToken: e, dstToken: t, dstUsd1Token: n } = N(), r = Ts(), s = $e().amountPerTrade, a = K((
|
|
3436
|
+
const { srcToken: e, dstToken: t, dstUsd1Token: n } = N(), r = Ts(), s = $e().amountPerTrade, a = K((f) => f.state.isMarketOrder), o = _(
|
|
3437
3437
|
() => Ha(s, r, !!a, (e == null ? void 0 : e.decimals) || 0),
|
|
3438
3438
|
[s, r, a, e == null ? void 0 : e.decimals]
|
|
3439
3439
|
), d = jt(t == null ? void 0 : t.decimals, o);
|
|
@@ -3478,7 +3478,7 @@ function ws() {
|
|
|
3478
3478
|
srcUsd1Token: r,
|
|
3479
3479
|
srcBalance: s,
|
|
3480
3480
|
chainId: a
|
|
3481
|
-
} = N(), { error: o } = It(), { error: d } = On(), { error:
|
|
3481
|
+
} = N(), { error: o } = It(), { error: d } = On(), { error: f } = $e(), { error: h } = Gt(), { error: C } = yr(), y = fo(), E = ft().amount, S = _(() => {
|
|
3482
3482
|
if (s && D(E).gt(s))
|
|
3483
3483
|
return {
|
|
3484
3484
|
type: me.INSUFFICIENT_BALANCE,
|
|
@@ -3492,7 +3492,7 @@ function ws() {
|
|
|
3492
3492
|
marketPriceLoading: t,
|
|
3493
3493
|
triggerPriceError: o,
|
|
3494
3494
|
limitPriceError: d,
|
|
3495
|
-
tradesError:
|
|
3495
|
+
tradesError: f,
|
|
3496
3496
|
fillDelayError: h,
|
|
3497
3497
|
durationError: C,
|
|
3498
3498
|
balanceError: S,
|
|
@@ -3503,7 +3503,7 @@ function ws() {
|
|
|
3503
3503
|
n,
|
|
3504
3504
|
o,
|
|
3505
3505
|
d,
|
|
3506
|
-
|
|
3506
|
+
f,
|
|
3507
3507
|
h,
|
|
3508
3508
|
C,
|
|
3509
3509
|
S,
|
|
@@ -3554,22 +3554,22 @@ var Xt = class {
|
|
|
3554
3554
|
L(this, gt, !1);
|
|
3555
3555
|
}
|
|
3556
3556
|
setTimeoutProvider(e) {
|
|
3557
|
-
process.env.NODE_ENV !== "production" &&
|
|
3557
|
+
process.env.NODE_ENV !== "production" && l(this, gt) && e !== l(this, Ke) && console.error(
|
|
3558
3558
|
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
3559
|
-
{ previous:
|
|
3559
|
+
{ previous: l(this, Ke), provider: e }
|
|
3560
3560
|
), I(this, Ke, e), process.env.NODE_ENV !== "production" && I(this, gt, !1);
|
|
3561
3561
|
}
|
|
3562
3562
|
setTimeout(e, t) {
|
|
3563
|
-
return process.env.NODE_ENV !== "production" && I(this, gt, !0),
|
|
3563
|
+
return process.env.NODE_ENV !== "production" && I(this, gt, !0), l(this, Ke).setTimeout(e, t);
|
|
3564
3564
|
}
|
|
3565
3565
|
clearTimeout(e) {
|
|
3566
|
-
|
|
3566
|
+
l(this, Ke).clearTimeout(e);
|
|
3567
3567
|
}
|
|
3568
3568
|
setInterval(e, t) {
|
|
3569
|
-
return process.env.NODE_ENV !== "production" && I(this, gt, !0),
|
|
3569
|
+
return process.env.NODE_ENV !== "production" && I(this, gt, !0), l(this, Ke).setInterval(e, t);
|
|
3570
3570
|
}
|
|
3571
3571
|
clearInterval(e) {
|
|
3572
|
-
|
|
3572
|
+
l(this, Ke).clearInterval(e);
|
|
3573
3573
|
}
|
|
3574
3574
|
}, Ke = new WeakMap(), gt = new WeakMap(), Vr), At = new ho();
|
|
3575
3575
|
function mo(e) {
|
|
@@ -3610,8 +3610,8 @@ function Ur(e, t) {
|
|
|
3610
3610
|
return !1;
|
|
3611
3611
|
}
|
|
3612
3612
|
if (n !== "all") {
|
|
3613
|
-
const
|
|
3614
|
-
if (n === "active" && !
|
|
3613
|
+
const f = t.isActive();
|
|
3614
|
+
if (n === "active" && !f || n === "inactive" && f)
|
|
3615
3615
|
return !1;
|
|
3616
3616
|
}
|
|
3617
3617
|
return !(typeof d == "boolean" && t.isStale() !== d || s && s !== t.state.fetchStatus || a && !a(t));
|
|
@@ -3648,11 +3648,11 @@ function Gn(e, t) {
|
|
|
3648
3648
|
const n = Lr(e) && Lr(t);
|
|
3649
3649
|
if (!n && !(Xn(e) && Xn(t))) return t;
|
|
3650
3650
|
const s = (n ? e : Object.keys(e)).length, a = n ? t : Object.keys(t), o = a.length, d = n ? new Array(o) : {};
|
|
3651
|
-
let
|
|
3651
|
+
let f = 0;
|
|
3652
3652
|
for (let h = 0; h < o; h++) {
|
|
3653
3653
|
const C = n ? h : a[h], y = e[C], E = t[C];
|
|
3654
3654
|
if (y === E) {
|
|
3655
|
-
d[C] = y, (n ? h < s : Ao.call(e, C)) &&
|
|
3655
|
+
d[C] = y, (n ? h < s : Ao.call(e, C)) && f++;
|
|
3656
3656
|
continue;
|
|
3657
3657
|
}
|
|
3658
3658
|
if (y === null || E === null || typeof y != "object" || typeof E != "object") {
|
|
@@ -3660,9 +3660,9 @@ function Gn(e, t) {
|
|
|
3660
3660
|
continue;
|
|
3661
3661
|
}
|
|
3662
3662
|
const S = Gn(y, E);
|
|
3663
|
-
d[C] = S, S === y &&
|
|
3663
|
+
d[C] = S, S === y && f++;
|
|
3664
3664
|
}
|
|
3665
|
-
return s === o &&
|
|
3665
|
+
return s === o && f === s ? e : d;
|
|
3666
3666
|
}
|
|
3667
3667
|
function Fn(e, t) {
|
|
3668
3668
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
@@ -3741,20 +3741,20 @@ var bt, rt, Rt, jr, xo = (jr = class extends Xt {
|
|
|
3741
3741
|
});
|
|
3742
3742
|
}
|
|
3743
3743
|
onSubscribe() {
|
|
3744
|
-
|
|
3744
|
+
l(this, rt) || this.setEventListener(l(this, Rt));
|
|
3745
3745
|
}
|
|
3746
3746
|
onUnsubscribe() {
|
|
3747
3747
|
var t;
|
|
3748
|
-
this.hasListeners() || ((t =
|
|
3748
|
+
this.hasListeners() || ((t = l(this, rt)) == null || t.call(this), I(this, rt, void 0));
|
|
3749
3749
|
}
|
|
3750
3750
|
setEventListener(t) {
|
|
3751
3751
|
var n;
|
|
3752
|
-
I(this, Rt, t), (n =
|
|
3752
|
+
I(this, Rt, t), (n = l(this, rt)) == null || n.call(this), I(this, rt, t((r) => {
|
|
3753
3753
|
typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
|
|
3754
3754
|
}));
|
|
3755
3755
|
}
|
|
3756
3756
|
setFocused(t) {
|
|
3757
|
-
|
|
3757
|
+
l(this, bt) !== t && (I(this, bt, t), this.onFocus());
|
|
3758
3758
|
}
|
|
3759
3759
|
onFocus() {
|
|
3760
3760
|
const t = this.isFocused();
|
|
@@ -3764,7 +3764,7 @@ var bt, rt, Rt, jr, xo = (jr = class extends Xt {
|
|
|
3764
3764
|
}
|
|
3765
3765
|
isFocused() {
|
|
3766
3766
|
var t;
|
|
3767
|
-
return typeof
|
|
3767
|
+
return typeof l(this, bt) == "boolean" ? l(this, bt) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
3768
3768
|
}
|
|
3769
3769
|
}, bt = new WeakMap(), rt = new WeakMap(), Rt = new WeakMap(), jr), Er = new xo();
|
|
3770
3770
|
function Yn() {
|
|
@@ -3804,29 +3804,29 @@ function To() {
|
|
|
3804
3804
|
const d = e;
|
|
3805
3805
|
e = [], d.length && s(() => {
|
|
3806
3806
|
r(() => {
|
|
3807
|
-
d.forEach((
|
|
3808
|
-
n(
|
|
3807
|
+
d.forEach((f) => {
|
|
3808
|
+
n(f);
|
|
3809
3809
|
});
|
|
3810
3810
|
});
|
|
3811
3811
|
});
|
|
3812
3812
|
};
|
|
3813
3813
|
return {
|
|
3814
3814
|
batch: (d) => {
|
|
3815
|
-
let
|
|
3815
|
+
let f;
|
|
3816
3816
|
t++;
|
|
3817
3817
|
try {
|
|
3818
|
-
|
|
3818
|
+
f = d();
|
|
3819
3819
|
} finally {
|
|
3820
3820
|
t--, t || o();
|
|
3821
3821
|
}
|
|
3822
|
-
return
|
|
3822
|
+
return f;
|
|
3823
3823
|
},
|
|
3824
3824
|
/**
|
|
3825
3825
|
* All calls to the wrapped function will be batched.
|
|
3826
3826
|
*/
|
|
3827
|
-
batchCalls: (d) => (...
|
|
3827
|
+
batchCalls: (d) => (...f) => {
|
|
3828
3828
|
a(() => {
|
|
3829
|
-
d(...
|
|
3829
|
+
d(...f);
|
|
3830
3830
|
});
|
|
3831
3831
|
},
|
|
3832
3832
|
schedule: a,
|
|
@@ -3865,23 +3865,23 @@ var ce = To(), kt, st, _t, Gr, wo = (Gr = class extends Xt {
|
|
|
3865
3865
|
});
|
|
3866
3866
|
}
|
|
3867
3867
|
onSubscribe() {
|
|
3868
|
-
|
|
3868
|
+
l(this, st) || this.setEventListener(l(this, _t));
|
|
3869
3869
|
}
|
|
3870
3870
|
onUnsubscribe() {
|
|
3871
3871
|
var t;
|
|
3872
|
-
this.hasListeners() || ((t =
|
|
3872
|
+
this.hasListeners() || ((t = l(this, st)) == null || t.call(this), I(this, st, void 0));
|
|
3873
3873
|
}
|
|
3874
3874
|
setEventListener(t) {
|
|
3875
3875
|
var n;
|
|
3876
|
-
I(this, _t, t), (n =
|
|
3876
|
+
I(this, _t, t), (n = l(this, st)) == null || n.call(this), I(this, st, t(this.setOnline.bind(this)));
|
|
3877
3877
|
}
|
|
3878
3878
|
setOnline(t) {
|
|
3879
|
-
|
|
3879
|
+
l(this, kt) !== t && (I(this, kt, t), this.listeners.forEach((r) => {
|
|
3880
3880
|
r(t);
|
|
3881
3881
|
}));
|
|
3882
3882
|
}
|
|
3883
3883
|
isOnline() {
|
|
3884
|
-
return
|
|
3884
|
+
return l(this, kt);
|
|
3885
3885
|
}
|
|
3886
3886
|
}, kt = new WeakMap(), st = new WeakMap(), _t = new WeakMap(), Gr), Sn = new wo();
|
|
3887
3887
|
function Fo(e) {
|
|
@@ -3905,7 +3905,7 @@ function Ps(e) {
|
|
|
3905
3905
|
}
|
|
3906
3906
|
}, d = () => {
|
|
3907
3907
|
t = !0;
|
|
3908
|
-
},
|
|
3908
|
+
}, f = () => {
|
|
3909
3909
|
t = !1;
|
|
3910
3910
|
}, h = () => Er.isFocused() && (e.networkMode === "always" || Sn.isOnline()) && e.canRun(), C = () => vs(e.networkMode) && e.canRun(), y = (O) => {
|
|
3911
3911
|
a() || (r == null || r(), s.resolve(O));
|
|
@@ -3919,7 +3919,7 @@ function Ps(e) {
|
|
|
3919
3919
|
}).then(() => {
|
|
3920
3920
|
var O;
|
|
3921
3921
|
r = void 0, a() || (O = e.onContinue) == null || O.call(e);
|
|
3922
|
-
}),
|
|
3922
|
+
}), v = () => {
|
|
3923
3923
|
if (a())
|
|
3924
3924
|
return;
|
|
3925
3925
|
let O;
|
|
@@ -3939,7 +3939,7 @@ function Ps(e) {
|
|
|
3939
3939
|
return;
|
|
3940
3940
|
}
|
|
3941
3941
|
n++, (z = e.onFail) == null || z.call(e, n, k), go(R).then(() => h() ? void 0 : S()).then(() => {
|
|
3942
|
-
t ? E(k) :
|
|
3942
|
+
t ? E(k) : v();
|
|
3943
3943
|
});
|
|
3944
3944
|
});
|
|
3945
3945
|
};
|
|
@@ -3949,9 +3949,9 @@ function Ps(e) {
|
|
|
3949
3949
|
cancel: o,
|
|
3950
3950
|
continue: () => (r == null || r(), s),
|
|
3951
3951
|
cancelRetry: d,
|
|
3952
|
-
continueRetry:
|
|
3952
|
+
continueRetry: f,
|
|
3953
3953
|
canStart: C,
|
|
3954
|
-
start: () => (C() ?
|
|
3954
|
+
start: () => (C() ? v() : S().then(v), s)
|
|
3955
3955
|
};
|
|
3956
3956
|
}
|
|
3957
3957
|
var Et, Xr, Os = (Xr = class {
|
|
@@ -3973,7 +3973,7 @@ var Et, Xr, Os = (Xr = class {
|
|
|
3973
3973
|
);
|
|
3974
3974
|
}
|
|
3975
3975
|
clearGcTimeout() {
|
|
3976
|
-
|
|
3976
|
+
l(this, Et) && (At.clearTimeout(l(this, Et)), I(this, Et, void 0));
|
|
3977
3977
|
}
|
|
3978
3978
|
}, Et = new WeakMap(), Xr), xt, Ut, Be, Ct, de, tn, Tt, Ue, Ge, Zr, Do = (Zr = class extends Os {
|
|
3979
3979
|
constructor(t) {
|
|
@@ -3986,17 +3986,17 @@ var Et, Xr, Os = (Xr = class {
|
|
|
3986
3986
|
L(this, de);
|
|
3987
3987
|
L(this, tn);
|
|
3988
3988
|
L(this, Tt);
|
|
3989
|
-
I(this, Tt, !1), I(this, tn, t.defaultOptions), this.setOptions(t.options), this.observers = [], I(this, Ct, t.client), I(this, Be,
|
|
3989
|
+
I(this, Tt, !1), I(this, tn, t.defaultOptions), this.setOptions(t.options), this.observers = [], I(this, Ct, t.client), I(this, Be, l(this, Ct).getQueryCache()), this.queryKey = t.queryKey, this.queryHash = t.queryHash, I(this, xt, Kr(this.options)), this.state = t.state ?? l(this, xt), this.scheduleGc();
|
|
3990
3990
|
}
|
|
3991
3991
|
get meta() {
|
|
3992
3992
|
return this.options.meta;
|
|
3993
3993
|
}
|
|
3994
3994
|
get promise() {
|
|
3995
3995
|
var t;
|
|
3996
|
-
return (t =
|
|
3996
|
+
return (t = l(this, de)) == null ? void 0 : t.promise;
|
|
3997
3997
|
}
|
|
3998
3998
|
setOptions(t) {
|
|
3999
|
-
if (this.options = { ...
|
|
3999
|
+
if (this.options = { ...l(this, tn), ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
4000
4000
|
const n = Kr(this.options);
|
|
4001
4001
|
n.data !== void 0 && (this.setState(
|
|
4002
4002
|
qr(n.data, n.dataUpdatedAt)
|
|
@@ -4004,7 +4004,7 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4004
4004
|
}
|
|
4005
4005
|
}
|
|
4006
4006
|
optionalRemove() {
|
|
4007
|
-
!this.observers.length && this.state.fetchStatus === "idle" &&
|
|
4007
|
+
!this.observers.length && this.state.fetchStatus === "idle" && l(this, Be).remove(this);
|
|
4008
4008
|
}
|
|
4009
4009
|
setData(t, n) {
|
|
4010
4010
|
const r = Zn(this.state.data, t, this.options);
|
|
@@ -4020,14 +4020,14 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4020
4020
|
}
|
|
4021
4021
|
cancel(t) {
|
|
4022
4022
|
var r, s;
|
|
4023
|
-
const n = (r =
|
|
4024
|
-
return (s =
|
|
4023
|
+
const n = (r = l(this, de)) == null ? void 0 : r.promise;
|
|
4024
|
+
return (s = l(this, de)) == null || s.cancel(t), n ? n.then(xe).catch(xe) : Promise.resolve();
|
|
4025
4025
|
}
|
|
4026
4026
|
destroy() {
|
|
4027
4027
|
super.destroy(), this.cancel({ silent: !0 });
|
|
4028
4028
|
}
|
|
4029
4029
|
reset() {
|
|
4030
|
-
this.destroy(), this.setState(
|
|
4030
|
+
this.destroy(), this.setState(l(this, xt));
|
|
4031
4031
|
}
|
|
4032
4032
|
isActive() {
|
|
4033
4033
|
return this.observers.some(
|
|
@@ -4053,18 +4053,18 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4053
4053
|
onFocus() {
|
|
4054
4054
|
var n;
|
|
4055
4055
|
const t = this.observers.find((r) => r.shouldFetchOnWindowFocus());
|
|
4056
|
-
t == null || t.refetch({ cancelRefetch: !1 }), (n =
|
|
4056
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (n = l(this, de)) == null || n.continue();
|
|
4057
4057
|
}
|
|
4058
4058
|
onOnline() {
|
|
4059
4059
|
var n;
|
|
4060
4060
|
const t = this.observers.find((r) => r.shouldFetchOnReconnect());
|
|
4061
|
-
t == null || t.refetch({ cancelRefetch: !1 }), (n =
|
|
4061
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (n = l(this, de)) == null || n.continue();
|
|
4062
4062
|
}
|
|
4063
4063
|
addObserver(t) {
|
|
4064
|
-
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(),
|
|
4064
|
+
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), l(this, Be).notify({ type: "observerAdded", query: this, observer: t }));
|
|
4065
4065
|
}
|
|
4066
4066
|
removeObserver(t) {
|
|
4067
|
-
this.observers.includes(t) && (this.observers = this.observers.filter((n) => n !== t), this.observers.length || (
|
|
4067
|
+
this.observers.includes(t) && (this.observers = this.observers.filter((n) => n !== t), this.observers.length || (l(this, de) && (l(this, Tt) ? l(this, de).cancel({ revert: !0 }) : l(this, de).cancelRetry()), this.scheduleGc()), l(this, Be).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
4068
4068
|
}
|
|
4069
4069
|
getObserversCount() {
|
|
4070
4070
|
return this.observers.length;
|
|
@@ -4073,15 +4073,15 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4073
4073
|
this.state.isInvalidated || W(this, Ue, Ge).call(this, { type: "invalidate" });
|
|
4074
4074
|
}
|
|
4075
4075
|
async fetch(t, n) {
|
|
4076
|
-
var
|
|
4076
|
+
var f, h, C, y, E, S, v, O, B, k, F, q;
|
|
4077
4077
|
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
4078
4078
|
// re-start the fetch; there is a chance that the query is still in a
|
|
4079
4079
|
// pending state when that happens
|
|
4080
|
-
((
|
|
4080
|
+
((f = l(this, de)) == null ? void 0 : f.status()) !== "rejected") {
|
|
4081
4081
|
if (this.state.data !== void 0 && (n != null && n.cancelRefetch))
|
|
4082
4082
|
this.cancel({ silent: !0 });
|
|
4083
|
-
else if (
|
|
4084
|
-
return
|
|
4083
|
+
else if (l(this, de))
|
|
4084
|
+
return l(this, de).continueRetry(), l(this, de).promise;
|
|
4085
4085
|
}
|
|
4086
4086
|
if (t && this.setOptions(t), !this.options.queryFn) {
|
|
4087
4087
|
const R = this.observers.find((X) => X.options.queryFn);
|
|
@@ -4098,7 +4098,7 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4098
4098
|
}, a = () => {
|
|
4099
4099
|
const R = Ds(this.options, n), z = (() => {
|
|
4100
4100
|
const ie = {
|
|
4101
|
-
client:
|
|
4101
|
+
client: l(this, Ct),
|
|
4102
4102
|
queryKey: this.queryKey,
|
|
4103
4103
|
meta: this.meta
|
|
4104
4104
|
};
|
|
@@ -4114,7 +4114,7 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4114
4114
|
fetchOptions: n,
|
|
4115
4115
|
options: this.options,
|
|
4116
4116
|
queryKey: this.queryKey,
|
|
4117
|
-
client:
|
|
4117
|
+
client: l(this, Ct),
|
|
4118
4118
|
state: this.state,
|
|
4119
4119
|
fetchFn: a
|
|
4120
4120
|
};
|
|
@@ -4125,7 +4125,7 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4125
4125
|
fn: d.fetchFn,
|
|
4126
4126
|
onCancel: (R) => {
|
|
4127
4127
|
R instanceof Jn && R.revert && this.setState({
|
|
4128
|
-
...
|
|
4128
|
+
...l(this, Ut),
|
|
4129
4129
|
fetchStatus: "idle"
|
|
4130
4130
|
}), r.abort();
|
|
4131
4131
|
},
|
|
@@ -4144,13 +4144,13 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4144
4144
|
canRun: () => !0
|
|
4145
4145
|
}));
|
|
4146
4146
|
try {
|
|
4147
|
-
const R = await
|
|
4147
|
+
const R = await l(this, de).start();
|
|
4148
4148
|
if (R === void 0)
|
|
4149
4149
|
throw process.env.NODE_ENV !== "production" && console.error(
|
|
4150
4150
|
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
4151
4151
|
), new Error(`${this.queryHash} data is undefined`);
|
|
4152
|
-
return this.setData(R), (S = (E =
|
|
4153
|
-
|
|
4152
|
+
return this.setData(R), (S = (E = l(this, Be).config).onSuccess) == null || S.call(E, R, this), (O = (v = l(this, Be).config).onSettled) == null || O.call(
|
|
4153
|
+
v,
|
|
4154
4154
|
R,
|
|
4155
4155
|
this.state.error,
|
|
4156
4156
|
this
|
|
@@ -4158,7 +4158,7 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4158
4158
|
} catch (R) {
|
|
4159
4159
|
if (R instanceof Jn) {
|
|
4160
4160
|
if (R.silent)
|
|
4161
|
-
return
|
|
4161
|
+
return l(this, de).promise;
|
|
4162
4162
|
if (R.revert) {
|
|
4163
4163
|
if (this.state.data === void 0)
|
|
4164
4164
|
throw R;
|
|
@@ -4168,11 +4168,11 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4168
4168
|
throw W(this, Ue, Ge).call(this, {
|
|
4169
4169
|
type: "error",
|
|
4170
4170
|
error: R
|
|
4171
|
-
}), (k = (B =
|
|
4171
|
+
}), (k = (B = l(this, Be).config).onError) == null || k.call(
|
|
4172
4172
|
B,
|
|
4173
4173
|
R,
|
|
4174
4174
|
this
|
|
4175
|
-
), (q = (F =
|
|
4175
|
+
), (q = (F = l(this, Be).config).onSettled) == null || q.call(
|
|
4176
4176
|
F,
|
|
4177
4177
|
this.state.data,
|
|
4178
4178
|
R,
|
|
@@ -4246,7 +4246,7 @@ var Et, Xr, Os = (Xr = class {
|
|
|
4246
4246
|
this.state = n(this.state), ce.batch(() => {
|
|
4247
4247
|
this.observers.forEach((r) => {
|
|
4248
4248
|
r.onQueryUpdate();
|
|
4249
|
-
}),
|
|
4249
|
+
}), l(this, Be).notify({ query: this, type: "updated", action: t });
|
|
4250
4250
|
});
|
|
4251
4251
|
}, Zr);
|
|
4252
4252
|
function Bs(e, t) {
|
|
@@ -4313,59 +4313,59 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4313
4313
|
this.refetch = this.refetch.bind(this);
|
|
4314
4314
|
}
|
|
4315
4315
|
onSubscribe() {
|
|
4316
|
-
this.listeners.size === 1 && (
|
|
4316
|
+
this.listeners.size === 1 && (l(this, j).addObserver(this), Hr(l(this, j), this.options) ? W(this, Y, Jt).call(this) : this.updateResult(), W(this, Y, rr).call(this));
|
|
4317
4317
|
}
|
|
4318
4318
|
onUnsubscribe() {
|
|
4319
4319
|
this.hasListeners() || this.destroy();
|
|
4320
4320
|
}
|
|
4321
4321
|
shouldFetchOnReconnect() {
|
|
4322
4322
|
return or(
|
|
4323
|
-
|
|
4323
|
+
l(this, j),
|
|
4324
4324
|
this.options,
|
|
4325
4325
|
this.options.refetchOnReconnect
|
|
4326
4326
|
);
|
|
4327
4327
|
}
|
|
4328
4328
|
shouldFetchOnWindowFocus() {
|
|
4329
4329
|
return or(
|
|
4330
|
-
|
|
4330
|
+
l(this, j),
|
|
4331
4331
|
this.options,
|
|
4332
4332
|
this.options.refetchOnWindowFocus
|
|
4333
4333
|
);
|
|
4334
4334
|
}
|
|
4335
4335
|
destroy() {
|
|
4336
|
-
this.listeners = /* @__PURE__ */ new Set(), W(this, Y, sr).call(this), W(this, Y, ar).call(this),
|
|
4336
|
+
this.listeners = /* @__PURE__ */ new Set(), W(this, Y, sr).call(this), W(this, Y, ar).call(this), l(this, j).removeObserver(this);
|
|
4337
4337
|
}
|
|
4338
4338
|
setOptions(t) {
|
|
4339
|
-
const n = this.options, r =
|
|
4340
|
-
if (this.options =
|
|
4339
|
+
const n = this.options, r = l(this, j);
|
|
4340
|
+
if (this.options = l(this, Fe).defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof Ie(this.options.enabled, l(this, j)) != "boolean")
|
|
4341
4341
|
throw new Error(
|
|
4342
4342
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
4343
4343
|
);
|
|
4344
|
-
W(this, Y, ir).call(this),
|
|
4344
|
+
W(this, Y, ir).call(this), l(this, j).setOptions(this.options), n._defaulted && !Fn(this.options, n) && l(this, Fe).getQueryCache().notify({
|
|
4345
4345
|
type: "observerOptionsUpdated",
|
|
4346
|
-
query:
|
|
4346
|
+
query: l(this, j),
|
|
4347
4347
|
observer: this
|
|
4348
4348
|
});
|
|
4349
4349
|
const s = this.hasListeners();
|
|
4350
4350
|
s && Wr(
|
|
4351
|
-
|
|
4351
|
+
l(this, j),
|
|
4352
4352
|
r,
|
|
4353
4353
|
this.options,
|
|
4354
4354
|
n
|
|
4355
|
-
) && W(this, Y, Jt).call(this), this.updateResult(), s && (
|
|
4355
|
+
) && W(this, Y, Jt).call(this), this.updateResult(), s && (l(this, j) !== r || Ie(this.options.enabled, l(this, j)) !== Ie(n.enabled, l(this, j)) || lt(this.options.staleTime, l(this, j)) !== lt(n.staleTime, l(this, j))) && W(this, Y, er).call(this);
|
|
4356
4356
|
const a = W(this, Y, tr).call(this);
|
|
4357
|
-
s && (
|
|
4357
|
+
s && (l(this, j) !== r || Ie(this.options.enabled, l(this, j)) !== Ie(n.enabled, l(this, j)) || a !== l(this, it)) && W(this, Y, nr).call(this, a);
|
|
4358
4358
|
}
|
|
4359
4359
|
getOptimisticResult(t) {
|
|
4360
|
-
const n =
|
|
4361
|
-
return Po(this, r) && (I(this, be, r), I(this, Mt, this.options), I(this, wt,
|
|
4360
|
+
const n = l(this, Fe).getQueryCache().build(l(this, Fe), t), r = this.createResult(n, t);
|
|
4361
|
+
return Po(this, r) && (I(this, be, r), I(this, Mt, this.options), I(this, wt, l(this, j).state)), r;
|
|
4362
4362
|
}
|
|
4363
4363
|
getCurrentResult() {
|
|
4364
|
-
return
|
|
4364
|
+
return l(this, be);
|
|
4365
4365
|
}
|
|
4366
4366
|
trackResult(t, n) {
|
|
4367
4367
|
return new Proxy(t, {
|
|
4368
|
-
get: (r, s) => (this.trackProp(s), n == null || n(s), s === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender &&
|
|
4368
|
+
get: (r, s) => (this.trackProp(s), n == null || n(s), s === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && l(this, Xe).status === "pending" && l(this, Xe).reject(
|
|
4369
4369
|
new Error(
|
|
4370
4370
|
"experimental_prefetchInRender feature flag is not enabled"
|
|
4371
4371
|
)
|
|
@@ -4373,10 +4373,10 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4373
4373
|
});
|
|
4374
4374
|
}
|
|
4375
4375
|
trackProp(t) {
|
|
4376
|
-
|
|
4376
|
+
l(this, qt).add(t);
|
|
4377
4377
|
}
|
|
4378
4378
|
getCurrentQuery() {
|
|
4379
|
-
return
|
|
4379
|
+
return l(this, j);
|
|
4380
4380
|
}
|
|
4381
4381
|
refetch({ ...t } = {}) {
|
|
4382
4382
|
return this.fetch({
|
|
@@ -4384,18 +4384,18 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4384
4384
|
});
|
|
4385
4385
|
}
|
|
4386
4386
|
fetchOptimistic(t) {
|
|
4387
|
-
const n =
|
|
4387
|
+
const n = l(this, Fe).defaultQueryOptions(t), r = l(this, Fe).getQueryCache().build(l(this, Fe), n);
|
|
4388
4388
|
return r.fetch().then(() => this.createResult(r, n));
|
|
4389
4389
|
}
|
|
4390
4390
|
fetch(t) {
|
|
4391
4391
|
return W(this, Y, Jt).call(this, {
|
|
4392
4392
|
...t,
|
|
4393
4393
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
4394
|
-
}).then(() => (this.updateResult(),
|
|
4394
|
+
}).then(() => (this.updateResult(), l(this, be)));
|
|
4395
4395
|
}
|
|
4396
4396
|
createResult(t, n) {
|
|
4397
4397
|
var c;
|
|
4398
|
-
const r =
|
|
4398
|
+
const r = l(this, j), s = this.options, a = l(this, be), o = l(this, wt), d = l(this, Mt), h = t !== r ? t.state : l(this, nn), { state: C } = t;
|
|
4399
4399
|
let y = { ...C }, E = !1, S;
|
|
4400
4400
|
if (n._optimisticResults) {
|
|
4401
4401
|
const u = this.hasListeners(), b = !u && Hr(t, n), m = u && Wr(t, r, n, s);
|
|
@@ -4404,14 +4404,14 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4404
4404
|
...Bs(C.data, t.options)
|
|
4405
4405
|
}), n._optimisticResults === "isRestoring" && (y.fetchStatus = "idle");
|
|
4406
4406
|
}
|
|
4407
|
-
let { error:
|
|
4407
|
+
let { error: v, errorUpdatedAt: O, status: B } = y;
|
|
4408
4408
|
S = y.data;
|
|
4409
4409
|
let k = !1;
|
|
4410
4410
|
if (n.placeholderData !== void 0 && S === void 0 && B === "pending") {
|
|
4411
4411
|
let u;
|
|
4412
4412
|
a != null && a.isPlaceholderData && n.placeholderData === (d == null ? void 0 : d.placeholderData) ? (u = a.data, k = !0) : u = typeof n.placeholderData == "function" ? n.placeholderData(
|
|
4413
|
-
(c =
|
|
4414
|
-
|
|
4413
|
+
(c = l(this, Nt)) == null ? void 0 : c.state.data,
|
|
4414
|
+
l(this, Nt)
|
|
4415
4415
|
) : n.placeholderData, u !== void 0 && (B = "success", S = Zn(
|
|
4416
4416
|
a == null ? void 0 : a.data,
|
|
4417
4417
|
u,
|
|
@@ -4419,15 +4419,15 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4419
4419
|
), E = !0);
|
|
4420
4420
|
}
|
|
4421
4421
|
if (n.select && S !== void 0 && !k)
|
|
4422
|
-
if (a && S === (o == null ? void 0 : o.data) && n.select ===
|
|
4423
|
-
S =
|
|
4422
|
+
if (a && S === (o == null ? void 0 : o.data) && n.select === l(this, rn))
|
|
4423
|
+
S = l(this, Lt);
|
|
4424
4424
|
else
|
|
4425
4425
|
try {
|
|
4426
4426
|
I(this, rn, n.select), S = n.select(S), S = Zn(a == null ? void 0 : a.data, S, n), I(this, Lt, S), I(this, at, null);
|
|
4427
4427
|
} catch (u) {
|
|
4428
4428
|
I(this, at, u);
|
|
4429
4429
|
}
|
|
4430
|
-
|
|
4430
|
+
l(this, at) && (v = l(this, at), S = l(this, Lt), O = Date.now(), B = "error");
|
|
4431
4431
|
const F = y.fetchStatus === "fetching", q = B === "pending", R = B === "error", X = q && F, z = S !== void 0, i = {
|
|
4432
4432
|
status: B,
|
|
4433
4433
|
fetchStatus: y.fetchStatus,
|
|
@@ -4438,7 +4438,7 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4438
4438
|
isLoading: X,
|
|
4439
4439
|
data: S,
|
|
4440
4440
|
dataUpdatedAt: y.dataUpdatedAt,
|
|
4441
|
-
error:
|
|
4441
|
+
error: v,
|
|
4442
4442
|
errorUpdatedAt: O,
|
|
4443
4443
|
failureCount: y.fetchFailureCount,
|
|
4444
4444
|
failureReason: y.fetchFailureReason,
|
|
@@ -4453,7 +4453,7 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4453
4453
|
isRefetchError: R && z,
|
|
4454
4454
|
isStale: xr(t, n),
|
|
4455
4455
|
refetch: this.refetch,
|
|
4456
|
-
promise:
|
|
4456
|
+
promise: l(this, Xe),
|
|
4457
4457
|
isEnabled: Ie(n.enabled, t) !== !1
|
|
4458
4458
|
};
|
|
4459
4459
|
if (this.options.experimental_prefetchInRender) {
|
|
@@ -4462,7 +4462,7 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4462
4462
|
}, b = () => {
|
|
4463
4463
|
const A = I(this, Xe, i.promise = Yn());
|
|
4464
4464
|
u(A);
|
|
4465
|
-
}, m =
|
|
4465
|
+
}, m = l(this, Xe);
|
|
4466
4466
|
switch (m.status) {
|
|
4467
4467
|
case "pending":
|
|
4468
4468
|
t.queryHash === r.queryHash && u(m);
|
|
@@ -4478,22 +4478,22 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4478
4478
|
return i;
|
|
4479
4479
|
}
|
|
4480
4480
|
updateResult() {
|
|
4481
|
-
const t =
|
|
4482
|
-
if (I(this, wt,
|
|
4481
|
+
const t = l(this, be), n = this.createResult(l(this, j), this.options);
|
|
4482
|
+
if (I(this, wt, l(this, j).state), I(this, Mt, this.options), l(this, wt).data !== void 0 && I(this, Nt, l(this, j)), Fn(n, t))
|
|
4483
4483
|
return;
|
|
4484
4484
|
I(this, be, n);
|
|
4485
4485
|
const r = () => {
|
|
4486
4486
|
if (!t)
|
|
4487
4487
|
return !0;
|
|
4488
4488
|
const { notifyOnChangeProps: s } = this.options, a = typeof s == "function" ? s() : s;
|
|
4489
|
-
if (a === "all" || !a && !
|
|
4489
|
+
if (a === "all" || !a && !l(this, qt).size)
|
|
4490
4490
|
return !0;
|
|
4491
4491
|
const o = new Set(
|
|
4492
|
-
a ??
|
|
4492
|
+
a ?? l(this, qt)
|
|
4493
4493
|
);
|
|
4494
|
-
return this.options.throwOnError && o.add("error"), Object.keys(
|
|
4495
|
-
const
|
|
4496
|
-
return
|
|
4494
|
+
return this.options.throwOnError && o.add("error"), Object.keys(l(this, be)).some((d) => {
|
|
4495
|
+
const f = d;
|
|
4496
|
+
return l(this, be)[f] !== t[f] && o.has(f);
|
|
4497
4497
|
});
|
|
4498
4498
|
};
|
|
4499
4499
|
W(this, Y, Is).call(this, { listeners: r() });
|
|
@@ -4503,7 +4503,7 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4503
4503
|
}
|
|
4504
4504
|
}, Fe = new WeakMap(), j = new WeakMap(), nn = new WeakMap(), be = new WeakMap(), wt = new WeakMap(), Mt = new WeakMap(), Xe = new WeakMap(), at = new WeakMap(), rn = new WeakMap(), Lt = new WeakMap(), Nt = new WeakMap(), Ft = new WeakMap(), Dt = new WeakMap(), it = new WeakMap(), qt = new WeakMap(), Y = new WeakSet(), Jt = function(t) {
|
|
4505
4505
|
W(this, Y, ir).call(this);
|
|
4506
|
-
let n =
|
|
4506
|
+
let n = l(this, j).fetch(
|
|
4507
4507
|
this.options,
|
|
4508
4508
|
t
|
|
4509
4509
|
);
|
|
@@ -4512,38 +4512,38 @@ var Fe, j, nn, be, wt, Mt, Xe, at, rn, Lt, Nt, Ft, Dt, it, qt, Y, Jt, er, tr, nr
|
|
|
4512
4512
|
W(this, Y, sr).call(this);
|
|
4513
4513
|
const t = lt(
|
|
4514
4514
|
this.options.staleTime,
|
|
4515
|
-
|
|
4515
|
+
l(this, j)
|
|
4516
4516
|
);
|
|
4517
|
-
if (Ot ||
|
|
4517
|
+
if (Ot || l(this, be).isStale || !jn(t))
|
|
4518
4518
|
return;
|
|
4519
|
-
const r = Fs(
|
|
4519
|
+
const r = Fs(l(this, be).dataUpdatedAt, t) + 1;
|
|
4520
4520
|
I(this, Ft, At.setTimeout(() => {
|
|
4521
|
-
|
|
4521
|
+
l(this, be).isStale || this.updateResult();
|
|
4522
4522
|
}, r));
|
|
4523
4523
|
}, tr = function() {
|
|
4524
|
-
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(
|
|
4524
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(l(this, j)) : this.options.refetchInterval) ?? !1;
|
|
4525
4525
|
}, nr = function(t) {
|
|
4526
|
-
W(this, Y, ar).call(this), I(this, it, t), !(Ot || Ie(this.options.enabled,
|
|
4526
|
+
W(this, Y, ar).call(this), I(this, it, t), !(Ot || Ie(this.options.enabled, l(this, j)) === !1 || !jn(l(this, it)) || l(this, it) === 0) && I(this, Dt, At.setInterval(() => {
|
|
4527
4527
|
(this.options.refetchIntervalInBackground || Er.isFocused()) && W(this, Y, Jt).call(this);
|
|
4528
|
-
},
|
|
4528
|
+
}, l(this, it)));
|
|
4529
4529
|
}, rr = function() {
|
|
4530
4530
|
W(this, Y, er).call(this), W(this, Y, nr).call(this, W(this, Y, tr).call(this));
|
|
4531
4531
|
}, sr = function() {
|
|
4532
|
-
|
|
4532
|
+
l(this, Ft) && (At.clearTimeout(l(this, Ft)), I(this, Ft, void 0));
|
|
4533
4533
|
}, ar = function() {
|
|
4534
|
-
|
|
4534
|
+
l(this, Dt) && (At.clearInterval(l(this, Dt)), I(this, Dt, void 0));
|
|
4535
4535
|
}, ir = function() {
|
|
4536
|
-
const t =
|
|
4537
|
-
if (t ===
|
|
4536
|
+
const t = l(this, Fe).getQueryCache().build(l(this, Fe), this.options);
|
|
4537
|
+
if (t === l(this, j))
|
|
4538
4538
|
return;
|
|
4539
|
-
const n =
|
|
4539
|
+
const n = l(this, j);
|
|
4540
4540
|
I(this, j, t), I(this, nn, t.state), this.hasListeners() && (n == null || n.removeObserver(this), t.addObserver(this));
|
|
4541
4541
|
}, Is = function(t) {
|
|
4542
4542
|
ce.batch(() => {
|
|
4543
4543
|
t.listeners && this.listeners.forEach((n) => {
|
|
4544
|
-
n(
|
|
4545
|
-
}),
|
|
4546
|
-
query:
|
|
4544
|
+
n(l(this, be));
|
|
4545
|
+
}), l(this, Fe).getQueryCache().notify({
|
|
4546
|
+
query: l(this, j),
|
|
4547
4547
|
type: "observerResultsUpdated"
|
|
4548
4548
|
});
|
|
4549
4549
|
});
|
|
@@ -4573,9 +4573,9 @@ function Po(e, t) {
|
|
|
4573
4573
|
function zr(e) {
|
|
4574
4574
|
return {
|
|
4575
4575
|
onFetch: (t, n) => {
|
|
4576
|
-
var C, y, E, S,
|
|
4577
|
-
const r = t.options, s = (E = (y = (C = t.fetchOptions) == null ? void 0 : C.meta) == null ? void 0 : y.fetchMore) == null ? void 0 : E.direction, a = ((S = t.state.data) == null ? void 0 : S.pages) || [], o = ((
|
|
4578
|
-
let d = { pages: [], pageParams: [] },
|
|
4576
|
+
var C, y, E, S, v;
|
|
4577
|
+
const r = t.options, s = (E = (y = (C = t.fetchOptions) == null ? void 0 : C.meta) == null ? void 0 : y.fetchMore) == null ? void 0 : E.direction, a = ((S = t.state.data) == null ? void 0 : S.pages) || [], o = ((v = t.state.data) == null ? void 0 : v.pageParams) || [];
|
|
4578
|
+
let d = { pages: [], pageParams: [] }, f = 0;
|
|
4579
4579
|
const h = async () => {
|
|
4580
4580
|
let O = !1;
|
|
4581
4581
|
const B = (q) => {
|
|
@@ -4614,11 +4614,11 @@ function zr(e) {
|
|
|
4614
4614
|
} else {
|
|
4615
4615
|
const q = e ?? a.length;
|
|
4616
4616
|
do {
|
|
4617
|
-
const R =
|
|
4618
|
-
if (
|
|
4617
|
+
const R = f === 0 ? o[0] ?? r.initialPageParam : Qr(r, d);
|
|
4618
|
+
if (f > 0 && R == null)
|
|
4619
4619
|
break;
|
|
4620
|
-
d = await F(d, R),
|
|
4621
|
-
} while (
|
|
4620
|
+
d = await F(d, R), f++;
|
|
4621
|
+
} while (f < q);
|
|
4622
4622
|
}
|
|
4623
4623
|
return d;
|
|
4624
4624
|
};
|
|
@@ -4669,33 +4669,33 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4669
4669
|
return this.options.meta;
|
|
4670
4670
|
}
|
|
4671
4671
|
addObserver(t) {
|
|
4672
|
-
|
|
4672
|
+
l(this, He).includes(t) || (l(this, He).push(t), this.clearGcTimeout(), l(this, Ee).notify({
|
|
4673
4673
|
type: "observerAdded",
|
|
4674
4674
|
mutation: this,
|
|
4675
4675
|
observer: t
|
|
4676
4676
|
}));
|
|
4677
4677
|
}
|
|
4678
4678
|
removeObserver(t) {
|
|
4679
|
-
I(this, He,
|
|
4679
|
+
I(this, He, l(this, He).filter((n) => n !== t)), this.scheduleGc(), l(this, Ee).notify({
|
|
4680
4680
|
type: "observerRemoved",
|
|
4681
4681
|
mutation: this,
|
|
4682
4682
|
observer: t
|
|
4683
4683
|
});
|
|
4684
4684
|
}
|
|
4685
4685
|
optionalRemove() {
|
|
4686
|
-
|
|
4686
|
+
l(this, He).length || (this.state.status === "pending" ? this.scheduleGc() : l(this, Ee).remove(this));
|
|
4687
4687
|
}
|
|
4688
4688
|
continue() {
|
|
4689
4689
|
var t;
|
|
4690
|
-
return ((t =
|
|
4690
|
+
return ((t = l(this, St)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
4691
4691
|
this.execute(this.state.variables);
|
|
4692
4692
|
}
|
|
4693
4693
|
async execute(t) {
|
|
4694
|
-
var o, d,
|
|
4694
|
+
var o, d, f, h, C, y, E, S, v, O, B, k, F, q, R, X, z, ie, i, c;
|
|
4695
4695
|
const n = () => {
|
|
4696
4696
|
W(this, We, nt).call(this, { type: "continue" });
|
|
4697
4697
|
}, r = {
|
|
4698
|
-
client:
|
|
4698
|
+
client: l(this, sn),
|
|
4699
4699
|
meta: this.options.meta,
|
|
4700
4700
|
mutationKey: this.options.mutationKey
|
|
4701
4701
|
};
|
|
@@ -4711,21 +4711,21 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4711
4711
|
retry: this.options.retry ?? 0,
|
|
4712
4712
|
retryDelay: this.options.retryDelay,
|
|
4713
4713
|
networkMode: this.options.networkMode,
|
|
4714
|
-
canRun: () =>
|
|
4714
|
+
canRun: () => l(this, Ee).canRun(this)
|
|
4715
4715
|
}));
|
|
4716
|
-
const s = this.state.status === "pending", a = !
|
|
4716
|
+
const s = this.state.status === "pending", a = !l(this, St).canStart();
|
|
4717
4717
|
try {
|
|
4718
4718
|
if (s)
|
|
4719
4719
|
n();
|
|
4720
4720
|
else {
|
|
4721
|
-
W(this, We, nt).call(this, { type: "pending", variables: t, isPaused: a }), await ((d = (o =
|
|
4721
|
+
W(this, We, nt).call(this, { type: "pending", variables: t, isPaused: a }), await ((d = (o = l(this, Ee).config).onMutate) == null ? void 0 : d.call(
|
|
4722
4722
|
o,
|
|
4723
4723
|
t,
|
|
4724
4724
|
this,
|
|
4725
4725
|
r
|
|
4726
4726
|
));
|
|
4727
|
-
const b = await ((h = (
|
|
4728
|
-
|
|
4727
|
+
const b = await ((h = (f = this.options).onMutate) == null ? void 0 : h.call(
|
|
4728
|
+
f,
|
|
4729
4729
|
t,
|
|
4730
4730
|
r
|
|
4731
4731
|
));
|
|
@@ -4736,8 +4736,8 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4736
4736
|
isPaused: a
|
|
4737
4737
|
});
|
|
4738
4738
|
}
|
|
4739
|
-
const u = await
|
|
4740
|
-
return await ((y = (C =
|
|
4739
|
+
const u = await l(this, St).start();
|
|
4740
|
+
return await ((y = (C = l(this, Ee).config).onSuccess) == null ? void 0 : y.call(
|
|
4741
4741
|
C,
|
|
4742
4742
|
u,
|
|
4743
4743
|
t,
|
|
@@ -4750,8 +4750,8 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4750
4750
|
t,
|
|
4751
4751
|
this.state.context,
|
|
4752
4752
|
r
|
|
4753
|
-
)), await ((O = (
|
|
4754
|
-
|
|
4753
|
+
)), await ((O = (v = l(this, Ee).config).onSettled) == null ? void 0 : O.call(
|
|
4754
|
+
v,
|
|
4755
4755
|
u,
|
|
4756
4756
|
null,
|
|
4757
4757
|
this.state.variables,
|
|
@@ -4768,7 +4768,7 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4768
4768
|
)), W(this, We, nt).call(this, { type: "success", data: u }), u;
|
|
4769
4769
|
} catch (u) {
|
|
4770
4770
|
try {
|
|
4771
|
-
throw await ((q = (F =
|
|
4771
|
+
throw await ((q = (F = l(this, Ee).config).onError) == null ? void 0 : q.call(
|
|
4772
4772
|
F,
|
|
4773
4773
|
u,
|
|
4774
4774
|
t,
|
|
@@ -4781,7 +4781,7 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4781
4781
|
t,
|
|
4782
4782
|
this.state.context,
|
|
4783
4783
|
r
|
|
4784
|
-
)), await ((ie = (z =
|
|
4784
|
+
)), await ((ie = (z = l(this, Ee).config).onSettled) == null ? void 0 : ie.call(
|
|
4785
4785
|
z,
|
|
4786
4786
|
void 0,
|
|
4787
4787
|
u,
|
|
@@ -4801,7 +4801,7 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4801
4801
|
W(this, We, nt).call(this, { type: "error", error: u });
|
|
4802
4802
|
}
|
|
4803
4803
|
} finally {
|
|
4804
|
-
|
|
4804
|
+
l(this, Ee).runNext(this);
|
|
4805
4805
|
}
|
|
4806
4806
|
}
|
|
4807
4807
|
}, sn = new WeakMap(), He = new WeakMap(), Ee = new WeakMap(), St = new WeakMap(), We = new WeakSet(), nt = function(t) {
|
|
@@ -4859,9 +4859,9 @@ var sn, He, Ee, St, We, nt, Jr, Bo = (Jr = class extends Os {
|
|
|
4859
4859
|
}
|
|
4860
4860
|
};
|
|
4861
4861
|
this.state = n(this.state), ce.batch(() => {
|
|
4862
|
-
|
|
4862
|
+
l(this, He).forEach((r) => {
|
|
4863
4863
|
r.onMutationUpdate(t);
|
|
4864
|
-
}),
|
|
4864
|
+
}), l(this, Ee).notify({
|
|
4865
4865
|
mutation: this,
|
|
4866
4866
|
type: "updated",
|
|
4867
4867
|
action: t
|
|
@@ -4900,24 +4900,24 @@ var Ze, Me, an, es, Io = (es = class extends Xt {
|
|
|
4900
4900
|
return this.add(s), s;
|
|
4901
4901
|
}
|
|
4902
4902
|
add(t) {
|
|
4903
|
-
|
|
4903
|
+
l(this, Ze).add(t);
|
|
4904
4904
|
const n = gn(t);
|
|
4905
4905
|
if (typeof n == "string") {
|
|
4906
|
-
const r =
|
|
4907
|
-
r ? r.push(t) :
|
|
4906
|
+
const r = l(this, Me).get(n);
|
|
4907
|
+
r ? r.push(t) : l(this, Me).set(n, [t]);
|
|
4908
4908
|
}
|
|
4909
4909
|
this.notify({ type: "added", mutation: t });
|
|
4910
4910
|
}
|
|
4911
4911
|
remove(t) {
|
|
4912
|
-
if (
|
|
4912
|
+
if (l(this, Ze).delete(t)) {
|
|
4913
4913
|
const n = gn(t);
|
|
4914
4914
|
if (typeof n == "string") {
|
|
4915
|
-
const r =
|
|
4915
|
+
const r = l(this, Me).get(n);
|
|
4916
4916
|
if (r)
|
|
4917
4917
|
if (r.length > 1) {
|
|
4918
4918
|
const s = r.indexOf(t);
|
|
4919
4919
|
s !== -1 && r.splice(s, 1);
|
|
4920
|
-
} else r[0] === t &&
|
|
4920
|
+
} else r[0] === t && l(this, Me).delete(n);
|
|
4921
4921
|
}
|
|
4922
4922
|
}
|
|
4923
4923
|
this.notify({ type: "removed", mutation: t });
|
|
@@ -4925,7 +4925,7 @@ var Ze, Me, an, es, Io = (es = class extends Xt {
|
|
|
4925
4925
|
canRun(t) {
|
|
4926
4926
|
const n = gn(t);
|
|
4927
4927
|
if (typeof n == "string") {
|
|
4928
|
-
const r =
|
|
4928
|
+
const r = l(this, Me).get(n), s = r == null ? void 0 : r.find(
|
|
4929
4929
|
(a) => a.state.status === "pending"
|
|
4930
4930
|
);
|
|
4931
4931
|
return !s || s === t;
|
|
@@ -4936,20 +4936,20 @@ var Ze, Me, an, es, Io = (es = class extends Xt {
|
|
|
4936
4936
|
var r;
|
|
4937
4937
|
const n = gn(t);
|
|
4938
4938
|
if (typeof n == "string") {
|
|
4939
|
-
const s = (r =
|
|
4939
|
+
const s = (r = l(this, Me).get(n)) == null ? void 0 : r.find((a) => a !== t && a.state.isPaused);
|
|
4940
4940
|
return (s == null ? void 0 : s.continue()) ?? Promise.resolve();
|
|
4941
4941
|
} else
|
|
4942
4942
|
return Promise.resolve();
|
|
4943
4943
|
}
|
|
4944
4944
|
clear() {
|
|
4945
4945
|
ce.batch(() => {
|
|
4946
|
-
|
|
4946
|
+
l(this, Ze).forEach((t) => {
|
|
4947
4947
|
this.notify({ type: "removed", mutation: t });
|
|
4948
|
-
}),
|
|
4948
|
+
}), l(this, Ze).clear(), l(this, Me).clear();
|
|
4949
4949
|
});
|
|
4950
4950
|
}
|
|
4951
4951
|
getAll() {
|
|
4952
|
-
return Array.from(
|
|
4952
|
+
return Array.from(l(this, Ze));
|
|
4953
4953
|
}
|
|
4954
4954
|
find(t) {
|
|
4955
4955
|
const n = { exact: !0, ...t };
|
|
@@ -4996,33 +4996,33 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
4996
4996
|
setOptions(t) {
|
|
4997
4997
|
var r;
|
|
4998
4998
|
const n = this.options;
|
|
4999
|
-
this.options =
|
|
4999
|
+
this.options = l(this, Ye).defaultMutationOptions(t), Fn(this.options, n) || l(this, Ye).getMutationCache().notify({
|
|
5000
5000
|
type: "observerOptionsUpdated",
|
|
5001
|
-
mutation:
|
|
5001
|
+
mutation: l(this, De),
|
|
5002
5002
|
observer: this
|
|
5003
|
-
}), n != null && n.mutationKey && this.options.mutationKey && Bt(n.mutationKey) !== Bt(this.options.mutationKey) ? this.reset() : ((r =
|
|
5003
|
+
}), n != null && n.mutationKey && this.options.mutationKey && Bt(n.mutationKey) !== Bt(this.options.mutationKey) ? this.reset() : ((r = l(this, De)) == null ? void 0 : r.state.status) === "pending" && l(this, De).setOptions(this.options);
|
|
5004
5004
|
}
|
|
5005
5005
|
onUnsubscribe() {
|
|
5006
5006
|
var t;
|
|
5007
|
-
this.hasListeners() || (t =
|
|
5007
|
+
this.hasListeners() || (t = l(this, De)) == null || t.removeObserver(this);
|
|
5008
5008
|
}
|
|
5009
5009
|
onMutationUpdate(t) {
|
|
5010
5010
|
W(this, et, Cn).call(this), W(this, et, cr).call(this, t);
|
|
5011
5011
|
}
|
|
5012
5012
|
getCurrentResult() {
|
|
5013
|
-
return
|
|
5013
|
+
return l(this, ot);
|
|
5014
5014
|
}
|
|
5015
5015
|
reset() {
|
|
5016
5016
|
var t;
|
|
5017
|
-
(t =
|
|
5017
|
+
(t = l(this, De)) == null || t.removeObserver(this), I(this, De, void 0), W(this, et, Cn).call(this), W(this, et, cr).call(this);
|
|
5018
5018
|
}
|
|
5019
5019
|
mutate(t, n) {
|
|
5020
5020
|
var r;
|
|
5021
|
-
return I(this, Je, n), (r =
|
|
5021
|
+
return I(this, Je, n), (r = l(this, De)) == null || r.removeObserver(this), I(this, De, l(this, Ye).getMutationCache().build(l(this, Ye), this.options)), l(this, De).addObserver(this), l(this, De).execute(t);
|
|
5022
5022
|
}
|
|
5023
5023
|
}, Ye = new WeakMap(), ot = new WeakMap(), De = new WeakMap(), Je = new WeakMap(), et = new WeakSet(), Cn = function() {
|
|
5024
5024
|
var n;
|
|
5025
|
-
const t = ((n =
|
|
5025
|
+
const t = ((n = l(this, De)) == null ? void 0 : n.state) ?? Rs();
|
|
5026
5026
|
I(this, ot, {
|
|
5027
5027
|
...t,
|
|
5028
5028
|
isPending: t.status === "pending",
|
|
@@ -5034,34 +5034,34 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5034
5034
|
});
|
|
5035
5035
|
}, cr = function(t) {
|
|
5036
5036
|
ce.batch(() => {
|
|
5037
|
-
var n, r, s, a, o, d,
|
|
5038
|
-
if (
|
|
5039
|
-
const C =
|
|
5040
|
-
client:
|
|
5037
|
+
var n, r, s, a, o, d, f, h;
|
|
5038
|
+
if (l(this, Je) && this.hasListeners()) {
|
|
5039
|
+
const C = l(this, ot).variables, y = l(this, ot).context, E = {
|
|
5040
|
+
client: l(this, Ye),
|
|
5041
5041
|
meta: this.options.meta,
|
|
5042
5042
|
mutationKey: this.options.mutationKey
|
|
5043
5043
|
};
|
|
5044
|
-
(t == null ? void 0 : t.type) === "success" ? ((r = (n =
|
|
5044
|
+
(t == null ? void 0 : t.type) === "success" ? ((r = (n = l(this, Je)).onSuccess) == null || r.call(
|
|
5045
5045
|
n,
|
|
5046
5046
|
t.data,
|
|
5047
5047
|
C,
|
|
5048
5048
|
y,
|
|
5049
5049
|
E
|
|
5050
|
-
), (a = (s =
|
|
5050
|
+
), (a = (s = l(this, Je)).onSettled) == null || a.call(
|
|
5051
5051
|
s,
|
|
5052
5052
|
t.data,
|
|
5053
5053
|
null,
|
|
5054
5054
|
C,
|
|
5055
5055
|
y,
|
|
5056
5056
|
E
|
|
5057
|
-
)) : (t == null ? void 0 : t.type) === "error" && ((d = (o =
|
|
5057
|
+
)) : (t == null ? void 0 : t.type) === "error" && ((d = (o = l(this, Je)).onError) == null || d.call(
|
|
5058
5058
|
o,
|
|
5059
5059
|
t.error,
|
|
5060
5060
|
C,
|
|
5061
5061
|
y,
|
|
5062
5062
|
E
|
|
5063
|
-
), (h = (
|
|
5064
|
-
|
|
5063
|
+
), (h = (f = l(this, Je)).onSettled) == null || h.call(
|
|
5064
|
+
f,
|
|
5065
5065
|
void 0,
|
|
5066
5066
|
t.error,
|
|
5067
5067
|
C,
|
|
@@ -5070,7 +5070,7 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5070
5070
|
));
|
|
5071
5071
|
}
|
|
5072
5072
|
this.listeners.forEach((C) => {
|
|
5073
|
-
C(
|
|
5073
|
+
C(l(this, ot));
|
|
5074
5074
|
});
|
|
5075
5075
|
});
|
|
5076
5076
|
}, ts), ze, ns, ko = (ns = class extends Xt {
|
|
@@ -5092,14 +5092,14 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5092
5092
|
}), this.add(o)), o;
|
|
5093
5093
|
}
|
|
5094
5094
|
add(t) {
|
|
5095
|
-
|
|
5095
|
+
l(this, ze).has(t.queryHash) || (l(this, ze).set(t.queryHash, t), this.notify({
|
|
5096
5096
|
type: "added",
|
|
5097
5097
|
query: t
|
|
5098
5098
|
}));
|
|
5099
5099
|
}
|
|
5100
5100
|
remove(t) {
|
|
5101
|
-
const n =
|
|
5102
|
-
n && (t.destroy(), n === t &&
|
|
5101
|
+
const n = l(this, ze).get(t.queryHash);
|
|
5102
|
+
n && (t.destroy(), n === t && l(this, ze).delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
5103
5103
|
}
|
|
5104
5104
|
clear() {
|
|
5105
5105
|
ce.batch(() => {
|
|
@@ -5109,10 +5109,10 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5109
5109
|
});
|
|
5110
5110
|
}
|
|
5111
5111
|
get(t) {
|
|
5112
|
-
return
|
|
5112
|
+
return l(this, ze).get(t);
|
|
5113
5113
|
}
|
|
5114
5114
|
getAll() {
|
|
5115
|
-
return [...
|
|
5115
|
+
return [...l(this, ze).values()];
|
|
5116
5116
|
}
|
|
5117
5117
|
find(t) {
|
|
5118
5118
|
const n = { exact: !0, ...t };
|
|
@@ -5158,21 +5158,21 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5158
5158
|
I(this, ae, e.queryCache || new ko()), I(this, ct, e.mutationCache || new Io()), I(this, ut, e.defaultOptions || {}), I(this, Kt, /* @__PURE__ */ new Map()), I(this, Ht, /* @__PURE__ */ new Map()), I(this, dt, 0);
|
|
5159
5159
|
}
|
|
5160
5160
|
mount() {
|
|
5161
|
-
pn(this, dt)._++,
|
|
5162
|
-
e && (await this.resumePausedMutations(),
|
|
5161
|
+
pn(this, dt)._++, l(this, dt) === 1 && (I(this, Wt, Er.subscribe(async (e) => {
|
|
5162
|
+
e && (await this.resumePausedMutations(), l(this, ae).onFocus());
|
|
5163
5163
|
})), I(this, zt, Sn.subscribe(async (e) => {
|
|
5164
|
-
e && (await this.resumePausedMutations(),
|
|
5164
|
+
e && (await this.resumePausedMutations(), l(this, ae).onOnline());
|
|
5165
5165
|
})));
|
|
5166
5166
|
}
|
|
5167
5167
|
unmount() {
|
|
5168
5168
|
var e, t;
|
|
5169
|
-
pn(this, dt)._--,
|
|
5169
|
+
pn(this, dt)._--, l(this, dt) === 0 && ((e = l(this, Wt)) == null || e.call(this), I(this, Wt, void 0), (t = l(this, zt)) == null || t.call(this), I(this, zt, void 0));
|
|
5170
5170
|
}
|
|
5171
5171
|
isFetching(e) {
|
|
5172
|
-
return
|
|
5172
|
+
return l(this, ae).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
5173
5173
|
}
|
|
5174
5174
|
isMutating(e) {
|
|
5175
|
-
return
|
|
5175
|
+
return l(this, ct).findAll({ ...e, status: "pending" }).length;
|
|
5176
5176
|
}
|
|
5177
5177
|
/**
|
|
5178
5178
|
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
@@ -5184,28 +5184,28 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5184
5184
|
getQueryData(e) {
|
|
5185
5185
|
var n;
|
|
5186
5186
|
const t = this.defaultQueryOptions({ queryKey: e });
|
|
5187
|
-
return (n =
|
|
5187
|
+
return (n = l(this, ae).get(t.queryHash)) == null ? void 0 : n.state.data;
|
|
5188
5188
|
}
|
|
5189
5189
|
ensureQueryData(e) {
|
|
5190
|
-
const t = this.defaultQueryOptions(e), n =
|
|
5190
|
+
const t = this.defaultQueryOptions(e), n = l(this, ae).build(this, t), r = n.state.data;
|
|
5191
5191
|
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && n.isStaleByTime(lt(t.staleTime, n)) && this.prefetchQuery(t), Promise.resolve(r));
|
|
5192
5192
|
}
|
|
5193
5193
|
getQueriesData(e) {
|
|
5194
|
-
return
|
|
5194
|
+
return l(this, ae).findAll(e).map(({ queryKey: t, state: n }) => {
|
|
5195
5195
|
const r = n.data;
|
|
5196
5196
|
return [t, r];
|
|
5197
5197
|
});
|
|
5198
5198
|
}
|
|
5199
5199
|
setQueryData(e, t, n) {
|
|
5200
|
-
const r = this.defaultQueryOptions({ queryKey: e }), s =
|
|
5200
|
+
const r = this.defaultQueryOptions({ queryKey: e }), s = l(this, ae).get(
|
|
5201
5201
|
r.queryHash
|
|
5202
5202
|
), a = s == null ? void 0 : s.state.data, o = yo(t, a);
|
|
5203
5203
|
if (o !== void 0)
|
|
5204
|
-
return
|
|
5204
|
+
return l(this, ae).build(this, r).setData(o, { ...n, manual: !0 });
|
|
5205
5205
|
}
|
|
5206
5206
|
setQueriesData(e, t, n) {
|
|
5207
5207
|
return ce.batch(
|
|
5208
|
-
() =>
|
|
5208
|
+
() => l(this, ae).findAll(e).map(({ queryKey: r }) => [
|
|
5209
5209
|
r,
|
|
5210
5210
|
this.setQueryData(r, t, n)
|
|
5211
5211
|
])
|
|
@@ -5214,12 +5214,12 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5214
5214
|
getQueryState(e) {
|
|
5215
5215
|
var n;
|
|
5216
5216
|
const t = this.defaultQueryOptions({ queryKey: e });
|
|
5217
|
-
return (n =
|
|
5217
|
+
return (n = l(this, ae).get(
|
|
5218
5218
|
t.queryHash
|
|
5219
5219
|
)) == null ? void 0 : n.state;
|
|
5220
5220
|
}
|
|
5221
5221
|
removeQueries(e) {
|
|
5222
|
-
const t =
|
|
5222
|
+
const t = l(this, ae);
|
|
5223
5223
|
ce.batch(() => {
|
|
5224
5224
|
t.findAll(e).forEach((n) => {
|
|
5225
5225
|
t.remove(n);
|
|
@@ -5227,7 +5227,7 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5227
5227
|
});
|
|
5228
5228
|
}
|
|
5229
5229
|
resetQueries(e, t) {
|
|
5230
|
-
const n =
|
|
5230
|
+
const n = l(this, ae);
|
|
5231
5231
|
return ce.batch(() => (n.findAll(e).forEach((r) => {
|
|
5232
5232
|
r.reset();
|
|
5233
5233
|
}), this.refetchQueries(
|
|
@@ -5240,12 +5240,12 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5240
5240
|
}
|
|
5241
5241
|
cancelQueries(e, t = {}) {
|
|
5242
5242
|
const n = { revert: !0, ...t }, r = ce.batch(
|
|
5243
|
-
() =>
|
|
5243
|
+
() => l(this, ae).findAll(e).map((s) => s.cancel(n))
|
|
5244
5244
|
);
|
|
5245
5245
|
return Promise.all(r).then(xe).catch(xe);
|
|
5246
5246
|
}
|
|
5247
5247
|
invalidateQueries(e, t = {}) {
|
|
5248
|
-
return ce.batch(() => (
|
|
5248
|
+
return ce.batch(() => (l(this, ae).findAll(e).forEach((n) => {
|
|
5249
5249
|
n.invalidate();
|
|
5250
5250
|
}), (e == null ? void 0 : e.refetchType) === "none" ? Promise.resolve() : this.refetchQueries(
|
|
5251
5251
|
{
|
|
@@ -5260,7 +5260,7 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5260
5260
|
...t,
|
|
5261
5261
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
5262
5262
|
}, r = ce.batch(
|
|
5263
|
-
() =>
|
|
5263
|
+
() => l(this, ae).findAll(e).filter((s) => !s.isDisabled() && !s.isStatic()).map((s) => {
|
|
5264
5264
|
let a = s.fetch(void 0, n);
|
|
5265
5265
|
return n.throwOnError || (a = a.catch(xe)), s.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
5266
5266
|
})
|
|
@@ -5270,7 +5270,7 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5270
5270
|
fetchQuery(e) {
|
|
5271
5271
|
const t = this.defaultQueryOptions(e);
|
|
5272
5272
|
t.retry === void 0 && (t.retry = !1);
|
|
5273
|
-
const n =
|
|
5273
|
+
const n = l(this, ae).build(this, t);
|
|
5274
5274
|
return n.isStaleByTime(
|
|
5275
5275
|
lt(t.staleTime, n)
|
|
5276
5276
|
) ? n.fetch(t) : Promise.resolve(n.state.data);
|
|
@@ -5288,40 +5288,40 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5288
5288
|
return e.behavior = zr(e.pages), this.ensureQueryData(e);
|
|
5289
5289
|
}
|
|
5290
5290
|
resumePausedMutations() {
|
|
5291
|
-
return Sn.isOnline() ?
|
|
5291
|
+
return Sn.isOnline() ? l(this, ct).resumePausedMutations() : Promise.resolve();
|
|
5292
5292
|
}
|
|
5293
5293
|
getQueryCache() {
|
|
5294
|
-
return
|
|
5294
|
+
return l(this, ae);
|
|
5295
5295
|
}
|
|
5296
5296
|
getMutationCache() {
|
|
5297
|
-
return
|
|
5297
|
+
return l(this, ct);
|
|
5298
5298
|
}
|
|
5299
5299
|
getDefaultOptions() {
|
|
5300
|
-
return
|
|
5300
|
+
return l(this, ut);
|
|
5301
5301
|
}
|
|
5302
5302
|
setDefaultOptions(e) {
|
|
5303
5303
|
I(this, ut, e);
|
|
5304
5304
|
}
|
|
5305
5305
|
setQueryDefaults(e, t) {
|
|
5306
|
-
|
|
5306
|
+
l(this, Kt).set(Bt(e), {
|
|
5307
5307
|
queryKey: e,
|
|
5308
5308
|
defaultOptions: t
|
|
5309
5309
|
});
|
|
5310
5310
|
}
|
|
5311
5311
|
getQueryDefaults(e) {
|
|
5312
|
-
const t = [...
|
|
5312
|
+
const t = [...l(this, Kt).values()], n = {};
|
|
5313
5313
|
return t.forEach((r) => {
|
|
5314
5314
|
en(e, r.queryKey) && Object.assign(n, r.defaultOptions);
|
|
5315
5315
|
}), n;
|
|
5316
5316
|
}
|
|
5317
5317
|
setMutationDefaults(e, t) {
|
|
5318
|
-
|
|
5318
|
+
l(this, Ht).set(Bt(e), {
|
|
5319
5319
|
mutationKey: e,
|
|
5320
5320
|
defaultOptions: t
|
|
5321
5321
|
});
|
|
5322
5322
|
}
|
|
5323
5323
|
getMutationDefaults(e) {
|
|
5324
|
-
const t = [...
|
|
5324
|
+
const t = [...l(this, Ht).values()], n = {};
|
|
5325
5325
|
return t.forEach((r) => {
|
|
5326
5326
|
en(e, r.mutationKey) && Object.assign(n, r.defaultOptions);
|
|
5327
5327
|
}), n;
|
|
@@ -5330,7 +5330,7 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5330
5330
|
if (e._defaulted)
|
|
5331
5331
|
return e;
|
|
5332
5332
|
const t = {
|
|
5333
|
-
...
|
|
5333
|
+
...l(this, ut).queries,
|
|
5334
5334
|
...this.getQueryDefaults(e.queryKey),
|
|
5335
5335
|
...e,
|
|
5336
5336
|
_defaulted: !0
|
|
@@ -5342,14 +5342,14 @@ var Ye, ot, De, Je, et, Cn, cr, ts, Ro = (ts = class extends Xt {
|
|
|
5342
5342
|
}
|
|
5343
5343
|
defaultMutationOptions(e) {
|
|
5344
5344
|
return e != null && e._defaulted ? e : {
|
|
5345
|
-
...
|
|
5345
|
+
...l(this, ut).mutations,
|
|
5346
5346
|
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
5347
5347
|
...e,
|
|
5348
5348
|
_defaulted: !0
|
|
5349
5349
|
};
|
|
5350
5350
|
}
|
|
5351
5351
|
clear() {
|
|
5352
|
-
|
|
5352
|
+
l(this, ae).clear(), l(this, ct).clear();
|
|
5353
5353
|
}
|
|
5354
5354
|
}, ae = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), Kt = new WeakMap(), Ht = new WeakMap(), dt = new WeakMap(), Wt = new WeakMap(), zt = new WeakMap(), rs), ks = pe.createContext(
|
|
5355
5355
|
void 0
|
|
@@ -5401,7 +5401,7 @@ var No = pe.createContext(Lo()), qo = () => pe.useContext(No), Ko = (e, t) => {
|
|
|
5401
5401
|
n.clearReset();
|
|
5402
5402
|
});
|
|
5403
5403
|
function Vo(e, t, n) {
|
|
5404
|
-
var y, E, S,
|
|
5404
|
+
var y, E, S, v, O;
|
|
5405
5405
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
5406
5406
|
throw new Error(
|
|
5407
5407
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
@@ -5413,26 +5413,26 @@ function Vo(e, t, n) {
|
|
|
5413
5413
|
), process.env.NODE_ENV !== "production" && (o.queryFn || console.error(
|
|
5414
5414
|
`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
5415
5415
|
)), o._optimisticResults = r ? "isRestoring" : "optimistic", zo(o), Ko(o, s), Ho(s);
|
|
5416
|
-
const d = !a.getQueryCache().get(o.queryHash), [
|
|
5416
|
+
const d = !a.getQueryCache().get(o.queryHash), [f] = pe.useState(
|
|
5417
5417
|
() => new t(
|
|
5418
5418
|
a,
|
|
5419
5419
|
o
|
|
5420
5420
|
)
|
|
5421
|
-
), h =
|
|
5421
|
+
), h = f.getOptimisticResult(o), C = !r && e.subscribed !== !1;
|
|
5422
5422
|
if (pe.useSyncExternalStore(
|
|
5423
5423
|
pe.useCallback(
|
|
5424
5424
|
(B) => {
|
|
5425
|
-
const k = C ?
|
|
5426
|
-
return
|
|
5425
|
+
const k = C ? f.subscribe(ce.batchCalls(B)) : xe;
|
|
5426
|
+
return f.updateResult(), k;
|
|
5427
5427
|
},
|
|
5428
|
-
[
|
|
5428
|
+
[f, C]
|
|
5429
5429
|
),
|
|
5430
|
-
() =>
|
|
5431
|
-
() =>
|
|
5430
|
+
() => f.getCurrentResult(),
|
|
5431
|
+
() => f.getCurrentResult()
|
|
5432
5432
|
), pe.useEffect(() => {
|
|
5433
|
-
|
|
5434
|
-
}, [o,
|
|
5435
|
-
throw $r(o,
|
|
5433
|
+
f.setOptions(o);
|
|
5434
|
+
}, [o, f]), $o(o, h))
|
|
5435
|
+
throw $r(o, f, s);
|
|
5436
5436
|
if (Wo({
|
|
5437
5437
|
result: h,
|
|
5438
5438
|
errorResetBoundary: s,
|
|
@@ -5441,23 +5441,23 @@ function Vo(e, t, n) {
|
|
|
5441
5441
|
suspense: o.suspense
|
|
5442
5442
|
}))
|
|
5443
5443
|
throw h.error;
|
|
5444
|
-
if ((
|
|
5444
|
+
if ((v = (S = a.getDefaultOptions().queries) == null ? void 0 : S._experimental_afterQuery) == null || v.call(
|
|
5445
5445
|
S,
|
|
5446
5446
|
o,
|
|
5447
5447
|
h
|
|
5448
5448
|
), o.experimental_prefetchInRender && !Ot && Qo(h, r)) {
|
|
5449
5449
|
const B = d ? (
|
|
5450
5450
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
5451
|
-
$r(o,
|
|
5451
|
+
$r(o, f, s)
|
|
5452
5452
|
) : (
|
|
5453
5453
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
5454
5454
|
(O = a.getQueryCache().get(o.queryHash)) == null ? void 0 : O.promise
|
|
5455
5455
|
);
|
|
5456
5456
|
B == null || B.catch(xe).finally(() => {
|
|
5457
|
-
|
|
5457
|
+
f.updateResult();
|
|
5458
5458
|
});
|
|
5459
5459
|
}
|
|
5460
|
-
return o.notifyOnChangeProps ? h :
|
|
5460
|
+
return o.notifyOnChangeProps ? h : f.trackResult(h);
|
|
5461
5461
|
}
|
|
5462
5462
|
function jo(e, t) {
|
|
5463
5463
|
return Vo(e, So);
|
|
@@ -5493,7 +5493,7 @@ const Go = 2e4, Xo = () => {
|
|
|
5493
5493
|
const { module: e } = N(), t = K((n) => n.state.isMarketOrder);
|
|
5494
5494
|
return _(() => e === $.TWAP ? t ? G.TWAP_MARKET : G.TWAP_LIMIT : e === $.LIMIT ? G.LIMIT : e === $.STOP_LOSS ? t ? G.STOP_LOSS_MARKET : G.STOP_LOSS_LIMIT : e === $.TAKE_PROFIT ? t ? G.TAKE_PROFIT_MARKET : G.TAKE_PROFIT_LIMIT : G.TWAP_MARKET, [e, t]);
|
|
5495
5495
|
}, In = () => {
|
|
5496
|
-
const { account: e, config: t, chainId: n, isDev: r } = N();
|
|
5496
|
+
const { account: e, config: t, chainId: n, isDev: r, supportLegacyOrders: s } = N();
|
|
5497
5497
|
return _(
|
|
5498
5498
|
() => [
|
|
5499
5499
|
"useTwapOrderHistoryManager",
|
|
@@ -5501,9 +5501,10 @@ const Go = 2e4, Xo = () => {
|
|
|
5501
5501
|
t == null ? void 0 : t.adapter,
|
|
5502
5502
|
t == null ? void 0 : t.partner,
|
|
5503
5503
|
n,
|
|
5504
|
-
r
|
|
5504
|
+
r,
|
|
5505
|
+
s
|
|
5505
5506
|
],
|
|
5506
|
-
[e, t, n, r]
|
|
5507
|
+
[e, t, n, r, s]
|
|
5507
5508
|
);
|
|
5508
5509
|
}, Zo = () => {
|
|
5509
5510
|
const e = Zt(), { account: t } = N(), n = In();
|
|
@@ -5534,10 +5535,10 @@ const Go = 2e4, Xo = () => {
|
|
|
5534
5535
|
const s = t.getQueryData(n);
|
|
5535
5536
|
let a = !1;
|
|
5536
5537
|
const o = [];
|
|
5537
|
-
s && s.filter((
|
|
5538
|
+
s && s.filter((f) => f.version === 2).forEach((f) => {
|
|
5538
5539
|
var C;
|
|
5539
|
-
const h = r.find((y) => y.id ===
|
|
5540
|
-
h && h.progress !==
|
|
5540
|
+
const h = r.find((y) => y.id === f.id);
|
|
5541
|
+
h && h.progress !== f.progress && (a = !0, o.push(h), h.status === le.Completed && ((C = e == null ? void 0 : e.onOrderFilled) == null || C.call(e, h)));
|
|
5541
5542
|
}), a && ((d = e == null ? void 0 : e.onOrdersProgressUpdate) == null || d.call(e, o));
|
|
5542
5543
|
},
|
|
5543
5544
|
[t, n, e]
|
|
@@ -5550,30 +5551,30 @@ const Go = 2e4, Xo = () => {
|
|
|
5550
5551
|
(s, a) => a.createdAt - s.createdAt
|
|
5551
5552
|
);
|
|
5552
5553
|
}, Cr = () => {
|
|
5553
|
-
const { account: e, config: t, chainId: n, isDev: r } = N(),
|
|
5554
|
+
const { account: e, config: t, chainId: n, isDev: r, supportLegacyOrders: s } = N(), a = Zt(), o = In(), d = Jo();
|
|
5554
5555
|
return jo({
|
|
5555
5556
|
refetchInterval: Go,
|
|
5556
5557
|
refetchOnWindowFocus: !0,
|
|
5557
5558
|
retry: !1,
|
|
5558
5559
|
gcTime: 1 / 0,
|
|
5559
5560
|
staleTime: 1 / 0,
|
|
5560
|
-
queryKey:
|
|
5561
|
-
queryFn: async ({ signal:
|
|
5561
|
+
queryKey: o,
|
|
5562
|
+
queryFn: async ({ signal: h }) => {
|
|
5562
5563
|
if (!e || !n || !t) return [];
|
|
5563
|
-
const
|
|
5564
|
-
signal:
|
|
5564
|
+
const C = a.getQueryData(o), y = s && !C, E = await Li({
|
|
5565
|
+
signal: h,
|
|
5565
5566
|
chainId: n,
|
|
5566
5567
|
config: t,
|
|
5567
5568
|
account: e,
|
|
5568
5569
|
isDev: r,
|
|
5569
|
-
includeV1GraphOrders:
|
|
5570
|
+
includeV1GraphOrders: y
|
|
5570
5571
|
});
|
|
5571
|
-
|
|
5572
|
-
const
|
|
5573
|
-
...
|
|
5574
|
-
fillDelayMillis: ds(
|
|
5575
|
-
} :
|
|
5576
|
-
return
|
|
5572
|
+
d(E);
|
|
5573
|
+
const S = E.map((v) => t != null && t.twapConfig ? {
|
|
5574
|
+
...v,
|
|
5575
|
+
fillDelayMillis: ds(v, t.twapConfig)
|
|
5576
|
+
} : v);
|
|
5577
|
+
return !s || y ? S : ec(S, C);
|
|
5577
5578
|
}
|
|
5578
5579
|
});
|
|
5579
5580
|
}, tc = (e, t, n) => _(() => {
|
|
@@ -5615,16 +5616,16 @@ const Go = 2e4, Xo = () => {
|
|
|
5615
5616
|
const e = K((n) => n.state.currentTime), t = yr().duration;
|
|
5616
5617
|
return _(() => Va(e, t), [e, t]);
|
|
5617
5618
|
}, Us = () => {
|
|
5618
|
-
const { srcToken: e, dstToken: t, account: n, chainId: r, slippage: s, config: a, module: o, fees: d } = N(), { amount:
|
|
5619
|
+
const { srcToken: e, dstToken: t, account: n, chainId: r, slippage: s, config: a, module: o, fees: d } = N(), { amount: f } = ft(), { amountPerTrade: h, totalTrades: C } = $e(), y = Tr(), { amount: E } = gr(), { pricePerChunk: S } = It(), { milliseconds: v } = Gt();
|
|
5619
5620
|
return _(() => {
|
|
5620
5621
|
var O;
|
|
5621
5622
|
return li({
|
|
5622
5623
|
chainId: r,
|
|
5623
5624
|
srcToken: cn((e == null ? void 0 : e.address) || "") ? ((O = Vt(r)) == null ? void 0 : O.wToken.address) || "" : (e == null ? void 0 : e.address) || "",
|
|
5624
5625
|
dstToken: (t == null ? void 0 : t.address) || "",
|
|
5625
|
-
srcAmount:
|
|
5626
|
+
srcAmount: f,
|
|
5626
5627
|
deadlineMillis: y,
|
|
5627
|
-
fillDelayMillis: !C || C === 1 ? 0 :
|
|
5628
|
+
fillDelayMillis: !C || C === 1 ? 0 : v,
|
|
5628
5629
|
slippage: s * 100,
|
|
5629
5630
|
account: n,
|
|
5630
5631
|
srcAmountPerTrade: h,
|
|
@@ -5641,10 +5642,10 @@ const Go = 2e4, Xo = () => {
|
|
|
5641
5642
|
s,
|
|
5642
5643
|
a,
|
|
5643
5644
|
o,
|
|
5644
|
-
|
|
5645
|
+
f,
|
|
5645
5646
|
h,
|
|
5646
5647
|
C,
|
|
5647
|
-
|
|
5648
|
+
v,
|
|
5648
5649
|
E,
|
|
5649
5650
|
S,
|
|
5650
5651
|
d
|
|
@@ -5653,8 +5654,8 @@ const Go = 2e4, Xo = () => {
|
|
|
5653
5654
|
function ac(e) {
|
|
5654
5655
|
const t = e.slice(2);
|
|
5655
5656
|
if (t.length === 128) {
|
|
5656
|
-
const a = `0x${t.slice(0, 64)}`, o = parseInt(t.charAt(64), 16), d = (o >> 3) + 27,
|
|
5657
|
-
return { r: a, s:
|
|
5657
|
+
const a = `0x${t.slice(0, 64)}`, o = parseInt(t.charAt(64), 16), d = (o >> 3) + 27, f = `0x${(o & 7).toString(16)}${t.slice(65, 128)}`;
|
|
5658
|
+
return { r: a, s: f, v: d };
|
|
5658
5659
|
}
|
|
5659
5660
|
const n = `0x${t.slice(0, 64)}`, r = `0x${t.slice(64, 128)}`, s = parseInt(t.slice(128, 130), 16);
|
|
5660
5661
|
return { r: n, s: r, v: s };
|
|
@@ -5675,12 +5676,12 @@ const ic = () => {
|
|
|
5675
5676
|
if (!s)
|
|
5676
5677
|
throw new Error("tokenAddress is not defined");
|
|
5677
5678
|
fe.onWrapRequest();
|
|
5678
|
-
const
|
|
5679
|
-
return (h = n == null ? void 0 : n.onWrapRequest) == null || h.call(n), o == null || o(
|
|
5680
|
-
txHash:
|
|
5681
|
-
explorerUrl: un(
|
|
5679
|
+
const f = await t.wrapNativeToken(d);
|
|
5680
|
+
return (h = n == null ? void 0 : n.onWrapRequest) == null || h.call(n), o == null || o(f), fe.onWrapSuccess(f), (C = n == null ? void 0 : n.onWrapSuccess) == null || C.call(n, {
|
|
5681
|
+
txHash: f,
|
|
5682
|
+
explorerUrl: un(f, r),
|
|
5682
5683
|
amount: Te(d, s.decimals)
|
|
5683
|
-
}),
|
|
5684
|
+
}), f;
|
|
5684
5685
|
},
|
|
5685
5686
|
onError: (o) => {
|
|
5686
5687
|
throw fe.onWrapError(o), o;
|
|
@@ -5697,28 +5698,28 @@ const ic = () => {
|
|
|
5697
5698
|
throw new Error("missing walletInteractions");
|
|
5698
5699
|
if (!n)
|
|
5699
5700
|
throw new Error("missing chainId");
|
|
5700
|
-
const { order:
|
|
5701
|
-
fe.onSignOrderRequest(
|
|
5701
|
+
const { order: f, domain: h, types: C, primaryType: y } = a;
|
|
5702
|
+
fe.onSignOrderRequest(f);
|
|
5702
5703
|
let E;
|
|
5703
5704
|
try {
|
|
5704
5705
|
E = await t.signOrder({
|
|
5705
5706
|
domain: h,
|
|
5706
5707
|
types: C,
|
|
5707
5708
|
primaryType: y,
|
|
5708
|
-
message:
|
|
5709
|
+
message: f,
|
|
5709
5710
|
account: e
|
|
5710
5711
|
});
|
|
5711
5712
|
} catch (R) {
|
|
5712
5713
|
throw (B = r == null ? void 0 : r.onSignOrderError) == null || B.call(r, R), fe.onSignOrderError(R), R;
|
|
5713
5714
|
}
|
|
5714
5715
|
fe.onSignOrderSuccess(E), (k = r == null ? void 0 : r.onSignOrderSuccess) == null || k.call(r, E);
|
|
5715
|
-
const S = ac(E),
|
|
5716
|
+
const S = ac(E), v = {
|
|
5716
5717
|
v: `0x${S.v.toString(16)}`,
|
|
5717
5718
|
r: S.r,
|
|
5718
5719
|
s: S.s
|
|
5719
5720
|
};
|
|
5720
5721
|
(F = r == null ? void 0 : r.onSignOrderRequest) == null || F.call(r);
|
|
5721
|
-
const O = await Si(
|
|
5722
|
+
const O = await Si(f, v, s);
|
|
5722
5723
|
return (q = r == null ? void 0 : r.onOrderCreated) == null || q.call(r, O), d(O), o(), O;
|
|
5723
5724
|
}
|
|
5724
5725
|
});
|
|
@@ -5753,7 +5754,7 @@ const ic = () => {
|
|
|
5753
5754
|
mutationFn: async ({
|
|
5754
5755
|
token: o,
|
|
5755
5756
|
onHash: d,
|
|
5756
|
-
srcAmountWei:
|
|
5757
|
+
srcAmountWei: f
|
|
5757
5758
|
}) => {
|
|
5758
5759
|
var y, E;
|
|
5759
5760
|
if (!e)
|
|
@@ -5765,7 +5766,7 @@ const ic = () => {
|
|
|
5765
5766
|
fe.onApproveRequest();
|
|
5766
5767
|
const h = await t.approveToken({
|
|
5767
5768
|
tokenAddress: o.address,
|
|
5768
|
-
amount:
|
|
5769
|
+
amount: f,
|
|
5769
5770
|
spenderAddress: n.repermit
|
|
5770
5771
|
});
|
|
5771
5772
|
if (!h)
|
|
@@ -5773,11 +5774,11 @@ const ic = () => {
|
|
|
5773
5774
|
(y = s == null ? void 0 : s.onApproveRequest) == null || y.call(s), d(h);
|
|
5774
5775
|
let C = !1;
|
|
5775
5776
|
for (let S = 0; S < 3; S++) {
|
|
5776
|
-
const { approvalRequired:
|
|
5777
|
+
const { approvalRequired: v } = await a({
|
|
5777
5778
|
tokenAddress: o.address,
|
|
5778
|
-
srcAmountWei:
|
|
5779
|
+
srcAmountWei: f
|
|
5779
5780
|
});
|
|
5780
|
-
if (!
|
|
5781
|
+
if (!v) {
|
|
5781
5782
|
C = !0;
|
|
5782
5783
|
break;
|
|
5783
5784
|
}
|
|
@@ -5791,12 +5792,12 @@ const ic = () => {
|
|
|
5791
5792
|
txHash: h,
|
|
5792
5793
|
explorerUrl: un(h, r),
|
|
5793
5794
|
token: o,
|
|
5794
|
-
amount: Te(
|
|
5795
|
+
amount: Te(f, o.decimals)
|
|
5795
5796
|
}), h;
|
|
5796
5797
|
}
|
|
5797
5798
|
});
|
|
5798
5799
|
}, uc = () => {
|
|
5799
|
-
const { account: e, chainId: t, srcToken: n, dstToken: r, module: s, slippage: a } = N(), o = It(), d = ft().amount,
|
|
5800
|
+
const { account: e, chainId: t, srcToken: n, dstToken: r, module: s, slippage: a } = N(), o = It(), d = ft().amount, f = $e().amountPerTrade, h = Tr(), C = $e().totalTrades, y = Gt().fillDelay, E = gr().amount, S = K((v) => v.state.isMarketOrder);
|
|
5800
5801
|
return pt({
|
|
5801
5802
|
mutationFn: async () => {
|
|
5802
5803
|
fe.onRequestOrder({
|
|
@@ -5806,7 +5807,7 @@ const ic = () => {
|
|
|
5806
5807
|
srcToken: n,
|
|
5807
5808
|
dstToken: r,
|
|
5808
5809
|
fromTokenAmount: d,
|
|
5809
|
-
srcChunkAmount:
|
|
5810
|
+
srcChunkAmount: f,
|
|
5810
5811
|
triggerPricePerTrade: o.pricePerChunk,
|
|
5811
5812
|
deadline: h,
|
|
5812
5813
|
fillDelay: y.unit * y.value,
|
|
@@ -5826,10 +5827,10 @@ function dc(e) {
|
|
|
5826
5827
|
};
|
|
5827
5828
|
}
|
|
5828
5829
|
const lc = () => {
|
|
5829
|
-
const { srcToken: e, dstToken: t, chainId: n, callbacks: r, marketPrice: s } = N(), a = cc().mutateAsync, o = ic().mutateAsync, d = oc().mutateAsync, { mutateAsync:
|
|
5830
|
+
const { srcToken: e, dstToken: t, chainId: n, callbacks: r, marketPrice: s } = N(), a = cc().mutateAsync, o = ic().mutateAsync, d = oc().mutateAsync, { mutateAsync: f } = Ms(), { update: h } = dn(), { amount: C } = ft(), y = uc().mutate;
|
|
5830
5831
|
return pt({
|
|
5831
5832
|
mutationFn: async () => {
|
|
5832
|
-
var
|
|
5833
|
+
var v, O;
|
|
5833
5834
|
const E = K.getState().state.swapExecutions[K.getState().state.swapExecutionIndex];
|
|
5834
5835
|
if ((E == null ? void 0 : E.status) === Ce.LOADING || E != null && E.allowanceLoading)
|
|
5835
5836
|
return;
|
|
@@ -5852,7 +5853,7 @@ const lc = () => {
|
|
|
5852
5853
|
dstToken: t,
|
|
5853
5854
|
pendingSteps: []
|
|
5854
5855
|
});
|
|
5855
|
-
const { approvalRequired: k } = await
|
|
5856
|
+
const { approvalRequired: k } = await f({
|
|
5856
5857
|
tokenAddress: B.address,
|
|
5857
5858
|
srcAmountWei: C
|
|
5858
5859
|
});
|
|
@@ -5877,7 +5878,7 @@ const lc = () => {
|
|
|
5877
5878
|
return h({ status: Ce.SUCCESS, orderId: X.id }), X;
|
|
5878
5879
|
} catch (B) {
|
|
5879
5880
|
if (As(B))
|
|
5880
|
-
(
|
|
5881
|
+
(v = r == null ? void 0 : r.onSubmitOrderRejected) == null || v.call(r), h({
|
|
5881
5882
|
step: void 0,
|
|
5882
5883
|
status: void 0,
|
|
5883
5884
|
stepIndex: void 0,
|
|
@@ -5901,17 +5902,17 @@ const lc = () => {
|
|
|
5901
5902
|
const e = dn(), { srcToken: t, dstToken: n } = N(), r = lc(), s = K((h) => h.resetState), a = te(
|
|
5902
5903
|
() => r.mutateAsync(),
|
|
5903
5904
|
[r]
|
|
5904
|
-
), { update: o, resetSwap: d, ...
|
|
5905
|
+
), { update: o, resetSwap: d, ...f } = e;
|
|
5905
5906
|
return _(() => ({
|
|
5906
|
-
status:
|
|
5907
|
-
parsedError:
|
|
5908
|
-
error:
|
|
5909
|
-
step:
|
|
5910
|
-
stepIndex:
|
|
5911
|
-
approveTxHash:
|
|
5912
|
-
wrapTxHash:
|
|
5913
|
-
totalSteps:
|
|
5914
|
-
pendingSteps:
|
|
5907
|
+
status: f.status,
|
|
5908
|
+
parsedError: f.parsedError,
|
|
5909
|
+
error: f.error,
|
|
5910
|
+
step: f.step,
|
|
5911
|
+
stepIndex: f.stepIndex,
|
|
5912
|
+
approveTxHash: f.approveTxHash,
|
|
5913
|
+
wrapTxHash: f.wrapTxHash,
|
|
5914
|
+
totalSteps: f.totalSteps,
|
|
5915
|
+
pendingSteps: f.pendingSteps,
|
|
5915
5916
|
srcToken: t,
|
|
5916
5917
|
dstToken: n,
|
|
5917
5918
|
onSubmit: a,
|
|
@@ -5920,8 +5921,8 @@ const lc = () => {
|
|
|
5920
5921
|
isLoading: (e == null ? void 0 : e.status) === Ce.LOADING,
|
|
5921
5922
|
isSuccess: (e == null ? void 0 : e.status) === Ce.SUCCESS,
|
|
5922
5923
|
isFailed: (e == null ? void 0 : e.status) === Ce.FAILED,
|
|
5923
|
-
confirmButtonLoading:
|
|
5924
|
-
}), [a,
|
|
5924
|
+
confirmButtonLoading: f.allowanceLoading
|
|
5925
|
+
}), [a, f, s, d, t, n]);
|
|
5925
5926
|
}, pc = () => {
|
|
5926
5927
|
const {
|
|
5927
5928
|
marketPrice: e,
|
|
@@ -5932,7 +5933,7 @@ const lc = () => {
|
|
|
5932
5933
|
srcUsd1Token: a,
|
|
5933
5934
|
noLiquidity: o,
|
|
5934
5935
|
typedInputAmount: d
|
|
5935
|
-
} = N(),
|
|
5936
|
+
} = N(), f = r || D(a || "0").isZero() || s === void 0 || D(e || "0").isZero(), h = !!(t && n && d && f), y = !!(ws() || o || h || D(d || "0").isZero() || !t || !n);
|
|
5936
5937
|
return _(() => ({
|
|
5937
5938
|
disabled: y,
|
|
5938
5939
|
loading: h
|
|
@@ -6020,21 +6021,21 @@ const lc = () => {
|
|
|
6020
6021
|
const { srcToken: e, dstToken: t, account: n, marketPrice: r } = N(), { spender: s } = Ac(), { amount: a } = ft(), {
|
|
6021
6022
|
amount: o,
|
|
6022
6023
|
amountUI: d,
|
|
6023
|
-
usd:
|
|
6024
|
+
usd: f
|
|
6024
6025
|
} = On(), {
|
|
6025
6026
|
amountPerTrade: h,
|
|
6026
6027
|
amountPerTradeUI: C,
|
|
6027
6028
|
amountPerTradeUsd: y,
|
|
6028
6029
|
totalTrades: E
|
|
6029
6030
|
} = $e(), S = Tr(), {
|
|
6030
|
-
amount:
|
|
6031
|
+
amount: v,
|
|
6031
6032
|
amountUI: O,
|
|
6032
6033
|
usd: B
|
|
6033
6034
|
} = gr(), {
|
|
6034
6035
|
amountUI: k,
|
|
6035
6036
|
amount: F,
|
|
6036
6037
|
usd: q
|
|
6037
|
-
} = It(), { milliseconds: R } = Gt(), { amount: X, amountUI: z } = Bn(), { srcAmountUsd: ie, dstAmountUsd: i } = hc(), { amount: c, amountUI: u, percent: b, usd: m } = mc(), A = Us(), w = K((V) => V.state.isMarketOrder), p = K((V) => V.state.currentTime), g = dn(), T = Xo(), x = g.acceptedSrcAmount || a,
|
|
6038
|
+
} = It(), { milliseconds: R } = Gt(), { amount: X, amountUI: z } = Bn(), { srcAmountUsd: ie, dstAmountUsd: i } = hc(), { amount: c, amountUI: u, percent: b, usd: m } = mc(), A = Us(), w = K((V) => V.state.isMarketOrder), p = K((V) => V.state.currentTime), g = dn(), T = Xo(), x = g.acceptedSrcAmount || a, P = Te(r, (t == null ? void 0 : t.decimals) || 0), U = _(() => T === G.TAKE_PROFIT_MARKET || T === G.TAKE_PROFIT_LIMIT || T === G.STOP_LOSS_LIMIT || T === G.STOP_LOSS_MARKET, [T]), M = yc({
|
|
6038
6039
|
srcToken: e,
|
|
6039
6040
|
dstToken: t,
|
|
6040
6041
|
account: n,
|
|
@@ -6051,11 +6052,11 @@ const lc = () => {
|
|
|
6051
6052
|
dstAmountUsd: i,
|
|
6052
6053
|
limitPrice: w ? void 0 : o,
|
|
6053
6054
|
limitPriceUI: w ? void 0 : d,
|
|
6054
|
-
limitPriceUsd: w ? void 0 :
|
|
6055
|
+
limitPriceUsd: w ? void 0 : f,
|
|
6055
6056
|
srcAmountPerTrade: h,
|
|
6056
6057
|
srcAmountPerTradeUI: C,
|
|
6057
6058
|
srcAmountPerTradeUsd: y,
|
|
6058
|
-
minDestAmountPerTrade:
|
|
6059
|
+
minDestAmountPerTrade: v,
|
|
6059
6060
|
minDestAmountPerTradeUI: O,
|
|
6060
6061
|
minDestAmountPerTradeUsd: B,
|
|
6061
6062
|
triggerPrice: F,
|
|
@@ -6072,7 +6073,7 @@ const lc = () => {
|
|
|
6072
6073
|
isTriggerPrice: U,
|
|
6073
6074
|
isMarketOrder: w,
|
|
6074
6075
|
marketPrice: r,
|
|
6075
|
-
marketPriceUi:
|
|
6076
|
+
marketPriceUi: P,
|
|
6076
6077
|
spender: s
|
|
6077
6078
|
}), [
|
|
6078
6079
|
M,
|
|
@@ -6084,7 +6085,7 @@ const lc = () => {
|
|
|
6084
6085
|
U,
|
|
6085
6086
|
w,
|
|
6086
6087
|
r,
|
|
6087
|
-
|
|
6088
|
+
P,
|
|
6088
6089
|
s
|
|
6089
6090
|
]);
|
|
6090
6091
|
}, bc = () => {
|
|
@@ -6126,7 +6127,7 @@ const lc = () => {
|
|
|
6126
6127
|
};
|
|
6127
6128
|
}, zc = (e) => {
|
|
6128
6129
|
const { account: t, walletInteractions: n, config: r, callbacks: s, chainId: a } = N(), o = Ls().mutateAsync, d = Yo(), {
|
|
6129
|
-
cancelOrders:
|
|
6130
|
+
cancelOrders: f,
|
|
6130
6131
|
setCancelOrder: h,
|
|
6131
6132
|
clearCancelOrder: C
|
|
6132
6133
|
} = xc(), { mutateAsync: y } = pt({
|
|
@@ -6136,9 +6137,9 @@ const lc = () => {
|
|
|
6136
6137
|
throw new Error("missing required parameters");
|
|
6137
6138
|
if (!e)
|
|
6138
6139
|
throw new Error("order is required");
|
|
6139
|
-
const
|
|
6140
|
+
const v = e.id;
|
|
6140
6141
|
try {
|
|
6141
|
-
(O = s == null ? void 0 : s.onCancelOrderRequest) == null || O.call(s, e), h(
|
|
6142
|
+
(O = s == null ? void 0 : s.onCancelOrderRequest) == null || O.call(s, e), h(v, { status: Ce.LOADING }), fe.onCancelOrderRequest(
|
|
6142
6143
|
[e.version === 1 ? e.id.toString() : e.hash],
|
|
6143
6144
|
e.version
|
|
6144
6145
|
);
|
|
@@ -6159,29 +6160,29 @@ const lc = () => {
|
|
|
6159
6160
|
order: e.version === 1 ? { ...e, status: le.Cancelled } : e,
|
|
6160
6161
|
txHash: F,
|
|
6161
6162
|
explorerUrl: un(F, a)
|
|
6162
|
-
}), h(
|
|
6163
|
+
}), h(v, { status: Ce.SUCCESS, txHash: F }), F;
|
|
6163
6164
|
} catch (F) {
|
|
6164
|
-
console.error("cancel order error", F), (k = s == null ? void 0 : s.onCancelOrderFailed) == null || k.call(s, F), As(F) ? C(
|
|
6165
|
+
console.error("cancel order error", F), (k = s == null ? void 0 : s.onCancelOrderFailed) == null || k.call(s, F), As(F) ? C(v) : (h(v, {
|
|
6165
6166
|
status: Ce.FAILED,
|
|
6166
6167
|
error: F.message
|
|
6167
6168
|
}), fe.onCancelOrderError(F));
|
|
6168
6169
|
}
|
|
6169
6170
|
}
|
|
6170
6171
|
}), E = _(() => {
|
|
6171
|
-
const
|
|
6172
|
+
const v = f[(e == null ? void 0 : e.id) || ""];
|
|
6172
6173
|
return {
|
|
6173
|
-
isLoading: (
|
|
6174
|
-
isSuccess: (
|
|
6175
|
-
isError: (
|
|
6176
|
-
error:
|
|
6177
|
-
txHash:
|
|
6174
|
+
isLoading: (v == null ? void 0 : v.status) === Ce.LOADING,
|
|
6175
|
+
isSuccess: (v == null ? void 0 : v.status) === Ce.SUCCESS,
|
|
6176
|
+
isError: (v == null ? void 0 : v.status) === Ce.FAILED,
|
|
6177
|
+
error: v == null ? void 0 : v.error,
|
|
6178
|
+
txHash: v == null ? void 0 : v.txHash
|
|
6178
6179
|
};
|
|
6179
|
-
}, [
|
|
6180
|
+
}, [f, e == null ? void 0 : e.id]), S = te(async () => y(), [y]);
|
|
6180
6181
|
return _(() => ({ cancelOrder: S, ...E }), [S, E]);
|
|
6181
6182
|
}, Ns = ur(null), Cc = ({
|
|
6182
6183
|
children: e
|
|
6183
6184
|
}) => {
|
|
6184
|
-
const t = Zi(), n = to(), r = Ji(), s = oo(), a = co(), o = Pn(), d = uo(),
|
|
6185
|
+
const t = Zi(), n = to(), r = Ji(), s = oo(), a = co(), o = Pn(), d = uo(), f = lo(), h = ws(), C = pc(), y = gc(), E = sc(), S = fc(), v = bc(), O = Ls(), { module: B } = N(), k = _(
|
|
6185
6186
|
() => ({
|
|
6186
6187
|
tradesAmountPanel: t,
|
|
6187
6188
|
durationPanel: n,
|
|
@@ -6190,13 +6191,13 @@ const lc = () => {
|
|
|
6190
6191
|
triggerPricePanel: a,
|
|
6191
6192
|
pricePanel: o,
|
|
6192
6193
|
dstTokenPanel: d,
|
|
6193
|
-
disclaimerPanel:
|
|
6194
|
+
disclaimerPanel: f,
|
|
6194
6195
|
inputError: h,
|
|
6195
6196
|
submitOrderButton: C,
|
|
6196
6197
|
derivedFormData: y,
|
|
6197
6198
|
orderHistoryPanel: E,
|
|
6198
6199
|
orderExecutionPanel: S,
|
|
6199
|
-
supportedChains:
|
|
6200
|
+
supportedChains: v,
|
|
6200
6201
|
refetchUntilStatusSynced: O,
|
|
6201
6202
|
module: B
|
|
6202
6203
|
}),
|
|
@@ -6208,13 +6209,13 @@ const lc = () => {
|
|
|
6208
6209
|
a,
|
|
6209
6210
|
o,
|
|
6210
6211
|
d,
|
|
6211
|
-
|
|
6212
|
+
f,
|
|
6212
6213
|
h,
|
|
6213
6214
|
C,
|
|
6214
6215
|
y,
|
|
6215
6216
|
E,
|
|
6216
6217
|
S,
|
|
6217
|
-
|
|
6218
|
+
v,
|
|
6218
6219
|
O,
|
|
6219
6220
|
B
|
|
6220
6221
|
]
|
|
@@ -6283,14 +6284,14 @@ class wc extends Qs {
|
|
|
6283
6284
|
} = this.state;
|
|
6284
6285
|
let d = t;
|
|
6285
6286
|
if (a) {
|
|
6286
|
-
const
|
|
6287
|
+
const f = {
|
|
6287
6288
|
error: o,
|
|
6288
6289
|
resetErrorBoundary: this.resetErrorBoundary
|
|
6289
6290
|
};
|
|
6290
6291
|
if (typeof n == "function")
|
|
6291
|
-
d = n(
|
|
6292
|
+
d = n(f);
|
|
6292
6293
|
else if (r)
|
|
6293
|
-
d = Fr(r,
|
|
6294
|
+
d = Fr(r, f);
|
|
6294
6295
|
else if (s !== void 0)
|
|
6295
6296
|
d = s;
|
|
6296
6297
|
else
|
|
@@ -6339,7 +6340,7 @@ const qs = ur(null), vc = new _o({
|
|
|
6339
6340
|
}
|
|
6340
6341
|
}
|
|
6341
6342
|
}), Pc = (e) => {
|
|
6342
|
-
var E, S,
|
|
6343
|
+
var E, S, v;
|
|
6343
6344
|
const t = K((O) => O.updateState), n = K((O) => O.state.isMarketOrder);
|
|
6344
6345
|
mt(() => {
|
|
6345
6346
|
const O = setInterval(() => {
|
|
@@ -6352,7 +6353,7 @@ const qs = ur(null), vc = new _o({
|
|
|
6352
6353
|
chunks: a,
|
|
6353
6354
|
fillDelay: o,
|
|
6354
6355
|
duration: d,
|
|
6355
|
-
limitPrice:
|
|
6356
|
+
limitPrice: f,
|
|
6356
6357
|
triggerPrice: h,
|
|
6357
6358
|
triggerPricePercent: C,
|
|
6358
6359
|
limitPricePercent: y
|
|
@@ -6362,7 +6363,7 @@ const qs = ur(null), vc = new _o({
|
|
|
6362
6363
|
typedChunks: a,
|
|
6363
6364
|
typedFillDelay: o,
|
|
6364
6365
|
typedDuration: d,
|
|
6365
|
-
typedLimitPrice:
|
|
6366
|
+
typedLimitPrice: f,
|
|
6366
6367
|
typedTriggerPrice: h,
|
|
6367
6368
|
triggerPricePercent: C,
|
|
6368
6369
|
limitPricePercent: y
|
|
@@ -6373,7 +6374,7 @@ const qs = ur(null), vc = new _o({
|
|
|
6373
6374
|
a,
|
|
6374
6375
|
o,
|
|
6375
6376
|
d,
|
|
6376
|
-
|
|
6377
|
+
f,
|
|
6377
6378
|
h,
|
|
6378
6379
|
C,
|
|
6379
6380
|
y
|
|
@@ -6385,7 +6386,7 @@ const qs = ur(null), vc = new _o({
|
|
|
6385
6386
|
triggerPricePercent: void 0,
|
|
6386
6387
|
limitPricePercent: void 0
|
|
6387
6388
|
});
|
|
6388
|
-
}, [(S = e.srcToken) == null ? void 0 : S.address, (
|
|
6389
|
+
}, [(S = e.srcToken) == null ? void 0 : S.address, (v = e.dstToken) == null ? void 0 : v.address]), mt(() => {
|
|
6389
6390
|
e.module === $.LIMIT && t({ isMarketOrder: !1 });
|
|
6390
6391
|
}, [e.module]), mt(() => {
|
|
6391
6392
|
n && t({ isInvertedTrade: !1 });
|
|
@@ -6417,8 +6418,8 @@ const qs = ur(null), vc = new _o({
|
|
|
6417
6418
|
() => Ma(e.partner),
|
|
6418
6419
|
[e.partner]
|
|
6419
6420
|
), r = _(() => {
|
|
6420
|
-
const
|
|
6421
|
-
return e.chainId && n.includes(e.chainId) ? e.chainId :
|
|
6421
|
+
const f = n[0];
|
|
6422
|
+
return e.chainId && n.includes(e.chainId) ? e.chainId : f;
|
|
6422
6423
|
}, [e.chainId, n]), s = _(
|
|
6423
6424
|
() => ps(e.partner, r),
|
|
6424
6425
|
[e.partner, r]
|
|
@@ -6453,7 +6454,8 @@ const qs = ur(null), vc = new _o({
|
|
|
6453
6454
|
dstBalance: e.dstBalance,
|
|
6454
6455
|
srcToken: t.srcToken || e.srcToken,
|
|
6455
6456
|
dstToken: t.dstToken || e.dstToken,
|
|
6456
|
-
isDev: e.isDev
|
|
6457
|
+
isDev: e.isDev,
|
|
6458
|
+
supportLegacyOrders: e.supportLegacyOrders ?? !1
|
|
6457
6459
|
}),
|
|
6458
6460
|
[
|
|
6459
6461
|
e.typedInputAmount,
|
|
@@ -6481,7 +6483,8 @@ const qs = ur(null), vc = new _o({
|
|
|
6481
6483
|
e.dstBalance,
|
|
6482
6484
|
e.srcToken,
|
|
6483
6485
|
e.dstToken,
|
|
6484
|
-
e.isDev
|
|
6486
|
+
e.isDev,
|
|
6487
|
+
e.supportLegacyOrders
|
|
6485
6488
|
]
|
|
6486
6489
|
);
|
|
6487
6490
|
return /* @__PURE__ */ Ws(qs.Provider, { value: d, children: [
|
|
@@ -6514,12 +6517,12 @@ const qs = ur(null), vc = new _o({
|
|
|
6514
6517
|
(s) => s.srcToken !== void 0 && s.dstToken !== void 0
|
|
6515
6518
|
), [e, t, n, r]);
|
|
6516
6519
|
}, Vc = (e, t, n) => {
|
|
6517
|
-
const { config: r } = N(), s = tc(t, n, e), a = nc(t, n, e), o = rc(t, n, e), d = _(() => e ? e.version === 2 ? e.fillDelay : r.twapConfig ? ds(e, r.twapConfig) : 0 : 0, [e, r]),
|
|
6520
|
+
const { config: r } = N(), s = tc(t, n, e), a = nc(t, n, e), o = rc(t, n, e), d = _(() => e ? e.version === 2 ? e.fillDelay : r.twapConfig ? ds(e, r.twapConfig) : 0 : 0, [e, r]), f = Ic(e == null ? void 0 : e.fills, t, n) ?? [];
|
|
6518
6521
|
return _(() => {
|
|
6519
6522
|
if (e != null && e.id)
|
|
6520
6523
|
return {
|
|
6521
6524
|
original: e,
|
|
6522
|
-
fills:
|
|
6525
|
+
fills: f,
|
|
6523
6526
|
srcToken: t,
|
|
6524
6527
|
dstToken: n,
|
|
6525
6528
|
orderType: e.type,
|
|
@@ -6555,7 +6558,7 @@ const qs = ur(null), vc = new _o({
|
|
|
6555
6558
|
};
|
|
6556
6559
|
}, [
|
|
6557
6560
|
e,
|
|
6558
|
-
|
|
6561
|
+
f,
|
|
6559
6562
|
t,
|
|
6560
6563
|
n,
|
|
6561
6564
|
d,
|