@thorswap-lib/swapkit-entities
Advanced tools
Comparing version 1.0.0-rc.31 to 1.0.0-rc.32
var Ge = Object.defineProperty; | ||
var Ve = (t, s, f) => s in t ? Ge(t, s, { enumerable: !0, configurable: !0, writable: !0, value: f }) : t[s] = f; | ||
var P = (t, s, f) => (Ve(t, typeof s != "symbol" ? s + "" : s, f), f); | ||
var m = /* @__PURE__ */ ((t) => (t.INVALID_INPUT_PARAMETERS = "1000", t.UNKNOWN_PROVIDERS = "1001", t.CANNOT_FIND_INBOUND_ADDRESS = "1002", t.NO_INBOUND_ADDRESSES = "1003", t.CHAIN_HALTED_OR_UNSUPPORTED = "1004", t.MISSING_INPUT_PARAMETER = "1005", t.INVALID_TYPE_GENERIC = "1100", t.INVALID_NUMBER_STRING = "1101", t.INVALID_NUMBER = "1102", t.INVALID_BOOLEAN = "1103", t.INVALID_OBJECT = "1104", t.INVALID_ARRAY = "1105", t.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", t.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", t.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", t.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", t.AFF_ADDRESS_TOO_LONG = "2004", t.AFF_BPS_INTEGER_MAX_500 = "2005", t.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", t.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", t.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", t.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", t.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", t.SOURCE_ADDRESS_SMART_CONTRACT = "2011", t.INVALID_PROVIDER = "2100", t.MISSING_CROSS_CHAIN_PROVIDER = "2101", t.MISSING_AVAX_PROVIDER = "2102", t.MISSING_BSC_PROVIDER = "2103", t.MISSING_ETH_PROVIDER = "2104", t.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", t.MISSING_ARB_PROVIDER = "2106", t.INVALID_CHAIN = "2200", t.INVALID_ASSET = "2201", t.INVALID_ASSET_IDENTIFIER = "2202", t.UNSUPPORTED_CHAIN = "2204", t.UNSUPPORTED_ASSET = "2203", t.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", t.INVALID_SOURCE_ADDRESS = "2300", t.INVALID_DESTINATION_ADDRESS = "2301", t.THORNODE_QUOTE_GENERIC_ERROR = "3000", t.NOT_ENOUGH_SYNTH_BALANCE = "3001", t.SYNTH_MINTING_CAP_REACHED = "3002", t.INVALID_QUOTE_MODE = "4000", t.NO_QUOTES = "4001", t.SERVICE_UNAVAILABLE_GENERIC = "5000", t.MISSING_GAS_DATA_GENERIC = "5100", t.MISSING_TOKEN_INFO_GENERIC = "5200", t.CANT_FIND_TOKEN_LIST = "5201", t.NO_PRICE = "5202", t.PRICE_IS_STALE = "5203", t.ADDRESS_NOT_WHITELISTED = "6000", t.ADDRESS_ALREADY_CLAIMED = "6001", t.TEMPORARY_ERROR = "9999", t))(m || {}); | ||
m.INVALID_INPUT_PARAMETERS + "", m.UNKNOWN_PROVIDERS + "", m.CANNOT_FIND_INBOUND_ADDRESS + "", m.NO_INBOUND_ADDRESSES + "", m.CHAIN_HALTED_OR_UNSUPPORTED + "", m.MISSING_INPUT_PARAMETER + "", m.INVALID_TYPE_GENERIC + "", m.INVALID_NUMBER_STRING + "", m.INVALID_NUMBER + "", m.INVALID_BOOLEAN + "", m.INVALID_OBJECT + "", m.INVALID_ARRAY + "", m.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", m.SELL_BUY_ASSETS_ARE_THE_SAME + "", m.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", m.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", m.AFF_ADDRESS_TOO_LONG + "", m.AFF_BPS_INTEGER_MAX_500 + "", m.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", m.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", m.PREFERRED_PROVIDER_NOT_SUPPORTED + "", m.DESTINATION_ADDRESS_SMART_CONTRACT + "", m.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", m.INVALID_PROVIDER + "", m.MISSING_CROSS_CHAIN_PROVIDER + "", m.MISSING_AVAX_PROVIDER + "", m.MISSING_BSC_PROVIDER + "", m.MISSING_ETH_PROVIDER + "", m.MISSING_ARB_PROVIDER + "", m.INVALID_PROVIDER_FOR_SWAP_OUT + "", m.INVALID_CHAIN + "", m.INVALID_ASSET + "", m.UNSUPPORTED_CHAIN + "", m.UNSUPPORTED_ASSET + "", m.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", m.THORNODE_QUOTE_GENERIC_ERROR + "", m.INVALID_SOURCE_ADDRESS + "", m.INVALID_DESTINATION_ADDRESS + "", m.NOT_ENOUGH_SYNTH_BALANCE + "", m.SYNTH_MINTING_CAP_REACHED + "", m.INVALID_QUOTE_MODE + "", m.NO_QUOTES + "", m.SERVICE_UNAVAILABLE_GENERIC + "", m.MISSING_GAS_DATA_GENERIC + "", m.MISSING_TOKEN_INFO_GENERIC + "", m.CANT_FIND_TOKEN_LIST + "", m.NO_PRICE + "", m.PRICE_IS_STALE + "", m.ADDRESS_NOT_WHITELISTED + "", m.ADDRESS_ALREADY_CLAIMED + ""; | ||
var R = /* @__PURE__ */ ((t) => (t.INVALID_INPUT_PARAMETERS = "1000", t.UNKNOWN_PROVIDERS = "1001", t.CANNOT_FIND_INBOUND_ADDRESS = "1002", t.NO_INBOUND_ADDRESSES = "1003", t.CHAIN_HALTED_OR_UNSUPPORTED = "1004", t.MISSING_INPUT_PARAMETER = "1005", t.INVALID_TYPE_GENERIC = "1100", t.INVALID_NUMBER_STRING = "1101", t.INVALID_NUMBER = "1102", t.INVALID_BOOLEAN = "1103", t.INVALID_OBJECT = "1104", t.INVALID_ARRAY = "1105", t.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", t.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", t.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", t.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", t.AFF_ADDRESS_TOO_LONG = "2004", t.AFF_BPS_INTEGER_MAX_500 = "2005", t.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", t.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", t.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", t.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", t.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", t.SOURCE_ADDRESS_SMART_CONTRACT = "2011", t.INVALID_PROVIDER = "2100", t.MISSING_CROSS_CHAIN_PROVIDER = "2101", t.MISSING_AVAX_PROVIDER = "2102", t.MISSING_BSC_PROVIDER = "2103", t.MISSING_ETH_PROVIDER = "2104", t.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", t.MISSING_ARB_PROVIDER = "2106", t.INVALID_CHAIN = "2200", t.INVALID_ASSET = "2201", t.INVALID_ASSET_IDENTIFIER = "2202", t.UNSUPPORTED_CHAIN = "2204", t.UNSUPPORTED_ASSET = "2203", t.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", t.INVALID_SOURCE_ADDRESS = "2300", t.INVALID_DESTINATION_ADDRESS = "2301", t.THORNODE_QUOTE_GENERIC_ERROR = "3000", t.NOT_ENOUGH_SYNTH_BALANCE = "3001", t.SYNTH_MINTING_CAP_REACHED = "3002", t.INVALID_QUOTE_MODE = "4000", t.NO_QUOTES = "4001", t.SERVICE_UNAVAILABLE_GENERIC = "5000", t.MISSING_GAS_DATA_GENERIC = "5100", t.MISSING_TOKEN_INFO_GENERIC = "5200", t.CANT_FIND_TOKEN_LIST = "5201", t.NO_PRICE = "5202", t.PRICE_IS_STALE = "5203", t.ADDRESS_NOT_WHITELISTED = "6000", t.ADDRESS_ALREADY_CLAIMED = "6001", t.TEMPORARY_ERROR = "9999", t))(R || {}); | ||
R.INVALID_INPUT_PARAMETERS + "", R.UNKNOWN_PROVIDERS + "", R.CANNOT_FIND_INBOUND_ADDRESS + "", R.NO_INBOUND_ADDRESSES + "", R.CHAIN_HALTED_OR_UNSUPPORTED + "", R.MISSING_INPUT_PARAMETER + "", R.INVALID_TYPE_GENERIC + "", R.INVALID_NUMBER_STRING + "", R.INVALID_NUMBER + "", R.INVALID_BOOLEAN + "", R.INVALID_OBJECT + "", R.INVALID_ARRAY + "", R.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", R.SELL_BUY_ASSETS_ARE_THE_SAME + "", R.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", R.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", R.AFF_ADDRESS_TOO_LONG + "", R.AFF_BPS_INTEGER_MAX_500 + "", R.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", R.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", R.PREFERRED_PROVIDER_NOT_SUPPORTED + "", R.SOURCE_ADDRESS_SMART_CONTRACT + "", R.DESTINATION_ADDRESS_SMART_CONTRACT + "", R.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", R.INVALID_PROVIDER + "", R.MISSING_CROSS_CHAIN_PROVIDER + "", R.MISSING_AVAX_PROVIDER + "", R.MISSING_BSC_PROVIDER + "", R.MISSING_ETH_PROVIDER + "", R.MISSING_ARB_PROVIDER + "", R.INVALID_PROVIDER_FOR_SWAP_OUT + "", R.INVALID_CHAIN + "", R.INVALID_ASSET + "", R.UNSUPPORTED_CHAIN + "", R.UNSUPPORTED_ASSET + "", R.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", R.THORNODE_QUOTE_GENERIC_ERROR + "", R.INVALID_SOURCE_ADDRESS + "", R.INVALID_DESTINATION_ADDRESS + "", R.NOT_ENOUGH_SYNTH_BALANCE + "", R.SYNTH_MINTING_CAP_REACHED + "", R.INVALID_QUOTE_MODE + "", R.NO_QUOTES + "", R.SERVICE_UNAVAILABLE_GENERIC + "", R.MISSING_GAS_DATA_GENERIC + "", R.MISSING_TOKEN_INFO_GENERIC + "", R.CANT_FIND_TOKEN_LIST + "", R.NO_PRICE + "", R.PRICE_IS_STALE + "", R.ADDRESS_NOT_WHITELISTED + "", R.ADDRESS_ALREADY_CLAIMED + ""; | ||
var D = /* @__PURE__ */ ((t) => (t.Arbitrum = "ARB", t.Avalanche = "AVAX", t.Binance = "BNB", t.BinanceSmartChain = "BSC", t.Bitcoin = "BTC", t.BitcoinCash = "BCH", t.Cosmos = "GAIA", t.Dogecoin = "DOGE", t.Ethereum = "ETH", t.Kujira = "KUJI", t.Litecoin = "LTC", t.Maya = "MAYA", t.Optimism = "OP", t.Polygon = "MATIC", t.THORChain = "THOR", t))(D || {}), j = /* @__PURE__ */ ((t) => (t[t.ARB = 18] = "ARB", t[t.AVAX = 18] = "AVAX", t[t.BCH = 8] = "BCH", t[t.BNB = 8] = "BNB", t[t.BSC = 18] = "BSC", t[t.BTC = 8] = "BTC", t[t.DASH = 8] = "DASH", t[t.DOGE = 8] = "DOGE", t[t.ETH = 18] = "ETH", t[t.GAIA = 6] = "GAIA", t[t.KUJI = 6] = "KUJI", t[t.LTC = 8] = "LTC", t[t.MATIC = 18] = "MATIC", t[t.MAYA = 10] = "MAYA", t[t.OP = 18] = "OP", t[t.THOR = 8] = "THOR", t))(j || {}), Ce = /* @__PURE__ */ ((t) => (t.Arbitrum = "42161", t.ArbitrumHex = "0xa4b1", t.Avalanche = "43114", t.AvalancheHex = "0xa86a", t.Binance = "Binance-Chain-Tigris", t.BinanceSmartChain = "56", t.BinanceSmartChainHex = "0x38", t.Bitcoin = "bitcoin", t.BitcoinCash = "bitcoincash", t.Cosmos = "cosmoshub-4", t.Dogecoin = "dogecoin", t.Kujira = "kaiyo-1", t.Ethereum = "1", t.EthereumHex = "0x1", t.Litecoin = "litecoin", t.Maya = "mayachain-mainnet-v1", t.MayaStagenet = "mayachain-stagenet-v1", t.Optimism = "10", t.OptimismHex = "0xa", t.Polygon = "137", t.PolygonHex = "0x89", t.THORChain = "thorchain-mainnet-v1", t.THORChainStagenet = "thorchain-stagenet-v2", t))(Ce || {}), ve = /* @__PURE__ */ ((t) => (t.Arbitrum = "https://arb1.arbitrum.io/rpc", t.Avalanche = "https://node-router.thorswap.net/avalanche-c", t.Binance = "", t.BinanceSmartChain = "https://bsc-dataseed.binance.org", t.Bitcoin = "https://node-router.thorswap.net/bitcoin", t.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", t.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", t.Kujira = "https://rpc-kujira.synergynodes.com/", t.Dogecoin = "https://node-router.thorswap.net/dogecoin", t.Ethereum = "https://node-router.thorswap.net/ethereum", t.Litecoin = "https://node-router.thorswap.net/litecoin", t.Maya = "https://tendermint.mayachain.info", t.MayaStagenet = "https://stagenet.tendermint.mayachain.info", t.Optimism = "https://mainnet.optimism.io", t.Polygon = "https://polygon-rpc.com", t.THORChain = "https://rpc.thorswap.net", t.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", t))(ve || {}); | ||
@@ -29,5 +29,5 @@ const Oe = Object.values(D), Fe = Object.keys(D), Be = Oe.reduce( | ||
); | ||
var ye = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, De = Math.ceil, W = Math.floor, k = "[BigNumber Error] ", Le = k + "Number primitive has more than 15 significant digits: ", z = 1e14, T = 14, we = 9007199254740991, ge = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], ie = 1e7, x = 1e9; | ||
var ye = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, De = Math.ceil, W = Math.floor, k = "[BigNumber Error] ", Le = k + "Number primitive has more than 15 significant digits: ", z = 1e14, T = 14, we = 9007199254740991, Ue = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], ie = 1e7, x = 1e9; | ||
function He(t) { | ||
var s, f, S, E = _.prototype = { constructor: _, toString: null, valueOf: null }, R = new _(1), d = 20, C = 4, w = -7, V = 21, ne = -1e7, K = 1e7, se = !1, le = 1, te = 0, Ie = { | ||
var s, f, S, E = _.prototype = { constructor: _, toString: null, valueOf: null }, m = new _(1), d = 20, C = 4, w = -7, V = 21, ne = -1e7, K = 1e7, se = !1, le = 1, te = 0, Ie = { | ||
prefix: "", | ||
@@ -42,3 +42,3 @@ groupSize: 3, | ||
suffix: "" | ||
}, oe = "0123456789abcdefghijklmnopqrstuvwxyz", me = !0; | ||
}, oe = "0123456789abcdefghijklmnopqrstuvwxyz", Re = !0; | ||
function _(e, i) { | ||
@@ -68,3 +68,3 @@ var r, l, o, c, A, n, a, h, u = this; | ||
} else { | ||
if (M(i, 2, oe.length, "Base"), i == 10 && me) | ||
if (M(i, 2, oe.length, "Base"), i == 10 && Re) | ||
return u = new _(e), $(u, d + u.e + 1, C); | ||
@@ -147,3 +147,3 @@ if (h = String(e), n = typeof e == "number") { | ||
if (r = e[i], typeof r == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(r)) | ||
me = r.slice(0, 10) == "0123456789", oe = r; | ||
Re = r.slice(0, 10) == "0123456789", oe = r; | ||
else | ||
@@ -200,3 +200,3 @@ throw Error(k + i + " invalid: " + r); | ||
return function(r) { | ||
var l, o, c, A, n, a = 0, h = [], u = new _(R); | ||
var l, o, c, A, n, a = 0, h = [], u = new _(m); | ||
if (r == null ? r = d : M(r, 0, x), A = De(r / T), se) | ||
@@ -216,3 +216,3 @@ if (crypto.getRandomValues) { | ||
n = i(), n < 9e15 && (h[a++] = n % 1e14); | ||
for (A = h[--a], r %= T, A && r && (n = ge[T - r], h[a] = W(A / n) * n); h[a] === 0; h.pop(), a--) | ||
for (A = h[--a], r %= T, A && r && (n = Ue[T - r], h[a] = W(A / n) * n); h[a] === 0; h.pop(), a--) | ||
; | ||
@@ -246,4 +246,4 @@ if (a < 0) | ||
return function(r, l, o, c, A) { | ||
var n, a, h, u, N, O, I, U, L = r.indexOf("."), H = d, g = C; | ||
for (L >= 0 && (u = te, te = 0, r = r.replace(".", ""), U = new _(l), O = U.pow(r.length - L), te = u, U.c = i( | ||
var n, a, h, u, N, O, I, g, L = r.indexOf("."), H = d, U = C; | ||
for (L >= 0 && (u = te, te = 0, r = r.replace(".", ""), g = new _(l), O = g.pow(r.length - L), te = u, g.c = i( | ||
ee(Y(O.c), O.e, "0"), | ||
@@ -253,7 +253,7 @@ 10, | ||
e | ||
), U.e = U.c.length), I = i(r, l, o, A ? (n = oe, e) : (n = e, oe)), h = u = I.length; I[--u] == 0; I.pop()) | ||
), g.e = g.c.length), I = i(r, l, o, A ? (n = oe, e) : (n = e, oe)), h = u = I.length; I[--u] == 0; I.pop()) | ||
; | ||
if (!I[0]) | ||
return n.charAt(0); | ||
if (L < 0 ? --h : (O.c = I, O.e = h, O.s = c, O = s(O, U, H, g, o), I = O.c, N = O.r, h = O.e), a = h + H + 1, L = I[a], u = o / 2, N = N || a < 0 || I[a + 1] != null, N = g < 4 ? (L != null || N) && (g == 0 || g == (O.s < 0 ? 3 : 2)) : L > u || L == u && (g == 4 || N || g == 6 && I[a - 1] & 1 || g == (O.s < 0 ? 8 : 7)), a < 1 || !I[0]) | ||
if (L < 0 ? --h : (O.c = I, O.e = h, O.s = c, O = s(O, g, H, U, o), I = O.c, N = O.r, h = O.e), a = h + H + 1, L = I[a], u = o / 2, N = N || a < 0 || I[a + 1] != null, N = U < 4 ? (L != null || N) && (U == 0 || U == (O.s < 0 ? 3 : 2)) : L > u || L == u && (U == 4 || N || U == 6 && I[a - 1] & 1 || U == (O.s < 0 ? 8 : 7)), a < 1 || !I[0]) | ||
r = N ? ee(n.charAt(1), -H, n.charAt(0)) : n.charAt(0); | ||
@@ -298,3 +298,3 @@ else { | ||
return function(l, o, c, A, n) { | ||
var a, h, u, N, O, I, U, L, H, g, B, F, Ee, de, pe, J, he, q = l.s == o.s ? 1 : -1, y = l.c, v = o.c; | ||
var a, h, u, N, O, I, g, L, H, U, B, F, Ee, de, pe, J, he, q = l.s == o.s ? 1 : -1, y = l.c, v = o.c; | ||
if (!y || !y[0] || !v || !v[0]) | ||
@@ -313,20 +313,20 @@ return new _( | ||
else { | ||
for (de = y.length, J = v.length, u = 0, q += 2, O = W(n / (v[0] + 1)), O > 1 && (v = e(v, O, n), y = e(y, O, n), J = v.length, de = y.length), Ee = J, g = y.slice(0, J), B = g.length; B < J; g[B++] = 0) | ||
for (de = y.length, J = v.length, u = 0, q += 2, O = W(n / (v[0] + 1)), O > 1 && (v = e(v, O, n), y = e(y, O, n), J = v.length, de = y.length), Ee = J, U = y.slice(0, J), B = U.length; B < J; U[B++] = 0) | ||
; | ||
he = v.slice(), he = [0].concat(he), pe = v[0], v[1] >= n / 2 && pe++; | ||
do { | ||
if (O = 0, a = i(v, g, J, B), a < 0) { | ||
if (F = g[0], J != B && (F = F * n + (g[1] || 0)), O = W(F / pe), O > 1) | ||
for (O >= n && (O = n - 1), I = e(v, O, n), U = I.length, B = g.length; i(I, g, U, B) == 1; ) | ||
O--, r(I, J < U ? he : v, U, n), U = I.length, a = 1; | ||
if (O = 0, a = i(v, U, J, B), a < 0) { | ||
if (F = U[0], J != B && (F = F * n + (U[1] || 0)), O = W(F / pe), O > 1) | ||
for (O >= n && (O = n - 1), I = e(v, O, n), g = I.length, B = U.length; i(I, U, g, B) == 1; ) | ||
O--, r(I, J < g ? he : v, g, n), g = I.length, a = 1; | ||
else | ||
O == 0 && (a = O = 1), I = v.slice(), U = I.length; | ||
if (U < B && (I = [0].concat(I)), r(g, I, B, n), B = g.length, a == -1) | ||
for (; i(v, g, J, B) < 1; ) | ||
O++, r(g, J < B ? he : v, B, n), B = g.length; | ||
O == 0 && (a = O = 1), I = v.slice(), g = I.length; | ||
if (g < B && (I = [0].concat(I)), r(U, I, B, n), B = U.length, a == -1) | ||
for (; i(v, U, J, B) < 1; ) | ||
O++, r(U, J < B ? he : v, B, n), B = U.length; | ||
} else | ||
a === 0 && (O++, g = [0]); | ||
H[u++] = O, g[0] ? g[B++] = y[Ee] || 0 : (g = [y[Ee]], B = 1); | ||
} while ((Ee++ < de || g[0] != null) && q--); | ||
N = g[0] != null, H[0] || H.splice(0, 1); | ||
a === 0 && (O++, U = [0]); | ||
H[u++] = O, U[0] ? U[B++] = y[Ee] || 0 : (U = [y[Ee]], B = 1); | ||
} while ((Ee++ < de || U[0] != null) && q--); | ||
N = U[0] != null, H[0] || H.splice(0, 1); | ||
} | ||
@@ -342,3 +342,3 @@ if (n == z) { | ||
}(); | ||
function Re(e, i, r, l) { | ||
function me(e, i, r, l) { | ||
var o, c, A, n, a; | ||
@@ -393,3 +393,3 @@ if (r == null ? r = C : M(r, 0, 8), !e.c) | ||
function $(e, i, r, l) { | ||
var o, c, A, n, a, h, u, N = e.c, O = ge; | ||
var o, c, A, n, a, h, u, N = e.c, O = Ue; | ||
if (N) { | ||
@@ -478,3 +478,3 @@ e: { | ||
} | ||
for (n ? (r = new _(0.5), a && (e.s = 1), h = Ne(e)) : (o = Math.abs(+Z(e)), h = o % 2), u = new _(R); ; ) { | ||
for (n ? (r = new _(0.5), a && (e.s = 1), h = Ne(e)) : (o = Math.abs(+Z(e)), h = o % 2), u = new _(m); ; ) { | ||
if (h) { | ||
@@ -498,3 +498,3 @@ if (u = u.times(N), !u.c) | ||
} | ||
return l ? u : (a && (u = R.div(u)), i ? u.mod(i) : c ? $(u, te, C, A) : u); | ||
return l ? u : (a && (u = m.div(u)), i ? u.mod(i) : c ? $(u, te, C, A) : u); | ||
}, E.integerValue = function(e) { | ||
@@ -569,13 +569,13 @@ var i = new _(this); | ||
}, E.multipliedBy = E.times = function(e, i) { | ||
var r, l, o, c, A, n, a, h, u, N, O, I, U, L, H, g = this, B = g.c, F = (e = new _(e, i)).c; | ||
var r, l, o, c, A, n, a, h, u, N, O, I, g, L, H, U = this, B = U.c, F = (e = new _(e, i)).c; | ||
if (!B || !F || !B[0] || !F[0]) | ||
return !g.s || !e.s || B && !B[0] && !F || F && !F[0] && !B ? e.c = e.e = e.s = null : (e.s *= g.s, !B || !F ? e.c = e.e = null : (e.c = [0], e.e = 0)), e; | ||
for (l = X(g.e / T) + X(e.e / T), e.s *= g.s, a = B.length, N = F.length, a < N && (U = B, B = F, F = U, o = a, a = N, N = o), o = a + N, U = []; o--; U.push(0)) | ||
return !U.s || !e.s || B && !B[0] && !F || F && !F[0] && !B ? e.c = e.e = e.s = null : (e.s *= U.s, !B || !F ? e.c = e.e = null : (e.c = [0], e.e = 0)), e; | ||
for (l = X(U.e / T) + X(e.e / T), e.s *= U.s, a = B.length, N = F.length, a < N && (g = B, B = F, F = g, o = a, a = N, N = o), o = a + N, g = []; o--; g.push(0)) | ||
; | ||
for (L = z, H = ie, o = N; --o >= 0; ) { | ||
for (r = 0, O = F[o] % H, I = F[o] / H | 0, A = a, c = o + A; c > o; ) | ||
h = B[--A] % H, u = B[A] / H | 0, n = I * h + u * O, h = O * h + n % H * H + U[c] + r, r = (h / L | 0) + (n / H | 0) + I * u, U[c--] = h % L; | ||
U[c] = r; | ||
h = B[--A] % H, u = B[A] / H | 0, n = I * h + u * O, h = O * h + n % H * H + g[c] + r, r = (h / L | 0) + (n / H | 0) + I * u, g[c--] = h % L; | ||
g[c] = r; | ||
} | ||
return r ? ++l : U.splice(0, 1), Te(e, U, l); | ||
return r ? ++l : g.splice(0, 1), Te(e, g, l); | ||
}, E.negated = function() { | ||
@@ -640,5 +640,5 @@ var e = new _(this); | ||
}, E.toExponential = function(e, i) { | ||
return e != null && (M(e, 0, x), e++), Re(this, e, i, 1); | ||
return e != null && (M(e, 0, x), e++), me(this, e, i, 1); | ||
}, E.toFixed = function(e, i) { | ||
return e != null && (M(e, 0, x), e = e + this.e + 1), Re(this, e, i); | ||
return e != null && (M(e, 0, x), e = e + this.e + 1), me(this, e, i); | ||
}, E.toFormat = function(e, i, r) { | ||
@@ -651,5 +651,5 @@ var l, o = this; | ||
if (l = o.toFixed(e, i), o.c) { | ||
var c, A = l.split("."), n = +r.groupSize, a = +r.secondaryGroupSize, h = r.groupSeparator || "", u = A[0], N = A[1], O = o.s < 0, I = O ? u.slice(1) : u, U = I.length; | ||
if (a && (c = n, n = a, a = c, U -= c), n > 0 && U > 0) { | ||
for (c = U % n || n, u = I.substr(0, c); c < U; c += n) | ||
var c, A = l.split("."), n = +r.groupSize, a = +r.secondaryGroupSize, h = r.groupSeparator || "", u = A[0], N = A[1], O = o.s < 0, I = O ? u.slice(1) : u, g = I.length; | ||
if (a && (c = n, n = a, a = c, g -= c), n > 0 && g > 0) { | ||
for (c = g % n || n, u = I.substr(0, c); c < g; c += n) | ||
u += h + I.substr(c, n); | ||
@@ -665,8 +665,8 @@ a > 0 && (u += h + I.slice(c)), O && (u = "-" + u); | ||
}, E.toFraction = function(e) { | ||
var i, r, l, o, c, A, n, a, h, u, N, O, I = this, U = I.c; | ||
if (e != null && (n = new _(e), !n.isInteger() && (n.c || n.s !== 1) || n.lt(R))) | ||
var i, r, l, o, c, A, n, a, h, u, N, O, I = this, g = I.c; | ||
if (e != null && (n = new _(e), !n.isInteger() && (n.c || n.s !== 1) || n.lt(m))) | ||
throw Error(k + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + Z(n)); | ||
if (!U) | ||
if (!g) | ||
return new _(I); | ||
for (i = new _(R), h = r = new _(R), l = a = new _(R), O = Y(U), c = i.e = O.length - I.e - 1, i.c[0] = ge[(A = c % T) < 0 ? T + A : A], e = !e || n.comparedTo(i) > 0 ? c > 0 ? i : h : n, A = K, K = 1 / 0, n = new _(O), a.c[0] = 0; u = s(n, i, 0, 1), o = r.plus(u.times(l)), o.comparedTo(e) != 1; ) | ||
for (i = new _(m), h = r = new _(m), l = a = new _(m), O = Y(g), c = i.e = O.length - I.e - 1, i.c[0] = Ue[(A = c % T) < 0 ? T + A : A], e = !e || n.comparedTo(i) > 0 ? c > 0 ? i : h : n, A = K, K = 1 / 0, n = new _(O), a.c[0] = 0; u = s(n, i, 0, 1), o = r.plus(u.times(l)), o.comparedTo(e) != 1; ) | ||
r = l, l = o, h = a.plus(u.times(o = h)), a = o, i = n.minus(u.times(o = i)), n = o; | ||
@@ -679,6 +679,6 @@ return o = s(e.minus(r), l, 0, 1), a = a.plus(o.times(h)), r = r.plus(o.times(l)), a.s = h.s = I.s, c = c * 2, N = s(h, l, c, C).minus(I).abs().comparedTo( | ||
}, E.toPrecision = function(e, i) { | ||
return e != null && M(e, 1, x), Re(this, e, i, 2); | ||
return e != null && M(e, 1, x), me(this, e, i, 2); | ||
}, E.toString = function(e) { | ||
var i, r = this, l = r.s, o = r.e; | ||
return o === null ? l ? (i = "Infinity", l < 0 && (i = "-" + i)) : i = "NaN" : (e == null ? i = o <= w || o >= V ? Se(Y(r.c), o) : ee(Y(r.c), o, "0") : e === 10 && me ? (r = $(new _(r), d + o + 1, C), i = ee(Y(r.c), r.e, "0")) : (M(e, 2, oe.length, "Base"), i = f(ee(Y(r.c), o, "0"), 10, e, l, !0)), l < 0 && r.c[0] && (i = "-" + i)), i; | ||
return o === null ? l ? (i = "Infinity", l < 0 && (i = "-" + i)) : i = "NaN" : (e == null ? i = o <= w || o >= V ? Se(Y(r.c), o) : ee(Y(r.c), o, "0") : e === 10 && Re ? (r = $(new _(r), d + o + 1, C), i = ee(Y(r.c), r.e, "0")) : (M(e, 2, oe.length, "Base"), i = f(ee(Y(r.c), o, "0"), 10, e, l, !0)), l < 0 && r.c[0] && (i = "-" + i)), i; | ||
}, E.valueOf = E.toJSON = function() { | ||
@@ -693,26 +693,26 @@ return Z(this); | ||
function Y(t) { | ||
for (var s, f, S = 1, E = t.length, R = t[0] + ""; S < E; ) { | ||
for (var s, f, S = 1, E = t.length, m = t[0] + ""; S < E; ) { | ||
for (s = t[S++] + "", f = T - s.length; f--; s = "0" + s) | ||
; | ||
R += s; | ||
m += s; | ||
} | ||
for (E = R.length; R.charCodeAt(--E) === 48; ) | ||
for (E = m.length; m.charCodeAt(--E) === 48; ) | ||
; | ||
return R.slice(0, E + 1 || 1); | ||
return m.slice(0, E + 1 || 1); | ||
} | ||
function ae(t, s) { | ||
var f, S, E = t.c, R = s.c, d = t.s, C = s.s, w = t.e, V = s.e; | ||
var f, S, E = t.c, m = s.c, d = t.s, C = s.s, w = t.e, V = s.e; | ||
if (!d || !C) | ||
return null; | ||
if (f = E && !E[0], S = R && !R[0], f || S) | ||
if (f = E && !E[0], S = m && !m[0], f || S) | ||
return f ? S ? 0 : -C : d; | ||
if (d != C) | ||
return d; | ||
if (f = d < 0, S = w == V, !E || !R) | ||
if (f = d < 0, S = w == V, !E || !m) | ||
return S ? 0 : !E ^ f ? 1 : -1; | ||
if (!S) | ||
return w > V ^ f ? 1 : -1; | ||
for (C = (w = E.length) < (V = R.length) ? w : V, d = 0; d < C; d++) | ||
if (E[d] != R[d]) | ||
return E[d] > R[d] ^ f ? 1 : -1; | ||
for (C = (w = E.length) < (V = m.length) ? w : V, d = 0; d < C; d++) | ||
if (E[d] != m[d]) | ||
return E[d] > m[d] ^ f ? 1 : -1; | ||
return w == V ? 0 : w > V ^ f ? 1 : -1; | ||
@@ -746,3 +746,3 @@ } | ||
var G = He(), _e = /* @__PURE__ */ ((t) => (t[t.ROUND_DOWN = 0] = "ROUND_DOWN", t[t.ROUND_HALF_UP = 1] = "ROUND_HALF_UP", t[t.ROUND_UP = 2] = "ROUND_UP", t))(_e || {}), re = /* @__PURE__ */ ((t) => (t[t.BASE_AMOUNT = 0] = "BASE_AMOUNT", t[t.ASSET_AMOUNT = 1] = "ASSET_AMOUNT", t))(re || {}); | ||
const Ue = { | ||
const ge = { | ||
0: G.ROUND_DOWN, | ||
@@ -841,3 +841,3 @@ 1: G.ROUND_HALF_UP, | ||
throw new Error(`${s} is not positive.`); | ||
return G.config({ FORMAT: f }), new G(this.assetAmount.toFixed(s, Ue[S])).toFormat(); | ||
return G.config({ FORMAT: f }), new G(this.assetAmount.toFixed(s, ge[S])).toFormat(); | ||
} | ||
@@ -869,6 +869,6 @@ toFixed(s = 8, f = ce, S = 0) { | ||
throw new Error(`${s} is not positive.`); | ||
return G.config({ FORMAT: f }), new G(this.assetAmount.toPrecision(s, Ue[S])); | ||
return G.config({ FORMAT: f }), new G(this.assetAmount.toPrecision(s, ge[S])); | ||
} | ||
} | ||
const We = (t, s = 8, f = 0) => (G.config({ FORMAT: ce }), new G(t.toFixed(s, Ue[f])).toFormat()), fe = class fe { | ||
const We = (t, s = 8, f = 0) => (G.config({ FORMAT: ce }), new G(t.toFixed(s, ge[f])).toFormat()), fe = class fe { | ||
constructor(s, f, S = !1, E) { | ||
@@ -893,4 +893,4 @@ P(this, "chain"); | ||
return null; | ||
const f = s.includes("/"), [S, ...E] = s.split(f ? "/" : "."), R = E.join("."), d = (w = R == null ? void 0 : R.split("-")) == null ? void 0 : w[0]; | ||
return S && R && d ? new fe(S, R, f) : null; | ||
const f = s.includes("/"), [S, ...E] = s.split(f ? "/" : "."), m = E.join("."), d = (w = m == null ? void 0 : m.split("-")) == null ? void 0 : w[0]; | ||
return S && m && d ? new fe(S, m, f) : null; | ||
} | ||
@@ -942,5 +942,5 @@ getAssetObj() { | ||
P(fe, "decodeFromURL", (s) => { | ||
var S, E, R; | ||
var S, E, m; | ||
let f = s.toUpperCase(); | ||
return f.startsWith("THOR.") && ((S = f.split("THOR.")) == null ? void 0 : S[1]) !== "RUNE" && (f = (R = (E = f.split("THOR.")) == null ? void 0 : E[1]) == null ? void 0 : R.replace(".", "/")), fe.fromAssetString(f); | ||
return f.startsWith("THOR.") && ((S = f.split("THOR.")) == null ? void 0 : S[1]) !== "RUNE" && (f = (m = (E = f.split("THOR.")) == null ? void 0 : E[1]) == null ? void 0 : m.replace(".", "/")), fe.fromAssetString(f); | ||
}); | ||
@@ -1004,3 +1004,3 @@ let b = fe; | ||
unitPrice: E, | ||
pools: R, | ||
pools: m, | ||
priceAmount: d | ||
@@ -1021,13 +1021,13 @@ }) { | ||
else { | ||
if (!R) | ||
if (!m) | ||
throw new Error("Pools must be provided if unitPrice omitted"); | ||
if (this.unitPrice = new G(0), S) | ||
if (f.isRUNE() && !S.isRUNE()) { | ||
const w = Ae(S, R); | ||
const w = Ae(S, m); | ||
w && (this.unitPrice = w.runePriceInAsset.assetAmount); | ||
} else if (!f.isRUNE() && S.isRUNE()) { | ||
const w = Ae(f, R); | ||
const w = Ae(f, m); | ||
w && (this.unitPrice = w.assetPriceInRune.assetAmount); | ||
} else if (!f.isRUNE() && !S.isRUNE()) { | ||
const w = Ae(f, R), V = Ae(S, R); | ||
const w = Ae(f, m), V = Ae(S, m); | ||
w && V && (this.unitPrice = w.assetPriceInRune.div( | ||
@@ -1039,6 +1039,6 @@ V.assetPriceInRune | ||
else if (f.isRUNE()) { | ||
const w = R == null ? void 0 : R[0]; | ||
const w = m == null ? void 0 : m[0]; | ||
w && (this.unitPrice = w.runePriceInAsset.mul(w.assetUSDPrice).assetAmount); | ||
} else { | ||
const w = Ae(f, R); | ||
const w = Ae(f, m); | ||
w && (this.unitPrice = w.assetUSDPrice.assetAmount); | ||
@@ -1115,5 +1115,5 @@ } | ||
rounding: _e.ROUND_DOWN | ||
}, R = !1) { | ||
}, m = !1) { | ||
const d = super.toSignificant(f, 8, S, E); | ||
return R ? `${this.asset.ticker} ${d}` : `${d} ${this.asset.ticker}`; | ||
return m ? `${this.asset.ticker} ${d}` : `${d} ${this.asset.ticker}`; | ||
} | ||
@@ -1155,6 +1155,6 @@ totalPriceIn(f, S) { | ||
static fromPoolData(s) { | ||
const { asset: f, runeDepth: S, assetDepth: E } = s, R = b.fromAssetString(f); | ||
if (R && S && E) { | ||
const { asset: f, runeDepth: S, assetDepth: E } = s, m = b.fromAssetString(f); | ||
if (m && S && E) { | ||
const d = p.fromBaseAmount(S, j.THOR), C = p.fromBaseAmount(E, j.THOR); | ||
return new xe(R, d, C, s); | ||
return new xe(m, d, C, s); | ||
} | ||
@@ -1161,0 +1161,0 @@ return null; |
@@ -6,3 +6,3 @@ { | ||
"tiny-invariant": "1.3.1", | ||
"@swapkit/types": "1.0.0-rc.31" | ||
"@swapkit/types": "1.0.0-rc.32" | ||
}, | ||
@@ -35,10 +35,10 @@ "description": "SwapKit Lib swapkit-entities", | ||
"name": "@thorswap-lib/swapkit-entities", | ||
"publishConfig": { | ||
"access": "public" | ||
"react-native": "./src/index.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/thorswap/SwapKit.git" | ||
}, | ||
"react-native": "./src/index.ts", | ||
"repository": "https://github.com/thorswap/SwapKit.git", | ||
"type": "module", | ||
"types": "./dist/index.d.ts", | ||
"version": "1.0.0-rc.31", | ||
"version": "1.0.0-rc.32", | ||
"scripts": { | ||
@@ -45,0 +45,0 @@ "build": "vite build", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
581520
0
+ Added@swapkit/types@1.0.0-rc.32(transitive)
- Removed@swapkit/types@1.0.0-rc.31(transitive)
Updated@swapkit/types@1.0.0-rc.32