@orbs-network/spot-ui 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +68 -69
  2. package/dist/spot-ui.js +1612 -2260
  3. package/dist/spot-ui.umd.cjs +8 -8
  4. package/dist/src/index.d.ts +11 -8
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/lib/analytics.d.ts +10 -12
  7. package/dist/src/lib/analytics.d.ts.map +1 -1
  8. package/dist/src/lib/api-config.d.ts +11 -0
  9. package/dist/src/lib/api-config.d.ts.map +1 -0
  10. package/dist/src/lib/build-repermit-order-data.d.ts +1 -2
  11. package/dist/src/lib/build-repermit-order-data.d.ts.map +1 -1
  12. package/dist/src/lib/client.d.ts +2 -2
  13. package/dist/src/lib/client.d.ts.map +1 -1
  14. package/dist/src/lib/evm-constants.d.ts +3 -0
  15. package/dist/src/lib/evm-constants.d.ts.map +1 -0
  16. package/dist/src/lib/order-form/amounts.d.ts +13 -0
  17. package/dist/src/lib/order-form/amounts.d.ts.map +1 -0
  18. package/dist/src/lib/order-form/calculate-order-form.d.ts +3 -0
  19. package/dist/src/lib/order-form/calculate-order-form.d.ts.map +1 -0
  20. package/dist/src/lib/order-form/constants.d.ts +10 -0
  21. package/dist/src/lib/order-form/constants.d.ts.map +1 -0
  22. package/dist/src/lib/order-form/prices.d.ts +8 -0
  23. package/dist/src/lib/order-form/prices.d.ts.map +1 -0
  24. package/dist/src/lib/order-form/schedule.d.ts +27 -0
  25. package/dist/src/lib/order-form/schedule.d.ts.map +1 -0
  26. package/dist/src/lib/order-form/types.d.ts +209 -0
  27. package/dist/src/lib/order-form/types.d.ts.map +1 -0
  28. package/dist/src/lib/order-form/validation.d.ts +7 -0
  29. package/dist/src/lib/order-form/validation.d.ts.map +1 -0
  30. package/dist/src/lib/order-form/values.d.ts +3 -0
  31. package/dist/src/lib/order-form/values.d.ts.map +1 -0
  32. package/dist/src/lib/orders/legacy-twap-config.d.ts +22 -0
  33. package/dist/src/lib/orders/legacy-twap-config.d.ts.map +1 -0
  34. package/dist/src/lib/partners.d.ts +3 -0
  35. package/dist/src/lib/partners.d.ts.map +1 -0
  36. package/dist/src/lib/public-links.d.ts +6 -0
  37. package/dist/src/lib/public-links.d.ts.map +1 -0
  38. package/dist/src/lib/types.d.ts +3 -13
  39. package/dist/src/lib/types.d.ts.map +1 -1
  40. package/dist/src/lib/utils.d.ts +1 -28
  41. package/dist/src/lib/utils.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/src/lib/calculations.d.ts +0 -123
  44. package/dist/src/lib/calculations.d.ts.map +0 -1
  45. package/dist/src/lib/consts.d.ts +0 -92
  46. package/dist/src/lib/consts.d.ts.map +0 -1
  47. package/dist/src/lib/lib.d.ts +0 -66
  48. package/dist/src/lib/lib.d.ts.map +0 -1
  49. package/dist/src/lib/networks.d.ts +0 -571
  50. package/dist/src/lib/networks.d.ts.map +0 -1
  51. package/dist/src/lib/order-form.d.ts +0 -95
  52. package/dist/src/lib/order-form.d.ts.map +0 -1
