@coinmasters/swapkit-entities
Advanced tools
Comparing version 3.7.6 to 3.7.7
@@ -5,4 +5,4 @@ var H = Object.defineProperty; | ||
import { BigNumber as E } from "bignumber.js"; | ||
var a = /* @__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_0_100 = "2005", t.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", t.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", t.PREFERRED_PROFVIDER_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))(a || {}); | ||
a.INVALID_INPUT_PARAMETERS + "", a.UNKNOWN_PROVIDERS + "", a.CANNOT_FIND_INBOUND_ADDRESS + "", a.NO_INBOUND_ADDRESSES + "", a.CHAIN_HALTED_OR_UNSUPPORTED + "", a.MISSING_INPUT_PARAMETER + "", a.INVALID_TYPE_GENERIC + "", a.INVALID_NUMBER_STRING + "", a.INVALID_NUMBER + "", a.INVALID_BOOLEAN + "", a.INVALID_OBJECT + "", a.INVALID_ARRAY + "", a.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", a.SELL_BUY_ASSETS_ARE_THE_SAME + "", a.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", a.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", a.AFF_ADDRESS_TOO_LONG + "", a.AFF_BPS_INTEGER_0_100 + "", a.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", a.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", a.PREFERRED_PROFVIDER_NOT_SUPPORTED + "", a.DESTINATION_ADDRESS_SMART_CONTRACT + "", a.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", a.INVALID_PROVIDER + "", a.MISSING_CROSS_CHAIN_PROVIDER + "", a.MISSING_AVAX_PROVIDER + "", a.MISSING_BSC_PROVIDER + "", a.MISSING_ETH_PROVIDER + "", a.MISSING_ARB_PROVIDER + "", a.INVALID_PROVIDER_FOR_SWAP_OUT + "", a.INVALID_CHAIN + "", a.INVALID_ASSET + "", a.UNSUPPORTED_CHAIN + "", a.UNSUPPORTED_ASSET + "", a.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", a.THORNODE_QUOTE_GENERIC_ERROR + "", a.INVALID_SOURCE_ADDRESS + "", a.INVALID_DESTINATION_ADDRESS + "", a.NOT_ENOUGH_SYNTH_BALANCE + "", a.SYNTH_MINTING_CAP_REACHED + "", a.INVALID_QUOTE_MODE + "", a.NO_QUOTES + "", a.SERVICE_UNAVAILABLE_GENERIC + "", a.MISSING_GAS_DATA_GENERIC + "", a.MISSING_TOKEN_INFO_GENERIC + "", a.CANT_FIND_TOKEN_LIST + "", a.NO_PRICE + "", a.PRICE_IS_STALE + "", a.ADDRESS_NOT_WHITELISTED + "", a.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_0_100 = "2005", t.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", t.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", t.PREFERRED_PROFVIDER_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_0_100 + "", r.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", r.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", r.PREFERRED_PROFVIDER_NOT_SUPPORTED + "", 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 e = /* @__PURE__ */ ((t) => (t.Arbitrum = "ARB", t.Avalanche = "AVAX", t.Base = "BASE", t.Binance = "BNB", t.BinanceSmartChain = "BSC", t.Bitcoin = "BTC", t.BitcoinCash = "BCH", t.Cosmos = "GAIA", t.Dash = "DASH", t.Digibyte = "DGB", t.Dogecoin = "DOGE", t.EOS = "EOS", t.Ethereum = "ETH", t.Kujira = "KUJI", t.Litecoin = "LTC", t.Mayachain = "MAYA", t.Optimism = "OP", t.Osmosis = "OSMO", t.Polygon = "MATIC", t.Ripple = "XRP", t.THORChain = "THOR", t.Zcash = "ZEC", t))(e || {}); | ||
@@ -35,12 +35,12 @@ const w = { | ||
w[e[t]], e[t]; | ||
var u = /* @__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.DGB = 8] = "DGB", t[t.DOGE = 8] = "DOGE", t[t.ETH = 18] = "ETH", t[t.BASE = 18] = "BASE", t[t.EOS = 6] = "EOS", 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.OSMO = 6] = "OSMO", t[t.XRP = 6] = "XRP", t[t.THOR = 8] = "THOR", t[t.ZEC = 8] = "ZEC", t))(u || {}); | ||
var _ = /* @__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.DGB = 8] = "DGB", t[t.DOGE = 8] = "DOGE", t[t.ETH = 18] = "ETH", t[t.BASE = 18] = "BASE", t[t.EOS = 6] = "EOS", 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.OSMO = 6] = "OSMO", t[t.XRP = 6] = "XRP", t[t.THOR = 8] = "THOR", t[t.ZEC = 8] = "ZEC", t))(_ || {}); | ||
const d = [ | ||
"ETH", | ||
"AVAX", | ||
"BSC", | ||
"ARB", | ||
"BASE", | ||
"OP", | ||
"MATIC" | ||
/* Polygon */ | ||
"ETH" | ||
/* Ethereum */ | ||
// Chain.Avalanche, | ||
// Chain.BinanceSmartChain, | ||
// Chain.Arbitrum, | ||
// Chain.Base, | ||
// Chain.Optimism, | ||
// Chain.Polygon, | ||
]; | ||
@@ -88,4 +88,15 @@ var B = /* @__PURE__ */ ((t) => (t.Arbitrum = "42161", t.ArbitrumHex = "0xa4b1", t.Avalanche = "43114", t.AvalancheHex = "0xa86a", t.Base = "8453", t.Binance = "Binance-Chain-Tigris", t.BinanceSmartChain = "56", t.BinanceSmartChainHex = "0x38", t.Bitcoin = "bitcoin", t.BitcoinCash = "bitcoincash", t.Cosmos = "cosmoshub-4", t.Dash = "dash", t.Dogecoin = "dogecoin", t.Kujira = "kaiyo-1", t.Ethereum = "1", t.EthereumHex = "0x1", t.Litecoin = "litecoin", t.Mayachain = "mayachain-mainnet-v1", t.MayaStagenet = "mayachain-stagenet-v1", t.Optimism = "10", t.OptimismHex = "0xa", t.Osmosis = "osmosis-1", t.Polygon = "137", t.PolygonHex = "0x89", t.THORChain = "thorchain-mainnet-v1", t.THORChainStagenet = "thorchain-stagenet-v2", t))(B || {}), b = /* @__PURE__ */ ((t) => (t.Arbitrum = "https://arb1.arbitrum.io/rpc", t.Avalanche = "https://daemon.avalanche.shapeshift.com/ext/bc/C/rpc", t.Binance = "https://base.llamarpc.com", t.BinanceSmartChain = "https://daemon.bnbsmartchain.shapeshift.com", t.Base = "https://developer-access-mainnet.base.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.Dash = "https://dash.nownodes.io", t.Dogecoin = "https://node-router.thorswap.net/dogecoin", t.Ethereum = "https://daemon.ethereum.shapeshift.com", t.Litecoin = "https://node-router.thorswap.net/litecoin", t.Mayachain = "https://mayanode.mayachain.info", t.MayaStagenet = "https://stagenet.tendermint.mayachain.info", t.Optimism = "https://mainnet.optimism.io", t.Osmosis = "https://lcd-osmosis.keplr.app", t.Polygon = "https://polygon-rpc.com", t.Ripple = "https://xrplcluster.com", t.THORChain = "https://thornode.ninerealms.com", t.THORChainStagenet = "https://thornode.ninerealms.com", t))(b || {}); | ||
]; | ||
e.Cosmos, e.Arbitrum, e.Base, e.Avalanche, e.Binance, e.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Dogecoin, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Bitcoin, e.BitcoinCash, e.Litecoin, e.Dogecoin, e.Ethereum, e.Arbitrum, e.Avalanche, e.Base, e.Binance, e.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Osmosis, e.Ripple, e.Dogecoin, e.Dash, e.Mayachain, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Arbitrum, e.Avalanche, e.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Dogecoin, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Arbitrum, e.Avalanche, e.Binance, e.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Ripple, e.Dogecoin, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Ethereum, e.Ethereum, e.Avalanche, e.BinanceSmartChain, e.Bitcoin, e.Cosmos; | ||
var l = /* @__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))(l || {}), _ = /* @__PURE__ */ ((t) => (t[t.BASE_AMOUNT = 0] = "BASE_AMOUNT", t[t.ASSET_AMOUNT = 1] = "ASSET_AMOUNT", t))(_ || {}); | ||
e.Cosmos, e.Arbitrum, e.Base, e.Avalanche, e.Binance, e.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Dogecoin, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Bitcoin, e.BitcoinCash, e.Litecoin, e.Dogecoin, e.Ethereum, // Chain.Arbitrum, | ||
// Chain.Avalanche, | ||
e.Base, // Chain.Binance, | ||
// Chain.BinanceSmartChain, | ||
e.Bitcoin, // Chain.BitcoinCash, | ||
// Chain.Cosmos, | ||
// Chain.Osmosis, | ||
// Chain.Ripple, | ||
// Chain.Dogecoin, | ||
// Chain.Dash, | ||
// Chain.Mayachain, | ||
e.Ethereum, e.Arbitrum, e.Avalanche, e.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Dogecoin, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Arbitrum, e.Avalanche, e.Binance, e.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Ripple, e.Dogecoin, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Ethereum, e.Ethereum, e.Avalanche, e.BinanceSmartChain, e.Bitcoin, e.Cosmos; | ||
var l = /* @__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))(l || {}), u = /* @__PURE__ */ ((t) => (t[t.BASE_AMOUNT = 0] = "BASE_AMOUNT", t[t.ASSET_AMOUNT = 1] = "ASSET_AMOUNT", t))(u || {}); | ||
const C = { | ||
@@ -98,3 +109,3 @@ 0: E.ROUND_DOWN, | ||
decimalSeparator: "." | ||
}, I = { | ||
}, N = { | ||
prefix: "", | ||
@@ -109,3 +120,3 @@ decimalSeparator: ".", | ||
}; | ||
class r { | ||
class a { | ||
constructor(s, i = 0, n) { | ||
@@ -120,12 +131,12 @@ c(this, "assetAmount"); | ||
static fromMidgard(s) { | ||
return new r(s || 0, 0, u.THOR); | ||
return new a(s || 0, 0, _.THOR); | ||
} | ||
static fromBaseAmount(s, i) { | ||
return new r(s, 0, i); | ||
return new a(s, 0, i); | ||
} | ||
static fromAssetAmount(s, i) { | ||
return new r(s, 1, i); | ||
return new a(s, 1, i); | ||
} | ||
static fromNormalAmount(s) { | ||
return new r(s || 0, 1, 1); | ||
return new a(s || 0, 1, 1); | ||
} | ||
@@ -138,3 +149,3 @@ static sorter(s, i) { | ||
add(s) { | ||
return new r( | ||
return new a( | ||
this.assetAmount.plus(s.assetAmount), | ||
@@ -146,3 +157,3 @@ 1, | ||
sub(s) { | ||
return new r( | ||
return new a( | ||
this.assetAmount.minus(s.assetAmount), | ||
@@ -154,31 +165,31 @@ 1, | ||
mul(s) { | ||
return s instanceof r ? new r( | ||
return s instanceof a ? new a( | ||
this.assetAmount.multipliedBy(s.assetAmount), | ||
1, | ||
this.decimal | ||
) : new r(this.assetAmount.multipliedBy(s), 1, this.decimal); | ||
) : new a(this.assetAmount.multipliedBy(s), 1, this.decimal); | ||
} | ||
div(s) { | ||
return s instanceof r ? new r( | ||
return s instanceof a ? new a( | ||
this.assetAmount.dividedBy(s.assetAmount), | ||
1, | ||
this.decimal | ||
) : new r(this.assetAmount.dividedBy(s), 1, this.decimal); | ||
) : new a(this.assetAmount.dividedBy(s), 1, this.decimal); | ||
} | ||
gte(s) { | ||
return s instanceof r ? this.assetAmount.isGreaterThanOrEqualTo(s.assetAmount) : this.assetAmount.isGreaterThanOrEqualTo(s); | ||
return s instanceof a ? this.assetAmount.isGreaterThanOrEqualTo(s.assetAmount) : this.assetAmount.isGreaterThanOrEqualTo(s); | ||
} | ||
gt(s) { | ||
return s instanceof r ? this.assetAmount.isGreaterThan(s.assetAmount) : this.assetAmount.isGreaterThan(s); | ||
return s instanceof a ? this.assetAmount.isGreaterThan(s.assetAmount) : this.assetAmount.isGreaterThan(s); | ||
} | ||
lte(s) { | ||
return s instanceof r ? this.assetAmount.isLessThanOrEqualTo(s.assetAmount) : this.assetAmount.isLessThanOrEqualTo(s); | ||
return s instanceof a ? this.assetAmount.isLessThanOrEqualTo(s.assetAmount) : this.assetAmount.isLessThanOrEqualTo(s); | ||
} | ||
lt(s) { | ||
return s instanceof r ? this.assetAmount.isLessThan(s.assetAmount) : this.assetAmount.isLessThan(s); | ||
return s instanceof a ? this.assetAmount.isLessThan(s.assetAmount) : this.assetAmount.isLessThan(s); | ||
} | ||
eq(s) { | ||
return s instanceof r ? this.assetAmount.isEqualTo(s.assetAmount) : this.assetAmount.isEqualTo(s); | ||
return s instanceof a ? this.assetAmount.isEqualTo(s.assetAmount) : this.assetAmount.isEqualTo(s); | ||
} | ||
toSignificant(s = 8, i = 8, n = I, o = 0) { | ||
toSignificant(s = 8, i = 8, n = N, o = 0) { | ||
return this.toSignificantBigNumber(s, n, o).decimalPlaces(i).toFormat(); | ||
@@ -193,3 +204,3 @@ } | ||
} | ||
toFixed(s = 8, i = I, n = 0) { | ||
toFixed(s = 8, i = N, n = 0) { | ||
return this.toFixedDecimal(s, i, n); | ||
@@ -206,11 +217,11 @@ } | ||
toMidgard() { | ||
return new r( | ||
return new a( | ||
new E( | ||
this.baseAmount.dividedBy(10 ** this.decimal).multipliedBy(10 ** u.THOR).toFixed() | ||
this.baseAmount.dividedBy(10 ** this.decimal).multipliedBy(10 ** _.THOR).toFixed() | ||
), | ||
0, | ||
u.THOR | ||
_.THOR | ||
); | ||
} | ||
toSignificantBigNumber(s = 8, i = I, n = 0) { | ||
toSignificantBigNumber(s = 8, i = N, n = 0) { | ||
if (!Number.isInteger(s)) | ||
@@ -223,3 +234,3 @@ throw new Error(`${s} is not an integer.`); | ||
} | ||
const k = (t, s = 8, i = 0) => (E.config({ FORMAT: I }), new E(t.toFixed(s, C[i])).toFormat()), T = class T { | ||
const k = (t, s = 8, i = 0) => (E.config({ FORMAT: N }), new E(t.toFixed(s, C[i])).toFormat()), T = class T { | ||
constructor(s, i, n = !1, o) { | ||
@@ -236,5 +247,5 @@ c(this, "chain"); | ||
c(this, "setDecimal", (s) => { | ||
this.decimal = s || u[this.chain] || u.THOR; | ||
this.decimal = s || _[this.chain] || _.THOR; | ||
}); | ||
this.chain = s, this.symbol = i.toUpperCase(), this.ticker = o || i.toUpperCase().split("-")[0], this.type = "Broken - MIGRATION", this.name = n ? `Synth ${this.ticker}` : this.ticker, this.network = "Broken - MIGRATION", this.decimal = n ? u.THOR : u[s], this.isSynth = n, this.L1Chain = n ? e.THORChain : s; | ||
this.chain = s, this.symbol = i.toUpperCase(), this.ticker = o || i.toUpperCase().split("-")[0], this.type = "Broken - MIGRATION", this.name = n ? `Synth ${this.ticker}` : this.ticker, this.network = "Broken - MIGRATION", this.decimal = n ? _.THOR : _[s], this.isSynth = n, this.L1Chain = n ? e.THORChain : s; | ||
} | ||
@@ -349,3 +360,3 @@ static fromAssetString(s) { | ||
}, Y = (t) => t.eq(f(t.chain)), D = (t, s) => s.find((i) => t.shallowEq(i.asset)); | ||
class g extends r { | ||
class g extends a { | ||
constructor({ | ||
@@ -358,7 +369,7 @@ baseAsset: i, | ||
}) { | ||
const O = r.fromAssetAmount( | ||
const I = a.fromAssetAmount( | ||
m ? m.assetAmount : 1, | ||
i.decimal | ||
); | ||
super(O.assetAmount, _.ASSET_AMOUNT, i.decimal); | ||
super(I.assetAmount, u.ASSET_AMOUNT, i.decimal); | ||
c(this, "baseAsset"); | ||
@@ -369,4 +380,4 @@ c(this, "quoteAsset"); | ||
c(this, "amount"); | ||
if (this.amount = O, this.baseAsset = i, this.quoteAsset = n, o !== void 0) | ||
this.unitPrice = o, this.price = O.assetAmount.multipliedBy(o); | ||
if (this.amount = I, this.baseAsset = i, this.quoteAsset = n, o !== void 0) | ||
this.unitPrice = o, this.price = I.assetAmount.multipliedBy(o); | ||
else { | ||
@@ -396,3 +407,3 @@ if (!A) | ||
} | ||
this.price = this.unitPrice.multipliedBy(O.assetAmount); | ||
this.price = this.unitPrice.multipliedBy(I.assetAmount); | ||
} | ||
@@ -412,17 +423,17 @@ } | ||
toAbbreviateRaw(i = 2) { | ||
return r.fromAssetAmount(this.price, 8).toAbbreviate(i); | ||
return a.fromAssetAmount(this.price, 8).toAbbreviate(i); | ||
} | ||
toFixedRaw(i = 8, n = I, o = l.ROUND_DOWN) { | ||
return r.fromAssetAmount(this.price, 8).toFixed(i, n, o); | ||
toFixedRaw(i = 8, n = N, o = l.ROUND_DOWN) { | ||
return a.fromAssetAmount(this.price, 8).toFixed(i, n, o); | ||
} | ||
toFixedInverted(i = 8, n = I, o = l.ROUND_DOWN) { | ||
return r.fromAssetAmount(this.invert(), 8).toFixed(i, n, o); | ||
toFixedInverted(i = 8, n = N, o = l.ROUND_DOWN) { | ||
return a.fromAssetAmount(this.invert(), 8).toFixed(i, n, o); | ||
} | ||
} | ||
class N extends r { | ||
class O extends a { | ||
constructor(i, n) { | ||
super(n.assetAmount, _.ASSET_AMOUNT, n.decimal); | ||
super(n.assetAmount, u.ASSET_AMOUNT, n.decimal); | ||
c(this, "asset"); | ||
c(this, "amount"); | ||
this.asset = i, this.amount = new r(n.assetAmount, _.ASSET_AMOUNT, n.decimal); | ||
this.asset = i, this.amount = new a(n.assetAmount, u.ASSET_AMOUNT, n.decimal); | ||
} | ||
@@ -432,3 +443,3 @@ add(i) { | ||
throw new Error("asset must be same"); | ||
return new N(this.asset, this.amount.add(i.amount)); | ||
return new O(this.asset, this.amount.add(i.amount)); | ||
} | ||
@@ -438,23 +449,23 @@ sub(i) { | ||
throw new Error("asset must be same"); | ||
return new N(this.asset, this.amount.sub(i.amount)); | ||
return new O(this.asset, this.amount.sub(i.amount)); | ||
} | ||
mul(i) { | ||
let n; | ||
return i instanceof r ? n = new r( | ||
return i instanceof a ? n = new a( | ||
this.assetAmount.multipliedBy(i.assetAmount), | ||
_.ASSET_AMOUNT, | ||
u.ASSET_AMOUNT, | ||
this.decimal | ||
) : n = new r( | ||
) : n = new a( | ||
this.assetAmount.multipliedBy(i), | ||
_.ASSET_AMOUNT, | ||
u.ASSET_AMOUNT, | ||
this.decimal | ||
), new N(this.asset, n); | ||
), new O(this.asset, n); | ||
} | ||
div(i) { | ||
let n; | ||
return i instanceof r ? n = new r( | ||
return i instanceof a ? n = new a( | ||
this.assetAmount.dividedBy(i.assetAmount), | ||
_.ASSET_AMOUNT, | ||
u.ASSET_AMOUNT, | ||
this.decimal | ||
) : n = new r(this.assetAmount.dividedBy(i), _.ASSET_AMOUNT, this.decimal), new N(this.asset, n); | ||
) : n = new a(this.assetAmount.dividedBy(i), u.ASSET_AMOUNT, this.decimal), new O(this.asset, n); | ||
} | ||
@@ -467,3 +478,3 @@ toCurrencyFormat({ | ||
significantDigits: 6, | ||
format: I, | ||
format: N, | ||
rounding: l.ROUND_DOWN | ||
@@ -479,3 +490,3 @@ }, A = !1) { | ||
pools: n, | ||
priceAmount: r.fromAssetAmount(this.assetAmount, this.decimal) | ||
priceAmount: a.fromAssetAmount(this.assetAmount, this.decimal) | ||
}); | ||
@@ -498,3 +509,3 @@ } | ||
) : 1; | ||
return new N(s, r.fromBaseAmount(i, s.decimal)); | ||
return new O(s, a.fromBaseAmount(i, s.decimal)); | ||
}; | ||
@@ -508,3 +519,3 @@ class M { | ||
c(this, "detail"); | ||
this.asset = s, this.runeDepth = i, this.assetDepth = n, this.detail = o, this.assetUSDPrice = r.fromAssetAmount(o.assetPriceUSD, u.THOR); | ||
this.asset = s, this.runeDepth = i, this.assetDepth = n, this.detail = o, this.assetUSDPrice = a.fromAssetAmount(o.assetPriceUSD, _.THOR); | ||
} | ||
@@ -514,4 +525,4 @@ static fromPoolData(s) { | ||
if (A && n && o) { | ||
const m = r.fromBaseAmount(n, u.THOR), O = r.fromBaseAmount(o, u.THOR); | ||
return new M(A, m, O, s); | ||
const m = a.fromBaseAmount(n, _.THOR), I = a.fromBaseAmount(o, _.THOR); | ||
return new M(A, m, I, s); | ||
} | ||
@@ -528,7 +539,7 @@ return null; | ||
export { | ||
r as Amount, | ||
_ as AmountType, | ||
N as AssetAmount, | ||
a as Amount, | ||
u as AmountType, | ||
O as AssetAmount, | ||
S as AssetEntity, | ||
I as BN_FORMAT, | ||
N as BN_FORMAT, | ||
y as EMPTY_FORMAT, | ||
@@ -535,0 +546,0 @@ M as Pool, |
@@ -5,3 +5,3 @@ { | ||
"tiny-invariant": "1.3.1", | ||
"@coinmasters/types": "4.7.6" | ||
"@coinmasters/types": "4.7.7" | ||
}, | ||
@@ -14,3 +14,3 @@ "description": "SwapKit Lib swapkit-entities", | ||
"vitest": "0.34.6", | ||
"@internal/config": "2.7.6" | ||
"@internal/config": "2.7.7" | ||
}, | ||
@@ -46,3 +46,3 @@ "eslintConfig": { | ||
"types": "./dist/index.d.ts", | ||
"version": "3.7.6", | ||
"version": "3.7.7", | ||
"scripts": { | ||
@@ -49,0 +49,0 @@ "build": "vite build", |
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
1491
123063
+ Added@coinmasters/types@4.7.7(transitive)
- Removed@coinmasters/types@4.7.6(transitive)
Updated@coinmasters/types@4.7.7