@orbs-network/spot-react 1.1.35 → 1.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/spot-react.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ks = Object.defineProperty;
|
|
2
2
|
var wr = (e) => {
|
|
3
3
|
throw TypeError(e);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var ln = (e, t, n) =>
|
|
7
|
-
var l = (e, t, n) => (
|
|
5
|
+
var Hs = (e, t, n) => t in e ? Ks(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6
|
+
var ln = (e, t, n) => Hs(e, typeof t != "symbol" ? t + "" : t, n), _n = (e, t, n) => t.has(e) || wr("Cannot " + n);
|
|
7
|
+
var l = (e, t, n) => (_n(e, t, "read from private field"), n ? n.call(e) : t.get(e)), L = (e, t, n) => t.has(e) ? wr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), I = (e, t, n, r) => (_n(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), W = (e, t, n) => (_n(e, t, "access private method"), n);
|
|
8
8
|
var pn = (e, t, n, r) => ({
|
|
9
9
|
set _(s) {
|
|
10
10
|
I(e, t, s, n);
|
|
@@ -13,28 +13,28 @@ var pn = (e, t, n, r) => ({
|
|
|
13
13
|
return l(e, t, r);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { jsx as
|
|
16
|
+
import { jsx as Ne, jsxs as Ws, Fragment as zs } from "react/jsx-runtime";
|
|
17
17
|
import * as fe from "react";
|
|
18
|
-
import fn, { useMemo as
|
|
19
|
-
const
|
|
20
|
-
SpookySwap:
|
|
21
|
-
SpookySwapSonic:
|
|
22
|
-
QuickSwap:
|
|
23
|
-
QuickSwapBase:
|
|
24
|
-
Thena:
|
|
25
|
-
PancakeSwap:
|
|
26
|
-
PancakeSwapArbitrum:
|
|
27
|
-
PancakeSwapBase:
|
|
28
|
-
PancakeSwapLinea:
|
|
29
|
-
Lynex:
|
|
30
|
-
SushiArb:
|
|
31
|
-
SushiBase:
|
|
32
|
-
SushiEth:
|
|
33
|
-
SushiKatana:
|
|
34
|
-
DragonSwap:
|
|
35
|
-
SwapX:
|
|
36
|
-
BlackholeAvax:
|
|
37
|
-
}, ca = /* @__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"}]'), ua = [
|
|
18
|
+
import fn, { useMemo as k, useCallback as ne, createContext as cr, useContext as ss, Component as Qs, createElement as Fr, useEffect as mt } from "react";
|
|
19
|
+
const $s = { 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: "" }, Vs = { 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: "" }, js = { 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" }, Gs = { 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: "" }, Xs = { 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" }, Zs = { 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: "" }, Ys = { 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: "" }, Js = { 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: "" }, ea = { 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: "" }, ta = { 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" }, na = { 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: "" }, ra = { 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: "" }, sa = { 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: "" }, aa = { 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: "" }, ia = { chainId: 1329, name: "DragonSwap" }, oa = { 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: "" }, ca = { 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" }, z = {
|
|
20
|
+
SpookySwap: $s,
|
|
21
|
+
SpookySwapSonic: Vs,
|
|
22
|
+
QuickSwap: js,
|
|
23
|
+
QuickSwapBase: Gs,
|
|
24
|
+
Thena: Xs,
|
|
25
|
+
PancakeSwap: Zs,
|
|
26
|
+
PancakeSwapArbitrum: Ys,
|
|
27
|
+
PancakeSwapBase: Js,
|
|
28
|
+
PancakeSwapLinea: ea,
|
|
29
|
+
Lynex: ta,
|
|
30
|
+
SushiArb: na,
|
|
31
|
+
SushiBase: ra,
|
|
32
|
+
SushiEth: sa,
|
|
33
|
+
SushiKatana: aa,
|
|
34
|
+
DragonSwap: ia,
|
|
35
|
+
SwapX: oa,
|
|
36
|
+
BlackholeAvax: ca
|
|
37
|
+
}, ua = /* @__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"}]'), da = [
|
|
38
38
|
{
|
|
39
39
|
type: "constructor",
|
|
40
40
|
inputs: [],
|
|
@@ -346,8 +346,8 @@ const zs = { chainName: "ftm", chainId: 250, twapVersion: 4, twapAddress: "0xd3B
|
|
|
346
346
|
}
|
|
347
347
|
]
|
|
348
348
|
}
|
|
349
|
-
],
|
|
350
|
-
var V = /* @__PURE__ */ ((e) => (e.TWAP = "TWAP", e.LIMIT = "LIMIT", e.STOP_LOSS = "STOP_LOSS", e.TAKE_PROFIT = "TAKE_PROFIT", e))(V || {}), le = /* @__PURE__ */ ((e) => (e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(le || {}),
|
|
349
|
+
], la = da, pa = ua;
|
|
350
|
+
var V = /* @__PURE__ */ ((e) => (e.TWAP = "TWAP", e.LIMIT = "LIMIT", e.STOP_LOSS = "STOP_LOSS", e.TAKE_PROFIT = "TAKE_PROFIT", e))(V || {}), le = /* @__PURE__ */ ((e) => (e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(le || {}), fa = /* @__PURE__ */ ((e) => (e.All = "ALL", e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(fa || {}), Le = /* @__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))(Le || {}), X = /* @__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))(X || {}), ke = /* @__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))(ke || {}), me = /* @__PURE__ */ ((e) => (e.EMPTY_LIMIT_PRICE = "emptyLimitPrice", e.MAX_CHUNKS = "maxChunksError", e.MIN_CHUNKS = "minChunksError", 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.MIN_TRADE_SIZE_ERROR = "minTradeSizeError", e))(me || {});
|
|
351
351
|
const ee = "0x0000000000000000000000000000000000000000", ge = {
|
|
352
352
|
eth: {
|
|
353
353
|
id: 1,
|
|
@@ -923,23 +923,23 @@ const ee = "0x0000000000000000000000000000000000000000", ge = {
|
|
|
923
923
|
explorer: "https://mantlescan.xyz",
|
|
924
924
|
eip1559: !0
|
|
925
925
|
}
|
|
926
|
-
},
|
|
927
|
-
version:
|
|
928
|
-
}, as = "https://order-sink-dev.orbs.network", Cn = "https://order-sink.orbs.network", is = "https://order-sink-v2.orbs.network", dr = ur.version.split(".")[0],
|
|
926
|
+
}, ha = "2.6.5", ur = {
|
|
927
|
+
version: ha
|
|
928
|
+
}, as = "https://order-sink-dev.orbs.network", Cn = "https://order-sink.orbs.network", is = "https://order-sink-v2.orbs.network", dr = ur.version.split(".")[0], ma = (e) => {
|
|
929
929
|
const t = Number(dr) >= 2;
|
|
930
930
|
return e ? as : t ? is : Cn;
|
|
931
|
-
},
|
|
931
|
+
}, ya = (e) => {
|
|
932
932
|
const t = Number(dr) >= 2;
|
|
933
933
|
return e ? [as] : t ? [is, Cn] : [Cn];
|
|
934
|
-
},
|
|
935
|
-
[
|
|
936
|
-
},
|
|
934
|
+
}, ga = {
|
|
935
|
+
[ke.Thena]: "0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67"
|
|
936
|
+
}, Aa = ({
|
|
937
937
|
endpoint: e,
|
|
938
938
|
exchange: t,
|
|
939
939
|
partner: n
|
|
940
|
-
}) => e === Cn && n &&
|
|
940
|
+
}) => e === Cn && n && ga[n] || t, Hn = 300 * 1e3, Tn = 1440 * 60 * 60 * 1e3, vr = 300 * 1e3, Ea = new Date(
|
|
941
941
|
Hn
|
|
942
|
-
).getMinutes(),
|
|
942
|
+
).getMinutes(), kn = (e) => `https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-${e}/prod/gn`, Re = "https://hub.orbs.network/api/apikey/subgraphs/id", ba = {
|
|
943
943
|
[ge.eth.id]: `${Re}/Bf7bvMYcJbDAvYWJmhMpHZ4cpFjqzkhK6GXXEpnPRq6`,
|
|
944
944
|
[ge.bsc.id]: `${Re}/4NfXEi8rreQsnAr4aJ45RLCKgnjcWX46Lbt9SadiCcz6`,
|
|
945
945
|
[ge.poly.id]: `${Re}/3PyRPWSvDnMowGbeBy7aNsvUkD5ZuxdXQw2RdJq4NdXi`,
|
|
@@ -951,69 +951,69 @@ const ee = "0x0000000000000000000000000000000000000000", ge = {
|
|
|
951
951
|
[ge.ftm.id]: `${Re}/DdRo1pmJkrJC9fjsjEBWnNE1uqrbh7Diz4tVKd7rfupp`,
|
|
952
952
|
[ge.katana.id]: `${Re}/CGi9sDFMQcnBwF3C3NoCFqnaE34sssbgwPLTwiskSXmW`,
|
|
953
953
|
[ge.avax.id]: `${Re}/FxZ1vMwE5Xy1qvKvZENUMz4vhW8Sh4vXJf9Vp7o17pTx`,
|
|
954
|
-
[ge.bera.id]:
|
|
955
|
-
[ge.flare.id]:
|
|
956
|
-
[ge.cronosZkEvm.id]:
|
|
957
|
-
},
|
|
958
|
-
|
|
954
|
+
[ge.bera.id]: kn("berachain"),
|
|
955
|
+
[ge.flare.id]: kn("flare"),
|
|
956
|
+
[ge.cronosZkEvm.id]: kn("cronos-zkevm")
|
|
957
|
+
}, xa = "0x0000000000000000000000000000000000000000", Ca = [
|
|
958
|
+
xa,
|
|
959
959
|
"0x0000000000000000000000000000000000001010",
|
|
960
960
|
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
961
961
|
"0x000000000000000000000000000000000000dEaD",
|
|
962
962
|
"0x000000000000000000000000000000000000800A",
|
|
963
963
|
"0x000000000000000000000000000000000000800a"
|
|
964
|
-
], os = "115792089237316195423570985008687907853269984665640564039457584007913129639935", Ae = (e) => `${e.name}_${e.chainId}`,
|
|
965
|
-
[Ae(
|
|
964
|
+
], os = "115792089237316195423570985008687907853269984665640564039457584007913129639935", Ae = (e) => `${e.name}_${e.chainId}`, Ta = {
|
|
965
|
+
[Ae(z.SushiArb)]: [
|
|
966
966
|
"0x846F2B29ef314bF3D667981b4ffdADc5B858312a",
|
|
967
967
|
"0x08c41f5D1C844061f6D952E25827eeAA576c6536"
|
|
968
968
|
],
|
|
969
|
-
[Ae(
|
|
969
|
+
[Ae(z.SushiBase)]: [
|
|
970
970
|
"0x846F2B29ef314bF3D667981b4ffdADc5B858312a",
|
|
971
971
|
"0x08c41f5D1C844061f6D952E25827eeAA576c6536"
|
|
972
972
|
],
|
|
973
|
-
[Ae(
|
|
973
|
+
[Ae(z.SushiEth)]: [
|
|
974
974
|
"0xc55943Fa6509004B2903ED8F8ab7347BfC47D0bA",
|
|
975
975
|
"0x08c41f5D1C844061f6D952E25827eeAA576c6536"
|
|
976
976
|
],
|
|
977
|
-
[Ae(
|
|
977
|
+
[Ae(z.PancakeSwap)]: [
|
|
978
978
|
"0xb2BAFe188faD927240038cC4FfF2d771d8A58905",
|
|
979
979
|
"0xE2a0c3b9aD19A18c4bBa7fffBe5bC1b0E58Db1CE"
|
|
980
980
|
],
|
|
981
|
-
[Ae(
|
|
981
|
+
[Ae(z.PancakeSwapArbitrum)]: [
|
|
982
982
|
"0xE20167871dB616DdfFD0Fd870d9bC068C350DD1F",
|
|
983
983
|
"0x807488ADAD033e95C438F998277bE654152594dc"
|
|
984
984
|
],
|
|
985
|
-
[Ae(
|
|
985
|
+
[Ae(z.PancakeSwapBase)]: [
|
|
986
986
|
"0x10ed1F36e4eBE76E161c9AADDa20BE841bc0082c",
|
|
987
987
|
"0x3A9df3eE209b802D0337383f5abCe3204d623588"
|
|
988
988
|
],
|
|
989
|
-
[Ae(
|
|
989
|
+
[Ae(z.PancakeSwapLinea)]: [
|
|
990
990
|
"0x3A9df3eE209b802D0337383f5abCe3204d623588"
|
|
991
991
|
],
|
|
992
|
-
[Ae(
|
|
992
|
+
[Ae(z.QuickSwap)]: [
|
|
993
993
|
"0x26D0ec4Be402BCE03AAa8aAf0CF67e9428ba54eF"
|
|
994
994
|
],
|
|
995
|
-
[Ae(
|
|
995
|
+
[Ae(z.Thena)]: [
|
|
996
996
|
"0xc2aBC02acd77Bb2407efA22348dA9afC8B375290"
|
|
997
997
|
],
|
|
998
|
-
[Ae(
|
|
998
|
+
[Ae(z.Lynex)]: [
|
|
999
999
|
"0x72e3e1fD5D2Ee2F1C2Eb695206D490a1D45C3835"
|
|
1000
1000
|
],
|
|
1001
|
-
[Ae(
|
|
1001
|
+
[Ae(z.DragonSwap)]: [
|
|
1002
1002
|
"0x101e1B65Bb516FB5f4547C80BAe0b51f1b8D7a22"
|
|
1003
1003
|
],
|
|
1004
|
-
[Ae(
|
|
1004
|
+
[Ae(z.SpookySwapSonic)]: [
|
|
1005
1005
|
"0xAd97B770ad64aE47fc7d64B3bD820dCDbF9ff7DA"
|
|
1006
1006
|
],
|
|
1007
|
-
[Ae(
|
|
1007
|
+
[Ae(z.SpookySwap)]: [
|
|
1008
1008
|
"0x3924d62219483015f982b160d48c0fa5Fd436Cba"
|
|
1009
1009
|
],
|
|
1010
|
-
[Ae(
|
|
1010
|
+
[Ae(z.SwapX)]: [
|
|
1011
1011
|
"0xE5012eBDe5e26EE3Ea41992154731a03023CF274"
|
|
1012
1012
|
]
|
|
1013
1013
|
}, Wn = {
|
|
1014
|
-
unit:
|
|
1015
|
-
value:
|
|
1016
|
-
},
|
|
1014
|
+
unit: Le.Minutes,
|
|
1015
|
+
value: Ea
|
|
1016
|
+
}, wa = "RePermitWitnessTransferFrom", Fa = {
|
|
1017
1017
|
RePermitWitnessTransferFrom: [
|
|
1018
1018
|
{
|
|
1019
1019
|
name: "permitted",
|
|
@@ -1143,12 +1143,12 @@ const ee = "0x0000000000000000000000000000000000000000", ge = {
|
|
|
1143
1143
|
type: "uint256"
|
|
1144
1144
|
}
|
|
1145
1145
|
]
|
|
1146
|
-
},
|
|
1146
|
+
}, _c = "https://www.orbs.com/dtwap-and-dlimit-faq/", kc = "https://www.orbs.com/dtwap-and-dlimit-faq/#dSLTP", Uc = "https://raw.githubusercontent.com/orbs-network/twap-ui/master/logo/orbslogo.svg", Mc = "https://www.orbs.com/", Lc = "https://www.orbs.com/dtwap-dlimit-disclaimer";
|
|
1147
1147
|
var an = /* @__PURE__ */ ((e) => (e.FRESHNESS = "freshness", e.MIN_CHUNK_SIZE_USD = "minChunkSizeUsd", e.ENV = "env", e.DURATION = "duration", e.IGNORE_ERRORS = "ignore-errors", e))(an || {});
|
|
1148
|
-
const va = "-5",
|
|
1149
|
-
var
|
|
1148
|
+
const va = "-5", Sa = "10", Da = "-10", Pa = "5";
|
|
1149
|
+
var Oa = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Un = Math.ceil, Pe = Math.floor, Ce = "[BigNumber Error] ", Sr = Ce + "Number primitive has more than 15 significant digits: ", _e = 1e14, K = 14, Mn = 9007199254740991, Ln = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], tt = 1e7, ue = 1e9;
|
|
1150
1150
|
function cs(e) {
|
|
1151
|
-
var t, n, r, s =
|
|
1151
|
+
var t, n, r, s = F.prototype = { constructor: F, toString: null, valueOf: null }, a = new F(1), o = 20, u = 4, p = -7, f = 21, T = -1e7, y = 1e7, b = !1, S = 1, P = 0, O = {
|
|
1152
1152
|
prefix: "",
|
|
1153
1153
|
groupSize: 3,
|
|
1154
1154
|
secondaryGroupSize: 0,
|
|
@@ -1159,9 +1159,9 @@ function cs(e) {
|
|
|
1159
1159
|
// non-breaking space
|
|
1160
1160
|
suffix: ""
|
|
1161
1161
|
}, B = "0123456789abcdefghijklmnopqrstuvwxyz", R = !0;
|
|
1162
|
-
function
|
|
1162
|
+
function F(i, c) {
|
|
1163
1163
|
var d, E, m, g, w, h, A, C, x = this;
|
|
1164
|
-
if (!(x instanceof
|
|
1164
|
+
if (!(x instanceof F)) return new F(i, c);
|
|
1165
1165
|
if (c == null) {
|
|
1166
1166
|
if (i && i._isBigNumber === !0) {
|
|
1167
1167
|
x.s = i.s, !i.c || i.e > y ? x.c = x.e = null : i.e < T ? x.c = [x.e = 0] : (x.e = i.e, x.c = i.c.slice());
|
|
@@ -1175,16 +1175,16 @@ function cs(e) {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
C = String(i);
|
|
1177
1177
|
} else {
|
|
1178
|
-
if (!
|
|
1178
|
+
if (!Oa.test(C = String(i))) return r(x, C, h);
|
|
1179
1179
|
x.s = C.charCodeAt(0) == 45 ? (C = C.slice(1), -1) : 1;
|
|
1180
1180
|
}
|
|
1181
1181
|
(g = C.indexOf(".")) > -1 && (C = C.replace(".", "")), (w = C.search(/e/i)) > 0 ? (g < 0 && (g = w), g += +C.slice(w + 1), C = C.substring(0, w)) : g < 0 && (g = C.length);
|
|
1182
1182
|
} else {
|
|
1183
1183
|
if (te(c, 2, B.length, "Base"), c == 10 && R)
|
|
1184
|
-
return x = new
|
|
1184
|
+
return x = new F(i), $(x, o + x.e + 1, u);
|
|
1185
1185
|
if (C = String(i), h = typeof i == "number") {
|
|
1186
1186
|
if (i * 0 != 0) return r(x, C, h, c);
|
|
1187
|
-
if (x.s = 1 / i < 0 ? (C = C.slice(1), -1) : 1,
|
|
1187
|
+
if (x.s = 1 / i < 0 ? (C = C.slice(1), -1) : 1, F.DEBUG && C.replace(/^0\.0*|\./, "").length > 15)
|
|
1188
1188
|
throw Error(Sr + i);
|
|
1189
1189
|
} else
|
|
1190
1190
|
x.s = C.charCodeAt(0) === 45 ? (C = C.slice(1), -1) : 1;
|
|
@@ -1206,7 +1206,7 @@ function cs(e) {
|
|
|
1206
1206
|
for (w = 0; C.charCodeAt(w) === 48; w++) ;
|
|
1207
1207
|
for (A = C.length; C.charCodeAt(--A) === 48; ) ;
|
|
1208
1208
|
if (C = C.slice(w, ++A)) {
|
|
1209
|
-
if (A -= w, h &&
|
|
1209
|
+
if (A -= w, h && F.DEBUG && A > 15 && (i > Mn || i !== Pe(i)))
|
|
1210
1210
|
throw Error(Sr + x.s * i);
|
|
1211
1211
|
if ((g = g - w - 1) > y)
|
|
1212
1212
|
x.c = x.e = null;
|
|
@@ -1225,7 +1225,7 @@ function cs(e) {
|
|
|
1225
1225
|
} else
|
|
1226
1226
|
x.c = [x.e = 0];
|
|
1227
1227
|
}
|
|
1228
|
-
|
|
1228
|
+
F.clone = cs, F.ROUND_UP = 0, F.ROUND_DOWN = 1, F.ROUND_CEIL = 2, F.ROUND_FLOOR = 3, F.ROUND_HALF_UP = 4, F.ROUND_HALF_DOWN = 5, F.ROUND_HALF_EVEN = 6, F.ROUND_HALF_CEIL = 7, F.ROUND_HALF_FLOOR = 8, F.EUCLID = 9, F.config = F.set = function(i) {
|
|
1229
1229
|
var c, d;
|
|
1230
1230
|
if (i != null)
|
|
1231
1231
|
if (typeof i == "object") {
|
|
@@ -1268,9 +1268,9 @@ function cs(e) {
|
|
|
1268
1268
|
FORMAT: O,
|
|
1269
1269
|
ALPHABET: B
|
|
1270
1270
|
};
|
|
1271
|
-
},
|
|
1271
|
+
}, F.isBigNumber = function(i) {
|
|
1272
1272
|
if (!i || i._isBigNumber !== !0) return !1;
|
|
1273
|
-
if (!
|
|
1273
|
+
if (!F.DEBUG) return !0;
|
|
1274
1274
|
var c, d, E = i.c, m = i.e, g = i.s;
|
|
1275
1275
|
e: if ({}.toString.call(E) == "[object Array]") {
|
|
1276
1276
|
if ((g === 1 || g === -1) && m >= -ue && m <= ue && m === Pe(m)) {
|
|
@@ -1280,25 +1280,25 @@ function cs(e) {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
if (c = (m + 1) % K, c < 1 && (c += K), String(E[0]).length == c) {
|
|
1282
1282
|
for (c = 0; c < E.length; c++)
|
|
1283
|
-
if (d = E[c], d < 0 || d >=
|
|
1283
|
+
if (d = E[c], d < 0 || d >= _e || d !== Pe(d)) break e;
|
|
1284
1284
|
if (d !== 0) return !0;
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
1287
|
} else if (E === null && m === null && (g === null || g === 1 || g === -1))
|
|
1288
1288
|
return !0;
|
|
1289
1289
|
throw Error(Ce + "Invalid BigNumber: " + i);
|
|
1290
|
-
},
|
|
1291
|
-
return
|
|
1292
|
-
},
|
|
1293
|
-
return
|
|
1294
|
-
},
|
|
1290
|
+
}, F.maximum = F.max = function() {
|
|
1291
|
+
return _(arguments, -1);
|
|
1292
|
+
}, F.minimum = F.min = function() {
|
|
1293
|
+
return _(arguments, 1);
|
|
1294
|
+
}, F.random = (function() {
|
|
1295
1295
|
var i = 9007199254740992, c = Math.random() * i & 2097151 ? function() {
|
|
1296
1296
|
return Pe(Math.random() * i);
|
|
1297
1297
|
} : function() {
|
|
1298
1298
|
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
1299
1299
|
};
|
|
1300
1300
|
return function(d) {
|
|
1301
|
-
var E, m, g, w, h, A = 0, C = [], x = new
|
|
1301
|
+
var E, m, g, w, h, A = 0, C = [], x = new F(a);
|
|
1302
1302
|
if (d == null ? d = o : te(d, 0, ue), w = Un(d / K), b)
|
|
1303
1303
|
if (crypto.getRandomValues) {
|
|
1304
1304
|
for (E = crypto.getRandomValues(new Uint32Array(w *= 2)); A < w; )
|
|
@@ -1323,8 +1323,8 @@ function cs(e) {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
return x.e = g, x.c = C, x;
|
|
1325
1325
|
};
|
|
1326
|
-
})(),
|
|
1327
|
-
for (var i = 1, c = arguments, d = new
|
|
1326
|
+
})(), F.sum = function() {
|
|
1327
|
+
for (var i = 1, c = arguments, d = new F(c[0]); i < c.length; ) d = d.plus(c[i++]);
|
|
1328
1328
|
return d;
|
|
1329
1329
|
}, n = /* @__PURE__ */ (function() {
|
|
1330
1330
|
var i = "0123456789";
|
|
@@ -1338,7 +1338,7 @@ function cs(e) {
|
|
|
1338
1338
|
}
|
|
1339
1339
|
return function(d, E, m, g, w) {
|
|
1340
1340
|
var h, A, C, x, D, U, M, j, re = d.indexOf("."), oe = o, Z = u;
|
|
1341
|
-
for (re >= 0 && (x = P, P = 0, d = d.replace(".", ""), j = new
|
|
1341
|
+
for (re >= 0 && (x = P, P = 0, d = d.replace(".", ""), j = new F(E), U = j.pow(d.length - re), P = x, j.c = c(
|
|
1342
1342
|
Ve(De(U.c), U.e, "0"),
|
|
1343
1343
|
10,
|
|
1344
1344
|
m,
|
|
@@ -1382,37 +1382,37 @@ function cs(e) {
|
|
|
1382
1382
|
for (; !E[0] && E.length > 1; E.splice(0, 1)) ;
|
|
1383
1383
|
}
|
|
1384
1384
|
return function(E, m, g, w, h) {
|
|
1385
|
-
var A, C, x, D, U, M, j, re, oe, Z, J, he, dn, Bn, Rn,
|
|
1385
|
+
var A, C, x, D, U, M, j, re, oe, Z, J, he, dn, Bn, Rn, qe, Zt, Se = E.s == m.s ? 1 : -1, ye = E.c, se = m.c;
|
|
1386
1386
|
if (!ye || !ye[0] || !se || !se[0])
|
|
1387
|
-
return new
|
|
1387
|
+
return new F(
|
|
1388
1388
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
1389
1389
|
!E.s || !m.s || (ye ? se && ye[0] == se[0] : !se) ? NaN : (
|
|
1390
1390
|
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
1391
1391
|
ye && ye[0] == 0 || !se ? Se * 0 : Se / 0
|
|
1392
1392
|
)
|
|
1393
1393
|
);
|
|
1394
|
-
for (re = new
|
|
1394
|
+
for (re = new F(Se), oe = re.c = [], C = E.e - m.e, Se = g + C + 1, h || (h = _e, C = Oe(E.e / K) - Oe(m.e / K), Se = Se / K | 0), x = 0; se[x] == (ye[x] || 0); x++) ;
|
|
1395
1395
|
if (se[x] > (ye[x] || 0) && C--, Se < 0)
|
|
1396
1396
|
oe.push(1), D = !0;
|
|
1397
1397
|
else {
|
|
1398
|
-
for (Bn = ye.length,
|
|
1398
|
+
for (Bn = ye.length, qe = se.length, x = 0, Se += 2, U = Pe(h / (se[0] + 1)), U > 1 && (se = i(se, U, h), ye = i(ye, U, h), qe = se.length, Bn = ye.length), dn = qe, Z = ye.slice(0, qe), J = Z.length; J < qe; Z[J++] = 0) ;
|
|
1399
1399
|
Zt = se.slice(), Zt = [0].concat(Zt), Rn = se[0], se[1] >= h / 2 && Rn++;
|
|
1400
1400
|
do {
|
|
1401
|
-
if (U = 0, A = c(se, Z,
|
|
1402
|
-
if (he = Z[0],
|
|
1401
|
+
if (U = 0, A = c(se, Z, qe, J), A < 0) {
|
|
1402
|
+
if (he = Z[0], qe != J && (he = he * h + (Z[1] || 0)), U = Pe(he / Rn), U > 1)
|
|
1403
1403
|
for (U >= h && (U = h - 1), M = i(se, U, h), j = M.length, J = Z.length; c(M, Z, j, J) == 1; )
|
|
1404
|
-
U--, d(M,
|
|
1404
|
+
U--, d(M, qe < j ? Zt : se, j, h), j = M.length, A = 1;
|
|
1405
1405
|
else
|
|
1406
1406
|
U == 0 && (A = U = 1), M = se.slice(), j = M.length;
|
|
1407
1407
|
if (j < J && (M = [0].concat(M)), d(Z, M, J, h), J = Z.length, A == -1)
|
|
1408
|
-
for (; c(se, Z,
|
|
1409
|
-
U++, d(Z,
|
|
1408
|
+
for (; c(se, Z, qe, J) < 1; )
|
|
1409
|
+
U++, d(Z, qe < J ? Zt : se, J, h), J = Z.length;
|
|
1410
1410
|
} else A === 0 && (U++, Z = [0]);
|
|
1411
1411
|
oe[x++] = U, Z[0] ? Z[J++] = ye[dn] || 0 : (Z = [ye[dn]], J = 1);
|
|
1412
1412
|
} while ((dn++ < Bn || Z[0] != null) && Se--);
|
|
1413
1413
|
D = Z[0] != null, oe[0] || oe.splice(0, 1);
|
|
1414
1414
|
}
|
|
1415
|
-
if (h ==
|
|
1415
|
+
if (h == _e) {
|
|
1416
1416
|
for (x = 1, Se = oe[0]; Se >= 10; Se /= 10, x++) ;
|
|
1417
1417
|
$(re, g + (re.e = x + C * K - 1) + 1, w, D);
|
|
1418
1418
|
} else
|
|
@@ -1425,7 +1425,7 @@ function cs(e) {
|
|
|
1425
1425
|
if (d == null ? d = u : te(d, 0, 8), !i.c) return i.toString();
|
|
1426
1426
|
if (m = i.c[0], w = i.e, c == null)
|
|
1427
1427
|
A = De(i.c), A = E == 1 || E == 2 && (w <= p || w >= f) ? mn(A, w) : Ve(A, w, "0");
|
|
1428
|
-
else if (i = $(new
|
|
1428
|
+
else if (i = $(new F(i), c, d), g = i.e, A = De(i.c), h = A.length, E == 1 || E == 2 && (c <= g || g <= p)) {
|
|
1429
1429
|
for (; h < c; A += "0", h++) ;
|
|
1430
1430
|
A = mn(A, g);
|
|
1431
1431
|
} else if (c -= w + (E === 2 && g > w), A = Ve(A, g, "0"), g + 1 > h) {
|
|
@@ -1434,12 +1434,12 @@ function cs(e) {
|
|
|
1434
1434
|
for (g + 1 == h && (A += "."); c--; A += "0") ;
|
|
1435
1435
|
return i.s < 0 && m ? "-" + A : A;
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1438
|
-
for (var d, E, m = 1, g = new
|
|
1439
|
-
E = new
|
|
1437
|
+
function _(i, c) {
|
|
1438
|
+
for (var d, E, m = 1, g = new F(i[0]); m < i.length; m++)
|
|
1439
|
+
E = new F(i[m]), (!E.s || (d = ht(g, E)) === c || d === 0 && g.s === c) && (g = E);
|
|
1440
1440
|
return g;
|
|
1441
1441
|
}
|
|
1442
|
-
function
|
|
1442
|
+
function Q(i, c, d) {
|
|
1443
1443
|
for (var E = 1, m = c.length; !c[--m]; c.pop()) ;
|
|
1444
1444
|
for (m = c[0]; m >= 10; m /= 10, E++) ;
|
|
1445
1445
|
return (d = E + d * K - 1) > y ? i.c = i.e = null : d < T ? i.c = [i.e = 0] : (i.e = d, i.c = c), i;
|
|
@@ -1454,8 +1454,8 @@ function cs(e) {
|
|
|
1454
1454
|
if (!h && (x = x.replace(i, function(D, U, M) {
|
|
1455
1455
|
return C = (M = M.toLowerCase()) == "x" ? 16 : M == "b" ? 2 : 8, !A || A == C ? U : D;
|
|
1456
1456
|
}), A && (C = A, x = x.replace(c, "$1").replace(d, "0.$1")), w != x))
|
|
1457
|
-
return new
|
|
1458
|
-
if (
|
|
1457
|
+
return new F(x, C);
|
|
1458
|
+
if (F.DEBUG)
|
|
1459
1459
|
throw Error(Ce + "Not a" + (A ? " base " + A : "") + " number: " + w);
|
|
1460
1460
|
g.s = null;
|
|
1461
1461
|
}
|
|
@@ -1490,10 +1490,10 @@ function cs(e) {
|
|
|
1490
1490
|
if (C == 0) {
|
|
1491
1491
|
for (g = 1, w = D[0]; w >= 10; w /= 10, g++) ;
|
|
1492
1492
|
for (w = D[0] += h, h = 1; w >= 10; w /= 10, h++) ;
|
|
1493
|
-
g != h && (i.e++, D[0] ==
|
|
1493
|
+
g != h && (i.e++, D[0] == _e && (D[0] = 1));
|
|
1494
1494
|
break;
|
|
1495
1495
|
} else {
|
|
1496
|
-
if (D[C] += h, D[C] !=
|
|
1496
|
+
if (D[C] += h, D[C] != _e) break;
|
|
1497
1497
|
D[C--] = 0, h = 1;
|
|
1498
1498
|
}
|
|
1499
1499
|
for (g = D.length; D[--g] === 0; D.pop()) ;
|
|
@@ -1507,36 +1507,36 @@ function cs(e) {
|
|
|
1507
1507
|
return d === null ? i.toString() : (c = De(i.c), c = d <= p || d >= f ? mn(c, d) : Ve(c, d, "0"), i.s < 0 ? "-" + c : c);
|
|
1508
1508
|
}
|
|
1509
1509
|
return s.absoluteValue = s.abs = function() {
|
|
1510
|
-
var i = new
|
|
1510
|
+
var i = new F(this);
|
|
1511
1511
|
return i.s < 0 && (i.s = 1), i;
|
|
1512
1512
|
}, s.comparedTo = function(i, c) {
|
|
1513
|
-
return ht(this, new
|
|
1513
|
+
return ht(this, new F(i, c));
|
|
1514
1514
|
}, s.decimalPlaces = s.dp = function(i, c) {
|
|
1515
1515
|
var d, E, m, g = this;
|
|
1516
1516
|
if (i != null)
|
|
1517
|
-
return te(i, 0, ue), c == null ? c = u : te(c, 0, 8), $(new
|
|
1517
|
+
return te(i, 0, ue), c == null ? c = u : te(c, 0, 8), $(new F(g), i + g.e + 1, c);
|
|
1518
1518
|
if (!(d = g.c)) return null;
|
|
1519
1519
|
if (E = ((m = d.length - 1) - Oe(this.e / K)) * K, m = d[m]) for (; m % 10 == 0; m /= 10, E--) ;
|
|
1520
1520
|
return E < 0 && (E = 0), E;
|
|
1521
1521
|
}, s.dividedBy = s.div = function(i, c) {
|
|
1522
|
-
return t(this, new
|
|
1522
|
+
return t(this, new F(i, c), o, u);
|
|
1523
1523
|
}, s.dividedToIntegerBy = s.idiv = function(i, c) {
|
|
1524
|
-
return t(this, new
|
|
1524
|
+
return t(this, new F(i, c), 0, 1);
|
|
1525
1525
|
}, s.exponentiatedBy = s.pow = function(i, c) {
|
|
1526
1526
|
var d, E, m, g, w, h, A, C, x, D = this;
|
|
1527
|
-
if (i = new
|
|
1527
|
+
if (i = new F(i), i.c && !i.isInteger())
|
|
1528
1528
|
throw Error(Ce + "Exponent not an integer: " + ie(i));
|
|
1529
|
-
if (c != null && (c = new
|
|
1530
|
-
return x = new
|
|
1529
|
+
if (c != null && (c = new F(c)), h = i.e > 14, !D.c || !D.c[0] || D.c[0] == 1 && !D.e && D.c.length == 1 || !i.c || !i.c[0])
|
|
1530
|
+
return x = new F(Math.pow(+ie(D), h ? i.s * (2 - hn(i)) : +ie(i))), c ? x.mod(c) : x;
|
|
1531
1531
|
if (A = i.s < 0, c) {
|
|
1532
|
-
if (c.c ? !c.c[0] : !c.s) return new
|
|
1532
|
+
if (c.c ? !c.c[0] : !c.s) return new F(NaN);
|
|
1533
1533
|
E = !A && D.isInteger() && c.isInteger(), E && (D = D.mod(c));
|
|
1534
1534
|
} else {
|
|
1535
1535
|
if (i.e > 9 && (D.e > 0 || D.e < -1 || (D.e == 0 ? D.c[0] > 1 || h && D.c[1] >= 24e7 : D.c[0] < 8e13 || h && D.c[0] <= 9999975e7)))
|
|
1536
|
-
return g = D.s < 0 && hn(i) ? -0 : 0, D.e > -1 && (g = 1 / g), new
|
|
1536
|
+
return g = D.s < 0 && hn(i) ? -0 : 0, D.e > -1 && (g = 1 / g), new F(A ? 1 / g : g);
|
|
1537
1537
|
P && (g = Un(P / K + 2));
|
|
1538
1538
|
}
|
|
1539
|
-
for (h ? (d = new
|
|
1539
|
+
for (h ? (d = new F(0.5), A && (i.s = 1), C = hn(i)) : (m = Math.abs(+ie(i)), C = m % 2), x = new F(a); ; ) {
|
|
1540
1540
|
if (C) {
|
|
1541
1541
|
if (x = x.times(D), !x.c) break;
|
|
1542
1542
|
g ? x.c.length > g && (x.c.length = g) : E && (x = x.mod(c));
|
|
@@ -1554,22 +1554,22 @@ function cs(e) {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
return E ? x : (A && (x = a.div(x)), c ? x.mod(c) : g ? $(x, P, u, w) : x);
|
|
1556
1556
|
}, s.integerValue = function(i) {
|
|
1557
|
-
var c = new
|
|
1557
|
+
var c = new F(this);
|
|
1558
1558
|
return i == null ? i = u : te(i, 0, 8), $(c, c.e + 1, i);
|
|
1559
1559
|
}, s.isEqualTo = s.eq = function(i, c) {
|
|
1560
|
-
return ht(this, new
|
|
1560
|
+
return ht(this, new F(i, c)) === 0;
|
|
1561
1561
|
}, s.isFinite = function() {
|
|
1562
1562
|
return !!this.c;
|
|
1563
1563
|
}, s.isGreaterThan = s.gt = function(i, c) {
|
|
1564
|
-
return ht(this, new
|
|
1564
|
+
return ht(this, new F(i, c)) > 0;
|
|
1565
1565
|
}, s.isGreaterThanOrEqualTo = s.gte = function(i, c) {
|
|
1566
|
-
return (c = ht(this, new
|
|
1566
|
+
return (c = ht(this, new F(i, c))) === 1 || c === 0;
|
|
1567
1567
|
}, s.isInteger = function() {
|
|
1568
1568
|
return !!this.c && Oe(this.e / K) > this.c.length - 2;
|
|
1569
1569
|
}, s.isLessThan = s.lt = function(i, c) {
|
|
1570
|
-
return ht(this, new
|
|
1570
|
+
return ht(this, new F(i, c)) < 0;
|
|
1571
1571
|
}, s.isLessThanOrEqualTo = s.lte = function(i, c) {
|
|
1572
|
-
return (c = ht(this, new
|
|
1572
|
+
return (c = ht(this, new F(i, c))) === -1 || c === 0;
|
|
1573
1573
|
}, s.isNaN = function() {
|
|
1574
1574
|
return !this.s;
|
|
1575
1575
|
}, s.isNegative = function() {
|
|
@@ -1580,14 +1580,14 @@ function cs(e) {
|
|
|
1580
1580
|
return !!this.c && this.c[0] == 0;
|
|
1581
1581
|
}, s.minus = function(i, c) {
|
|
1582
1582
|
var d, E, m, g, w = this, h = w.s;
|
|
1583
|
-
if (i = new
|
|
1583
|
+
if (i = new F(i, c), c = i.s, !h || !c) return new F(NaN);
|
|
1584
1584
|
if (h != c)
|
|
1585
1585
|
return i.s = -c, w.plus(i);
|
|
1586
1586
|
var A = w.e / K, C = i.e / K, x = w.c, D = i.c;
|
|
1587
1587
|
if (!A || !C) {
|
|
1588
|
-
if (!x || !D) return x ? (i.s = -c, i) : new
|
|
1588
|
+
if (!x || !D) return x ? (i.s = -c, i) : new F(D ? w : NaN);
|
|
1589
1589
|
if (!x[0] || !D[0])
|
|
1590
|
-
return D[0] ? (i.s = -c, i) : new
|
|
1590
|
+
return D[0] ? (i.s = -c, i) : new F(x[0] ? w : (
|
|
1591
1591
|
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
1592
1592
|
u == 3 ? -0 : 0
|
|
1593
1593
|
));
|
|
@@ -1602,53 +1602,53 @@ function cs(e) {
|
|
|
1602
1602
|
break;
|
|
1603
1603
|
}
|
|
1604
1604
|
if (g && (m = x, x = D, D = m, i.s = -i.s), c = (E = D.length) - (d = x.length), c > 0) for (; c--; x[d++] = 0) ;
|
|
1605
|
-
for (c =
|
|
1605
|
+
for (c = _e - 1; E > h; ) {
|
|
1606
1606
|
if (x[--E] < D[E]) {
|
|
1607
1607
|
for (d = E; d && !x[--d]; x[d] = c) ;
|
|
1608
|
-
--x[d], x[E] +=
|
|
1608
|
+
--x[d], x[E] += _e;
|
|
1609
1609
|
}
|
|
1610
1610
|
x[E] -= D[E];
|
|
1611
1611
|
}
|
|
1612
1612
|
for (; x[0] == 0; x.splice(0, 1), --C) ;
|
|
1613
|
-
return x[0] ?
|
|
1613
|
+
return x[0] ? Q(i, x, C) : (i.s = u == 3 ? -1 : 1, i.c = [i.e = 0], i);
|
|
1614
1614
|
}, s.modulo = s.mod = function(i, c) {
|
|
1615
1615
|
var d, E, m = this;
|
|
1616
|
-
return i = new
|
|
1616
|
+
return i = new F(i, c), !m.c || !i.s || i.c && !i.c[0] ? new F(NaN) : !i.c || m.c && !m.c[0] ? new F(m) : (S == 9 ? (E = i.s, i.s = 1, d = t(m, i, 0, 3), i.s = E, d.s *= E) : d = t(m, i, 0, S), i = m.minus(d.times(i)), !i.c[0] && S == 1 && (i.s = m.s), i);
|
|
1617
1617
|
}, s.multipliedBy = s.times = function(i, c) {
|
|
1618
|
-
var d, E, m, g, w, h, A, C, x, D, U, M, j, re, oe, Z = this, J = Z.c, he = (i = new
|
|
1618
|
+
var d, E, m, g, w, h, A, C, x, D, U, M, j, re, oe, Z = this, J = Z.c, he = (i = new F(i, c)).c;
|
|
1619
1619
|
if (!J || !he || !J[0] || !he[0])
|
|
1620
1620
|
return !Z.s || !i.s || J && !J[0] && !he || he && !he[0] && !J ? i.c = i.e = i.s = null : (i.s *= Z.s, !J || !he ? i.c = i.e = null : (i.c = [0], i.e = 0)), i;
|
|
1621
1621
|
for (E = Oe(Z.e / K) + Oe(i.e / K), i.s *= Z.s, A = J.length, D = he.length, A < D && (j = J, J = he, he = j, m = A, A = D, D = m), m = A + D, j = []; m--; j.push(0)) ;
|
|
1622
|
-
for (re =
|
|
1622
|
+
for (re = _e, oe = tt, m = D; --m >= 0; ) {
|
|
1623
1623
|
for (d = 0, U = he[m] % oe, M = he[m] / oe | 0, w = A, g = m + w; g > m; )
|
|
1624
1624
|
C = J[--w] % oe, x = J[w] / oe | 0, h = M * C + x * U, C = U * C + h % oe * oe + j[g] + d, d = (C / re | 0) + (h / oe | 0) + M * x, j[g--] = C % re;
|
|
1625
1625
|
j[g] = d;
|
|
1626
1626
|
}
|
|
1627
|
-
return d ? ++E : j.splice(0, 1),
|
|
1627
|
+
return d ? ++E : j.splice(0, 1), Q(i, j, E);
|
|
1628
1628
|
}, s.negated = function() {
|
|
1629
|
-
var i = new
|
|
1629
|
+
var i = new F(this);
|
|
1630
1630
|
return i.s = -i.s || null, i;
|
|
1631
1631
|
}, s.plus = function(i, c) {
|
|
1632
1632
|
var d, E = this, m = E.s;
|
|
1633
|
-
if (i = new
|
|
1633
|
+
if (i = new F(i, c), c = i.s, !m || !c) return new F(NaN);
|
|
1634
1634
|
if (m != c)
|
|
1635
1635
|
return i.s = -c, E.minus(i);
|
|
1636
1636
|
var g = E.e / K, w = i.e / K, h = E.c, A = i.c;
|
|
1637
1637
|
if (!g || !w) {
|
|
1638
|
-
if (!h || !A) return new
|
|
1639
|
-
if (!h[0] || !A[0]) return A[0] ? i : new
|
|
1638
|
+
if (!h || !A) return new F(m / 0);
|
|
1639
|
+
if (!h[0] || !A[0]) return A[0] ? i : new F(h[0] ? E : m * 0);
|
|
1640
1640
|
}
|
|
1641
1641
|
if (g = Oe(g), w = Oe(w), h = h.slice(), m = g - w) {
|
|
1642
1642
|
for (m > 0 ? (w = g, d = A) : (m = -m, d = h), d.reverse(); m--; d.push(0)) ;
|
|
1643
1643
|
d.reverse();
|
|
1644
1644
|
}
|
|
1645
1645
|
for (m = h.length, c = A.length, m - c < 0 && (d = A, A = h, h = d, c = m), m = 0; c; )
|
|
1646
|
-
m = (h[--c] = h[c] + A[c] + m) /
|
|
1647
|
-
return m && (h = [m].concat(h), ++w),
|
|
1646
|
+
m = (h[--c] = h[c] + A[c] + m) / _e | 0, h[c] = _e === h[c] ? 0 : h[c] % _e;
|
|
1647
|
+
return m && (h = [m].concat(h), ++w), Q(i, h, w);
|
|
1648
1648
|
}, s.precision = s.sd = function(i, c) {
|
|
1649
1649
|
var d, E, m, g = this;
|
|
1650
1650
|
if (i != null && i !== !!i)
|
|
1651
|
-
return te(i, 1, ue), c == null ? c = u : te(c, 0, 8), $(new
|
|
1651
|
+
return te(i, 1, ue), c == null ? c = u : te(c, 0, 8), $(new F(g), i, c);
|
|
1652
1652
|
if (!(d = g.c)) return null;
|
|
1653
1653
|
if (m = d.length - 1, E = m * K + 1, m = d[m]) {
|
|
1654
1654
|
for (; m % 10 == 0; m /= 10, E--) ;
|
|
@@ -1658,10 +1658,10 @@ function cs(e) {
|
|
|
1658
1658
|
}, s.shiftedBy = function(i) {
|
|
1659
1659
|
return te(i, -Mn, Mn), this.times("1e" + i);
|
|
1660
1660
|
}, s.squareRoot = s.sqrt = function() {
|
|
1661
|
-
var i, c, d, E, m, g = this, w = g.c, h = g.s, A = g.e, C = o + 4, x = new
|
|
1661
|
+
var i, c, d, E, m, g = this, w = g.c, h = g.s, A = g.e, C = o + 4, x = new F("0.5");
|
|
1662
1662
|
if (h !== 1 || !w || !w[0])
|
|
1663
|
-
return new
|
|
1664
|
-
if (h = Math.sqrt(+ie(g)), h == 0 || h == 1 / 0 ? (c = De(w), (c.length + A) % 2 == 0 && (c += "0"), h = Math.sqrt(+c), A = Oe((A + 1) / 2) - (A < 0 || A % 2), h == 1 / 0 ? c = "5e" + A : (c = h.toExponential(), c = c.slice(0, c.indexOf("e") + 1) + A), d = new
|
|
1663
|
+
return new F(!h || h < 0 && (!w || w[0]) ? NaN : w ? g : 1 / 0);
|
|
1664
|
+
if (h = Math.sqrt(+ie(g)), h == 0 || h == 1 / 0 ? (c = De(w), (c.length + A) % 2 == 0 && (c += "0"), h = Math.sqrt(+c), A = Oe((A + 1) / 2) - (A < 0 || A % 2), h == 1 / 0 ? c = "5e" + A : (c = h.toExponential(), c = c.slice(0, c.indexOf("e") + 1) + A), d = new F(c)) : d = new F(h + ""), d.c[0]) {
|
|
1665
1665
|
for (A = d.e, h = A + C, h < 3 && (h = 0); ; )
|
|
1666
1666
|
if (m = d, d = x.times(m.plus(t(g, m, C, 1))), De(m.c).slice(0, h) === (c = De(d.c)).slice(0, h))
|
|
1667
1667
|
if (d.e < A && --h, c = c.slice(h - 3, h + 1), c == "9999" || !E && c == "4999") {
|
|
@@ -1700,10 +1700,10 @@ function cs(e) {
|
|
|
1700
1700
|
return (d.prefix || "") + E + (d.suffix || "");
|
|
1701
1701
|
}, s.toFraction = function(i) {
|
|
1702
1702
|
var c, d, E, m, g, w, h, A, C, x, D, U, M = this, j = M.c;
|
|
1703
|
-
if (i != null && (h = new
|
|
1703
|
+
if (i != null && (h = new F(i), !h.isInteger() && (h.c || h.s !== 1) || h.lt(a)))
|
|
1704
1704
|
throw Error(Ce + "Argument " + (h.isInteger() ? "out of range: " : "not an integer: ") + ie(h));
|
|
1705
|
-
if (!j) return new
|
|
1706
|
-
for (c = new
|
|
1705
|
+
if (!j) return new F(M);
|
|
1706
|
+
for (c = new F(a), C = d = new F(a), E = A = new F(a), U = De(j), g = c.e = U.length - M.e - 1, c.c[0] = Ln[(w = g % K) < 0 ? K + w : w], i = !i || h.comparedTo(c) > 0 ? g > 0 ? c : C : h, w = y, y = 1 / 0, h = new F(U), A.c[0] = 0; x = t(h, c, 0, 1), m = d.plus(x.times(E)), m.comparedTo(i) != 1; )
|
|
1707
1707
|
d = E, E = m, C = A.plus(x.times(m = C)), A = m, c = h.minus(x.times(m = c)), h = m;
|
|
1708
1708
|
return m = t(i.minus(d), E, 0, 1), A = A.plus(m.times(C)), d = d.plus(m.times(E)), A.s = C.s = M.s, g = g * 2, D = t(C, E, g, u).minus(M).abs().comparedTo(
|
|
1709
1709
|
t(A, d, g, u).minus(M).abs()
|
|
@@ -1714,10 +1714,10 @@ function cs(e) {
|
|
|
1714
1714
|
return i != null && te(i, 1, ue), q(this, i, c, 2);
|
|
1715
1715
|
}, s.toString = function(i) {
|
|
1716
1716
|
var c, d = this, E = d.s, m = d.e;
|
|
1717
|
-
return m === null ? E ? (c = "Infinity", E < 0 && (c = "-" + c)) : c = "NaN" : (i == null ? c = m <= p || m >= f ? mn(De(d.c), m) : Ve(De(d.c), m, "0") : i === 10 && R ? (d = $(new
|
|
1717
|
+
return m === null ? E ? (c = "Infinity", E < 0 && (c = "-" + c)) : c = "NaN" : (i == null ? c = m <= p || m >= f ? mn(De(d.c), m) : Ve(De(d.c), m, "0") : i === 10 && R ? (d = $(new F(d), o + m + 1, u), c = Ve(De(d.c), d.e, "0")) : (te(i, 2, B.length, "Base"), c = n(Ve(De(d.c), m, "0"), 10, i, E, !0)), E < 0 && d.c[0] && (c = "-" + c)), c;
|
|
1718
1718
|
}, s.valueOf = s.toJSON = function() {
|
|
1719
1719
|
return ie(this);
|
|
1720
|
-
}, s._isBigNumber = !0, s[Symbol.toStringTag] = "BigNumber", s[Symbol.for("nodejs.util.inspect.custom")] = s.valueOf, e != null &&
|
|
1720
|
+
}, s._isBigNumber = !0, s[Symbol.toStringTag] = "BigNumber", s[Symbol.for("nodejs.util.inspect.custom")] = s.valueOf, e != null && F.set(e), F;
|
|
1721
1721
|
}
|
|
1722
1722
|
function Oe(e) {
|
|
1723
1723
|
var t = e | 0;
|
|
@@ -1763,15 +1763,15 @@ function Ve(e, t, n) {
|
|
|
1763
1763
|
} else t < r && (e = e.slice(0, t) + "." + e.slice(t));
|
|
1764
1764
|
return e;
|
|
1765
1765
|
}
|
|
1766
|
-
var
|
|
1767
|
-
function
|
|
1766
|
+
var v = cs();
|
|
1767
|
+
function Ia(e) {
|
|
1768
1768
|
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.');
|
|
1769
1769
|
}
|
|
1770
|
-
const
|
|
1770
|
+
const Ba = {
|
|
1771
1771
|
1: { adapter: { Odos: "0x1ae80D14C52F82c09a54C423e6f9D5Fb737089C8", Sushi: "0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c", Ring: "0x47e27973dA3e16dB13F8b713877b3A31623E0E5B" }, dex: { sushiswap: { type: "default", solver: "Sushi", router: "0xAC4c6e212A361c968F1725b4d055b47E63F80b75", adapter: "0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df", fee: "0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc" }, ring: { type: "dynamicp2", solver: "Ring", permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", adapter: "0x028fa69049aB68EC42064Eb18896D587dD41Af2a", fee: "0xA04329696aAd1417c75Cf6d91342815001999B21" } } },
|
|
1772
1772
|
10: { adapter: { Odos: "0xc7Ec90152fd5A6210570cb04C4Ab099Bdac352af", Sushi: "0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c" }, dex: { sushiswap: { type: "default", solver: "Sushi", router: "0xAC4c6e212A361c968F1725b4d055b47E63F80b75", adapter: "0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df", fee: "0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc" } } },
|
|
1773
1773
|
14: { adapter: { SparkDex: "0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7" }, dex: { spark: { type: "default", solver: "SparkDex", router: "0x0f3D8a38D4c74afBebc2c42695642f0e3acb15D3", adapter: "0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7", fee: "0xaeA8C3e1a129A77686E115b1a46D9aD8405F7D2b" } } },
|
|
1774
|
-
56: { adapter: { Odos: "0x6c17cc2984A87BD8b002c6E3C08dBB8c8Eb89E48", Orbs: "0xaf3532dca7b4a75cD06671614C093e9e8fb5b1F2", Ring: "0x47e27973dA3e16dB13F8b713877b3A31623E0E5B" }, dex: { thena: { type: "default", solver: "Odos", router: "0x89b8AA89FDd0507a99d334CBe3C808fAFC7d850E", adapter: "0x9E61dEabe996236814c28eC69ab2A7405cB6f03E", fee: "0x15eBc8b5b3877512FFF23650188694A9a8891FAc" }, pancake: { type: "p2", solver: "Orbs", router: "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB", permit2: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768", adapter: "0x52Ed96B1AEd25818B6A284b063b055488E012b73", fee: "0x37A957f10F458e0d7fDECBE2917971b57F15c927" }, newera: { type: "default", solver: "Odos", router: "0x89b8AA89FDd0507a99d334CBe3C808fAFC7d850E", adapter: "0x6236a466CE5c368DC6686d69cAcf5561196B76ef", fee: "0x4E7454909eB6D539111D56b50d68897E933D2d11" }, ring: { type: "dynamicp2", solver: "Ring", permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", adapter: "0x028fa69049aB68EC42064Eb18896D587dD41Af2a", fee: "0xA04329696aAd1417c75Cf6d91342815001999B21" } } },
|
|
1774
|
+
56: { adapter: { Odos: "0x6c17cc2984A87BD8b002c6E3C08dBB8c8Eb89E48", Orbs: "0xaf3532dca7b4a75cD06671614C093e9e8fb5b1F2", Ring: "0x47e27973dA3e16dB13F8b713877b3A31623E0E5B", Topaz: "0x2Be5260d030ff9A6040bA4292326B796ff1a055d" }, dex: { thena: { type: "default", solver: "Odos", router: "0x89b8AA89FDd0507a99d334CBe3C808fAFC7d850E", adapter: "0x9E61dEabe996236814c28eC69ab2A7405cB6f03E", fee: "0x15eBc8b5b3877512FFF23650188694A9a8891FAc" }, pancake: { type: "p2", solver: "Orbs", router: "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB", permit2: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768", adapter: "0x52Ed96B1AEd25818B6A284b063b055488E012b73", fee: "0x37A957f10F458e0d7fDECBE2917971b57F15c927" }, newera: { type: "default", solver: "Odos", router: "0x89b8AA89FDd0507a99d334CBe3C808fAFC7d850E", adapter: "0x6236a466CE5c368DC6686d69cAcf5561196B76ef", fee: "0x4E7454909eB6D539111D56b50d68897E933D2d11" }, ring: { type: "dynamicp2", solver: "Ring", permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", adapter: "0x028fa69049aB68EC42064Eb18896D587dD41Af2a", fee: "0xA04329696aAd1417c75Cf6d91342815001999B21" }, topaz: { type: "default", solver: "Topaz", router: "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", adapter: "0x671c59dCbc8ee3a08D15e1D03a88032740869919", fee: "0xDbB17E23d12cd3C0AA856528F7177a68f98fFd5B" } } },
|
|
1775
1775
|
130: { adapter: { Ring: "0x47e27973dA3e16dB13F8b713877b3A31623E0E5B" }, dex: { ring: { type: "dynamicp2", solver: "Ring", permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", adapter: "0x028fa69049aB68EC42064Eb18896D587dD41Af2a", fee: "0xA04329696aAd1417c75Cf6d91342815001999B21" } } },
|
|
1776
1776
|
137: { adapter: { Odos: "0x5628D7383b42E14E83DA310de3e7E04E6b025418", Paraswap: "0x179C4b8e982b5F1365d36CC8d0c1CEB621B7198D" }, dex: { quick: { type: "paraswap", solver: "Paraswap", router: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57", adapter: "0x727e1CbA41Ff1ff11C32fa43DAb499b4317A1b65", fee: "0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f" }, teafi: { type: "paraswap", solver: "Paraswap", router: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57", adapter: "0xF710D67C783D2C14671EC1c61B0683DCb996F5c3", fee: "0x04Ff96e2c4D62b5771795d307AD679a25b3D2D50" } } },
|
|
1777
1777
|
143: { adapter: { OpenOcean: "0xc7f07C830e22FCA94bF52F38C6707F9D396c6172", Kyber: "0x6f4e5b8d7F6b037c62277992c39E7834D7C04596" }, dex: { yowie: { type: "default", solver: "OpenOcean", router: "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", adapter: "0xCA84Ab5a5A5bf2cff6AC0C835eF049365D13c6cB", fee: "0x6AF3eE77A3A3257777F5649aFa611b4C7Fd975Ef" }, pangolin: { type: "default", solver: "Kyber", router: "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", adapter: "0xf42106eBf985bF49b39eba0114F57FA05e7B52eD", fee: "0xde92da99D188Ceb54A11ec711EF52D808A6260B5" } } },
|
|
@@ -1787,13 +1787,13 @@ const Ia = {
|
|
|
1787
1787
|
59144: { adapter: { Odos: "0xA58A55AC39b47504A63993A91B78544158862e61", Orbs: "0x917b492557957f5dD3e69c04c8E1Ac3d6948c022", OpenOcean: "0xd2e68b1d1C5DBB2D6cC396c10C55017e01309C37" }, dex: { pancake: { type: "p2", solver: "Orbs", router: "0xFE6508f0015C778Bdcc1fB5465bA5ebE224C9912", permit2: "0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768", adapter: "0xA7CcB11F1D20D1F915FC220F5Cb1646E4523bB75", fee: "0x37A957f10F458e0d7fDECBE2917971b57F15c927" }, lynex: { type: "default", solver: "OpenOcean", router: "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", adapter: "0xd8bC1FF79a642e8D7Fbd0711374F287202fBb3AA", fee: "0xcb36ed1B1BfAD8F7FC9651f52d21f04A68677423" } } },
|
|
1788
1788
|
80094: { adapter: { Kodiak: "0xcB16237c88A859d46Ae850B97d7D1bdECF482C06" }, dex: { kodiak: { type: "default", solver: "Kodiak", router: "0x43Dac637c4383f91B4368041E7A8687da3806Cae", adapter: "0xcB16237c88A859d46Ae850B97d7D1bdECF482C06", fee: "0xBA47Ec15aFbCF6e7e9F52900632049530bB6bAe4" } } },
|
|
1789
1789
|
747474: { adapter: { Sushi: "0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c" }, dex: { sushiswap: { type: "default", solver: "Sushi", router: "0xAC4c6e212A361c968F1725b4d055b47E63F80b75", adapter: "0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df", fee: "0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc" } } },
|
|
1790
|
-
"*": { 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", utilaAdapter: "0x7671291910b559d7a05ab73ee31dd714d9c6e7b065c9496338bf427182ae5145", utilaFee: "0x46f797cddb221ecf6279b56f52e2f6360cd721ef95bd5a17dd0ffceffaaf7fd6", efAdapter: "0xa5425e0f84a7cf12c4213f57396810d808d88e43a65210786bd0d9a98a314728", efFee: "0x14387b821c54f18e2a9351887a92cc79164a5ea0b88cfc3f36741eae6d4fd815" }, dex: { agent: { type: "universal", adapter: "0x0002BeFB46587d460AcEA9B2792c4A4c67B9cADa", fee: "0x0006d9557Ac9Af4f31962896299ba4FaBDaB9fEE" }, utila: { type: "universal", adapter: "0x000ADa14B2ECF45Da6Cf1B33dE34e05231E9C76f", fee: "0x000FEee351263c82501a4dF5f699a8b630ac7f36" }, ef: { type: "universal", adapter: "0xeF1B796D708BD776F6b377E93eAd8Ca5fA0C3117", fee: "0xeF1D677d7aE1a066beb26cC1C74E31C082B75FEf" } } }
|
|
1790
|
+
"*": { 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", utilaAdapter: "0x7671291910b559d7a05ab73ee31dd714d9c6e7b065c9496338bf427182ae5145", utilaFee: "0x46f797cddb221ecf6279b56f52e2f6360cd721ef95bd5a17dd0ffceffaaf7fd6", efAdapter: "0xa5425e0f84a7cf12c4213f57396810d808d88e43a65210786bd0d9a98a314728", efFee: "0x14387b821c54f18e2a9351887a92cc79164a5ea0b88cfc3f36741eae6d4fd815", htAdapter: "0x2ec50a8a136049da76c16f3dd12a8ed1b23f2bc91aca73c6a20cc8344e34f998", htFee: "0x2f902a86a7f6abeedc073e76cd33d4737f25189e18c8f450f16d2ffe14405242" }, dex: { agent: { type: "universal", adapter: "0x0002BeFB46587d460AcEA9B2792c4A4c67B9cADa", fee: "0x0006d9557Ac9Af4f31962896299ba4FaBDaB9fEE" }, utila: { type: "universal", adapter: "0x000ADa14B2ECF45Da6Cf1B33dE34e05231E9C76f", fee: "0x000FEee351263c82501a4dF5f699a8b630ac7f36" }, ef: { type: "universal", adapter: "0xeF1B796D708BD776F6b377E93eAd8Ca5fA0C3117", fee: "0xeF1D677d7aE1a066beb26cC1C74E31C082B75FEf" }, ht: { type: "universal", adapter: "0xA560a960C3b7784f5c335C33028D31596b91650b", fee: "0xE7a926C0cb01aCCE74e5d4FCeB7CA1699e200608" } } }
|
|
1791
1791
|
};
|
|
1792
1792
|
var Nn, Dr;
|
|
1793
|
-
function
|
|
1793
|
+
function Ra() {
|
|
1794
1794
|
if (Dr) return Nn;
|
|
1795
1795
|
Dr = 1;
|
|
1796
|
-
const e =
|
|
1796
|
+
const e = Ba, t = (a) => Ia(`./out/${a}.sol/${a}.abi.json`), n = () => ({
|
|
1797
1797
|
wm: t("WM"),
|
|
1798
1798
|
repermit: t("RePermit"),
|
|
1799
1799
|
reactor: t("OrderReactor"),
|
|
@@ -1821,191 +1821,195 @@ function Ba() {
|
|
|
1821
1821
|
}
|
|
1822
1822
|
return Nn = { config: s, adapters: r, abis: n, raw: e }, Nn;
|
|
1823
1823
|
}
|
|
1824
|
-
var us =
|
|
1825
|
-
const
|
|
1824
|
+
var us = Ra();
|
|
1825
|
+
const Qt = (e, t) => {
|
|
1826
1826
|
if (!e || !t) return "";
|
|
1827
|
-
const n =
|
|
1828
|
-
return
|
|
1827
|
+
const n = v(10).pow(e || 0);
|
|
1828
|
+
return v(t).times(n).idiv(n).div(n).toFixed();
|
|
1829
1829
|
};
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1830
|
+
v(0);
|
|
1831
|
+
v(1);
|
|
1832
|
+
v(10);
|
|
1833
|
+
v(1e18);
|
|
1834
1834
|
function $t(e, t) {
|
|
1835
1835
|
return e == t || e.toLowerCase() == t.toLowerCase();
|
|
1836
1836
|
}
|
|
1837
|
-
const on = (e) => !!
|
|
1838
|
-
function
|
|
1837
|
+
const on = (e) => !!Ca.find((t) => $t(t, e || ""));
|
|
1838
|
+
function _a(e) {
|
|
1839
1839
|
return [
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
].find((n) => n <= e) ||
|
|
1840
|
+
Le.Years,
|
|
1841
|
+
Le.Months,
|
|
1842
|
+
Le.Weeks,
|
|
1843
|
+
Le.Days,
|
|
1844
|
+
Le.Hours,
|
|
1845
|
+
Le.Minutes
|
|
1846
|
+
].find((n) => n <= e) || Le.Minutes;
|
|
1847
1847
|
}
|
|
1848
|
-
const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0" :
|
|
1848
|
+
const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0" : v(e).decimalPlaces(0).toFixed(), Vt = (e) => Object.values(ge).find((t) => t.id === e), Ua = (e) => {
|
|
1849
1849
|
if (!e) return;
|
|
1850
|
-
const t = e.map((a) => Ae(a)), n = Object.entries(
|
|
1850
|
+
const t = e.map((a) => Ae(a)), n = Object.entries(Ta).filter(([a]) => t.includes(a)).flatMap(([, a]) => a), r = e.map((a) => a.exchangeAddress), s = new Set(
|
|
1851
1851
|
[...r, ...n].map((a) => a.toLowerCase())
|
|
1852
1852
|
);
|
|
1853
1853
|
return Array.from(s);
|
|
1854
|
-
}, ds = (e, t) => e.version === 1 ? (e.fillDelay || 0) * 1e3 +
|
|
1855
|
-
if (!
|
|
1854
|
+
}, ds = (e, t) => e.version === 1 ? (e.fillDelay || 0) * 1e3 + ja(t) : (e.fillDelay || 0) * 1e3, Sn = (e) => typeof window > "u" ? null : new URLSearchParams(window.location.search).get(e), Ma = (e) => oi().filter((t) => t.name === e).map((t) => t.chainId), ls = (e = "", t = "", n = 18, r = 18) => {
|
|
1855
|
+
if (!v(e || 0).gt(0) || !v(t || 0).gt(0))
|
|
1856
1856
|
return "";
|
|
1857
|
-
const s =
|
|
1858
|
-
return
|
|
1859
|
-
}, Ma = (e, t, n) => {
|
|
1860
|
-
if (e.type === X.TWAP_MARKET) return "";
|
|
1861
|
-
const r = zt(t, e.srcAmountPerTrade), s = zt(n, e.dstMinAmountPerTrade);
|
|
1862
|
-
return F(s).div(r).toFixed();
|
|
1857
|
+
const s = Qt(n, e), a = Qt(r, t);
|
|
1858
|
+
return v(a).div(s).toFixed();
|
|
1863
1859
|
}, La = (e, t, n) => {
|
|
1864
1860
|
if (e.type === X.TWAP_MARKET) return "";
|
|
1865
|
-
const r =
|
|
1866
|
-
return
|
|
1861
|
+
const r = Qt(t, e.srcAmountPerTrade), s = Qt(n, e.dstMinAmountPerTrade);
|
|
1862
|
+
return v(s).div(r).toFixed();
|
|
1867
1863
|
}, Na = (e, t, n) => {
|
|
1864
|
+
if (e.type === X.TWAP_MARKET) return "";
|
|
1865
|
+
const r = Qt(t, e.srcAmountPerTrade), s = Qt(n, e.triggerPricePerTrade);
|
|
1866
|
+
return v(s).div(r).toFixed();
|
|
1867
|
+
}, qa = /* @__PURE__ */ new Set([1, 56, 42161, 8453]), ps = (e, t) => e === ke.Ring ? qa.has(t) : !0, Ka = (e, t, n) => {
|
|
1868
1868
|
if (!e || !t || !n) return;
|
|
1869
|
-
const r =
|
|
1869
|
+
const r = v(e).times(t), s = v(10).pow(n);
|
|
1870
1870
|
return r.div(s).toFixed(0);
|
|
1871
|
-
},
|
|
1871
|
+
}, Ha = (e, t, n, r) => {
|
|
1872
1872
|
if (n || !r || !e || !t)
|
|
1873
|
-
return
|
|
1874
|
-
const s =
|
|
1875
|
-
return
|
|
1876
|
-
},
|
|
1873
|
+
return v(0).toString();
|
|
1874
|
+
const s = v(e).times(v(t)), a = v(10).pow(r), o = s.div(a);
|
|
1875
|
+
return v.max(1, o).integerValue(v.ROUND_FLOOR).toFixed(0);
|
|
1876
|
+
}, Wa = (e, t, n, r) => {
|
|
1877
1877
|
if (e === V.TWAP || e === V.LIMIT)
|
|
1878
1878
|
return "0";
|
|
1879
1879
|
if (!r || !t || !n) return;
|
|
1880
|
-
const s =
|
|
1881
|
-
return
|
|
1882
|
-
},
|
|
1883
|
-
const s = Pt(n) * 2 * t, a = Sn(an.DURATION), o =
|
|
1884
|
-
return a ? { unit: o, value: Number(
|
|
1885
|
-
},
|
|
1880
|
+
const s = v(t).times(v(n)), a = v(10).pow(r), o = s.div(a);
|
|
1881
|
+
return v.max(1, o).integerValue(v.ROUND_FLOOR).toFixed(0) || "0";
|
|
1882
|
+
}, za = (e, t, n, r) => {
|
|
1883
|
+
const s = Pt(n) * 2 * t, a = Sn(an.DURATION), o = _a(a ? Number(a) : s);
|
|
1884
|
+
return a ? { unit: o, value: Number(v(Number(a) / o).toFixed(2)) } : r || (e === V.LIMIT ? { unit: Le.Days, value: 7 } : e === V.STOP_LOSS || e === V.TAKE_PROFIT ? { unit: Le.Days, value: 1 } : { unit: o, value: Number(v(s / o).toFixed(2)) });
|
|
1885
|
+
}, Qa = (e, t, n) => t !== V.TWAP ? 1 : n !== void 0 ? n : Math.max(1, Math.ceil(e / 2)), $a = (e, t, n) => {
|
|
1886
1886
|
if (!e || !t || !n) return 1;
|
|
1887
|
-
const s =
|
|
1887
|
+
const s = v(t).times(e).div(n).integerValue(v.ROUND_FLOOR).toNumber();
|
|
1888
1888
|
return Math.max(1, s);
|
|
1889
|
-
},
|
|
1889
|
+
}, Va = (e, t) => e + Pt(t) + 6e4, ja = (e) => e.bidDelaySeconds * 1e3 * 2, Ga = (e = "", t = 0) => !e || !t ? "0" : v(e).div(t).integerValue(v.ROUND_FLOOR).toFixed(0), Xa = (e, t) => ({
|
|
1890
1890
|
isError: !(e.unit === Wn.unit && e.value === Wn.value) && Pt(e) * t > Tn,
|
|
1891
1891
|
value: Math.floor(Tn / t)
|
|
1892
|
-
}),
|
|
1892
|
+
}), Za = (e = "", t = "", n) => {
|
|
1893
1893
|
if (n === V.STOP_LOSS)
|
|
1894
1894
|
return {
|
|
1895
|
-
isError:
|
|
1895
|
+
isError: v(t || 0).gte(v(e || 0)),
|
|
1896
1896
|
value: e
|
|
1897
1897
|
};
|
|
1898
|
-
},
|
|
1898
|
+
}, Ya = (e = "", t = "", n) => {
|
|
1899
1899
|
if (n === V.TAKE_PROFIT)
|
|
1900
1900
|
return {
|
|
1901
|
-
isError:
|
|
1901
|
+
isError: v(t || 0).lte(v(e || 0)),
|
|
1902
1902
|
value: e
|
|
1903
1903
|
};
|
|
1904
|
-
},
|
|
1904
|
+
}, Ja = (e = "", t = "", n = !1, r) => {
|
|
1905
1905
|
if (!n && r === V.STOP_LOSS)
|
|
1906
1906
|
return {
|
|
1907
|
-
isError:
|
|
1907
|
+
isError: v(t || 0).gte(v(e || 0)),
|
|
1908
1908
|
value: e
|
|
1909
1909
|
};
|
|
1910
|
-
},
|
|
1910
|
+
}, ei = (e = "", t = "", n = !1, r) => {
|
|
1911
1911
|
if (!n && r === V.TAKE_PROFIT)
|
|
1912
1912
|
return {
|
|
1913
|
-
isError:
|
|
1913
|
+
isError: v(t || 0).gte(v(e || 0)),
|
|
1914
1914
|
value: e
|
|
1915
1915
|
};
|
|
1916
|
-
},
|
|
1916
|
+
}, ti = (e, t) => e === V.STOP_LOSS || e === V.TAKE_PROFIT ? {
|
|
1917
1917
|
isError: Pt(t) > 5184e6,
|
|
1918
1918
|
value: 5184e6
|
|
1919
1919
|
} : {
|
|
1920
1920
|
isError: Pt(t) > Tn,
|
|
1921
1921
|
// 365 days
|
|
1922
1922
|
value: Tn
|
|
1923
|
-
},
|
|
1924
|
-
isError: Pt(e) <
|
|
1925
|
-
value:
|
|
1926
|
-
}),
|
|
1923
|
+
}, ni = (e) => ({
|
|
1924
|
+
isError: Pt(e) < vr,
|
|
1925
|
+
value: vr
|
|
1926
|
+
}), ri = (e) => ({
|
|
1927
1927
|
isError: Pt(e) < Hn,
|
|
1928
1928
|
value: Hn
|
|
1929
|
-
}),
|
|
1930
|
-
isError:
|
|
1929
|
+
}), si = (e, t, n) => ({
|
|
1930
|
+
isError: v(t || 0).multipliedBy(e || 0).isLessThan(n),
|
|
1931
1931
|
value: n
|
|
1932
|
-
}),
|
|
1933
|
-
isError: n === V.TWAP &&
|
|
1932
|
+
}), ai = (e, t, n) => ({
|
|
1933
|
+
isError: n === V.TWAP && v(e).isGreaterThan(t),
|
|
1934
1934
|
value: t
|
|
1935
|
-
}),
|
|
1936
|
-
if (e ===
|
|
1935
|
+
}), ii = (e, t) => {
|
|
1936
|
+
if (e === ke.Pancake)
|
|
1937
1937
|
switch (t) {
|
|
1938
1938
|
case 56:
|
|
1939
|
-
return
|
|
1939
|
+
return z.PancakeSwap;
|
|
1940
1940
|
case 42161:
|
|
1941
|
-
return
|
|
1941
|
+
return z.PancakeSwapArbitrum;
|
|
1942
1942
|
case 8453:
|
|
1943
|
-
return
|
|
1943
|
+
return z.PancakeSwapBase;
|
|
1944
1944
|
case 59144:
|
|
1945
|
-
return
|
|
1945
|
+
return z.PancakeSwapLinea;
|
|
1946
1946
|
default:
|
|
1947
|
-
return
|
|
1947
|
+
return z.PancakeSwap;
|
|
1948
1948
|
}
|
|
1949
|
-
if (e ===
|
|
1949
|
+
if (e === ke.Sushiswap)
|
|
1950
1950
|
switch (t) {
|
|
1951
1951
|
case 1:
|
|
1952
|
-
return
|
|
1952
|
+
return z.SushiEth;
|
|
1953
1953
|
case 42161:
|
|
1954
|
-
return
|
|
1954
|
+
return z.SushiArb;
|
|
1955
1955
|
case 8453:
|
|
1956
|
-
return
|
|
1956
|
+
return z.SushiBase;
|
|
1957
1957
|
case 747474:
|
|
1958
|
-
return
|
|
1958
|
+
return z.SushiKatana;
|
|
1959
1959
|
default:
|
|
1960
|
-
return
|
|
1960
|
+
return z.SushiEth;
|
|
1961
1961
|
}
|
|
1962
|
-
if (e ===
|
|
1962
|
+
if (e === ke.Quick)
|
|
1963
1963
|
switch (t) {
|
|
1964
1964
|
case 137:
|
|
1965
|
-
return
|
|
1965
|
+
return z.QuickSwap;
|
|
1966
1966
|
case 8453:
|
|
1967
|
-
return
|
|
1967
|
+
return z.QuickSwapBase;
|
|
1968
1968
|
default:
|
|
1969
|
-
return
|
|
1969
|
+
return z.QuickSwap;
|
|
1970
1970
|
}
|
|
1971
|
-
if (e ===
|
|
1971
|
+
if (e === ke.Thena)
|
|
1972
1972
|
switch (t) {
|
|
1973
1973
|
case 56:
|
|
1974
|
-
return
|
|
1974
|
+
return z.Thena;
|
|
1975
1975
|
default:
|
|
1976
|
-
return
|
|
1976
|
+
return z.Thena;
|
|
1977
1977
|
}
|
|
1978
|
-
if (e ===
|
|
1978
|
+
if (e === ke.Spooky)
|
|
1979
1979
|
switch (t) {
|
|
1980
1980
|
case 250:
|
|
1981
|
-
return
|
|
1981
|
+
return z.SpookySwap;
|
|
1982
1982
|
case 146:
|
|
1983
|
-
return
|
|
1983
|
+
return z.SpookySwapSonic;
|
|
1984
1984
|
default:
|
|
1985
|
-
return
|
|
1985
|
+
return z.SpookySwap;
|
|
1986
1986
|
}
|
|
1987
|
-
if (e ===
|
|
1987
|
+
if (e === ke.Lynex)
|
|
1988
1988
|
switch (t) {
|
|
1989
1989
|
case 59144:
|
|
1990
|
-
return
|
|
1990
|
+
return z.Lynex;
|
|
1991
1991
|
default:
|
|
1992
|
-
return
|
|
1992
|
+
return z.Lynex;
|
|
1993
1993
|
}
|
|
1994
|
-
if (e ===
|
|
1994
|
+
if (e === ke.Swapx)
|
|
1995
1995
|
switch (t) {
|
|
1996
1996
|
case 146:
|
|
1997
|
-
return
|
|
1997
|
+
return z.SwapX;
|
|
1998
1998
|
default:
|
|
1999
|
-
return
|
|
1999
|
+
return z.SwapX;
|
|
2000
2000
|
}
|
|
2001
|
-
if (e ===
|
|
2001
|
+
if (e === ke.Blackhole)
|
|
2002
2002
|
switch (t) {
|
|
2003
2003
|
case 43114:
|
|
2004
|
-
return
|
|
2004
|
+
return z.BlackholeAvax;
|
|
2005
2005
|
default:
|
|
2006
|
-
return
|
|
2006
|
+
return z.BlackholeAvax;
|
|
2007
2007
|
}
|
|
2008
|
-
},
|
|
2008
|
+
}, fs = (e, t = 0) => {
|
|
2009
|
+
if (!ps(e, t))
|
|
2010
|
+
throw new Error(
|
|
2011
|
+
`Partner "${e}" is not supported on chain ${t}`
|
|
2012
|
+
);
|
|
2009
2013
|
const { abi: n, ...r } = us.config(t, e);
|
|
2010
2014
|
if (!r.reactor)
|
|
2011
2015
|
throw new Error(
|
|
@@ -2014,25 +2018,30 @@ const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0"
|
|
|
2014
2018
|
return {
|
|
2015
2019
|
...r,
|
|
2016
2020
|
partner: e,
|
|
2017
|
-
twapConfig:
|
|
2021
|
+
twapConfig: ii(e, t)
|
|
2018
2022
|
};
|
|
2019
|
-
},
|
|
2023
|
+
}, oi = () => {
|
|
2020
2024
|
var n;
|
|
2021
2025
|
const e = us.raw, t = ((n = e["*"]) == null ? void 0 : n.dex) ?? {};
|
|
2022
2026
|
return Object.entries(e).filter(([r]) => r !== "*").flatMap(([r, s]) => {
|
|
2023
|
-
const a = { ...t, ...(s == null ? void 0 : s.dex) ?? {} };
|
|
2024
|
-
return !
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2027
|
+
const a = Number(r), o = { ...t, ...(s == null ? void 0 : s.dex) ?? {} };
|
|
2028
|
+
return !o || typeof o != "object" ? [] : Object.entries(o).flatMap(([u]) => {
|
|
2029
|
+
const p = u;
|
|
2030
|
+
return ps(p, a) ? [
|
|
2031
|
+
{
|
|
2032
|
+
chainId: a,
|
|
2033
|
+
name: u,
|
|
2034
|
+
config: fs(p, a)
|
|
2035
|
+
}
|
|
2036
|
+
] : [];
|
|
2037
|
+
});
|
|
2029
2038
|
}).sort((r, s) => r.name.localeCompare(s.name));
|
|
2030
|
-
},
|
|
2039
|
+
}, ci = (e) => {
|
|
2031
2040
|
const t = Sn(
|
|
2032
2041
|
an.MIN_CHUNK_SIZE_USD
|
|
2033
2042
|
);
|
|
2034
2043
|
return t ? parseInt(t) : e;
|
|
2035
|
-
},
|
|
2044
|
+
}, ui = ({
|
|
2036
2045
|
marketPrice: e,
|
|
2037
2046
|
typedInputAmount: t,
|
|
2038
2047
|
srcUsd1Token: n,
|
|
@@ -2045,9 +2054,9 @@ const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0"
|
|
|
2045
2054
|
balanceError: f,
|
|
2046
2055
|
minTradeSizeError: T
|
|
2047
2056
|
}) => {
|
|
2048
|
-
if (!Sn(an.IGNORE_ERRORS) && !(
|
|
2057
|
+
if (!Sn(an.IGNORE_ERRORS) && !(v(e || 0).isZero() || v(t || 0).isZero() || v(n || "0").isZero() || r))
|
|
2049
2058
|
return T || s || a || o || u || p || f;
|
|
2050
|
-
},
|
|
2059
|
+
}, di = (e, t) => {
|
|
2051
2060
|
const n = Date.now().toString(), r = parseInt((e / 1e3).toFixed(0)), s = ka(t / 1e3), a = Sn(an.FRESHNESS), o = a ? parseInt(a) : 60;
|
|
2052
2061
|
return {
|
|
2053
2062
|
nonce: n,
|
|
@@ -2055,7 +2064,7 @@ const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0"
|
|
|
2055
2064
|
deadline: s,
|
|
2056
2065
|
freshness: o
|
|
2057
2066
|
};
|
|
2058
|
-
},
|
|
2067
|
+
}, li = ({
|
|
2059
2068
|
chainId: e,
|
|
2060
2069
|
srcToken: t,
|
|
2061
2070
|
dstToken: n,
|
|
@@ -2070,10 +2079,10 @@ const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0"
|
|
|
2070
2079
|
config: y,
|
|
2071
2080
|
module: b
|
|
2072
2081
|
}) => {
|
|
2073
|
-
const { nonce: S, epoch: P, deadline: O, freshness: B } =
|
|
2082
|
+
const { nonce: S, epoch: P, deadline: O, freshness: B } = di(
|
|
2074
2083
|
a,
|
|
2075
2084
|
s
|
|
2076
|
-
), R = Math.floor(Date.now() / 1e3).toString(),
|
|
2085
|
+
), R = Math.floor(Date.now() / 1e3).toString(), F = f, q = b === V.STOP_LOSS ? T : "0", _ = b === V.TAKE_PROFIT ? T : "0", Q = {
|
|
2077
2086
|
permitted: {
|
|
2078
2087
|
token: t,
|
|
2079
2088
|
amount: r
|
|
@@ -2106,9 +2115,9 @@ const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0"
|
|
|
2106
2115
|
},
|
|
2107
2116
|
output: {
|
|
2108
2117
|
token: n,
|
|
2109
|
-
limit: F
|
|
2110
|
-
triggerLower:
|
|
2111
|
-
triggerUpper:
|
|
2118
|
+
limit: v(F || 0).toFixed(),
|
|
2119
|
+
triggerLower: v(q || 0).toFixed(),
|
|
2120
|
+
triggerUpper: v(_ || 0).toFixed(),
|
|
2112
2121
|
recipient: u
|
|
2113
2122
|
}
|
|
2114
2123
|
}
|
|
@@ -2120,20 +2129,20 @@ const Pt = (e) => e ? e.value * e.unit : 0, ka = (e) => !e || e === "NaN" ? "0"
|
|
|
2120
2129
|
chainId: e,
|
|
2121
2130
|
verifyingContract: y.repermit
|
|
2122
2131
|
},
|
|
2123
|
-
order:
|
|
2124
|
-
types:
|
|
2125
|
-
primaryType:
|
|
2132
|
+
order: Q,
|
|
2133
|
+
types: Fa,
|
|
2134
|
+
primaryType: wa
|
|
2126
2135
|
};
|
|
2127
|
-
},
|
|
2128
|
-
let
|
|
2129
|
-
function
|
|
2130
|
-
|
|
2136
|
+
}, pi = 0.7, fi = `https://bi.orbs.network/putes/twap-ui-${pi}`;
|
|
2137
|
+
let zn = "unknown";
|
|
2138
|
+
function hi(e) {
|
|
2139
|
+
zn = e;
|
|
2131
2140
|
}
|
|
2132
2141
|
function qn() {
|
|
2133
2142
|
const e = Math.random().toString(36).substring(2, 16), t = Math.random().toString(36).substring(2, 16), n = Date.now().toString(36);
|
|
2134
2143
|
return `id_${e + t + n}`;
|
|
2135
2144
|
}
|
|
2136
|
-
const
|
|
2145
|
+
const mi = (e, t, n) => {
|
|
2137
2146
|
var r, s, a, o, u, p, f, T, y;
|
|
2138
2147
|
return {
|
|
2139
2148
|
spotVersion: ur.version,
|
|
@@ -2162,7 +2171,7 @@ const fi = (e, t, n) => {
|
|
|
2162
2171
|
};
|
|
2163
2172
|
}, Pr = async (e) => {
|
|
2164
2173
|
try {
|
|
2165
|
-
await fetch(
|
|
2174
|
+
await fetch(fi, {
|
|
2166
2175
|
method: "POST",
|
|
2167
2176
|
headers: {
|
|
2168
2177
|
Accept: "application/json",
|
|
@@ -2174,7 +2183,7 @@ const fi = (e, t, n) => {
|
|
|
2174
2183
|
console.error("Failed to send BI", t);
|
|
2175
2184
|
}
|
|
2176
2185
|
};
|
|
2177
|
-
class
|
|
2186
|
+
class yi {
|
|
2178
2187
|
constructor() {
|
|
2179
2188
|
ln(this, "timeout");
|
|
2180
2189
|
ln(this, "config");
|
|
@@ -2304,9 +2313,9 @@ class hi {
|
|
|
2304
2313
|
this.config = t, (r !== ((a = this.data) == null ? void 0 : a.chainId) || s !== ((o = this.data) == null ? void 0 : o.appId)) && (this.data = {
|
|
2305
2314
|
_id: qn(),
|
|
2306
2315
|
action: "module-import",
|
|
2307
|
-
uiVersion:
|
|
2316
|
+
uiVersion: zn,
|
|
2308
2317
|
appId: s,
|
|
2309
|
-
...
|
|
2318
|
+
...mi(t, n, r),
|
|
2310
2319
|
origin: window.location.origin
|
|
2311
2320
|
}, this.updateAndSend(this.data));
|
|
2312
2321
|
}
|
|
@@ -2329,7 +2338,7 @@ class hi {
|
|
|
2329
2338
|
this.data = {
|
|
2330
2339
|
_id: qn(),
|
|
2331
2340
|
action: "reset",
|
|
2332
|
-
uiVersion:
|
|
2341
|
+
uiVersion: zn,
|
|
2333
2342
|
appId: this.data.appId,
|
|
2334
2343
|
origin: this.data.origin,
|
|
2335
2344
|
spotVersion: ur.version,
|
|
@@ -2366,15 +2375,15 @@ class hi {
|
|
|
2366
2375
|
});
|
|
2367
2376
|
}
|
|
2368
2377
|
}
|
|
2369
|
-
const pe = new
|
|
2378
|
+
const pe = new yi(), gi = (e) => {
|
|
2370
2379
|
var f;
|
|
2371
|
-
const t =
|
|
2380
|
+
const t = v(e.order.witness.output.limit || 0).gt(1), { stop: n, triggerLower: r, triggerUpper: s } = e.order.witness.output, a = v(n || 0).eq(os), o = a || v(s || 0).gt(0), u = !a && v(n || 0).gt(0) || v(r || 0).gt(0), p = ((f = e.metadata.chunks) == null ? void 0 : f.length) || v(e.order.witness.input.maxAmount).div(v(e.order.witness.input.amount)).toNumber();
|
|
2372
2381
|
return o ? t ? X.TAKE_PROFIT_LIMIT : X.TAKE_PROFIT_MARKET : u ? t ? X.STOP_LOSS_LIMIT : X.STOP_LOSS_MARKET : t ? p > 1 && t ? X.TWAP_LIMIT : t ? X.LIMIT : X.TWAP_MARKET : X.TWAP_MARKET;
|
|
2373
|
-
},
|
|
2382
|
+
}, Ai = (e) => {
|
|
2374
2383
|
var s;
|
|
2375
|
-
const t = ((s = e.metadata.chunks) == null ? void 0 : s.filter((a) => a.status === "success").length) || 0, n = e.metadata.expectedChunks || 0, r =
|
|
2384
|
+
const t = ((s = e.metadata.chunks) == null ? void 0 : s.filter((a) => a.status === "success").length) || 0, n = e.metadata.expectedChunks || 0, r = v(t).dividedBy(n).toNumber();
|
|
2376
2385
|
return r >= 0.99 ? 100 : r <= 0 ? 0 : Number((r * 100).toFixed(2));
|
|
2377
|
-
},
|
|
2386
|
+
}, Ei = (e, t) => e.metadata.status === "completed" || t >= 99 ? le.Completed : ["pending", "eligible"].includes(e.metadata.status) ? le.Open : e.metadata.description.toLowerCase() === "cancelled by contract" ? le.Cancelled : le.Expired, bi = (e) => {
|
|
2378
2387
|
var n;
|
|
2379
2388
|
return (((n = e.metadata.chunks) == null ? void 0 : n.filter((r) => r.status === "success")) || []).map((r) => ({
|
|
2380
2389
|
inAmount: r.inAmount,
|
|
@@ -2382,26 +2391,26 @@ const pe = new hi(), mi = (e) => {
|
|
|
2382
2391
|
timestamp: new Date(r.timestamp).getTime(),
|
|
2383
2392
|
txHash: r.txHash
|
|
2384
2393
|
}));
|
|
2385
|
-
},
|
|
2394
|
+
}, xi = (e, t) => {
|
|
2386
2395
|
var r;
|
|
2387
2396
|
const n = e.length;
|
|
2388
2397
|
return n >= t && ((r = e[n - 1]) == null ? void 0 : r.timestamp) || 0;
|
|
2389
|
-
},
|
|
2390
|
-
const { triggerLower: t = "0", triggerUpper: n = "0" } = e.order.witness.output, r = lr(e), s = e.metadata.expectedChunks || 1, a =
|
|
2398
|
+
}, Ci = (e) => v(e.metadata.displayOnlyInputTokenPriceUSD).dividedBy(1e18).toFixed(), lr = (e) => Number(e.order.witness.output.limit) === 1 ? "" : e.order.witness.output.limit, Ti = (e) => {
|
|
2399
|
+
const { triggerLower: t = "0", triggerUpper: n = "0" } = e.order.witness.output, r = lr(e), s = e.metadata.expectedChunks || 1, a = v(n || 0).gt(0);
|
|
2391
2400
|
return {
|
|
2392
2401
|
dstMinAmountPerTrade: r,
|
|
2393
2402
|
triggerPricePerTrade: a ? n : t,
|
|
2394
|
-
dstMinAmountTotal:
|
|
2403
|
+
dstMinAmountTotal: v(r).multipliedBy(s).toFixed()
|
|
2395
2404
|
};
|
|
2396
|
-
},
|
|
2397
|
-
const t = lr(e), n =
|
|
2405
|
+
}, wi = (e) => {
|
|
2406
|
+
const t = lr(e), n = v(e.order.witness.output.stop || 0).eq(os), r = e.metadata.expectedChunks || 1;
|
|
2398
2407
|
return {
|
|
2399
2408
|
dstMinAmountPerTrade: n ? "" : t,
|
|
2400
|
-
triggerPricePerTrade: n ? t :
|
|
2401
|
-
dstMinAmountTotal: n ? "" :
|
|
2409
|
+
triggerPricePerTrade: n ? t : v(e.order.witness.output.stop || "").toFixed(),
|
|
2410
|
+
dstMinAmountTotal: n ? "" : v(t).multipliedBy(r).toFixed()
|
|
2402
2411
|
};
|
|
2403
|
-
},
|
|
2404
|
-
const t =
|
|
2412
|
+
}, Fi = (e) => Number(dr) >= 2 ? Ti(e) : wi(e), hs = (e) => {
|
|
2413
|
+
const t = Ai(e), n = lr(e), r = e.metadata.expectedChunks || 1, s = bi(e), a = gi(e);
|
|
2405
2414
|
return {
|
|
2406
2415
|
id: e.hash,
|
|
2407
2416
|
hash: e.hash,
|
|
@@ -2409,28 +2418,28 @@ const pe = new hi(), mi = (e) => {
|
|
|
2409
2418
|
type: a,
|
|
2410
2419
|
maker: e.order.witness.swapper,
|
|
2411
2420
|
progress: t,
|
|
2412
|
-
srcAmountFilled: s.reduce((o, u) => o.plus(u.inAmount), new
|
|
2413
|
-
dstAmountFilled: s.reduce((o, u) => o.plus(u.outAmount), new
|
|
2421
|
+
srcAmountFilled: s.reduce((o, u) => o.plus(u.inAmount), new v(0)).toFixed() || "",
|
|
2422
|
+
dstAmountFilled: s.reduce((o, u) => o.plus(u.outAmount), new v(0)).toFixed() || "",
|
|
2414
2423
|
fills: s,
|
|
2415
2424
|
srcTokenAddress: e.order.witness.input.token,
|
|
2416
2425
|
dstTokenAddress: e.order.witness.output.token,
|
|
2417
|
-
orderDollarValueIn:
|
|
2426
|
+
orderDollarValueIn: Ci(e),
|
|
2418
2427
|
fillDelay: e.order.witness.epoch * 1e3,
|
|
2419
2428
|
deadline: Number(e.order.deadline) * 1e3,
|
|
2420
2429
|
createdAt: new Date(e.timestamp).getTime(),
|
|
2421
2430
|
srcAmount: e.order.witness.input.maxAmount,
|
|
2422
2431
|
srcAmountPerTrade: e.order.witness.input.amount,
|
|
2423
2432
|
totalTradesAmount: r,
|
|
2424
|
-
isMarketPrice:
|
|
2433
|
+
isMarketPrice: v(n || 0).lte(1),
|
|
2425
2434
|
chainId: e.order.witness.chainid,
|
|
2426
|
-
filledOrderTimestamp:
|
|
2427
|
-
status:
|
|
2435
|
+
filledOrderTimestamp: xi(s, r),
|
|
2436
|
+
status: Ei(e, t),
|
|
2428
2437
|
repermitDigest: e.metadata.repermitDigest,
|
|
2429
2438
|
isTriggerPrice: a === X.TAKE_PROFIT_MARKET || a === X.TAKE_PROFIT_LIMIT || a === X.STOP_LOSS_LIMIT || a === X.STOP_LOSS_MARKET,
|
|
2430
2439
|
rawOrder: e,
|
|
2431
|
-
...
|
|
2440
|
+
...Fi(e)
|
|
2432
2441
|
};
|
|
2433
|
-
},
|
|
2442
|
+
}, vi = async ({
|
|
2434
2443
|
chainId: e,
|
|
2435
2444
|
signal: t,
|
|
2436
2445
|
account: n,
|
|
@@ -2440,11 +2449,11 @@ const pe = new hi(), mi = (e) => {
|
|
|
2440
2449
|
}) => {
|
|
2441
2450
|
try {
|
|
2442
2451
|
if (!n) return [];
|
|
2443
|
-
const o =
|
|
2452
|
+
const o = ya(a), u = /* @__PURE__ */ new Map();
|
|
2444
2453
|
return (await Promise.all(
|
|
2445
2454
|
o.map(async (f) => {
|
|
2446
2455
|
try {
|
|
2447
|
-
const T =
|
|
2456
|
+
const T = Aa({
|
|
2448
2457
|
endpoint: f,
|
|
2449
2458
|
exchange: r,
|
|
2450
2459
|
partner: s
|
|
@@ -2459,7 +2468,7 @@ const pe = new hi(), mi = (e) => {
|
|
|
2459
2468
|
const P = [];
|
|
2460
2469
|
for (const O of S.orders)
|
|
2461
2470
|
try {
|
|
2462
|
-
P.push(
|
|
2471
|
+
P.push(hs(O));
|
|
2463
2472
|
} catch {
|
|
2464
2473
|
continue;
|
|
2465
2474
|
}
|
|
@@ -2474,7 +2483,7 @@ const pe = new hi(), mi = (e) => {
|
|
|
2474
2483
|
} catch {
|
|
2475
2484
|
return [];
|
|
2476
2485
|
}
|
|
2477
|
-
},
|
|
2486
|
+
}, Si = async (e, t, n = !1) => {
|
|
2478
2487
|
try {
|
|
2479
2488
|
const r = {
|
|
2480
2489
|
signature: t,
|
|
@@ -2482,7 +2491,7 @@ const pe = new hi(), mi = (e) => {
|
|
|
2482
2491
|
status: "pending"
|
|
2483
2492
|
};
|
|
2484
2493
|
pe.onCreateOrderRequest();
|
|
2485
|
-
const s = await fetch(`${
|
|
2494
|
+
const s = await fetch(`${ma(n)}/orders/new`, {
|
|
2486
2495
|
method: "POST",
|
|
2487
2496
|
body: JSON.stringify(r)
|
|
2488
2497
|
}), a = await s.json().catch(() => ({}));
|
|
@@ -2492,14 +2501,14 @@ const pe = new hi(), mi = (e) => {
|
|
|
2492
2501
|
}
|
|
2493
2502
|
if (!a.signedOrder || typeof a.signedOrder != "object")
|
|
2494
2503
|
throw new Error("Invalid API response: missing signedOrder");
|
|
2495
|
-
const o =
|
|
2504
|
+
const o = hs(a.signedOrder);
|
|
2496
2505
|
return pe.onCreateOrderSuccess(o.id), o;
|
|
2497
2506
|
} catch (r) {
|
|
2498
2507
|
throw pe.onCreateOrderError(r), console.error(r), r;
|
|
2499
2508
|
}
|
|
2500
|
-
}, je = (e, t) => e && e.length ? e.map(t || ((n) => `${n}`)) : void 0,
|
|
2509
|
+
}, je = (e, t) => e && e.length ? e.map(t || ((n) => `${n}`)) : void 0, Di = (e) => {
|
|
2501
2510
|
if (e)
|
|
2502
|
-
return
|
|
2511
|
+
return ba[e];
|
|
2503
2512
|
}, pr = async ({
|
|
2504
2513
|
chainId: e,
|
|
2505
2514
|
buildQuery: t,
|
|
@@ -2509,8 +2518,8 @@ const pe = new hi(), mi = (e) => {
|
|
|
2509
2518
|
limit: a = 1e3,
|
|
2510
2519
|
page: o
|
|
2511
2520
|
}) => {
|
|
2512
|
-
const u =
|
|
2513
|
-
if (!u) throw new
|
|
2521
|
+
const u = Di(e);
|
|
2522
|
+
if (!u) throw new _i();
|
|
2514
2523
|
const p = async (y) => {
|
|
2515
2524
|
let b = 0;
|
|
2516
2525
|
for (; b <= s; )
|
|
@@ -2564,17 +2573,17 @@ const pe = new hi(), mi = (e) => {
|
|
|
2564
2573
|
f++;
|
|
2565
2574
|
}
|
|
2566
2575
|
return T;
|
|
2567
|
-
},
|
|
2576
|
+
}, ms = (e) => e.map((t) => ({
|
|
2568
2577
|
inAmount: t.srcAmountIn,
|
|
2569
2578
|
outAmount: t.dstAmountOut,
|
|
2570
2579
|
timestamp: t.timestamp,
|
|
2571
2580
|
txHash: t.transactionHash
|
|
2572
2581
|
})), Or = (e, t) => {
|
|
2573
|
-
const n =
|
|
2582
|
+
const n = v(e || 0).gt(1);
|
|
2574
2583
|
return !n && t === 1 ? X.TWAP_MARKET : t > 1 && n ? X.TWAP_LIMIT : n ? X.LIMIT : X.TWAP_MARKET;
|
|
2575
|
-
},
|
|
2584
|
+
}, Pi = (e, t, n, r) => {
|
|
2576
2585
|
var b;
|
|
2577
|
-
const s =
|
|
2586
|
+
const s = ms(n || []), a = new v(e.ask_srcAmount || 0).div(e.ask_srcBidAmount).integerValue(v.ROUND_FLOOR).toNumber(), u = (n == null ? void 0 : n.length) === a ? (b = n == null ? void 0 : n[(n == null ? void 0 : n.length) - 1]) == null ? void 0 : b.timestamp : void 0, p = s.reduce((S, P) => S.plus(P.inAmount), new v(0)).toFixed(), f = s.reduce((S, P) => S.plus(P.outAmount), new v(0)).toFixed(), T = ys(e.ask_srcAmount, p), y = Or(e.ask_dstMinAmount, a);
|
|
2578
2587
|
return {
|
|
2579
2588
|
repermitDigest: "",
|
|
2580
2589
|
version: 1,
|
|
@@ -2590,14 +2599,14 @@ const pe = new hi(), mi = (e) => {
|
|
|
2590
2599
|
progress: T,
|
|
2591
2600
|
dstAmountFilled: f,
|
|
2592
2601
|
srcAmountFilled: p,
|
|
2593
|
-
orderDollarValueIn:
|
|
2602
|
+
orderDollarValueIn: v(e.dollarValueIn || 0).toFixed(6),
|
|
2594
2603
|
srcAmount: e.ask_srcAmount,
|
|
2595
|
-
dstMinAmountTotal:
|
|
2604
|
+
dstMinAmountTotal: v(e.ask_dstMinAmount).multipliedBy(a).toString(),
|
|
2596
2605
|
fills: s,
|
|
2597
2606
|
fillDelay: e.ask_fillDelay,
|
|
2598
2607
|
deadline: e.ask_deadline * 1e3,
|
|
2599
2608
|
createdAt: new Date(e.timestamp).getTime(),
|
|
2600
|
-
dstMinAmountPerTrade:
|
|
2609
|
+
dstMinAmountPerTrade: v(e.ask_dstMinAmount).eq(1) ? "" : e.ask_dstMinAmount,
|
|
2601
2610
|
triggerPricePerTrade: "",
|
|
2602
2611
|
srcAmountPerTrade: e.ask_srcBidAmount,
|
|
2603
2612
|
txHash: e.transactionHash,
|
|
@@ -2608,14 +2617,14 @@ const pe = new hi(), mi = (e) => {
|
|
|
2608
2617
|
status: r,
|
|
2609
2618
|
rawOrder: e
|
|
2610
2619
|
};
|
|
2611
|
-
},
|
|
2620
|
+
}, Oi = (e) => {
|
|
2612
2621
|
var y;
|
|
2613
2622
|
if (!e) return "";
|
|
2614
2623
|
const t = je(
|
|
2615
2624
|
e.accounts,
|
|
2616
2625
|
(b) => `"${b.toLowerCase()}"`
|
|
2617
2626
|
), n = je(
|
|
2618
|
-
|
|
2627
|
+
Ua(e.configs),
|
|
2619
2628
|
(b) => `"${b.toLowerCase()}"`
|
|
2620
2629
|
), r = je(
|
|
2621
2630
|
e.inTokenSymbols,
|
|
@@ -2653,14 +2662,14 @@ const pe = new hi(), mi = (e) => {
|
|
|
2653
2662
|
(e == null ? void 0 : e.orderType) === "market" ? "ask_dstMinAmount_lte: 1" : ""
|
|
2654
2663
|
].filter(Boolean).join(", ");
|
|
2655
2664
|
};
|
|
2656
|
-
async function
|
|
2665
|
+
async function Ii({
|
|
2657
2666
|
chainId: e,
|
|
2658
2667
|
signal: t,
|
|
2659
2668
|
page: n,
|
|
2660
2669
|
limit: r,
|
|
2661
2670
|
filters: s
|
|
2662
2671
|
}) {
|
|
2663
|
-
const a = r || 1e3, o =
|
|
2672
|
+
const a = r || 1e3, o = Oi(s);
|
|
2664
2673
|
return await pr({
|
|
2665
2674
|
chainId: e,
|
|
2666
2675
|
signal: t,
|
|
@@ -2707,13 +2716,13 @@ async function Pi({
|
|
|
2707
2716
|
}
|
|
2708
2717
|
});
|
|
2709
2718
|
}
|
|
2710
|
-
const
|
|
2719
|
+
const Bi = async ({
|
|
2711
2720
|
chainId: e,
|
|
2712
2721
|
orders: t,
|
|
2713
2722
|
signal: n
|
|
2714
2723
|
}) => {
|
|
2715
2724
|
if (t.length === 0) return [];
|
|
2716
|
-
const r =
|
|
2725
|
+
const r = Qn(t.map((u) => u.Contract_id.toString()));
|
|
2717
2726
|
if (!r.length) return [];
|
|
2718
2727
|
const a = `where: { twapId_in: [${r.map((u) => `"${u}"`).join(", ")}]}`;
|
|
2719
2728
|
return await pr({
|
|
@@ -2739,15 +2748,15 @@ const Oi = async ({
|
|
|
2739
2748
|
}
|
|
2740
2749
|
});
|
|
2741
2750
|
};
|
|
2742
|
-
function
|
|
2751
|
+
function Qn(e) {
|
|
2743
2752
|
return Array.from(new Set(e));
|
|
2744
2753
|
}
|
|
2745
|
-
const
|
|
2754
|
+
const Ri = async ({
|
|
2746
2755
|
chainId: e,
|
|
2747
2756
|
orders: t,
|
|
2748
2757
|
signal: n
|
|
2749
2758
|
}) => {
|
|
2750
|
-
const r =
|
|
2759
|
+
const r = Qn(t.map((y) => y.Contract_id)), s = Qn(t.map((y) => y.twapAddress)).filter(Boolean);
|
|
2751
2760
|
if (r.length === 0) return [];
|
|
2752
2761
|
const a = r.join(", "), o = s.map((y) => `"${y}"`).join(", "), u = s.length ? `twapAddress_in: [${o}]` : "", f = `where: { ${[
|
|
2753
2762
|
`TWAP_id_in: [${a}]`,
|
|
@@ -2784,12 +2793,12 @@ const Ii = async ({
|
|
|
2784
2793
|
}
|
|
2785
2794
|
});
|
|
2786
2795
|
};
|
|
2787
|
-
class
|
|
2796
|
+
class _i extends Error {
|
|
2788
2797
|
constructor() {
|
|
2789
2798
|
super("No graph endpoint found"), this.name = "NoGraphEndpointError";
|
|
2790
2799
|
}
|
|
2791
2800
|
}
|
|
2792
|
-
const
|
|
2801
|
+
const ki = async ({
|
|
2793
2802
|
chainId: e,
|
|
2794
2803
|
signal: t,
|
|
2795
2804
|
page: n,
|
|
@@ -2797,41 +2806,41 @@ const Ri = async ({
|
|
|
2797
2806
|
filters: s
|
|
2798
2807
|
}) => {
|
|
2799
2808
|
try {
|
|
2800
|
-
const a = await
|
|
2809
|
+
const a = await Ii({
|
|
2801
2810
|
chainId: e,
|
|
2802
2811
|
signal: t,
|
|
2803
2812
|
page: n,
|
|
2804
2813
|
limit: r,
|
|
2805
2814
|
filters: s
|
|
2806
2815
|
}), [o, u] = await Promise.all([
|
|
2807
|
-
|
|
2808
|
-
|
|
2816
|
+
Ri({ chainId: e, orders: a, signal: t }),
|
|
2817
|
+
Bi({ chainId: e, orders: a, signal: t })
|
|
2809
2818
|
]), p = a.map((T) => {
|
|
2810
2819
|
const y = o == null ? void 0 : o.filter(
|
|
2811
2820
|
(b) => b.TWAP_id === Number(T.Contract_id) && $t(b.exchange, T.exchange) && $t(b.twapAddress, T.twapAddress)
|
|
2812
2821
|
);
|
|
2813
|
-
return
|
|
2822
|
+
return Pi(
|
|
2814
2823
|
T,
|
|
2815
2824
|
e,
|
|
2816
2825
|
y,
|
|
2817
|
-
|
|
2826
|
+
Ui(T, y || [], u)
|
|
2818
2827
|
);
|
|
2819
2828
|
}).sort((T, y) => y.createdAt - T.createdAt), f = /* @__PURE__ */ new Set();
|
|
2820
2829
|
return p.filter((T) => f.has(T.id) ? !1 : (f.add(T.id), !0));
|
|
2821
2830
|
} catch {
|
|
2822
2831
|
return [];
|
|
2823
2832
|
}
|
|
2824
|
-
},
|
|
2833
|
+
}, Ui = (e, t, n) => {
|
|
2825
2834
|
var u;
|
|
2826
2835
|
const r = (u = n == null ? void 0 : n.find(
|
|
2827
2836
|
(p) => p.twapId === e.Contract_id.toString() && $t(p.twapAddress, e.twapAddress)
|
|
2828
|
-
)) == null ? void 0 : u.status, a =
|
|
2829
|
-
return
|
|
2830
|
-
},
|
|
2837
|
+
)) == null ? void 0 : u.status, a = ms(t).reduce((p, f) => p.plus(f.inAmount), new v(0)).toFixed(), o = ys(e.ask_srcAmount, a);
|
|
2838
|
+
return Mi(o, e.ask_deadline * 1e3, r);
|
|
2839
|
+
}, ys = (e, t) => {
|
|
2831
2840
|
if (!t || !e) return 0;
|
|
2832
|
-
const n =
|
|
2841
|
+
const n = v(t).dividedBy(e).toNumber();
|
|
2833
2842
|
return n >= 0.99 ? 100 : n <= 0 ? 0 : Number((n * 100).toFixed(2));
|
|
2834
|
-
},
|
|
2843
|
+
}, Mi = (e, t, n) => e === 100 ? le.Completed : n === "CANCELLED" ? le.Cancelled : n === "COMPLETED" ? le.Completed : t > Date.now() ? le.Open : le.Expired, Li = async ({
|
|
2835
2844
|
signal: e,
|
|
2836
2845
|
page: t,
|
|
2837
2846
|
chainId: n,
|
|
@@ -2841,7 +2850,7 @@ const Ri = async ({
|
|
|
2841
2850
|
isDev: o = !1,
|
|
2842
2851
|
includeV1GraphOrders: u = !0
|
|
2843
2852
|
}) => (await Promise.all([
|
|
2844
|
-
!s || !u ? Promise.resolve([]) :
|
|
2853
|
+
!s || !u ? Promise.resolve([]) : ki({
|
|
2845
2854
|
chainId: n,
|
|
2846
2855
|
signal: e,
|
|
2847
2856
|
page: t,
|
|
@@ -2851,7 +2860,7 @@ const Ri = async ({
|
|
|
2851
2860
|
configs: s.twapConfig ? [s.twapConfig] : []
|
|
2852
2861
|
}
|
|
2853
2862
|
}),
|
|
2854
|
-
|
|
2863
|
+
vi({
|
|
2855
2864
|
chainId: n,
|
|
2856
2865
|
signal: e,
|
|
2857
2866
|
account: a,
|
|
@@ -2859,8 +2868,8 @@ const Ri = async ({
|
|
|
2859
2868
|
partner: s == null ? void 0 : s.partner,
|
|
2860
2869
|
isDev: o
|
|
2861
2870
|
})
|
|
2862
|
-
]).then(([T, y]) => [...T, ...y])).sort((T, y) => y.createdAt - T.createdAt),
|
|
2863
|
-
version:
|
|
2871
|
+
]).then(([T, y]) => [...T, ...y])).sort((T, y) => y.createdAt - T.createdAt), Ni = "1.1.37", qi = {
|
|
2872
|
+
version: Ni
|
|
2864
2873
|
}, Ir = (e) => {
|
|
2865
2874
|
let t;
|
|
2866
2875
|
const n = /* @__PURE__ */ new Set(), r = (f, T) => {
|
|
@@ -2871,8 +2880,8 @@ const Ri = async ({
|
|
|
2871
2880
|
}
|
|
2872
2881
|
}, s = () => t, u = { setState: r, getState: s, getInitialState: () => p, subscribe: (f) => (n.add(f), () => n.delete(f)) }, p = t = e(r, s, u);
|
|
2873
2882
|
return u;
|
|
2874
|
-
},
|
|
2875
|
-
function
|
|
2883
|
+
}, Ki = ((e) => e ? Ir(e) : Ir), Hi = (e) => e;
|
|
2884
|
+
function Wi(e, t = Hi) {
|
|
2876
2885
|
const n = fn.useSyncExternalStore(
|
|
2877
2886
|
e.subscribe,
|
|
2878
2887
|
fn.useCallback(() => t(e.getState()), [e, t]),
|
|
@@ -2881,14 +2890,14 @@ function Ki(e, t = qi) {
|
|
|
2881
2890
|
return fn.useDebugValue(n), n;
|
|
2882
2891
|
}
|
|
2883
2892
|
const Br = (e) => {
|
|
2884
|
-
const t =
|
|
2893
|
+
const t = Ki(e), n = (r) => Wi(t, r);
|
|
2885
2894
|
return Object.assign(n, t), n;
|
|
2886
|
-
},
|
|
2895
|
+
}, zi = ((e) => e ? Br(e) : Br), En = {}, Rr = {
|
|
2887
2896
|
currentTime: Date.now(),
|
|
2888
2897
|
cancelOrders: {},
|
|
2889
2898
|
swapExecutions: [En],
|
|
2890
2899
|
swapExecutionIndex: 0
|
|
2891
|
-
}, H =
|
|
2900
|
+
}, H = zi((e, t) => ({
|
|
2892
2901
|
state: Rr,
|
|
2893
2902
|
updateState: (n) => e((r) => ({ state: { ...r.state, ...n } })),
|
|
2894
2903
|
updateSwapExecutionAtIndex: (n, r) => e((s) => {
|
|
@@ -2915,14 +2924,14 @@ const Br = (e) => {
|
|
|
2915
2924
|
});
|
|
2916
2925
|
}
|
|
2917
2926
|
}));
|
|
2918
|
-
var
|
|
2919
|
-
const Dt = (e, t) => !t || !e ||
|
|
2927
|
+
var ve = /* @__PURE__ */ ((e) => (e[e.LOADING = 1] = "LOADING", e[e.SUCCESS = 2] = "SUCCESS", e[e.FAILED = 3] = "FAILED", e))(ve || {}), bn = /* @__PURE__ */ ((e) => (e.TRIGGER_MARKET_PRICE = "triggerMarketPriceDisclaimer", e.MARKET_PRICE = "marketOrderDisclaimer", e.LIMIT_PRICE = "limitOrderDisclaimer", e))(bn || {}), yt = /* @__PURE__ */ ((e) => (e.WRAP = "wrap", e.APPROVE = "approve", e.CREATE = "create", e))(yt || {});
|
|
2928
|
+
const Dt = (e, t) => !t || !e || v(e).isNaN() ? "" : v(e).multipliedBy(v(10).pow(t)).toFixed(0), Fe = (e, t) => {
|
|
2920
2929
|
try {
|
|
2921
|
-
return !t || !e ||
|
|
2930
|
+
return !t || !e || v(e).isNaN() ? "" : v(e).dividedBy(v(10).pow(t)).toFixed();
|
|
2922
2931
|
} catch (n) {
|
|
2923
2932
|
return console.error(n), "";
|
|
2924
2933
|
}
|
|
2925
|
-
},
|
|
2934
|
+
}, Nc = (e) => {
|
|
2926
2935
|
const t = "An error occurred.";
|
|
2927
2936
|
if (!e || !e.message) return t;
|
|
2928
2937
|
try {
|
|
@@ -2930,73 +2939,73 @@ const Dt = (e, t) => !t || !e || F(e).isNaN() ? "" : F(e).multipliedBy(F(10).pow
|
|
|
2930
2939
|
} catch {
|
|
2931
2940
|
return t;
|
|
2932
2941
|
}
|
|
2933
|
-
},
|
|
2942
|
+
}, gs = (e) => {
|
|
2934
2943
|
var t, n, r, s;
|
|
2935
2944
|
if (e != null && e.message)
|
|
2936
2945
|
return ((n = (t = e.message) == null ? void 0 : t.toLowerCase()) == null ? void 0 : n.includes("rejected")) || ((s = (r = e.message) == null ? void 0 : r.toLowerCase()) == null ? void 0 : s.includes("denied"));
|
|
2937
|
-
},
|
|
2946
|
+
}, Qi = (e, t) => {
|
|
2938
2947
|
const n = Vt(t);
|
|
2939
2948
|
return n && on(e.address) ? n.wToken : e;
|
|
2940
2949
|
};
|
|
2941
|
-
function
|
|
2950
|
+
function As(e) {
|
|
2942
2951
|
return e ? e / 864e5 : 0;
|
|
2943
2952
|
}
|
|
2944
2953
|
function $n(e) {
|
|
2945
2954
|
return e ? e / 6e4 : 0;
|
|
2946
2955
|
}
|
|
2947
|
-
const
|
|
2956
|
+
const qc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, Es = (e, t, n) => {
|
|
2948
2957
|
const r = Vt(n);
|
|
2949
2958
|
return on((e == null ? void 0 : e.address) || "") && $t((t == null ? void 0 : t.address) || "", (r == null ? void 0 : r.wToken.address) || "");
|
|
2950
|
-
},
|
|
2959
|
+
}, bs = (e, t, n) => {
|
|
2951
2960
|
const r = Vt(n);
|
|
2952
2961
|
return $t((e == null ? void 0 : e.address) || "", (r == null ? void 0 : r.wToken.address) || "") && on((t == null ? void 0 : t.address) || "");
|
|
2953
2962
|
}, cn = (e, t) => {
|
|
2954
2963
|
if (!t) return "";
|
|
2955
2964
|
const n = Vt(t);
|
|
2956
2965
|
return `${n == null ? void 0 : n.explorer}/tx/${e}`;
|
|
2957
|
-
}, fr = (e, t) =>
|
|
2966
|
+
}, fr = (e, t) => k(() => Dt(t, e), [e, t]), jt = (e, t) => k(() => Fe(t, e), [e, t]), hr = () => {
|
|
2958
2967
|
const { chainId: e } = N();
|
|
2959
|
-
return
|
|
2960
|
-
},
|
|
2968
|
+
return k(() => Vt(e), [e]);
|
|
2969
|
+
}, Kc = (e) => {
|
|
2961
2970
|
const t = hr();
|
|
2962
|
-
return
|
|
2971
|
+
return k(() => {
|
|
2963
2972
|
if (!(!e || !t))
|
|
2964
2973
|
return cn(e, t.id);
|
|
2965
2974
|
}, [e, t]);
|
|
2966
|
-
},
|
|
2975
|
+
}, Qe = (e, t) => k(() => !e || !t || v(e || "0").isZero() || v(t || "0").isZero() ? "" : v(e || "0").times(t).toFixed(), [e, t]), $i = () => {
|
|
2967
2976
|
const { srcToken: e, dstToken: t, chainId: n } = N();
|
|
2968
|
-
return
|
|
2969
|
-
},
|
|
2977
|
+
return k(() => Es(e, t, n), [e, t, n]);
|
|
2978
|
+
}, Vi = () => {
|
|
2970
2979
|
const { srcToken: e, dstToken: t, chainId: n } = N();
|
|
2971
|
-
return
|
|
2972
|
-
},
|
|
2973
|
-
const e =
|
|
2980
|
+
return k(() => bs(e, t, n), [e, t, n]);
|
|
2981
|
+
}, ji = () => {
|
|
2982
|
+
const e = $i(), t = Vi();
|
|
2974
2983
|
return e || t;
|
|
2975
2984
|
}, pt = () => {
|
|
2976
2985
|
const { srcToken: e, typedInputAmount: t } = N();
|
|
2977
2986
|
return {
|
|
2978
2987
|
amount: fr(e == null ? void 0 : e.decimals, t),
|
|
2979
2988
|
amountUI: t,
|
|
2980
|
-
error:
|
|
2989
|
+
error: v(t || 0).isZero() ? "enterAmount" : void 0
|
|
2981
2990
|
};
|
|
2982
|
-
},
|
|
2991
|
+
}, Gi = (e, t) => {
|
|
2983
2992
|
const { module: n, srcUsd1Token: r, marketPrice: s, minChunkSizeUsd: a, typedInputAmount: o } = N();
|
|
2984
|
-
return
|
|
2985
|
-
if (
|
|
2993
|
+
return k(() => {
|
|
2994
|
+
if (v(o || "0").isZero() || !s || v(r || "0").isZero()) return;
|
|
2986
2995
|
if (!e)
|
|
2987
2996
|
return {
|
|
2988
2997
|
type: me.MIN_CHUNKS,
|
|
2989
2998
|
value: 1,
|
|
2990
2999
|
args: { minChunks: "1" }
|
|
2991
3000
|
};
|
|
2992
|
-
const { isError: u } =
|
|
3001
|
+
const { isError: u } = ai(e, t, n);
|
|
2993
3002
|
if (u)
|
|
2994
3003
|
return {
|
|
2995
3004
|
type: me.MAX_CHUNKS,
|
|
2996
3005
|
value: t,
|
|
2997
3006
|
args: { maxChunks: `${t}` }
|
|
2998
3007
|
};
|
|
2999
|
-
const { isError: p, value: f } =
|
|
3008
|
+
const { isError: p, value: f } = si(o || "", r || "", a || 0);
|
|
3000
3009
|
if (p)
|
|
3001
3010
|
return {
|
|
3002
3011
|
type: me.MIN_TRADE_SIZE,
|
|
@@ -3005,15 +3014,15 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3005
3014
|
};
|
|
3006
3015
|
}, [e, t, n, o, r, a, s]);
|
|
3007
3016
|
}, $e = () => {
|
|
3008
|
-
const { srcToken: e, srcUsd1Token: t, module: n, minChunkSizeUsd: r } = N(), s = H((P) => P.state.typedChunks), a = H((P) => P.updateState), { amount: o, amountUI: u } = pt(), p =
|
|
3009
|
-
() =>
|
|
3017
|
+
const { srcToken: e, srcUsd1Token: t, module: n, minChunkSizeUsd: r } = N(), s = H((P) => P.state.typedChunks), a = H((P) => P.updateState), { amount: o, amountUI: u } = pt(), p = k(
|
|
3018
|
+
() => $a(u || "", t || "", r || 0),
|
|
3010
3019
|
[u, t, r]
|
|
3011
|
-
), f =
|
|
3020
|
+
), f = k(() => Qa(p, n, s), [p, s, n]), T = ne(
|
|
3012
3021
|
(P) => a({
|
|
3013
3022
|
typedChunks: P
|
|
3014
3023
|
}),
|
|
3015
3024
|
[a]
|
|
3016
|
-
), y =
|
|
3025
|
+
), y = k(() => Ga(o || "", f), [o, f]), b = jt(e == null ? void 0 : e.decimals, y), S = k(() => t ? v(b || "0").times(t || 0).toString() : "0", [b, t]);
|
|
3017
3026
|
return {
|
|
3018
3027
|
totalTrades: f,
|
|
3019
3028
|
maxTrades: p,
|
|
@@ -3021,9 +3030,9 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3021
3030
|
amountPerTrade: y,
|
|
3022
3031
|
amountPerTradeUsd: S,
|
|
3023
3032
|
onChange: T,
|
|
3024
|
-
error:
|
|
3033
|
+
error: Gi(f, p)
|
|
3025
3034
|
};
|
|
3026
|
-
},
|
|
3035
|
+
}, Xi = () => {
|
|
3027
3036
|
const { srcToken: e, dstToken: t } = N(), { onChange: n, totalTrades: r, amountPerTradeUsd: s, amountPerTradeUI: a, error: o, maxTrades: u, amountPerTrade: p } = $e();
|
|
3028
3037
|
return {
|
|
3029
3038
|
error: o,
|
|
@@ -3036,8 +3045,8 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3036
3045
|
fromToken: e,
|
|
3037
3046
|
toToken: t
|
|
3038
3047
|
};
|
|
3039
|
-
},
|
|
3040
|
-
const t =
|
|
3048
|
+
}, _r = (e) => {
|
|
3049
|
+
const t = As(e);
|
|
3041
3050
|
if (t >= 1)
|
|
3042
3051
|
return `${t.toFixed(t % 1 ? 1 : 0)} ${t === 1 ? "day" : "days"}`;
|
|
3043
3052
|
const n = $n(e) / 60;
|
|
@@ -3045,27 +3054,27 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3045
3054
|
return `${n.toFixed(n % 1 ? 1 : 0)} ${n === 1 ? "hour" : "hours"}`;
|
|
3046
3055
|
const r = $n(e);
|
|
3047
3056
|
return `${r.toFixed(r % 1 ? 1 : 0)} ${r === 1 ? "minute" : "minutes"}`;
|
|
3048
|
-
},
|
|
3049
|
-
const { totalTrades: t } = $e(), { marketPrice: n, typedInputAmount: r } = N(), s =
|
|
3050
|
-
const { isError: o, value: u } =
|
|
3051
|
-
if (!(!o ||
|
|
3057
|
+
}, Zi = (e) => {
|
|
3058
|
+
const { totalTrades: t } = $e(), { marketPrice: n, typedInputAmount: r } = N(), s = k(() => {
|
|
3059
|
+
const { isError: o, value: u } = ri(e);
|
|
3060
|
+
if (!(!o || v(r || "0").isZero() || !n))
|
|
3052
3061
|
return {
|
|
3053
3062
|
type: me.MIN_FILL_DELAY,
|
|
3054
3063
|
value: u,
|
|
3055
|
-
args: { fillDelay:
|
|
3064
|
+
args: { fillDelay: _r(u) }
|
|
3056
3065
|
};
|
|
3057
|
-
}, [e, r, n]), a =
|
|
3058
|
-
const { isError: o, value: u } =
|
|
3059
|
-
if (!(!o ||
|
|
3066
|
+
}, [e, r, n]), a = k(() => {
|
|
3067
|
+
const { isError: o, value: u } = Xa(e, t);
|
|
3068
|
+
if (!(!o || v(r || "0").isZero() || !n))
|
|
3060
3069
|
return {
|
|
3061
3070
|
type: me.MAX_FILL_DELAY,
|
|
3062
3071
|
value: u,
|
|
3063
|
-
args: { fillDelay:
|
|
3072
|
+
args: { fillDelay: _r(u) }
|
|
3064
3073
|
};
|
|
3065
3074
|
}, [e, r, n, t]);
|
|
3066
3075
|
return s || a;
|
|
3067
3076
|
}, Gt = () => {
|
|
3068
|
-
const { callbacks: e } = N(), t = H((a) => a.state.typedFillDelay), n = H((a) => a.updateState), r =
|
|
3077
|
+
const { callbacks: e } = N(), t = H((a) => a.state.typedFillDelay), n = H((a) => a.updateState), r = k(() => t || Wn, [t]), s = Zi(r);
|
|
3069
3078
|
return {
|
|
3070
3079
|
fillDelay: r,
|
|
3071
3080
|
onChange: ne((a) => {
|
|
@@ -3075,7 +3084,7 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3075
3084
|
error: s,
|
|
3076
3085
|
milliseconds: r.unit * r.value
|
|
3077
3086
|
};
|
|
3078
|
-
},
|
|
3087
|
+
}, Yi = () => {
|
|
3079
3088
|
const { onChange: e, fillDelay: t, error: n } = Gt(), r = ne((a) => e({ unit: t.unit, value: Number(a) }), [e, t]), s = ne((a) => e({ unit: a, value: t.value }), [e, t]);
|
|
3080
3089
|
return {
|
|
3081
3090
|
onInputChange: r,
|
|
@@ -3085,16 +3094,16 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3085
3094
|
fillDelay: t,
|
|
3086
3095
|
error: n
|
|
3087
3096
|
};
|
|
3088
|
-
},
|
|
3097
|
+
}, Ji = (e) => {
|
|
3089
3098
|
const { module: t, marketPrice: n } = N();
|
|
3090
|
-
return
|
|
3091
|
-
const r =
|
|
3099
|
+
return k(() => {
|
|
3100
|
+
const r = ti(t, e), s = ni(e);
|
|
3092
3101
|
if (n) {
|
|
3093
3102
|
if (r.isError)
|
|
3094
3103
|
return {
|
|
3095
3104
|
type: me.MAX_ORDER_DURATION,
|
|
3096
3105
|
value: r.value,
|
|
3097
|
-
args: { duration: `${Math.floor(
|
|
3106
|
+
args: { duration: `${Math.floor(As(r.value)).toFixed(0)} days` }
|
|
3098
3107
|
};
|
|
3099
3108
|
if (s.isError)
|
|
3100
3109
|
return {
|
|
@@ -3105,7 +3114,7 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3105
3114
|
}
|
|
3106
3115
|
}, [e, t, n]);
|
|
3107
3116
|
}, mr = () => {
|
|
3108
|
-
const { module: e, callbacks: t } = N(), n = H((p) => p.state.typedDuration), r = H((p) => p.updateState), s = $e().totalTrades, a = Gt().fillDelay, o =
|
|
3117
|
+
const { module: e, callbacks: t } = N(), n = H((p) => p.state.typedDuration), r = H((p) => p.updateState), s = $e().totalTrades, a = Gt().fillDelay, o = k(() => za(e, s, a, n), [s, a, n, e]), u = Ji(o);
|
|
3109
3118
|
return {
|
|
3110
3119
|
duration: o,
|
|
3111
3120
|
setDuration: ne((p) => {
|
|
@@ -3114,7 +3123,7 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3114
3123
|
}, [r, t]),
|
|
3115
3124
|
error: u
|
|
3116
3125
|
};
|
|
3117
|
-
},
|
|
3126
|
+
}, eo = () => {
|
|
3118
3127
|
const { duration: e, setDuration: t, error: n } = mr(), r = ne(
|
|
3119
3128
|
(a) => {
|
|
3120
3129
|
t({ unit: e.unit, value: Number(a) });
|
|
@@ -3134,24 +3143,24 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3134
3143
|
onUnitSelect: s,
|
|
3135
3144
|
error: n
|
|
3136
3145
|
};
|
|
3137
|
-
},
|
|
3146
|
+
}, to = () => {
|
|
3138
3147
|
const { module: e } = N();
|
|
3139
|
-
return
|
|
3148
|
+
return k(() => e === V.STOP_LOSS ? va : Sa, [e]);
|
|
3140
3149
|
}, yr = () => {
|
|
3141
3150
|
const { module: e } = N(), t = H((n) => n.state.isMarketOrder);
|
|
3142
|
-
return
|
|
3143
|
-
},
|
|
3151
|
+
return k(() => e !== V.STOP_LOSS && e !== V.TAKE_PROFIT || t ? void 0 : e === V.STOP_LOSS ? Da : Pa, [e, t]);
|
|
3152
|
+
}, kr = (e) => {
|
|
3144
3153
|
if (e === void 0 || e === "") return e;
|
|
3145
|
-
const t =
|
|
3146
|
-
return t.isNaN() || t.isZero() ? "0" :
|
|
3154
|
+
const t = v(e);
|
|
3155
|
+
return t.isNaN() || t.isZero() ? "0" : v(1).div(t).toFixed();
|
|
3147
3156
|
}, Dn = () => {
|
|
3148
3157
|
const { srcToken: e, dstToken: t } = N(), n = H((p) => p.updateState), r = H((p) => p.state.isInvertedTrade), s = H((p) => p.state.typedTriggerPrice), a = H((p) => p.state.typedLimitPrice), o = H((p) => p.state.isMarketOrder);
|
|
3149
3158
|
return {
|
|
3150
3159
|
onInvert: ne(() => {
|
|
3151
3160
|
n({
|
|
3152
3161
|
isInvertedTrade: !r,
|
|
3153
|
-
...s !== void 0 ? { typedTriggerPrice:
|
|
3154
|
-
...a !== void 0 ? { typedLimitPrice:
|
|
3162
|
+
...s !== void 0 ? { typedTriggerPrice: kr(s) } : {},
|
|
3163
|
+
...a !== void 0 ? { typedLimitPrice: kr(a) } : {}
|
|
3155
3164
|
});
|
|
3156
3165
|
}, [n, r, s, a]),
|
|
3157
3166
|
isInverted: r,
|
|
@@ -3159,7 +3168,7 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3159
3168
|
toToken: r ? e : t,
|
|
3160
3169
|
isMarketPrice: o
|
|
3161
3170
|
};
|
|
3162
|
-
}, yn = (e) => e ?
|
|
3171
|
+
}, yn = (e) => e ? v(e).isNaN() ? "" : e : "", xs = ({
|
|
3163
3172
|
amount: e,
|
|
3164
3173
|
typedValue: t,
|
|
3165
3174
|
amountDecimals: n = 18,
|
|
@@ -3168,12 +3177,12 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3168
3177
|
invertedAmountUsd: a,
|
|
3169
3178
|
isInverted: o
|
|
3170
3179
|
}) => {
|
|
3171
|
-
const u =
|
|
3180
|
+
const u = k(() => {
|
|
3172
3181
|
if (t !== void 0)
|
|
3173
3182
|
return yn(t);
|
|
3174
|
-
const T =
|
|
3175
|
-
return !T ||
|
|
3176
|
-
}, [e, n, o, t]), p =
|
|
3183
|
+
const T = Fe(e, n);
|
|
3184
|
+
return !T || v(T || "0").isZero() ? "" : o ? v(1).div(T).toFixed() : T;
|
|
3185
|
+
}, [e, n, o, t]), p = k(() => u ? yn(o ? Dt(u, r) : e) : "", [e, u, r, o]), f = Qe(
|
|
3177
3186
|
u || "0",
|
|
3178
3187
|
o ? a : s
|
|
3179
3188
|
);
|
|
@@ -3182,7 +3191,7 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3182
3191
|
amountUI: u,
|
|
3183
3192
|
usd: yn(f)
|
|
3184
3193
|
};
|
|
3185
|
-
},
|
|
3194
|
+
}, Cs = ({
|
|
3186
3195
|
typedValue: e,
|
|
3187
3196
|
tokenDecimals: t = 18,
|
|
3188
3197
|
initialPrice: n = "0",
|
|
@@ -3190,16 +3199,16 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3190
3199
|
setValue: s,
|
|
3191
3200
|
setPercentage: a
|
|
3192
3201
|
}) => {
|
|
3193
|
-
const { isInverted: o } = Dn(), u =
|
|
3202
|
+
const { isInverted: o } = Dn(), u = k(() => v((() => {
|
|
3194
3203
|
if (e !== void 0) {
|
|
3195
|
-
const b = o ?
|
|
3204
|
+
const b = o ? v(e).isZero() ? v(0) : v(1).div(e) : v(e);
|
|
3196
3205
|
return Dt(b.toFixed(), t);
|
|
3197
3206
|
}
|
|
3198
|
-
if (r !== void 0 &&
|
|
3199
|
-
const b =
|
|
3207
|
+
if (r !== void 0 && v(n || "0").gt(0) && !v(n || "0").isNaN()) {
|
|
3208
|
+
const b = v(n || "0"), S = v(r || 0).div(100);
|
|
3200
3209
|
return b.plus(b.multipliedBy(S)).decimalPlaces(0).toFixed();
|
|
3201
3210
|
}
|
|
3202
|
-
return
|
|
3211
|
+
return v(n).gt(0) ? n : "";
|
|
3203
3212
|
})()).decimalPlaces(0).toFixed(), [e, r, t, n, o]), p = ne(
|
|
3204
3213
|
(y) => {
|
|
3205
3214
|
s(y), a(null);
|
|
@@ -3210,85 +3219,85 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3210
3219
|
s(void 0), a(y);
|
|
3211
3220
|
},
|
|
3212
3221
|
[s, a]
|
|
3213
|
-
), T =
|
|
3214
|
-
if (!n ||
|
|
3222
|
+
), T = k(() => {
|
|
3223
|
+
if (!n || v(n).isZero()) return "";
|
|
3215
3224
|
if (r != null)
|
|
3216
3225
|
return r;
|
|
3217
3226
|
if (u) {
|
|
3218
|
-
const y =
|
|
3219
|
-
return
|
|
3227
|
+
const y = v(n), S = v(u).minus(y).div(y).multipliedBy(100).decimalPlaces(2).toString();
|
|
3228
|
+
return v(S || "0").isZero() ? "" : S;
|
|
3220
3229
|
}
|
|
3221
3230
|
return "";
|
|
3222
3231
|
}, [u, n, r]);
|
|
3223
3232
|
return {
|
|
3224
|
-
amount:
|
|
3233
|
+
amount: v(u).isNaN() ? "" : u,
|
|
3225
3234
|
typedValue: e,
|
|
3226
3235
|
selectedPercentage: T,
|
|
3227
3236
|
onChange: p,
|
|
3228
3237
|
onPercentageChange: f,
|
|
3229
3238
|
isTypedValue: e !== void 0
|
|
3230
3239
|
};
|
|
3231
|
-
},
|
|
3240
|
+
}, no = (e = "") => {
|
|
3232
3241
|
const { module: t, marketPrice: n, typedInputAmount: r } = N();
|
|
3233
|
-
return
|
|
3234
|
-
if (
|
|
3235
|
-
const s =
|
|
3242
|
+
return k(() => {
|
|
3243
|
+
if (v(r || "0").isZero() || !n || t !== V.STOP_LOSS && t !== V.TAKE_PROFIT) return;
|
|
3244
|
+
const s = Za(n || "", e || "", t);
|
|
3236
3245
|
if (s != null && s.isError)
|
|
3237
3246
|
return {
|
|
3238
3247
|
type: me.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,
|
|
3239
3248
|
value: s.value
|
|
3240
3249
|
};
|
|
3241
|
-
const a =
|
|
3250
|
+
const a = Ya(n || "", e || "", t);
|
|
3242
3251
|
if (a != null && a.isError)
|
|
3243
3252
|
return {
|
|
3244
3253
|
type: me.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,
|
|
3245
3254
|
value: a.value
|
|
3246
3255
|
};
|
|
3247
|
-
if (!e ||
|
|
3256
|
+
if (!e || v(e || 0).isZero())
|
|
3248
3257
|
return {
|
|
3249
3258
|
type: me.EMPTY_TRIGGER_PRICE,
|
|
3250
3259
|
value: e
|
|
3251
3260
|
};
|
|
3252
3261
|
}, [n, e, t, r]);
|
|
3253
|
-
},
|
|
3254
|
-
const { srcToken: t, dstToken: n, module: r, dstUsd1Token: s } = N(), a = $e().amountPerTrade, o = H((f) => f.state.isMarketOrder), u =
|
|
3262
|
+
}, ro = (e) => {
|
|
3263
|
+
const { srcToken: t, dstToken: n, module: r, dstUsd1Token: s } = N(), a = $e().amountPerTrade, o = H((f) => f.state.isMarketOrder), u = k(() => Wa(r, a, e, (t == null ? void 0 : t.decimals) || 0), [e, a, o, t == null ? void 0 : t.decimals, r]), p = jt((n == null ? void 0 : n.decimals) || 0, u);
|
|
3255
3264
|
return {
|
|
3256
3265
|
amount: u,
|
|
3257
3266
|
amountUI: p,
|
|
3258
|
-
usd:
|
|
3267
|
+
usd: Qe(p, s)
|
|
3259
3268
|
};
|
|
3260
3269
|
}, Bt = () => {
|
|
3261
|
-
const { dstToken: e, dstUsd1Token: t, marketPrice: n, module: r, callbacks: s } = N(), a = H((R) => R.updateState), o =
|
|
3270
|
+
const { dstToken: e, dstUsd1Token: t, marketPrice: n, module: r, callbacks: s } = N(), a = H((R) => R.updateState), o = to(), u = H((R) => R.state.triggerPricePercent), p = u === void 0 ? o : u, f = r === V.STOP_LOSS || r === V.TAKE_PROFIT, T = Cs({
|
|
3262
3271
|
typedValue: H((R) => R.state.typedTriggerPrice),
|
|
3263
3272
|
percentage: p,
|
|
3264
3273
|
tokenDecimals: (e == null ? void 0 : e.decimals) || 18,
|
|
3265
3274
|
initialPrice: f ? n : void 0,
|
|
3266
3275
|
setValue: ne((R) => {
|
|
3267
|
-
var
|
|
3268
|
-
a({ typedTriggerPrice: R }), (
|
|
3276
|
+
var F;
|
|
3277
|
+
a({ typedTriggerPrice: R }), (F = s == null ? void 0 : s.onTriggerPriceChange) == null || F.call(s, R || "");
|
|
3269
3278
|
}, [a, s]),
|
|
3270
3279
|
setPercentage: ne(
|
|
3271
3280
|
(R) => {
|
|
3272
|
-
var
|
|
3273
|
-
a({ triggerPricePercent: R }), (
|
|
3281
|
+
var F;
|
|
3282
|
+
a({ triggerPricePercent: R }), (F = s == null ? void 0 : s.onTriggerPricePercentChange) == null || F.call(s, R || "");
|
|
3274
3283
|
},
|
|
3275
3284
|
[a, s]
|
|
3276
3285
|
)
|
|
3277
|
-
}), y =
|
|
3278
|
-
return
|
|
3286
|
+
}), y = no(T.amount), b = jt((e == null ? void 0 : e.decimals) || 18, T.amount), S = Qe(b, t), { amount: P, amountUI: O, usd: B } = ro(T.amount);
|
|
3287
|
+
return k(() => ({
|
|
3279
3288
|
...T,
|
|
3280
|
-
amountUI:
|
|
3281
|
-
usd:
|
|
3289
|
+
amountUI: v(b).isNaN() ? "" : b,
|
|
3290
|
+
usd: v(S).isNaN() ? "" : S,
|
|
3282
3291
|
error: y,
|
|
3283
3292
|
pricePerChunk: P,
|
|
3284
3293
|
pricePerChunkUI: O,
|
|
3285
3294
|
pricePerChunkUsd: B
|
|
3286
3295
|
}), [T, b, S, y, P, O, B]);
|
|
3287
|
-
},
|
|
3296
|
+
}, so = (e) => {
|
|
3288
3297
|
const { module: t, marketPrice: n, typedInputAmount: r } = N(), { amount: s } = Bt(), a = H((o) => o.state.isMarketOrder);
|
|
3289
|
-
return
|
|
3290
|
-
if (
|
|
3291
|
-
const o =
|
|
3298
|
+
return k(() => {
|
|
3299
|
+
if (v(r || "0").isZero() || !s || !n) return;
|
|
3300
|
+
const o = Ja(s, e, a, t), u = ei(s, e, a, t);
|
|
3292
3301
|
if (o != null && o.isError)
|
|
3293
3302
|
return {
|
|
3294
3303
|
type: me.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,
|
|
@@ -3299,14 +3308,14 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3299
3308
|
type: me.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,
|
|
3300
3309
|
value: u.value
|
|
3301
3310
|
};
|
|
3302
|
-
if (e &&
|
|
3311
|
+
if (e && v(e || 0).isZero())
|
|
3303
3312
|
return {
|
|
3304
3313
|
type: me.MISSING_LIMIT_PRICE,
|
|
3305
3314
|
value: e || ""
|
|
3306
3315
|
};
|
|
3307
3316
|
}, [e, s, t, a, r, n]);
|
|
3308
3317
|
}, Pn = () => {
|
|
3309
|
-
const { dstToken: e, dstUsd1Token: t, marketPrice: n, callbacks: r } = N(), s = H((b) => b.updateState), a = yr(), o = H((b) => b.state.limitPricePercent), u = o === void 0 ? a : o, p =
|
|
3318
|
+
const { dstToken: e, dstUsd1Token: t, marketPrice: n, callbacks: r } = N(), s = H((b) => b.updateState), a = yr(), o = H((b) => b.state.limitPricePercent), u = o === void 0 ? a : o, p = Cs({
|
|
3310
3319
|
typedValue: H((b) => b.state.typedLimitPrice),
|
|
3311
3320
|
percentage: u,
|
|
3312
3321
|
tokenDecimals: (e == null ? void 0 : e.decimals) || 18,
|
|
@@ -3322,14 +3331,14 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3322
3331
|
},
|
|
3323
3332
|
[s, r]
|
|
3324
3333
|
)
|
|
3325
|
-
}), f =
|
|
3326
|
-
return
|
|
3334
|
+
}), f = so(p.amount), T = jt((e == null ? void 0 : e.decimals) || 18, p.amount), y = Qe(T, t);
|
|
3335
|
+
return k(() => ({
|
|
3327
3336
|
...p,
|
|
3328
|
-
amountUI:
|
|
3329
|
-
usd:
|
|
3337
|
+
amountUI: v(T).isNaN() ? "" : T,
|
|
3338
|
+
usd: v(y).isNaN() ? "" : y,
|
|
3330
3339
|
error: f
|
|
3331
3340
|
}), [p, T, y, f]);
|
|
3332
|
-
},
|
|
3341
|
+
}, ao = () => {
|
|
3333
3342
|
const { module: e } = N(), t = H((u) => u.updateState), n = H((u) => u.state.isMarketOrder), r = yr(), s = H((u) => u.state.triggerPricePercent) || 0, a = e === V.LIMIT, o = ne(() => {
|
|
3334
3343
|
!n && e === V.STOP_LOSS && t({ limitPricePercent: r }), t({ isMarketOrder: !n });
|
|
3335
3344
|
}, [t, s, e, n, r]);
|
|
@@ -3338,8 +3347,8 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3338
3347
|
toggleLimitPrice: o,
|
|
3339
3348
|
hide: a
|
|
3340
3349
|
};
|
|
3341
|
-
},
|
|
3342
|
-
const { module: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: u, onChange: p, onPercentageChange: f, selectedPercentage: T, error: y, isTypedValue: b } = Pn(), S = H(($) => $.updateState), P = yr(), { isLimitPrice: O, toggleLimitPrice: B } =
|
|
3350
|
+
}, io = () => {
|
|
3351
|
+
const { module: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: u, onChange: p, onPercentageChange: f, selectedPercentage: T, error: y, isTypedValue: b } = Pn(), S = H(($) => $.updateState), P = yr(), { isLimitPrice: O, toggleLimitPrice: B } = ao(), { fromToken: R, toToken: F, isInverted: q } = Dn(), _ = xs({
|
|
3343
3352
|
amount: o,
|
|
3344
3353
|
typedValue: u,
|
|
3345
3354
|
amountDecimals: (r == null ? void 0 : r.decimals) || 18,
|
|
@@ -3347,29 +3356,29 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3347
3356
|
amountUsd: a,
|
|
3348
3357
|
invertedAmountUsd: s,
|
|
3349
3358
|
isInverted: q
|
|
3350
|
-
}),
|
|
3359
|
+
}), Q = ne(() => {
|
|
3351
3360
|
S({ typedLimitPrice: void 0 }), S({ limitPricePercent: P });
|
|
3352
3361
|
}, [S, e, P]);
|
|
3353
3362
|
return {
|
|
3354
|
-
price:
|
|
3355
|
-
priceUI:
|
|
3363
|
+
price: _.amount,
|
|
3364
|
+
priceUI: _.amountUI,
|
|
3356
3365
|
error: y,
|
|
3357
3366
|
onInputChange: p,
|
|
3358
3367
|
onPercentageChange: f,
|
|
3359
|
-
onReset:
|
|
3360
|
-
usd:
|
|
3368
|
+
onReset: Q,
|
|
3369
|
+
usd: _.usd,
|
|
3361
3370
|
srcToken: n,
|
|
3362
3371
|
dstToken: r,
|
|
3363
3372
|
invertedSrcToken: R,
|
|
3364
|
-
invertedDstToken:
|
|
3373
|
+
invertedDstToken: F,
|
|
3365
3374
|
percentage: T,
|
|
3366
3375
|
isLoading: t,
|
|
3367
3376
|
isLimitPrice: O,
|
|
3368
3377
|
toggleLimitPrice: B,
|
|
3369
3378
|
isTypedValue: b
|
|
3370
3379
|
};
|
|
3371
|
-
},
|
|
3372
|
-
const { marketPrice: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: u, onChange: p, onPercentageChange: f, selectedPercentage: T, error: y, pricePerChunk: b, pricePerChunkUI: S, pricePerChunkUsd: P, isTypedValue: O } = Bt(), B = H(($) => $.updateState), { fromToken: R, toToken:
|
|
3380
|
+
}, oo = () => {
|
|
3381
|
+
const { marketPrice: e, marketPriceLoading: t, srcToken: n, dstToken: r, srcUsd1Token: s, dstUsd1Token: a } = N(), { amount: o, typedValue: u, onChange: p, onPercentageChange: f, selectedPercentage: T, error: y, pricePerChunk: b, pricePerChunkUI: S, pricePerChunkUsd: P, isTypedValue: O } = Bt(), B = H(($) => $.updateState), { fromToken: R, toToken: F, isInverted: q } = Dn(), _ = xs({
|
|
3373
3382
|
amount: o,
|
|
3374
3383
|
typedValue: u,
|
|
3375
3384
|
amountDecimals: (r == null ? void 0 : r.decimals) || 18,
|
|
@@ -3377,12 +3386,12 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3377
3386
|
amountUsd: a,
|
|
3378
3387
|
invertedAmountUsd: s,
|
|
3379
3388
|
isInverted: q
|
|
3380
|
-
}),
|
|
3389
|
+
}), Q = ne(() => {
|
|
3381
3390
|
B({ triggerPricePercent: void 0, typedTriggerPrice: void 0 });
|
|
3382
3391
|
}, [B]);
|
|
3383
3392
|
return {
|
|
3384
|
-
price:
|
|
3385
|
-
priceUI:
|
|
3393
|
+
price: _.amount,
|
|
3394
|
+
priceUI: _.amountUI,
|
|
3386
3395
|
amountPerChunk: b,
|
|
3387
3396
|
amountPerChunkUI: S,
|
|
3388
3397
|
amountPerChunkUsd: P,
|
|
@@ -3390,61 +3399,61 @@ const Lc = (e, t) => e ? X.TWAP_MARKET : t === 1 ? X.LIMIT : X.TWAP_LIMIT, As =
|
|
|
3390
3399
|
onInputChange: p,
|
|
3391
3400
|
onPercentageChange: f,
|
|
3392
3401
|
percentage: T,
|
|
3393
|
-
onReset:
|
|
3394
|
-
usd:
|
|
3402
|
+
onReset: Q,
|
|
3403
|
+
usd: _.usd,
|
|
3395
3404
|
srcToken: n,
|
|
3396
3405
|
dstToken: r,
|
|
3397
3406
|
invertedSrcToken: R,
|
|
3398
|
-
invertedDstToken:
|
|
3407
|
+
invertedDstToken: F,
|
|
3399
3408
|
isLoading: t || !e,
|
|
3400
3409
|
isTypedValue: O
|
|
3401
3410
|
};
|
|
3402
|
-
},
|
|
3411
|
+
}, Ts = () => {
|
|
3403
3412
|
const { module: e, marketPrice: t } = N(), n = Pn().amount, r = Bt().amount, s = H((a) => a.state.isMarketOrder);
|
|
3404
3413
|
return e === V.LIMIT || !s ? n || "" : e === V.STOP_LOSS || e === V.TAKE_PROFIT ? r || "" : t || "";
|
|
3405
3414
|
}, On = () => {
|
|
3406
|
-
const { srcToken: e, dstToken: t, dstUsd1Token: n } = N(), r =
|
|
3415
|
+
const { srcToken: e, dstToken: t, dstUsd1Token: n } = N(), r = Ts(), s = pt().amount, a = k(() => Ka(s || "", r, (e == null ? void 0 : e.decimals) || 0), [s, r, e == null ? void 0 : e.decimals]), o = jt(t == null ? void 0 : t.decimals, a);
|
|
3407
3416
|
return {
|
|
3408
3417
|
amount: a,
|
|
3409
3418
|
amountUI: o,
|
|
3410
|
-
usd:
|
|
3419
|
+
usd: Qe(o, n)
|
|
3411
3420
|
};
|
|
3412
3421
|
}, gr = () => {
|
|
3413
|
-
const { srcToken: e, dstToken: t, dstUsd1Token: n } = N(), r =
|
|
3414
|
-
() =>
|
|
3422
|
+
const { srcToken: e, dstToken: t, dstUsd1Token: n } = N(), r = Ts(), s = $e().amountPerTrade, a = H((p) => p.state.isMarketOrder), o = k(
|
|
3423
|
+
() => Ha(s, r, !!a, (e == null ? void 0 : e.decimals) || 0),
|
|
3415
3424
|
[s, r, a, e == null ? void 0 : e.decimals]
|
|
3416
3425
|
), u = jt(t == null ? void 0 : t.decimals, o);
|
|
3417
3426
|
return {
|
|
3418
3427
|
amount: o,
|
|
3419
3428
|
amountUI: u,
|
|
3420
|
-
usd:
|
|
3429
|
+
usd: Qe(u, n)
|
|
3421
3430
|
};
|
|
3422
|
-
},
|
|
3423
|
-
const { typedInputAmount: e, marketPriceLoading: t, dstToken: n } = N(), { amountUI: r, usd: s } = On(), o =
|
|
3431
|
+
}, co = () => {
|
|
3432
|
+
const { typedInputAmount: e, marketPriceLoading: t, dstToken: n } = N(), { amountUI: r, usd: s } = On(), o = ji() ? e : r, u = fr(n == null ? void 0 : n.decimals, o);
|
|
3424
3433
|
return {
|
|
3425
3434
|
value: o,
|
|
3426
3435
|
valueWei: u,
|
|
3427
3436
|
isLoading: t,
|
|
3428
3437
|
usd: s
|
|
3429
3438
|
};
|
|
3430
|
-
},
|
|
3431
|
-
const e = H((s) => s.state.isMarketOrder), { module: t } = N(), n =
|
|
3439
|
+
}, uo = () => {
|
|
3440
|
+
const e = H((s) => s.state.isMarketOrder), { module: t } = N(), n = k(() => {
|
|
3432
3441
|
if (e && t === V.STOP_LOSS)
|
|
3433
3442
|
return bn.TRIGGER_MARKET_PRICE;
|
|
3434
|
-
}, [e, t]), r =
|
|
3443
|
+
}, [e, t]), r = k(() => {
|
|
3435
3444
|
if (!(t !== V.LIMIT && t !== V.TWAP))
|
|
3436
3445
|
return e ? bn.MARKET_PRICE : bn.LIMIT_PRICE;
|
|
3437
3446
|
}, [e, t]);
|
|
3438
3447
|
return n || r;
|
|
3439
|
-
},
|
|
3440
|
-
const { minChunkSizeUsd: e, typedInputAmount: t, srcUsd1Token: n } = N(), r =
|
|
3441
|
-
return
|
|
3448
|
+
}, lo = () => {
|
|
3449
|
+
const { minChunkSizeUsd: e, typedInputAmount: t, srcUsd1Token: n } = N(), r = Qe(t, n);
|
|
3450
|
+
return k(() => v(e).gt(v(r || "0")) ? {
|
|
3442
3451
|
type: me.MIN_TRADE_SIZE_ERROR,
|
|
3443
3452
|
value: e,
|
|
3444
3453
|
args: { minTradeSize: `${e}` }
|
|
3445
3454
|
} : void 0, [e, r]);
|
|
3446
3455
|
};
|
|
3447
|
-
function
|
|
3456
|
+
function ws() {
|
|
3448
3457
|
const {
|
|
3449
3458
|
marketPrice: e,
|
|
3450
3459
|
marketPriceLoading: t,
|
|
@@ -3452,14 +3461,14 @@ function Ts() {
|
|
|
3452
3461
|
srcUsd1Token: r,
|
|
3453
3462
|
srcBalance: s,
|
|
3454
3463
|
chainId: a
|
|
3455
|
-
} = N(), { error: o } = Bt(), { error: u } = Pn(), { error: p } = $e(), { error: f } = Gt(), { error: T } = mr(), y =
|
|
3456
|
-
if (s &&
|
|
3464
|
+
} = N(), { error: o } = Bt(), { error: u } = Pn(), { error: p } = $e(), { error: f } = Gt(), { error: T } = mr(), y = lo(), b = pt().amount, S = k(() => {
|
|
3465
|
+
if (s && v(b).gt(s))
|
|
3457
3466
|
return {
|
|
3458
3467
|
type: me.INSUFFICIENT_BALANCE,
|
|
3459
3468
|
value: s || ""
|
|
3460
3469
|
};
|
|
3461
3470
|
}, [s, b, a]);
|
|
3462
|
-
return
|
|
3471
|
+
return k(() => ui({
|
|
3463
3472
|
marketPrice: e,
|
|
3464
3473
|
typedInputAmount: n,
|
|
3465
3474
|
srcUsd1Token: r,
|
|
@@ -3501,7 +3510,7 @@ var Xt = class {
|
|
|
3501
3510
|
}
|
|
3502
3511
|
onUnsubscribe() {
|
|
3503
3512
|
}
|
|
3504
|
-
},
|
|
3513
|
+
}, po = {
|
|
3505
3514
|
// We need the wrapper function syntax below instead of direct references to
|
|
3506
3515
|
// global setTimeout etc.
|
|
3507
3516
|
//
|
|
@@ -3516,7 +3525,7 @@ var Xt = class {
|
|
|
3516
3525
|
clearTimeout: (e) => clearTimeout(e),
|
|
3517
3526
|
setInterval: (e, t) => setInterval(e, t),
|
|
3518
3527
|
clearInterval: (e) => clearInterval(e)
|
|
3519
|
-
}, Ke, At, Vr,
|
|
3528
|
+
}, Ke, At, Vr, fo = (Vr = class {
|
|
3520
3529
|
constructor() {
|
|
3521
3530
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
3522
3531
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
@@ -3524,7 +3533,7 @@ var Xt = class {
|
|
|
3524
3533
|
//
|
|
3525
3534
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
3526
3535
|
// this class is unsafe internally to allow for extension.
|
|
3527
|
-
L(this, Ke,
|
|
3536
|
+
L(this, Ke, po);
|
|
3528
3537
|
L(this, At, !1);
|
|
3529
3538
|
}
|
|
3530
3539
|
setTimeoutProvider(e) {
|
|
@@ -3545,20 +3554,20 @@ var Xt = class {
|
|
|
3545
3554
|
clearInterval(e) {
|
|
3546
3555
|
l(this, Ke).clearInterval(e);
|
|
3547
3556
|
}
|
|
3548
|
-
}, Ke = new WeakMap(), At = new WeakMap(), Vr), gt = new
|
|
3549
|
-
function
|
|
3557
|
+
}, Ke = new WeakMap(), At = new WeakMap(), Vr), gt = new fo();
|
|
3558
|
+
function ho(e) {
|
|
3550
3559
|
setTimeout(e, 0);
|
|
3551
3560
|
}
|
|
3552
3561
|
var Ot = typeof window > "u" || "Deno" in globalThis;
|
|
3553
3562
|
function xe() {
|
|
3554
3563
|
}
|
|
3555
|
-
function
|
|
3564
|
+
function mo(e, t) {
|
|
3556
3565
|
return typeof e == "function" ? e(t) : e;
|
|
3557
3566
|
}
|
|
3558
3567
|
function Vn(e) {
|
|
3559
3568
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
3560
3569
|
}
|
|
3561
|
-
function
|
|
3570
|
+
function Fs(e, t) {
|
|
3562
3571
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
3563
3572
|
}
|
|
3564
3573
|
function lt(e, t) {
|
|
@@ -3615,7 +3624,7 @@ function It(e) {
|
|
|
3615
3624
|
function Jt(e, t) {
|
|
3616
3625
|
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((n) => Jt(e[n], t[n])) : !1;
|
|
3617
3626
|
}
|
|
3618
|
-
var
|
|
3627
|
+
var yo = Object.prototype.hasOwnProperty;
|
|
3619
3628
|
function jn(e, t) {
|
|
3620
3629
|
if (e === t)
|
|
3621
3630
|
return e;
|
|
@@ -3626,7 +3635,7 @@ function jn(e, t) {
|
|
|
3626
3635
|
for (let f = 0; f < o; f++) {
|
|
3627
3636
|
const T = n ? f : a[f], y = e[T], b = t[T];
|
|
3628
3637
|
if (y === b) {
|
|
3629
|
-
u[T] = y, (n ? f < s :
|
|
3638
|
+
u[T] = y, (n ? f < s : yo.call(e, T)) && p++;
|
|
3630
3639
|
continue;
|
|
3631
3640
|
}
|
|
3632
3641
|
if (y === null || b === null || typeof y != "object" || typeof b != "object") {
|
|
@@ -3661,7 +3670,7 @@ function Gn(e) {
|
|
|
3661
3670
|
function Nr(e) {
|
|
3662
3671
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
3663
3672
|
}
|
|
3664
|
-
function
|
|
3673
|
+
function go(e) {
|
|
3665
3674
|
return new Promise((t) => {
|
|
3666
3675
|
gt.setTimeout(t, e);
|
|
3667
3676
|
});
|
|
@@ -3682,24 +3691,24 @@ function Xn(e, t, n) {
|
|
|
3682
3691
|
}
|
|
3683
3692
|
return t;
|
|
3684
3693
|
}
|
|
3685
|
-
function
|
|
3694
|
+
function Ao(e, t, n = 0) {
|
|
3686
3695
|
const r = [...e, t];
|
|
3687
3696
|
return n && r.length > n ? r.slice(1) : r;
|
|
3688
3697
|
}
|
|
3689
|
-
function
|
|
3698
|
+
function Eo(e, t, n = 0) {
|
|
3690
3699
|
const r = [t, ...e];
|
|
3691
3700
|
return n && r.length > n ? r.slice(0, -1) : r;
|
|
3692
3701
|
}
|
|
3693
|
-
var
|
|
3702
|
+
var Fn = Symbol();
|
|
3694
3703
|
function vs(e, t) {
|
|
3695
|
-
return process.env.NODE_ENV !== "production" && e.queryFn ===
|
|
3704
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === Fn && console.error(
|
|
3696
3705
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
3697
|
-
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn ===
|
|
3706
|
+
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn === Fn ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
3698
3707
|
}
|
|
3699
|
-
function
|
|
3708
|
+
function Ss(e, t) {
|
|
3700
3709
|
return typeof e == "function" ? e(...t) : !!e;
|
|
3701
3710
|
}
|
|
3702
|
-
var Et, rt, Rt, jr,
|
|
3711
|
+
var Et, rt, Rt, jr, bo = (jr = class extends Xt {
|
|
3703
3712
|
constructor() {
|
|
3704
3713
|
super();
|
|
3705
3714
|
L(this, Et);
|
|
@@ -3740,7 +3749,7 @@ var Et, rt, Rt, jr, Ao = (jr = class extends Xt {
|
|
|
3740
3749
|
var t;
|
|
3741
3750
|
return typeof l(this, Et) == "boolean" ? l(this, Et) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
3742
3751
|
}
|
|
3743
|
-
}, Et = new WeakMap(), rt = new WeakMap(), Rt = new WeakMap(), jr), Er = new
|
|
3752
|
+
}, Et = new WeakMap(), rt = new WeakMap(), Rt = new WeakMap(), jr), Er = new bo();
|
|
3744
3753
|
function Zn() {
|
|
3745
3754
|
let e, t;
|
|
3746
3755
|
const n = new Promise((s, a) => {
|
|
@@ -3763,13 +3772,13 @@ function Zn() {
|
|
|
3763
3772
|
}), t(s);
|
|
3764
3773
|
}, n;
|
|
3765
3774
|
}
|
|
3766
|
-
var
|
|
3767
|
-
function
|
|
3775
|
+
var xo = ho;
|
|
3776
|
+
function Co() {
|
|
3768
3777
|
let e = [], t = 0, n = (u) => {
|
|
3769
3778
|
u();
|
|
3770
3779
|
}, r = (u) => {
|
|
3771
3780
|
u();
|
|
3772
|
-
}, s =
|
|
3781
|
+
}, s = xo;
|
|
3773
3782
|
const a = (u) => {
|
|
3774
3783
|
t ? e.push(u) : s(() => {
|
|
3775
3784
|
n(u);
|
|
@@ -3823,13 +3832,13 @@ function bo() {
|
|
|
3823
3832
|
}
|
|
3824
3833
|
};
|
|
3825
3834
|
}
|
|
3826
|
-
var ce =
|
|
3835
|
+
var ce = Co(), _t, st, kt, Gr, To = (Gr = class extends Xt {
|
|
3827
3836
|
constructor() {
|
|
3828
3837
|
super();
|
|
3829
|
-
L(this,
|
|
3838
|
+
L(this, _t, !0);
|
|
3830
3839
|
L(this, st);
|
|
3831
|
-
L(this,
|
|
3832
|
-
I(this,
|
|
3840
|
+
L(this, kt);
|
|
3841
|
+
I(this, kt, (t) => {
|
|
3833
3842
|
if (!Ot && window.addEventListener) {
|
|
3834
3843
|
const n = () => t(!0), r = () => t(!1);
|
|
3835
3844
|
return window.addEventListener("online", n, !1), window.addEventListener("offline", r, !1), () => {
|
|
@@ -3839,7 +3848,7 @@ var ce = bo(), kt, st, _t, Gr, xo = (Gr = class extends Xt {
|
|
|
3839
3848
|
});
|
|
3840
3849
|
}
|
|
3841
3850
|
onSubscribe() {
|
|
3842
|
-
l(this, st) || this.setEventListener(l(this,
|
|
3851
|
+
l(this, st) || this.setEventListener(l(this, kt));
|
|
3843
3852
|
}
|
|
3844
3853
|
onUnsubscribe() {
|
|
3845
3854
|
var t;
|
|
@@ -3847,29 +3856,29 @@ var ce = bo(), kt, st, _t, Gr, xo = (Gr = class extends Xt {
|
|
|
3847
3856
|
}
|
|
3848
3857
|
setEventListener(t) {
|
|
3849
3858
|
var n;
|
|
3850
|
-
I(this,
|
|
3859
|
+
I(this, kt, t), (n = l(this, st)) == null || n.call(this), I(this, st, t(this.setOnline.bind(this)));
|
|
3851
3860
|
}
|
|
3852
3861
|
setOnline(t) {
|
|
3853
|
-
l(this,
|
|
3862
|
+
l(this, _t) !== t && (I(this, _t, t), this.listeners.forEach((r) => {
|
|
3854
3863
|
r(t);
|
|
3855
3864
|
}));
|
|
3856
3865
|
}
|
|
3857
3866
|
isOnline() {
|
|
3858
|
-
return l(this,
|
|
3867
|
+
return l(this, _t);
|
|
3859
3868
|
}
|
|
3860
|
-
},
|
|
3861
|
-
function
|
|
3869
|
+
}, _t = new WeakMap(), st = new WeakMap(), kt = new WeakMap(), Gr), vn = new To();
|
|
3870
|
+
function wo(e) {
|
|
3862
3871
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
3863
3872
|
}
|
|
3864
|
-
function
|
|
3865
|
-
return (e ?? "online") === "online" ?
|
|
3873
|
+
function Ds(e) {
|
|
3874
|
+
return (e ?? "online") === "online" ? vn.isOnline() : !0;
|
|
3866
3875
|
}
|
|
3867
3876
|
var Yn = class extends Error {
|
|
3868
3877
|
constructor(e) {
|
|
3869
3878
|
super("CancelledError"), this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
3870
3879
|
}
|
|
3871
3880
|
};
|
|
3872
|
-
function
|
|
3881
|
+
function Ps(e) {
|
|
3873
3882
|
let t = !1, n = 0, r;
|
|
3874
3883
|
const s = Zn(), a = () => s.status !== "pending", o = (O) => {
|
|
3875
3884
|
var B;
|
|
@@ -3881,7 +3890,7 @@ function Ds(e) {
|
|
|
3881
3890
|
t = !0;
|
|
3882
3891
|
}, p = () => {
|
|
3883
3892
|
t = !1;
|
|
3884
|
-
}, f = () => Er.isFocused() && (e.networkMode === "always" ||
|
|
3893
|
+
}, f = () => Er.isFocused() && (e.networkMode === "always" || vn.isOnline()) && e.canRun(), T = () => Ds(e.networkMode) && e.canRun(), y = (O) => {
|
|
3885
3894
|
a() || (r == null || r(), s.resolve(O));
|
|
3886
3895
|
}, b = (O) => {
|
|
3887
3896
|
a() || (r == null || r(), s.reject(O));
|
|
@@ -3907,12 +3916,12 @@ function Ds(e) {
|
|
|
3907
3916
|
var $;
|
|
3908
3917
|
if (a())
|
|
3909
3918
|
return;
|
|
3910
|
-
const
|
|
3911
|
-
if (t || !
|
|
3919
|
+
const F = e.retry ?? (Ot ? 0 : 3), q = e.retryDelay ?? wo, _ = typeof q == "function" ? q(n, R) : q, Q = F === !0 || typeof F == "number" && n < F || typeof F == "function" && F(n, R);
|
|
3920
|
+
if (t || !Q) {
|
|
3912
3921
|
b(R);
|
|
3913
3922
|
return;
|
|
3914
3923
|
}
|
|
3915
|
-
n++, ($ = e.onFail) == null || $.call(e, n, R),
|
|
3924
|
+
n++, ($ = e.onFail) == null || $.call(e, n, R), go(_).then(() => f() ? void 0 : S()).then(() => {
|
|
3916
3925
|
t ? b(R) : P();
|
|
3917
3926
|
});
|
|
3918
3927
|
});
|
|
@@ -3928,7 +3937,7 @@ function Ds(e) {
|
|
|
3928
3937
|
start: () => (T() ? P() : S().then(P), s)
|
|
3929
3938
|
};
|
|
3930
3939
|
}
|
|
3931
|
-
var bt, Xr,
|
|
3940
|
+
var bt, Xr, Os = (Xr = class {
|
|
3932
3941
|
constructor() {
|
|
3933
3942
|
L(this, bt);
|
|
3934
3943
|
}
|
|
@@ -3949,10 +3958,10 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
3949
3958
|
clearGcTimeout() {
|
|
3950
3959
|
l(this, bt) && (gt.clearTimeout(l(this, bt)), I(this, bt, void 0));
|
|
3951
3960
|
}
|
|
3952
|
-
}, bt = new WeakMap(), Xr), xt, Ut, Ie, Ct, de, en, Tt,
|
|
3961
|
+
}, bt = new WeakMap(), Xr), xt, Ut, Ie, Ct, de, en, Tt, Ue, Ge, Zr, Fo = (Zr = class extends Os {
|
|
3953
3962
|
constructor(t) {
|
|
3954
3963
|
super();
|
|
3955
|
-
L(this,
|
|
3964
|
+
L(this, Ue);
|
|
3956
3965
|
L(this, xt);
|
|
3957
3966
|
L(this, Ut);
|
|
3958
3967
|
L(this, Ie);
|
|
@@ -3982,7 +3991,7 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
3982
3991
|
}
|
|
3983
3992
|
setData(t, n) {
|
|
3984
3993
|
const r = Xn(this.state.data, t, this.options);
|
|
3985
|
-
return W(this,
|
|
3994
|
+
return W(this, Ue, Ge).call(this, {
|
|
3986
3995
|
data: r,
|
|
3987
3996
|
type: "success",
|
|
3988
3997
|
dataUpdatedAt: n == null ? void 0 : n.updatedAt,
|
|
@@ -3990,7 +3999,7 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
3990
3999
|
}), r;
|
|
3991
4000
|
}
|
|
3992
4001
|
setState(t, n) {
|
|
3993
|
-
W(this,
|
|
4002
|
+
W(this, Ue, Ge).call(this, { type: "setState", state: t, setStateOptions: n });
|
|
3994
4003
|
}
|
|
3995
4004
|
cancel(t) {
|
|
3996
4005
|
var r, s;
|
|
@@ -4009,7 +4018,7 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4009
4018
|
);
|
|
4010
4019
|
}
|
|
4011
4020
|
isDisabled() {
|
|
4012
|
-
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn ===
|
|
4021
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Fn || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
4013
4022
|
}
|
|
4014
4023
|
isStatic() {
|
|
4015
4024
|
return this.getObserversCount() > 0 ? this.observers.some(
|
|
@@ -4022,7 +4031,7 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4022
4031
|
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
4023
4032
|
}
|
|
4024
4033
|
isStaleByTime(t = 0) {
|
|
4025
|
-
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !
|
|
4034
|
+
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !Fs(this.state.dataUpdatedAt, t);
|
|
4026
4035
|
}
|
|
4027
4036
|
onFocus() {
|
|
4028
4037
|
var n;
|
|
@@ -4044,10 +4053,10 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4044
4053
|
return this.observers.length;
|
|
4045
4054
|
}
|
|
4046
4055
|
invalidate() {
|
|
4047
|
-
this.state.isInvalidated || W(this,
|
|
4056
|
+
this.state.isInvalidated || W(this, Ue, Ge).call(this, { type: "invalidate" });
|
|
4048
4057
|
}
|
|
4049
4058
|
async fetch(t, n) {
|
|
4050
|
-
var p, f, T, y, b, S, P, O, B, R,
|
|
4059
|
+
var p, f, T, y, b, S, P, O, B, R, F, q;
|
|
4051
4060
|
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
4052
4061
|
// re-start the fetch; there is a chance that the query is still in a
|
|
4053
4062
|
// pending state when that happens
|
|
@@ -4058,19 +4067,19 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4058
4067
|
return l(this, de).continueRetry(), l(this, de).promise;
|
|
4059
4068
|
}
|
|
4060
4069
|
if (t && this.setOptions(t), !this.options.queryFn) {
|
|
4061
|
-
const
|
|
4062
|
-
|
|
4070
|
+
const _ = this.observers.find((Q) => Q.options.queryFn);
|
|
4071
|
+
_ && this.setOptions(_.options);
|
|
4063
4072
|
}
|
|
4064
4073
|
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
4065
4074
|
"As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
|
|
4066
4075
|
));
|
|
4067
|
-
const r = new AbortController(), s = (
|
|
4068
|
-
Object.defineProperty(
|
|
4076
|
+
const r = new AbortController(), s = (_) => {
|
|
4077
|
+
Object.defineProperty(_, "signal", {
|
|
4069
4078
|
enumerable: !0,
|
|
4070
4079
|
get: () => (I(this, Tt, !0), r.signal)
|
|
4071
4080
|
});
|
|
4072
4081
|
}, a = () => {
|
|
4073
|
-
const
|
|
4082
|
+
const _ = vs(this.options, n), $ = (() => {
|
|
4074
4083
|
const ie = {
|
|
4075
4084
|
client: l(this, Ct),
|
|
4076
4085
|
queryKey: this.queryKey,
|
|
@@ -4079,12 +4088,12 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4079
4088
|
return s(ie), ie;
|
|
4080
4089
|
})();
|
|
4081
4090
|
return I(this, Tt, !1), this.options.persister ? this.options.persister(
|
|
4082
|
-
|
|
4091
|
+
_,
|
|
4083
4092
|
$,
|
|
4084
4093
|
this
|
|
4085
|
-
) :
|
|
4094
|
+
) : _($);
|
|
4086
4095
|
}, u = (() => {
|
|
4087
|
-
const
|
|
4096
|
+
const _ = {
|
|
4088
4097
|
fetchOptions: n,
|
|
4089
4098
|
options: this.options,
|
|
4090
4099
|
queryKey: this.queryKey,
|
|
@@ -4092,25 +4101,25 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4092
4101
|
state: this.state,
|
|
4093
4102
|
fetchFn: a
|
|
4094
4103
|
};
|
|
4095
|
-
return s(
|
|
4104
|
+
return s(_), _;
|
|
4096
4105
|
})();
|
|
4097
|
-
(f = this.options.behavior) == null || f.onFetch(u, this), I(this, Ut, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((T = u.fetchOptions) == null ? void 0 : T.meta)) && W(this,
|
|
4106
|
+
(f = this.options.behavior) == null || f.onFetch(u, this), I(this, Ut, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((T = u.fetchOptions) == null ? void 0 : T.meta)) && W(this, Ue, Ge).call(this, { type: "fetch", meta: (y = u.fetchOptions) == null ? void 0 : y.meta }), I(this, de, Ps({
|
|
4098
4107
|
initialPromise: n == null ? void 0 : n.initialPromise,
|
|
4099
4108
|
fn: u.fetchFn,
|
|
4100
|
-
onCancel: (
|
|
4101
|
-
|
|
4109
|
+
onCancel: (_) => {
|
|
4110
|
+
_ instanceof Yn && _.revert && this.setState({
|
|
4102
4111
|
...l(this, Ut),
|
|
4103
4112
|
fetchStatus: "idle"
|
|
4104
4113
|
}), r.abort();
|
|
4105
4114
|
},
|
|
4106
|
-
onFail: (
|
|
4107
|
-
W(this,
|
|
4115
|
+
onFail: (_, Q) => {
|
|
4116
|
+
W(this, Ue, Ge).call(this, { type: "failed", failureCount: _, error: Q });
|
|
4108
4117
|
},
|
|
4109
4118
|
onPause: () => {
|
|
4110
|
-
W(this,
|
|
4119
|
+
W(this, Ue, Ge).call(this, { type: "pause" });
|
|
4111
4120
|
},
|
|
4112
4121
|
onContinue: () => {
|
|
4113
|
-
W(this,
|
|
4122
|
+
W(this, Ue, Ge).call(this, { type: "continue" });
|
|
4114
4123
|
},
|
|
4115
4124
|
retry: u.options.retry,
|
|
4116
4125
|
retryDelay: u.options.retryDelay,
|
|
@@ -4118,45 +4127,45 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4118
4127
|
canRun: () => !0
|
|
4119
4128
|
}));
|
|
4120
4129
|
try {
|
|
4121
|
-
const
|
|
4122
|
-
if (
|
|
4130
|
+
const _ = await l(this, de).start();
|
|
4131
|
+
if (_ === void 0)
|
|
4123
4132
|
throw process.env.NODE_ENV !== "production" && console.error(
|
|
4124
4133
|
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
4125
4134
|
), new Error(`${this.queryHash} data is undefined`);
|
|
4126
|
-
return this.setData(
|
|
4135
|
+
return this.setData(_), (S = (b = l(this, Ie).config).onSuccess) == null || S.call(b, _, this), (O = (P = l(this, Ie).config).onSettled) == null || O.call(
|
|
4127
4136
|
P,
|
|
4128
|
-
|
|
4137
|
+
_,
|
|
4129
4138
|
this.state.error,
|
|
4130
4139
|
this
|
|
4131
|
-
),
|
|
4132
|
-
} catch (
|
|
4133
|
-
if (
|
|
4134
|
-
if (
|
|
4140
|
+
), _;
|
|
4141
|
+
} catch (_) {
|
|
4142
|
+
if (_ instanceof Yn) {
|
|
4143
|
+
if (_.silent)
|
|
4135
4144
|
return l(this, de).promise;
|
|
4136
|
-
if (
|
|
4145
|
+
if (_.revert) {
|
|
4137
4146
|
if (this.state.data === void 0)
|
|
4138
|
-
throw
|
|
4147
|
+
throw _;
|
|
4139
4148
|
return this.state.data;
|
|
4140
4149
|
}
|
|
4141
4150
|
}
|
|
4142
|
-
throw W(this,
|
|
4151
|
+
throw W(this, Ue, Ge).call(this, {
|
|
4143
4152
|
type: "error",
|
|
4144
|
-
error:
|
|
4153
|
+
error: _
|
|
4145
4154
|
}), (R = (B = l(this, Ie).config).onError) == null || R.call(
|
|
4146
4155
|
B,
|
|
4147
|
-
|
|
4156
|
+
_,
|
|
4148
4157
|
this
|
|
4149
|
-
), (q = (
|
|
4150
|
-
|
|
4158
|
+
), (q = (F = l(this, Ie).config).onSettled) == null || q.call(
|
|
4159
|
+
F,
|
|
4151
4160
|
this.state.data,
|
|
4152
|
-
|
|
4161
|
+
_,
|
|
4153
4162
|
this
|
|
4154
|
-
),
|
|
4163
|
+
), _;
|
|
4155
4164
|
} finally {
|
|
4156
4165
|
this.scheduleGc();
|
|
4157
4166
|
}
|
|
4158
4167
|
}
|
|
4159
|
-
}, xt = new WeakMap(), Ut = new WeakMap(), Ie = new WeakMap(), Ct = new WeakMap(), de = new WeakMap(), en = new WeakMap(), Tt = new WeakMap(),
|
|
4168
|
+
}, xt = new WeakMap(), Ut = new WeakMap(), Ie = new WeakMap(), Ct = new WeakMap(), de = new WeakMap(), en = new WeakMap(), Tt = new WeakMap(), Ue = new WeakSet(), Ge = function(t) {
|
|
4160
4169
|
const n = (r) => {
|
|
4161
4170
|
switch (t.type) {
|
|
4162
4171
|
case "failed":
|
|
@@ -4178,7 +4187,7 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4178
4187
|
case "fetch":
|
|
4179
4188
|
return {
|
|
4180
4189
|
...r,
|
|
4181
|
-
...
|
|
4190
|
+
...Is(r.data, this.options),
|
|
4182
4191
|
fetchMeta: t.meta ?? null
|
|
4183
4192
|
};
|
|
4184
4193
|
case "success":
|
|
@@ -4223,11 +4232,11 @@ var bt, Xr, Ps = (Xr = class {
|
|
|
4223
4232
|
}), l(this, Ie).notify({ query: this, type: "updated", action: t });
|
|
4224
4233
|
});
|
|
4225
4234
|
}, Zr);
|
|
4226
|
-
function
|
|
4235
|
+
function Is(e, t) {
|
|
4227
4236
|
return {
|
|
4228
4237
|
fetchFailureCount: 0,
|
|
4229
4238
|
fetchFailureReason: null,
|
|
4230
|
-
fetchStatus:
|
|
4239
|
+
fetchStatus: Ds(t.networkMode) ? "fetching" : "paused",
|
|
4231
4240
|
...e === void 0 && {
|
|
4232
4241
|
error: null,
|
|
4233
4242
|
status: "pending"
|
|
@@ -4260,7 +4269,7 @@ function Kr(e) {
|
|
|
4260
4269
|
fetchStatus: "idle"
|
|
4261
4270
|
};
|
|
4262
4271
|
}
|
|
4263
|
-
var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt,
|
|
4272
|
+
var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, Ft, vt, it, qt, Y, Yt, Jn, er, tr, nr, rr, sr, ar, Bs, Yr, vo = (Yr = class extends Xt {
|
|
4264
4273
|
constructor(t, n) {
|
|
4265
4274
|
super();
|
|
4266
4275
|
L(this, Y);
|
|
@@ -4277,8 +4286,8 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4277
4286
|
// This property keeps track of the last query with defined data.
|
|
4278
4287
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
4279
4288
|
L(this, Nt);
|
|
4280
|
-
L(this, vt);
|
|
4281
4289
|
L(this, Ft);
|
|
4290
|
+
L(this, vt);
|
|
4282
4291
|
L(this, it);
|
|
4283
4292
|
L(this, qt, /* @__PURE__ */ new Set());
|
|
4284
4293
|
this.options = n, I(this, Te, t), I(this, at, null), I(this, Xe, Zn()), this.bindMethods(), this.setOptions(n);
|
|
@@ -4332,7 +4341,7 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4332
4341
|
}
|
|
4333
4342
|
getOptimisticResult(t) {
|
|
4334
4343
|
const n = l(this, Te).getQueryCache().build(l(this, Te), t), r = this.createResult(n, t);
|
|
4335
|
-
return
|
|
4344
|
+
return Do(this, r) && (I(this, Ee, r), I(this, Mt, this.options), I(this, wt, l(this, G).state)), r;
|
|
4336
4345
|
}
|
|
4337
4346
|
getCurrentResult() {
|
|
4338
4347
|
return l(this, Ee);
|
|
@@ -4375,7 +4384,7 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4375
4384
|
const d = this.hasListeners(), E = !d && Hr(t, n), m = d && Wr(t, r, n, s);
|
|
4376
4385
|
(E || m) && (y = {
|
|
4377
4386
|
...y,
|
|
4378
|
-
...
|
|
4387
|
+
...Is(T.data, t.options)
|
|
4379
4388
|
}), n._optimisticResults === "isRestoring" && (y.fetchStatus = "idle");
|
|
4380
4389
|
}
|
|
4381
4390
|
let { error: P, errorUpdatedAt: O, status: B } = y;
|
|
@@ -4402,14 +4411,14 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4402
4411
|
I(this, at, d);
|
|
4403
4412
|
}
|
|
4404
4413
|
l(this, at) && (P = l(this, at), S = l(this, Lt), O = Date.now(), B = "error");
|
|
4405
|
-
const
|
|
4414
|
+
const F = y.fetchStatus === "fetching", q = B === "pending", _ = B === "error", Q = q && F, $ = S !== void 0, i = {
|
|
4406
4415
|
status: B,
|
|
4407
4416
|
fetchStatus: y.fetchStatus,
|
|
4408
4417
|
isPending: q,
|
|
4409
4418
|
isSuccess: B === "success",
|
|
4410
|
-
isError:
|
|
4411
|
-
isInitialLoading:
|
|
4412
|
-
isLoading:
|
|
4419
|
+
isError: _,
|
|
4420
|
+
isInitialLoading: Q,
|
|
4421
|
+
isLoading: Q,
|
|
4413
4422
|
data: S,
|
|
4414
4423
|
dataUpdatedAt: y.dataUpdatedAt,
|
|
4415
4424
|
error: P,
|
|
@@ -4419,12 +4428,12 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4419
4428
|
errorUpdateCount: y.errorUpdateCount,
|
|
4420
4429
|
isFetched: y.dataUpdateCount > 0 || y.errorUpdateCount > 0,
|
|
4421
4430
|
isFetchedAfterMount: y.dataUpdateCount > f.dataUpdateCount || y.errorUpdateCount > f.errorUpdateCount,
|
|
4422
|
-
isFetching:
|
|
4423
|
-
isRefetching:
|
|
4424
|
-
isLoadingError:
|
|
4431
|
+
isFetching: F,
|
|
4432
|
+
isRefetching: F && !q,
|
|
4433
|
+
isLoadingError: _ && !$,
|
|
4425
4434
|
isPaused: y.fetchStatus === "paused",
|
|
4426
4435
|
isPlaceholderData: b,
|
|
4427
|
-
isRefetchError:
|
|
4436
|
+
isRefetchError: _ && $,
|
|
4428
4437
|
isStale: br(t, n),
|
|
4429
4438
|
refetch: this.refetch,
|
|
4430
4439
|
promise: l(this, Xe),
|
|
@@ -4470,12 +4479,12 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4470
4479
|
return l(this, Ee)[p] !== t[p] && o.has(p);
|
|
4471
4480
|
});
|
|
4472
4481
|
};
|
|
4473
|
-
W(this, Y,
|
|
4482
|
+
W(this, Y, Bs).call(this, { listeners: r() });
|
|
4474
4483
|
}
|
|
4475
4484
|
onQueryUpdate() {
|
|
4476
4485
|
this.updateResult(), this.hasListeners() && W(this, Y, nr).call(this);
|
|
4477
4486
|
}
|
|
4478
|
-
}, Te = new WeakMap(), G = new WeakMap(), tn = new WeakMap(), Ee = new WeakMap(), wt = new WeakMap(), Mt = new WeakMap(), Xe = new WeakMap(), at = new WeakMap(), nn = new WeakMap(), Lt = new WeakMap(), Nt = new WeakMap(),
|
|
4487
|
+
}, Te = new WeakMap(), G = new WeakMap(), tn = new WeakMap(), Ee = new WeakMap(), wt = new WeakMap(), Mt = new WeakMap(), Xe = new WeakMap(), at = new WeakMap(), nn = new WeakMap(), Lt = new WeakMap(), Nt = new WeakMap(), Ft = new WeakMap(), vt = new WeakMap(), it = new WeakMap(), qt = new WeakMap(), Y = new WeakSet(), Yt = function(t) {
|
|
4479
4488
|
W(this, Y, ar).call(this);
|
|
4480
4489
|
let n = l(this, G).fetch(
|
|
4481
4490
|
this.options,
|
|
@@ -4490,29 +4499,29 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4490
4499
|
);
|
|
4491
4500
|
if (Ot || l(this, Ee).isStale || !Vn(t))
|
|
4492
4501
|
return;
|
|
4493
|
-
const r =
|
|
4494
|
-
I(this,
|
|
4502
|
+
const r = Fs(l(this, Ee).dataUpdatedAt, t) + 1;
|
|
4503
|
+
I(this, Ft, gt.setTimeout(() => {
|
|
4495
4504
|
l(this, Ee).isStale || this.updateResult();
|
|
4496
4505
|
}, r));
|
|
4497
4506
|
}, er = function() {
|
|
4498
4507
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(l(this, G)) : this.options.refetchInterval) ?? !1;
|
|
4499
4508
|
}, tr = function(t) {
|
|
4500
|
-
W(this, Y, sr).call(this), I(this, it, t), !(Ot || Be(this.options.enabled, l(this, G)) === !1 || !Vn(l(this, it)) || l(this, it) === 0) && I(this,
|
|
4509
|
+
W(this, Y, sr).call(this), I(this, it, t), !(Ot || Be(this.options.enabled, l(this, G)) === !1 || !Vn(l(this, it)) || l(this, it) === 0) && I(this, vt, gt.setInterval(() => {
|
|
4501
4510
|
(this.options.refetchIntervalInBackground || Er.isFocused()) && W(this, Y, Yt).call(this);
|
|
4502
4511
|
}, l(this, it)));
|
|
4503
4512
|
}, nr = function() {
|
|
4504
4513
|
W(this, Y, Jn).call(this), W(this, Y, tr).call(this, W(this, Y, er).call(this));
|
|
4505
4514
|
}, rr = function() {
|
|
4506
|
-
l(this,
|
|
4515
|
+
l(this, Ft) && (gt.clearTimeout(l(this, Ft)), I(this, Ft, void 0));
|
|
4507
4516
|
}, sr = function() {
|
|
4508
|
-
l(this,
|
|
4517
|
+
l(this, vt) && (gt.clearInterval(l(this, vt)), I(this, vt, void 0));
|
|
4509
4518
|
}, ar = function() {
|
|
4510
4519
|
const t = l(this, Te).getQueryCache().build(l(this, Te), this.options);
|
|
4511
4520
|
if (t === l(this, G))
|
|
4512
4521
|
return;
|
|
4513
4522
|
const n = l(this, G);
|
|
4514
4523
|
I(this, G, t), I(this, tn, t.state), this.hasListeners() && (n == null || n.removeObserver(this), t.addObserver(this));
|
|
4515
|
-
},
|
|
4524
|
+
}, Bs = function(t) {
|
|
4516
4525
|
ce.batch(() => {
|
|
4517
4526
|
t.listeners && this.listeners.forEach((n) => {
|
|
4518
4527
|
n(l(this, Ee));
|
|
@@ -4522,11 +4531,11 @@ var Te, G, tn, Ee, wt, Mt, Xe, at, nn, Lt, Nt, vt, Ft, it, qt, Y, Yt, Jn, er, tr
|
|
|
4522
4531
|
});
|
|
4523
4532
|
});
|
|
4524
4533
|
}, Yr);
|
|
4525
|
-
function
|
|
4534
|
+
function So(e, t) {
|
|
4526
4535
|
return Be(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
4527
4536
|
}
|
|
4528
4537
|
function Hr(e, t) {
|
|
4529
|
-
return
|
|
4538
|
+
return So(e, t) || e.state.data !== void 0 && ir(e, t, t.refetchOnMount);
|
|
4530
4539
|
}
|
|
4531
4540
|
function ir(e, t, n) {
|
|
4532
4541
|
if (Be(t.enabled, e) !== !1 && lt(t.staleTime, e) !== "static") {
|
|
@@ -4541,10 +4550,10 @@ function Wr(e, t, n, r) {
|
|
|
4541
4550
|
function br(e, t) {
|
|
4542
4551
|
return Be(t.enabled, e) !== !1 && e.isStaleByTime(lt(t.staleTime, e));
|
|
4543
4552
|
}
|
|
4544
|
-
function
|
|
4553
|
+
function Do(e, t) {
|
|
4545
4554
|
return !wn(e.getCurrentResult(), t);
|
|
4546
4555
|
}
|
|
4547
|
-
function
|
|
4556
|
+
function zr(e) {
|
|
4548
4557
|
return {
|
|
4549
4558
|
onFetch: (t, n) => {
|
|
4550
4559
|
var T, y, b, S, P;
|
|
@@ -4559,39 +4568,39 @@ function Qr(e) {
|
|
|
4559
4568
|
O = !0;
|
|
4560
4569
|
}), t.signal)
|
|
4561
4570
|
});
|
|
4562
|
-
}, R = vs(t.options, t.fetchOptions),
|
|
4571
|
+
}, R = vs(t.options, t.fetchOptions), F = async (q, _, Q) => {
|
|
4563
4572
|
if (O)
|
|
4564
4573
|
return Promise.reject();
|
|
4565
|
-
if (
|
|
4574
|
+
if (_ == null && q.pages.length)
|
|
4566
4575
|
return Promise.resolve(q);
|
|
4567
4576
|
const ie = (() => {
|
|
4568
4577
|
const E = {
|
|
4569
4578
|
client: t.client,
|
|
4570
4579
|
queryKey: t.queryKey,
|
|
4571
|
-
pageParam:
|
|
4572
|
-
direction:
|
|
4580
|
+
pageParam: _,
|
|
4581
|
+
direction: Q ? "backward" : "forward",
|
|
4573
4582
|
meta: t.options.meta
|
|
4574
4583
|
};
|
|
4575
4584
|
return B(E), E;
|
|
4576
|
-
})(), i = await R(ie), { maxPages: c } = t.options, d =
|
|
4585
|
+
})(), i = await R(ie), { maxPages: c } = t.options, d = Q ? Eo : Ao;
|
|
4577
4586
|
return {
|
|
4578
4587
|
pages: d(q.pages, i, c),
|
|
4579
|
-
pageParams: d(q.pageParams,
|
|
4588
|
+
pageParams: d(q.pageParams, _, c)
|
|
4580
4589
|
};
|
|
4581
4590
|
};
|
|
4582
4591
|
if (s && a.length) {
|
|
4583
|
-
const q = s === "backward",
|
|
4592
|
+
const q = s === "backward", _ = q ? Po : Qr, Q = {
|
|
4584
4593
|
pages: a,
|
|
4585
4594
|
pageParams: o
|
|
4586
|
-
}, $ =
|
|
4587
|
-
u = await
|
|
4595
|
+
}, $ = _(r, Q);
|
|
4596
|
+
u = await F(Q, $, q);
|
|
4588
4597
|
} else {
|
|
4589
4598
|
const q = e ?? a.length;
|
|
4590
4599
|
do {
|
|
4591
|
-
const
|
|
4592
|
-
if (p > 0 &&
|
|
4600
|
+
const _ = p === 0 ? o[0] ?? r.initialPageParam : Qr(r, u);
|
|
4601
|
+
if (p > 0 && _ == null)
|
|
4593
4602
|
break;
|
|
4594
|
-
u = await
|
|
4603
|
+
u = await F(u, _), p++;
|
|
4595
4604
|
} while (p < q);
|
|
4596
4605
|
}
|
|
4597
4606
|
return u;
|
|
@@ -4613,7 +4622,7 @@ function Qr(e) {
|
|
|
4613
4622
|
}
|
|
4614
4623
|
};
|
|
4615
4624
|
}
|
|
4616
|
-
function
|
|
4625
|
+
function Qr(e, { pages: t, pageParams: n }) {
|
|
4617
4626
|
const r = t.length - 1;
|
|
4618
4627
|
return t.length > 0 ? e.getNextPageParam(
|
|
4619
4628
|
t[r],
|
|
@@ -4622,11 +4631,11 @@ function zr(e, { pages: t, pageParams: n }) {
|
|
|
4622
4631
|
n
|
|
4623
4632
|
) : void 0;
|
|
4624
4633
|
}
|
|
4625
|
-
function
|
|
4634
|
+
function Po(e, { pages: t, pageParams: n }) {
|
|
4626
4635
|
var r;
|
|
4627
4636
|
return t.length > 0 ? (r = e.getPreviousPageParam) == null ? void 0 : r.call(e, t[0], t, n[0], n) : void 0;
|
|
4628
4637
|
}
|
|
4629
|
-
var rn, He, be, St, We, nt, Jr,
|
|
4638
|
+
var rn, He, be, St, We, nt, Jr, Oo = (Jr = class extends Os {
|
|
4630
4639
|
constructor(t) {
|
|
4631
4640
|
super();
|
|
4632
4641
|
L(this, We);
|
|
@@ -4634,7 +4643,7 @@ var rn, He, be, St, We, nt, Jr, Do = (Jr = class extends Ps {
|
|
|
4634
4643
|
L(this, He);
|
|
4635
4644
|
L(this, be);
|
|
4636
4645
|
L(this, St);
|
|
4637
|
-
I(this, rn, t.client), this.mutationId = t.mutationId, I(this, be, t.mutationCache), I(this, He, []), this.state = t.state ||
|
|
4646
|
+
I(this, rn, t.client), this.mutationId = t.mutationId, I(this, be, t.mutationCache), I(this, He, []), this.state = t.state || Rs(), this.setOptions(t.options), this.scheduleGc();
|
|
4638
4647
|
}
|
|
4639
4648
|
setOptions(t) {
|
|
4640
4649
|
this.options = t, this.updateGcTime(this.options.gcTime);
|
|
@@ -4665,7 +4674,7 @@ var rn, He, be, St, We, nt, Jr, Do = (Jr = class extends Ps {
|
|
|
4665
4674
|
this.execute(this.state.variables);
|
|
4666
4675
|
}
|
|
4667
4676
|
async execute(t) {
|
|
4668
|
-
var o, u, p, f, T, y, b, S, P, O, B, R,
|
|
4677
|
+
var o, u, p, f, T, y, b, S, P, O, B, R, F, q, _, Q, $, ie, i, c;
|
|
4669
4678
|
const n = () => {
|
|
4670
4679
|
W(this, We, nt).call(this, { type: "continue" });
|
|
4671
4680
|
}, r = {
|
|
@@ -4673,7 +4682,7 @@ var rn, He, be, St, We, nt, Jr, Do = (Jr = class extends Ps {
|
|
|
4673
4682
|
meta: this.options.meta,
|
|
4674
4683
|
mutationKey: this.options.mutationKey
|
|
4675
4684
|
};
|
|
4676
|
-
I(this, St,
|
|
4685
|
+
I(this, St, Ps({
|
|
4677
4686
|
fn: () => this.options.mutationFn ? this.options.mutationFn(t, r) : Promise.reject(new Error("No mutationFn found")),
|
|
4678
4687
|
onFail: (d, E) => {
|
|
4679
4688
|
W(this, We, nt).call(this, { type: "failed", failureCount: d, error: E });
|
|
@@ -4742,15 +4751,15 @@ var rn, He, be, St, We, nt, Jr, Do = (Jr = class extends Ps {
|
|
|
4742
4751
|
)), W(this, We, nt).call(this, { type: "success", data: d }), d;
|
|
4743
4752
|
} catch (d) {
|
|
4744
4753
|
try {
|
|
4745
|
-
throw await ((q = (
|
|
4746
|
-
|
|
4754
|
+
throw await ((q = (F = l(this, be).config).onError) == null ? void 0 : q.call(
|
|
4755
|
+
F,
|
|
4747
4756
|
d,
|
|
4748
4757
|
t,
|
|
4749
4758
|
this.state.context,
|
|
4750
4759
|
this,
|
|
4751
4760
|
r
|
|
4752
|
-
)), await ((
|
|
4753
|
-
|
|
4761
|
+
)), await ((Q = (_ = this.options).onError) == null ? void 0 : Q.call(
|
|
4762
|
+
_,
|
|
4754
4763
|
d,
|
|
4755
4764
|
t,
|
|
4756
4765
|
this.state.context,
|
|
@@ -4842,7 +4851,7 @@ var rn, He, be, St, We, nt, Jr, Do = (Jr = class extends Ps {
|
|
|
4842
4851
|
});
|
|
4843
4852
|
});
|
|
4844
4853
|
}, Jr);
|
|
4845
|
-
function
|
|
4854
|
+
function Rs() {
|
|
4846
4855
|
return {
|
|
4847
4856
|
context: void 0,
|
|
4848
4857
|
data: void 0,
|
|
@@ -4855,16 +4864,16 @@ function Bs() {
|
|
|
4855
4864
|
submittedAt: 0
|
|
4856
4865
|
};
|
|
4857
4866
|
}
|
|
4858
|
-
var Ze,
|
|
4867
|
+
var Ze, Me, sn, es, Io = (es = class extends Xt {
|
|
4859
4868
|
constructor(t = {}) {
|
|
4860
4869
|
super();
|
|
4861
4870
|
L(this, Ze);
|
|
4862
|
-
L(this,
|
|
4871
|
+
L(this, Me);
|
|
4863
4872
|
L(this, sn);
|
|
4864
|
-
this.config = t, I(this, Ze, /* @__PURE__ */ new Set()), I(this,
|
|
4873
|
+
this.config = t, I(this, Ze, /* @__PURE__ */ new Set()), I(this, Me, /* @__PURE__ */ new Map()), I(this, sn, 0);
|
|
4865
4874
|
}
|
|
4866
4875
|
build(t, n, r) {
|
|
4867
|
-
const s = new
|
|
4876
|
+
const s = new Oo({
|
|
4868
4877
|
client: t,
|
|
4869
4878
|
mutationCache: this,
|
|
4870
4879
|
mutationId: ++pn(this, sn)._,
|
|
@@ -4877,8 +4886,8 @@ var Ze, Ue, sn, es, Po = (es = class extends Xt {
|
|
|
4877
4886
|
l(this, Ze).add(t);
|
|
4878
4887
|
const n = gn(t);
|
|
4879
4888
|
if (typeof n == "string") {
|
|
4880
|
-
const r = l(this,
|
|
4881
|
-
r ? r.push(t) : l(this,
|
|
4889
|
+
const r = l(this, Me).get(n);
|
|
4890
|
+
r ? r.push(t) : l(this, Me).set(n, [t]);
|
|
4882
4891
|
}
|
|
4883
4892
|
this.notify({ type: "added", mutation: t });
|
|
4884
4893
|
}
|
|
@@ -4886,12 +4895,12 @@ var Ze, Ue, sn, es, Po = (es = class extends Xt {
|
|
|
4886
4895
|
if (l(this, Ze).delete(t)) {
|
|
4887
4896
|
const n = gn(t);
|
|
4888
4897
|
if (typeof n == "string") {
|
|
4889
|
-
const r = l(this,
|
|
4898
|
+
const r = l(this, Me).get(n);
|
|
4890
4899
|
if (r)
|
|
4891
4900
|
if (r.length > 1) {
|
|
4892
4901
|
const s = r.indexOf(t);
|
|
4893
4902
|
s !== -1 && r.splice(s, 1);
|
|
4894
|
-
} else r[0] === t && l(this,
|
|
4903
|
+
} else r[0] === t && l(this, Me).delete(n);
|
|
4895
4904
|
}
|
|
4896
4905
|
}
|
|
4897
4906
|
this.notify({ type: "removed", mutation: t });
|
|
@@ -4899,7 +4908,7 @@ var Ze, Ue, sn, es, Po = (es = class extends Xt {
|
|
|
4899
4908
|
canRun(t) {
|
|
4900
4909
|
const n = gn(t);
|
|
4901
4910
|
if (typeof n == "string") {
|
|
4902
|
-
const r = l(this,
|
|
4911
|
+
const r = l(this, Me).get(n), s = r == null ? void 0 : r.find(
|
|
4903
4912
|
(a) => a.state.status === "pending"
|
|
4904
4913
|
);
|
|
4905
4914
|
return !s || s === t;
|
|
@@ -4910,7 +4919,7 @@ var Ze, Ue, sn, es, Po = (es = class extends Xt {
|
|
|
4910
4919
|
var r;
|
|
4911
4920
|
const n = gn(t);
|
|
4912
4921
|
if (typeof n == "string") {
|
|
4913
|
-
const s = (r = l(this,
|
|
4922
|
+
const s = (r = l(this, Me).get(n)) == null ? void 0 : r.find((a) => a !== t && a.state.isPaused);
|
|
4914
4923
|
return (s == null ? void 0 : s.continue()) ?? Promise.resolve();
|
|
4915
4924
|
} else
|
|
4916
4925
|
return Promise.resolve();
|
|
@@ -4919,7 +4928,7 @@ var Ze, Ue, sn, es, Po = (es = class extends Xt {
|
|
|
4919
4928
|
ce.batch(() => {
|
|
4920
4929
|
l(this, Ze).forEach((t) => {
|
|
4921
4930
|
this.notify({ type: "removed", mutation: t });
|
|
4922
|
-
}), l(this, Ze).clear(), l(this,
|
|
4931
|
+
}), l(this, Ze).clear(), l(this, Me).clear();
|
|
4923
4932
|
});
|
|
4924
4933
|
}
|
|
4925
4934
|
getAll() {
|
|
@@ -4949,12 +4958,12 @@ var Ze, Ue, sn, es, Po = (es = class extends Xt {
|
|
|
4949
4958
|
)
|
|
4950
4959
|
);
|
|
4951
4960
|
}
|
|
4952
|
-
}, Ze = new WeakMap(),
|
|
4961
|
+
}, Ze = new WeakMap(), Me = new WeakMap(), sn = new WeakMap(), es);
|
|
4953
4962
|
function gn(e) {
|
|
4954
4963
|
var t;
|
|
4955
4964
|
return (t = e.options.scope) == null ? void 0 : t.id;
|
|
4956
4965
|
}
|
|
4957
|
-
var Ye, ot, we, Je, et, xn, or, ts,
|
|
4966
|
+
var Ye, ot, we, Je, et, xn, or, ts, Bo = (ts = class extends Xt {
|
|
4958
4967
|
constructor(t, n) {
|
|
4959
4968
|
super();
|
|
4960
4969
|
L(this, et);
|
|
@@ -4996,7 +5005,7 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
4996
5005
|
}
|
|
4997
5006
|
}, Ye = new WeakMap(), ot = new WeakMap(), we = new WeakMap(), Je = new WeakMap(), et = new WeakSet(), xn = function() {
|
|
4998
5007
|
var n;
|
|
4999
|
-
const t = ((n = l(this, we)) == null ? void 0 : n.state) ??
|
|
5008
|
+
const t = ((n = l(this, we)) == null ? void 0 : n.state) ?? Rs();
|
|
5000
5009
|
I(this, ot, {
|
|
5001
5010
|
...t,
|
|
5002
5011
|
isPending: t.status === "pending",
|
|
@@ -5047,16 +5056,16 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5047
5056
|
T(l(this, ot));
|
|
5048
5057
|
});
|
|
5049
5058
|
});
|
|
5050
|
-
}, ts),
|
|
5059
|
+
}, ts), ze, ns, Ro = (ns = class extends Xt {
|
|
5051
5060
|
constructor(t = {}) {
|
|
5052
5061
|
super();
|
|
5053
|
-
L(this,
|
|
5054
|
-
this.config = t, I(this,
|
|
5062
|
+
L(this, ze);
|
|
5063
|
+
this.config = t, I(this, ze, /* @__PURE__ */ new Map());
|
|
5055
5064
|
}
|
|
5056
5065
|
build(t, n, r) {
|
|
5057
5066
|
const s = n.queryKey, a = n.queryHash ?? Ar(s, n);
|
|
5058
5067
|
let o = this.get(a);
|
|
5059
|
-
return o || (o = new
|
|
5068
|
+
return o || (o = new Fo({
|
|
5060
5069
|
client: t,
|
|
5061
5070
|
queryKey: s,
|
|
5062
5071
|
queryHash: a,
|
|
@@ -5066,14 +5075,14 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5066
5075
|
}), this.add(o)), o;
|
|
5067
5076
|
}
|
|
5068
5077
|
add(t) {
|
|
5069
|
-
l(this,
|
|
5078
|
+
l(this, ze).has(t.queryHash) || (l(this, ze).set(t.queryHash, t), this.notify({
|
|
5070
5079
|
type: "added",
|
|
5071
5080
|
query: t
|
|
5072
5081
|
}));
|
|
5073
5082
|
}
|
|
5074
5083
|
remove(t) {
|
|
5075
|
-
const n = l(this,
|
|
5076
|
-
n && (t.destroy(), n === t && l(this,
|
|
5084
|
+
const n = l(this, ze).get(t.queryHash);
|
|
5085
|
+
n && (t.destroy(), n === t && l(this, ze).delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
5077
5086
|
}
|
|
5078
5087
|
clear() {
|
|
5079
5088
|
ce.batch(() => {
|
|
@@ -5083,10 +5092,10 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5083
5092
|
});
|
|
5084
5093
|
}
|
|
5085
5094
|
get(t) {
|
|
5086
|
-
return l(this,
|
|
5095
|
+
return l(this, ze).get(t);
|
|
5087
5096
|
}
|
|
5088
5097
|
getAll() {
|
|
5089
|
-
return [...l(this,
|
|
5098
|
+
return [...l(this, ze).values()];
|
|
5090
5099
|
}
|
|
5091
5100
|
find(t) {
|
|
5092
5101
|
const n = { exact: !0, ...t };
|
|
@@ -5119,7 +5128,7 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5119
5128
|
});
|
|
5120
5129
|
});
|
|
5121
5130
|
}
|
|
5122
|
-
},
|
|
5131
|
+
}, ze = new WeakMap(), ns), ae, ct, ut, Kt, Ht, dt, Wt, zt, rs, _o = (rs = class {
|
|
5123
5132
|
constructor(e = {}) {
|
|
5124
5133
|
L(this, ae);
|
|
5125
5134
|
L(this, ct);
|
|
@@ -5128,19 +5137,19 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5128
5137
|
L(this, Ht);
|
|
5129
5138
|
L(this, dt);
|
|
5130
5139
|
L(this, Wt);
|
|
5131
|
-
L(this,
|
|
5132
|
-
I(this, ae, e.queryCache || new
|
|
5140
|
+
L(this, zt);
|
|
5141
|
+
I(this, ae, e.queryCache || new Ro()), I(this, ct, e.mutationCache || new Io()), I(this, ut, e.defaultOptions || {}), I(this, Kt, /* @__PURE__ */ new Map()), I(this, Ht, /* @__PURE__ */ new Map()), I(this, dt, 0);
|
|
5133
5142
|
}
|
|
5134
5143
|
mount() {
|
|
5135
5144
|
pn(this, dt)._++, l(this, dt) === 1 && (I(this, Wt, Er.subscribe(async (e) => {
|
|
5136
5145
|
e && (await this.resumePausedMutations(), l(this, ae).onFocus());
|
|
5137
|
-
})), I(this,
|
|
5146
|
+
})), I(this, zt, vn.subscribe(async (e) => {
|
|
5138
5147
|
e && (await this.resumePausedMutations(), l(this, ae).onOnline());
|
|
5139
5148
|
})));
|
|
5140
5149
|
}
|
|
5141
5150
|
unmount() {
|
|
5142
5151
|
var e, t;
|
|
5143
|
-
pn(this, dt)._--, l(this, dt) === 0 && ((e = l(this, Wt)) == null || e.call(this), I(this, Wt, void 0), (t = l(this,
|
|
5152
|
+
pn(this, dt)._--, l(this, dt) === 0 && ((e = l(this, Wt)) == null || e.call(this), I(this, Wt, void 0), (t = l(this, zt)) == null || t.call(this), I(this, zt, void 0));
|
|
5144
5153
|
}
|
|
5145
5154
|
isFetching(e) {
|
|
5146
5155
|
return l(this, ae).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
@@ -5173,7 +5182,7 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5173
5182
|
setQueryData(e, t, n) {
|
|
5174
5183
|
const r = this.defaultQueryOptions({ queryKey: e }), s = l(this, ae).get(
|
|
5175
5184
|
r.queryHash
|
|
5176
|
-
), a = s == null ? void 0 : s.state.data, o =
|
|
5185
|
+
), a = s == null ? void 0 : s.state.data, o = mo(t, a);
|
|
5177
5186
|
if (o !== void 0)
|
|
5178
5187
|
return l(this, ae).build(this, r).setData(o, { ...n, manual: !0 });
|
|
5179
5188
|
}
|
|
@@ -5253,16 +5262,16 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5253
5262
|
return this.fetchQuery(e).then(xe).catch(xe);
|
|
5254
5263
|
}
|
|
5255
5264
|
fetchInfiniteQuery(e) {
|
|
5256
|
-
return e.behavior =
|
|
5265
|
+
return e.behavior = zr(e.pages), this.fetchQuery(e);
|
|
5257
5266
|
}
|
|
5258
5267
|
prefetchInfiniteQuery(e) {
|
|
5259
5268
|
return this.fetchInfiniteQuery(e).then(xe).catch(xe);
|
|
5260
5269
|
}
|
|
5261
5270
|
ensureInfiniteQueryData(e) {
|
|
5262
|
-
return e.behavior =
|
|
5271
|
+
return e.behavior = zr(e.pages), this.ensureQueryData(e);
|
|
5263
5272
|
}
|
|
5264
5273
|
resumePausedMutations() {
|
|
5265
|
-
return
|
|
5274
|
+
return vn.isOnline() ? l(this, ct).resumePausedMutations() : Promise.resolve();
|
|
5266
5275
|
}
|
|
5267
5276
|
getQueryCache() {
|
|
5268
5277
|
return l(this, ae);
|
|
@@ -5312,7 +5321,7 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5312
5321
|
return t.queryHash || (t.queryHash = Ar(
|
|
5313
5322
|
t.queryKey,
|
|
5314
5323
|
t
|
|
5315
|
-
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn ===
|
|
5324
|
+
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === Fn && (t.enabled = !1), t;
|
|
5316
5325
|
}
|
|
5317
5326
|
defaultMutationOptions(e) {
|
|
5318
5327
|
return e != null && e._defaulted ? e : {
|
|
@@ -5325,21 +5334,21 @@ var Ye, ot, we, Je, et, xn, or, ts, Oo = (ts = class extends Xt {
|
|
|
5325
5334
|
clear() {
|
|
5326
5335
|
l(this, ae).clear(), l(this, ct).clear();
|
|
5327
5336
|
}
|
|
5328
|
-
}, ae = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), Kt = new WeakMap(), Ht = new WeakMap(), dt = new WeakMap(), Wt = new WeakMap(),
|
|
5337
|
+
}, ae = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), Kt = new WeakMap(), Ht = new WeakMap(), dt = new WeakMap(), Wt = new WeakMap(), zt = new WeakMap(), rs), _s = fe.createContext(
|
|
5329
5338
|
void 0
|
|
5330
5339
|
), un = (e) => {
|
|
5331
|
-
const t = fe.useContext(
|
|
5340
|
+
const t = fe.useContext(_s);
|
|
5332
5341
|
if (!t)
|
|
5333
5342
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
5334
5343
|
return t;
|
|
5335
|
-
},
|
|
5344
|
+
}, ko = ({
|
|
5336
5345
|
client: e,
|
|
5337
5346
|
children: t
|
|
5338
5347
|
}) => (fe.useEffect(() => (e.mount(), () => {
|
|
5339
5348
|
e.unmount();
|
|
5340
|
-
}), [e]), /* @__PURE__ */
|
|
5349
|
+
}), [e]), /* @__PURE__ */ Ne(_s.Provider, { value: e, children: t })), ks = fe.createContext(!1), Uo = () => fe.useContext(ks);
|
|
5341
5350
|
ks.Provider;
|
|
5342
|
-
function
|
|
5351
|
+
function Mo() {
|
|
5343
5352
|
let e = !1;
|
|
5344
5353
|
return {
|
|
5345
5354
|
clearReset: () => {
|
|
@@ -5351,19 +5360,19 @@ function _o() {
|
|
|
5351
5360
|
isReset: () => e
|
|
5352
5361
|
};
|
|
5353
5362
|
}
|
|
5354
|
-
var
|
|
5363
|
+
var Lo = fe.createContext(Mo()), No = () => fe.useContext(Lo), qo = (e, t) => {
|
|
5355
5364
|
(e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
|
|
5356
|
-
},
|
|
5365
|
+
}, Ko = (e) => {
|
|
5357
5366
|
fe.useEffect(() => {
|
|
5358
5367
|
e.clearReset();
|
|
5359
5368
|
}, [e]);
|
|
5360
|
-
},
|
|
5369
|
+
}, Ho = ({
|
|
5361
5370
|
result: e,
|
|
5362
5371
|
errorResetBoundary: t,
|
|
5363
5372
|
throwOnError: n,
|
|
5364
5373
|
query: r,
|
|
5365
5374
|
suspense: s
|
|
5366
|
-
}) => e.isError && !t.isReset() && !e.isFetching && r && (s && e.data === void 0 ||
|
|
5375
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && (s && e.data === void 0 || Ss(n, [e.error, r])), Wo = (e) => {
|
|
5367
5376
|
if (e.suspense) {
|
|
5368
5377
|
const n = (s) => s === "static" ? s : Math.max(s ?? 1e3, 1e3), r = e.staleTime;
|
|
5369
5378
|
e.staleTime = typeof r == "function" ? (...s) => n(r(...s)) : n(r), typeof e.gcTime == "number" && (e.gcTime = Math.max(
|
|
@@ -5371,22 +5380,22 @@ var Uo = fe.createContext(_o()), Mo = () => fe.useContext(Uo), Lo = (e, t) => {
|
|
|
5371
5380
|
1e3
|
|
5372
5381
|
));
|
|
5373
5382
|
}
|
|
5374
|
-
},
|
|
5383
|
+
}, zo = (e, t) => e.isLoading && e.isFetching && !t, Qo = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, $r = (e, t, n) => t.fetchOptimistic(e).catch(() => {
|
|
5375
5384
|
n.clearReset();
|
|
5376
5385
|
});
|
|
5377
|
-
function
|
|
5386
|
+
function $o(e, t, n) {
|
|
5378
5387
|
var y, b, S, P, O;
|
|
5379
5388
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
5380
5389
|
throw new Error(
|
|
5381
5390
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
5382
5391
|
);
|
|
5383
|
-
const r =
|
|
5392
|
+
const r = Uo(), s = No(), a = un(), o = a.defaultQueryOptions(e);
|
|
5384
5393
|
(b = (y = a.getDefaultOptions().queries) == null ? void 0 : y._experimental_beforeQuery) == null || b.call(
|
|
5385
5394
|
y,
|
|
5386
5395
|
o
|
|
5387
5396
|
), process.env.NODE_ENV !== "production" && (o.queryFn || console.error(
|
|
5388
5397
|
`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
5389
|
-
)), o._optimisticResults = r ? "isRestoring" : "optimistic",
|
|
5398
|
+
)), o._optimisticResults = r ? "isRestoring" : "optimistic", Wo(o), qo(o, s), Ko(s);
|
|
5390
5399
|
const u = !a.getQueryCache().get(o.queryHash), [p] = fe.useState(
|
|
5391
5400
|
() => new t(
|
|
5392
5401
|
a,
|
|
@@ -5405,9 +5414,9 @@ function Qo(e, t, n) {
|
|
|
5405
5414
|
() => p.getCurrentResult()
|
|
5406
5415
|
), fe.useEffect(() => {
|
|
5407
5416
|
p.setOptions(o);
|
|
5408
|
-
}, [o, p]),
|
|
5417
|
+
}, [o, p]), Qo(o, f))
|
|
5409
5418
|
throw $r(o, p, s);
|
|
5410
|
-
if (
|
|
5419
|
+
if (Ho({
|
|
5411
5420
|
result: f,
|
|
5412
5421
|
errorResetBoundary: s,
|
|
5413
5422
|
throwOnError: o.throwOnError,
|
|
@@ -5419,7 +5428,7 @@ function Qo(e, t, n) {
|
|
|
5419
5428
|
S,
|
|
5420
5429
|
o,
|
|
5421
5430
|
f
|
|
5422
|
-
), o.experimental_prefetchInRender && !Ot &&
|
|
5431
|
+
), o.experimental_prefetchInRender && !Ot && zo(f, r)) {
|
|
5423
5432
|
const B = u ? (
|
|
5424
5433
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
5425
5434
|
$r(o, p, s)
|
|
@@ -5433,12 +5442,12 @@ function Qo(e, t, n) {
|
|
|
5433
5442
|
}
|
|
5434
5443
|
return o.notifyOnChangeProps ? f : p.trackResult(f);
|
|
5435
5444
|
}
|
|
5436
|
-
function
|
|
5437
|
-
return
|
|
5445
|
+
function Vo(e, t) {
|
|
5446
|
+
return $o(e, vo);
|
|
5438
5447
|
}
|
|
5439
5448
|
function ft(e, t) {
|
|
5440
5449
|
const n = un(), [r] = fe.useState(
|
|
5441
|
-
() => new
|
|
5450
|
+
() => new Bo(
|
|
5442
5451
|
n,
|
|
5443
5452
|
e
|
|
5444
5453
|
)
|
|
@@ -5459,7 +5468,7 @@ function ft(e, t) {
|
|
|
5459
5468
|
},
|
|
5460
5469
|
[r]
|
|
5461
5470
|
);
|
|
5462
|
-
if (s.error &&
|
|
5471
|
+
if (s.error && Ss(r.options.throwOnError, [s.error]))
|
|
5463
5472
|
throw s.error;
|
|
5464
5473
|
return { ...s, mutate: a, mutateAsync: s.mutate };
|
|
5465
5474
|
}
|
|
@@ -5470,13 +5479,13 @@ const In = () => {
|
|
|
5470
5479
|
(a) => n(e, a),
|
|
5471
5480
|
[n, e]
|
|
5472
5481
|
);
|
|
5473
|
-
return
|
|
5474
|
-
},
|
|
5482
|
+
return k(() => ({ ...t, update: s, resetSwap: r }), [t, s, r]);
|
|
5483
|
+
}, jo = 2e4, Go = () => {
|
|
5475
5484
|
const { module: e } = N(), t = H((n) => n.state.isMarketOrder);
|
|
5476
|
-
return
|
|
5485
|
+
return k(() => e === V.TWAP ? t ? X.TWAP_MARKET : X.TWAP_LIMIT : e === V.LIMIT ? X.LIMIT : e === V.STOP_LOSS ? t ? X.STOP_LOSS_MARKET : X.STOP_LOSS_LIMIT : e === V.TAKE_PROFIT ? t ? X.TAKE_PROFIT_MARKET : X.TAKE_PROFIT_LIMIT : X.TWAP_MARKET, [e, t]);
|
|
5477
5486
|
}, xr = () => {
|
|
5478
5487
|
const { account: e, config: t, chainId: n, isDev: r } = N();
|
|
5479
|
-
return
|
|
5488
|
+
return k(
|
|
5480
5489
|
() => [
|
|
5481
5490
|
"useTwapOrderHistoryManager",
|
|
5482
5491
|
e,
|
|
@@ -5487,7 +5496,7 @@ const In = () => {
|
|
|
5487
5496
|
],
|
|
5488
5497
|
[e, t, n, r]
|
|
5489
5498
|
);
|
|
5490
|
-
},
|
|
5499
|
+
}, Xo = () => {
|
|
5491
5500
|
const e = un(), t = xr();
|
|
5492
5501
|
return ne(
|
|
5493
5502
|
(n, r) => {
|
|
@@ -5500,7 +5509,7 @@ const In = () => {
|
|
|
5500
5509
|
},
|
|
5501
5510
|
[e, t]
|
|
5502
5511
|
);
|
|
5503
|
-
},
|
|
5512
|
+
}, Zo = () => {
|
|
5504
5513
|
const { callbacks: e } = N(), t = un(), n = xr();
|
|
5505
5514
|
return ne(
|
|
5506
5515
|
(r) => {
|
|
@@ -5516,7 +5525,7 @@ const In = () => {
|
|
|
5516
5525
|
},
|
|
5517
5526
|
[t, n, e]
|
|
5518
5527
|
);
|
|
5519
|
-
},
|
|
5528
|
+
}, Yo = (e, t) => {
|
|
5520
5529
|
const n = new Set(e.map((s) => s.id)), r = (t == null ? void 0 : t.filter(
|
|
5521
5530
|
(s) => s.version === 1 && !n.has(s.id)
|
|
5522
5531
|
)) ?? [];
|
|
@@ -5524,9 +5533,9 @@ const In = () => {
|
|
|
5524
5533
|
(s, a) => a.createdAt - s.createdAt
|
|
5525
5534
|
);
|
|
5526
5535
|
}, Cr = () => {
|
|
5527
|
-
const { account: e, config: t, chainId: n, isDev: r } = N(), s = un(), a = xr(), o =
|
|
5528
|
-
return
|
|
5529
|
-
refetchInterval:
|
|
5536
|
+
const { account: e, config: t, chainId: n, isDev: r } = N(), s = un(), a = xr(), o = Zo();
|
|
5537
|
+
return Vo({
|
|
5538
|
+
refetchInterval: jo,
|
|
5530
5539
|
refetchOnWindowFocus: !0,
|
|
5531
5540
|
retry: !1,
|
|
5532
5541
|
gcTime: 1 / 0,
|
|
@@ -5534,7 +5543,7 @@ const In = () => {
|
|
|
5534
5543
|
queryKey: a,
|
|
5535
5544
|
queryFn: async ({ signal: p }) => {
|
|
5536
5545
|
if (!e || !n || !t) return [];
|
|
5537
|
-
const f = s.getQueryData(a), T = !f, y = await
|
|
5546
|
+
const f = s.getQueryData(a), T = !f, y = await Li({
|
|
5538
5547
|
signal: p,
|
|
5539
5548
|
chainId: n,
|
|
5540
5549
|
config: t,
|
|
@@ -5547,20 +5556,20 @@ const In = () => {
|
|
|
5547
5556
|
...S,
|
|
5548
5557
|
fillDelayMillis: ds(S, t.twapConfig)
|
|
5549
5558
|
} : S);
|
|
5550
|
-
return T ? b :
|
|
5559
|
+
return T ? b : Yo(b, f);
|
|
5551
5560
|
}
|
|
5552
5561
|
});
|
|
5553
|
-
},
|
|
5562
|
+
}, Jo = (e, t, n) => k(() => {
|
|
5554
5563
|
if (!(!e || !t || !n || n != null && n.isMarketPrice))
|
|
5555
|
-
return
|
|
5564
|
+
return La(
|
|
5556
5565
|
n,
|
|
5557
5566
|
e == null ? void 0 : e.decimals,
|
|
5558
5567
|
t == null ? void 0 : t.decimals
|
|
5559
5568
|
);
|
|
5560
|
-
}, [n, e, t]),
|
|
5569
|
+
}, [n, e, t]), ec = (e, t, n) => k(() => {
|
|
5561
5570
|
if (!(!e || !t || !n))
|
|
5562
|
-
return
|
|
5563
|
-
}, [n, e, t]),
|
|
5571
|
+
return Na(n, e.decimals, t.decimals);
|
|
5572
|
+
}, [n, e, t]), tc = (e, t, n) => k(() => {
|
|
5564
5573
|
if (!(!e || !t || !n))
|
|
5565
5574
|
return ls(
|
|
5566
5575
|
n.srcAmountFilled,
|
|
@@ -5568,12 +5577,12 @@ const In = () => {
|
|
|
5568
5577
|
e.decimals,
|
|
5569
5578
|
t.decimals
|
|
5570
5579
|
);
|
|
5571
|
-
}, [n, e, t]), An = (e, t) => [...e.filter((r) => r.status === t)].sort((r, s) => s.createdAt - r.createdAt),
|
|
5580
|
+
}, [n, e, t]), An = (e, t) => [...e.filter((r) => r.status === t)].sort((r, s) => s.createdAt - r.createdAt), nc = () => {
|
|
5572
5581
|
const { data: e, isLoading: t, refetch: n, isRefetching: r } = Cr(), s = ne(
|
|
5573
5582
|
() => n().then((a) => a.data),
|
|
5574
5583
|
[n]
|
|
5575
5584
|
);
|
|
5576
|
-
return
|
|
5585
|
+
return k(() => ({
|
|
5577
5586
|
orders: {
|
|
5578
5587
|
all: e ?? [],
|
|
5579
5588
|
open: An(e ?? [], le.Open),
|
|
@@ -5587,12 +5596,12 @@ const In = () => {
|
|
|
5587
5596
|
}), [e, t, r, s]);
|
|
5588
5597
|
}, Tr = () => {
|
|
5589
5598
|
const e = H((n) => n.state.currentTime), t = mr().duration;
|
|
5590
|
-
return
|
|
5591
|
-
},
|
|
5599
|
+
return k(() => Va(e, t), [e, t]);
|
|
5600
|
+
}, Us = () => {
|
|
5592
5601
|
const { srcToken: e, dstToken: t, account: n, chainId: r, slippage: s, config: a, module: o, fees: u } = N(), { amount: p } = pt(), { amountPerTrade: f, totalTrades: T } = $e(), y = Tr(), { amount: b } = gr(), { pricePerChunk: S } = Bt(), { milliseconds: P } = Gt();
|
|
5593
|
-
return
|
|
5602
|
+
return k(() => {
|
|
5594
5603
|
var O;
|
|
5595
|
-
return
|
|
5604
|
+
return li({
|
|
5596
5605
|
chainId: r,
|
|
5597
5606
|
srcToken: on((e == null ? void 0 : e.address) || "") ? ((O = Vt(r)) == null ? void 0 : O.wToken.address) || "" : (e == null ? void 0 : e.address) || "",
|
|
5598
5607
|
dstToken: (t == null ? void 0 : t.address) || "",
|
|
@@ -5624,7 +5633,7 @@ const In = () => {
|
|
|
5624
5633
|
u
|
|
5625
5634
|
]);
|
|
5626
5635
|
};
|
|
5627
|
-
function
|
|
5636
|
+
function rc(e) {
|
|
5628
5637
|
const t = e.slice(2);
|
|
5629
5638
|
if (t.length === 128) {
|
|
5630
5639
|
const a = `0x${t.slice(0, 64)}`, o = parseInt(t.charAt(64), 16), u = (o >> 3) + 27, p = `0x${(o & 7).toString(16)}${t.slice(65, 128)}`;
|
|
@@ -5633,7 +5642,7 @@ function tc(e) {
|
|
|
5633
5642
|
const n = `0x${t.slice(0, 64)}`, r = `0x${t.slice(64, 128)}`, s = parseInt(t.slice(128, 130), 16);
|
|
5634
5643
|
return { r: n, s: r, v: s };
|
|
5635
5644
|
}
|
|
5636
|
-
const
|
|
5645
|
+
const sc = () => {
|
|
5637
5646
|
var a;
|
|
5638
5647
|
const { account: e, walletInteractions: t, callbacks: n, chainId: r } = N(), s = (a = hr()) == null ? void 0 : a.wToken;
|
|
5639
5648
|
return ft({
|
|
@@ -5653,18 +5662,18 @@ const nc = () => {
|
|
|
5653
5662
|
return (f = n == null ? void 0 : n.onWrapRequest) == null || f.call(n), o == null || o(p), pe.onWrapSuccess(p), (T = n == null ? void 0 : n.onWrapSuccess) == null || T.call(n, {
|
|
5654
5663
|
txHash: p,
|
|
5655
5664
|
explorerUrl: cn(p, r),
|
|
5656
|
-
amount:
|
|
5665
|
+
amount: Fe(u, s.decimals)
|
|
5657
5666
|
}), p;
|
|
5658
5667
|
},
|
|
5659
5668
|
onError: (o) => {
|
|
5660
5669
|
throw pe.onWrapError(o), o;
|
|
5661
5670
|
}
|
|
5662
5671
|
});
|
|
5663
|
-
},
|
|
5664
|
-
const { account: e, walletInteractions: t, chainId: n, callbacks: r, isDev: s } = N(), a =
|
|
5672
|
+
}, ac = () => {
|
|
5673
|
+
const { account: e, walletInteractions: t, chainId: n, callbacks: r, isDev: s } = N(), a = Us(), { refetch: o } = Cr();
|
|
5665
5674
|
return ft({
|
|
5666
5675
|
mutationFn: async () => {
|
|
5667
|
-
var O, B, R,
|
|
5676
|
+
var O, B, R, F;
|
|
5668
5677
|
if (!e)
|
|
5669
5678
|
throw new Error("missing account");
|
|
5670
5679
|
if (!t)
|
|
@@ -5686,17 +5695,17 @@ const nc = () => {
|
|
|
5686
5695
|
throw (O = r == null ? void 0 : r.onSignOrderError) == null || O.call(r, q), pe.onSignOrderError(q), q;
|
|
5687
5696
|
}
|
|
5688
5697
|
pe.onSignOrderSuccess(y), (B = r == null ? void 0 : r.onSignOrderSuccess) == null || B.call(r, y);
|
|
5689
|
-
const b =
|
|
5698
|
+
const b = rc(y), S = {
|
|
5690
5699
|
v: `0x${b.v.toString(16)}`,
|
|
5691
5700
|
r: b.r,
|
|
5692
5701
|
s: b.s
|
|
5693
5702
|
};
|
|
5694
5703
|
(R = r == null ? void 0 : r.onSignOrderRequest) == null || R.call(r);
|
|
5695
|
-
const P = await
|
|
5696
|
-
return (
|
|
5704
|
+
const P = await Si(u, S, s);
|
|
5705
|
+
return (F = r == null ? void 0 : r.onOrderCreated) == null || F.call(r, P), await o(), P;
|
|
5697
5706
|
}
|
|
5698
5707
|
});
|
|
5699
|
-
},
|
|
5708
|
+
}, Ms = () => {
|
|
5700
5709
|
const { account: e, walletInteractions: t, config: n } = N();
|
|
5701
5710
|
return ft({
|
|
5702
5711
|
mutationFn: async ({
|
|
@@ -5712,14 +5721,14 @@ const nc = () => {
|
|
|
5712
5721
|
const a = await t.getAllowance({
|
|
5713
5722
|
tokenAddress: r,
|
|
5714
5723
|
spenderAddress: n.repermit
|
|
5715
|
-
}), o =
|
|
5716
|
-
|
|
5724
|
+
}), o = v(a || "0").lt(
|
|
5725
|
+
v(s).toString()
|
|
5717
5726
|
);
|
|
5718
5727
|
return { allowance: a, approvalRequired: o };
|
|
5719
5728
|
}
|
|
5720
5729
|
});
|
|
5721
|
-
},
|
|
5722
|
-
const { account: e, walletInteractions: t, config: n, chainId: r, callbacks: s } = N(), { mutateAsync: a } =
|
|
5730
|
+
}, ic = () => {
|
|
5731
|
+
const { account: e, walletInteractions: t, config: n, chainId: r, callbacks: s } = N(), { mutateAsync: a } = Ms();
|
|
5723
5732
|
return ft({
|
|
5724
5733
|
onError: (o) => {
|
|
5725
5734
|
pe.onApproveError(o);
|
|
@@ -5765,11 +5774,11 @@ const nc = () => {
|
|
|
5765
5774
|
txHash: f,
|
|
5766
5775
|
explorerUrl: cn(f, r),
|
|
5767
5776
|
token: o,
|
|
5768
|
-
amount:
|
|
5777
|
+
amount: Fe(p, o.decimals)
|
|
5769
5778
|
}), f;
|
|
5770
5779
|
}
|
|
5771
5780
|
});
|
|
5772
|
-
},
|
|
5781
|
+
}, oc = () => {
|
|
5773
5782
|
const { account: e, chainId: t, srcToken: n, dstToken: r, module: s, slippage: a } = N(), o = Bt(), u = pt().amount, p = $e().amountPerTrade, f = Tr(), T = $e().totalTrades, y = Gt().fillDelay, b = gr().amount, S = H((P) => P.state.isMarketOrder);
|
|
5774
5783
|
return ft({
|
|
5775
5784
|
mutationFn: async () => {
|
|
@@ -5792,15 +5801,15 @@ const nc = () => {
|
|
|
5792
5801
|
}
|
|
5793
5802
|
});
|
|
5794
5803
|
};
|
|
5795
|
-
function
|
|
5804
|
+
function cc(e) {
|
|
5796
5805
|
const t = e.message, n = t.match(/,\s*code\s*:\s*(\d+)/i);
|
|
5797
5806
|
return {
|
|
5798
5807
|
message: t.replace(/^error\s*:/i, "").replace(/,\s*code\s*:\s*\d+/i, "").trim() || "",
|
|
5799
5808
|
code: n ? Number(n[1]) : 0
|
|
5800
5809
|
};
|
|
5801
5810
|
}
|
|
5802
|
-
const
|
|
5803
|
-
const { srcToken: e, dstToken: t, chainId: n, callbacks: r, marketPrice: s } = N(), a =
|
|
5811
|
+
const uc = () => {
|
|
5812
|
+
const { srcToken: e, dstToken: t, chainId: n, callbacks: r, marketPrice: s } = N(), a = ic().mutateAsync, o = sc().mutateAsync, u = ac().mutateAsync, { mutateAsync: p } = Ms(), { update: f } = In(), { amount: T } = pt(), y = oc().mutate;
|
|
5804
5813
|
return ft({
|
|
5805
5814
|
mutationFn: async () => {
|
|
5806
5815
|
var S, P;
|
|
@@ -5812,7 +5821,7 @@ const oc = () => {
|
|
|
5812
5821
|
throw new Error("missing dstToken");
|
|
5813
5822
|
if (!n)
|
|
5814
5823
|
throw new Error("missing chainId");
|
|
5815
|
-
const O =
|
|
5824
|
+
const O = Qi(e, n);
|
|
5816
5825
|
f({
|
|
5817
5826
|
allowanceLoading: !0,
|
|
5818
5827
|
wrapTxHash: void 0,
|
|
@@ -5827,27 +5836,27 @@ const oc = () => {
|
|
|
5827
5836
|
tokenAddress: O.address,
|
|
5828
5837
|
srcAmountWei: T
|
|
5829
5838
|
});
|
|
5830
|
-
let R = 0,
|
|
5831
|
-
b &&
|
|
5832
|
-
totalSteps:
|
|
5839
|
+
let R = 0, F = 1;
|
|
5840
|
+
b && F++, B && F++, f({
|
|
5841
|
+
totalSteps: F,
|
|
5833
5842
|
stepIndex: R,
|
|
5834
5843
|
allowanceLoading: !1,
|
|
5835
5844
|
hasApproval: !B,
|
|
5836
|
-
status:
|
|
5845
|
+
status: ve.LOADING
|
|
5837
5846
|
}), y();
|
|
5838
5847
|
let q = [];
|
|
5839
5848
|
b && q.push(yt.WRAP), B && q.push(yt.APPROVE), q.push(yt.CREATE), f({ pendingSteps: q }), b && (f({ step: yt.WRAP }), await o({
|
|
5840
|
-
onHash: (
|
|
5849
|
+
onHash: (Q) => f({ wrapTxHash: Q }),
|
|
5841
5850
|
srcAmountWei: T
|
|
5842
5851
|
}), R++, f({ stepIndex: R })), B && (f({ step: yt.APPROVE }), await a({
|
|
5843
5852
|
token: O,
|
|
5844
|
-
onHash: (
|
|
5853
|
+
onHash: (Q) => f({ approveTxHash: Q }),
|
|
5845
5854
|
srcAmountWei: T
|
|
5846
5855
|
}), R++, f({ stepIndex: R })), f({ step: yt.CREATE });
|
|
5847
|
-
const
|
|
5848
|
-
return f({ status:
|
|
5856
|
+
const _ = await u();
|
|
5857
|
+
return f({ status: ve.SUCCESS, orderId: _.id }), _;
|
|
5849
5858
|
} catch (O) {
|
|
5850
|
-
if (
|
|
5859
|
+
if (gs(O))
|
|
5851
5860
|
(S = r == null ? void 0 : r.onSubmitOrderRejected) == null || S.call(r), f({
|
|
5852
5861
|
step: void 0,
|
|
5853
5862
|
status: void 0,
|
|
@@ -5855,9 +5864,9 @@ const oc = () => {
|
|
|
5855
5864
|
error: O
|
|
5856
5865
|
});
|
|
5857
5866
|
else {
|
|
5858
|
-
const B =
|
|
5867
|
+
const B = cc(O);
|
|
5859
5868
|
(P = r == null ? void 0 : r.onSubmitOrderFailed) == null || P.call(r, B), f({
|
|
5860
|
-
status:
|
|
5869
|
+
status: ve.FAILED,
|
|
5861
5870
|
parsedError: B,
|
|
5862
5871
|
error: O
|
|
5863
5872
|
});
|
|
@@ -5866,12 +5875,12 @@ const oc = () => {
|
|
|
5866
5875
|
}
|
|
5867
5876
|
}
|
|
5868
5877
|
});
|
|
5869
|
-
},
|
|
5870
|
-
const e = In(), { srcToken: t, dstToken: n } = N(), r =
|
|
5878
|
+
}, dc = () => {
|
|
5879
|
+
const e = In(), { srcToken: t, dstToken: n } = N(), r = uc(), s = H((f) => f.resetState), a = ne(
|
|
5871
5880
|
() => r.mutateAsync(),
|
|
5872
5881
|
[r]
|
|
5873
5882
|
), { update: o, resetSwap: u, ...p } = e;
|
|
5874
|
-
return
|
|
5883
|
+
return k(() => ({
|
|
5875
5884
|
status: p.status,
|
|
5876
5885
|
parsedError: p.parsedError,
|
|
5877
5886
|
error: p.error,
|
|
@@ -5886,12 +5895,12 @@ const oc = () => {
|
|
|
5886
5895
|
onSubmit: a,
|
|
5887
5896
|
resetState: s,
|
|
5888
5897
|
resetCurrentSwap: u,
|
|
5889
|
-
isLoading: (e == null ? void 0 : e.status) ===
|
|
5890
|
-
isSuccess: (e == null ? void 0 : e.status) ===
|
|
5891
|
-
isFailed: (e == null ? void 0 : e.status) ===
|
|
5898
|
+
isLoading: (e == null ? void 0 : e.status) === ve.LOADING,
|
|
5899
|
+
isSuccess: (e == null ? void 0 : e.status) === ve.SUCCESS,
|
|
5900
|
+
isFailed: (e == null ? void 0 : e.status) === ve.FAILED,
|
|
5892
5901
|
confirmButtonLoading: p.allowanceLoading
|
|
5893
5902
|
}), [a, p, s, u, t, n]);
|
|
5894
|
-
},
|
|
5903
|
+
}, lc = () => {
|
|
5895
5904
|
const {
|
|
5896
5905
|
marketPrice: e,
|
|
5897
5906
|
srcToken: t,
|
|
@@ -5901,25 +5910,25 @@ const oc = () => {
|
|
|
5901
5910
|
srcUsd1Token: a,
|
|
5902
5911
|
noLiquidity: o,
|
|
5903
5912
|
typedInputAmount: u
|
|
5904
|
-
} = N(), p = r ||
|
|
5905
|
-
return
|
|
5913
|
+
} = N(), p = r || v(a || "0").isZero() || s === void 0 || v(e || "0").isZero(), f = !!(t && n && u && p), y = !!(ws() || o || f || v(u || "0").isZero() || !t || !n);
|
|
5914
|
+
return k(() => ({
|
|
5906
5915
|
disabled: y,
|
|
5907
5916
|
loading: f
|
|
5908
5917
|
}), [y, f]);
|
|
5909
|
-
},
|
|
5910
|
-
const { srcUsd1Token: e, dstUsd1Token: t } = N(), n = pt().amountUI, r = On().amountUI, s =
|
|
5918
|
+
}, pc = () => {
|
|
5919
|
+
const { srcUsd1Token: e, dstUsd1Token: t } = N(), n = pt().amountUI, r = On().amountUI, s = Qe(n, e), a = Qe(r, t);
|
|
5911
5920
|
return { srcAmountUsd: s, dstAmountUsd: a };
|
|
5912
|
-
},
|
|
5913
|
-
const { fees: e, dstToken: t, dstUsd1Token: n } = N(), { amountUI: r } = On(), s =
|
|
5921
|
+
}, fc = () => {
|
|
5922
|
+
const { fees: e, dstToken: t, dstUsd1Token: n } = N(), { amountUI: r } = On(), s = k(() => !e || !r ? "" : v(r).multipliedBy(e).dividedBy(100).toFixed(), [r, e]), a = fr((t == null ? void 0 : t.decimals) || 0, s);
|
|
5914
5923
|
return {
|
|
5915
5924
|
amountUI: s,
|
|
5916
5925
|
amount: a,
|
|
5917
5926
|
percent: e,
|
|
5918
|
-
usd:
|
|
5927
|
+
usd: Qe(s, n)
|
|
5919
5928
|
};
|
|
5920
|
-
},
|
|
5921
|
-
const t =
|
|
5922
|
-
return
|
|
5929
|
+
}, hc = (e) => {
|
|
5930
|
+
const t = k(() => !e.minDestAmountPerTrade || !e.totalTrades ? "" : v(e.minDestAmountPerTrade).multipliedBy(e.totalTrades).decimalPlaces(0).toFixed(), [e.minDestAmountPerTrade, e.totalTrades]), n = k(() => !e.minDestAmountPerTradeUI || !e.totalTrades ? "" : v(e.minDestAmountPerTradeUI).multipliedBy(e.totalTrades).toFixed(), [e.minDestAmountPerTradeUI, e.totalTrades]), r = k(() => !e.minDestAmountPerTradeUsd || !e.totalTrades ? "" : v(e.minDestAmountPerTradeUsd).multipliedBy(e.totalTrades).decimalPlaces(2).toFixed(), [e.minDestAmountPerTradeUsd, e.totalTrades]);
|
|
5931
|
+
return k(() => ({
|
|
5923
5932
|
srcToken: e.srcToken,
|
|
5924
5933
|
dstToken: e.dstToken,
|
|
5925
5934
|
orderType: e.orderType,
|
|
@@ -5980,13 +5989,13 @@ const oc = () => {
|
|
|
5980
5989
|
e.triggerPriceUI,
|
|
5981
5990
|
e.triggerPriceUsd
|
|
5982
5991
|
]);
|
|
5983
|
-
},
|
|
5992
|
+
}, mc = () => {
|
|
5984
5993
|
const { config: e } = N();
|
|
5985
|
-
return
|
|
5994
|
+
return k(() => ({
|
|
5986
5995
|
spender: e.repermit
|
|
5987
5996
|
}), [e]);
|
|
5988
|
-
},
|
|
5989
|
-
const { srcToken: e, dstToken: t, account: n, marketPrice: r } = N(), { spender: s } =
|
|
5997
|
+
}, yc = () => {
|
|
5998
|
+
const { srcToken: e, dstToken: t, account: n, marketPrice: r } = N(), { spender: s } = mc(), { amount: a } = pt(), {
|
|
5990
5999
|
amount: o,
|
|
5991
6000
|
amountUI: u,
|
|
5992
6001
|
usd: p
|
|
@@ -6001,9 +6010,9 @@ const oc = () => {
|
|
|
6001
6010
|
usd: B
|
|
6002
6011
|
} = gr(), {
|
|
6003
6012
|
amountUI: R,
|
|
6004
|
-
amount:
|
|
6013
|
+
amount: F,
|
|
6005
6014
|
usd: q
|
|
6006
|
-
} = Bt(), { milliseconds:
|
|
6015
|
+
} = Bt(), { milliseconds: _ } = Gt(), { amount: Q, amountUI: $ } = On(), { srcAmountUsd: ie, dstAmountUsd: i } = pc(), { amount: c, amountUI: d, percent: E, usd: m } = fc(), g = Us(), w = H((j) => j.state.isMarketOrder), h = H((j) => j.state.currentTime), A = In(), C = Go(), x = A.acceptedSrcAmount || a, D = Fe(r, (t == null ? void 0 : t.decimals) || 0), U = k(() => C === X.TAKE_PROFIT_MARKET || C === X.TAKE_PROFIT_LIMIT || C === X.STOP_LOSS_LIMIT || C === X.STOP_LOSS_MARKET, [C]), M = hc({
|
|
6007
6016
|
srcToken: e,
|
|
6008
6017
|
dstToken: t,
|
|
6009
6018
|
account: n,
|
|
@@ -6011,11 +6020,11 @@ const oc = () => {
|
|
|
6011
6020
|
createdAt: h,
|
|
6012
6021
|
deadline: S,
|
|
6013
6022
|
totalTrades: b,
|
|
6014
|
-
tradeInterval:
|
|
6023
|
+
tradeInterval: _,
|
|
6015
6024
|
srcAmount: x,
|
|
6016
|
-
srcAmountUI:
|
|
6025
|
+
srcAmountUI: Fe(x, (e == null ? void 0 : e.decimals) || 0),
|
|
6017
6026
|
srcAmountUsd: ie,
|
|
6018
|
-
dstAmount:
|
|
6027
|
+
dstAmount: Q,
|
|
6019
6028
|
dstAmountUI: $,
|
|
6020
6029
|
dstAmountUsd: i,
|
|
6021
6030
|
limitPrice: w ? void 0 : o,
|
|
@@ -6027,11 +6036,11 @@ const oc = () => {
|
|
|
6027
6036
|
minDestAmountPerTrade: P,
|
|
6028
6037
|
minDestAmountPerTradeUI: O,
|
|
6029
6038
|
minDestAmountPerTradeUsd: B,
|
|
6030
|
-
triggerPrice:
|
|
6039
|
+
triggerPrice: F,
|
|
6031
6040
|
triggerPriceUI: R,
|
|
6032
6041
|
triggerPriceUsd: q
|
|
6033
6042
|
});
|
|
6034
|
-
return
|
|
6043
|
+
return k(() => ({
|
|
6035
6044
|
...M,
|
|
6036
6045
|
feesAmountUI: d,
|
|
6037
6046
|
feesAmount: c,
|
|
@@ -6056,15 +6065,15 @@ const oc = () => {
|
|
|
6056
6065
|
D,
|
|
6057
6066
|
s
|
|
6058
6067
|
]);
|
|
6059
|
-
},
|
|
6068
|
+
}, gc = () => {
|
|
6060
6069
|
const { supportedChains: e } = N();
|
|
6061
|
-
return
|
|
6062
|
-
},
|
|
6070
|
+
return k(() => e, [e]);
|
|
6071
|
+
}, Ac = 60, Ls = () => {
|
|
6063
6072
|
const { refetch: e } = Cr();
|
|
6064
6073
|
return ft({
|
|
6065
6074
|
mutationFn: async (t) => {
|
|
6066
6075
|
var n;
|
|
6067
|
-
for (let r = 0; r <
|
|
6076
|
+
for (let r = 0; r < Ac; r++) {
|
|
6068
6077
|
const s = (n = await e()) == null ? void 0 : n.data;
|
|
6069
6078
|
if (!s)
|
|
6070
6079
|
throw new Error("orders not found");
|
|
@@ -6078,7 +6087,7 @@ const oc = () => {
|
|
|
6078
6087
|
);
|
|
6079
6088
|
}
|
|
6080
6089
|
});
|
|
6081
|
-
},
|
|
6090
|
+
}, Ec = () => {
|
|
6082
6091
|
const e = H((n) => n.updateState), t = H((n) => n.state.cancelOrders);
|
|
6083
6092
|
return {
|
|
6084
6093
|
cancelOrders: t,
|
|
@@ -6092,12 +6101,12 @@ const oc = () => {
|
|
|
6092
6101
|
e({ cancelOrders: s });
|
|
6093
6102
|
}
|
|
6094
6103
|
};
|
|
6095
|
-
},
|
|
6096
|
-
const { account: t, walletInteractions: n, config: r, callbacks: s, chainId: a } = N(), o =
|
|
6104
|
+
}, Hc = (e) => {
|
|
6105
|
+
const { account: t, walletInteractions: n, config: r, callbacks: s, chainId: a } = N(), o = Ls().mutateAsync, u = Xo(), {
|
|
6097
6106
|
cancelOrders: p,
|
|
6098
6107
|
setCancelOrder: f,
|
|
6099
6108
|
clearCancelOrder: T
|
|
6100
|
-
} =
|
|
6109
|
+
} = Ec(), { mutateAsync: y } = ft({
|
|
6101
6110
|
mutationFn: async () => {
|
|
6102
6111
|
var O, B, R;
|
|
6103
6112
|
if (!t || !n || !r)
|
|
@@ -6106,44 +6115,44 @@ const oc = () => {
|
|
|
6106
6115
|
throw new Error("order is required");
|
|
6107
6116
|
const P = e.id;
|
|
6108
6117
|
try {
|
|
6109
|
-
(O = s == null ? void 0 : s.onCancelOrderRequest) == null || O.call(s, e), f(P, { status:
|
|
6118
|
+
(O = s == null ? void 0 : s.onCancelOrderRequest) == null || O.call(s, e), f(P, { status: ve.LOADING }), pe.onCancelOrderRequest(
|
|
6110
6119
|
[e.version === 1 ? e.id.toString() : e.hash],
|
|
6111
6120
|
e.version
|
|
6112
6121
|
);
|
|
6113
|
-
const
|
|
6122
|
+
const F = await n.cancelOrder({
|
|
6114
6123
|
order: e,
|
|
6115
6124
|
contractAddress: e.version === 1 ? e.twapAddress : r.repermit,
|
|
6116
6125
|
args: e.version === 1 ? [e.id] : [[e.repermitDigest]],
|
|
6117
|
-
abi: e.version === 1 ?
|
|
6126
|
+
abi: e.version === 1 ? pa : la
|
|
6118
6127
|
});
|
|
6119
|
-
if (!
|
|
6120
|
-
return pe.onCancelOrderSuccess(
|
|
6128
|
+
if (!F) throw new Error("failed to cancel order");
|
|
6129
|
+
return pe.onCancelOrderSuccess(F), e.version === 1 ? u(e.id, le.Cancelled) : await o(e.id), (B = s == null ? void 0 : s.onCancelOrderSuccess) == null || B.call(s, {
|
|
6121
6130
|
order: e.version === 1 ? { ...e, status: le.Cancelled } : e,
|
|
6122
|
-
txHash:
|
|
6123
|
-
explorerUrl: cn(
|
|
6124
|
-
}), f(P, { status:
|
|
6125
|
-
} catch (
|
|
6126
|
-
console.error("cancel order error",
|
|
6127
|
-
status:
|
|
6128
|
-
error:
|
|
6129
|
-
}), pe.onCancelOrderError(
|
|
6131
|
+
txHash: F,
|
|
6132
|
+
explorerUrl: cn(F, a)
|
|
6133
|
+
}), f(P, { status: ve.SUCCESS, txHash: F }), F;
|
|
6134
|
+
} catch (F) {
|
|
6135
|
+
console.error("cancel order error", F), (R = s == null ? void 0 : s.onCancelOrderFailed) == null || R.call(s, F), gs(F) ? T(P) : (f(P, {
|
|
6136
|
+
status: ve.FAILED,
|
|
6137
|
+
error: F.message
|
|
6138
|
+
}), pe.onCancelOrderError(F));
|
|
6130
6139
|
}
|
|
6131
6140
|
}
|
|
6132
|
-
}), b =
|
|
6141
|
+
}), b = k(() => {
|
|
6133
6142
|
const P = p[(e == null ? void 0 : e.id) || ""];
|
|
6134
6143
|
return {
|
|
6135
|
-
isLoading: (P == null ? void 0 : P.status) ===
|
|
6136
|
-
isSuccess: (P == null ? void 0 : P.status) ===
|
|
6137
|
-
isError: (P == null ? void 0 : P.status) ===
|
|
6144
|
+
isLoading: (P == null ? void 0 : P.status) === ve.LOADING,
|
|
6145
|
+
isSuccess: (P == null ? void 0 : P.status) === ve.SUCCESS,
|
|
6146
|
+
isError: (P == null ? void 0 : P.status) === ve.FAILED,
|
|
6138
6147
|
error: P == null ? void 0 : P.error,
|
|
6139
6148
|
txHash: P == null ? void 0 : P.txHash
|
|
6140
6149
|
};
|
|
6141
6150
|
}, [p, e == null ? void 0 : e.id]), S = ne(async () => y(), [y]);
|
|
6142
|
-
return
|
|
6143
|
-
},
|
|
6151
|
+
return k(() => ({ cancelOrder: S, ...b }), [S, b]);
|
|
6152
|
+
}, Ns = cr(null), bc = ({
|
|
6144
6153
|
children: e
|
|
6145
6154
|
}) => {
|
|
6146
|
-
const t =
|
|
6155
|
+
const t = Xi(), n = eo(), r = Yi(), s = io(), a = oo(), o = Dn(), u = co(), p = uo(), f = ws(), T = lc(), y = yc(), b = nc(), S = dc(), P = gc(), O = Ls(), { module: B } = N(), R = {
|
|
6147
6156
|
tradesAmountPanel: t,
|
|
6148
6157
|
durationPanel: n,
|
|
6149
6158
|
fillDelayPanel: r,
|
|
@@ -6161,17 +6170,17 @@ const oc = () => {
|
|
|
6161
6170
|
refetchUntilStatusSynced: O,
|
|
6162
6171
|
module: B
|
|
6163
6172
|
};
|
|
6164
|
-
return /* @__PURE__ */
|
|
6165
|
-
},
|
|
6166
|
-
const e = ss(
|
|
6173
|
+
return /* @__PURE__ */ Ne(Ns.Provider, { value: R, children: e });
|
|
6174
|
+
}, Wc = () => {
|
|
6175
|
+
const e = ss(Ns);
|
|
6167
6176
|
if (e === null)
|
|
6168
6177
|
throw new Error("useSpot must be used within SpotProvider");
|
|
6169
6178
|
return e;
|
|
6170
|
-
},
|
|
6179
|
+
}, xc = cr(null), Kn = {
|
|
6171
6180
|
didCatch: !1,
|
|
6172
6181
|
error: null
|
|
6173
6182
|
};
|
|
6174
|
-
class
|
|
6183
|
+
class Cc extends Qs {
|
|
6175
6184
|
constructor(t) {
|
|
6176
6185
|
super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = Kn;
|
|
6177
6186
|
}
|
|
@@ -6204,7 +6213,7 @@ class bc extends Qs {
|
|
|
6204
6213
|
} = this.state, {
|
|
6205
6214
|
resetKeys: s
|
|
6206
6215
|
} = this.props;
|
|
6207
|
-
if (r && n.error !== null &&
|
|
6216
|
+
if (r && n.error !== null && Tc(t.resetKeys, s)) {
|
|
6208
6217
|
var a, o;
|
|
6209
6218
|
(a = (o = this.props).onReset) === null || a === void 0 || a.call(o, {
|
|
6210
6219
|
next: s,
|
|
@@ -6232,13 +6241,13 @@ class bc extends Qs {
|
|
|
6232
6241
|
if (typeof n == "function")
|
|
6233
6242
|
u = n(p);
|
|
6234
6243
|
else if (r)
|
|
6235
|
-
u =
|
|
6244
|
+
u = Fr(r, p);
|
|
6236
6245
|
else if (s !== void 0)
|
|
6237
6246
|
u = s;
|
|
6238
6247
|
else
|
|
6239
6248
|
throw o;
|
|
6240
6249
|
}
|
|
6241
|
-
return
|
|
6250
|
+
return Fr(xc.Provider, {
|
|
6242
6251
|
value: {
|
|
6243
6252
|
didCatch: a,
|
|
6244
6253
|
error: o,
|
|
@@ -6247,11 +6256,11 @@ class bc extends Qs {
|
|
|
6247
6256
|
}, u);
|
|
6248
6257
|
}
|
|
6249
6258
|
}
|
|
6250
|
-
function
|
|
6259
|
+
function Tc() {
|
|
6251
6260
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
6252
6261
|
return e.length !== t.length || e.some((n, r) => !Object.is(n, t[r]));
|
|
6253
6262
|
}
|
|
6254
|
-
const
|
|
6263
|
+
const wc = () => /* @__PURE__ */ Ne("div", { className: "twap-error-fallback", children: /* @__PURE__ */ Ne(
|
|
6255
6264
|
"p",
|
|
6256
6265
|
{
|
|
6257
6266
|
style: {
|
|
@@ -6264,23 +6273,23 @@ const Cc = () => /* @__PURE__ */ Le("div", { className: "twap-error-fallback", c
|
|
|
6264
6273
|
children: "Something went wrong"
|
|
6265
6274
|
}
|
|
6266
6275
|
) });
|
|
6267
|
-
function
|
|
6268
|
-
return /* @__PURE__ */
|
|
6269
|
-
|
|
6276
|
+
function Fc({ children: e }) {
|
|
6277
|
+
return /* @__PURE__ */ Ne(
|
|
6278
|
+
Cc,
|
|
6270
6279
|
{
|
|
6271
|
-
FallbackComponent:
|
|
6280
|
+
FallbackComponent: wc,
|
|
6272
6281
|
onError: (t) => pe.onCrash(t),
|
|
6273
|
-
children: /* @__PURE__ */
|
|
6282
|
+
children: /* @__PURE__ */ Ne(zs, { children: e })
|
|
6274
6283
|
}
|
|
6275
6284
|
);
|
|
6276
6285
|
}
|
|
6277
|
-
const
|
|
6286
|
+
const qs = cr(null), vc = new _o({
|
|
6278
6287
|
defaultOptions: {
|
|
6279
6288
|
queries: {
|
|
6280
6289
|
refetchOnWindowFocus: !1
|
|
6281
6290
|
}
|
|
6282
6291
|
}
|
|
6283
|
-
}),
|
|
6292
|
+
}), Sc = (e) => {
|
|
6284
6293
|
var r, s, a;
|
|
6285
6294
|
const t = H((o) => o.updateState), n = H((o) => o.state.isMarketOrder);
|
|
6286
6295
|
return mt(() => {
|
|
@@ -6289,16 +6298,16 @@ const Ns = cr(null), wc = new Bo({
|
|
|
6289
6298
|
}, 6e4);
|
|
6290
6299
|
return () => clearInterval(o);
|
|
6291
6300
|
}, [t]), mt(() => {
|
|
6292
|
-
var u, p, f, T, y, b, S, P, O, B, R,
|
|
6301
|
+
var u, p, f, T, y, b, S, P, O, B, R, F, q, _, Q, $;
|
|
6293
6302
|
const o = (p = (u = e.overrides) == null ? void 0 : u.state) == null ? void 0 : p.isMarketOrder;
|
|
6294
6303
|
o !== void 0 && t({ isMarketOrder: o }), t({
|
|
6295
6304
|
typedChunks: (T = (f = e.overrides) == null ? void 0 : f.state) == null ? void 0 : T.chunks,
|
|
6296
6305
|
typedFillDelay: (b = (y = e.overrides) == null ? void 0 : y.state) == null ? void 0 : b.fillDelay,
|
|
6297
6306
|
typedDuration: (P = (S = e.overrides) == null ? void 0 : S.state) == null ? void 0 : P.duration,
|
|
6298
6307
|
typedLimitPrice: (B = (O = e.overrides) == null ? void 0 : O.state) == null ? void 0 : B.limitPrice,
|
|
6299
|
-
typedTriggerPrice: (
|
|
6300
|
-
triggerPricePercent: (
|
|
6301
|
-
limitPricePercent: ($ = (
|
|
6308
|
+
typedTriggerPrice: (F = (R = e.overrides) == null ? void 0 : R.state) == null ? void 0 : F.triggerPrice,
|
|
6309
|
+
triggerPricePercent: (_ = (q = e.overrides) == null ? void 0 : q.state) == null ? void 0 : _.triggerPricePercent,
|
|
6310
|
+
limitPricePercent: ($ = (Q = e.overrides) == null ? void 0 : Q.state) == null ? void 0 : $.limitPricePercent
|
|
6302
6311
|
});
|
|
6303
6312
|
}, [(r = e.overrides) == null ? void 0 : r.state, e.module]), mt(() => {
|
|
6304
6313
|
var o, u, p, f;
|
|
@@ -6315,44 +6324,44 @@ const Ns = cr(null), wc = new Bo({
|
|
|
6315
6324
|
}, [n]), mt(() => {
|
|
6316
6325
|
t({ typedChunks: void 0 });
|
|
6317
6326
|
}, [e.typedInputAmount]), null;
|
|
6318
|
-
},
|
|
6327
|
+
}, Dc = ({
|
|
6319
6328
|
marketReferencePrice: e,
|
|
6320
6329
|
srcToken: t,
|
|
6321
6330
|
dstToken: n,
|
|
6322
6331
|
chainId: r,
|
|
6323
6332
|
typedInputAmount: s
|
|
6324
|
-
}) =>
|
|
6325
|
-
if (
|
|
6333
|
+
}) => k(() => {
|
|
6334
|
+
if (Es(t, n, r) || bs(t, n, r))
|
|
6326
6335
|
return {
|
|
6327
6336
|
isLoading: !1,
|
|
6328
6337
|
noLiquidity: !1,
|
|
6329
6338
|
value: Dt(s || "0", t == null ? void 0 : t.decimals)
|
|
6330
6339
|
};
|
|
6331
|
-
if (
|
|
6340
|
+
if (v(e.value || 0).isZero() || v(s || 0).isZero())
|
|
6332
6341
|
return e;
|
|
6333
|
-
const a =
|
|
6342
|
+
const a = v(e.value || 0).dividedBy(s || 0).decimalPlaces(0).toFixed();
|
|
6334
6343
|
return {
|
|
6335
6344
|
...e,
|
|
6336
6345
|
value: a
|
|
6337
6346
|
};
|
|
6338
|
-
}, [e, s, t, n, r]),
|
|
6339
|
-
const t = In(), n =
|
|
6340
|
-
() =>
|
|
6347
|
+
}, [e, s, t, n, r]), Pc = (e) => {
|
|
6348
|
+
const t = In(), n = k(
|
|
6349
|
+
() => Ma(e.partner),
|
|
6341
6350
|
[e.partner]
|
|
6342
|
-
), r =
|
|
6351
|
+
), r = k(() => {
|
|
6343
6352
|
const u = n[0];
|
|
6344
6353
|
return e.chainId && n.includes(e.chainId) ? e.chainId : u;
|
|
6345
|
-
}, [e.chainId, n]), s =
|
|
6346
|
-
() =>
|
|
6354
|
+
}, [e.chainId, n]), s = k(
|
|
6355
|
+
() => fs(e.partner, r),
|
|
6347
6356
|
[e.partner, r]
|
|
6348
|
-
), a =
|
|
6349
|
-
() =>
|
|
6357
|
+
), a = Dc(e), o = k(
|
|
6358
|
+
() => ci(e.minChunkSizeUsd),
|
|
6350
6359
|
[e.minChunkSizeUsd]
|
|
6351
6360
|
);
|
|
6352
6361
|
return mt(() => {
|
|
6353
6362
|
pe.init(s, o, r, e.appId);
|
|
6354
|
-
}, [s, r, o, e.appId]), /* @__PURE__ */
|
|
6355
|
-
|
|
6363
|
+
}, [s, r, o, e.appId]), /* @__PURE__ */ Ws(
|
|
6364
|
+
qs.Provider,
|
|
6356
6365
|
{
|
|
6357
6366
|
value: {
|
|
6358
6367
|
typedInputAmount: e.typedInputAmount,
|
|
@@ -6380,24 +6389,24 @@ const Ns = cr(null), wc = new Bo({
|
|
|
6380
6389
|
isDev: e.isDev
|
|
6381
6390
|
},
|
|
6382
6391
|
children: [
|
|
6383
|
-
/* @__PURE__ */
|
|
6384
|
-
/* @__PURE__ */
|
|
6392
|
+
/* @__PURE__ */ Ne(Sc, { ...e }),
|
|
6393
|
+
/* @__PURE__ */ Ne(bc, { children: /* @__PURE__ */ Ne(Fc, { children: e.children }) })
|
|
6385
6394
|
]
|
|
6386
6395
|
}
|
|
6387
6396
|
);
|
|
6388
|
-
},
|
|
6389
|
-
const e = ss(
|
|
6397
|
+
}, zc = (e) => /* @__PURE__ */ Ne(ko, { client: vc, children: /* @__PURE__ */ Ne(Pc, { ...e }) }), N = () => {
|
|
6398
|
+
const e = ss(qs);
|
|
6390
6399
|
if (e === null)
|
|
6391
6400
|
throw new Error("useSpotContext must be used within SpotProvider");
|
|
6392
6401
|
return e;
|
|
6393
|
-
},
|
|
6402
|
+
}, Oc = (e, t, n) => {
|
|
6394
6403
|
const r = hr();
|
|
6395
|
-
return
|
|
6404
|
+
return k(() => e == null ? void 0 : e.map((s) => ({
|
|
6396
6405
|
rawFill: s,
|
|
6397
6406
|
srcToken: t,
|
|
6398
6407
|
dstToken: n,
|
|
6399
|
-
srcAmount:
|
|
6400
|
-
dstAmount:
|
|
6408
|
+
srcAmount: Fe(s.inAmount, t == null ? void 0 : t.decimals),
|
|
6409
|
+
dstAmount: Fe(s.outAmount, n == null ? void 0 : n.decimals),
|
|
6401
6410
|
timestamp: s.timestamp,
|
|
6402
6411
|
txHash: s.txHash,
|
|
6403
6412
|
explorerUrl: cn(s.txHash, r == null ? void 0 : r.id),
|
|
@@ -6410,9 +6419,9 @@ const Ns = cr(null), wc = new Bo({
|
|
|
6410
6419
|
})).filter(
|
|
6411
6420
|
(s) => s.srcToken !== void 0 && s.dstToken !== void 0
|
|
6412
6421
|
), [e, t, n, r]);
|
|
6413
|
-
},
|
|
6414
|
-
const { config: r } = N(), s =
|
|
6415
|
-
return
|
|
6422
|
+
}, Qc = (e, t, n) => {
|
|
6423
|
+
const { config: r } = N(), s = Jo(t, n, e), a = ec(t, n, e), o = tc(t, n, e), u = k(() => e ? e.version === 2 ? e.fillDelay : r.twapConfig ? ds(e, r.twapConfig) : 0 : 0, [e, r]), p = Oc(e == null ? void 0 : e.fills, t, n) ?? [];
|
|
6424
|
+
return k(() => {
|
|
6416
6425
|
if (e != null && e.id)
|
|
6417
6426
|
return {
|
|
6418
6427
|
original: e,
|
|
@@ -6426,25 +6435,25 @@ const Ns = cr(null), wc = new Bo({
|
|
|
6426
6435
|
tradeInterval: u,
|
|
6427
6436
|
recipient: e.maker || "",
|
|
6428
6437
|
srcAmount: e.srcAmount || "",
|
|
6429
|
-
srcAmountUI:
|
|
6438
|
+
srcAmountUI: Fe(e.srcAmount, t == null ? void 0 : t.decimals),
|
|
6430
6439
|
limitPrice: Dt(s, n == null ? void 0 : n.decimals),
|
|
6431
6440
|
limitPriceUI: s || "",
|
|
6432
6441
|
sizePerTrade: e.srcAmountPerTrade || "",
|
|
6433
|
-
sizePerTradeUI:
|
|
6442
|
+
sizePerTradeUI: Fe(e.srcAmountPerTrade, t == null ? void 0 : t.decimals),
|
|
6434
6443
|
minDestAmountPerTrade: e.dstMinAmountPerTrade || "",
|
|
6435
|
-
minDestAmountPerTradeUI:
|
|
6444
|
+
minDestAmountPerTradeUI: Fe(
|
|
6436
6445
|
e.dstMinAmountPerTrade,
|
|
6437
6446
|
n == null ? void 0 : n.decimals
|
|
6438
6447
|
),
|
|
6439
6448
|
dstMinAmount: e.dstMinAmountTotal,
|
|
6440
|
-
dstMinAmountUI:
|
|
6449
|
+
dstMinAmountUI: Fe(e.dstMinAmountTotal, n == null ? void 0 : n.decimals),
|
|
6441
6450
|
triggerPrice: Dt(a, n == null ? void 0 : n.decimals),
|
|
6442
6451
|
triggerPriceUI: a || "",
|
|
6443
6452
|
id: e.id,
|
|
6444
6453
|
amountInFilled: e.srcAmountFilled,
|
|
6445
|
-
amountInFilledUI:
|
|
6454
|
+
amountInFilledUI: Fe(e.srcAmountFilled, t == null ? void 0 : t.decimals),
|
|
6446
6455
|
amountOutFilled: e.dstAmountFilled,
|
|
6447
|
-
amountOutFilledUI:
|
|
6456
|
+
amountOutFilledUI: Fe(e.dstAmountFilled, n == null ? void 0 : n.decimals),
|
|
6448
6457
|
progress: e.progress,
|
|
6449
6458
|
executionPrice: Dt(o, n == null ? void 0 : n.decimals),
|
|
6450
6459
|
executionPriceUI: o,
|
|
@@ -6461,57 +6470,57 @@ const Ns = cr(null), wc = new Bo({
|
|
|
6461
6470
|
o
|
|
6462
6471
|
]);
|
|
6463
6472
|
};
|
|
6464
|
-
|
|
6473
|
+
hi(qi.version);
|
|
6465
6474
|
export {
|
|
6466
|
-
|
|
6475
|
+
Lc as DISCLAIMER_URL,
|
|
6467
6476
|
bn as Disclaimer,
|
|
6468
6477
|
me as InputErrors,
|
|
6469
6478
|
V as Module,
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6479
|
+
Uc as ORBS_LOGO,
|
|
6480
|
+
kc as ORBS_SLTP_FAQ_URL,
|
|
6481
|
+
_c as ORBS_TWAP_FAQ_URL,
|
|
6482
|
+
Mc as ORBS_WEBSITE_URL,
|
|
6483
|
+
fa as OrderFilter,
|
|
6475
6484
|
le as OrderStatus,
|
|
6476
6485
|
X as OrderType,
|
|
6477
|
-
|
|
6486
|
+
ke as Partners,
|
|
6478
6487
|
dr as SPOT_VERSION,
|
|
6479
|
-
|
|
6488
|
+
zc as SpotProvider,
|
|
6480
6489
|
yt as Steps,
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6490
|
+
ve as SwapStatus,
|
|
6491
|
+
Le as TimeUnit,
|
|
6492
|
+
li as buildRePermitOrderData,
|
|
6493
|
+
Qi as ensureWrappedToken,
|
|
6485
6494
|
$t as eqIgnoreCase,
|
|
6486
|
-
|
|
6495
|
+
fs as getConfig,
|
|
6487
6496
|
cn as getExplorerUrl,
|
|
6488
|
-
|
|
6497
|
+
ci as getMinChunkSizeUsd,
|
|
6489
6498
|
Vt as getNetwork,
|
|
6490
6499
|
ls as getOrderExecutionRate,
|
|
6491
6500
|
ds as getOrderFillDelayMillis,
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6501
|
+
La as getOrderLimitPriceRate,
|
|
6502
|
+
qc as getOrderType,
|
|
6503
|
+
Ma as getPartnerChains,
|
|
6504
|
+
oi as getPartners,
|
|
6505
|
+
Na as getTriggerPriceRate,
|
|
6497
6506
|
on as isNativeAddress,
|
|
6498
|
-
|
|
6499
|
-
|
|
6507
|
+
gs as isTxRejected,
|
|
6508
|
+
As as millisToDays,
|
|
6500
6509
|
$n as millisToMinutes,
|
|
6501
6510
|
ge as networks,
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6511
|
+
Nc as parseError,
|
|
6512
|
+
bs as shouldUnwrapOnly,
|
|
6513
|
+
Es as shouldWrapOnly,
|
|
6514
|
+
Si as submitOrder,
|
|
6515
|
+
Fe as toAmountUi,
|
|
6507
6516
|
Dt as toAmountWei,
|
|
6508
6517
|
jt as useAmountUi,
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6518
|
+
Hc as useCancelOrder,
|
|
6519
|
+
Qc as useDerivedHistoryOrder,
|
|
6520
|
+
Kc as useExplorerLink,
|
|
6512
6521
|
hr as useNetwork,
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6522
|
+
ac as useSignOrder,
|
|
6523
|
+
Wc as useSpot,
|
|
6524
|
+
uc as useSubmitOrder,
|
|
6516
6525
|
In as useSwapExecution
|
|
6517
6526
|
};
|