package/dist/spot-ui.js CHANGED
@@ -1,9 +1,9 @@
1
- var Tt = Object.defineProperty;
2
- var Dt = (e, t, n) => t in e ? Tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var he = (e, t, n) => Dt(e, typeof t != "symbol" ? t + "" : t, n);
4
- var _ = /* @__PURE__ */ ((e) => (e.TWAP = "TWAP", e.LIMIT = "LIMIT", e.STOP_LOSS = "STOP_LOSS", e.TAKE_PROFIT = "TAKE_PROFIT", e))(_ || {}), ue = /* @__PURE__ */ ((e) => (e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(ue || {}), Ft = /* @__PURE__ */ ((e) => (e.All = "ALL", e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(Ft || {}), de = /* @__PURE__ */ ((e) => (e[e.Minutes = 6e4] = "Minutes", e[e.Hours = 36e5] = "Hours", e[e.Weeks = 6048e5] = "Weeks", e[e.Days = 864e5] = "Days", e[e.Months = 2592e6] = "Months", e[e.Years = 31536e6] = "Years", e))(de || {}), N = /* @__PURE__ */ ((e) => (e.LIMIT = "limit", e.TWAP_LIMIT = "twap-limit", e.TWAP_MARKET = "twap-market", e.TAKE_PROFIT_MARKET = "take-profit-market", e.TAKE_PROFIT_LIMIT = "take-profit-limit", e.STOP_LOSS_LIMIT = "stop-loss-limit", e.STOP_LOSS_MARKET = "stop-loss-market", e))(N || {}), J = /* @__PURE__ */ ((e) => (e.Arbidex = "arbidex", e.Blackhole = "blackhole", e.Chronos = "chronos", e.Dragon = "dragon", e.Kodiak = "kodiak", e.Lynex = "lynex", e.Nami = "nami", e.Newera = "newera", e.Omni = "omni", e.Pancake = "pancake", e.Quick = "quick", e.Ramses = "ramses", e.Shadow = "shadow", e.Spark = "spark", e.Spooky = "spooky", e.Swapx = "swapx", e.Teafi = "teafi", e.Thena = "thena", e.Yowie = "yowie", e.Pangolin = "pangolin", e.Sushiswap = "sushiswap", e.Agent = "agent", e.Utila = "utila", e.Ring = "ring", e.EfficientFrontier = "ef", e.HtDigital = "ht", e.Ginco = "ginco", e.Katana = "katana", e.Unknown = "unknown", e))(J || {}), ee = /* @__PURE__ */ ((e) => (e.MAX_TRADES = "maxTradesError", e.MIN_TRADES = "minTradesError", e.MIN_TRADE_SIZE = "minTradeSizeError", e.MAX_FILL_DELAY = "maxFillDelayError", e.MIN_FILL_DELAY = "minFillDelayError", e.MAX_ORDER_DURATION = "maxDurationError", e.MIN_ORDER_DURATION = "minDurationError", e.MISSING_LIMIT_PRICE = "missingLimitPrice", e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE = "StopLossTriggerPriceError", e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE = "triggerLimitPriceError", e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE = "TakeProfitTriggerPriceError", e.EMPTY_TRIGGER_PRICE = "emptyTriggerPrice", e.INSUFFICIENT_BALANCE = "insufficientFunds", e.MAX_ORDER_SIZE = "maxOrderSize", e))(ee || {}), wt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Ve = Math.ceil, re = Math.floor, Q = "[BigNumber Error] ", et = Q + "Number primitive has more than 15 significant digits: ", oe = 1e14, O = 14, We = 9007199254740991, ze = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], me = 1e7, H = 1e9;
1
+ var ht = Object.defineProperty;
2
+ var Tt = (e, t, n) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Ee = (e, t, n) => Tt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ var v = /* @__PURE__ */ ((e) => (e.TWAP = "TWAP", e.LIMIT = "LIMIT", e.STOP_LOSS = "STOP_LOSS", e.TAKE_PROFIT = "TAKE_PROFIT", e))(v || {}), ce = /* @__PURE__ */ ((e) => (e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(ce || {}), xt = /* @__PURE__ */ ((e) => (e.All = "ALL", e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(xt || {}), se = /* @__PURE__ */ ((e) => (e[e.Minutes = 6e4] = "Minutes", e[e.Hours = 36e5] = "Hours", e[e.Weeks = 6048e5] = "Weeks", e[e.Days = 864e5] = "Days", e[e.Months = 2592e6] = "Months", e[e.Years = 31536e6] = "Years", e))(se || {}), N = /* @__PURE__ */ ((e) => (e.LIMIT = "limit", e.TWAP_LIMIT = "twap-limit", e.TWAP_MARKET = "twap-market", e.TAKE_PROFIT_MARKET = "take-profit-market", e.TAKE_PROFIT_LIMIT = "take-profit-limit", e.STOP_LOSS_LIMIT = "stop-loss-limit", e.STOP_LOSS_MARKET = "stop-loss-market", e))(N || {}), Q = /* @__PURE__ */ ((e) => (e.Arbidex = "arbidex", e.Blackhole = "blackhole", e.Chronos = "chronos", e.Dragon = "dragon", e.Kodiak = "kodiak", e.Lynex = "lynex", e.Nami = "nami", e.Newera = "newera", e.Omni = "omni", e.Pancake = "pancake", e.Quick = "quick", e.Ramses = "ramses", e.Shadow = "shadow", e.Spark = "spark", e.Spooky = "spooky", e.Swapx = "swapx", e.Teafi = "teafi", e.Thena = "thena", e.Yowie = "yowie", e.Pangolin = "pangolin", e.Sushiswap = "sushiswap", e.Agent = "agent", e.Utila = "utila", e.Ring = "ring", e.EfficientFrontier = "ef", e.HtDigital = "ht", e.Ginco = "ginco", e.Katana = "katana", e.Unknown = "unknown", e))(Q || {}), J = /* @__PURE__ */ ((e) => (e.MAX_TRADES = "maxTradesError", e.MIN_TRADES = "minTradesError", e.MIN_TRADE_SIZE = "minTradeSizeError", e.MAX_FILL_DELAY = "maxFillDelayError", e.MIN_FILL_DELAY = "minFillDelayError", e.MAX_ORDER_DURATION = "maxDurationError", e.MIN_ORDER_DURATION = "minDurationError", e.MISSING_LIMIT_PRICE = "missingLimitPrice", e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE = "StopLossTriggerPriceError", e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE = "triggerLimitPriceError", e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE = "TakeProfitTriggerPriceError", e.EMPTY_TRIGGER_PRICE = "emptyTriggerPrice", e.INSUFFICIENT_BALANCE = "insufficientFunds", e.MAX_ORDER_SIZE = "maxOrderSize", e))(J || {}), gt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Ne = Math.ceil, ne = Math.floor, Z = "[BigNumber Error] ", Qe = Z + "Number primitive has more than 15 significant digits: ", ae = 1e14, k = 14, Le = 9007199254740991, Ue = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], pe = 1e7, q = 1e9;
5
5
  function ut(e) {
6
- var t, n, a, s = T.prototype = { constructor: T, toString: null, valueOf: null }, c = new T(1), y = 20, E = 4, D = -7, C = 21, P = -1e7, F = 1e7, g = !1, S = 1, w = 0, $ = {
6
+ var t, n, i, a = g.prototype = { constructor: g, toString: null, valueOf: null }, d = new g(1), m = 20, b = 4, D = -7, C = 21, O = -1e7, F = 1e7, h = !1, w = 1, B = 0, V = {
7
7
  prefix: "",
8
8
  groupSize: 3,
9
9
  secondaryGroupSize: 0,
@@ -13,616 +13,827 @@ function ut(e) {
13
13
  fractionGroupSeparator: " ",
14
14
  // non-breaking space
15
15
  suffix: ""
16
- }, K = "0123456789abcdefghijklmnopqrstuvwxyz", q = !0;
17
- function T(r, i) {
18
- var o, m, l, p, b, d, u, A, f = this;
19
- if (!(f instanceof T)) return new T(r, i);
20
- if (i == null) {
16
+ }, K = "0123456789abcdefghijklmnopqrstuvwxyz", z = !0;
17
+ function g(r, s) {
18
+ var o, A, u, f, E, c, l, y, p = this;
19
+ if (!(p instanceof g)) return new g(r, s);
20
+ if (s == null) {
21
21
  if (r && r._isBigNumber === !0) {
22
- f.s = r.s, !r.c || r.e > F ? f.c = f.e = null : r.e < P ? f.c = [f.e = 0] : (f.e = r.e, f.c = r.c.slice());
22
+ p.s = r.s, !r.c || r.e > F ? p.c = p.e = null : r.e < O ? p.c = [p.e = 0] : (p.e = r.e, p.c = r.c.slice());
23
23
  return;
24
24
  }
25
- if ((d = typeof r == "number") && r * 0 == 0) {
26
- if (f.s = 1 / r < 0 ? (r = -r, -1) : 1, r === ~~r) {
27
- for (p = 0, b = r; b >= 10; b /= 10, p++) ;
28
- p > F ? f.c = f.e = null : (f.e = p, f.c = [r]);
25
+ if ((c = typeof r == "number") && r * 0 == 0) {
26
+ if (p.s = 1 / r < 0 ? (r = -r, -1) : 1, r === ~~r) {
27
+ for (f = 0, E = r; E >= 10; E /= 10, f++) ;
28
+ f > F ? p.c = p.e = null : (p.e = f, p.c = [r]);
29
29
  return;
30
30
  }
31
- A = String(r);
31
+ y = String(r);
32
32
  } else {
33
- if (!wt.test(A = String(r))) return a(f, A, d);
34
- f.s = A.charCodeAt(0) == 45 ? (A = A.slice(1), -1) : 1;
33
+ if (!gt.test(y = String(r))) return i(p, y, c);
34
+ p.s = y.charCodeAt(0) == 45 ? (y = y.slice(1), -1) : 1;
35
35
  }
36
- (p = A.indexOf(".")) > -1 && (A = A.replace(".", "")), (b = A.search(/e/i)) > 0 ? (p < 0 && (p = b), p += +A.slice(b + 1), A = A.substring(0, b)) : p < 0 && (p = A.length);
36
+ (f = y.indexOf(".")) > -1 && (y = y.replace(".", "")), (E = y.search(/e/i)) > 0 ? (f < 0 && (f = E), f += +y.slice(E + 1), y = y.substring(0, E)) : f < 0 && (f = y.length);
37
37
  } else {
38
- if (L(i, 2, K.length, "Base"), i == 10 && q)
39
- return f = new T(r), Y(f, y + f.e + 1, E);
40
- if (A = String(r), d = typeof r == "number") {
41
- if (r * 0 != 0) return a(f, A, d, i);
42
- if (f.s = 1 / r < 0 ? (A = A.slice(1), -1) : 1, T.DEBUG && A.replace(/^0\.0*|\./, "").length > 15)
43
- throw Error(et + r);
38
+ if (L(s, 2, K.length, "Base"), s == 10 && z)
39
+ return p = new g(r), Y(p, m + p.e + 1, b);
40
+ if (y = String(r), c = typeof r == "number") {
41
+ if (r * 0 != 0) return i(p, y, c, s);
42
+ if (p.s = 1 / r < 0 ? (y = y.slice(1), -1) : 1, g.DEBUG && y.replace(/^0\.0*|\./, "").length > 15)
43
+ throw Error(Qe + r);
44
44
  } else
45
- f.s = A.charCodeAt(0) === 45 ? (A = A.slice(1), -1) : 1;
46
- for (o = K.slice(0, i), p = b = 0, u = A.length; b < u; b++)
47
- if (o.indexOf(m = A.charAt(b)) < 0) {
48
- if (m == ".") {
49
- if (b > p) {
50
- p = u;
45
+ p.s = y.charCodeAt(0) === 45 ? (y = y.slice(1), -1) : 1;
46
+ for (o = K.slice(0, s), f = E = 0, l = y.length; E < l; E++)
47
+ if (o.indexOf(A = y.charAt(E)) < 0) {
48
+ if (A == ".") {
49
+ if (E > f) {
50
+ f = l;
51
51
  continue;
52
52
  }
53
- } else if (!l && (A == A.toUpperCase() && (A = A.toLowerCase()) || A == A.toLowerCase() && (A = A.toUpperCase()))) {
54
- l = !0, b = -1, p = 0;
53
+ } else if (!u && (y == y.toUpperCase() && (y = y.toLowerCase()) || y == y.toLowerCase() && (y = y.toUpperCase()))) {
54
+ u = !0, E = -1, f = 0;
55
55
  continue;
56
56
  }
57
- return a(f, String(r), d, i);
57
+ return i(p, String(r), c, s);
58
58
  }
59
- d = !1, A = n(A, i, 10, f.s), (p = A.indexOf(".")) > -1 ? A = A.replace(".", "") : p = A.length;
59
+ c = !1, y = n(y, s, 10, p.s), (f = y.indexOf(".")) > -1 ? y = y.replace(".", "") : f = y.length;
60
60
  }
61
- for (b = 0; A.charCodeAt(b) === 48; b++) ;
62
- for (u = A.length; A.charCodeAt(--u) === 48; ) ;
63
- if (A = A.slice(b, ++u)) {
64
- if (u -= b, d && T.DEBUG && u > 15 && (r > We || r !== re(r)))
65
- throw Error(et + f.s * r);
66
- if ((p = p - b - 1) > F)
67
- f.c = f.e = null;
68
- else if (p < P)
69
- f.c = [f.e = 0];
61
+ for (E = 0; y.charCodeAt(E) === 48; E++) ;
62
+ for (l = y.length; y.charCodeAt(--l) === 48; ) ;
63
+ if (y = y.slice(E, ++l)) {
64
+ if (l -= E, c && g.DEBUG && l > 15 && (r > Le || r !== ne(r)))
65
+ throw Error(Qe + p.s * r);
66
+ if ((f = f - E - 1) > F)
67
+ p.c = p.e = null;
68
+ else if (f < O)
69
+ p.c = [p.e = 0];
70
70
  else {
71
- if (f.e = p, f.c = [], b = (p + 1) % O, p < 0 && (b += O), b < u) {
72
- for (b && f.c.push(+A.slice(0, b)), u -= O; b < u; )
73
- f.c.push(+A.slice(b, b += O));
74
- b = O - (A = A.slice(b)).length;
71
+ if (p.e = f, p.c = [], E = (f + 1) % k, f < 0 && (E += k), E < l) {
72
+ for (E && p.c.push(+y.slice(0, E)), l -= k; E < l; )
73
+ p.c.push(+y.slice(E, E += k));
74
+ E = k - (y = y.slice(E)).length;
75
75
  } else
76
- b -= u;
77
- for (; b--; A += "0") ;
78
- f.c.push(+A);
76
+ E -= l;
77
+ for (; E--; y += "0") ;
78
+ p.c.push(+y);
79
79
  }
80
80
  } else
81
- f.c = [f.e = 0];
81
+ p.c = [p.e = 0];
82
82
  }
83
- T.clone = ut, T.ROUND_UP = 0, T.ROUND_DOWN = 1, T.ROUND_CEIL = 2, T.ROUND_FLOOR = 3, T.ROUND_HALF_UP = 4, T.ROUND_HALF_DOWN = 5, T.ROUND_HALF_EVEN = 6, T.ROUND_HALF_CEIL = 7, T.ROUND_HALF_FLOOR = 8, T.EUCLID = 9, T.config = T.set = function(r) {
84
- var i, o;
83
+ g.clone = ut, g.ROUND_UP = 0, g.ROUND_DOWN = 1, g.ROUND_CEIL = 2, g.ROUND_FLOOR = 3, g.ROUND_HALF_UP = 4, g.ROUND_HALF_DOWN = 5, g.ROUND_HALF_EVEN = 6, g.ROUND_HALF_CEIL = 7, g.ROUND_HALF_FLOOR = 8, g.EUCLID = 9, g.config = g.set = function(r) {
84
+ var s, o;
85
85
  if (r != null)
86
86
  if (typeof r == "object") {
87
- if (r.hasOwnProperty(i = "DECIMAL_PLACES") && (o = r[i], L(o, 0, H, i), y = o), r.hasOwnProperty(i = "ROUNDING_MODE") && (o = r[i], L(o, 0, 8, i), E = o), r.hasOwnProperty(i = "EXPONENTIAL_AT") && (o = r[i], o && o.pop ? (L(o[0], -H, 0, i), L(o[1], 0, H, i), D = o[0], C = o[1]) : (L(o, -H, H, i), D = -(C = o < 0 ? -o : o))), r.hasOwnProperty(i = "RANGE"))
88
- if (o = r[i], o && o.pop)
89
- L(o[0], -H, -1, i), L(o[1], 1, H, i), P = o[0], F = o[1];
90
- else if (L(o, -H, H, i), o)
91
- P = -(F = o < 0 ? -o : o);
87
+ if (r.hasOwnProperty(s = "DECIMAL_PLACES") && (o = r[s], L(o, 0, q, s), m = o), r.hasOwnProperty(s = "ROUNDING_MODE") && (o = r[s], L(o, 0, 8, s), b = o), r.hasOwnProperty(s = "EXPONENTIAL_AT") && (o = r[s], o && o.pop ? (L(o[0], -q, 0, s), L(o[1], 0, q, s), D = o[0], C = o[1]) : (L(o, -q, q, s), D = -(C = o < 0 ? -o : o))), r.hasOwnProperty(s = "RANGE"))
88
+ if (o = r[s], o && o.pop)
89
+ L(o[0], -q, -1, s), L(o[1], 1, q, s), O = o[0], F = o[1];
90
+ else if (L(o, -q, q, s), o)
91
+ O = -(F = o < 0 ? -o : o);
92
92
  else
93
- throw Error(Q + i + " cannot be zero: " + o);
94
- if (r.hasOwnProperty(i = "CRYPTO"))
95
- if (o = r[i], o === !!o)
93
+ throw Error(Z + s + " cannot be zero: " + o);
94
+ if (r.hasOwnProperty(s = "CRYPTO"))
95
+ if (o = r[s], o === !!o)
96
96
  if (o)
97
97
  if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
98
- g = o;
98
+ h = o;
99
99
  else
100
- throw g = !o, Error(Q + "crypto unavailable");
100
+ throw h = !o, Error(Z + "crypto unavailable");
101
101
  else
102
- g = o;
102
+ h = o;
103
103
  else
104
- throw Error(Q + i + " not true or false: " + o);
105
- if (r.hasOwnProperty(i = "MODULO_MODE") && (o = r[i], L(o, 0, 9, i), S = o), r.hasOwnProperty(i = "POW_PRECISION") && (o = r[i], L(o, 0, H, i), w = o), r.hasOwnProperty(i = "FORMAT"))
106
- if (o = r[i], typeof o == "object") $ = o;
107
- else throw Error(Q + i + " not an object: " + o);
108
- if (r.hasOwnProperty(i = "ALPHABET"))
109
- if (o = r[i], typeof o == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(o))
110
- q = o.slice(0, 10) == "0123456789", K = o;
104
+ throw Error(Z + s + " not true or false: " + o);
105
+ if (r.hasOwnProperty(s = "MODULO_MODE") && (o = r[s], L(o, 0, 9, s), w = o), r.hasOwnProperty(s = "POW_PRECISION") && (o = r[s], L(o, 0, q, s), B = o), r.hasOwnProperty(s = "FORMAT"))
106
+ if (o = r[s], typeof o == "object") V = o;
107
+ else throw Error(Z + s + " not an object: " + o);
108
+ if (r.hasOwnProperty(s = "ALPHABET"))
109
+ if (o = r[s], typeof o == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(o))
110
+ z = o.slice(0, 10) == "0123456789", K = o;
111
111
  else
112
- throw Error(Q + i + " invalid: " + o);
112
+ throw Error(Z + s + " invalid: " + o);
113
113
  } else
114
- throw Error(Q + "Object expected: " + r);
114
+ throw Error(Z + "Object expected: " + r);
115
115
  return {
116
- DECIMAL_PLACES: y,
117
- ROUNDING_MODE: E,
116
+ DECIMAL_PLACES: m,
117
+ ROUNDING_MODE: b,
118
118
  EXPONENTIAL_AT: [D, C],
119
- RANGE: [P, F],
120
- CRYPTO: g,
121
- MODULO_MODE: S,
122
- POW_PRECISION: w,
123
- FORMAT: $,
119
+ RANGE: [O, F],
120
+ CRYPTO: h,
121
+ MODULO_MODE: w,
122
+ POW_PRECISION: B,
123
+ FORMAT: V,
124
124
  ALPHABET: K
125
125
  };
126
- }, T.isBigNumber = function(r) {
126
+ }, g.isBigNumber = function(r) {
127
127
  if (!r || r._isBigNumber !== !0) return !1;
128
- if (!T.DEBUG) return !0;
129
- var i, o, m = r.c, l = r.e, p = r.s;
130
- e: if ({}.toString.call(m) == "[object Array]") {
131
- if ((p === 1 || p === -1) && l >= -H && l <= H && l === re(l)) {
132
- if (m[0] === 0) {
133
- if (l === 0 && m.length === 1) return !0;
128
+ if (!g.DEBUG) return !0;
129
+ var s, o, A = r.c, u = r.e, f = r.s;
130
+ e: if ({}.toString.call(A) == "[object Array]") {
131
+ if ((f === 1 || f === -1) && u >= -q && u <= q && u === ne(u)) {
132
+ if (A[0] === 0) {
133
+ if (u === 0 && A.length === 1) return !0;
134
134
  break e;
135
135
  }
136
- if (i = (l + 1) % O, i < 1 && (i += O), String(m[0]).length == i) {
137
- for (i = 0; i < m.length; i++)
138
- if (o = m[i], o < 0 || o >= oe || o !== re(o)) break e;
136
+ if (s = (u + 1) % k, s < 1 && (s += k), String(A[0]).length == s) {
137
+ for (s = 0; s < A.length; s++)
138
+ if (o = A[s], o < 0 || o >= ae || o !== ne(o)) break e;
139
139
  if (o !== 0) return !0;
140
140
  }
141
141
  }
142
- } else if (m === null && l === null && (p === null || p === 1 || p === -1))
142
+ } else if (A === null && u === null && (f === null || f === 1 || f === -1))
143
143
  return !0;
144
- throw Error(Q + "Invalid BigNumber: " + r);
145
- }, T.maximum = T.max = function() {
144
+ throw Error(Z + "Invalid BigNumber: " + r);
145
+ }, g.maximum = g.max = function() {
146
146
  return De(arguments, -1);
147
- }, T.minimum = T.min = function() {
147
+ }, g.minimum = g.min = function() {
148
148
  return De(arguments, 1);
149
- }, T.random = (function() {
150
- var r = 9007199254740992, i = Math.random() * r & 2097151 ? function() {
151
- return re(Math.random() * r);
149
+ }, g.random = (function() {
150
+ var r = 9007199254740992, s = Math.random() * r & 2097151 ? function() {
151
+ return ne(Math.random() * r);
152
152
  } : function() {
153
153
  return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
154
154
  };
155
155
  return function(o) {
156
- var m, l, p, b, d, u = 0, A = [], f = new T(c);
157
- if (o == null ? o = y : L(o, 0, H), b = Ve(o / O), g)
156
+ var A, u, f, E, c, l = 0, y = [], p = new g(d);
157
+ if (o == null ? o = m : L(o, 0, q), E = Ne(o / k), h)
158
158
  if (crypto.getRandomValues) {
159
- for (m = crypto.getRandomValues(new Uint32Array(b *= 2)); u < b; )
160
- d = m[u] * 131072 + (m[u + 1] >>> 11), d >= 9e15 ? (l = crypto.getRandomValues(new Uint32Array(2)), m[u] = l[0], m[u + 1] = l[1]) : (A.push(d % 1e14), u += 2);
161
- u = b / 2;
159
+ for (A = crypto.getRandomValues(new Uint32Array(E *= 2)); l < E; )
160
+ c = A[l] * 131072 + (A[l + 1] >>> 11), c >= 9e15 ? (u = crypto.getRandomValues(new Uint32Array(2)), A[l] = u[0], A[l + 1] = u[1]) : (y.push(c % 1e14), l += 2);
161
+ l = E / 2;
162
162
  } else if (crypto.randomBytes) {
163
- for (m = crypto.randomBytes(b *= 7); u < b; )
164
- d = (m[u] & 31) * 281474976710656 + m[u + 1] * 1099511627776 + m[u + 2] * 4294967296 + m[u + 3] * 16777216 + (m[u + 4] << 16) + (m[u + 5] << 8) + m[u + 6], d >= 9e15 ? crypto.randomBytes(7).copy(m, u) : (A.push(d % 1e14), u += 7);
165
- u = b / 7;
163
+ for (A = crypto.randomBytes(E *= 7); l < E; )
164
+ c = (A[l] & 31) * 281474976710656 + A[l + 1] * 1099511627776 + A[l + 2] * 4294967296 + A[l + 3] * 16777216 + (A[l + 4] << 16) + (A[l + 5] << 8) + A[l + 6], c >= 9e15 ? crypto.randomBytes(7).copy(A, l) : (y.push(c % 1e14), l += 7);
165
+ l = E / 7;
166
166
  } else
167
- throw g = !1, Error(Q + "crypto unavailable");
168
- if (!g)
169
- for (; u < b; )
170
- d = i(), d < 9e15 && (A[u++] = d % 1e14);
171
- for (b = A[--u], o %= O, b && o && (d = ze[O - o], A[u] = re(b / d) * d); A[u] === 0; A.pop(), u--) ;
172
- if (u < 0)
173
- A = [p = 0];
167
+ throw h = !1, Error(Z + "crypto unavailable");
168
+ if (!h)
169
+ for (; l < E; )
170
+ c = s(), c < 9e15 && (y[l++] = c % 1e14);
171
+ for (E = y[--l], o %= k, E && o && (c = Ue[k - o], y[l] = ne(E / c) * c); y[l] === 0; y.pop(), l--) ;
172
+ if (l < 0)
173
+ y = [f = 0];
174
174
  else {
175
- for (p = -1; A[0] === 0; A.splice(0, 1), p -= O) ;
176
- for (u = 1, d = A[0]; d >= 10; d /= 10, u++) ;
177
- u < O && (p -= O - u);
175
+ for (f = -1; y[0] === 0; y.splice(0, 1), f -= k) ;
176
+ for (l = 1, c = y[0]; c >= 10; c /= 10, l++) ;
177
+ l < k && (f -= k - l);
178
178
  }
179
- return f.e = p, f.c = A, f;
179
+ return p.e = f, p.c = y, p;
180
180
  };
181
- })(), T.sum = function() {
182
- for (var r = 1, i = arguments, o = new T(i[0]); r < i.length; ) o = o.plus(i[r++]);
181
+ })(), g.sum = function() {
182
+ for (var r = 1, s = arguments, o = new g(s[0]); r < s.length; ) o = o.plus(s[r++]);
183
183
  return o;
184
184
  }, n = /* @__PURE__ */ (function() {
185
185
  var r = "0123456789";
186
- function i(o, m, l, p) {
187
- for (var b, d = [0], u, A = 0, f = o.length; A < f; ) {
188
- for (u = d.length; u--; d[u] *= m) ;
189
- for (d[0] += p.indexOf(o.charAt(A++)), b = 0; b < d.length; b++)
190
- d[b] > l - 1 && (d[b + 1] == null && (d[b + 1] = 0), d[b + 1] += d[b] / l | 0, d[b] %= l);
186
+ function s(o, A, u, f) {
187
+ for (var E, c = [0], l, y = 0, p = o.length; y < p; ) {
188
+ for (l = c.length; l--; c[l] *= A) ;
189
+ for (c[0] += f.indexOf(o.charAt(y++)), E = 0; E < c.length; E++)
190
+ c[E] > u - 1 && (c[E + 1] == null && (c[E + 1] = 0), c[E + 1] += c[E] / u | 0, c[E] %= u);
191
191
  }
192
- return d.reverse();
192
+ return c.reverse();
193
193
  }
194
- return function(o, m, l, p, b) {
195
- var d, u, A, f, x, B, k, I, V = o.indexOf("."), z = y, R = E;
196
- for (V >= 0 && (f = w, w = 0, o = o.replace(".", ""), I = new T(m), B = I.pow(o.length - V), w = f, I.c = i(
197
- pe(ne(B.c), B.e, "0"),
194
+ return function(o, A, u, f, E) {
195
+ var c, l, y, p, T, S, P, R, U = o.indexOf("."), G = m, I = b;
196
+ for (U >= 0 && (p = B, B = 0, o = o.replace(".", ""), R = new g(A), S = R.pow(o.length - U), B = p, R.c = s(
197
+ le(te(S.c), S.e, "0"),
198
198
  10,
199
- l,
199
+ u,
200
200
  r
201
- ), I.e = I.c.length), k = i(o, m, l, b ? (d = K, r) : (d = r, K)), A = f = k.length; k[--f] == 0; k.pop()) ;
202
- if (!k[0]) return d.charAt(0);
203
- if (V < 0 ? --A : (B.c = k, B.e = A, B.s = p, B = t(B, I, z, R, l), k = B.c, x = B.r, A = B.e), u = A + z + 1, V = k[u], f = l / 2, x = x || u < 0 || k[u + 1] != null, x = R < 4 ? (V != null || x) && (R == 0 || R == (B.s < 0 ? 3 : 2)) : V > f || V == f && (R == 4 || x || R == 6 && k[u - 1] & 1 || R == (B.s < 0 ? 8 : 7)), u < 1 || !k[0])
204
- o = x ? pe(d.charAt(1), -z, d.charAt(0)) : d.charAt(0);
201
+ ), R.e = R.c.length), P = s(o, A, u, E ? (c = K, r) : (c = r, K)), y = p = P.length; P[--p] == 0; P.pop()) ;
202
+ if (!P[0]) return c.charAt(0);
203
+ if (U < 0 ? --y : (S.c = P, S.e = y, S.s = f, S = t(S, R, G, I, u), P = S.c, T = S.r, y = S.e), l = y + G + 1, U = P[l], p = u / 2, T = T || l < 0 || P[l + 1] != null, T = I < 4 ? (U != null || T) && (I == 0 || I == (S.s < 0 ? 3 : 2)) : U > p || U == p && (I == 4 || T || I == 6 && P[l - 1] & 1 || I == (S.s < 0 ? 8 : 7)), l < 1 || !P[0])
204
+ o = T ? le(c.charAt(1), -G, c.charAt(0)) : c.charAt(0);
205
205
  else {
206
- if (k.length = u, x)
207
- for (--l; ++k[--u] > l; )
208
- k[u] = 0, u || (++A, k = [1].concat(k));
209
- for (f = k.length; !k[--f]; ) ;
210
- for (V = 0, o = ""; V <= f; o += d.charAt(k[V++])) ;
211
- o = pe(o, A, d.charAt(0));
206
+ if (P.length = l, T)
207
+ for (--u; ++P[--l] > u; )
208
+ P[l] = 0, l || (++y, P = [1].concat(P));
209
+ for (p = P.length; !P[--p]; ) ;
210
+ for (U = 0, o = ""; U <= p; o += c.charAt(P[U++])) ;
211
+ o = le(o, y, c.charAt(0));
212
212
  }
213
213
  return o;
214
214
  };
215
215
  })(), t = /* @__PURE__ */ (function() {
216
- function r(m, l, p) {
217
- var b, d, u, A, f = 0, x = m.length, B = l % me, k = l / me | 0;
218
- for (m = m.slice(); x--; )
219
- u = m[x] % me, A = m[x] / me | 0, b = k * u + A * B, d = B * u + b % me * me + f, f = (d / p | 0) + (b / me | 0) + k * A, m[x] = d % p;
220
- return f && (m = [f].concat(m)), m;
216
+ function r(A, u, f) {
217
+ var E, c, l, y, p = 0, T = A.length, S = u % pe, P = u / pe | 0;
218
+ for (A = A.slice(); T--; )
219
+ l = A[T] % pe, y = A[T] / pe | 0, E = P * l + y * S, c = S * l + E % pe * pe + p, p = (c / f | 0) + (E / pe | 0) + P * y, A[T] = c % f;
220
+ return p && (A = [p].concat(A)), A;
221
221
  }
222
- function i(m, l, p, b) {
223
- var d, u;
224
- if (p != b)
225
- u = p > b ? 1 : -1;
222
+ function s(A, u, f, E) {
223
+ var c, l;
224
+ if (f != E)
225
+ l = f > E ? 1 : -1;
226
226
  else
227
- for (d = u = 0; d < p; d++)
228
- if (m[d] != l[d]) {
229
- u = m[d] > l[d] ? 1 : -1;
227
+ for (c = l = 0; c < f; c++)
228
+ if (A[c] != u[c]) {
229
+ l = A[c] > u[c] ? 1 : -1;
230
230
  break;
231
231
  }
232
- return u;
232
+ return l;
233
233
  }
234
- function o(m, l, p, b) {
235
- for (var d = 0; p--; )
236
- m[p] -= d, d = m[p] < l[p] ? 1 : 0, m[p] = d * b + m[p] - l[p];
237
- for (; !m[0] && m.length > 1; m.splice(0, 1)) ;
234
+ function o(A, u, f, E) {
235
+ for (var c = 0; f--; )
236
+ A[f] -= c, c = A[f] < u[f] ? 1 : 0, A[f] = c * E + A[f] - u[f];
237
+ for (; !A[0] && A.length > 1; A.splice(0, 1)) ;
238
238
  }
239
- return function(m, l, p, b, d) {
240
- var u, A, f, x, B, k, I, V, z, R, M, j, Be, $e, Ke, le, we, te = m.s == l.s ? 1 : -1, X = m.c, W = l.c;
241
- if (!X || !X[0] || !W || !W[0])
242
- return new T(
239
+ return function(A, u, f, E, c) {
240
+ var l, y, p, T, S, P, R, U, G, I, M, j, Fe, Re, Me, oe, ge, ee = A.s == u.s ? 1 : -1, X = A.c, $ = u.c;
241
+ if (!X || !X[0] || !$ || !$[0])
242
+ return new g(
243
243
  // Return NaN if either NaN, or both Infinity or 0.
244
- !m.s || !l.s || (X ? W && X[0] == W[0] : !W) ? NaN : (
244
+ !A.s || !u.s || (X ? $ && X[0] == $[0] : !$) ? NaN : (
245
245
  // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
246
- X && X[0] == 0 || !W ? te * 0 : te / 0
246
+ X && X[0] == 0 || !$ ? ee * 0 : ee / 0
247
247
  )
248
248
  );
249
- for (V = new T(te), z = V.c = [], A = m.e - l.e, te = p + A + 1, d || (d = oe, A = ae(m.e / O) - ae(l.e / O), te = te / O | 0), f = 0; W[f] == (X[f] || 0); f++) ;
250
- if (W[f] > (X[f] || 0) && A--, te < 0)
251
- z.push(1), x = !0;
249
+ for (U = new g(ee), G = U.c = [], y = A.e - u.e, ee = f + y + 1, c || (c = ae, y = re(A.e / k) - re(u.e / k), ee = ee / k | 0), p = 0; $[p] == (X[p] || 0); p++) ;
250
+ if ($[p] > (X[p] || 0) && y--, ee < 0)
251
+ G.push(1), T = !0;
252
252
  else {
253
- for ($e = X.length, le = W.length, f = 0, te += 2, B = re(d / (W[0] + 1)), B > 1 && (W = r(W, B, d), X = r(X, B, d), le = W.length, $e = X.length), Be = le, R = X.slice(0, le), M = R.length; M < le; R[M++] = 0) ;
254
- we = W.slice(), we = [0].concat(we), Ke = W[0], W[1] >= d / 2 && Ke++;
253
+ for (Re = X.length, oe = $.length, p = 0, ee += 2, S = ne(c / ($[0] + 1)), S > 1 && ($ = r($, S, c), X = r(X, S, c), oe = $.length, Re = X.length), Fe = oe, I = X.slice(0, oe), M = I.length; M < oe; I[M++] = 0) ;
254
+ ge = $.slice(), ge = [0].concat(ge), Me = $[0], $[1] >= c / 2 && Me++;
255
255
  do {
256
- if (B = 0, u = i(W, R, le, M), u < 0) {
257
- if (j = R[0], le != M && (j = j * d + (R[1] || 0)), B = re(j / Ke), B > 1)
258
- for (B >= d && (B = d - 1), k = r(W, B, d), I = k.length, M = R.length; i(k, R, I, M) == 1; )
259
- B--, o(k, le < I ? we : W, I, d), I = k.length, u = 1;
256
+ if (S = 0, l = s($, I, oe, M), l < 0) {
257
+ if (j = I[0], oe != M && (j = j * c + (I[1] || 0)), S = ne(j / Me), S > 1)
258
+ for (S >= c && (S = c - 1), P = r($, S, c), R = P.length, M = I.length; s(P, I, R, M) == 1; )
259
+ S--, o(P, oe < R ? ge : $, R, c), R = P.length, l = 1;
260
260
  else
261
- B == 0 && (u = B = 1), k = W.slice(), I = k.length;
262
- if (I < M && (k = [0].concat(k)), o(R, k, M, d), M = R.length, u == -1)
263
- for (; i(W, R, le, M) < 1; )
264
- B++, o(R, le < M ? we : W, M, d), M = R.length;
265
- } else u === 0 && (B++, R = [0]);
266
- z[f++] = B, R[0] ? R[M++] = X[Be] || 0 : (R = [X[Be]], M = 1);
267
- } while ((Be++ < $e || R[0] != null) && te--);
268
- x = R[0] != null, z[0] || z.splice(0, 1);
261
+ S == 0 && (l = S = 1), P = $.slice(), R = P.length;
262
+ if (R < M && (P = [0].concat(P)), o(I, P, M, c), M = I.length, l == -1)
263
+ for (; s($, I, oe, M) < 1; )
264
+ S++, o(I, oe < M ? ge : $, M, c), M = I.length;
265
+ } else l === 0 && (S++, I = [0]);
266
+ G[p++] = S, I[0] ? I[M++] = X[Fe] || 0 : (I = [X[Fe]], M = 1);
267
+ } while ((Fe++ < Re || I[0] != null) && ee--);
268
+ T = I[0] != null, G[0] || G.splice(0, 1);
269
269
  }
270
- if (d == oe) {
271
- for (f = 1, te = z[0]; te >= 10; te /= 10, f++) ;
272
- Y(V, p + (V.e = f + A * O - 1) + 1, b, x);
270
+ if (c == ae) {
271
+ for (p = 1, ee = G[0]; ee >= 10; ee /= 10, p++) ;
272
+ Y(U, f + (U.e = p + y * k - 1) + 1, E, T);
273
273
  } else
274
- V.e = A, V.r = +x;
275
- return V;
274
+ U.e = y, U.r = +T;
275
+ return U;
276
276
  };
277
277
  })();
278
- function Te(r, i, o, m) {
279
- var l, p, b, d, u;
280
- if (o == null ? o = E : L(o, 0, 8), !r.c) return r.toString();
281
- if (l = r.c[0], b = r.e, i == null)
282
- u = ne(r.c), u = m == 1 || m == 2 && (b <= D || b >= C) ? Se(u, b) : pe(u, b, "0");
283
- else if (r = Y(new T(r), i, o), p = r.e, u = ne(r.c), d = u.length, m == 1 || m == 2 && (i <= p || p <= D)) {
284
- for (; d < i; u += "0", d++) ;
285
- u = Se(u, p);
286
- } else if (i -= b + (m === 2 && p > b), u = pe(u, p, "0"), p + 1 > d) {
287
- if (--i > 0) for (u += "."; i--; u += "0") ;
288
- } else if (i += p - d, i > 0)
289
- for (p + 1 == d && (u += "."); i--; u += "0") ;
290
- return r.s < 0 && l ? "-" + u : u;
278
+ function Te(r, s, o, A) {
279
+ var u, f, E, c, l;
280
+ if (o == null ? o = b : L(o, 0, 8), !r.c) return r.toString();
281
+ if (u = r.c[0], E = r.e, s == null)
282
+ l = te(r.c), l = A == 1 || A == 2 && (E <= D || E >= C) ? Be(l, E) : le(l, E, "0");
283
+ else if (r = Y(new g(r), s, o), f = r.e, l = te(r.c), c = l.length, A == 1 || A == 2 && (s <= f || f <= D)) {
284
+ for (; c < s; l += "0", c++) ;
285
+ l = Be(l, f);
286
+ } else if (s -= E + (A === 2 && f > E), l = le(l, f, "0"), f + 1 > c) {
287
+ if (--s > 0) for (l += "."; s--; l += "0") ;
288
+ } else if (s += f - c, s > 0)
289
+ for (f + 1 == c && (l += "."); s--; l += "0") ;
290
+ return r.s < 0 && u ? "-" + l : l;
291
291
  }
292
- function De(r, i) {
293
- for (var o, m, l = 1, p = new T(r[0]); l < r.length; l++)
294
- m = new T(r[l]), (!m.s || (o = be(p, m)) === i || o === 0 && p.s === i) && (p = m);
295
- return p;
292
+ function De(r, s) {
293
+ for (var o, A, u = 1, f = new g(r[0]); u < r.length; u++)
294
+ A = new g(r[u]), (!A.s || (o = ye(f, A)) === s || o === 0 && f.s === s) && (f = A);
295
+ return f;
296
296
  }
297
- function Fe(r, i, o) {
298
- for (var m = 1, l = i.length; !i[--l]; i.pop()) ;
299
- for (l = i[0]; l >= 10; l /= 10, m++) ;
300
- return (o = m + o * O - 1) > F ? r.c = r.e = null : o < P ? r.c = [r.e = 0] : (r.e = o, r.c = i), r;
297
+ function xe(r, s, o) {
298
+ for (var A = 1, u = s.length; !s[--u]; s.pop()) ;
299
+ for (u = s[0]; u >= 10; u /= 10, A++) ;
300
+ return (o = A + o * k - 1) > F ? r.c = r.e = null : o < O ? r.c = [r.e = 0] : (r.e = o, r.c = s), r;
301
301
  }
302
- a = /* @__PURE__ */ (function() {
303
- var r = /^(-?)0([xbo])(?=\w[\w.]*$)/i, i = /^([^.]+)\.$/, o = /^\.([^.]+)$/, m = /^-?(Infinity|NaN)$/, l = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
304
- return function(p, b, d, u) {
305
- var A, f = d ? b : b.replace(l, "");
306
- if (m.test(f))
307
- p.s = isNaN(f) ? null : f < 0 ? -1 : 1;
302
+ i = /* @__PURE__ */ (function() {
303
+ var r = /^(-?)0([xbo])(?=\w[\w.]*$)/i, s = /^([^.]+)\.$/, o = /^\.([^.]+)$/, A = /^-?(Infinity|NaN)$/, u = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
304
+ return function(f, E, c, l) {
305
+ var y, p = c ? E : E.replace(u, "");
306
+ if (A.test(p))
307
+ f.s = isNaN(p) ? null : p < 0 ? -1 : 1;
308
308
  else {
309
- if (!d && (f = f.replace(r, function(x, B, k) {
310
- return A = (k = k.toLowerCase()) == "x" ? 16 : k == "b" ? 2 : 8, !u || u == A ? B : x;
311
- }), u && (A = u, f = f.replace(i, "$1").replace(o, "0.$1")), b != f))
312
- return new T(f, A);
313
- if (T.DEBUG)
314
- throw Error(Q + "Not a" + (u ? " base " + u : "") + " number: " + b);
315
- p.s = null;
309
+ if (!c && (p = p.replace(r, function(T, S, P) {
310
+ return y = (P = P.toLowerCase()) == "x" ? 16 : P == "b" ? 2 : 8, !l || l == y ? S : T;
311
+ }), l && (y = l, p = p.replace(s, "$1").replace(o, "0.$1")), E != p))
312
+ return new g(p, y);
313
+ if (g.DEBUG)
314
+ throw Error(Z + "Not a" + (l ? " base " + l : "") + " number: " + E);
315
+ f.s = null;
316
316
  }
317
- p.c = p.e = null;
317
+ f.c = f.e = null;
318
318
  };
319
319
  })();
320
- function Y(r, i, o, m) {
321
- var l, p, b, d, u, A, f, x = r.c, B = ze;
322
- if (x) {
320
+ function Y(r, s, o, A) {
321
+ var u, f, E, c, l, y, p, T = r.c, S = Ue;
322
+ if (T) {
323
323
  e: {
324
- for (l = 1, d = x[0]; d >= 10; d /= 10, l++) ;
325
- if (p = i - l, p < 0)
326
- p += O, b = i, u = x[A = 0], f = re(u / B[l - b - 1] % 10);
327
- else if (A = Ve((p + 1) / O), A >= x.length)
328
- if (m) {
329
- for (; x.length <= A; x.push(0)) ;
330
- u = f = 0, l = 1, p %= O, b = p - O + 1;
324
+ for (u = 1, c = T[0]; c >= 10; c /= 10, u++) ;
325
+ if (f = s - u, f < 0)
326
+ f += k, E = s, l = T[y = 0], p = ne(l / S[u - E - 1] % 10);
327
+ else if (y = Ne((f + 1) / k), y >= T.length)
328
+ if (A) {
329
+ for (; T.length <= y; T.push(0)) ;
330
+ l = p = 0, u = 1, f %= k, E = f - k + 1;
331
331
  } else
332
332
  break e;
333
333
  else {
334
- for (u = d = x[A], l = 1; d >= 10; d /= 10, l++) ;
335
- p %= O, b = p - O + l, f = b < 0 ? 0 : re(u / B[l - b - 1] % 10);
334
+ for (l = c = T[y], u = 1; c >= 10; c /= 10, u++) ;
335
+ f %= k, E = f - k + u, p = E < 0 ? 0 : ne(l / S[u - E - 1] % 10);
336
336
  }
337
- if (m = m || i < 0 || // Are there any non-zero digits after the rounding digit?
337
+ if (A = A || s < 0 || // Are there any non-zero digits after the rounding digit?
338
338
  // The expression n % pows10[d - j - 1] returns all digits of n to the right
339
339
  // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
340
- x[A + 1] != null || (b < 0 ? u : u % B[l - b - 1]), m = o < 4 ? (f || m) && (o == 0 || o == (r.s < 0 ? 3 : 2)) : f > 5 || f == 5 && (o == 4 || m || o == 6 && // Check whether the digit to the left of the rounding digit is odd.
341
- (p > 0 ? b > 0 ? u / B[l - b] : 0 : x[A - 1]) % 10 & 1 || o == (r.s < 0 ? 8 : 7)), i < 1 || !x[0])
342
- return x.length = 0, m ? (i -= r.e + 1, x[0] = B[(O - i % O) % O], r.e = -i || 0) : x[0] = r.e = 0, r;
343
- if (p == 0 ? (x.length = A, d = 1, A--) : (x.length = A + 1, d = B[O - p], x[A] = b > 0 ? re(u / B[l - b] % B[b]) * d : 0), m)
340
+ T[y + 1] != null || (E < 0 ? l : l % S[u - E - 1]), A = o < 4 ? (p || A) && (o == 0 || o == (r.s < 0 ? 3 : 2)) : p > 5 || p == 5 && (o == 4 || A || o == 6 && // Check whether the digit to the left of the rounding digit is odd.
341
+ (f > 0 ? E > 0 ? l / S[u - E] : 0 : T[y - 1]) % 10 & 1 || o == (r.s < 0 ? 8 : 7)), s < 1 || !T[0])
342
+ return T.length = 0, A ? (s -= r.e + 1, T[0] = S[(k - s % k) % k], r.e = -s || 0) : T[0] = r.e = 0, r;
343
+ if (f == 0 ? (T.length = y, c = 1, y--) : (T.length = y + 1, c = S[k - f], T[y] = E > 0 ? ne(l / S[u - E] % S[E]) * c : 0), A)
344
344
  for (; ; )
345
- if (A == 0) {
346
- for (p = 1, b = x[0]; b >= 10; b /= 10, p++) ;
347
- for (b = x[0] += d, d = 1; b >= 10; b /= 10, d++) ;
348
- p != d && (r.e++, x[0] == oe && (x[0] = 1));
345
+ if (y == 0) {
346
+ for (f = 1, E = T[0]; E >= 10; E /= 10, f++) ;
347
+ for (E = T[0] += c, c = 1; E >= 10; E /= 10, c++) ;
348
+ f != c && (r.e++, T[0] == ae && (T[0] = 1));
349
349
  break;
350
350
  } else {
351
- if (x[A] += d, x[A] != oe) break;
352
- x[A--] = 0, d = 1;
351
+ if (T[y] += c, T[y] != ae) break;
352
+ T[y--] = 0, c = 1;
353
353
  }
354
- for (p = x.length; x[--p] === 0; x.pop()) ;
354
+ for (f = T.length; T[--f] === 0; T.pop()) ;
355
355
  }
356
- r.e > F ? r.c = r.e = null : r.e < P && (r.c = [r.e = 0]);
356
+ r.e > F ? r.c = r.e = null : r.e < O && (r.c = [r.e = 0]);
357
357
  }
358
358
  return r;
359
359
  }
360
- function ie(r) {
361
- var i, o = r.e;
362
- return o === null ? r.toString() : (i = ne(r.c), i = o <= D || o >= C ? Se(i, o) : pe(i, o, "0"), r.s < 0 ? "-" + i : i);
360
+ function ue(r) {
361
+ var s, o = r.e;
362
+ return o === null ? r.toString() : (s = te(r.c), s = o <= D || o >= C ? Be(s, o) : le(s, o, "0"), r.s < 0 ? "-" + s : s);
363
363
  }
364
- return s.absoluteValue = s.abs = function() {
365
- var r = new T(this);
364
+ return a.absoluteValue = a.abs = function() {
365
+ var r = new g(this);
366
366
  return r.s < 0 && (r.s = 1), r;
367
- }, s.comparedTo = function(r, i) {
368
- return be(this, new T(r, i));
369
- }, s.decimalPlaces = s.dp = function(r, i) {
370
- var o, m, l, p = this;
367
+ }, a.comparedTo = function(r, s) {
368
+ return ye(this, new g(r, s));
369
+ }, a.decimalPlaces = a.dp = function(r, s) {
370
+ var o, A, u, f = this;
371
371
  if (r != null)
372
- return L(r, 0, H), i == null ? i = E : L(i, 0, 8), Y(new T(p), r + p.e + 1, i);
373
- if (!(o = p.c)) return null;
374
- if (m = ((l = o.length - 1) - ae(this.e / O)) * O, l = o[l]) for (; l % 10 == 0; l /= 10, m--) ;
375
- return m < 0 && (m = 0), m;
376
- }, s.dividedBy = s.div = function(r, i) {
377
- return t(this, new T(r, i), y, E);
378
- }, s.dividedToIntegerBy = s.idiv = function(r, i) {
379
- return t(this, new T(r, i), 0, 1);
380
- }, s.exponentiatedBy = s.pow = function(r, i) {
381
- var o, m, l, p, b, d, u, A, f, x = this;
382
- if (r = new T(r), r.c && !r.isInteger())
383
- throw Error(Q + "Exponent not an integer: " + ie(r));
384
- if (i != null && (i = new T(i)), d = r.e > 14, !x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !r.c || !r.c[0])
385
- return f = new T(Math.pow(+ie(x), d ? r.s * (2 - ke(r)) : +ie(r))), i ? f.mod(i) : f;
386
- if (u = r.s < 0, i) {
387
- if (i.c ? !i.c[0] : !i.s) return new T(NaN);
388
- m = !u && x.isInteger() && i.isInteger(), m && (x = x.mod(i));
372
+ return L(r, 0, q), s == null ? s = b : L(s, 0, 8), Y(new g(f), r + f.e + 1, s);
373
+ if (!(o = f.c)) return null;
374
+ if (A = ((u = o.length - 1) - re(this.e / k)) * k, u = o[u]) for (; u % 10 == 0; u /= 10, A--) ;
375
+ return A < 0 && (A = 0), A;
376
+ }, a.dividedBy = a.div = function(r, s) {
377
+ return t(this, new g(r, s), m, b);
378
+ }, a.dividedToIntegerBy = a.idiv = function(r, s) {
379
+ return t(this, new g(r, s), 0, 1);
380
+ }, a.exponentiatedBy = a.pow = function(r, s) {
381
+ var o, A, u, f, E, c, l, y, p, T = this;
382
+ if (r = new g(r), r.c && !r.isInteger())
383
+ throw Error(Z + "Exponent not an integer: " + ue(r));
384
+ if (s != null && (s = new g(s)), c = r.e > 14, !T.c || !T.c[0] || T.c[0] == 1 && !T.e && T.c.length == 1 || !r.c || !r.c[0])
385
+ return p = new g(Math.pow(+ue(T), c ? r.s * (2 - Ce(r)) : +ue(r))), s ? p.mod(s) : p;
386
+ if (l = r.s < 0, s) {
387
+ if (s.c ? !s.c[0] : !s.s) return new g(NaN);
388
+ A = !l && T.isInteger() && s.isInteger(), A && (T = T.mod(s));
389
389
  } else {
390
- if (r.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || d && x.c[1] >= 24e7 : x.c[0] < 8e13 || d && x.c[0] <= 9999975e7)))
391
- return p = x.s < 0 && ke(r) ? -0 : 0, x.e > -1 && (p = 1 / p), new T(u ? 1 / p : p);
392
- w && (p = Ve(w / O + 2));
390
+ if (r.e > 9 && (T.e > 0 || T.e < -1 || (T.e == 0 ? T.c[0] > 1 || c && T.c[1] >= 24e7 : T.c[0] < 8e13 || c && T.c[0] <= 9999975e7)))
391
+ return f = T.s < 0 && Ce(r) ? -0 : 0, T.e > -1 && (f = 1 / f), new g(l ? 1 / f : f);
392
+ B && (f = Ne(B / k + 2));
393
393
  }
394
- for (d ? (o = new T(0.5), u && (r.s = 1), A = ke(r)) : (l = Math.abs(+ie(r)), A = l % 2), f = new T(c); ; ) {
395
- if (A) {
396
- if (f = f.times(x), !f.c) break;
397
- p ? f.c.length > p && (f.c.length = p) : m && (f = f.mod(i));
394
+ for (c ? (o = new g(0.5), l && (r.s = 1), y = Ce(r)) : (u = Math.abs(+ue(r)), y = u % 2), p = new g(d); ; ) {
395
+ if (y) {
396
+ if (p = p.times(T), !p.c) break;
397
+ f ? p.c.length > f && (p.c.length = f) : A && (p = p.mod(s));
398
398
  }
399
- if (l) {
400
- if (l = re(l / 2), l === 0) break;
401
- A = l % 2;
399
+ if (u) {
400
+ if (u = ne(u / 2), u === 0) break;
401
+ y = u % 2;
402
402
  } else if (r = r.times(o), Y(r, r.e + 1, 1), r.e > 14)
403
- A = ke(r);
403
+ y = Ce(r);
404
404
  else {
405
- if (l = +ie(r), l === 0) break;
406
- A = l % 2;
405
+ if (u = +ue(r), u === 0) break;
406
+ y = u % 2;
407
407
  }
408
- x = x.times(x), p ? x.c && x.c.length > p && (x.c.length = p) : m && (x = x.mod(i));
408
+ T = T.times(T), f ? T.c && T.c.length > f && (T.c.length = f) : A && (T = T.mod(s));
409
409
  }
410
- return m ? f : (u && (f = c.div(f)), i ? f.mod(i) : p ? Y(f, w, E, b) : f);
411
- }, s.integerValue = function(r) {
412
- var i = new T(this);
413
- return r == null ? r = E : L(r, 0, 8), Y(i, i.e + 1, r);
414
- }, s.isEqualTo = s.eq = function(r, i) {
415
- return be(this, new T(r, i)) === 0;
416
- }, s.isFinite = function() {
410
+ return A ? p : (l && (p = d.div(p)), s ? p.mod(s) : f ? Y(p, B, b, E) : p);
411
+ }, a.integerValue = function(r) {
412
+ var s = new g(this);
413
+ return r == null ? r = b : L(r, 0, 8), Y(s, s.e + 1, r);
414
+ }, a.isEqualTo = a.eq = function(r, s) {
415
+ return ye(this, new g(r, s)) === 0;
416
+ }, a.isFinite = function() {
417
417
  return !!this.c;
418
- }, s.isGreaterThan = s.gt = function(r, i) {
419
- return be(this, new T(r, i)) > 0;
420
- }, s.isGreaterThanOrEqualTo = s.gte = function(r, i) {
421
- return (i = be(this, new T(r, i))) === 1 || i === 0;
422
- }, s.isInteger = function() {
423
- return !!this.c && ae(this.e / O) > this.c.length - 2;
424
- }, s.isLessThan = s.lt = function(r, i) {
425
- return be(this, new T(r, i)) < 0;
426
- }, s.isLessThanOrEqualTo = s.lte = function(r, i) {
427
- return (i = be(this, new T(r, i))) === -1 || i === 0;
428
- }, s.isNaN = function() {
418
+ }, a.isGreaterThan = a.gt = function(r, s) {
419
+ return ye(this, new g(r, s)) > 0;
420
+ }, a.isGreaterThanOrEqualTo = a.gte = function(r, s) {
421
+ return (s = ye(this, new g(r, s))) === 1 || s === 0;
422
+ }, a.isInteger = function() {
423
+ return !!this.c && re(this.e / k) > this.c.length - 2;
424
+ }, a.isLessThan = a.lt = function(r, s) {
425
+ return ye(this, new g(r, s)) < 0;
426
+ }, a.isLessThanOrEqualTo = a.lte = function(r, s) {
427
+ return (s = ye(this, new g(r, s))) === -1 || s === 0;
428
+ }, a.isNaN = function() {
429
429
  return !this.s;
430
- }, s.isNegative = function() {
430
+ }, a.isNegative = function() {
431
431
  return this.s < 0;
432
- }, s.isPositive = function() {
432
+ }, a.isPositive = function() {
433
433
  return this.s > 0;
434
- }, s.isZero = function() {
434
+ }, a.isZero = function() {
435
435
  return !!this.c && this.c[0] == 0;
436
- }, s.minus = function(r, i) {
437
- var o, m, l, p, b = this, d = b.s;
438
- if (r = new T(r, i), i = r.s, !d || !i) return new T(NaN);
439
- if (d != i)
440
- return r.s = -i, b.plus(r);
441
- var u = b.e / O, A = r.e / O, f = b.c, x = r.c;
442
- if (!u || !A) {
443
- if (!f || !x) return f ? (r.s = -i, r) : new T(x ? b : NaN);
444
- if (!f[0] || !x[0])
445
- return x[0] ? (r.s = -i, r) : new T(f[0] ? b : (
436
+ }, a.minus = function(r, s) {
437
+ var o, A, u, f, E = this, c = E.s;
438
+ if (r = new g(r, s), s = r.s, !c || !s) return new g(NaN);
439
+ if (c != s)
440
+ return r.s = -s, E.plus(r);
441
+ var l = E.e / k, y = r.e / k, p = E.c, T = r.c;
442
+ if (!l || !y) {
443
+ if (!p || !T) return p ? (r.s = -s, r) : new g(T ? E : NaN);
444
+ if (!p[0] || !T[0])
445
+ return T[0] ? (r.s = -s, r) : new g(p[0] ? E : (
446
446
  // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
447
- E == 3 ? -0 : 0
447
+ b == 3 ? -0 : 0
448
448
  ));
449
449
  }
450
- if (u = ae(u), A = ae(A), f = f.slice(), d = u - A) {
451
- for ((p = d < 0) ? (d = -d, l = f) : (A = u, l = x), l.reverse(), i = d; i--; l.push(0)) ;
452
- l.reverse();
450
+ if (l = re(l), y = re(y), p = p.slice(), c = l - y) {
451
+ for ((f = c < 0) ? (c = -c, u = p) : (y = l, u = T), u.reverse(), s = c; s--; u.push(0)) ;
452
+ u.reverse();
453
453
  } else
454
- for (m = (p = (d = f.length) < (i = x.length)) ? d : i, d = i = 0; i < m; i++)
455
- if (f[i] != x[i]) {
456
- p = f[i] < x[i];
454
+ for (A = (f = (c = p.length) < (s = T.length)) ? c : s, c = s = 0; s < A; s++)
455
+ if (p[s] != T[s]) {
456
+ f = p[s] < T[s];
457
457
  break;
458
458
  }
459
- if (p && (l = f, f = x, x = l, r.s = -r.s), i = (m = x.length) - (o = f.length), i > 0) for (; i--; f[o++] = 0) ;
460
- for (i = oe - 1; m > d; ) {
461
- if (f[--m] < x[m]) {
462
- for (o = m; o && !f[--o]; f[o] = i) ;
463
- --f[o], f[m] += oe;
459
+ if (f && (u = p, p = T, T = u, r.s = -r.s), s = (A = T.length) - (o = p.length), s > 0) for (; s--; p[o++] = 0) ;
460
+ for (s = ae - 1; A > c; ) {
461
+ if (p[--A] < T[A]) {
462
+ for (o = A; o && !p[--o]; p[o] = s) ;
463
+ --p[o], p[A] += ae;
464
464
  }
465
- f[m] -= x[m];
465
+ p[A] -= T[A];
466
466
  }
467
- for (; f[0] == 0; f.splice(0, 1), --A) ;
468
- return f[0] ? Fe(r, f, A) : (r.s = E == 3 ? -1 : 1, r.c = [r.e = 0], r);
469
- }, s.modulo = s.mod = function(r, i) {
470
- var o, m, l = this;
471
- return r = new T(r, i), !l.c || !r.s || r.c && !r.c[0] ? new T(NaN) : !r.c || l.c && !l.c[0] ? new T(l) : (S == 9 ? (m = r.s, r.s = 1, o = t(l, r, 0, 3), r.s = m, o.s *= m) : o = t(l, r, 0, S), r = l.minus(o.times(r)), !r.c[0] && S == 1 && (r.s = l.s), r);
472
- }, s.multipliedBy = s.times = function(r, i) {
473
- var o, m, l, p, b, d, u, A, f, x, B, k, I, V, z, R = this, M = R.c, j = (r = new T(r, i)).c;
467
+ for (; p[0] == 0; p.splice(0, 1), --y) ;
468
+ return p[0] ? xe(r, p, y) : (r.s = b == 3 ? -1 : 1, r.c = [r.e = 0], r);
469
+ }, a.modulo = a.mod = function(r, s) {
470
+ var o, A, u = this;
471
+ return r = new g(r, s), !u.c || !r.s || r.c && !r.c[0] ? new g(NaN) : !r.c || u.c && !u.c[0] ? new g(u) : (w == 9 ? (A = r.s, r.s = 1, o = t(u, r, 0, 3), r.s = A, o.s *= A) : o = t(u, r, 0, w), r = u.minus(o.times(r)), !r.c[0] && w == 1 && (r.s = u.s), r);
472
+ }, a.multipliedBy = a.times = function(r, s) {
473
+ var o, A, u, f, E, c, l, y, p, T, S, P, R, U, G, I = this, M = I.c, j = (r = new g(r, s)).c;
474
474
  if (!M || !j || !M[0] || !j[0])
475
- return !R.s || !r.s || M && !M[0] && !j || j && !j[0] && !M ? r.c = r.e = r.s = null : (r.s *= R.s, !M || !j ? r.c = r.e = null : (r.c = [0], r.e = 0)), r;
476
- for (m = ae(R.e / O) + ae(r.e / O), r.s *= R.s, u = M.length, x = j.length, u < x && (I = M, M = j, j = I, l = u, u = x, x = l), l = u + x, I = []; l--; I.push(0)) ;
477
- for (V = oe, z = me, l = x; --l >= 0; ) {
478
- for (o = 0, B = j[l] % z, k = j[l] / z | 0, b = u, p = l + b; p > l; )
479
- A = M[--b] % z, f = M[b] / z | 0, d = k * A + f * B, A = B * A + d % z * z + I[p] + o, o = (A / V | 0) + (d / z | 0) + k * f, I[p--] = A % V;
480
- I[p] = o;
475
+ return !I.s || !r.s || M && !M[0] && !j || j && !j[0] && !M ? r.c = r.e = r.s = null : (r.s *= I.s, !M || !j ? r.c = r.e = null : (r.c = [0], r.e = 0)), r;
476
+ for (A = re(I.e / k) + re(r.e / k), r.s *= I.s, l = M.length, T = j.length, l < T && (R = M, M = j, j = R, u = l, l = T, T = u), u = l + T, R = []; u--; R.push(0)) ;
477
+ for (U = ae, G = pe, u = T; --u >= 0; ) {
478
+ for (o = 0, S = j[u] % G, P = j[u] / G | 0, E = l, f = u + E; f > u; )
479
+ y = M[--E] % G, p = M[E] / G | 0, c = P * y + p * S, y = S * y + c % G * G + R[f] + o, o = (y / U | 0) + (c / G | 0) + P * p, R[f--] = y % U;
480
+ R[f] = o;
481
481
  }
482
- return o ? ++m : I.splice(0, 1), Fe(r, I, m);
483
- }, s.negated = function() {
484
- var r = new T(this);
482
+ return o ? ++A : R.splice(0, 1), xe(r, R, A);
483
+ }, a.negated = function() {
484
+ var r = new g(this);
485
485
  return r.s = -r.s || null, r;
486
- }, s.plus = function(r, i) {
487
- var o, m = this, l = m.s;
488
- if (r = new T(r, i), i = r.s, !l || !i) return new T(NaN);
489
- if (l != i)
490
- return r.s = -i, m.minus(r);
491
- var p = m.e / O, b = r.e / O, d = m.c, u = r.c;
492
- if (!p || !b) {
493
- if (!d || !u) return new T(l / 0);
494
- if (!d[0] || !u[0]) return u[0] ? r : new T(d[0] ? m : l * 0);
486
+ }, a.plus = function(r, s) {
487
+ var o, A = this, u = A.s;
488
+ if (r = new g(r, s), s = r.s, !u || !s) return new g(NaN);
489
+ if (u != s)
490
+ return r.s = -s, A.minus(r);
491
+ var f = A.e / k, E = r.e / k, c = A.c, l = r.c;
492
+ if (!f || !E) {
493
+ if (!c || !l) return new g(u / 0);
494
+ if (!c[0] || !l[0]) return l[0] ? r : new g(c[0] ? A : u * 0);
495
495
  }
496
- if (p = ae(p), b = ae(b), d = d.slice(), l = p - b) {
497
- for (l > 0 ? (b = p, o = u) : (l = -l, o = d), o.reverse(); l--; o.push(0)) ;
496
+ if (f = re(f), E = re(E), c = c.slice(), u = f - E) {
497
+ for (u > 0 ? (E = f, o = l) : (u = -u, o = c), o.reverse(); u--; o.push(0)) ;
498
498
  o.reverse();
499
499
  }
500
- for (l = d.length, i = u.length, l - i < 0 && (o = u, u = d, d = o, i = l), l = 0; i; )
501
- l = (d[--i] = d[i] + u[i] + l) / oe | 0, d[i] = oe === d[i] ? 0 : d[i] % oe;
502
- return l && (d = [l].concat(d), ++b), Fe(r, d, b);
503
- }, s.precision = s.sd = function(r, i) {
504
- var o, m, l, p = this;
500
+ for (u = c.length, s = l.length, u - s < 0 && (o = l, l = c, c = o, s = u), u = 0; s; )
501
+ u = (c[--s] = c[s] + l[s] + u) / ae | 0, c[s] = ae === c[s] ? 0 : c[s] % ae;
502
+ return u && (c = [u].concat(c), ++E), xe(r, c, E);
503
+ }, a.precision = a.sd = function(r, s) {
504
+ var o, A, u, f = this;
505
505
  if (r != null && r !== !!r)
506
- return L(r, 1, H), i == null ? i = E : L(i, 0, 8), Y(new T(p), r, i);
507
- if (!(o = p.c)) return null;
508
- if (l = o.length - 1, m = l * O + 1, l = o[l]) {
509
- for (; l % 10 == 0; l /= 10, m--) ;
510
- for (l = o[0]; l >= 10; l /= 10, m++) ;
506
+ return L(r, 1, q), s == null ? s = b : L(s, 0, 8), Y(new g(f), r, s);
507
+ if (!(o = f.c)) return null;
508
+ if (u = o.length - 1, A = u * k + 1, u = o[u]) {
509
+ for (; u % 10 == 0; u /= 10, A--) ;
510
+ for (u = o[0]; u >= 10; u /= 10, A++) ;
511
511
  }
512
- return r && p.e + 1 > m && (m = p.e + 1), m;
513
- }, s.shiftedBy = function(r) {
514
- return L(r, -We, We), this.times("1e" + r);
515
- }, s.squareRoot = s.sqrt = function() {
516
- var r, i, o, m, l, p = this, b = p.c, d = p.s, u = p.e, A = y + 4, f = new T("0.5");
517
- if (d !== 1 || !b || !b[0])
518
- return new T(!d || d < 0 && (!b || b[0]) ? NaN : b ? p : 1 / 0);
519
- if (d = Math.sqrt(+ie(p)), d == 0 || d == 1 / 0 ? (i = ne(b), (i.length + u) % 2 == 0 && (i += "0"), d = Math.sqrt(+i), u = ae((u + 1) / 2) - (u < 0 || u % 2), d == 1 / 0 ? i = "5e" + u : (i = d.toExponential(), i = i.slice(0, i.indexOf("e") + 1) + u), o = new T(i)) : o = new T(d + ""), o.c[0]) {
520
- for (u = o.e, d = u + A, d < 3 && (d = 0); ; )
521
- if (l = o, o = f.times(l.plus(t(p, l, A, 1))), ne(l.c).slice(0, d) === (i = ne(o.c)).slice(0, d))
522
- if (o.e < u && --d, i = i.slice(d - 3, d + 1), i == "9999" || !m && i == "4999") {
523
- if (!m && (Y(l, l.e + y + 2, 0), l.times(l).eq(p))) {
524
- o = l;
512
+ return r && f.e + 1 > A && (A = f.e + 1), A;
513
+ }, a.shiftedBy = function(r) {
514
+ return L(r, -Le, Le), this.times("1e" + r);
515
+ }, a.squareRoot = a.sqrt = function() {
516
+ var r, s, o, A, u, f = this, E = f.c, c = f.s, l = f.e, y = m + 4, p = new g("0.5");
517
+ if (c !== 1 || !E || !E[0])
518
+ return new g(!c || c < 0 && (!E || E[0]) ? NaN : E ? f : 1 / 0);
519
+ if (c = Math.sqrt(+ue(f)), c == 0 || c == 1 / 0 ? (s = te(E), (s.length + l) % 2 == 0 && (s += "0"), c = Math.sqrt(+s), l = re((l + 1) / 2) - (l < 0 || l % 2), c == 1 / 0 ? s = "5e" + l : (s = c.toExponential(), s = s.slice(0, s.indexOf("e") + 1) + l), o = new g(s)) : o = new g(c + ""), o.c[0]) {
520
+ for (l = o.e, c = l + y, c < 3 && (c = 0); ; )
521
+ if (u = o, o = p.times(u.plus(t(f, u, y, 1))), te(u.c).slice(0, c) === (s = te(o.c)).slice(0, c))
522
+ if (o.e < l && --c, s = s.slice(c - 3, c + 1), s == "9999" || !A && s == "4999") {
523
+ if (!A && (Y(u, u.e + m + 2, 0), u.times(u).eq(f))) {
524
+ o = u;
525
525
  break;
526
526
  }
527
- A += 4, d += 4, m = 1;
527
+ y += 4, c += 4, A = 1;
528
528
  } else {
529
- (!+i || !+i.slice(1) && i.charAt(0) == "5") && (Y(o, o.e + y + 2, 1), r = !o.times(o).eq(p));
529
+ (!+s || !+s.slice(1) && s.charAt(0) == "5") && (Y(o, o.e + m + 2, 1), r = !o.times(o).eq(f));
530
530
  break;
531
531
  }
532
532
  }
533
- return Y(o, o.e + y + 1, E, r);
534
- }, s.toExponential = function(r, i) {
535
- return r != null && (L(r, 0, H), r++), Te(this, r, i, 1);
536
- }, s.toFixed = function(r, i) {
537
- return r != null && (L(r, 0, H), r = r + this.e + 1), Te(this, r, i);
538
- }, s.toFormat = function(r, i, o) {
539
- var m, l = this;
533
+ return Y(o, o.e + m + 1, b, r);
534
+ }, a.toExponential = function(r, s) {
535
+ return r != null && (L(r, 0, q), r++), Te(this, r, s, 1);
536
+ }, a.toFixed = function(r, s) {
537
+ return r != null && (L(r, 0, q), r = r + this.e + 1), Te(this, r, s);
538
+ }, a.toFormat = function(r, s, o) {
539
+ var A, u = this;
540
540
  if (o == null)
541
- r != null && i && typeof i == "object" ? (o = i, i = null) : r && typeof r == "object" ? (o = r, r = i = null) : o = $;
541
+ r != null && s && typeof s == "object" ? (o = s, s = null) : r && typeof r == "object" ? (o = r, r = s = null) : o = V;
542
542
  else if (typeof o != "object")
543
- throw Error(Q + "Argument not an object: " + o);
544
- if (m = l.toFixed(r, i), l.c) {
545
- var p, b = m.split("."), d = +o.groupSize, u = +o.secondaryGroupSize, A = o.groupSeparator || "", f = b[0], x = b[1], B = l.s < 0, k = B ? f.slice(1) : f, I = k.length;
546
- if (u && (p = d, d = u, u = p, I -= p), d > 0 && I > 0) {
547
- for (p = I % d || d, f = k.substr(0, p); p < I; p += d) f += A + k.substr(p, d);
548
- u > 0 && (f += A + k.slice(p)), B && (f = "-" + f);
543
+ throw Error(Z + "Argument not an object: " + o);
544
+ if (A = u.toFixed(r, s), u.c) {
545
+ var f, E = A.split("."), c = +o.groupSize, l = +o.secondaryGroupSize, y = o.groupSeparator || "", p = E[0], T = E[1], S = u.s < 0, P = S ? p.slice(1) : p, R = P.length;
546
+ if (l && (f = c, c = l, l = f, R -= f), c > 0 && R > 0) {
547
+ for (f = R % c || c, p = P.substr(0, f); f < R; f += c) p += y + P.substr(f, c);
548
+ l > 0 && (p += y + P.slice(f)), S && (p = "-" + p);
549
549
  }
550
- m = x ? f + (o.decimalSeparator || "") + ((u = +o.fractionGroupSize) ? x.replace(
551
- new RegExp("\\d{" + u + "}\\B", "g"),
550
+ A = T ? p + (o.decimalSeparator || "") + ((l = +o.fractionGroupSize) ? T.replace(
551
+ new RegExp("\\d{" + l + "}\\B", "g"),
552
552
  "$&" + (o.fractionGroupSeparator || "")
553
- ) : x) : f;
553
+ ) : T) : p;
554
554
  }
555
- return (o.prefix || "") + m + (o.suffix || "");
556
- }, s.toFraction = function(r) {
557
- var i, o, m, l, p, b, d, u, A, f, x, B, k = this, I = k.c;
558
- if (r != null && (d = new T(r), !d.isInteger() && (d.c || d.s !== 1) || d.lt(c)))
559
- throw Error(Q + "Argument " + (d.isInteger() ? "out of range: " : "not an integer: ") + ie(d));
560
- if (!I) return new T(k);
561
- for (i = new T(c), A = o = new T(c), m = u = new T(c), B = ne(I), p = i.e = B.length - k.e - 1, i.c[0] = ze[(b = p % O) < 0 ? O + b : b], r = !r || d.comparedTo(i) > 0 ? p > 0 ? i : A : d, b = F, F = 1 / 0, d = new T(B), u.c[0] = 0; f = t(d, i, 0, 1), l = o.plus(f.times(m)), l.comparedTo(r) != 1; )
562
- o = m, m = l, A = u.plus(f.times(l = A)), u = l, i = d.minus(f.times(l = i)), d = l;
563
- return l = t(r.minus(o), m, 0, 1), u = u.plus(l.times(A)), o = o.plus(l.times(m)), u.s = A.s = k.s, p = p * 2, x = t(A, m, p, E).minus(k).abs().comparedTo(
564
- t(u, o, p, E).minus(k).abs()
565
- ) < 1 ? [A, m] : [u, o], F = b, x;
566
- }, s.toNumber = function() {
567
- return +ie(this);
568
- }, s.toPrecision = function(r, i) {
569
- return r != null && L(r, 1, H), Te(this, r, i, 2);
570
- }, s.toString = function(r) {
571
- var i, o = this, m = o.s, l = o.e;
572
- return l === null ? m ? (i = "Infinity", m < 0 && (i = "-" + i)) : i = "NaN" : (r == null ? i = l <= D || l >= C ? Se(ne(o.c), l) : pe(ne(o.c), l, "0") : r === 10 && q ? (o = Y(new T(o), y + l + 1, E), i = pe(ne(o.c), o.e, "0")) : (L(r, 2, K.length, "Base"), i = n(pe(ne(o.c), l, "0"), 10, r, m, !0)), m < 0 && o.c[0] && (i = "-" + i)), i;
573
- }, s.valueOf = s.toJSON = function() {
574
- return ie(this);
575
- }, s._isBigNumber = !0, s[Symbol.toStringTag] = "BigNumber", s[Symbol.for("nodejs.util.inspect.custom")] = s.valueOf, e != null && T.set(e), T;
555
+ return (o.prefix || "") + A + (o.suffix || "");
556
+ }, a.toFraction = function(r) {
557
+ var s, o, A, u, f, E, c, l, y, p, T, S, P = this, R = P.c;
558
+ if (r != null && (c = new g(r), !c.isInteger() && (c.c || c.s !== 1) || c.lt(d)))
559
+ throw Error(Z + "Argument " + (c.isInteger() ? "out of range: " : "not an integer: ") + ue(c));
560
+ if (!R) return new g(P);
561
+ for (s = new g(d), y = o = new g(d), A = l = new g(d), S = te(R), f = s.e = S.length - P.e - 1, s.c[0] = Ue[(E = f % k) < 0 ? k + E : E], r = !r || c.comparedTo(s) > 0 ? f > 0 ? s : y : c, E = F, F = 1 / 0, c = new g(S), l.c[0] = 0; p = t(c, s, 0, 1), u = o.plus(p.times(A)), u.comparedTo(r) != 1; )
562
+ o = A, A = u, y = l.plus(p.times(u = y)), l = u, s = c.minus(p.times(u = s)), c = u;
563
+ return u = t(r.minus(o), A, 0, 1), l = l.plus(u.times(y)), o = o.plus(u.times(A)), l.s = y.s = P.s, f = f * 2, T = t(y, A, f, b).minus(P).abs().comparedTo(
564
+ t(l, o, f, b).minus(P).abs()
565
+ ) < 1 ? [y, A] : [l, o], F = E, T;
566
+ }, a.toNumber = function() {
567
+ return +ue(this);
568
+ }, a.toPrecision = function(r, s) {
569
+ return r != null && L(r, 1, q), Te(this, r, s, 2);
570
+ }, a.toString = function(r) {
571
+ var s, o = this, A = o.s, u = o.e;
572
+ return u === null ? A ? (s = "Infinity", A < 0 && (s = "-" + s)) : s = "NaN" : (r == null ? s = u <= D || u >= C ? Be(te(o.c), u) : le(te(o.c), u, "0") : r === 10 && z ? (o = Y(new g(o), m + u + 1, b), s = le(te(o.c), o.e, "0")) : (L(r, 2, K.length, "Base"), s = n(le(te(o.c), u, "0"), 10, r, A, !0)), A < 0 && o.c[0] && (s = "-" + s)), s;
573
+ }, a.valueOf = a.toJSON = function() {
574
+ return ue(this);
575
+ }, a._isBigNumber = !0, a[Symbol.toStringTag] = "BigNumber", a[Symbol.for("nodejs.util.inspect.custom")] = a.valueOf, e != null && g.set(e), g;
576
576
  }
577
- function ae(e) {
577
+ function re(e) {
578
578
  var t = e | 0;
579
579
  return e > 0 || e === t ? t : t - 1;
580
580
  }
581
- function ne(e) {
582
- for (var t, n, a = 1, s = e.length, c = e[0] + ""; a < s; ) {
583
- for (t = e[a++] + "", n = O - t.length; n--; t = "0" + t) ;
584
- c += t;
581
+ function te(e) {
582
+ for (var t, n, i = 1, a = e.length, d = e[0] + ""; i < a; ) {
583
+ for (t = e[i++] + "", n = k - t.length; n--; t = "0" + t) ;
584
+ d += t;
585
585
  }
586
- for (s = c.length; c.charCodeAt(--s) === 48; ) ;
587
- return c.slice(0, s + 1 || 1);
586
+ for (a = d.length; d.charCodeAt(--a) === 48; ) ;
587
+ return d.slice(0, a + 1 || 1);
588
588
  }
589
- function be(e, t) {
590
- var n, a, s = e.c, c = t.c, y = e.s, E = t.s, D = e.e, C = t.e;
591
- if (!y || !E) return null;
592
- if (n = s && !s[0], a = c && !c[0], n || a) return n ? a ? 0 : -E : y;
593
- if (y != E) return y;
594
- if (n = y < 0, a = D == C, !s || !c) return a ? 0 : !s ^ n ? 1 : -1;
595
- if (!a) return D > C ^ n ? 1 : -1;
596
- for (E = (D = s.length) < (C = c.length) ? D : C, y = 0; y < E; y++) if (s[y] != c[y]) return s[y] > c[y] ^ n ? 1 : -1;
589
+ function ye(e, t) {
590
+ var n, i, a = e.c, d = t.c, m = e.s, b = t.s, D = e.e, C = t.e;
591
+ if (!m || !b) return null;
592
+ if (n = a && !a[0], i = d && !d[0], n || i) return n ? i ? 0 : -b : m;
593
+ if (m != b) return m;
594
+ if (n = m < 0, i = D == C, !a || !d) return i ? 0 : !a ^ n ? 1 : -1;
595
+ if (!i) return D > C ^ n ? 1 : -1;
596
+ for (b = (D = a.length) < (C = d.length) ? D : C, m = 0; m < b; m++) if (a[m] != d[m]) return a[m] > d[m] ^ n ? 1 : -1;
597
597
  return D == C ? 0 : D > C ^ n ? 1 : -1;
598
598
  }
599
- function L(e, t, n, a) {
600
- if (e < t || e > n || e !== re(e))
601
- throw Error(Q + (a || "Argument") + (typeof e == "number" ? e < t || e > n ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(e));
599
+ function L(e, t, n, i) {
600
+ if (e < t || e > n || e !== ne(e))
601
+ throw Error(Z + (i || "Argument") + (typeof e == "number" ? e < t || e > n ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(e));
602
602
  }
603
- function ke(e) {
603
+ function Ce(e) {
604
604
  var t = e.c.length - 1;
605
- return ae(e.e / O) == t && e.c[t] % 2 != 0;
605
+ return re(e.e / k) == t && e.c[t] % 2 != 0;
606
606
  }
607
- function Se(e, t) {
607
+ function Be(e, t) {
608
608
  return (e.length > 1 ? e.charAt(0) + "." + e.slice(1) : e) + (t < 0 ? "e" : "e+") + t;
609
609
  }
610
- function pe(e, t, n) {
611
- var a, s;
610
+ function le(e, t, n) {
611
+ var i, a;
612
612
  if (t < 0) {
613
- for (s = n + "."; ++t; s += n) ;
614
- e = s + e;
615
- } else if (a = e.length, ++t > a) {
616
- for (s = n, t -= a; --t; s += n) ;
617
- e += s;
618
- } else t < a && (e = e.slice(0, t) + "." + e.slice(t));
613
+ for (a = n + "."; ++t; a += n) ;
614
+ e = a + e;
615
+ } else if (i = e.length, ++t > i) {
616
+ for (a = n, t -= i; --t; a += n) ;
617
+ e += a;
618
+ } else t < i && (e = e.slice(0, t) + "." + e.slice(t));
619
619
  return e;
620
620
  }
621
- var h = ut();
622
- function Ct(e) {
621
+ var x = ut();
622
+ const H = (e) => {
623
+ if (!e) return "";
624
+ const t = x(e);
625
+ return t.isFinite() && !t.isNaN() ? e : "";
626
+ }, We = (e, t) => {
627
+ if (t == null || !e) return "";
628
+ const n = x(e);
629
+ return !n.isFinite() || n.isNaN() ? "" : n.multipliedBy(x(10).pow(t)).toFixed(0);
630
+ }, ze = (e, t) => {
631
+ if (t == null || !e) return "";
632
+ const n = x(e);
633
+ return !n.isFinite() || n.isNaN() ? "" : n.dividedBy(x(10).pow(t)).toFixed();
634
+ }, je = (e, t) => {
635
+ if (!e || !t) return "";
636
+ const n = x(e), i = x(t);
637
+ return !n.isFinite() || n.isNaN() || n.isZero() || !i.isFinite() || i.isNaN() || i.isZero() ? "" : n.multipliedBy(i).toFixed();
638
+ }, Ae = (e, t, n) => {
639
+ const i = H(e), a = ze(i, t);
640
+ return {
641
+ raw: i,
642
+ ui: a,
643
+ usd: je(a, n)
644
+ };
645
+ }, Dt = ({
646
+ quotedOutputAmountRaw: e,
647
+ inputAmountUi: t,
648
+ outputTokenDecimals: n,
649
+ outputUsdPrice: i
650
+ }) => {
651
+ const a = H(e), d = H(t), m = a && d && x(d).gt(0) ? x(a).dividedBy(d).toFixed() : "", b = ze(m, n);
652
+ return {
653
+ raw: m,
654
+ ui: b,
655
+ usd: je(b, i)
656
+ };
657
+ }, Ke = 300 * 1e3, Oe = 1440 * 60 * 60 * 1e3, Je = 300 * 1e3, Ve = {
658
+ unit: se.Minutes,
659
+ value: Ke / 6e4
660
+ }, Ft = "-5", Ct = "10", Bt = "-10", wt = "5", lt = (e) => {
661
+ const t = H(e.initialPrice);
662
+ let n = "";
663
+ if (e.typedValue !== void 0) {
664
+ const d = x(e.typedValue), m = e.isInverted ? d.isZero() ? x(0) : x(1).dividedBy(d) : d;
665
+ n = We(m.toFixed(), e.tokenDecimals);
666
+ } else if (e.percentage !== void 0 && t && x(t).gt(0)) {
667
+ const d = x(e.percentage || 0).dividedBy(100);
668
+ n = x(t).plus(x(t).multipliedBy(d)).decimalPlaces(0).toFixed();
669
+ } else t && x(t).gt(0) && (n = x(t).decimalPlaces(0).toFixed());
670
+ const i = H(n);
671
+ let a = "";
672
+ if (t && !x(t).isZero()) {
673
+ if (e.percentage !== void 0 && e.percentage !== null)
674
+ a = e.percentage;
675
+ else if (i) {
676
+ const d = x(i).minus(t).dividedBy(t).multipliedBy(100).decimalPlaces(2).toString();
677
+ a = x(d).isZero() ? "" : d;
678
+ }
679
+ }
680
+ return {
681
+ raw: i,
682
+ typedValue: e.typedValue,
683
+ percentage: a,
684
+ isTypedValue: e.typedValue !== void 0
685
+ };
686
+ }, ft = (e) => {
687
+ const t = (d) => {
688
+ if (!d) return "";
689
+ const m = x(d);
690
+ return m.isFinite() && !m.isNaN() ? d : "";
691
+ };
692
+ let n = "";
693
+ if (e.typedValue !== void 0)
694
+ n = t(e.typedValue);
695
+ else {
696
+ const d = ze(e.raw, e.amountDecimals ?? 18);
697
+ d && !x(d).isZero() && (n = e.isInverted ? x(1).dividedBy(d).toFixed() : d);
698
+ }
699
+ const i = n ? e.isInverted ? t(We(n, e.invertedAmountDecimals ?? 18)) : t(e.raw) : "", a = e.isInverted ? e.invertedAmountUsdPrice : e.amountUsdPrice;
700
+ return {
701
+ raw: i,
702
+ ui: n,
703
+ usd: je(n, a)
704
+ };
705
+ }, $r = (e) => {
706
+ if (e === void 0 || e === "") return e;
707
+ const t = x(e);
708
+ return !t.isFinite() || t.isNaN() || t.isZero() ? "0" : x(1).dividedBy(t).toFixed();
709
+ }, St = (e) => {
710
+ if (e === v.STOP_LOSS) return Ft;
711
+ if (e === v.TAKE_PROFIT) return Ct;
712
+ }, Pt = (e, t) => {
713
+ if (!t) {
714
+ if (e === v.STOP_LOSS)
715
+ return Bt;
716
+ if (e === v.TAKE_PROFIT)
717
+ return wt;
718
+ }
719
+ }, Ot = (e, t, n, i) => {
720
+ if (!(x(t || "0").isZero() || !n || e !== v.STOP_LOSS && e !== v.TAKE_PROFIT)) {
721
+ if (e === v.STOP_LOSS && x(i || 0).gte(n))
722
+ return {
723
+ type: J.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,
724
+ value: n
725
+ };
726
+ if (e === v.TAKE_PROFIT && x(i || 0).lte(n))
727
+ return {
728
+ type: J.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,
729
+ value: n
730
+ };
731
+ if (!i || x(i).isZero())
732
+ return {
733
+ type: J.EMPTY_TRIGGER_PRICE,
734
+ value: i
735
+ };
736
+ }
737
+ }, kt = (e) => {
738
+ const t = e.module === v.STOP_LOSS || e.module === v.TAKE_PROFIT, n = e.triggerPricePercent === void 0 ? St(e.module) : e.triggerPricePercent, i = lt({
739
+ tokenDecimals: e.outputTokenDecimals,
740
+ initialPrice: t ? e.marketPrice : void 0,
741
+ typedValue: e.triggerPrice,
742
+ percentage: n,
743
+ isInverted: e.isInverted
744
+ }), a = ft({
745
+ raw: i.raw,
746
+ typedValue: i.typedValue,
747
+ amountDecimals: e.outputTokenDecimals,
748
+ invertedAmountDecimals: e.inputTokenDecimals,
749
+ amountUsdPrice: e.outputUsdPrice,
750
+ invertedAmountUsdPrice: e.inputUsdPrice,
751
+ isInverted: e.isInverted
752
+ });
753
+ return {
754
+ ...i,
755
+ enabled: t,
756
+ display: a,
757
+ error: Ot(
758
+ e.module,
759
+ e.inputAmountRaw,
760
+ H(e.marketPrice),
761
+ i.raw
762
+ )
763
+ };
764
+ }, _t = (e, t, n) => {
765
+ if (!(x(e.inputAmountRaw || "0").isZero() || !t || e.isMarketOrder)) {
766
+ if ((e.module === v.STOP_LOSS || e.module === v.TAKE_PROFIT) && e.triggerPrice && x(n || 0).gte(e.triggerPrice))
767
+ return {
768
+ type: J.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,
769
+ value: e.triggerPrice
770
+ };
771
+ if (!n || x(n).isZero())
772
+ return {
773
+ type: J.MISSING_LIMIT_PRICE,
774
+ value: n
775
+ };
776
+ }
777
+ }, vt = (e) => {
778
+ const t = e.limitPricePercent === void 0 ? Pt(e.module, e.isMarketOrder) : e.limitPricePercent, n = lt({
779
+ tokenDecimals: e.outputTokenDecimals,
780
+ initialPrice: e.marketPrice,
781
+ typedValue: e.limitPrice,
782
+ percentage: t,
783
+ isInverted: e.isInverted
784
+ }), i = ft({
785
+ raw: n.raw,
786
+ typedValue: n.typedValue,
787
+ amountDecimals: e.outputTokenDecimals,
788
+ invertedAmountDecimals: e.inputTokenDecimals,
789
+ amountUsdPrice: e.outputUsdPrice,
790
+ invertedAmountUsdPrice: e.inputUsdPrice,
791
+ isInverted: e.isInverted
792
+ }), a = H(e.marketPrice);
793
+ return {
794
+ ...n,
795
+ display: i,
796
+ error: _t(e, a, n.raw)
797
+ };
798
+ }, It = (e, t, n) => {
799
+ const i = kt({
800
+ module: e.module,
801
+ marketPrice: n,
802
+ inputAmountRaw: t,
803
+ triggerPrice: e.userInput.triggerPriceUi,
804
+ triggerPricePercent: e.userInput.triggerPricePercent,
805
+ isInverted: e.userInput.isPriceInverted,
806
+ inputTokenDecimals: e.inputTokenDecimals,
807
+ outputTokenDecimals: e.outputTokenDecimals,
808
+ inputUsdPrice: e.inputTokenUsdPrice,
809
+ outputUsdPrice: e.outputTokenUsdPrice
810
+ }), a = e.module === v.LIMIT ? !1 : e.userInput.isMarketOrder, d = vt({
811
+ module: e.module,
812
+ isMarketOrder: a,
813
+ marketPrice: n,
814
+ inputAmountRaw: t,
815
+ limitPrice: e.userInput.limitPriceUi,
816
+ limitPricePercent: e.userInput.limitPricePercent,
817
+ triggerPrice: i.raw,
818
+ isInverted: e.userInput.isPriceInverted,
819
+ inputTokenDecimals: e.inputTokenDecimals,
820
+ outputTokenDecimals: e.outputTokenDecimals,
821
+ inputUsdPrice: e.inputTokenUsdPrice,
822
+ outputUsdPrice: e.outputTokenUsdPrice
823
+ });
824
+ return { isMarketOrder: a, triggerPrice: i, limitPrice: d };
825
+ }, Rt = [
826
+ "0x0000000000000000000000000000000000000000",
827
+ "0x0000000000000000000000000000000000001010",
828
+ "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
829
+ "0x000000000000000000000000000000000000dEaD",
830
+ "0x000000000000000000000000000000000000800A",
831
+ "0x000000000000000000000000000000000000800a"
832
+ ], pt = "115792089237316195423570985008687907853269984665640564039457584007913129639935";
833
+ function Mt(e) {
623
834
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
624
835
  }
625
- const Bt = {
836
+ const Nt = {
626
837
  1: { adapter: { Nordstern: "0x6603629C8d4b683fdc51c7F810D1799cfEAcEAe3", Sushi: "0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c", Ring: "0x47e27973dA3e16dB13F8b713877b3A31623E0E5B", Kyber: "0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA", Magpie: "0x370AC766279eCD03dc1D8eb0E5A632a24A255EAb", OpenOcean: "0x2Be5260d030ff9A6040bA4292326B796ff1a055d", Paraswap: "0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f" }, dex: { sushiswap: { type: "default", solver: "Sushi", router: "0xAC4c6e212A361c968F1725b4d055b47E63F80b75", adapter: "0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df", fee: "0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc" }, ring: { type: "dynamicp2", solver: "Ring", permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", adapter: "0x028fa69049aB68EC42064Eb18896D587dD41Af2a", fee: "0xA04329696aAd1417c75Cf6d91342815001999B21" } } },
627
838
  10: { adapter: { Nordstern: "0x1D06d98D523F8B51AD693D4A22fb97fCf0838d83", Sushi: "0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c", Kyber: "0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA", Magpie: "0x370AC766279eCD03dc1D8eb0E5A632a24A255EAb", OpenOcean: "0x2Be5260d030ff9A6040bA4292326B796ff1a055d", Paraswap: "0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f" }, dex: {} },
628
839
  14: { adapter: { Nordstern: "0xd16A1849E86431872a87f476fa0DfB30eEb96cb3", SparkDex: "0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7", OpenOcean: "0x2Be5260d030ff9A6040bA4292326B796ff1a055d" }, dex: { spark: { type: "default", solver: "SparkDex", router: "0x0f3D8a38D4c74afBebc2c42695642f0e3acb15D3", adapter: "0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7", fee: "0xaeA8C3e1a129A77686E115b1a46D9aD8405F7D2b" } } },
@@ -643,11 +854,11 @@ const Bt = {
643
854
  747474: { adapter: { Nordstern: "0xd16A1849E86431872a87f476fa0DfB30eEb96cb3", Sushi: "0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c" }, dex: { katana: { type: "universal", adapter: "0xe7505d43AdF7d44AB11d7eEAF353a85F8169bE6a", fee: "0x7a76704765D366ac2A559e1A1fc1273b834B2cA8" }, sushiswap: { type: "default", solver: "Sushi", router: "0xAC4c6e212A361c968F1725b4d055b47E63F80b75", adapter: "0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df", fee: "0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc" } } },
644
855
  "*": { wm: "0x0005d5cE0dB57e5BE3b2b8b6FeB75f0ccd015000", repermit: "0x00002a9C4D9497df5Bd31768eC5d30eEf5405000", cosigner: "0x000ECFa392ecDEfEE6e2a5C095d39B7A32f1E000", reactor: "0x000000b33fE4fB9d999Dd684F79b110731c3d000", executor: "0x000642A0966d9bd49870D9519f76b5cf823f3000", refinery: "0x000E474c0D7084EAA35A501035E73269f4b009A5", salt: { wm: "0xc9b46eae42dfeba3222a0315bf682f33cd5cc9d60c9625642e88406f8415f152", repermit: "0x4871dc9008e605821ea9677b65ea2a60ffb774afb31e0dcaea2e192880096be7", cosigner: "0x1117fe6f4e25c9380d10b2b3314a1e9b33e5f65ba0e55e0c63d0640db0dd60a2", reactor: "0xec73677f3a465a9755d4c9eab9509b59a24613fdb8b78719682930373e9876f5", executor: "0x9abc67d936f79e493f1f14050c2f6adb87ec208ff7aaae2e7ae788a7cb4796d7", refinery: "0x9746de29f1dd31b2c8460d71e92a7aefa34911130e61f274f37776e598c48bec", agentAdapter: "0xf6d54cf6a0619f1fb8e1ded91d4c23e7bb9f498c56735fb0c7669423c766219f", agentFee: "0x151234279af18acc113f70463977058efa2e598b5bfc0c106c75fd638d344c0a", unknownAdapter: "0x1aa43154c4be61f2790f139ef440a68806cfbbb86d0dc5e2704937cd93cbafc4", unknownFee: "0x429599ae7495b3e6a93b88d653ac97772fb130b0b74e755d9d215912a252cb7e", utilaAdapter: "0x7671291910b559d7a05ab73ee31dd714d9c6e7b065c9496338bf427182ae5145", utilaFee: "0x46f797cddb221ecf6279b56f52e2f6360cd721ef95bd5a17dd0ffceffaaf7fd6", efAdapter: "0xa5425e0f84a7cf12c4213f57396810d808d88e43a65210786bd0d9a98a314728", efFee: "0x14387b821c54f18e2a9351887a92cc79164a5ea0b88cfc3f36741eae6d4fd815", htAdapter: "0x2ec50a8a136049da76c16f3dd12a8ed1b23f2bc91aca73c6a20cc8344e34f998", htFee: "0x2f902a86a7f6abeedc073e76cd33d4737f25189e18c8f450f16d2ffe14405242" }, dex: { agent: { type: "universal", adapter: "0x0002BeFB46587d460AcEA9B2792c4A4c67B9cADa", fee: "0x0006d9557Ac9Af4f31962896299ba4FaBDaB9fEE" }, unknown: { type: "universal", adapter: "0xada00982E8a888a6aa9BFb270591cb54cE7190d0", fee: "0xfEe00C84894160d582860D76cd7e896d96DBD3d5" }, utila: { type: "universal", adapter: "0x000ADa14B2ECF45Da6Cf1B33dE34e05231E9C76f", fee: "0x000FEee351263c82501a4dF5f699a8b630ac7f36" }, ef: { type: "universal", adapter: "0xeF1B796D708BD776F6b377E93eAd8Ca5fA0C3117", fee: "0xeF1D677d7aE1a066beb26cC1C74E31C082B75FEf" }, ht: { type: "universal", adapter: "0xA560a960C3b7784f5c335C33028D31596b91650b", fee: "0xE7a926C0cb01aCCE74e5d4FCeB7CA1699e200608" }, ginco: { type: "universal", adapter: "0x96604C3E846BBa75c43B5518bd076851e5484197", fee: "0xCf2eB80A89A69aB17e295aeF033Ffe9564736155" } } }
645
856
  };
646
- var He, tt;
647
- function kt() {
648
- if (tt) return He;
649
- tt = 1;
650
- const e = Bt, t = (c) => Ct(`./out/${c}.sol/${c}.abi.json`), n = () => ({
857
+ var $e, et;
858
+ function Lt() {
859
+ if (et) return $e;
860
+ et = 1;
861
+ const e = Nt, t = (d) => Mt(`./out/${d}.sol/${d}.abi.json`), n = () => ({
651
862
  wm: t("WM"),
652
863
  repermit: t("RePermit"),
653
864
  reactor: t("OrderReactor"),
@@ -656,1107 +867,252 @@ function kt() {
656
867
  settler: t("Settler"),
657
868
  adapter: t("DefaultDexAdapter")
658
869
  });
659
- function a(c) {
660
- var E;
661
- if (!c) return;
662
- const y = e[c];
663
- if (y)
664
- return { ...((E = e["*"]) == null ? void 0 : E.adapter) ?? {}, ...y.adapter ?? {} };
870
+ function i(d) {
871
+ var b;
872
+ if (!d) return;
873
+ const m = e[d];
874
+ if (m)
875
+ return { ...((b = e["*"]) == null ? void 0 : b.adapter) ?? {}, ...m.adapter ?? {} };
665
876
  }
666
- function s(c, y) {
667
- if (!c) return;
668
- const { dex: E, salt: D, ...C } = e["*"] ?? {}, P = e[c];
669
- if (!P) return;
670
- const { dex: F, salt: g, ...S } = P, w = { ...C, ...S }, $ = y == null ? void 0 : y.trim();
671
- if (!$) return w;
672
- const K = E == null ? void 0 : E[$], q = F == null ? void 0 : F[$];
673
- if (!(!K && !q))
674
- return { ...w, ...K, ...q };
877
+ function a(d, m) {
878
+ if (!d) return;
879
+ const { dex: b, salt: D, ...C } = e["*"] ?? {}, O = e[d];
880
+ if (!O) return;
881
+ const { dex: F, salt: h, ...w } = O, B = { ...C, ...w }, V = m == null ? void 0 : m.trim();
882
+ if (!V) return B;
883
+ const K = b == null ? void 0 : b[V], z = F == null ? void 0 : F[V];
884
+ if (!(!K && !z))
885
+ return { ...B, ...K, ...z };
675
886
  }
676
- return He = { config: s, adapters: a, abis: n, raw: e }, He;
887
+ return $e = { config: a, adapters: i, abis: n, raw: e }, $e;
677
888
  }
678
- var pt = kt();
679
- const St = { chainName: "ftm", chainId: 250, twapVersion: 4, twapAddress: "0xd3B290FEB04E353d1821bc0a12397FdEa9a846C0", lensAddress: "0x0221EfDF1Fd3212AF87F23cceB7693a65fAF1d7f", takers: ["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913", "0x504f6E10173249dD22491829D98862Cf81DeF79E"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SpookySwap", partner: "Orbs:TWAP:SpookySwap", exchangeAddress: "0xdF7CCd5fc7077E9de5f27a7b7bfDC837c82f8496", exchangeType: "ExchangeV2", pathfinderKey: "" }, Pt = { chainName: "sonic", chainId: 146, twapVersion: 4, twapAddress: "0x8963992816b4EafE5a22b7DB2A99513c18be9afA", lensAddress: "0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D", takers: ["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913", "0x504f6E10173249dD22491829D98862Cf81DeF79E"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SpookySwapSonic", partner: "Orbs:TWAP:SpookySwap", exchangeAddress: "0x6699bE3aF75e5c1B807b1031dBde6dA9A67739F3", exchangeType: "ExchangeV2", pathfinderKey: "" }, Ot = { chainName: "poly", chainId: 137, twapVersion: 4, twapAddress: "0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4", lensAddress: "0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "QuickSwap", partner: "Orbs:TWAP:QuickSwap", exchangeAddress: "0x8FCc245209bE85C49D738D0CE5613F74E5d91E86", exchangeType: "ParaswapExchange", pathfinderKey: "QuickSwap,QuickSwapV3" }, vt = { chainName: "base", chainId: 8453, twapVersion: 4, twapAddress: "0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55", lensAddress: "0x6313188c1909b161074D62E43105faC9B756A23e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "QuickSwap", partner: "Orbs:TWAP:QuickSwap", exchangeAddress: "0xb7a3d74895bfd3aff6780525e36d79fcf26a895f", exchangeType: "ExchangeV2", pathfinderKey: "" }, _t = { chainName: "bsc", chainId: 56, twapVersion: 4, twapAddress: "0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994", lensAddress: "0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "Thena", partner: "Orbs:TWAP:Thena", exchangeAddress: "0x2B2fABDbfa4a15da0d351F947C14F4520db0bDc1", exchangeType: "ExchangeV2", pathfinderKey: "43,47" }, Rt = { chainName: "bsc", chainId: 56, twapVersion: 4, twapAddress: "0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994", lensAddress: "0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0x1A2bb6B75D58b740d88413ef4840D6fa3F637940", exchangeType: "P2Exchange", pathfinderKey: "" }, It = { chainName: "arb", chainId: 42161, twapVersion: 4, twapAddress: "0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3", lensAddress: "0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0xb37cB9A058c03081Ae6EF934313588cD53d408e7", exchangeType: "P2Exchange", pathfinderKey: "" }, Mt = { chainName: "base", chainId: 8453, twapVersion: 4, twapAddress: "0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55", lensAddress: "0x6313188c1909b161074D62E43105faC9B756A23e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0xb37cB9A058c03081Ae6EF934313588cD53d408e7", exchangeType: "P2Exchange", pathfinderKey: "" }, Nt = { chainName: "linea", chainId: 59144, twapVersion: 4, twapAddress: "0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78", lensAddress: "0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 100, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0xb37cB9A058c03081Ae6EF934313588cD53d408e7", exchangeType: "P2Exchange", pathfinderKey: "" }, Ut = { chainName: "linea", chainId: 59144, twapVersion: 4, twapAddress: "0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78", lensAddress: "0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 100, name: "Lynex", partner: "Orbs:TWAP:Lynex", exchangeAddress: "0x04C06C96d7D19977156016DD408B5992af0570a2", exchangeType: "ExchangeV2", pathfinderKey: "19,18" }, Lt = { chainName: "arb", chainId: 42161, twapVersion: 4, twapAddress: "0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3", lensAddress: "0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "SushiArb", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad", exchangeType: "ExchangeV2", pathfinderKey: "" }, $t = { chainName: "base", chainId: 8453, twapVersion: 4, twapAddress: "0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55", lensAddress: "0x6313188c1909b161074D62E43105faC9B756A23e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "SushiBase", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad", exchangeType: "ExchangeV2", pathfinderKey: "" }, Kt = { chainName: "eth", chainId: 1, twapVersion: 4, twapAddress: "0xb1ed8BCAD1EaC8a1DF0764700472391800D12946", lensAddress: "0x0967f448c4d4dbd14c355E635AE9CbF68cc44A60", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 200, name: "SushiEth", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad", exchangeType: "ExchangeV2", pathfinderKey: "" }, Vt = { chainName: "katana", chainId: 747474, twapVersion: 4, twapAddress: "0xf2d96E7BE676153d202e1453804E2749923C7c5b", lensAddress: "0x1579EED0527781B1A748043AA1f59a3858Ace4a7", takers: ["0xF74437A3Fc45a518640828E5D6A3E8c9A9BbDC3a", "0x07A6C715063e94c0D95e809efefFCbF4EBEdfD55"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "SushiKatana", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x92209481507e6B2d14C9b5b70Ed287024177220E", exchangeType: "ExchangeV2", pathfinderKey: "" }, Wt = { chainId: 1329, name: "DragonSwap" }, zt = { chainName: "flare", chainId: 14, twapVersion: 4, twapAddress: "0x9D70B0b90915Bb8b9bdAC7e6a7e6435bBF1feC4D", lensAddress: "0xf2d96E7BE676153d202e1453804E2749923C7c5b", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SparkDEX", partner: "Orbs:TWAP:SparkDEX", exchangeAddress: "0xe59c53C76bB7EEc01401A18fA8215B94bC65Bf56", exchangeType: "P2Exchange" }, Ht = { chainName: "sonic", chainId: 146, twapVersion: 4, twapAddress: "0x8963992816b4EafE5a22b7DB2A99513c18be9afA", lensAddress: "0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D", takers: ["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913", "0x504f6E10173249dD22491829D98862Cf81DeF79E"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SwapX", partner: "Orbs:TWAP:SwapX", exchangeAddress: "0xDA902994b7F7a1ecDd8De02E4a17dbFF2E6F67b7", exchangeType: "ExchangeV2", pathfinderKey: "" }, qt = { chainName: "avax", chainId: 43114, twapVersion: 4, twapAddress: "0xf77Ad005aBF7e31f669ce89a6568B2f39Ca92cDe", lensAddress: "0x48466B82Ce1575c5c9eCa168ac1090048dD47fA3", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "BlackholeAvax", partner: "Orbs:TWAP:BlackholeAvax", exchangeAddress: "0xb7A3d74895bFD3Aff6780525e36D79FCf26a895F", exchangeType: "ExchangeV2" }, v = {
680
- SpookySwap: St,
681
- SpookySwapSonic: Pt,
682
- QuickSwap: Ot,
683
- QuickSwapBase: vt,
684
- Thena: _t,
685
- PancakeSwap: Rt,
686
- PancakeSwapArbitrum: It,
687
- PancakeSwapBase: Mt,
688
- PancakeSwapLinea: Nt,
689
- Lynex: Ut,
690
- SushiArb: Lt,
691
- SushiBase: $t,
692
- SushiEth: Kt,
693
- SushiKatana: Vt,
694
- DragonSwap: Wt,
695
- SparkDEX: zt,
696
- SwapX: Ht,
697
- BlackholeAvax: qt
698
- }, U = "0x0000000000000000000000000000000000000000", Z = {
699
- eth: {
700
- id: 1,
701
- name: "Ethereum",
702
- shortname: "eth",
703
- native: {
704
- address: U,
705
- symbol: "ETH",
706
- decimals: 18,
707
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
708
- },
709
- wToken: {
710
- symbol: "WETH",
711
- address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
712
- decimals: 18,
713
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
714
- },
715
- publicRpcUrl: "https://eth.llamarpc.com",
716
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg",
717
- explorer: "https://etherscan.io",
718
- eip1559: !0
719
- },
720
- bsc: {
721
- id: 56,
722
- name: "BinanceSmartChain",
723
- shortname: "bsc",
724
- native: {
725
- address: U,
726
- symbol: "BNB",
727
- decimals: 18,
728
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/1839.png"
729
- },
730
- wToken: {
731
- symbol: "WBNB",
732
- address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
733
- decimals: 18,
734
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/1839.png"
735
- },
736
- publicRpcUrl: "https://bsc-dataseed.binance.org",
737
- logoUrl: "https://app.1inch.io/assets/images/network-logos/bsc_2.svg",
738
- explorer: "https://bscscan.com",
739
- eip1559: !1
740
- },
741
- unichain: {
742
- id: 130,
743
- name: "Unichain",
744
- shortname: "unichain",
745
- native: {
746
- address: U,
747
- symbol: "ETH",
748
- decimals: 18,
749
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
750
- },
751
- wToken: {
752
- symbol: "WETH",
753
- address: "0x4200000000000000000000000000000000000006",
754
- decimals: 18,
755
- logoUrl: "https://tokens-data.1inch.io/images/130/0x4200000000000000000000000000000000000006_0x042e6d078c6cf9e13a618396b0aa40181bcb43921ebdb5fabc8fb1124d516156.webp"
756
- },
757
- publicRpcUrl: "https://mainnet.unichain.org",
758
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_unichain",
759
- explorer: "https://uniscan.xyz",
760
- eip1559: !0
761
- },
762
- xlayer: {
763
- id: 196,
764
- name: "X Layer",
765
- shortname: "xlayer",
766
- native: {
767
- address: U,
768
- symbol: "OKB",
769
- decimals: 18,
770
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png"
771
- },
772
- wToken: {
773
- symbol: "WOKB",
774
- address: "0xe538905cf8410324e03A5A23C1c177a474D59b2b",
775
- decimals: 18,
776
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png"
777
- },
778
- publicRpcUrl: "https://rpc.xlayer.tech",
779
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png",
780
- explorer: "https://www.oklink.com/xlayer",
781
- eip1559: !0
782
- },
783
- hyperevm: {
784
- id: 999,
785
- name: "HyperEVM",
786
- shortname: "hyperevm",
787
- native: {
788
- address: U,
789
- symbol: "HYPE",
790
- decimals: 18,
791
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/32196.png"
792
- },
793
- wToken: {
794
- symbol: "WHYPE",
795
- address: "0x5555555555555555555555555555555555555555",
796
- decimals: 18,
797
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/32196.png"
798
- },
799
- publicRpcUrl: "https://rpc.hyperliquid.xyz/evm",
800
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_hyperliquid",
801
- explorer: "https://hyperevmscan.io",
802
- eip1559: !0
803
- },
804
- megaeth: {
805
- id: 4326,
806
- name: "MegaETH",
807
- shortname: "megaeth",
808
- native: {
809
- address: U,
810
- symbol: "ETH",
811
- decimals: 18,
812
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
813
- },
814
- wToken: {
815
- symbol: "WETH",
816
- address: "0x4200000000000000000000000000000000000006",
817
- decimals: 18,
818
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
819
- },
820
- publicRpcUrl: "https://mainnet.megaeth.com/rpc",
821
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_megaeth",
822
- explorer: "https://mega.etherscan.io",
823
- eip1559: !0
824
- },
825
- poly: {
826
- id: 137,
827
- name: "Polygon",
828
- shortname: "poly",
829
- native: {
830
- address: U,
831
- symbol: "POL",
832
- decimals: 18,
833
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/28321.png"
834
- },
835
- wToken: {
836
- symbol: "WPOL",
837
- address: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
838
- decimals: 18,
839
- logoUrl: "https://tokens-data.1inch.io/images/0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270.png"
840
- },
841
- publicRpcUrl: "https://polygon-rpc.com",
842
- logoUrl: "https://app.1inch.io/assets/images/network-logos/polygon.svg",
843
- explorer: "https://polygonscan.com",
844
- eip1559: !0
845
- },
846
- arb: {
847
- id: 42161,
848
- name: "Arbitrum",
849
- shortname: "arb",
850
- native: {
851
- address: U,
852
- symbol: "ETH",
853
- decimals: 18,
854
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
855
- },
856
- wToken: {
857
- symbol: "WETH",
858
- address: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
859
- decimals: 18,
860
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
861
- },
862
- publicRpcUrl: "https://arb1.arbitrum.io/rpc",
863
- logoUrl: "https://app.1inch.io/assets/images/network-logos/arbitrum.svg",
864
- explorer: "https://arbiscan.io",
865
- eip1559: !0
866
- },
867
- sei: {
868
- id: 1329,
869
- name: "Sei",
870
- shortname: "sei",
871
- native: {
872
- address: U,
873
- symbol: "SEI",
874
- decimals: 18,
875
- logoUrl: "https://assets.coingecko.com/coins/images/28205/standard/Sei_Logo_-_Transparent.png"
876
- },
877
- wToken: {
878
- symbol: "WSEI",
879
- address: "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7",
880
- decimals: 18,
881
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
882
- },
883
- publicRpcUrl: "https://evm-rpc.sei-apis.com",
884
- logoUrl: "https://assets.coingecko.com/coins/images/28205/standard/Sei_Logo_-_Transparent.png",
885
- explorer: "https://seitrace.com",
886
- eip1559: !1
887
- },
888
- avax: {
889
- id: 43114,
890
- name: "Avalanche",
891
- shortname: "avax",
892
- native: {
893
- address: U,
894
- symbol: "AVAX",
895
- decimals: 18,
896
- logoUrl: "https://app.1inch.io/assets/images/network-logos/avalanche.svg"
897
- },
898
- wToken: {
899
- symbol: "WAVAX",
900
- address: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
901
- decimals: 18,
902
- logoUrl: "https://tokens-data.1inch.io/images/0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7.png"
903
- },
904
- publicRpcUrl: "https://api.avax.network/ext/bc/C/rpc",
905
- logoUrl: "https://app.1inch.io/assets/images/network-logos/avalanche.svg",
906
- explorer: "https://snowtrace.io",
907
- eip1559: !0
908
- },
909
- ftm: {
910
- id: 250,
911
- name: "Fantom",
912
- shortname: "ftm",
913
- native: {
914
- address: U,
915
- symbol: "FTM",
916
- decimals: 18,
917
- logoUrl: "https://app.1inch.io/assets/images/network-logos/fantom.svg"
918
- },
919
- wToken: {
920
- symbol: "WFTM",
921
- address: "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",
922
- decimals: 18,
923
- logoUrl: "https://tokens-data.1inch.io/images/0x4e15361fd6b4bb609fa63c81a2be19d873717870.png"
924
- },
925
- publicRpcUrl: "https://rpc.ftm.tools",
926
- logoUrl: "https://app.1inch.io/assets/images/network-logos/fantom.svg",
927
- explorer: "https://ftmscan.com",
928
- eip1559: !0
929
- },
930
- base: {
931
- id: 8453,
932
- name: "Base",
933
- shortname: "base",
934
- native: {
935
- address: U,
936
- symbol: "ETH",
937
- decimals: 18,
938
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png"
939
- },
940
- wToken: {
941
- symbol: "WETH",
942
- address: "0x4200000000000000000000000000000000000006",
943
- decimals: 18,
944
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
945
- },
946
- publicRpcUrl: "https://mainnet.base.org",
947
- logoUrl: "https://app.1inch.io/assets/images/network-logos/base.svg",
948
- explorer: "https://basescan.org",
949
- eip1559: !1
950
- },
951
- linea: {
952
- id: 59144,
953
- name: "Linea",
954
- shortname: "linea",
955
- native: {
956
- address: U,
957
- symbol: "ETH",
958
- decimals: 18,
959
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
960
- },
961
- wToken: {
962
- symbol: "WETH",
963
- address: "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
964
- decimals: 18,
965
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
966
- },
967
- publicRpcUrl: "https://rpc.linea.build",
968
- logoUrl: "https://lineascan.build/images/logo.svg",
969
- explorer: "https://lineascan.build",
970
- eip1559: !1
971
- },
972
- zksync: {
973
- id: 324,
974
- name: "zksync",
975
- shortname: "zksync",
976
- native: {
977
- address: U,
978
- symbol: "ETH",
979
- decimals: 18,
980
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
981
- },
982
- wToken: {
983
- symbol: "WETH",
984
- address: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",
985
- decimals: 18,
986
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
987
- },
988
- publicRpcUrl: "https://mainnet.era.zksync.io",
989
- logoUrl: "https://raw.githubusercontent.com/matter-labs/zksync/0a4ca2145a0c95b5bafa84c2f095c644907a8825/zkSyncLogo.svg",
990
- explorer: "https://explorer.zksync.io/",
991
- eip1559: !0
992
- },
993
- zkevm: {
994
- id: 1101,
995
- name: "zkevm",
996
- shortname: "zkevm",
997
- native: {
998
- address: U,
999
- symbol: "ETH",
1000
- decimals: 18,
1001
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
1002
- },
1003
- wToken: {
1004
- symbol: "WETH",
1005
- address: "0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9",
1006
- decimals: 18,
1007
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
1008
- },
1009
- publicRpcUrl: "https://zkevm-rpc.com",
1010
- logoUrl: "https://user-images.githubusercontent.com/18598517/235932702-bc47eae5-d672-4dd9-9da2-8ea8f51a93f3.png",
1011
- explorer: "https://zkevm.polygonscan.com/",
1012
- eip1559: !0
1013
- },
1014
- manta: {
1015
- id: 169,
1016
- name: "manta",
1017
- shortname: "manta",
1018
- native: {
1019
- address: U,
1020
- symbol: "ETH",
1021
- decimals: 18,
1022
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_manta.jpg"
1023
- },
1024
- wToken: {
1025
- symbol: "WETH",
1026
- address: "0x0Dc808adcE2099A9F62AA87D9670745AbA741746",
1027
- decimals: 18,
1028
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
1029
- },
1030
- publicRpcUrl: "https://pacific-rpc.manta.network/http",
1031
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_manta.jpg",
1032
- explorer: "https://manta.socialscan.io/",
1033
- eip1559: !0
1034
- },
1035
- blast: {
1036
- id: 81457,
1037
- name: "blast",
1038
- shortname: "blast",
1039
- native: {
1040
- address: U,
1041
- symbol: "ETH",
1042
- decimals: 18,
1043
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_blast"
1044
- },
1045
- wToken: {
1046
- symbol: "WETH",
1047
- address: "0x4300000000000000000000000000000000000004",
1048
- decimals: 18,
1049
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
1050
- },
1051
- publicRpcUrl: "https://rpc.ankr.com/blast",
1052
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_blast",
1053
- explorer: "https://blastscan.io/",
1054
- eip1559: !0
1055
- },
1056
- sonic: {
1057
- id: 146,
1058
- name: "sonic",
1059
- shortname: "sonic",
1060
- native: {
1061
- address: U,
1062
- symbol: "S",
1063
- decimals: 18,
1064
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_sonic"
1065
- },
1066
- wToken: {
1067
- symbol: "WS",
1068
- address: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
1069
- decimals: 18,
1070
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_sonic"
1071
- },
1072
- publicRpcUrl: "https://rpc.soniclabs.com",
1073
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_sonic",
1074
- explorer: "https://www.sonicscan.org/",
1075
- eip1559: !0
1076
- },
1077
- scroll: {
1078
- id: 534352,
1079
- name: "scroll",
1080
- shortname: "scroll",
1081
- native: {
1082
- address: U,
1083
- symbol: "ETH",
1084
- decimals: 18,
1085
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_scroll"
1086
- },
1087
- wToken: {
1088
- symbol: "WETH",
1089
- address: "0x5300000000000000000000000000000000000004",
1090
- decimals: 18,
1091
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
1092
- },
1093
- publicRpcUrl: "https://scroll-rpc.publicnode.com",
1094
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_scroll",
1095
- explorer: "https://scrollscan.com/",
1096
- eip1559: !0
1097
- },
1098
- zircuit: {
1099
- id: 48900,
1100
- name: "Zircuit",
1101
- shortname: "zircuit",
1102
- native: {
1103
- address: U,
1104
- symbol: "ETH",
1105
- decimals: 18,
1106
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg"
1107
- },
1108
- wToken: {
1109
- symbol: "WETH",
1110
- address: "0x4200000000000000000000000000000000000006",
1111
- decimals: 18,
1112
- logoUrl: "https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
1113
- },
1114
- publicRpcUrl: "https://zircuit-mainnet.drpc.org",
1115
- logoUrl: "https://app.1inch.io/assets/images/network-logos/ethereum.svg",
1116
- explorer: "https://explorer.zircuit.com/",
1117
- eip1559: !0
1118
- },
1119
- flare: {
1120
- id: 14,
1121
- name: "flare",
1122
- shortname: "flare",
1123
- native: {
1124
- address: U,
1125
- symbol: "FLR",
1126
- decimals: 18,
1127
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_flare?w=48&h=48"
1128
- },
1129
- wToken: {
1130
- symbol: "WFLR",
1131
- address: "0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d",
1132
- decimals: 18,
1133
- logoUrl: "https://res.cloudinary.com/sparkdex/image/upload/q_100/v1/website-assets/coins/wflr?_a=DATAg1AAZAA0"
1134
- },
1135
- publicRpcUrl: "https://flare.network",
1136
- logoUrl: "https://icons.llamao.fi/icons/chains/rsz_flare?w=48&h=48",
1137
- explorer: "https://flarescan.com",
1138
- eip1559: !0
1139
- },
1140
- cronosZkEvm: {
1141
- id: 388,
1142
- name: "Cronos zkEVM",
1143
- shortname: "cronosZkEvm",
1144
- native: {
1145
- address: "0x000000000000000000000000000000000000800a",
1146
- symbol: "zkCRO",
1147
- decimals: 18,
1148
- logoUrl: "https://cryptologos.cc/logos/cronos-cro-logo.png"
1149
- // Replace with the official logo URL if available
1150
- },
1151
- wToken: {
1152
- symbol: "wzkCRO",
1153
- address: "0xC1bF55EE54E16229d9b369a5502Bfe5fC9F20b6d",
1154
- decimals: 18,
1155
- logoUrl: "https://cryptologos.cc/logos/cronos-cro-logo.png"
1156
- // Replace with the official logo URL if available
1157
- },
1158
- publicRpcUrl: "https://rpc.zkevm.cronos.org",
1159
- logoUrl: "https://cryptologos.cc/logos/cronos-cro-logo.png",
1160
- // Replace with the official logo URL if available
1161
- explorer: "https://explorer.zkevm.cronos.org",
1162
- eip1559: !0
1163
- },
1164
- katana: {
1165
- id: 747474,
1166
- name: "Katana",
1167
- shortname: "katana",
1168
- native: {
1169
- address: U,
1170
- symbol: "ETH",
1171
- decimals: 18,
1172
- logoUrl: "https://katana.network/assets/katana-logo.svg"
1173
- },
1174
- wToken: {
1175
- symbol: "WETH",
1176
- address: "0xee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62",
1177
- // standard L2 WETH address (example, verify if custom)
1178
- decimals: 18,
1179
- logoUrl: "https://katana.network/assets/weth-logo.svg"
1180
- },
1181
- publicRpcUrl: "https://rpc.katanarpc.com",
1182
- logoUrl: "https://katana.network/assets/katana-logo.svg",
1183
- explorer: "https://explorer.katana.garden",
1184
- // placeholder — replace with actual if known
1185
- eip1559: !0
1186
- },
1187
- bera: {
1188
- id: 80094,
1189
- name: "Bera",
1190
- shortname: "bera",
1191
- native: {
1192
- address: U,
1193
- symbol: "BERA",
1194
- decimals: 18,
1195
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/24647.png"
1196
- },
1197
- wToken: {
1198
- symbol: "WBERA",
1199
- address: "0x6969696969696969696969696969696969696969",
1200
- // standard L2 WETH address (example, verify if custom)
1201
- decimals: 18,
1202
- logoUrl: "https://berascan.com/token/images/wrappedbera_ofc_64.png"
1203
- },
1204
- publicRpcUrl: "https://rpc.berachain.com",
1205
- logoUrl: "https://berascan.com/token/images/wrappedbera_ofc_64.png",
1206
- explorer: "https://berascan.com",
1207
- // placeholder — replace with actual if known
1208
- eip1559: !0
1209
- },
1210
- monad: {
1211
- id: 143,
1212
- name: "Monad",
1213
- shortname: "monad",
1214
- native: {
1215
- address: U,
1216
- symbol: "MONAD",
1217
- decimals: 18,
1218
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/30495.png"
1219
- },
1220
- wToken: {
1221
- symbol: "WMON",
1222
- address: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a",
1223
- decimals: 18,
1224
- logoUrl: "https://assets.coingecko.com/coins/images/70784/standard/wmon.png?1766028904"
1225
- },
1226
- publicRpcUrl: "https://monad-mainnet.drpc.org",
1227
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/30495.png",
1228
- explorer: "https://monad.network",
1229
- eip1559: !0
1230
- },
1231
- optimism: {
1232
- id: 10,
1233
- name: "Optimism",
1234
- shortname: "optimism",
1235
- native: {
1236
- address: U,
1237
- symbol: "ETH",
1238
- decimals: 18,
1239
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/11840.png"
1240
- },
1241
- wToken: {
1242
- symbol: "WETH",
1243
- address: "0x4200000000000000000000000000000000000006",
1244
- decimals: 18,
1245
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/2396.png"
1246
- },
1247
- publicRpcUrl: "https://optimism.blockscout.com",
1248
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/11840.png",
1249
- explorer: "https://optimistic.etherscan.io",
1250
- eip1559: !0
1251
- },
1252
- mantle: {
1253
- id: 5e3,
1254
- name: "Mantle",
1255
- shortname: "mantle",
1256
- native: {
1257
- address: U,
1258
- symbol: "MNT",
1259
- decimals: 18,
1260
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/27075.png"
1261
- },
1262
- wToken: {
1263
- symbol: "WMNT",
1264
- address: "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8",
1265
- decimals: 18,
1266
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/27614.png"
1267
- },
1268
- publicRpcUrl: "https://rpc.mantle.xyz",
1269
- logoUrl: "https://s2.coinmarketcap.com/static/img/coins/128x128/27075.png",
1270
- explorer: "https://mantlescan.xyz",
1271
- eip1559: !0
1272
- }
1273
- }, Gt = "2.8.1", Ne = {
1274
- version: Gt
1275
- }, Re = "https://order-sink.orbs.network", Ue = "https://order-sink-v2.orbs.network", Xe = Ne.version.split(".")[0], jt = () => Number(Xe) >= 2 ? Ue : Re, Xt = () => `${Ue}/config`, Zt = () => Number(Xe) >= 2 ? [Ue, Re] : [Re], Yt = {
1276
- [J.Thena]: ["0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67"],
1277
- [J.Katana]: [
1278
- "0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df"
1279
- ]
1280
- }, Qt = ({
1281
- endpoint: e,
1282
- exchange: t,
1283
- partner: n
1284
- }) => {
1285
- const s = [Re, Ue].includes(e) && n ? Yt[n] || [] : [], c = t ? [t, ...s] : s;
1286
- return c.filter(
1287
- (y, E) => c.findIndex(
1288
- (D) => D.toLowerCase() === y.toLowerCase()
1289
- ) === E
889
+ var Ge = Lt();
890
+ const Ut = new Set(Object.values(Q)), $t = (e) => Ut.has(e), At = () => {
891
+ var n;
892
+ const e = Ge.raw, t = ((n = e["*"]) == null ? void 0 : n.dex) ?? {};
893
+ return Object.entries(e).flatMap(([i, a]) => {
894
+ if (i === "*") return [];
895
+ const d = Number(i);
896
+ if (!Number.isSafeInteger(d)) return [];
897
+ const m = { ...t, ...(a == null ? void 0 : a.dex) ?? {} };
898
+ return Object.keys(m).filter($t).filter((b) => !!Ge.config(d, b)).map((b) => ({ chainId: d, name: b }));
899
+ }).sort(
900
+ (i, a) => i.name.localeCompare(a.name) || i.chainId - a.chainId
1290
901
  );
1291
- }, qe = 300 * 1e3, Ie = 1440 * 60 * 60 * 1e3, nt = 300 * 1e3, Jt = qe / (60 * 1e3), rt = (e) => `https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-${e}/prod/gn`, en = "https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-flare/prod/gn", ce = "https://hub.orbs.network/api/apikey/subgraphs/id", tn = {
1292
- [Z.eth.id]: `${ce}/Bf7bvMYcJbDAvYWJmhMpHZ4cpFjqzkhK6GXXEpnPRq6`,
1293
- [Z.bsc.id]: `${ce}/4NfXEi8rreQsnAr4aJ45RLCKgnjcWX46Lbt9SadiCcz6`,
1294
- [Z.poly.id]: `${ce}/3PyRPWSvDnMowGbeBy7aNsvUkD5ZuxdXQw2RdJq4NdXi`,
1295
- [Z.arb.id]: `${ce}/83bpQexEaqBjHaQbKoFTbtvCXuo5RudRkfLgtRUYqo2c`,
1296
- [Z.base.id]: `${ce}/DFhaPQb3HATXkpsWNZw3gydYHehLBVEDiSk4iBdZJyps`,
1297
- [Z.sei.id]: `${ce}/5zjzRnURzoddyFSZBw5E5NAM3oBgPq3NasTYbtMk6EL6`,
1298
- [Z.linea.id]: `${ce}/6VsNPEYfFLPZCqdMMDadoXQjLHWJdjEwiD768GAtb7j6`,
1299
- [Z.sonic.id]: `${ce}/DtBr6a5vsoDd2oAXdPszcn4gLgrr1XC68Q3AJQKXnNLV`,
1300
- [Z.ftm.id]: `${ce}/DdRo1pmJkrJC9fjsjEBWnNE1uqrbh7Diz4tVKd7rfupp`,
1301
- [Z.katana.id]: `${ce}/CGi9sDFMQcnBwF3C3NoCFqnaE34sssbgwPLTwiskSXmW`,
1302
- [Z.avax.id]: `${ce}/FxZ1vMwE5Xy1qvKvZENUMz4vhW8Sh4vXJf9Vp7o17pTx`,
1303
- [Z.bera.id]: rt("berachain"),
1304
- [Z.flare.id]: en,
1305
- [Z.cronosZkEvm.id]: rt("cronos-zkevm")
1306
- }, nn = "0x0000000000000000000000000000000000000000", rn = [
1307
- nn,
1308
- "0x0000000000000000000000000000000000001010",
1309
- "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
1310
- "0x000000000000000000000000000000000000dEaD",
1311
- "0x000000000000000000000000000000000000800A",
1312
- "0x000000000000000000000000000000000000800a"
1313
- ], ft = "115792089237316195423570985008687907853269984665640564039457584007913129639935", G = (e) => `${e.name}_${e.chainId}`, an = {
1314
- [G(v.SushiArb)]: [
902
+ }, Kt = { chainName: "ftm", chainId: 250, twapVersion: 4, twapAddress: "0xd3B290FEB04E353d1821bc0a12397FdEa9a846C0", lensAddress: "0x0221EfDF1Fd3212AF87F23cceB7693a65fAF1d7f", takers: ["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913", "0x504f6E10173249dD22491829D98862Cf81DeF79E"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SpookySwap", partner: "Orbs:TWAP:SpookySwap", exchangeAddress: "0xdF7CCd5fc7077E9de5f27a7b7bfDC837c82f8496", exchangeType: "ExchangeV2", pathfinderKey: "" }, Vt = { chainName: "sonic", chainId: 146, twapVersion: 4, twapAddress: "0x8963992816b4EafE5a22b7DB2A99513c18be9afA", lensAddress: "0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D", takers: ["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913", "0x504f6E10173249dD22491829D98862Cf81DeF79E"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SpookySwapSonic", partner: "Orbs:TWAP:SpookySwap", exchangeAddress: "0x6699bE3aF75e5c1B807b1031dBde6dA9A67739F3", exchangeType: "ExchangeV2", pathfinderKey: "" }, Gt = { chainName: "poly", chainId: 137, twapVersion: 4, twapAddress: "0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4", lensAddress: "0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "QuickSwap", partner: "Orbs:TWAP:QuickSwap", exchangeAddress: "0x8FCc245209bE85C49D738D0CE5613F74E5d91E86", exchangeType: "ParaswapExchange", pathfinderKey: "QuickSwap,QuickSwapV3" }, qt = { chainName: "base", chainId: 8453, twapVersion: 4, twapAddress: "0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55", lensAddress: "0x6313188c1909b161074D62E43105faC9B756A23e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "QuickSwap", partner: "Orbs:TWAP:QuickSwap", exchangeAddress: "0xb7a3d74895bfd3aff6780525e36d79fcf26a895f", exchangeType: "ExchangeV2", pathfinderKey: "" }, Wt = { chainName: "bsc", chainId: 56, twapVersion: 4, twapAddress: "0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994", lensAddress: "0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "Thena", partner: "Orbs:TWAP:Thena", exchangeAddress: "0x2B2fABDbfa4a15da0d351F947C14F4520db0bDc1", exchangeType: "ExchangeV2", pathfinderKey: "43,47" }, zt = { chainName: "bsc", chainId: 56, twapVersion: 4, twapAddress: "0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994", lensAddress: "0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0x1A2bb6B75D58b740d88413ef4840D6fa3F637940", exchangeType: "P2Exchange", pathfinderKey: "" }, jt = { chainName: "arb", chainId: 42161, twapVersion: 4, twapAddress: "0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3", lensAddress: "0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0xb37cB9A058c03081Ae6EF934313588cD53d408e7", exchangeType: "P2Exchange", pathfinderKey: "" }, Xt = { chainName: "base", chainId: 8453, twapVersion: 4, twapAddress: "0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55", lensAddress: "0x6313188c1909b161074D62E43105faC9B756A23e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0xb37cB9A058c03081Ae6EF934313588cD53d408e7", exchangeType: "P2Exchange", pathfinderKey: "" }, Ht = { chainName: "linea", chainId: 59144, twapVersion: 4, twapAddress: "0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78", lensAddress: "0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 100, name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0xb37cB9A058c03081Ae6EF934313588cD53d408e7", exchangeType: "P2Exchange", pathfinderKey: "" }, Yt = { chainName: "linea", chainId: 59144, twapVersion: 4, twapAddress: "0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78", lensAddress: "0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 100, name: "Lynex", partner: "Orbs:TWAP:Lynex", exchangeAddress: "0x04C06C96d7D19977156016DD408B5992af0570a2", exchangeType: "ExchangeV2", pathfinderKey: "19,18" }, Zt = { chainName: "arb", chainId: 42161, twapVersion: 4, twapAddress: "0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3", lensAddress: "0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "SushiArb", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad", exchangeType: "ExchangeV2", pathfinderKey: "" }, Qt = { chainName: "base", chainId: 8453, twapVersion: 4, twapAddress: "0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55", lensAddress: "0x6313188c1909b161074D62E43105faC9B756A23e", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "SushiBase", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad", exchangeType: "ExchangeV2", pathfinderKey: "" }, Jt = { chainName: "eth", chainId: 1, twapVersion: 4, twapAddress: "0xb1ed8BCAD1EaC8a1DF0764700472391800D12946", lensAddress: "0x0967f448c4d4dbd14c355E635AE9CbF68cc44A60", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 200, name: "SushiEth", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad", exchangeType: "ExchangeV2", pathfinderKey: "" }, en = { chainName: "katana", chainId: 747474, twapVersion: 4, twapAddress: "0xf2d96E7BE676153d202e1453804E2749923C7c5b", lensAddress: "0x1579EED0527781B1A748043AA1f59a3858Ace4a7", takers: ["0xF74437A3Fc45a518640828E5D6A3E8c9A9BbDC3a", "0x07A6C715063e94c0D95e809efefFCbF4EBEdfD55"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "SushiKatana", partner: "Orbs:TWAP:Sushi", exchangeAddress: "0x92209481507e6B2d14C9b5b70Ed287024177220E", exchangeType: "ExchangeV2", pathfinderKey: "" }, tn = { chainId: 1329, name: "DragonSwap" }, nn = { chainName: "flare", chainId: 14, twapVersion: 4, twapAddress: "0x9D70B0b90915Bb8b9bdAC7e6a7e6435bBF1feC4D", lensAddress: "0xf2d96E7BE676153d202e1453804E2749923C7c5b", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SparkDEX", partner: "Orbs:TWAP:SparkDEX", exchangeAddress: "0xe59c53C76bB7EEc01401A18fA8215B94bC65Bf56", exchangeType: "P2Exchange" }, rn = { chainName: "sonic", chainId: 146, twapVersion: 4, twapAddress: "0x8963992816b4EafE5a22b7DB2A99513c18be9afA", lensAddress: "0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D", takers: ["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913", "0x504f6E10173249dD22491829D98862Cf81DeF79E"], bidDelaySeconds: 60, minChunkSizeUsd: 10, name: "SwapX", partner: "Orbs:TWAP:SwapX", exchangeAddress: "0xDA902994b7F7a1ecDd8De02E4a17dbFF2E6F67b7", exchangeType: "ExchangeV2", pathfinderKey: "" }, an = { chainName: "avax", chainId: 43114, twapVersion: 4, twapAddress: "0xf77Ad005aBF7e31f669ce89a6568B2f39Ca92cDe", lensAddress: "0x48466B82Ce1575c5c9eCa168ac1090048dD47fA3", takers: ["0xA05405b6340A7F43dC5835351BFC4f5b1F028359", "0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"], bidDelaySeconds: 60, minChunkSizeUsd: 50, name: "BlackholeAvax", partner: "Orbs:TWAP:BlackholeAvax", exchangeAddress: "0xb7A3d74895bFD3Aff6780525e36D79FCf26a895F", exchangeType: "ExchangeV2" }, _ = {
903
+ SpookySwap: Kt,
904
+ SpookySwapSonic: Vt,
905
+ QuickSwap: Gt,
906
+ QuickSwapBase: qt,
907
+ Thena: Wt,
908
+ PancakeSwap: zt,
909
+ PancakeSwapArbitrum: jt,
910
+ PancakeSwapBase: Xt,
911
+ PancakeSwapLinea: Ht,
912
+ Lynex: Yt,
913
+ SushiArb: Zt,
914
+ SushiBase: Qt,
915
+ SushiEth: Jt,
916
+ SushiKatana: en,
917
+ DragonSwap: tn,
918
+ SparkDEX: nn,
919
+ SwapX: rn,
920
+ BlackholeAvax: an
921
+ }, tt = (e) => `https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-${e}/prod/gn`, sn = "https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-flare/prod/gn", ie = "https://hub.orbs.network/api/apikey/subgraphs/id", on = {
922
+ 1: `${ie}/Bf7bvMYcJbDAvYWJmhMpHZ4cpFjqzkhK6GXXEpnPRq6`,
923
+ 14: sn,
924
+ 56: `${ie}/4NfXEi8rreQsnAr4aJ45RLCKgnjcWX46Lbt9SadiCcz6`,
925
+ 137: `${ie}/3PyRPWSvDnMowGbeBy7aNsvUkD5ZuxdXQw2RdJq4NdXi`,
926
+ 146: `${ie}/DtBr6a5vsoDd2oAXdPszcn4gLgrr1XC68Q3AJQKXnNLV`,
927
+ 250: `${ie}/DdRo1pmJkrJC9fjsjEBWnNE1uqrbh7Diz4tVKd7rfupp`,
928
+ 388: tt("cronos-zkevm"),
929
+ 1329: `${ie}/5zjzRnURzoddyFSZBw5E5NAM3oBgPq3NasTYbtMk6EL6`,
930
+ 8453: `${ie}/DFhaPQb3HATXkpsWNZw3gydYHehLBVEDiSk4iBdZJyps`,
931
+ 42161: `${ie}/83bpQexEaqBjHaQbKoFTbtvCXuo5RudRkfLgtRUYqo2c`,
932
+ 43114: `${ie}/FxZ1vMwE5Xy1qvKvZENUMz4vhW8Sh4vXJf9Vp7o17pTx`,
933
+ 59144: `${ie}/6VsNPEYfFLPZCqdMMDadoXQjLHWJdjEwiD768GAtb7j6`,
934
+ 80094: tt("berachain"),
935
+ 747474: `${ie}/CGi9sDFMQcnBwF3C3NoCFqnaE34sssbgwPLTwiskSXmW`
936
+ }, W = (e) => `${e.name}_${e.chainId}`, dn = {
937
+ [W(_.SushiArb)]: [
1315
938
  "0x846F2B29ef314bF3D667981b4ffdADc5B858312a",
1316
939
  "0x08c41f5D1C844061f6D952E25827eeAA576c6536"
1317
940
  ],
1318
- [G(v.SushiBase)]: [
941
+ [W(_.SushiBase)]: [
1319
942
  "0x846F2B29ef314bF3D667981b4ffdADc5B858312a",
1320
943
  "0x08c41f5D1C844061f6D952E25827eeAA576c6536"
1321
944
  ],
1322
- [G(v.SushiEth)]: [
945
+ [W(_.SushiEth)]: [
1323
946
  "0xc55943Fa6509004B2903ED8F8ab7347BfC47D0bA",
1324
947
  "0x08c41f5D1C844061f6D952E25827eeAA576c6536"
1325
948
  ],
1326
- [G(v.PancakeSwap)]: [
949
+ [W(_.PancakeSwap)]: [
1327
950
  "0xb2BAFe188faD927240038cC4FfF2d771d8A58905",
1328
951
  "0xE2a0c3b9aD19A18c4bBa7fffBe5bC1b0E58Db1CE"
1329
952
  ],
1330
- [G(v.PancakeSwapArbitrum)]: [
953
+ [W(_.PancakeSwapArbitrum)]: [
1331
954
  "0xE20167871dB616DdfFD0Fd870d9bC068C350DD1F",
1332
955
  "0x807488ADAD033e95C438F998277bE654152594dc"
1333
956
  ],
1334
- [G(v.PancakeSwapBase)]: [
957
+ [W(_.PancakeSwapBase)]: [
1335
958
  "0x10ed1F36e4eBE76E161c9AADDa20BE841bc0082c",
1336
959
  "0x3A9df3eE209b802D0337383f5abCe3204d623588"
1337
960
  ],
1338
- [G(v.PancakeSwapLinea)]: [
961
+ [W(_.PancakeSwapLinea)]: [
1339
962
  "0x3A9df3eE209b802D0337383f5abCe3204d623588"
1340
963
  ],
1341
- [G(v.QuickSwap)]: [
964
+ [W(_.QuickSwap)]: [
1342
965
  "0x26D0ec4Be402BCE03AAa8aAf0CF67e9428ba54eF"
1343
966
  ],
1344
- [G(v.Thena)]: [
967
+ [W(_.Thena)]: [
1345
968
  "0xc2aBC02acd77Bb2407efA22348dA9afC8B375290"
1346
969
  ],
1347
- [G(v.Lynex)]: [
970
+ [W(_.Lynex)]: [
1348
971
  "0x72e3e1fD5D2Ee2F1C2Eb695206D490a1D45C3835"
1349
972
  ],
1350
- [G(v.DragonSwap)]: [
973
+ [W(_.DragonSwap)]: [
1351
974
  "0x101e1B65Bb516FB5f4547C80BAe0b51f1b8D7a22"
1352
975
  ],
1353
- [G(v.SpookySwapSonic)]: [
976
+ [W(_.SpookySwapSonic)]: [
1354
977
  "0xAd97B770ad64aE47fc7d64B3bD820dCDbF9ff7DA"
1355
978
  ],
1356
- [G(v.SpookySwap)]: [
979
+ [W(_.SpookySwap)]: [
1357
980
  "0x3924d62219483015f982b160d48c0fa5Fd436Cba"
1358
981
  ],
1359
- [G(v.SwapX)]: [
982
+ [W(_.SwapX)]: [
1360
983
  "0xE5012eBDe5e26EE3Ea41992154731a03023CF274"
1361
984
  ],
1362
- [G(v.SushiKatana)]: [
985
+ [W(_.SushiKatana)]: [
1363
986
  "0x92209481507e6B2d14C9b5b70Ed287024177220E"
1364
987
  ],
1365
- [G(v.SparkDEX)]: [
988
+ [W(_.SparkDEX)]: [
1366
989
  "0xe59c53C76bB7EEc01401A18fA8215B94bC65Bf56"
1367
990
  ]
1368
- }, Ge = {
1369
- unit: de.Minutes,
1370
- value: Jt
1371
- }, Vr = "https://www.orbs.com/dtwap-and-dlimit-faq/", Wr = "https://www.orbs.com/dtwap-and-dlimit-faq/#dSLTP", zr = "https://raw.githubusercontent.com/orbs-network/twap-ui/master/logo/orbslogo.svg", Hr = "https://www.orbs.com/", qr = "https://www.orbs.com/dtwap-dlimit-disclaimer", sn = "-5", on = "10", cn = "-10", dn = "5", ge = (e, t) => {
991
+ }, cn = (e) => dn[W(e)] ?? [], de = (e) => new Map(e.map((t) => [t.chainId, t])), un = {
992
+ [Q.Pancake]: de([
993
+ _.PancakeSwap,
994
+ _.PancakeSwapArbitrum,
995
+ _.PancakeSwapBase,
996
+ _.PancakeSwapLinea
997
+ ]),
998
+ [Q.Sushiswap]: de([
999
+ _.SushiEth,
1000
+ _.SushiArb,
1001
+ _.SushiBase,
1002
+ _.SushiKatana
1003
+ ]),
1004
+ [Q.Quick]: de([
1005
+ _.QuickSwap,
1006
+ _.QuickSwapBase
1007
+ ]),
1008
+ [Q.Thena]: de([_.Thena]),
1009
+ [Q.Spooky]: de([
1010
+ _.SpookySwap,
1011
+ _.SpookySwapSonic
1012
+ ]),
1013
+ [Q.Lynex]: de([_.Lynex]),
1014
+ [Q.Swapx]: de([_.SwapX]),
1015
+ [Q.Blackhole]: de([_.BlackholeAvax]),
1016
+ [Q.Spark]: de([_.SparkDEX]),
1017
+ [Q.Katana]: de([_.SushiKatana])
1018
+ }, ln = (e, t) => {
1019
+ var n;
1020
+ return (n = un[e]) == null ? void 0 : n.get(t);
1021
+ }, fn = (e) => e.bidDelaySeconds * 1e3 * 2, be = (e, t) => {
1372
1022
  if (e == null || !t) return "";
1373
- const n = h(10).pow(e);
1374
- return h(t).times(n).idiv(n).div(n).toFixed();
1023
+ const n = x(10).pow(e);
1024
+ return x(t).times(n).idiv(n).div(n).toFixed();
1375
1025
  };
1376
- h(0);
1377
- h(1);
1378
- h(10);
1379
- h(1e18);
1380
- function xe(e, t) {
1026
+ function ke(e, t) {
1381
1027
  return e == t || e.toLowerCase() == t.toLowerCase();
1382
1028
  }
1383
- const Le = (e) => !!rn.find((t) => xe(t, e || ""));
1384
- function ln(e) {
1029
+ const pn = (e) => Rt.some(
1030
+ (t) => ke(t, e || "")
1031
+ );
1032
+ function An(e) {
1385
1033
  return [
1386
- de.Years,
1387
- de.Months,
1388
- de.Weeks,
1389
- de.Days,
1390
- de.Hours,
1391
- de.Minutes
1392
- ].find((n) => n <= e) || de.Minutes;
1034
+ se.Years,
1035
+ se.Months,
1036
+ se.Weeks,
1037
+ se.Days,
1038
+ se.Hours,
1039
+ se.Minutes
1040
+ ].find((n) => n <= e) || se.Minutes;
1393
1041
  }
1394
- const ye = (e) => e ? e.value * e.unit : 0, un = (e) => !e || e === "NaN" ? "0" : h(e).decimalPlaces(0).toFixed(), Ce = (e) => Object.values(Z).find((t) => t.id === e), Gr = (e, t) => {
1395
- const n = Ce(t);
1396
- return !n || !Le(e.address) ? e : n.wToken;
1397
- }, jr = (e, t, n) => {
1398
- var s;
1399
- const a = (s = Ce(n)) == null ? void 0 : s.wToken.address;
1400
- return !!(Le(e == null ? void 0 : e.address) && a && xe((t == null ? void 0 : t.address) || "", a));
1401
- }, Xr = (e, t, n) => {
1402
- var s;
1403
- const a = (s = Ce(n)) == null ? void 0 : s.wToken.address;
1404
- return !!(a && xe((e == null ? void 0 : e.address) || "", a) && Le(t == null ? void 0 : t.address));
1405
- }, Zr = (e) => {
1042
+ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0" : x(e).decimalPlaces(0).toFixed(), Kr = (e) => {
1406
1043
  const t = [e];
1407
1044
  return typeof e == "object" && e !== null && t.push(Reflect.get(e, "error"), Reflect.get(e, "cause")), t.some((n) => {
1408
1045
  if (typeof n != "object" || n === null)
1409
- return typeof n == "string" && at(n);
1410
- const a = Reflect.get(n, "code");
1411
- if (a === 4001 || a === "4001" || a === "ACTION_REJECTED" || a === "USER_REJECTED" || a === "USER_DENIED")
1046
+ return typeof n == "string" && nt(n);
1047
+ const i = Reflect.get(n, "code");
1048
+ if (i === 4001 || i === "4001" || i === "ACTION_REJECTED" || i === "USER_REJECTED" || i === "USER_DENIED")
1412
1049
  return !0;
1413
- const s = Reflect.get(n, "message");
1414
- return typeof s == "string" && at(s);
1050
+ const a = Reflect.get(n, "message");
1051
+ return typeof a == "string" && nt(a);
1415
1052
  });
1416
- }, at = (e) => /\buser\b.{0,80}\b(?:rejected|denied|cancelled|canceled)\b/i.test(
1053
+ }, nt = (e) => /\buser\b.{0,80}\b(?:rejected|denied|cancelled|canceled)\b/i.test(
1417
1054
  e
1418
1055
  ) || /\brequest\b\s+(?:was\s+)?\b(?:rejected|denied|cancelled|canceled)\b/i.test(
1419
1056
  e
1420
1057
  ) || /\b(?:rejected|denied|cancelled|canceled)\b.{0,80}\bby\s+(?:the\s+)?user\b/i.test(
1421
1058
  e
1422
- ), Yr = (e, t) => {
1423
- var a;
1424
- const n = (a = Ce(t)) == null ? void 0 : a.explorer;
1425
- return n && e ? `${n}/tx/${e}` : "";
1426
- }, pn = (e) => {
1059
+ ), En = (e) => {
1427
1060
  if (!e) return;
1428
- const t = e.map((c) => G(c)), n = Object.entries(an).filter(([c]) => t.includes(c)).flatMap(([, c]) => c), a = e.map((c) => c.exchangeAddress), s = new Set(
1429
- [...a, ...n].map((c) => c.toLowerCase())
1061
+ const t = e.flatMap(cn), n = e.map((a) => a.exchangeAddress), i = new Set(
1062
+ [...n, ...t].map((a) => a.toLowerCase())
1430
1063
  );
1431
- return Array.from(s);
1432
- }, Qr = (e, t) => e.version === 1 ? (e.fillDelay || 0) * 1e3 + (t ? Tn(t) : 0) : e.fillDelay || 0, Jr = (e) => mt().filter((t) => t.name === e).map((t) => t.chainId), ea = (e = "", t = "", n = 18, a = 18) => {
1433
- if (!h(e || 0).gt(0) || !h(t || 0).gt(0))
1064
+ return Array.from(i);
1065
+ }, Vr = (e, t) => e.version === 1 ? (e.fillDelay || 0) * 1e3 + (t ? fn(t) : 0) : e.fillDelay || 0, Gr = (e) => At().filter((t) => t.name === e).map((t) => t.chainId), qr = (e = "", t = "", n = 18, i = 18) => {
1066
+ if (!x(e || 0).gt(0) || !x(t || 0).gt(0))
1434
1067
  return "";
1435
- const s = ge(n, e), c = ge(a, t);
1436
- return h(c).div(s).toFixed();
1437
- }, ta = (e, t, n) => {
1068
+ const a = be(n, e), d = be(i, t);
1069
+ return x(d).div(a).toFixed();
1070
+ }, Wr = (e, t, n) => {
1438
1071
  if (e.type === N.TWAP_MARKET) return "";
1439
- const a = ge(t, e.srcAmountPerTrade), s = ge(n, e.dstMinAmountPerTrade);
1440
- return h(s).div(a).toFixed();
1441
- }, na = (e, t, n) => {
1072
+ const i = be(t, e.srcAmountPerTrade), a = be(n, e.dstMinAmountPerTrade);
1073
+ return x(a).div(i).toFixed();
1074
+ }, zr = (e, t, n) => {
1442
1075
  if (e.type === N.TWAP_MARKET) return "";
1443
- const a = ge(t, e.srcAmountPerTrade), s = ge(n, e.triggerPricePerTrade);
1444
- return h(s).div(a).toFixed();
1445
- }, fn = /* @__PURE__ */ new Set([1, 56, 42161, 8453]), mn = (e, t) => e === J.Ring ? fn.has(t) : !0, An = (e, t, n) => {
1446
- if (!e || !t || n == null) return;
1447
- const a = h(e).times(t), s = h(10).pow(n);
1448
- return a.div(s).toFixed(0);
1449
- }, bn = (e, t, n, a) => {
1450
- if (n || a == null || !e || !t)
1451
- return h(0).toString();
1452
- const s = h(e).times(h(t)), c = h(10).pow(a), y = s.div(c);
1453
- return h.max(1, y).integerValue(h.ROUND_FLOOR).toFixed(0);
1454
- }, yn = (e, t, n, a) => {
1455
- if (e === _.TWAP || e === _.LIMIT)
1456
- return "0";
1457
- if (a == null || !t || !n) return;
1458
- const s = h(t).times(h(n)), c = h(10).pow(a), y = s.div(c);
1459
- return h.max(1, y).integerValue(h.ROUND_FLOOR).toFixed(0) || "0";
1460
- }, hn = (e, t, n, a) => {
1461
- const s = ye(n) * 2 * t;
1462
- if (a)
1463
- return a;
1464
- if (e === _.LIMIT)
1465
- return { unit: de.Days, value: 7 };
1466
- if (e === _.STOP_LOSS || e === _.TAKE_PROFIT)
1467
- return { unit: de.Days, value: 1 };
1468
- const c = ln(s);
1469
- return { unit: c, value: Number(h(s / c).toFixed(2)) };
1470
- }, En = (e, t, n) => t !== _.TWAP ? 1 : n !== void 0 ? n : Math.max(1, Math.ceil(e / 2)), gn = (e, t, n) => {
1076
+ const i = be(t, e.srcAmountPerTrade), a = be(n, e.triggerPricePerTrade);
1077
+ return x(a).div(i).toFixed();
1078
+ }, mn = (e, t, n, i) => {
1079
+ const a = he(n) * 2 * t;
1080
+ if (i) return i;
1081
+ if (e === v.LIMIT) return { unit: se.Days, value: 7 };
1082
+ if (e === v.STOP_LOSS || e === v.TAKE_PROFIT)
1083
+ return { unit: se.Days, value: 1 };
1084
+ const d = An(a);
1085
+ return { unit: d, value: Number(x(a / d).toFixed(2)) };
1086
+ }, bn = (e, t, n) => t !== v.TWAP ? 1 : n !== void 0 ? n : Math.max(1, Math.ceil(e / 2)), hn = (e, t, n) => {
1471
1087
  if (!e || !t || !n) return 1;
1472
- const s = h(t).times(e).div(n).integerValue(h.ROUND_FLOOR).toNumber();
1473
- return Math.max(1, s);
1474
- }, xn = (e, t) => e + ye(t) + 6e4, Tn = (e) => e.bidDelaySeconds * 1e3 * 2, Dn = (e = "", t = 0) => !e || !t ? "0" : h(e).div(t).integerValue(h.ROUND_FLOOR).toFixed(0), Fn = (e, t) => ({
1475
- isError: !(e.unit === Ge.unit && e.value === Ge.value) && ye(e) * t > Ie,
1476
- value: Math.floor(Ie / t)
1477
- }), wn = (e, t) => e === _.STOP_LOSS || e === _.TAKE_PROFIT ? {
1478
- isError: ye(t) > 5184e6,
1088
+ const a = x(t).times(e).div(n).integerValue(x.ROUND_FLOOR).toNumber();
1089
+ return Math.max(1, a);
1090
+ }, Tn = (e, t) => ({
1091
+ isError: !(e.unit === Ve.unit && e.value === Ve.value) && he(e) * t > Oe,
1092
+ value: Math.floor(Oe / t)
1093
+ }), xn = (e, t) => e === v.STOP_LOSS || e === v.TAKE_PROFIT ? {
1094
+ isError: he(t) > 5184e6,
1479
1095
  value: 5184e6
1480
1096
  } : {
1481
- isError: ye(t) > Ie,
1482
- // 365 days
1483
- value: Ie
1484
- }, Cn = (e) => ({
1485
- isError: ye(e) < nt,
1486
- value: nt
1487
- }), Bn = (e) => ({
1488
- isError: ye(e) < qe,
1489
- value: qe
1490
- }), kn = (e, t, n) => ({
1491
- isError: n === _.TWAP && h(e).isGreaterThan(t),
1097
+ isError: he(t) > Oe,
1098
+ value: Oe
1099
+ }, gn = (e) => ({
1100
+ isError: he(e) < Je,
1101
+ value: Je
1102
+ }), Dn = (e) => ({
1103
+ isError: he(e) < Ke,
1104
+ value: Ke
1105
+ }), Fn = (e, t, n) => ({
1106
+ isError: n === v.TWAP && x(e).isGreaterThan(t),
1492
1107
  value: t
1493
- }), Sn = (e, t) => {
1494
- if (e === J.Pancake)
1495
- switch (t) {
1496
- case 56:
1497
- return v.PancakeSwap;
1498
- case 42161:
1499
- return v.PancakeSwapArbitrum;
1500
- case 8453:
1501
- return v.PancakeSwapBase;
1502
- case 59144:
1503
- return v.PancakeSwapLinea;
1504
- default:
1505
- return v.PancakeSwap;
1506
- }
1507
- if (e === J.Sushiswap)
1508
- switch (t) {
1509
- case 1:
1510
- return v.SushiEth;
1511
- case 42161:
1512
- return v.SushiArb;
1513
- case 8453:
1514
- return v.SushiBase;
1515
- case 747474:
1516
- return v.SushiKatana;
1517
- default:
1518
- return v.SushiEth;
1519
- }
1520
- if (e === J.Quick)
1521
- switch (t) {
1522
- case 137:
1523
- return v.QuickSwap;
1524
- case 8453:
1525
- return v.QuickSwapBase;
1526
- default:
1527
- return v.QuickSwap;
1528
- }
1529
- if (e === J.Thena)
1530
- switch (t) {
1531
- case 56:
1532
- return v.Thena;
1533
- default:
1534
- return v.Thena;
1535
- }
1536
- if (e === J.Spooky)
1537
- switch (t) {
1538
- case 250:
1539
- return v.SpookySwap;
1540
- case 146:
1541
- return v.SpookySwapSonic;
1542
- default:
1543
- return v.SpookySwap;
1544
- }
1545
- if (e === J.Lynex)
1546
- switch (t) {
1547
- case 59144:
1548
- return v.Lynex;
1549
- default:
1550
- return v.Lynex;
1551
- }
1552
- if (e === J.Swapx)
1553
- switch (t) {
1554
- case 146:
1555
- return v.SwapX;
1556
- default:
1557
- return v.SwapX;
1558
- }
1559
- if (e === J.Blackhole)
1560
- switch (t) {
1561
- case 43114:
1562
- return v.BlackholeAvax;
1563
- default:
1564
- return v.BlackholeAvax;
1565
- }
1566
- if (e === J.Spark)
1567
- return v.SparkDEX;
1568
- if (e === J.Katana)
1569
- switch (t) {
1570
- case 747474:
1571
- return v.SushiKatana;
1572
- default:
1573
- return v.SushiKatana;
1574
- }
1575
- }, mt = () => {
1576
- var n;
1577
- const e = pt.raw, t = ((n = e["*"]) == null ? void 0 : n.dex) ?? {};
1578
- return Object.entries(e).filter(([a]) => a !== "*").flatMap(([a, s]) => {
1579
- const c = Number(a), y = { ...t, ...(s == null ? void 0 : s.dex) ?? {} };
1580
- return !y || typeof y != "object" ? [] : Object.entries(y).flatMap(([E]) => mn(E, c) ? [
1581
- {
1582
- chainId: c,
1583
- name: E
1584
- }
1585
- ] : []);
1586
- }).sort((a, s) => a.name.localeCompare(s.name));
1587
- }, se = (e) => {
1588
- if (!e) return "";
1589
- const t = h(e);
1590
- return t.isFinite() && !t.isNaN() ? e : "";
1591
- }, At = (e, t) => {
1592
- if (t == null || !e) return "";
1593
- const n = h(e);
1594
- return !n.isFinite() || n.isNaN() ? "" : n.multipliedBy(h(10).pow(t)).toFixed(0);
1595
- }, Me = (e, t) => {
1596
- if (t == null || !e) return "";
1597
- const n = h(e);
1598
- return !n.isFinite() || n.isNaN() ? "" : n.dividedBy(h(10).pow(t)).toFixed();
1599
- }, Ze = (e, t) => {
1600
- if (!e || !t) return "";
1601
- const n = h(e), a = h(t);
1602
- return !n.isFinite() || n.isNaN() || n.isZero() || !a.isFinite() || a.isNaN() || a.isZero() ? "" : n.multipliedBy(a).toFixed();
1603
- }, bt = (e) => {
1604
- const t = se(e.initialPrice);
1605
- let n = "";
1606
- if (e.typedValue !== void 0) {
1607
- const c = h(e.typedValue), y = e.isInverted ? c.isZero() ? h(0) : h(1).dividedBy(c) : c;
1608
- n = At(y.toFixed(), e.tokenDecimals);
1609
- } else if (e.percentage !== void 0 && t && h(t).gt(0)) {
1610
- const c = h(e.percentage || 0).dividedBy(100);
1611
- n = h(t).plus(h(t).multipliedBy(c)).decimalPlaces(0).toFixed();
1612
- } else t && h(t).gt(0) && (n = h(t).decimalPlaces(0).toFixed());
1613
- const a = se(n);
1614
- let s = "";
1615
- if (t && !h(t).isZero()) {
1616
- if (e.percentage !== void 0 && e.percentage !== null)
1617
- s = e.percentage;
1618
- else if (a) {
1619
- const c = h(a).minus(t).dividedBy(t).multipliedBy(100).decimalPlaces(2).toString();
1620
- s = h(c).isZero() ? "" : c;
1621
- }
1622
- }
1623
- return {
1624
- raw: a,
1625
- typedValue: e.typedValue,
1626
- percentage: s,
1627
- isTypedValue: e.typedValue !== void 0
1628
- };
1629
- }, yt = (e) => {
1630
- const t = (c) => {
1631
- if (!c) return "";
1632
- const y = h(c);
1633
- return y.isFinite() && !y.isNaN() ? c : "";
1634
- };
1635
- let n = "";
1636
- if (e.typedValue !== void 0)
1637
- n = t(e.typedValue);
1638
- else {
1639
- const c = Me(
1640
- e.raw,
1641
- e.amountDecimals ?? 18
1642
- );
1643
- c && !h(c).isZero() && (n = e.isInverted ? h(1).dividedBy(c).toFixed() : c);
1644
- }
1645
- const a = n ? e.isInverted ? t(
1646
- At(n, e.invertedAmountDecimals ?? 18)
1647
- ) : t(e.raw) : "", s = e.isInverted ? e.invertedAmountUsdPrice : e.amountUsdPrice;
1648
- return {
1649
- raw: a,
1650
- ui: n,
1651
- usd: Ze(n, s)
1652
- };
1653
- }, ra = (e) => {
1654
- if (e === void 0 || e === "") return e;
1655
- const t = h(e);
1656
- return !t.isFinite() || t.isNaN() || t.isZero() ? "0" : h(1).dividedBy(t).toFixed();
1657
- }, Pn = (e) => {
1658
- if (e === _.STOP_LOSS) return sn;
1659
- if (e === _.TAKE_PROFIT) return on;
1660
- }, On = (e, t) => {
1661
- if (!t) {
1662
- if (e === _.STOP_LOSS)
1663
- return cn;
1664
- if (e === _.TAKE_PROFIT)
1665
- return dn;
1666
- }
1667
- }, vn = (e, t, n, a) => {
1668
- if (!(h(t || "0").isZero() || !n || e !== _.STOP_LOSS && e !== _.TAKE_PROFIT)) {
1669
- if (e === _.STOP_LOSS && h(a || 0).gte(n))
1670
- return {
1671
- type: ee.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,
1672
- value: n
1673
- };
1674
- if (e === _.TAKE_PROFIT && h(a || 0).lte(n))
1675
- return {
1676
- type: ee.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,
1677
- value: n
1678
- };
1679
- if (!a || h(a).isZero())
1680
- return {
1681
- type: ee.EMPTY_TRIGGER_PRICE,
1682
- value: a
1683
- };
1684
- }
1685
- }, _n = (e) => {
1686
- const t = e.module === _.STOP_LOSS || e.module === _.TAKE_PROFIT, n = e.triggerPricePercent === void 0 ? Pn(e.module) : e.triggerPricePercent, a = bt({
1687
- tokenDecimals: e.outputTokenDecimals,
1688
- initialPrice: t ? e.marketPrice : void 0,
1689
- typedValue: e.triggerPrice,
1690
- percentage: n,
1691
- isInverted: e.isInverted
1692
- }), s = yt({
1693
- raw: a.raw,
1694
- typedValue: a.typedValue,
1695
- amountDecimals: e.outputTokenDecimals,
1696
- invertedAmountDecimals: e.inputTokenDecimals,
1697
- amountUsdPrice: e.outputUsdPrice,
1698
- invertedAmountUsdPrice: e.inputUsdPrice,
1699
- isInverted: e.isInverted
1700
- });
1701
- return {
1702
- ...a,
1703
- enabled: t,
1704
- display: s,
1705
- error: vn(
1706
- e.module,
1707
- e.inputAmountWei,
1708
- se(e.marketPrice),
1709
- a.raw
1710
- )
1711
- };
1712
- }, Rn = (e, t, n) => {
1713
- if (!(h(e.inputAmountWei || "0").isZero() || !t || e.isMarketOrder)) {
1714
- if ((e.module === _.STOP_LOSS || e.module === _.TAKE_PROFIT) && e.triggerPrice && h(n || 0).gte(e.triggerPrice))
1715
- return {
1716
- type: ee.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,
1717
- value: e.triggerPrice
1718
- };
1719
- if (!n || h(n).isZero())
1720
- return {
1721
- type: ee.MISSING_LIMIT_PRICE,
1722
- value: n
1723
- };
1724
- }
1725
- }, In = (e) => {
1726
- const t = e.limitPricePercent === void 0 ? On(e.module, e.isMarketOrder) : e.limitPricePercent, n = bt({
1727
- tokenDecimals: e.outputTokenDecimals,
1728
- initialPrice: e.marketPrice,
1729
- typedValue: e.limitPrice,
1730
- percentage: t,
1731
- isInverted: e.isInverted
1732
- }), a = yt({
1733
- raw: n.raw,
1734
- typedValue: n.typedValue,
1735
- amountDecimals: e.outputTokenDecimals,
1736
- invertedAmountDecimals: e.inputTokenDecimals,
1737
- amountUsdPrice: e.outputUsdPrice,
1738
- invertedAmountUsdPrice: e.inputUsdPrice,
1739
- isInverted: e.isInverted
1740
- }), s = se(e.marketPrice);
1741
- return {
1742
- ...n,
1743
- display: a,
1744
- error: Rn(e, s, n.raw)
1745
- };
1746
- }, Mn = (e, t) => e === _.LIMIT ? N.LIMIT : e === _.STOP_LOSS ? t ? N.STOP_LOSS_MARKET : N.STOP_LOSS_LIMIT : e === _.TAKE_PROFIT ? t ? N.TAKE_PROFIT_MARKET : N.TAKE_PROFIT_LIMIT : t ? N.TWAP_MARKET : N.TWAP_LIMIT, Nn = ({
1747
- module: e,
1748
- isMarketOrder: t,
1749
- marketPrice: n,
1750
- limitPrice: a,
1751
- triggerPrice: s
1752
- }) => e === _.LIMIT || !t ? se(a) : e === _.STOP_LOSS || e === _.TAKE_PROFIT ? se(s) : se(n), Un = (e, t) => !e || !t ? "" : h(e).multipliedBy(t).decimalPlaces(0).toFixed(), Ln = (e, t) => {
1108
+ }), Cn = (e, t) => {
1753
1109
  const n = Number.isFinite(t) ? Math.floor(t) : 1;
1754
- return e === _.TWAP ? Math.max(1, n) : 1;
1755
- }, st = (e) => {
1110
+ return e === v.TWAP ? Math.max(1, n) : 1;
1111
+ }, rt = (e) => {
1756
1112
  const t = e.unit * e.value;
1757
1113
  return Number.isFinite(t) ? Math.max(0, t) : 0;
1758
- }, $n = (e) => {
1759
- const t = Ln(e.module, e.totalTrades), n = e.fillDelay ?? { ...Ge }, a = hn(
1114
+ }, Bn = (e) => {
1115
+ const t = Cn(e.module, e.totalTrades), n = e.fillDelay ?? { ...Ve }, i = mn(
1760
1116
  e.module,
1761
1117
  t,
1762
1118
  n,
@@ -1765,349 +1121,319 @@ const ye = (e) => e ? e.value * e.unit : 0, un = (e) => !e || e === "NaN" ? "0"
1765
1121
  return {
1766
1122
  totalTrades: t,
1767
1123
  fillDelay: n,
1768
- fillDelayMillis: st(n),
1769
- duration: a,
1770
- durationMillis: st(a)
1771
- };
1772
- }, Kn = (e) => {
1773
- const t = $n(e), n = Number.isFinite(e.priceProtection) ? e.priceProtection * 100 : 0;
1774
- let a = 0;
1775
- typeof e.displayFeePercent == "number" && Number.isFinite(e.displayFeePercent) && (a = e.displayFeePercent);
1776
- const s = se(e.totalInputAmount), c = se(e.marketPrice), y = se(e.limitPrice), E = se(e.triggerPrice), D = Nn({
1777
- module: e.module,
1778
- isMarketOrder: e.isMarketOrder,
1779
- marketPrice: c,
1780
- limitPrice: y,
1781
- triggerPrice: E
1782
- }), C = Dn(
1783
- s,
1784
- t.totalTrades
1785
- ), P = se(
1786
- An(s, D, e.inputTokenDecimals)
1787
- ), F = bn(
1788
- C,
1789
- y,
1790
- e.isMarketOrder,
1791
- e.inputTokenDecimals
1792
- ), g = Un(
1793
- F,
1794
- t.totalTrades
1795
- ), S = yn(
1796
- e.module,
1797
- C,
1798
- E,
1799
- e.inputTokenDecimals
1800
- ) || "0", w = a && P ? h(P).multipliedBy(a).dividedBy(100).toFixed(0) : "", $ = Mn(e.module, e.isMarketOrder), K = e.module === _.STOP_LOSS || e.module === _.TAKE_PROFIT;
1801
- return {
1802
- ...t,
1803
- orderType: $,
1804
- isMarketOrder: e.isMarketOrder,
1805
- isTriggerPrice: K,
1806
- slippageBps: n,
1807
- inputAmount: s,
1808
- outputAmount: P,
1809
- inputAmountPerTrade: C,
1810
- minOutputAmountPerTrade: F,
1811
- minOutputAmountTotal: g,
1812
- triggerOutputAmountPerTrade: S,
1813
- tradePrice: D,
1814
- marketPrice: c,
1815
- limitPrice: y,
1816
- triggerPrice: E,
1817
- displayFeeAmount: w,
1818
- displayFeePercent: a
1819
- };
1820
- }, ve = (e) => {
1821
- if (!e) return "";
1822
- const t = h(e);
1823
- return t.isFinite() && !t.isNaN() ? e : "";
1824
- }, Ae = (e, t, n) => {
1825
- const a = ve(e), s = Me(a, t);
1826
- return {
1827
- raw: a,
1828
- ui: s,
1829
- usd: Ze(s, n)
1124
+ fillDelayMillis: rt(n),
1125
+ duration: i,
1126
+ durationMillis: rt(i)
1830
1127
  };
1831
- }, Vn = (e) => {
1832
- const t = ve(e.marketPrice), n = ve(e.quotedOutputAmount), a = Me(
1833
- ve(e.inputAmountWei),
1834
- e.inputTokenDecimals
1835
- ), s = n && a && h(a).gt(0) ? h(n).dividedBy(a).toFixed() : "", c = t || s, y = Me(c, e.outputTokenDecimals);
1836
- return {
1837
- raw: c,
1838
- ui: y,
1839
- usd: Ze(y, e.outputUsdPrice)
1840
- };
1841
- }, it = (e) => {
1128
+ }, at = (e) => {
1842
1129
  const t = e / 6e4, n = t / 60 / 24;
1843
1130
  if (n >= 1)
1844
1131
  return `${n.toFixed(n % 1 ? 1 : 0)} ${n === 1 ? "day" : "days"}`;
1845
- const a = t / 60;
1846
- return a >= 1 ? `${a.toFixed(a % 1 ? 1 : 0)} ${a === 1 ? "hour" : "hours"}` : `${t.toFixed(t % 1 ? 1 : 0)} ${t === 1 ? "minute" : "minutes"}`;
1847
- }, Wn = (e, t, n, a, s) => {
1848
- if (h(n.raw || "0").isZero() || !t || h(e.inputUsdPrice || "0").isZero())
1132
+ const i = t / 60;
1133
+ return i >= 1 ? `${i.toFixed(i % 1 ? 1 : 0)} ${i === 1 ? "hour" : "hours"}` : `${t.toFixed(t % 1 ? 1 : 0)} ${t === 1 ? "minute" : "minutes"}`;
1134
+ }, wn = (e, t, n, i, a) => {
1135
+ if (x(n.raw || "0").isZero() || !t || x(e.inputTokenUsdPrice || "0").isZero())
1849
1136
  return;
1850
- if (!a)
1137
+ if (!i)
1851
1138
  return {
1852
- type: ee.MIN_TRADES,
1139
+ type: J.MIN_TRADES,
1853
1140
  value: 1,
1854
1141
  args: { minTrades: "1" }
1855
1142
  };
1856
- if (kn(
1143
+ if (Fn(
1144
+ i,
1857
1145
  a,
1858
- s,
1859
1146
  e.module
1860
1147
  ).isError)
1861
1148
  return {
1862
- type: ee.MAX_TRADES,
1863
- value: s,
1864
- args: { maxTrades: `${s}` }
1149
+ type: J.MAX_TRADES,
1150
+ value: a,
1151
+ args: { maxTrades: `${a}` }
1865
1152
  };
1866
- }, zn = (e, t, n) => {
1867
- if (h(e || "0").isZero() || !t) return;
1868
- const a = Bn(n.fillDelay);
1869
- if (a.isError)
1153
+ }, Sn = (e, t, n) => {
1154
+ if (x(e || "0").isZero() || !t) return;
1155
+ const i = Dn(n.fillDelay);
1156
+ if (i.isError)
1870
1157
  return {
1871
- type: ee.MIN_FILL_DELAY,
1872
- value: a.value,
1873
- args: { fillDelay: it(a.value) }
1158
+ type: J.MIN_FILL_DELAY,
1159
+ value: i.value,
1160
+ args: { fillDelay: at(i.value) }
1874
1161
  };
1875
- const s = Fn(
1162
+ const a = Tn(
1876
1163
  n.fillDelay,
1877
1164
  n.totalTrades
1878
1165
  );
1879
- if (s.isError)
1166
+ if (a.isError)
1880
1167
  return {
1881
- type: ee.MAX_FILL_DELAY,
1882
- value: s.value,
1883
- args: { fillDelay: it(s.value) }
1168
+ type: J.MAX_FILL_DELAY,
1169
+ value: a.value,
1170
+ args: { fillDelay: at(a.value) }
1884
1171
  };
1885
- }, Hn = (e, t, n, a) => {
1886
- if (h(t || "0").isZero() || !n) return;
1887
- const s = wn(e, a.duration);
1888
- if (s.isError)
1172
+ }, Pn = (e, t, n, i) => {
1173
+ if (x(t || "0").isZero() || !n) return;
1174
+ const a = xn(e, i.duration);
1175
+ if (a.isError)
1889
1176
  return {
1890
- type: ee.MAX_ORDER_DURATION,
1891
- value: s.value,
1177
+ type: J.MAX_ORDER_DURATION,
1178
+ value: a.value,
1892
1179
  args: {
1893
- duration: `${Math.floor(s.value / 864e5).toFixed(0)} days`
1180
+ duration: `${Math.floor(a.value / 864e5).toFixed(0)} days`
1894
1181
  }
1895
1182
  };
1896
- const c = Cn(a.duration);
1897
- if (c.isError)
1183
+ const d = gn(i.duration);
1184
+ if (d.isError)
1898
1185
  return {
1899
- type: ee.MIN_ORDER_DURATION,
1900
- value: c.value,
1186
+ type: J.MIN_ORDER_DURATION,
1187
+ value: d.value,
1901
1188
  args: {
1902
- duration: `${Math.floor(c.value / 6e4).toFixed(0)} minutes`
1189
+ duration: `${Math.floor(d.value / 6e4).toFixed(0)} minutes`
1903
1190
  }
1904
1191
  };
1905
- }, qn = (e, t) => {
1906
- if (!(!h(e.raw || 0).gt(0) || !e.usd) && h(t).gt(e.usd))
1192
+ }, On = (e, t) => {
1193
+ if (!(!x(e.raw || 0).gt(0) || !e.usd) && x(t).gt(e.usd))
1907
1194
  return {
1908
- type: ee.MIN_TRADE_SIZE,
1195
+ type: J.MIN_TRADE_SIZE,
1909
1196
  value: t,
1910
1197
  args: { minTradeSize: `${t}` }
1911
1198
  };
1912
- }, Gn = (e) => {
1913
- const t = Ae(
1914
- e.inputAmountWei,
1199
+ }, kn = (e, t, n, i, a, d) => {
1200
+ const m = On(
1201
+ t,
1202
+ e.minTradeSizeUsd
1203
+ ), b = e.inputBalanceRaw && x(t.raw).gt(e.inputBalanceRaw) ? {
1204
+ type: J.INSUFFICIENT_BALANCE,
1205
+ value: e.inputBalanceRaw
1206
+ } : void 0, D = [
1207
+ m,
1208
+ d.triggerPrice.error,
1209
+ d.limitPrice.error,
1210
+ i.error,
1211
+ a.fillDelayError,
1212
+ a.durationError,
1213
+ b
1214
+ ].filter((F) => !!F), C = x(n || 0).gt(0) && x(t.raw || 0).gt(0) && x(e.inputTokenUsdPrice || 0).gt(0), O = C ? D[0] : void 0;
1215
+ return {
1216
+ errors: {
1217
+ primary: O,
1218
+ all: D,
1219
+ minTradeSize: m,
1220
+ triggerPrice: d.triggerPrice.error,
1221
+ limitPrice: d.limitPrice.error,
1222
+ trades: i.error,
1223
+ fillDelay: a.fillDelayError,
1224
+ duration: a.durationError,
1225
+ balance: b
1226
+ },
1227
+ isReady: C,
1228
+ canSubmit: C && !O
1229
+ };
1230
+ }, _n = (e, t, n) => {
1231
+ if (!(!e || !t || n == null))
1232
+ return x(e).times(t).div(x(10).pow(n)).toFixed(0);
1233
+ }, vn = (e, t, n, i) => {
1234
+ if (n || i == null || !e || !t)
1235
+ return "0";
1236
+ const a = x(e).times(t).div(x(10).pow(i));
1237
+ return x.max(1, a).integerValue(x.ROUND_FLOOR).toFixed(0);
1238
+ }, In = (e, t, n, i) => {
1239
+ if (e === v.TWAP || e === v.LIMIT) return "0";
1240
+ if (i == null || !t || !n)
1241
+ return;
1242
+ const a = x(t).times(n).div(x(10).pow(i));
1243
+ return x.max(1, a).integerValue(x.ROUND_FLOOR).toFixed(0);
1244
+ }, Rn = (e = "", t = 0) => !e || !t ? "0" : x(e).div(t).integerValue(x.ROUND_FLOOR).toFixed(0), Mn = (e, t) => e === v.LIMIT ? N.LIMIT : e === v.STOP_LOSS ? t ? N.STOP_LOSS_MARKET : N.STOP_LOSS_LIMIT : e === v.TAKE_PROFIT ? t ? N.TAKE_PROFIT_MARKET : N.TAKE_PROFIT_LIMIT : t ? N.TWAP_MARKET : N.TWAP_LIMIT, Nn = ({
1245
+ module: e,
1246
+ isMarketOrder: t,
1247
+ marketPrice: n,
1248
+ limitPrice: i,
1249
+ triggerPrice: a
1250
+ }) => e === v.LIMIT || !t ? H(i) : e === v.STOP_LOSS || e === v.TAKE_PROFIT ? H(a) : H(n), Ln = (e, t) => !e || !t ? "" : x(e).multipliedBy(t).decimalPlaces(0).toFixed(), Un = (e) => {
1251
+ const t = Bn(e), n = Number.isFinite(e.priceProtectionPercent) ? e.priceProtectionPercent * 100 : 0, i = typeof e.displayFeePercent == "number" && Number.isFinite(e.displayFeePercent) ? e.displayFeePercent : 0, a = H(e.totalInputAmount), d = H(e.marketPrice), m = H(e.limitPrice), b = H(e.triggerPrice), D = Nn({
1252
+ module: e.module,
1253
+ isMarketOrder: e.isMarketOrder,
1254
+ marketPrice: d,
1255
+ limitPrice: m,
1256
+ triggerPrice: b
1257
+ }), C = Rn(
1258
+ a,
1259
+ t.totalTrades
1260
+ ), O = H(
1261
+ _n(a, D, e.inputTokenDecimals)
1262
+ ), F = vn(
1263
+ C,
1264
+ m,
1265
+ e.isMarketOrder,
1266
+ e.inputTokenDecimals
1267
+ ), h = Ln(
1268
+ F,
1269
+ t.totalTrades
1270
+ ), w = In(
1271
+ e.module,
1272
+ C,
1273
+ b,
1274
+ e.inputTokenDecimals
1275
+ ) || "0", B = i && O ? x(O).multipliedBy(i).dividedBy(100).toFixed(0) : "";
1276
+ return {
1277
+ ...t,
1278
+ orderType: Mn(e.module, e.isMarketOrder),
1279
+ isMarketOrder: e.isMarketOrder,
1280
+ isTriggerPrice: e.module === v.STOP_LOSS || e.module === v.TAKE_PROFIT,
1281
+ slippageBps: n,
1282
+ inputAmount: a,
1283
+ outputAmount: O,
1284
+ inputAmountPerTrade: C,
1285
+ minOutputAmountPerTrade: F,
1286
+ minOutputAmountTotal: h,
1287
+ triggerOutputAmountPerTrade: w,
1288
+ tradePrice: D,
1289
+ marketPrice: d,
1290
+ limitPrice: m,
1291
+ triggerPrice: b,
1292
+ displayFeeAmount: B,
1293
+ displayFeePercent: i
1294
+ };
1295
+ }, $n = (e) => {
1296
+ const t = We(
1297
+ e.userInput.inputAmountUi,
1298
+ e.inputTokenDecimals
1299
+ ), n = Ae(
1300
+ t,
1915
1301
  e.inputTokenDecimals,
1916
- e.inputUsdPrice
1302
+ e.inputTokenUsdPrice
1917
1303
  );
1918
1304
  return {
1919
- ...t,
1920
- isEmpty: !h(t.raw || 0).gt(0)
1305
+ ...n,
1306
+ isEmpty: !x(n.raw || 0).gt(0)
1921
1307
  };
1922
- }, jn = (e, t, n) => {
1923
- const a = gn(
1308
+ }, Kn = (e, t, n) => {
1309
+ const i = hn(
1924
1310
  t.ui,
1925
- e.inputUsdPrice,
1311
+ e.inputTokenUsdPrice,
1926
1312
  e.minTradeSizeUsd
1927
- ), s = En(
1928
- a,
1313
+ ), a = bn(
1314
+ i,
1929
1315
  e.module,
1930
- e.trades
1316
+ e.userInput.tradeCount
1931
1317
  );
1932
1318
  return {
1933
- totalTrades: s,
1934
- maxTrades: a,
1935
- error: Wn(
1319
+ totalTrades: a,
1320
+ maxTrades: i,
1321
+ error: wn(
1936
1322
  e,
1937
1323
  n,
1938
1324
  t,
1939
- s,
1940
- a
1325
+ a,
1326
+ i
1941
1327
  )
1942
1328
  };
1943
- }, Xn = (e, t, n) => ({
1329
+ }, Vn = (e, t, n) => ({
1944
1330
  totalTrades: t.totalTrades,
1945
1331
  maxTrades: t.maxTrades,
1946
1332
  inputAmountPerTrade: Ae(
1947
1333
  n.inputAmountPerTrade,
1948
1334
  e.inputTokenDecimals,
1949
- e.inputUsdPrice
1335
+ e.inputTokenUsdPrice
1950
1336
  ),
1951
1337
  minOutputAmountPerTrade: Ae(
1952
1338
  n.minOutputAmountPerTrade,
1953
1339
  e.outputTokenDecimals,
1954
- e.outputUsdPrice
1340
+ e.outputTokenUsdPrice
1955
1341
  ),
1956
1342
  triggerOutputAmountPerTrade: Ae(
1957
1343
  n.triggerOutputAmountPerTrade,
1958
1344
  e.outputTokenDecimals,
1959
- e.outputUsdPrice
1345
+ e.outputTokenUsdPrice
1960
1346
  ),
1961
1347
  error: t.error
1962
- }), Zn = (e, t, n, a) => ({
1963
- totalTrades: a.totalTrades,
1964
- fillDelay: a.fillDelay,
1965
- fillDelayMillis: a.fillDelayMillis,
1966
- duration: a.duration,
1967
- durationMillis: a.durationMillis,
1968
- fillDelayError: zn(
1348
+ }), Gn = (e, t, n, i) => ({
1349
+ totalTrades: i.totalTrades,
1350
+ fillDelay: i.fillDelay,
1351
+ fillDelayMillis: i.fillDelayMillis,
1352
+ duration: i.duration,
1353
+ durationMillis: i.durationMillis,
1354
+ fillDelayError: Sn(
1969
1355
  t,
1970
1356
  n,
1971
- a
1357
+ i
1972
1358
  ),
1973
- durationError: Hn(
1359
+ durationError: Pn(
1974
1360
  e.module,
1975
1361
  t,
1976
1362
  n,
1977
- a
1363
+ i
1978
1364
  )
1979
- }), Yn = (e, t, n) => {
1980
- const a = _n({
1981
- module: e.module,
1982
- marketPrice: n,
1983
- inputAmountWei: t,
1984
- triggerPrice: e.triggerPrice,
1985
- triggerPricePercent: e.triggerPricePercent,
1986
- isInverted: e.isInverted,
1987
- inputTokenDecimals: e.inputTokenDecimals,
1988
- outputTokenDecimals: e.outputTokenDecimals,
1989
- inputUsdPrice: e.inputUsdPrice,
1990
- outputUsdPrice: e.outputUsdPrice
1991
- }), s = e.module === _.LIMIT ? !1 : e.isMarketOrder, c = In({
1992
- module: e.module,
1993
- isMarketOrder: s,
1994
- marketPrice: n,
1995
- inputAmountWei: t,
1996
- limitPrice: e.limitPrice,
1997
- limitPricePercent: e.limitPricePercent,
1998
- triggerPrice: a.raw,
1999
- isInverted: e.isInverted,
2000
- inputTokenDecimals: e.inputTokenDecimals,
1365
+ }), jr = (e) => {
1366
+ const t = $n(e), n = t.raw, i = Dt({
1367
+ quotedOutputAmountRaw: e.quotedOutputAmountRaw,
1368
+ inputAmountUi: t.ui,
2001
1369
  outputTokenDecimals: e.outputTokenDecimals,
2002
- inputUsdPrice: e.inputUsdPrice,
2003
- outputUsdPrice: e.outputUsdPrice
2004
- });
2005
- return { isMarketOrder: s, triggerPrice: a, limitPrice: c };
2006
- }, Qn = (e, t, n, a, s, c) => {
2007
- const y = qn(
2008
- t,
2009
- e.minTradeSizeUsd
2010
- ), E = e.inputBalance && h(t.raw).gt(e.inputBalance) ? {
2011
- type: ee.INSUFFICIENT_BALANCE,
2012
- value: e.inputBalance
2013
- } : void 0, D = [
2014
- y,
2015
- c.triggerPrice.error,
2016
- c.limitPrice.error,
2017
- a.error,
2018
- s.fillDelayError,
2019
- s.durationError,
2020
- E
2021
- ].filter((g) => !!g), C = h(n || 0).gt(0) && h(t.raw || 0).gt(0) && h(e.inputUsdPrice || 0).gt(0), P = e.ignoreErrors || !C ? void 0 : D[0];
2022
- return {
2023
- errors: {
2024
- primary: P,
2025
- all: D,
2026
- minTradeSize: y,
2027
- triggerPrice: c.triggerPrice.error,
2028
- limitPrice: c.limitPrice.error,
2029
- trades: a.error,
2030
- fillDelay: s.fillDelayError,
2031
- duration: s.durationError,
2032
- balance: E
2033
- },
2034
- isReady: C,
2035
- canSubmit: C && !P
2036
- };
2037
- }, aa = (e) => {
2038
- const t = Gn(e), n = t.raw, a = Vn({
2039
- marketPrice: e.marketPrice,
2040
- quotedOutputAmount: e.quotedOutputAmount,
2041
- inputAmountWei: n,
2042
- inputTokenDecimals: e.inputTokenDecimals,
2043
- outputTokenDecimals: e.outputTokenDecimals,
2044
- outputUsdPrice: e.outputUsdPrice
2045
- }), s = a.raw, c = jn(
1370
+ outputUsdPrice: e.outputTokenUsdPrice
1371
+ }), a = i.raw, d = Kn(
2046
1372
  e,
2047
1373
  t,
2048
- s
2049
- ), y = Yn(e, n, s), E = Kn({
1374
+ a
1375
+ ), m = It(e, n, a), b = Un({
2050
1376
  module: e.module,
2051
1377
  inputTokenDecimals: e.inputTokenDecimals,
2052
1378
  totalInputAmount: n,
2053
- fillDelay: e.fillDelay,
2054
- duration: e.duration,
2055
- totalTrades: c.totalTrades,
2056
- priceProtection: e.priceProtection,
2057
- isMarketOrder: y.isMarketOrder,
2058
- marketPrice: s,
2059
- limitPrice: y.limitPrice.raw,
2060
- triggerPrice: y.triggerPrice.raw,
1379
+ fillDelay: e.userInput.tradeInterval,
1380
+ duration: e.userInput.orderDuration,
1381
+ totalTrades: d.totalTrades,
1382
+ priceProtectionPercent: e.priceProtectionPercent,
1383
+ isMarketOrder: m.isMarketOrder,
1384
+ marketPrice: a,
1385
+ limitPrice: m.limitPrice.raw,
1386
+ triggerPrice: m.triggerPrice.raw,
2061
1387
  displayFeePercent: e.displayFeePercent
2062
- }), D = Zn(
1388
+ }), D = Gn(
2063
1389
  e,
2064
1390
  n,
2065
- s,
2066
- E
2067
- ), C = Xn(e, c, E), P = Qn(
1391
+ a,
1392
+ b
1393
+ ), C = Vn(e, d, b), O = kn(
2068
1394
  e,
2069
1395
  t,
2070
- s,
2071
- c,
1396
+ a,
1397
+ d,
2072
1398
  D,
2073
- y
1399
+ m
2074
1400
  );
2075
1401
  return {
2076
1402
  module: e.module,
2077
- isInverted: !!e.isInverted,
1403
+ isInverted: !!e.userInput.isPriceInverted,
2078
1404
  inputAmount: t,
2079
1405
  outputAmount: Ae(
2080
- E.outputAmount,
1406
+ b.outputAmount,
2081
1407
  e.outputTokenDecimals,
2082
- e.outputUsdPrice
1408
+ e.outputTokenUsdPrice
2083
1409
  ),
2084
- marketPrice: a,
1410
+ marketPrice: i,
2085
1411
  trades: C,
2086
1412
  schedule: D,
2087
- triggerPrice: y.triggerPrice,
2088
- limitPrice: y.limitPrice,
1413
+ triggerPrice: m.triggerPrice,
1414
+ limitPrice: m.limitPrice,
2089
1415
  minOutputAmountTotal: Ae(
2090
- E.minOutputAmountTotal,
1416
+ b.minOutputAmountTotal,
2091
1417
  e.outputTokenDecimals,
2092
- e.outputUsdPrice
1418
+ e.outputTokenUsdPrice
2093
1419
  ),
2094
1420
  tradePrice: Ae(
2095
- E.tradePrice,
1421
+ b.tradePrice,
2096
1422
  e.outputTokenDecimals,
2097
- e.outputUsdPrice
1423
+ e.outputTokenUsdPrice
2098
1424
  ),
2099
1425
  fees: {
2100
1426
  ...Ae(
2101
- E.displayFeeAmount,
1427
+ b.displayFeeAmount,
2102
1428
  e.outputTokenDecimals,
2103
- e.outputUsdPrice
1429
+ e.outputTokenUsdPrice
2104
1430
  ),
2105
- percentage: E.displayFeePercent
1431
+ percentage: b.displayFeePercent
2106
1432
  },
2107
- values: E,
2108
- ...P
1433
+ values: b,
1434
+ ...O
2109
1435
  };
2110
- }, Jn = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"address","name":"_iweth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"name":"OrderBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"OrderCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"}],"name":"OrderCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcAmountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstAmountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcFilledAmount","type":"uint256"}],"name":"OrderFilled","type":"event"},{"inputs":[],"name":"MIN_BID_DELAY_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_OUTBID_PERCENT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_BASE","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STALE_BID_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_CANCELED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_COMPLETED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"_ask","type":"tuple"}],"name":"ask","outputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"bid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"book","outputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"fill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"iweth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"makerOrders","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"order","outputs":[{"components":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"internalType":"struct OrderLib.Order","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"maker","type":"address"}],"name":"orderIdsByMaker","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"prune","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"status","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]'), er = [
1436
+ }, qn = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"address","name":"_iweth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"name":"OrderBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"OrderCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"}],"name":"OrderCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcAmountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstAmountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcFilledAmount","type":"uint256"}],"name":"OrderFilled","type":"event"},{"inputs":[],"name":"MIN_BID_DELAY_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_OUTBID_PERCENT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_BASE","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STALE_BID_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_CANCELED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_COMPLETED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"_ask","type":"tuple"}],"name":"ask","outputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"bid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"book","outputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"fill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"iweth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"makerOrders","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"order","outputs":[{"components":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"internalType":"struct OrderLib.Order","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"maker","type":"address"}],"name":"orderIdsByMaker","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"prune","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"status","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]'), Wn = [
2111
1437
  {
2112
1438
  type: "constructor",
2113
1439
  inputs: [],
@@ -2419,37 +1745,39 @@ const ye = (e) => e ? e.value * e.unit : 0, un = (e) => !e || e === "NaN" ? "0"
2419
1745
  }
2420
1746
  ]
2421
1747
  }
2422
- ], tr = er, nr = Jn, rr = 0.7, ar = `https://bi.orbs.network/putes/twap-ui-${rr}`;
2423
- let _e = "unknown";
2424
- function sa(e) {
2425
- _e = e;
1748
+ ], zn = Wn, jn = qn, Xn = "2.8.1", ve = {
1749
+ version: Xn
1750
+ }, Hn = 0.7, Yn = `https://bi.orbs.network/putes/twap-ui-${Hn}`;
1751
+ let Pe = "unknown";
1752
+ function Xr(e) {
1753
+ Pe = e;
2426
1754
  }
2427
- function Pe() {
1755
+ function we() {
2428
1756
  const e = Math.random().toString(36).substring(2, 16), t = Math.random().toString(36).substring(2, 16), n = Date.now().toString(36);
2429
1757
  return `id_${e + t + n}`;
2430
1758
  }
2431
- const sr = (e, t, n) => ({
2432
- spotVersion: Ne.version,
1759
+ const Zn = (e, t, n) => ({
1760
+ spotVersion: ve.version,
2433
1761
  partner: e,
2434
1762
  chainId: n || 0,
2435
1763
  minChunkSizeUsd: t
2436
- }), ir = (e, t, n, a) => {
2437
- const { witness: s } = e.order, c = pt.config(
1764
+ }), Qn = (e, t, n, i) => {
1765
+ const { witness: a } = e.order, d = Ge.config(
2438
1766
  e.domain.chainId,
2439
1767
  t
2440
1768
  );
2441
1769
  return {
2442
- spotVersion: Ne.version,
1770
+ spotVersion: ve.version,
2443
1771
  partner: t,
2444
- cosigner: c == null ? void 0 : c.cosigner,
2445
- fee: c == null ? void 0 : c.fee,
2446
- refinery: c == null ? void 0 : c.refinery,
2447
- router: c == null ? void 0 : c.router,
2448
- type: c == null ? void 0 : c.type,
2449
- wm: c == null ? void 0 : c.wm,
2450
- adapter: s.exchange.adapter,
2451
- executor: s.executor,
2452
- reactor: s.reactor,
1772
+ cosigner: d == null ? void 0 : d.cosigner,
1773
+ fee: d == null ? void 0 : d.fee,
1774
+ refinery: d == null ? void 0 : d.refinery,
1775
+ router: d == null ? void 0 : d.router,
1776
+ type: d == null ? void 0 : d.type,
1777
+ wm: d == null ? void 0 : d.wm,
1778
+ adapter: a.exchange.adapter,
1779
+ executor: a.executor,
1780
+ reactor: a.reactor,
2453
1781
  repermit: e.domain.verifyingContract,
2454
1782
  chainId: e.domain.chainId,
2455
1783
  chainName: (n == null ? void 0 : n.chainName) || "",
@@ -2457,15 +1785,15 @@ const sr = (e, t, n) => ({
2457
1785
  twapAddress: (n == null ? void 0 : n.twapAddress) || "",
2458
1786
  lensAddress: (n == null ? void 0 : n.lensAddress) || "",
2459
1787
  bidDelaySeconds: (n == null ? void 0 : n.bidDelaySeconds) || 0,
2460
- minChunkSizeUsd: a || 0,
1788
+ minChunkSizeUsd: i || 0,
2461
1789
  name: (n == null ? void 0 : n.name) || "",
2462
1790
  exchangeAddress: (n == null ? void 0 : n.exchangeAddress) || "",
2463
1791
  exchangeType: (n == null ? void 0 : n.exchangeType) || "",
2464
1792
  pathfinderKey: (n == null ? void 0 : n.pathfinderKey) || ""
2465
1793
  };
2466
- }, Oe = async (e) => {
1794
+ }, Se = async (e) => {
2467
1795
  try {
2468
- await fetch(ar, {
1796
+ await fetch(Yn, {
2469
1797
  method: "POST",
2470
1798
  headers: {
2471
1799
  Accept: "application/json",
@@ -2476,27 +1804,42 @@ const sr = (e, t, n) => ({
2476
1804
  } catch (t) {
2477
1805
  console.error("Failed to send BI", t);
2478
1806
  }
1807
+ }, it = (e) => {
1808
+ try {
1809
+ if (typeof e == "string" && e.trim())
1810
+ return e.toLowerCase();
1811
+ if (typeof e == "object" && e !== null) {
1812
+ const t = Reflect.get(e, "message");
1813
+ if (typeof t == "string" && t.trim())
1814
+ return t.toLowerCase();
1815
+ const n = Reflect.get(e, "code");
1816
+ if (typeof n == "string" || typeof n == "number")
1817
+ return String(n).toLowerCase();
1818
+ }
1819
+ } catch {
1820
+ }
1821
+ return "unknown error";
2479
1822
  };
2480
- class or {
1823
+ class Jn {
2481
1824
  constructor() {
2482
- he(this, "timeout");
2483
- he(this, "configDetails", {});
2484
- he(this, "configUpdateKey", "");
2485
- he(this, "moduleImportKey", "");
2486
- he(this, "data", {
2487
- _id: Pe()
1825
+ Ee(this, "timeout");
1826
+ Ee(this, "configDetails", {});
1827
+ Ee(this, "configUpdateKey", "");
1828
+ Ee(this, "moduleImportKey", "");
1829
+ Ee(this, "data", {
1830
+ _id: we()
2488
1831
  });
2489
1832
  }
2490
- async updateAndSend(t = {}, n = !1, a) {
1833
+ async updateAndSend(t = {}, n = !1, i) {
2491
1834
  try {
2492
1835
  this.data = {
2493
1836
  ...this.data,
2494
1837
  ...t
2495
- }, n ? (await Oe(this.data), a == null || a()) : (clearTimeout(this.timeout), this.timeout = setTimeout(() => {
2496
- Oe(this.data), a == null || a();
1838
+ }, n ? (await Se(this.data), i == null || i()) : (clearTimeout(this.timeout), this.timeout = setTimeout(() => {
1839
+ Se(this.data), i == null || i();
2497
1840
  }, 1e3));
2498
- } catch (s) {
2499
- console.error("Failed to update and send BI", s);
1841
+ } catch (a) {
1842
+ console.error("Failed to update and send BI", a);
2500
1843
  }
2501
1844
  }
2502
1845
  onCancelOrderRequest(t, n) {
@@ -2545,54 +1888,53 @@ class or {
2545
1888
  this.onTxError(t);
2546
1889
  }
2547
1890
  onCrash(t) {
2548
- var n;
2549
- this.updateAndSend({ action: "crash", actionError: ((n = t == null ? void 0 : t.message) == null ? void 0 : n.toLowerCase()) || (t == null ? void 0 : t.toLowerCase()) });
1891
+ this.updateAndSend({
1892
+ action: "crash",
1893
+ actionError: it(t)
1894
+ });
2550
1895
  }
2551
1896
  onTxError(t) {
2552
- var a;
2553
- const n = ((a = t == null ? void 0 : t.message) == null ? void 0 : a.toLowerCase()) || (t == null ? void 0 : t.toLowerCase());
2554
- this.updateAndSend({ actionError: n });
1897
+ this.updateAndSend({ actionError: it(t) });
2555
1898
  }
2556
1899
  onRequestOrder({
2557
1900
  account: t,
2558
1901
  chainId: n,
2559
- module: a,
2560
- srcToken: s,
2561
- dstToken: c,
2562
- fromTokenAmount: y,
2563
- srcChunkAmount: E,
1902
+ module: i,
1903
+ srcToken: a,
1904
+ dstToken: d,
1905
+ fromTokenAmount: m,
1906
+ srcChunkAmount: b,
2564
1907
  minDstAmountOutPerTrade: D = "",
2565
1908
  triggerPricePerTrade: C = "",
2566
- deadline: P,
1909
+ deadline: O,
2567
1910
  fillDelay: F,
2568
- slippage: g,
2569
- isMarketOrder: S,
2570
- chunksAmount: w
1911
+ slippage: h,
1912
+ isMarketOrder: w,
1913
+ chunksAmount: B
2571
1914
  }) {
2572
1915
  this.updateAndSend({
2573
- toTokenAddress: c.address,
2574
- toTokenSymbol: c.symbol,
2575
- fromTokenAddress: s.address,
2576
- fromTokenSymbol: s.symbol,
2577
- fromTokenAmount: y,
2578
- chunksAmount: w,
2579
- srcChunkAmount: E,
1916
+ toTokenAddress: d.address,
1917
+ toTokenSymbol: d.symbol,
1918
+ fromTokenAddress: a.address,
1919
+ fromTokenSymbol: a.symbol,
1920
+ fromTokenAmount: m,
1921
+ chunksAmount: B,
1922
+ srcChunkAmount: b,
2580
1923
  minDstAmountOutPerTrade: D,
2581
1924
  triggerPricePerTrade: C,
2582
- deadline: P,
1925
+ deadline: O,
2583
1926
  fillDelay: F,
2584
- slippage: g,
1927
+ slippage: h,
2585
1928
  chainId: n,
2586
1929
  walletAddress: t,
2587
- module: a,
2588
- orderType: S ? "market" : "limit",
1930
+ module: i,
1931
+ orderType: w ? "market" : "limit",
2589
1932
  actionError: void 0
2590
1933
  });
2591
1934
  }
2592
1935
  onSignOrderRequest(t) {
2593
1936
  this.updateAndSend({
2594
- action: "sign order",
2595
- order: t
1937
+ action: "sign order"
2596
1938
  });
2597
1939
  }
2598
1940
  onSignOrderError(t) {
@@ -2600,39 +1942,38 @@ class or {
2600
1942
  }
2601
1943
  onSignOrderSuccess(t) {
2602
1944
  this.updateAndSend({
2603
- action: "sign order",
2604
- signature: t
1945
+ action: "sign order"
2605
1946
  });
2606
1947
  }
2607
- init(t, n, a, s) {
2608
- const c = `${t}:${a || 0}:${s || ""}`;
2609
- if (c !== this.moduleImportKey) {
2610
- this.moduleImportKey = c;
2611
- const y = {
2612
- _id: Pe(),
1948
+ init(t, n, i, a) {
1949
+ const d = `${t}:${i || 0}:${a || ""}`;
1950
+ if (d !== this.moduleImportKey) {
1951
+ this.moduleImportKey = d;
1952
+ const m = {
1953
+ _id: we(),
2613
1954
  action: "module-import",
2614
- uiVersion: _e,
2615
- appId: s,
2616
- ...sr(t, n, a),
1955
+ uiVersion: Pe,
1956
+ appId: a,
1957
+ ...Zn(t, n, i),
2617
1958
  origin: window.location.origin
2618
1959
  };
2619
- this.configDetails.partner === t && this.configDetails.chainId === (a || 0) || (this.configDetails = {}), this.data = { ...y, ...this.configDetails }, Oe(y);
1960
+ this.configDetails.partner === t && this.configDetails.chainId === (i || 0) || (this.configDetails = {}), this.data = { ...m, ...this.configDetails }, Se(m);
2620
1961
  }
2621
1962
  }
2622
- onFetchedConfig(t, n, a, s) {
2623
- const c = ir(
1963
+ onFetchedConfig(t, n, i, a) {
1964
+ const d = Qn(
2624
1965
  t,
2625
1966
  n,
2626
- a,
2627
- s
2628
- ), y = `${n}:${c.chainId}:${c.repermit}:${c.adapter}:${c.executor}:${c.reactor}`;
2629
- y !== this.configUpdateKey && (this.configUpdateKey = y, this.configDetails = c, this.data = { ...this.data, ...c }, Oe({
2630
- _id: Pe(),
1967
+ i,
1968
+ a
1969
+ ), m = `${n}:${d.chainId}:${d.repermit}:${d.adapter}:${d.executor}:${d.reactor}`;
1970
+ m !== this.configUpdateKey && (this.configUpdateKey = m, this.configDetails = d, this.data = { ...this.data, ...d }, Se({
1971
+ _id: we(),
2631
1972
  action: "config-update",
2632
- uiVersion: _e,
1973
+ uiVersion: Pe,
2633
1974
  appId: this.data.appId,
2634
1975
  origin: typeof window > "u" ? void 0 : window.location.origin,
2635
- ...c
1976
+ ...d
2636
1977
  }));
2637
1978
  }
2638
1979
  onCreateOrderError(t) {
@@ -2652,12 +1993,12 @@ class or {
2652
1993
  void 0,
2653
1994
  () => {
2654
1995
  this.data = {
2655
- _id: Pe(),
1996
+ _id: we(),
2656
1997
  action: "reset",
2657
- uiVersion: _e,
1998
+ uiVersion: Pe,
2658
1999
  appId: this.data.appId,
2659
2000
  origin: this.data.origin,
2660
- spotVersion: Ne.version,
2001
+ spotVersion: ve.version,
2661
2002
  partner: this.data.partner,
2662
2003
  adapter: this.data.adapter,
2663
2004
  cosigner: this.data.cosigner,
@@ -2685,156 +2026,170 @@ class or {
2685
2026
  );
2686
2027
  }
2687
2028
  }
2688
- const Ee = new or(), cr = async (e, t) => {
2029
+ const me = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order-sink-v2.orbs.network", Xe = ve.version.split(".")[0], er = () => Number(Xe) >= 2 ? Ie : _e, tr = () => `${Ie}/config`, nr = () => Number(Xe) >= 2 ? [Ie, _e] : [_e], rr = {
2030
+ [Q.Thena]: ["0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67"],
2031
+ [Q.Katana]: ["0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df"]
2032
+ }, ar = ({
2033
+ endpoint: e,
2034
+ exchange: t,
2035
+ partner: n
2036
+ }) => {
2037
+ const a = [_e, Ie].includes(
2038
+ e
2039
+ ) && n ? rr[n] || [] : [], d = t ? [t, ...a] : a;
2040
+ return d.filter(
2041
+ (m, b) => d.findIndex(
2042
+ (D) => D.toLowerCase() === m.toLowerCase()
2043
+ ) === b
2044
+ );
2045
+ }, ir = async (e, t) => {
2689
2046
  const n = new URLSearchParams({
2690
2047
  partner: e,
2691
2048
  chain: t.toString()
2692
- }), a = await fetch(`${Xt()}?${n}`);
2693
- if (!a.ok) {
2694
- const s = await a.text();
2049
+ }), i = await fetch(`${tr()}?${n}`);
2050
+ if (!i.ok) {
2051
+ const a = await i.text();
2695
2052
  throw new Error(
2696
- `Failed to fetch RePermit data for partner "${e}" on chain ${t}: ${a.status}${s ? ` ${s}` : ""}`
2053
+ `Failed to fetch RePermit data for partner "${e}" on chain ${t}: ${i.status}${a ? ` ${a}` : ""}`
2697
2054
  );
2698
2055
  }
2699
- return a.json();
2700
- }, dr = ({
2701
- chainId: e,
2702
- inputTokenAddress: t,
2703
- outputTokenAddress: n,
2704
- totalInputAmount: a,
2705
- nonce: s,
2706
- currentTimeMillis: c,
2707
- deadlineMillis: y,
2708
- fillDelayMillis: E,
2709
- totalTrades: D,
2710
- slippageBps: C,
2711
- swapperAddress: P,
2712
- inputAmountPerTrade: F,
2713
- minOutputAmountPerTrade: g = "0",
2714
- triggerOutputAmountPerTrade: S = "0",
2056
+ return i.json();
2057
+ }, sr = ({
2058
+ inputTokenAddress: e,
2059
+ outputTokenAddress: t,
2060
+ totalInputAmount: n,
2061
+ nonce: i,
2062
+ currentTimeMillis: a,
2063
+ deadlineMillis: d,
2064
+ fillDelayMillis: m,
2065
+ totalTrades: b,
2066
+ slippageBps: D,
2067
+ swapperAddress: C,
2068
+ inputAmountPerTrade: O,
2069
+ minOutputAmountPerTrade: F = "0",
2070
+ triggerOutputAmountPerTrade: h = "0",
2715
2071
  permitData: w,
2716
- module: $
2072
+ module: B
2717
2073
  }) => {
2718
- var i;
2719
- const K = !D || D === 1 ? 0 : parseInt((E / 1e3).toFixed(0)), q = un(y / 1e3), T = 60, Te = Math.floor(c / 1e3).toString(), De = Le(t) ? ((i = Ce(e)) == null ? void 0 : i.wToken.address) || "" : t, Fe = h(g || 0).toFixed(), Y = h(
2720
- $ === _.STOP_LOSS && S || 0
2721
- ).toFixed(), ie = h(
2722
- $ === _.TAKE_PROFIT && S || 0
2723
- ).toFixed(), r = {
2074
+ const V = !b || b === 1 ? 0 : parseInt((m / 1e3).toFixed(0)), K = yn(d / 1e3), z = 60, g = Math.floor(a / 1e3).toString(), Te = x(F || 0).toFixed(), De = x(
2075
+ B === v.STOP_LOSS && h || 0
2076
+ ).toFixed(), xe = x(
2077
+ B === v.TAKE_PROFIT && h || 0
2078
+ ).toFixed(), Y = {
2724
2079
  ...w.order,
2725
2080
  permitted: {
2726
2081
  ...w.order.permitted,
2727
- token: De,
2728
- amount: a
2082
+ token: e,
2083
+ amount: n
2729
2084
  },
2730
- nonce: s,
2731
- deadline: q,
2085
+ nonce: i,
2086
+ deadline: K,
2732
2087
  witness: {
2733
2088
  ...w.order.witness,
2734
- swapper: P,
2735
- nonce: s,
2736
- start: Te,
2737
- deadline: q,
2738
- epoch: K,
2739
- slippage: C,
2740
- freshness: T,
2089
+ swapper: C,
2090
+ nonce: i,
2091
+ start: g,
2092
+ deadline: K,
2093
+ epoch: V,
2094
+ slippage: D,
2095
+ freshness: z,
2741
2096
  input: {
2742
2097
  ...w.order.witness.input,
2743
- token: De,
2744
- amount: F,
2745
- maxAmount: a
2098
+ token: e,
2099
+ amount: O,
2100
+ maxAmount: n
2746
2101
  },
2747
2102
  output: {
2748
2103
  ...w.order.witness.output,
2749
- token: n,
2750
- limit: Fe,
2751
- triggerLower: Y,
2752
- triggerUpper: ie,
2753
- recipient: P
2104
+ token: t,
2105
+ limit: Te,
2106
+ triggerLower: De,
2107
+ triggerUpper: xe,
2108
+ recipient: C
2754
2109
  }
2755
2110
  }
2756
2111
  };
2757
2112
  return {
2758
2113
  ...w,
2759
- order: r
2114
+ order: Y
2760
2115
  };
2761
- }, fe = (e, t) => e && e.length ? e.map(t || ((n) => `${n}`)) : void 0, lr = (e) => {
2116
+ }, fe = (e, t) => e && e.length ? e.map(t || ((n) => `${n}`)) : void 0, or = (e) => {
2762
2117
  if (e)
2763
- return tn[e];
2764
- }, Ye = (e, t) => {
2118
+ return on[e];
2119
+ }, He = (e, t) => {
2765
2120
  if (!e || typeof e != "object")
2766
2121
  throw new Error("Invalid subgraph response");
2767
2122
  const n = e.data;
2768
2123
  if (!n || typeof n != "object")
2769
2124
  throw new Error("Invalid subgraph response: missing data");
2770
- const a = n[t];
2771
- if (!Array.isArray(a))
2125
+ const i = n[t];
2126
+ if (!Array.isArray(i))
2772
2127
  throw new Error(`Invalid subgraph response: missing ${t}`);
2773
- return a;
2774
- }, Qe = async ({
2128
+ return i;
2129
+ }, Ye = async ({
2775
2130
  chainId: e,
2776
2131
  buildQuery: t,
2777
2132
  extractResults: n,
2778
- signal: a,
2779
- retries: s = 1,
2780
- limit: c = 1e3,
2781
- page: y
2133
+ signal: i,
2134
+ retries: a = 1,
2135
+ limit: d = 1e3,
2136
+ page: m
2782
2137
  }) => {
2783
- const E = lr(e);
2784
- if (!E) throw new Et();
2138
+ const b = or(e);
2139
+ if (!b) throw new Et();
2785
2140
  const D = async (F) => {
2786
- let g = 0;
2787
- for (; g <= s; )
2141
+ let h = 0;
2142
+ for (; h <= a; )
2788
2143
  try {
2789
- const S = await fetch(E, {
2144
+ const w = await fetch(b, {
2790
2145
  method: "POST",
2791
2146
  body: JSON.stringify({ query: F }),
2792
- signal: a,
2147
+ signal: i,
2793
2148
  headers: { "Content-Type": "application/json" }
2794
2149
  });
2795
- if (!S.ok) throw new Error(`HTTP error: ${S.status}`);
2796
- const w = await S.json(), $ = w && typeof w == "object" ? w.errors : void 0;
2797
- if (Array.isArray($) && $.length) {
2798
- const K = $[0], q = K && typeof K == "object" ? K.message : void 0;
2150
+ if (!w.ok) throw new Error(`HTTP error: ${w.status}`);
2151
+ const B = await w.json(), V = B && typeof B == "object" ? B.errors : void 0;
2152
+ if (Array.isArray(V) && V.length) {
2153
+ const K = V[0], z = K && typeof K == "object" ? K.message : void 0;
2799
2154
  throw new Error(
2800
- typeof q == "string" ? q : "Subgraph request failed"
2155
+ typeof z == "string" ? z : "Subgraph request failed"
2801
2156
  );
2802
2157
  }
2803
- return n(w);
2804
- } catch (S) {
2805
- if (a != null && a.aborted || S instanceof Error && S.name === "AbortError" || g === s) throw S;
2806
- await new Promise((w) => setTimeout(w, 500 * 2 ** g)), g++;
2158
+ return n(B);
2159
+ } catch (w) {
2160
+ if (i != null && i.aborted || w instanceof Error && w.name === "AbortError" || h === a) throw w;
2161
+ await new Promise((B) => setTimeout(B, 500 * 2 ** h)), h++;
2807
2162
  }
2808
2163
  return [];
2809
2164
  };
2810
2165
  let C = 0;
2811
- const P = [];
2812
- if (y !== void 0) {
2813
- const F = t(y, c);
2166
+ const O = [];
2167
+ if (m !== void 0) {
2168
+ const F = t(m, d);
2814
2169
  return D(F);
2815
2170
  }
2816
2171
  for (; ; ) {
2817
- const F = t(C, c), g = await D(F);
2818
- if (P.push(...g), g.length < c) break;
2172
+ const F = t(C, d), h = await D(F);
2173
+ if (O.push(...h), h.length < d) break;
2819
2174
  C++;
2820
2175
  }
2821
- return P;
2822
- }, ht = (e) => e.map((t) => ({
2176
+ return O;
2177
+ }, yt = (e) => e.map((t) => ({
2823
2178
  inAmount: t.srcAmountIn,
2824
2179
  outAmount: t.dstAmountOut,
2825
2180
  timestamp: t.timestamp,
2826
2181
  txHash: t.transactionHash
2827
- })), ot = (e, t) => {
2828
- const n = h(e || 0).gt(1);
2182
+ })), st = (e, t) => {
2183
+ const n = x(e || 0).gt(1);
2829
2184
  return !n && t === 1 ? N.TWAP_MARKET : t > 1 && n ? N.TWAP_LIMIT : n ? N.LIMIT : N.TWAP_MARKET;
2830
- }, ur = (e, t, n, a) => {
2831
- const s = ht(n || []), c = new h(e.ask_srcBidAmount || 0), y = c.gt(0) ? Math.max(
2185
+ }, dr = (e, t, n, i) => {
2186
+ const a = yt(n || []), d = new x(e.ask_srcBidAmount || 0), m = d.gt(0) ? Math.max(
2832
2187
  1,
2833
- new h(e.ask_srcAmount || 0).div(c).integerValue(h.ROUND_CEIL).toNumber()
2834
- ) : 1, D = (n == null ? void 0 : n.length) >= y ? s.reduce(
2835
- (S, w) => Math.max(S, w.timestamp),
2188
+ new x(e.ask_srcAmount || 0).div(d).integerValue(x.ROUND_CEIL).toNumber()
2189
+ ) : 1, D = (n == null ? void 0 : n.length) >= m ? a.reduce(
2190
+ (w, B) => Math.max(w, B.timestamp),
2836
2191
  0
2837
- ) : void 0, C = s.reduce((S, w) => S.plus(w.inAmount), new h(0)).toFixed(), P = s.reduce((S, w) => S.plus(w.outAmount), new h(0)).toFixed(), F = gt(e.ask_srcAmount, C), g = ot(e.ask_dstMinAmount, y);
2192
+ ) : void 0, C = a.reduce((w, B) => w.plus(B.inAmount), new x(0)).toFixed(), O = a.reduce((w, B) => w.plus(B.outAmount), new x(0)).toFixed(), F = mt(e.ask_srcAmount, C), h = st(e.ask_dstMinAmount, m);
2838
2193
  return {
2839
2194
  repermitDigest: "",
2840
2195
  version: 1,
@@ -2842,95 +2197,95 @@ const Ee = new or(), cr = async (e, t) => {
2842
2197
  isTriggerPrice: !1,
2843
2198
  id: e.Contract_id.toString(),
2844
2199
  hash: "",
2845
- type: ot(e.ask_dstMinAmount, y),
2200
+ type: st(e.ask_dstMinAmount, m),
2846
2201
  srcTokenAddress: e.ask_srcToken,
2847
2202
  dstTokenAddress: e.ask_dstToken,
2848
2203
  exchangeAddress: e.exchange,
2849
2204
  twapAddress: e.twapAddress,
2850
2205
  maker: e.maker,
2851
2206
  progress: F,
2852
- dstAmountFilled: P,
2207
+ dstAmountFilled: O,
2853
2208
  srcAmountFilled: C,
2854
- orderDollarValueIn: h(e.dollarValueIn || 0).toFixed(6),
2209
+ orderDollarValueIn: x(e.dollarValueIn || 0).toFixed(6),
2855
2210
  srcAmount: e.ask_srcAmount,
2856
- dstMinAmountTotal: h(e.ask_dstMinAmount).multipliedBy(y).toString(),
2857
- fills: s,
2211
+ dstMinAmountTotal: x(e.ask_dstMinAmount).multipliedBy(m).toString(),
2212
+ fills: a,
2858
2213
  fillDelay: e.ask_fillDelay,
2859
2214
  deadline: e.ask_deadline * 1e3,
2860
2215
  createdAt: new Date(e.timestamp).getTime(),
2861
- dstMinAmountPerTrade: h(e.ask_dstMinAmount).eq(1) ? "" : e.ask_dstMinAmount,
2216
+ dstMinAmountPerTrade: x(e.ask_dstMinAmount).eq(1) ? "" : e.ask_dstMinAmount,
2862
2217
  triggerPricePerTrade: "",
2863
2218
  srcAmountPerTrade: e.ask_srcBidAmount,
2864
2219
  txHash: e.transactionHash,
2865
- totalTradesAmount: y,
2866
- isMarketPrice: [N.TWAP_MARKET].includes(g),
2220
+ totalTradesAmount: m,
2221
+ isMarketPrice: [N.TWAP_MARKET].includes(h),
2867
2222
  chainId: t,
2868
2223
  filledOrderTimestamp: D || 0,
2869
- status: a,
2224
+ status: i,
2870
2225
  rawOrder: e
2871
2226
  };
2872
- }, pr = (e) => {
2227
+ }, cr = (e) => {
2873
2228
  var F;
2874
2229
  if (!e) return "";
2875
2230
  const t = fe(
2876
2231
  e.accounts,
2877
- (g) => `"${g.toLowerCase()}"`
2232
+ (h) => `"${h.toLowerCase()}"`
2878
2233
  ), n = fe(
2879
- pn(e.configs),
2880
- (g) => `"${g.toLowerCase()}"`
2881
- ), a = fe(
2234
+ En(e.configs),
2235
+ (h) => `"${h.toLowerCase()}"`
2236
+ ), i = fe(
2882
2237
  e.inTokenSymbols,
2883
- (g) => `"${g.toUpperCase()}"`
2884
- ), s = fe(
2238
+ (h) => `"${h.toUpperCase()}"`
2239
+ ), a = fe(
2885
2240
  e.outTokenSymbols,
2886
- (g) => `"${g.toUpperCase()}"`
2887
- ), c = fe(
2241
+ (h) => `"${h.toUpperCase()}"`
2242
+ ), d = fe(
2888
2243
  e.inTokenAddresses,
2889
- (g) => `"${g.toLowerCase()}"`
2890
- ), y = fe(
2244
+ (h) => `"${h.toLowerCase()}"`
2245
+ ), m = fe(
2891
2246
  e.outTokenAddresses,
2892
- (g) => `"${g.toLowerCase()}"`
2893
- ), E = fe(
2247
+ (h) => `"${h.toLowerCase()}"`
2248
+ ), b = fe(
2894
2249
  e.transactionHashes,
2895
- (g) => `"${g.toLowerCase()}"`
2896
- ), D = fe(e.orderIds, (g) => `"${g}"`), C = n != null && n.length ? "" : fe(
2897
- (F = e.configs) == null ? void 0 : F.map((g) => g.twapAddress),
2898
- (g) => `"${g.toLowerCase()}"`
2899
- ), P = e.minDollarValueIn;
2250
+ (h) => `"${h.toLowerCase()}"`
2251
+ ), D = fe(e.orderIds, (h) => `"${h}"`), C = n != null && n.length ? "" : fe(
2252
+ (F = e.configs) == null ? void 0 : F.map((h) => h.twapAddress),
2253
+ (h) => `"${h.toLowerCase()}"`
2254
+ ), O = e.minDollarValueIn;
2900
2255
  return [
2901
2256
  n ? `exchange_in: [${n.join(", ")}]` : "",
2902
2257
  C ? `twapAddress_in: [${C.join(", ")}]` : "",
2903
2258
  t ? `maker_in: [${t.join(", ")}]` : "",
2904
- E ? `transactionHash_in: [${E.join(", ")}]` : "",
2259
+ b ? `transactionHash_in: [${b.join(", ")}]` : "",
2905
2260
  D ? `Contract_id_in: [${D.join(", ")}]` : "",
2906
- P ? `dollarValueIn_gte: ${P}` : "",
2907
- a ? `srcTokenSymbol_in: [${a.join(", ")}]` : "",
2908
- s ? `dstTokenSymbol_in: [${s.join(", ")}]` : "",
2909
- c ? `srcTokenAddress_in: [${c.join(", ")}]` : "",
2910
- y ? `dstTokenAddress_in: [${y.join(", ")}]` : "",
2261
+ O ? `dollarValueIn_gte: ${O}` : "",
2262
+ i ? `srcTokenSymbol_in: [${i.join(", ")}]` : "",
2263
+ a ? `dstTokenSymbol_in: [${a.join(", ")}]` : "",
2264
+ d ? `srcTokenAddress_in: [${d.join(", ")}]` : "",
2265
+ m ? `dstTokenAddress_in: [${m.join(", ")}]` : "",
2911
2266
  e != null && e.startDate ? `blockTimestamp_gte: ${e.startDate}` : "",
2912
2267
  e != null && e.endDate ? `blockTimestamp_lte: ${e.endDate}` : "",
2913
2268
  (e == null ? void 0 : e.orderType) === "limit" ? "ask_dstMinAmount_gt: 1" : "",
2914
2269
  (e == null ? void 0 : e.orderType) === "market" ? "ask_dstMinAmount_lte: 1" : ""
2915
2270
  ].filter(Boolean).join(", ");
2916
2271
  };
2917
- async function fr({
2272
+ async function ur({
2918
2273
  chainId: e,
2919
2274
  signal: t,
2920
2275
  page: n,
2921
- limit: a,
2922
- filters: s
2276
+ limit: i,
2277
+ filters: a
2923
2278
  }) {
2924
- const c = a || 1e3, y = pr(s);
2925
- return await Qe({
2279
+ const d = i || 1e3, m = cr(a);
2280
+ return await Ye({
2926
2281
  chainId: e,
2927
2282
  signal: t,
2928
- limit: c,
2283
+ limit: d,
2929
2284
  page: n,
2930
2285
  buildQuery: (D, C) => `
2931
2286
  {
2932
2287
  orderCreateds(
2933
- ${y ? `where: { ${y} },` : ""}
2288
+ ${m ? `where: { ${m} },` : ""}
2934
2289
  first: ${C},
2935
2290
  skip: ${D * C},
2936
2291
  orderBy: timestamp,
@@ -2962,28 +2317,28 @@ async function fr({
2962
2317
  }
2963
2318
  }
2964
2319
  `,
2965
- extractResults: (D) => Ye(D, "orderCreateds")
2320
+ extractResults: (D) => He(D, "orderCreateds")
2966
2321
  });
2967
2322
  }
2968
- const mr = async ({
2323
+ const lr = async ({
2969
2324
  chainId: e,
2970
2325
  orders: t,
2971
2326
  signal: n
2972
2327
  }) => {
2973
2328
  if (t.length === 0) return [];
2974
- const a = je(t.map((E) => E.Contract_id.toString()));
2975
- if (!a.length) return [];
2976
- const c = `where: { twapId_in: [${a.map((E) => `"${E}"`).join(", ")}]}`;
2977
- return await Qe({
2329
+ const i = qe(t.map((b) => b.Contract_id.toString()));
2330
+ if (!i.length) return [];
2331
+ const d = `where: { twapId_in: [${i.map((b) => `"${b}"`).join(", ")}]}`;
2332
+ return await Ye({
2978
2333
  chainId: e,
2979
2334
  signal: n,
2980
2335
  limit: 1e3,
2981
- buildQuery: (E, D) => `
2336
+ buildQuery: (b, D) => `
2982
2337
  {
2983
2338
  statusNews(
2984
2339
  first: ${D},
2985
- skip: ${E * D},
2986
- ${c}
2340
+ skip: ${b * D},
2341
+ ${d}
2987
2342
  ) {
2988
2343
  twapId
2989
2344
  twapAddress
@@ -2991,30 +2346,30 @@ const mr = async ({
2991
2346
  }
2992
2347
  }
2993
2348
  `,
2994
- extractResults: (E) => Ye(E, "statusNews")
2349
+ extractResults: (b) => He(b, "statusNews")
2995
2350
  });
2996
2351
  };
2997
- function je(e) {
2352
+ function qe(e) {
2998
2353
  return Array.from(new Set(e));
2999
2354
  }
3000
- const Ar = async ({
2355
+ const fr = async ({
3001
2356
  chainId: e,
3002
2357
  orders: t,
3003
2358
  signal: n
3004
2359
  }) => {
3005
- const a = je(t.map((F) => F.Contract_id)), s = je(t.map((F) => F.twapAddress)).filter(Boolean);
3006
- if (a.length === 0) return [];
3007
- const c = a.join(", "), y = s.map((F) => `"${F}"`).join(", "), E = s.length ? `twapAddress_in: [${y}]` : "", C = `where: { ${[
3008
- `TWAP_id_in: [${c}]`,
3009
- E
2360
+ const i = qe(t.map((F) => F.Contract_id)), a = qe(t.map((F) => F.twapAddress)).filter(Boolean);
2361
+ if (i.length === 0) return [];
2362
+ const d = i.join(", "), m = a.map((F) => `"${F}"`).join(", "), b = a.length ? `twapAddress_in: [${m}]` : "", C = `where: { ${[
2363
+ `TWAP_id_in: [${d}]`,
2364
+ b
3010
2365
  ].filter(Boolean).join(", ")} }`;
3011
- return await Qe({
2366
+ return await Ye({
3012
2367
  chainId: e,
3013
2368
  signal: n,
3014
2369
  limit: 1e3,
3015
- buildQuery: (F, g) => `
2370
+ buildQuery: (F, h) => `
3016
2371
  {
3017
- orderFilleds(first: ${g}, orderBy: timestamp, skip: ${F * g}, ${C}) {
2372
+ orderFilleds(first: ${h}, orderBy: timestamp, skip: ${F * h}, ${C}) {
3018
2373
  id
3019
2374
  dstAmountOut
3020
2375
  dstFee
@@ -3030,9 +2385,9 @@ const Ar = async ({
3030
2385
  }
3031
2386
  }
3032
2387
  `,
3033
- extractResults: (F) => Ye(F, "orderFilleds").map((g) => ({
3034
- ...g,
3035
- timestamp: new Date(g.timestamp).getTime()
2388
+ extractResults: (F) => He(F, "orderFilleds").map((h) => ({
2389
+ ...h,
2390
+ timestamp: new Date(h.timestamp).getTime()
3036
2391
  }))
3037
2392
  });
3038
2393
  };
@@ -3041,277 +2396,277 @@ class Et extends Error {
3041
2396
  super("No graph endpoint found"), this.name = "NoGraphEndpointError";
3042
2397
  }
3043
2398
  }
3044
- const br = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "number" && Number.isFinite(e.Contract_id)) && typeof e.twapAddress == "string" && e.twapAddress.length > 0 && typeof e.exchange == "string", yr = async ({
2399
+ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "number" && Number.isFinite(e.Contract_id)) && typeof e.twapAddress == "string" && e.twapAddress.length > 0 && typeof e.exchange == "string", Ar = async ({
3045
2400
  chainId: e,
3046
2401
  signal: t,
3047
2402
  page: n,
3048
- limit: a,
3049
- filters: s
2403
+ limit: i,
2404
+ filters: a
3050
2405
  }) => {
3051
2406
  try {
3052
- const c = await fr({
2407
+ const d = await ur({
3053
2408
  chainId: e,
3054
2409
  signal: t,
3055
2410
  page: n,
3056
- limit: a,
3057
- filters: s
2411
+ limit: i,
2412
+ filters: a
3058
2413
  });
3059
- let y = 0;
3060
- const E = c.filter((g) => {
3061
- const S = br(g);
3062
- return S || y++, S;
2414
+ let m = 0;
2415
+ const b = d.filter((h) => {
2416
+ const w = pr(h);
2417
+ return w || m++, w;
3063
2418
  }), [D, C] = await Promise.all([
3064
- Ar({ chainId: e, orders: E, signal: t }),
3065
- mr({ chainId: e, orders: E, signal: t })
3066
- ]), P = E.flatMap((g) => {
3067
- const S = D == null ? void 0 : D.filter(
3068
- (w) => w.TWAP_id === Number(g.Contract_id) && xe(w.exchange, g.exchange) && xe(w.twapAddress, g.twapAddress)
2419
+ fr({ chainId: e, orders: b, signal: t }),
2420
+ lr({ chainId: e, orders: b, signal: t })
2421
+ ]), O = b.flatMap((h) => {
2422
+ const w = D == null ? void 0 : D.filter(
2423
+ (B) => String(B.TWAP_id) === String(h.Contract_id) && ke(B.exchange, h.exchange) && ke(B.twapAddress, h.twapAddress)
3069
2424
  );
3070
2425
  try {
3071
2426
  return [
3072
- ur(
3073
- g,
2427
+ dr(
2428
+ h,
3074
2429
  e,
3075
- S,
3076
- hr(g, S || [], C)
2430
+ w,
2431
+ yr(h, w || [], C)
3077
2432
  )
3078
2433
  ];
3079
2434
  } catch {
3080
- return y++, [];
2435
+ return m++, [];
3081
2436
  }
3082
- }).sort((g, S) => S.createdAt - g.createdAt);
3083
- y > 0 && console.warn(
3084
- `Skipped ${y} invalid legacy order history ${y === 1 ? "item" : "items"} on chain ${e}`
2437
+ }).sort((h, w) => w.createdAt - h.createdAt);
2438
+ m > 0 && console.warn(
2439
+ `Skipped ${m} invalid legacy order history ${m === 1 ? "item" : "items"} on chain ${e}`
3085
2440
  );
3086
2441
  const F = /* @__PURE__ */ new Set();
3087
- return P.filter((g) => F.has(g.historyKey) ? !1 : (F.add(g.historyKey), !0));
3088
- } catch (c) {
3089
- if (c instanceof Et) return [];
3090
- throw c;
2442
+ return O.filter((h) => F.has(h.historyKey) ? !1 : (F.add(h.historyKey), !0));
2443
+ } catch (d) {
2444
+ if (d instanceof Et) return [];
2445
+ throw d;
3091
2446
  }
3092
- }, hr = (e, t, n) => {
3093
- var E;
3094
- const a = (E = n == null ? void 0 : n.find(
3095
- (D) => D.twapId === e.Contract_id.toString() && xe(D.twapAddress, e.twapAddress)
3096
- )) == null ? void 0 : E.status, c = ht(t).reduce((D, C) => D.plus(C.inAmount), new h(0)).toFixed(), y = gt(e.ask_srcAmount, c);
3097
- return Er(y, e.ask_deadline * 1e3, a);
3098
- }, gt = (e, t) => {
3099
- const n = h(e || 0), a = h(t || 0);
3100
- if (!n.isFinite() || !a.isFinite() || n.lte(0)) return 0;
3101
- const s = a.dividedBy(n).toNumber();
3102
- return s >= 1 ? 100 : s <= 0 ? 0 : Number((s * 100).toFixed(2));
3103
- }, Er = (e, t, n) => e === 100 ? ue.Completed : n === "CANCELLED" ? ue.Cancelled : n === "COMPLETED" ? ue.Completed : t > Date.now() ? ue.Open : ue.Expired, gr = (e) => {
3104
- const t = h(e.order.witness.output.limit || 0).gt(1), { stop: n, triggerLower: a, triggerUpper: s } = e.order.witness.output, c = h(n || 0).eq(ft), y = c || h(s || 0).gt(0), E = !c && h(n || 0).gt(0) || h(a || 0).gt(0), D = h(e.order.witness.input.amount), C = e.metadata.expectedChunks || (D.gt(0) ? h(e.order.witness.input.maxAmount).div(D).toNumber() : 1);
3105
- return y ? t ? N.TAKE_PROFIT_LIMIT : N.TAKE_PROFIT_MARKET : E ? t ? N.STOP_LOSS_LIMIT : N.STOP_LOSS_MARKET : t ? C > 1 && t ? N.TWAP_LIMIT : t ? N.LIMIT : N.TWAP_MARKET : N.TWAP_MARKET;
3106
- }, xr = (e) => {
3107
- var s;
3108
- const t = ((s = e.metadata.chunks) == null ? void 0 : s.filter((c) => c.status === "success").length) || 0, n = e.metadata.expectedChunks || 0;
2447
+ }, yr = (e, t, n) => {
2448
+ var b;
2449
+ const i = (b = n == null ? void 0 : n.find(
2450
+ (D) => D.twapId === e.Contract_id.toString() && ke(D.twapAddress, e.twapAddress)
2451
+ )) == null ? void 0 : b.status, d = yt(t).reduce((D, C) => D.plus(C.inAmount), new x(0)).toFixed(), m = mt(e.ask_srcAmount, d);
2452
+ return Er(m, e.ask_deadline * 1e3, i);
2453
+ }, mt = (e, t) => {
2454
+ const n = x(e || 0), i = x(t || 0);
2455
+ if (!n.isFinite() || !i.isFinite() || n.lte(0)) return 0;
2456
+ const a = i.dividedBy(n).toNumber();
2457
+ return a >= 1 ? 100 : a <= 0 ? 0 : Number((a * 100).toFixed(2));
2458
+ }, Er = (e, t, n) => e === 100 ? ce.Completed : n === "CANCELLED" ? ce.Cancelled : n === "COMPLETED" ? ce.Completed : t > Date.now() ? ce.Open : ce.Expired, mr = (e) => {
2459
+ const t = x(e.order.witness.output.limit || 0).gt(1), { stop: n, triggerLower: i, triggerUpper: a } = e.order.witness.output, d = x(n || 0).eq(pt), m = d || x(a || 0).gt(0), b = !d && x(n || 0).gt(0) || x(i || 0).gt(0), D = x(e.order.witness.input.amount), C = e.metadata.expectedChunks || (D.gt(0) ? x(e.order.witness.input.maxAmount).div(D).toNumber() : 1);
2460
+ return m ? t ? N.TAKE_PROFIT_LIMIT : N.TAKE_PROFIT_MARKET : b ? t ? N.STOP_LOSS_LIMIT : N.STOP_LOSS_MARKET : t ? C > 1 && t ? N.TWAP_LIMIT : t ? N.LIMIT : N.TWAP_MARKET : N.TWAP_MARKET;
2461
+ }, br = (e) => {
2462
+ var a;
2463
+ const t = ((a = e.metadata.chunks) == null ? void 0 : a.filter((d) => d.status === "success").length) || 0, n = e.metadata.expectedChunks || 0;
3109
2464
  if (!n) return 0;
3110
- const a = h(t).dividedBy(n).toNumber();
3111
- return t >= n ? 100 : a <= 0 ? 0 : Number((a * 100).toFixed(2));
3112
- }, Tr = (e, t) => {
3113
- var s;
3114
- const n = (e.metadata.status || "").toLowerCase(), a = (s = e.metadata.description) == null ? void 0 : s.toLowerCase();
3115
- return n === "completed" || t === 100 ? ue.Completed : ["pending", "eligible"].includes(n) ? ue.Open : ["cancelled", "canceled"].includes(n) || a === "cancelled by contract" || a === "canceled by contract" ? ue.Cancelled : ue.Expired;
3116
- }, Dr = (e) => {
2465
+ const i = x(t).dividedBy(n).toNumber();
2466
+ return t >= n ? 100 : i <= 0 ? 0 : Number((i * 100).toFixed(2));
2467
+ }, hr = (e, t) => {
2468
+ var a;
2469
+ const n = (e.metadata.status || "").toLowerCase(), i = (a = e.metadata.description) == null ? void 0 : a.toLowerCase();
2470
+ return n === "completed" || t === 100 ? ce.Completed : ["pending", "eligible"].includes(n) ? ce.Open : ["cancelled", "canceled"].includes(n) || i === "cancelled by contract" || i === "canceled by contract" ? ce.Cancelled : ce.Expired;
2471
+ }, Tr = (e) => {
3117
2472
  var n;
3118
- return (((n = e.metadata.chunks) == null ? void 0 : n.filter((a) => a.status === "success")) || []).map((a) => ({
3119
- inAmount: a.inAmount,
3120
- outAmount: a.outAmount,
3121
- timestamp: new Date(a.timestamp).getTime(),
3122
- txHash: a.txHash
3123
- })).sort((a, s) => a.timestamp - s.timestamp);
3124
- }, Fr = (e, t) => e.length >= t ? e.reduce(
3125
- (a, s) => Math.max(a, s.timestamp),
2473
+ return (((n = e.metadata.chunks) == null ? void 0 : n.filter((i) => i.status === "success")) || []).map((i) => ({
2474
+ inAmount: i.inAmount,
2475
+ outAmount: i.outAmount,
2476
+ timestamp: new Date(i.timestamp).getTime(),
2477
+ txHash: i.txHash
2478
+ })).sort((i, a) => i.timestamp - a.timestamp);
2479
+ }, xr = (e, t) => e.length >= t ? e.reduce(
2480
+ (i, a) => Math.max(i, a.timestamp),
3126
2481
  0
3127
- ) : 0, wr = (e) => {
3128
- const t = h(e.metadata.displayOnlyInputTokenPriceUSD || 0);
2482
+ ) : 0, gr = (e) => {
2483
+ const t = x(e.metadata.displayOnlyInputTokenPriceUSD || 0);
3129
2484
  return t.isFinite() ? t.dividedBy(1e18).toFixed() : "0";
3130
- }, Je = (e) => h(e.order.witness.output.limit || 0).eq(1) ? "" : e.order.witness.output.limit, Cr = (e) => {
3131
- const { triggerLower: t = "0", triggerUpper: n = "0" } = e.order.witness.output, a = Je(e), s = e.metadata.expectedChunks || 1, c = h(n || 0).gt(0);
2485
+ }, Ze = (e) => x(e.order.witness.output.limit || 0).eq(1) ? "" : e.order.witness.output.limit, Dr = (e) => {
2486
+ const { triggerLower: t = "0", triggerUpper: n = "0" } = e.order.witness.output, i = Ze(e), a = e.metadata.expectedChunks || 1, d = x(n || 0).gt(0);
3132
2487
  return {
3133
- dstMinAmountPerTrade: a,
3134
- triggerPricePerTrade: c ? n : t,
3135
- dstMinAmountTotal: a ? h(a).multipliedBy(s).toFixed() : ""
2488
+ dstMinAmountPerTrade: i,
2489
+ triggerPricePerTrade: d ? n : t,
2490
+ dstMinAmountTotal: i ? x(i).multipliedBy(a).toFixed() : ""
3136
2491
  };
3137
- }, Br = (e) => {
3138
- const t = Je(e), n = h(e.order.witness.output.stop || 0).eq(ft), a = e.metadata.expectedChunks || 1;
2492
+ }, Fr = (e) => {
2493
+ const t = Ze(e), n = x(e.order.witness.output.stop || 0).eq(pt), i = e.metadata.expectedChunks || 1;
3139
2494
  return {
3140
2495
  dstMinAmountPerTrade: n ? "" : t,
3141
- triggerPricePerTrade: n ? t : h(e.order.witness.output.stop || 0).toFixed(),
3142
- dstMinAmountTotal: n || !t ? "" : h(t).multipliedBy(a).toFixed()
2496
+ triggerPricePerTrade: n ? t : x(e.order.witness.output.stop || 0).toFixed(),
2497
+ dstMinAmountTotal: n || !t ? "" : x(t).multipliedBy(i).toFixed()
3143
2498
  };
3144
- }, kr = (e) => Number(Xe) >= 2 ? Cr(e) : Br(e), xt = (e) => {
3145
- const t = xr(e), n = Je(e), a = e.metadata.expectedChunks || 1, s = Dr(e), c = gr(e);
2499
+ }, Cr = (e) => Number(Xe) >= 2 ? Dr(e) : Fr(e), bt = (e) => {
2500
+ const t = br(e), n = Ze(e), i = e.metadata.expectedChunks || 1, a = Tr(e), d = mr(e);
3146
2501
  return {
3147
2502
  id: e.hash,
3148
2503
  hash: e.hash,
3149
2504
  version: 2,
3150
2505
  historyKey: `2:${e.order.witness.chainid}:${e.hash.toLowerCase()}`,
3151
- type: c,
2506
+ type: d,
3152
2507
  maker: e.order.witness.swapper,
3153
2508
  progress: t,
3154
- srcAmountFilled: s.reduce((y, E) => y.plus(E.inAmount), new h(0)).toFixed() || "",
3155
- dstAmountFilled: s.reduce((y, E) => y.plus(E.outAmount), new h(0)).toFixed() || "",
3156
- fills: s,
2509
+ srcAmountFilled: a.reduce((m, b) => m.plus(b.inAmount), new x(0)).toFixed() || "",
2510
+ dstAmountFilled: a.reduce((m, b) => m.plus(b.outAmount), new x(0)).toFixed() || "",
2511
+ fills: a,
3157
2512
  srcTokenAddress: e.order.witness.input.token,
3158
2513
  dstTokenAddress: e.order.witness.output.token,
3159
- orderDollarValueIn: wr(e),
2514
+ orderDollarValueIn: gr(e),
3160
2515
  fillDelay: e.order.witness.epoch * 1e3,
3161
2516
  deadline: Number(e.order.deadline) * 1e3,
3162
2517
  createdAt: new Date(e.timestamp).getTime(),
3163
2518
  srcAmount: e.order.witness.input.maxAmount,
3164
2519
  srcAmountPerTrade: e.order.witness.input.amount,
3165
- totalTradesAmount: a,
3166
- isMarketPrice: h(n || 0).lte(1),
2520
+ totalTradesAmount: i,
2521
+ isMarketPrice: x(n || 0).lte(1),
3167
2522
  chainId: e.order.witness.chainid,
3168
- filledOrderTimestamp: Fr(s, a),
3169
- status: Tr(e, t),
2523
+ filledOrderTimestamp: xr(a, i),
2524
+ status: hr(e, t),
3170
2525
  repermitDigest: e.metadata.repermitDigest,
3171
- isTriggerPrice: c === N.TAKE_PROFIT_MARKET || c === N.TAKE_PROFIT_LIMIT || c === N.STOP_LOSS_LIMIT || c === N.STOP_LOSS_MARKET,
2526
+ isTriggerPrice: d === N.TAKE_PROFIT_MARKET || d === N.TAKE_PROFIT_LIMIT || d === N.STOP_LOSS_LIMIT || d === N.STOP_LOSS_MARKET,
3172
2527
  rawOrder: e,
3173
- ...kr(e)
2528
+ ...Cr(e)
3174
2529
  };
3175
- }, Sr = (e, t) => {
2530
+ }, Br = (e, t) => {
3176
2531
  e !== 0 && console.warn(
3177
2532
  `Skipped ${e} invalid order history ${e === 1 ? "item" : "items"} from ${t}`
3178
2533
  );
3179
- }, Pr = (e, t) => {
2534
+ }, wr = (e, t) => {
3180
2535
  if (!e || typeof e != "object" || !Array.isArray(e.orders))
3181
2536
  throw new Error("Invalid order history response: missing orders array");
3182
2537
  const n = Number(
3183
2538
  e.totalPages
3184
- ), a = Number.isSafeInteger(n) && n > 0 ? Math.max(t, n) : t;
2539
+ ), i = Number.isSafeInteger(n) && n > 0 ? Math.max(t, n) : t;
3185
2540
  return {
3186
2541
  orders: e.orders,
3187
- totalPages: a
2542
+ totalPages: i
3188
2543
  };
3189
- }, ct = async ({
2544
+ }, ot = async ({
3190
2545
  endpoint: e,
3191
2546
  chainId: t,
3192
2547
  signal: n,
3193
- account: a,
3194
- exchange: s,
3195
- page: c,
3196
- limit: y
2548
+ account: i,
2549
+ exchange: a,
2550
+ page: d,
2551
+ limit: m
3197
2552
  }) => {
3198
- const E = new URLSearchParams({
3199
- swapper: a,
2553
+ const b = new URLSearchParams({
2554
+ swapper: i,
3200
2555
  chainId: t.toString(),
3201
- page: c.toString()
2556
+ page: d.toString()
3202
2557
  });
3203
- s && E.set("exchange", s), y !== void 0 && E.set("limit", y.toString());
3204
- const D = await fetch(`${e}/orders?${E}`, { signal: n });
2558
+ a && b.set("exchange", a), m !== void 0 && b.set("limit", m.toString());
2559
+ const D = await fetch(`${e}/orders?${b}`, { signal: n });
3205
2560
  if (!D.ok)
3206
2561
  throw new Error(
3207
2562
  `Failed to fetch order history from ${e}: ${D.status}`
3208
2563
  );
3209
- const C = Pr(await D.json(), c);
3210
- let P = 0;
3211
- const F = C.orders.flatMap((g) => {
2564
+ const C = wr(await D.json(), d);
2565
+ let O = 0;
2566
+ const F = C.orders.flatMap((h) => {
3212
2567
  try {
3213
- return [xt(g)];
2568
+ return [bt(h)];
3214
2569
  } catch {
3215
- return P++, [];
2570
+ return O++, [];
3216
2571
  }
3217
2572
  });
3218
- return Sr(P, e), { orders: F, totalPages: C.totalPages ?? c };
3219
- }, Or = async ({
2573
+ return Br(O, e), { orders: F, totalPages: C.totalPages ?? d };
2574
+ }, Sr = async ({
3220
2575
  endpoint: e,
3221
2576
  chainId: t,
3222
2577
  signal: n,
3223
- account: a,
3224
- exchange: s,
3225
- page: c,
3226
- limit: y
2578
+ account: i,
2579
+ exchange: a,
2580
+ page: d,
2581
+ limit: m
3227
2582
  }) => {
3228
- const E = c === void 0 ? 1 : c + 1, D = await ct({
2583
+ const b = d === void 0 ? 1 : d + 1, D = await ot({
3229
2584
  endpoint: e,
3230
2585
  chainId: t,
3231
2586
  signal: n,
3232
- account: a,
3233
- exchange: s,
3234
- page: E,
3235
- limit: y
2587
+ account: i,
2588
+ exchange: a,
2589
+ page: b,
2590
+ limit: m
3236
2591
  });
3237
- if (c !== void 0 || E >= D.totalPages)
2592
+ if (d !== void 0 || b >= D.totalPages)
3238
2593
  return D.orders;
3239
2594
  const C = Array.from(
3240
- { length: D.totalPages - E },
3241
- (F, g) => E + g + 1
3242
- ), P = await Promise.all(
2595
+ { length: D.totalPages - b },
2596
+ (F, h) => b + h + 1
2597
+ ), O = await Promise.all(
3243
2598
  C.map(
3244
- (F) => ct({
2599
+ (F) => ot({
3245
2600
  endpoint: e,
3246
2601
  chainId: t,
3247
2602
  signal: n,
3248
- account: a,
3249
- exchange: s,
2603
+ account: i,
2604
+ exchange: a,
3250
2605
  page: F,
3251
- limit: y
2606
+ limit: m
3252
2607
  })
3253
2608
  )
3254
2609
  );
3255
2610
  return [
3256
2611
  ...D.orders,
3257
- ...P.flatMap((F) => F.orders)
2612
+ ...O.flatMap((F) => F.orders)
3258
2613
  ];
3259
- }, vr = (e, t, n) => {
3260
- const a = /* @__PURE__ */ new Map();
3261
- for (const s of e) {
3262
- const c = Qt({ endpoint: s, exchange: t, partner: n }), y = c.length ? c : [void 0];
3263
- for (const E of y) {
3264
- const D = (E == null ? void 0 : E.toLowerCase()) ?? "all", C = a.get(D) ?? {
3265
- exchange: E,
2614
+ }, Pr = (e, t, n) => {
2615
+ const i = /* @__PURE__ */ new Map();
2616
+ for (const a of e) {
2617
+ const d = ar({ endpoint: a, exchange: t, partner: n }), m = d.length ? d : [void 0];
2618
+ for (const b of m) {
2619
+ const D = (b == null ? void 0 : b.toLowerCase()) ?? "all", C = i.get(D) ?? {
2620
+ exchange: b,
3266
2621
  endpoints: []
3267
2622
  };
3268
- C.endpoints.push(s), a.set(D, C);
2623
+ C.endpoints.push(a), i.set(D, C);
3269
2624
  }
3270
2625
  }
3271
- return Array.from(a.values());
2626
+ return Array.from(i.values());
3272
2627
  }, dt = () => {
3273
2628
  const e = new Error("Order history request aborted");
3274
2629
  throw e.name = "AbortError", e;
3275
- }, _r = async ({
2630
+ }, Or = async ({
3276
2631
  chainId: e,
3277
2632
  signal: t,
3278
2633
  account: n,
3279
- exchange: a,
3280
- partner: s,
3281
- page: c,
3282
- limit: y
2634
+ exchange: i,
2635
+ partner: a,
2636
+ page: d,
2637
+ limit: m
3283
2638
  }) => {
3284
2639
  if (!n) return [];
3285
- const E = vr(
3286
- Zt(),
3287
- a,
3288
- s
2640
+ const b = Pr(
2641
+ nr(),
2642
+ i,
2643
+ a
3289
2644
  ), D = await Promise.allSettled(
3290
- E.map(async (F) => {
3291
- const g = await Promise.allSettled(
2645
+ b.map(async (F) => {
2646
+ const h = await Promise.allSettled(
3292
2647
  F.endpoints.map(
3293
- (w) => Or({
3294
- endpoint: w,
2648
+ (B) => Sr({
2649
+ endpoint: B,
3295
2650
  chainId: e,
3296
2651
  signal: t,
3297
2652
  account: n,
3298
2653
  exchange: F.exchange,
3299
- page: c,
3300
- limit: y
2654
+ page: d,
2655
+ limit: m
3301
2656
  })
3302
2657
  )
3303
2658
  );
3304
2659
  t != null && t.aborted && dt();
3305
- const S = g.filter(
3306
- (w) => w.status === "fulfilled"
2660
+ const w = h.filter(
2661
+ (B) => B.status === "fulfilled"
3307
2662
  );
3308
- if (!S.length) {
3309
- const w = g.find(
3310
- ($) => $.status === "rejected"
2663
+ if (!w.length) {
2664
+ const B = h.find(
2665
+ (V) => V.status === "rejected"
3311
2666
  );
3312
- throw (w == null ? void 0 : w.reason) instanceof Error ? w.reason : new Error("Failed to fetch order history");
2667
+ throw (B == null ? void 0 : B.reason) instanceof Error ? B.reason : new Error("Failed to fetch order history");
3313
2668
  }
3314
- return S.flatMap((w) => w.value);
2669
+ return w.flatMap((B) => B.value);
3315
2670
  })
3316
2671
  );
3317
2672
  t != null && t.aborted && dt();
@@ -3320,232 +2675,229 @@ const br = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
3320
2675
  );
3321
2676
  if (!C.length) {
3322
2677
  const F = D.find(
3323
- (g) => g.status === "rejected"
2678
+ (h) => h.status === "rejected"
3324
2679
  );
3325
2680
  throw (F == null ? void 0 : F.reason) instanceof Error ? F.reason : new Error("Failed to fetch order history");
3326
2681
  }
3327
- const P = /* @__PURE__ */ new Map();
3328
- for (const F of C.flatMap((g) => g.value))
3329
- P.has(F.historyKey) || P.set(F.historyKey, F);
3330
- return Array.from(P.values());
3331
- }, Rr = (e, t) => {
2682
+ const O = /* @__PURE__ */ new Map();
2683
+ for (const F of C.flatMap((h) => h.value))
2684
+ O.has(F.historyKey) || O.set(F.historyKey, F);
2685
+ return Array.from(O.values());
2686
+ }, kr = (e, t) => {
3332
2687
  if (e !== void 0 && (!Number.isInteger(e) || e < 0))
3333
2688
  throw new Error("Order history page must be a non-negative integer");
3334
2689
  if (t !== void 0 && (!Number.isInteger(t) || t <= 0))
3335
2690
  throw new Error("Order history limit must be a positive integer");
3336
- }, Ir = async ({
2691
+ }, _r = async ({
3337
2692
  signal: e,
3338
2693
  page: t,
3339
2694
  chainId: n,
3340
- limit: a,
3341
- exchange: s,
3342
- partner: c,
3343
- account: y,
3344
- legacyOrders: E = !0
2695
+ limit: i,
2696
+ exchange: a,
2697
+ partner: d,
2698
+ account: m,
2699
+ legacyOrders: b = !0
3345
2700
  }) => {
3346
- Rr(t, a);
3347
- const D = Sn(c, n);
2701
+ kr(t, i);
2702
+ const D = ln(d, n);
3348
2703
  return (await Promise.all([
3349
- !D || !E ? Promise.resolve([]) : yr({
2704
+ !D || !b ? Promise.resolve([]) : Ar({
3350
2705
  chainId: n,
3351
2706
  signal: e,
3352
2707
  page: t,
3353
- limit: a,
2708
+ limit: i,
3354
2709
  filters: {
3355
- accounts: [y],
2710
+ accounts: [m],
3356
2711
  configs: [D]
3357
2712
  }
3358
2713
  }),
3359
- _r({
2714
+ Or({
3360
2715
  chainId: n,
3361
2716
  signal: e,
3362
- account: y,
3363
- exchange: s,
3364
- partner: c,
2717
+ account: m,
2718
+ exchange: a,
2719
+ partner: d,
3365
2720
  page: t,
3366
- limit: a
2721
+ limit: i
3367
2722
  })
3368
- ]).then(([F, g]) => [...F, ...g])).sort((F, g) => g.createdAt - F.createdAt);
3369
- }, Mr = async (e, t) => {
2723
+ ]).then(([F, h]) => [...F, ...h])).sort((F, h) => h.createdAt - F.createdAt);
2724
+ }, vr = async (e, t) => {
3370
2725
  try {
3371
2726
  const n = {
3372
2727
  signature: t,
3373
2728
  order: e,
3374
2729
  status: "pending"
3375
2730
  };
3376
- Ee.onCreateOrderRequest();
3377
- const a = await fetch(`${jt()}/orders/new`, {
2731
+ me.onCreateOrderRequest();
2732
+ const i = await fetch(`${er()}/orders/new`, {
3378
2733
  method: "POST",
3379
2734
  headers: {
3380
2735
  "Content-Type": "application/json",
3381
2736
  Accept: "application/json"
3382
2737
  },
3383
2738
  body: JSON.stringify(n)
3384
- }), s = await a.json().catch(() => ({}));
3385
- if (!a.ok || !(s != null && s.success)) {
3386
- const y = (s == null ? void 0 : s.message) ?? a.statusText ?? "Request failed", E = (s == null ? void 0 : s.code) ?? a.status;
3387
- throw new Error(`error:${y}, code:${E}`);
2739
+ }), a = await i.json().catch(() => ({}));
2740
+ if (!i.ok || !(a != null && a.success)) {
2741
+ const m = (a == null ? void 0 : a.message) ?? i.statusText ?? "Request failed", b = (a == null ? void 0 : a.code) ?? i.status;
2742
+ throw new Error(`error:${m}, code:${b}`);
3388
2743
  }
3389
- if (!s.signedOrder || typeof s.signedOrder != "object")
2744
+ if (!a.signedOrder || typeof a.signedOrder != "object")
3390
2745
  throw new Error("Invalid API response: missing signedOrder");
3391
- const c = xt(s.signedOrder);
3392
- return Ee.onCreateOrderSuccess(c.id), c;
2746
+ const d = bt(a.signedOrder);
2747
+ return me.onCreateOrderSuccess(d.id), d;
3393
2748
  } catch (n) {
3394
- throw Ee.onCreateOrderError(n), console.error(n), n;
2749
+ throw me.onCreateOrderError(n), console.error(n), n;
3395
2750
  }
3396
- }, Nr = (e, t) => {
3397
- if (!mt().some(
3398
- (a) => a.name === e && a.chainId === t
2751
+ }, Ir = (e, t) => e + t.unit * t.value + 6e4, Rr = (e, t) => {
2752
+ if (!At().some(
2753
+ (i) => i.name === e && i.chainId === t
3399
2754
  ))
3400
2755
  throw new Error(`Partner "${e}" is not supported on chain ${t}`);
3401
- }, Ur = /^0x[0-9a-f]{40}$/i, Lr = /^0x0{40}$/i;
3402
- function lt(e, t) {
3403
- if (typeof e != "string" || !Ur.test(e) || Lr.test(e))
2756
+ }, Mr = /^0x[0-9a-f]{40}$/i, Nr = /^0x0{40}$/i;
2757
+ function ct(e, t) {
2758
+ if (typeof e != "string" || !Mr.test(e) || Nr.test(e))
3404
2759
  throw new Error(
3405
2760
  `Invalid RePermit configuration: ${t} must be a non-zero EVM address`
3406
2761
  );
3407
2762
  }
3408
- const $r = (e, t) => {
3409
- var y;
3410
- const n = e, a = n.domain, s = n.order, c = s == null ? void 0 : s.witness;
3411
- if (Number(a == null ? void 0 : a.chainId) !== t)
2763
+ const Lr = (e, t) => {
2764
+ var m;
2765
+ const n = e, i = n.domain, a = n.order, d = a == null ? void 0 : a.witness;
2766
+ if (Number(i == null ? void 0 : i.chainId) !== t)
3412
2767
  throw new Error(
3413
2768
  `Invalid RePermit configuration: domain.chainId does not match requested chain ${t}`
3414
2769
  );
3415
- if (Number(c == null ? void 0 : c.chainid) !== t)
2770
+ if (Number(d == null ? void 0 : d.chainid) !== t)
3416
2771
  throw new Error(
3417
2772
  `Invalid RePermit configuration: order.witness.chainid does not match requested chain ${t}`
3418
2773
  );
3419
- lt(
3420
- a == null ? void 0 : a.verifyingContract,
2774
+ ct(
2775
+ i == null ? void 0 : i.verifyingContract,
3421
2776
  "domain.verifyingContract"
3422
- ), lt(
3423
- (y = c == null ? void 0 : c.exchange) == null ? void 0 : y.adapter,
2777
+ ), ct(
2778
+ (m = d == null ? void 0 : d.exchange) == null ? void 0 : m.adapter,
3424
2779
  "order.witness.exchange.adapter"
3425
2780
  );
3426
- }, ia = async (e, t) => {
3427
- Nr(e, t);
3428
- const n = await cr(e, t);
3429
- $r(n, t);
3430
- const a = n.domain.verifyingContract, s = n.order.witness.exchange.adapter;
3431
- let c = 0;
3432
- const y = (g) => (c = Math.max(g, c + 1), c.toString());
2781
+ }, Hr = async (e, t) => {
2782
+ Rr(e, t);
2783
+ const n = await ir(e, t);
2784
+ Lr(n, t);
2785
+ const i = n.domain.verifyingContract, a = n.order.witness.exchange.adapter;
2786
+ let d = 0;
2787
+ const m = (h) => (d = Math.max(h, d + 1), d.toString());
3433
2788
  return Object.freeze({
3434
2789
  partner: e,
3435
2790
  chainId: t,
3436
2791
  rePermitData: n,
3437
- spenderAddress: a,
3438
- exchangeAddress: s,
3439
- prepareOrder: (g) => {
3440
- const { form: S } = g;
3441
- if (!S.canSubmit)
2792
+ spenderAddress: i,
2793
+ exchangeAddress: a,
2794
+ prepareOrder: (h) => {
2795
+ const { form: w } = h;
2796
+ if (!w.canSubmit)
3442
2797
  throw new Error("Order form is not submittable");
3443
- const w = S.values, $ = Date.now(), K = {
3444
- ...w,
3445
- currentTimeMillis: $,
3446
- deadlineMillis: xn($, w.duration)
3447
- }, q = dr({
3448
- chainId: t,
3449
- inputTokenAddress: g.inputTokenAddress,
3450
- outputTokenAddress: g.outputTokenAddress,
3451
- totalInputAmount: w.inputAmount,
3452
- nonce: y($),
2798
+ if (pn(h.inputTokenAddress))
2799
+ throw new Error(
2800
+ "prepareOrder inputTokenAddress must be an ERC-20 address; pass the host-provided wrapped native token for native input"
2801
+ );
2802
+ const B = w.values, V = Date.now(), K = {
2803
+ ...B,
2804
+ currentTimeMillis: V,
2805
+ deadlineMillis: Ir(V, B.duration)
2806
+ }, z = sr({
2807
+ inputTokenAddress: h.inputTokenAddress,
2808
+ outputTokenAddress: h.outputTokenAddress,
2809
+ totalInputAmount: B.inputAmount,
2810
+ nonce: m(V),
3453
2811
  currentTimeMillis: K.currentTimeMillis,
3454
2812
  deadlineMillis: K.deadlineMillis,
3455
- fillDelayMillis: w.fillDelayMillis,
3456
- totalTrades: w.totalTrades,
3457
- slippageBps: w.slippageBps,
3458
- swapperAddress: g.swapperAddress,
3459
- inputAmountPerTrade: w.inputAmountPerTrade,
3460
- minOutputAmountPerTrade: w.minOutputAmountPerTrade,
3461
- triggerOutputAmountPerTrade: w.triggerOutputAmountPerTrade,
2813
+ fillDelayMillis: B.fillDelayMillis,
2814
+ totalTrades: B.totalTrades,
2815
+ slippageBps: B.slippageBps,
2816
+ swapperAddress: h.swapperAddress,
2817
+ inputAmountPerTrade: B.inputAmountPerTrade,
2818
+ minOutputAmountPerTrade: B.minOutputAmountPerTrade,
2819
+ triggerOutputAmountPerTrade: B.triggerOutputAmountPerTrade,
3462
2820
  permitData: n,
3463
- module: S.module
3464
- }), T = q.order;
2821
+ module: w.module
2822
+ }), g = z.order;
3465
2823
  return {
3466
- order: T,
2824
+ order: g,
3467
2825
  signingRequest: {
3468
- signerAddress: g.swapperAddress,
2826
+ signerAddress: h.swapperAddress,
3469
2827
  typedData: {
3470
- domain: q.domain,
3471
- types: q.types,
3472
- primaryType: q.primaryType,
3473
- message: T
2828
+ domain: z.domain,
2829
+ types: z.types,
2830
+ primaryType: z.primaryType,
2831
+ message: g
3474
2832
  }
3475
2833
  },
3476
2834
  approvalRequest: {
3477
- tokenAddress: T.permitted.token,
3478
- amount: w.inputAmount,
3479
- spenderAddress: a
2835
+ tokenAddress: g.permitted.token,
2836
+ amount: B.inputAmount,
2837
+ spenderAddress: i
3480
2838
  },
3481
- form: S,
2839
+ form: w,
3482
2840
  values: K
3483
2841
  };
3484
2842
  },
3485
- signOrder: async (g, S) => {
3486
- Ee.onSignOrderRequest(g.order);
2843
+ signOrder: async (h, w) => {
2844
+ me.onSignOrderRequest(h.order);
3487
2845
  try {
3488
- const w = await S(g.signingRequest);
3489
- return Ee.onSignOrderSuccess(w), w;
3490
- } catch (w) {
3491
- throw Ee.onSignOrderError(w), w;
2846
+ const B = await w(h.signingRequest);
2847
+ return me.onSignOrderSuccess(B), B;
2848
+ } catch (B) {
2849
+ throw me.onSignOrderError(B), B;
3492
2850
  }
3493
2851
  },
3494
- submitOrder: (g, S) => Mr(g.order, S),
3495
- getCancelOrderRequest: (g) => {
3496
- const S = g.version === 1 ? g.twapAddress : a;
3497
- if (!S)
2852
+ submitOrder: (h, w) => vr(h.order, w),
2853
+ getCancelOrderRequest: (h) => {
2854
+ const w = h.version === 1 ? h.twapAddress : i;
2855
+ if (!w)
3498
2856
  throw new Error("Cancellation contract address is unavailable");
3499
2857
  return {
3500
- order: g,
3501
- contractAddress: S,
3502
- args: g.version === 1 ? [g.id] : [[g.repermitDigest]],
3503
- abi: g.version === 1 ? nr : tr
2858
+ order: h,
2859
+ contractAddress: w,
2860
+ args: h.version === 1 ? [h.id] : [[h.repermitDigest]],
2861
+ abi: h.version === 1 ? jn : zn
3504
2862
  };
3505
2863
  },
3506
- getAccountOrders: (g) => Ir({
3507
- ...g,
2864
+ getAccountOrders: (h) => _r({
2865
+ ...h,
3508
2866
  chainId: t,
3509
- exchange: s,
2867
+ exchange: a,
3510
2868
  partner: e
3511
2869
  })
3512
2870
  });
3513
- };
2871
+ }, Yr = "https://www.orbs.com/dtwap-and-dlimit-faq/", Zr = "https://www.orbs.com/dtwap-and-dlimit-faq/#dSLTP", Qr = "https://raw.githubusercontent.com/orbs-network/twap-ui/master/logo/orbslogo.svg", Jr = "https://www.orbs.com/", ea = "https://www.orbs.com/dtwap-dlimit-disclaimer";
3514
2872
  export {
3515
- qr as DISCLAIMER_URL,
3516
- ee as InputErrors,
3517
- _ as Module,
3518
- zr as ORBS_LOGO,
3519
- Wr as ORBS_SLTP_FAQ_URL,
3520
- Vr as ORBS_TWAP_FAQ_URL,
3521
- Hr as ORBS_WEBSITE_URL,
3522
- Ft as OrderFilter,
3523
- ue as OrderStatus,
2873
+ ea as DISCLAIMER_URL,
2874
+ J as InputErrors,
2875
+ v as Module,
2876
+ Qr as ORBS_LOGO,
2877
+ Zr as ORBS_SLTP_FAQ_URL,
2878
+ Yr as ORBS_TWAP_FAQ_URL,
2879
+ Jr as ORBS_WEBSITE_URL,
2880
+ xt as OrderFilter,
2881
+ ce as OrderStatus,
3524
2882
  N as OrderType,
3525
- J as Partners,
2883
+ Q as Partners,
3526
2884
  Xe as SPOT_VERSION,
3527
- de as TimeUnit,
3528
- Ee as analytics,
3529
- aa as calculateOrderForm,
3530
- ia as createClient,
3531
- Gr as ensureWrappedToken,
3532
- xe as eqIgnoreCase,
3533
- Yr as getExplorerUrl,
3534
- Ce as getNetwork,
3535
- ea as getOrderExecutionRate,
3536
- Qr as getOrderFillDelayMillis,
3537
- ta as getOrderLimitPriceRate,
3538
- Jr as getPartnerChains,
3539
- mt as getPartners,
3540
- na as getTriggerPriceRate,
3541
- Sn as getTwapConfig,
3542
- ra as invertPriceInput,
3543
- Le as isNativeAddress,
3544
- Zr as isTxRejected,
3545
- Z as networks,
3546
- sa as setUIVersion,
3547
- Xr as shouldUnwrapOnly,
3548
- jr as shouldWrapOnly,
3549
- Me as toAmountUI,
3550
- At as toAmountWei
2885
+ se as TimeUnit,
2886
+ me as analytics,
2887
+ jr as calculateOrderForm,
2888
+ Hr as createClient,
2889
+ ke as eqIgnoreCase,
2890
+ qr as getOrderExecutionRate,
2891
+ Vr as getOrderFillDelayMillis,
2892
+ Wr as getOrderLimitPriceRate,
2893
+ Gr as getPartnerChains,
2894
+ At as getPartners,
2895
+ zr as getTriggerPriceRate,
2896
+ ln as getTwapConfig,
2897
+ $r as invertPriceInput,
2898
+ pn as isNativeAddress,
2899
+ Kr as isTxRejected,
2900
+ Xr as setUIVersion,
2901
+ We as toAmountRaw,
2902
+ ze as toAmountUI
3551
2903
  };