@coinmasters/swapkit-entities
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -8,3 +8,3 @@ var H = Object.defineProperty; | ||
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.Maya = "MAYA", t.Optimism = "OP", t.Osmosis = "OSMO", t.Polygon = "MATIC", t.Ripple = "XRP", t.THORChain = "THOR", t.Zcash = "ZEC", t))(e || {}); | ||
const V = { | ||
const v = { | ||
ARB: "eip155:42161", | ||
@@ -34,5 +34,5 @@ AVAX: "eip155:43114", | ||
for (const t in e) | ||
V[e[t]], e[t]; | ||
var m = /* @__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.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))(m || {}); | ||
const C = [ | ||
v[e[t]], e[t]; | ||
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.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 p = [ | ||
"ETH", | ||
@@ -47,6 +47,6 @@ "AVAX", | ||
]; | ||
var U = /* @__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.Maya = "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))(U || {}), b = /* @__PURE__ */ ((t) => (t.Arbitrum = "https://arb1.arbitrum.io/rpc", t.Avalanche = "https://node-router.thorswap.net/avalanche-c", t.Binance = "https://base.llamarpc.com", t.BinanceSmartChain = "https://bsc-dataseed.binance.org", t.Base = "https://base.llamarpc.com", 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://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.Osmosis = "https://rpc-osmosis.keplr.app", t.Polygon = "https://polygon-rpc.com", t.THORChain = "https://rpc.thorswap.net", t.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", t))(b || {}); | ||
const p = Object.values(e), v = Object.keys(e), f = p.reduce( | ||
var U = /* @__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.Maya = "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))(U || {}), M = /* @__PURE__ */ ((t) => (t.Arbitrum = "https://arb1.arbitrum.io/rpc", t.Avalanche = "https://node-router.thorswap.net/avalanche-c", t.Binance = "https://base.llamarpc.com", t.BinanceSmartChain = "https://bsc-dataseed.binance.org", t.Base = "https://base.llamarpc.com", 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://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.Osmosis = "https://lcd-osmosis.keplr.app", t.Polygon = "https://polygon-rpc.com", t.Ripple = "https://xrplcluster.com", t.THORChain = "https://rpc.thorswap.net", t.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", t))(M || {}); | ||
const l = Object.values(e), V = Object.keys(e), f = l.reduce( | ||
(t, s) => { | ||
const i = v.find((n) => e[n] === s); | ||
const i = V.find((n) => e[n] === s); | ||
return i && (t[s] = i), t; | ||
@@ -56,11 +56,11 @@ }, | ||
); | ||
p.reduce( | ||
l.reduce( | ||
(t, s) => (t[s] = U[f[s]], t), | ||
{} | ||
); | ||
p.reduce( | ||
(t, s) => (t[s] = b[f[s]], t), | ||
l.reduce( | ||
(t, s) => (t[s] = M[f[s]], t), | ||
{} | ||
); | ||
p.reduce( | ||
l.reduce( | ||
(t, s) => { | ||
@@ -72,3 +72,3 @@ const i = `${f[s]}Hex`; | ||
); | ||
const d = [ | ||
const C = [ | ||
e.Arbitrum, | ||
@@ -81,3 +81,6 @@ e.Avalanche, | ||
e.Cosmos, | ||
e.Osmosis, | ||
e.Ripple, | ||
e.Dogecoin, | ||
e.Dash, | ||
e.Ethereum, | ||
@@ -89,4 +92,4 @@ e.Litecoin, | ||
]; | ||
e.Cosmos, e.Bitcoin, e.BitcoinCash, e.Litecoin, e.Dogecoin, 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.Ethereum, e.Binance, e.BinanceSmartChain, e.Avalanche, e.THORChain, 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 || {}); | ||
e.Cosmos, e.Arbitrum, 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.BinanceSmartChain, e.Bitcoin, e.BitcoinCash, e.Cosmos, e.Dogecoin, e.Ethereum, e.Litecoin, e.Optimism, e.Polygon, e.THORChain, e.Ethereum, e.Binance, e.BinanceSmartChain, e.Avalanche, e.THORChain, e.Ethereum, e.Avalanche, e.BinanceSmartChain, e.Bitcoin, e.Cosmos; | ||
var d = /* @__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))(d || {}), u = /* @__PURE__ */ ((t) => (t[t.BASE_AMOUNT = 0] = "BASE_AMOUNT", t[t.ASSET_AMOUNT = 1] = "ASSET_AMOUNT", t))(u || {}); | ||
const B = { | ||
@@ -96,3 +99,3 @@ 0: E.ROUND_DOWN, | ||
2: E.ROUND_UP | ||
}, F = { | ||
}, y = { | ||
groupSeparator: "", | ||
@@ -120,3 +123,3 @@ decimalSeparator: "." | ||
static fromMidgard(s) { | ||
return new a(s || 0, 0, m.THOR); | ||
return new a(s || 0, 0, _.THOR); | ||
} | ||
@@ -183,3 +186,3 @@ static fromBaseAmount(s, i) { | ||
} | ||
toFixedDecimal(s = 8, i = F, n = 0) { | ||
toFixedDecimal(s = 8, i = y, n = 0) { | ||
if (!Number.isInteger(s)) | ||
@@ -205,6 +208,6 @@ throw new Error(`${s} is not an integer.`); | ||
new E( | ||
this.baseAmount.dividedBy(10 ** this.decimal).multipliedBy(10 ** m.THOR).toFixed() | ||
this.baseAmount.dividedBy(10 ** this.decimal).multipliedBy(10 ** _.THOR).toFixed() | ||
), | ||
0, | ||
m.THOR | ||
_.THOR | ||
); | ||
@@ -232,5 +235,5 @@ } | ||
c(this, "setDecimal", (s) => { | ||
this.decimal = s || m[this.chain] || m.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 ? m.THOR : m[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; | ||
} | ||
@@ -241,4 +244,4 @@ static fromAssetString(s) { | ||
return null; | ||
const i = s.includes("/"), [n, ...o] = s.split(i ? "/" : "."), A = o.join("."), R = (h = A == null ? void 0 : A.split("-")) == null ? void 0 : h[0]; | ||
return n && A && R ? new T(n, A, i) : null; | ||
const i = s.includes("/"), [n, ...o] = s.split(i ? "/" : "."), A = o.join("."), m = (h = A == null ? void 0 : A.split("-")) == null ? void 0 : h[0]; | ||
return n && A && m ? new T(n, A, i) : null; | ||
} | ||
@@ -295,5 +298,5 @@ getAssetObj() { | ||
let S = T; | ||
const G = "THOR-0xa5f2211B9b8170F694421f2046281775E8468044", y = "VTHOR-0x815C23eCA83261b6Ec689b60Cc4a58b54BC24D8D", _ = {}, P = (t, s = !1) => { | ||
if (_[t]) | ||
return _[t]; | ||
const F = "THOR-0xa5f2211B9b8170F694421f2046281775E8468044", G = "VTHOR-0x815C23eCA83261b6Ec689b60Cc4a58b54BC24D8D", R = {}, P = (t, s = !1) => { | ||
if (R[t]) | ||
return R[t]; | ||
switch (t) { | ||
@@ -308,3 +311,3 @@ case e.Avalanche: | ||
const i = new S(t, t, s); | ||
return _[t] = i, i; | ||
return R[t] = i, i; | ||
} | ||
@@ -314,31 +317,31 @@ case e.Optimism: | ||
const i = new S(t, e.Ethereum, s); | ||
return i.setDecimal(18), _[t] = i, i; | ||
return i.setDecimal(18), R[t] = i, i; | ||
} | ||
case e.BinanceSmartChain: { | ||
const i = new S(t, e.Binance, s); | ||
return i.setDecimal(18), _[t] = i, i; | ||
return i.setDecimal(18), R[t] = i, i; | ||
} | ||
case e.Polygon: { | ||
const i = new S(t, t, s); | ||
return i.setDecimal(18), _[t] = i, i; | ||
return i.setDecimal(18), R[t] = i, i; | ||
} | ||
case e.Cosmos: { | ||
const i = new S(t, "ATOM", s, "ATOM"); | ||
return _[t] = i, i; | ||
return R[t] = i, i; | ||
} | ||
case e.THORChain: { | ||
const i = new S(e.THORChain, "RUNE", s, "RUNE"); | ||
return _[t] = i, i; | ||
return R[t] = i, i; | ||
} | ||
case "USD": { | ||
const i = new S(e.THORChain, "USD-USD", s, "USD-USD"); | ||
return _[t] = i, i; | ||
return R[t] = i, i; | ||
} | ||
case "ETH_THOR": { | ||
const i = new S(e.Ethereum, G, s); | ||
return i.setDecimal(18), _[t] = i, i; | ||
const i = new S(e.Ethereum, F, s); | ||
return i.setDecimal(18), R[t] = i, i; | ||
} | ||
case "ETH_VTHOR": { | ||
const i = new S(e.Ethereum, y, s); | ||
return i.setDecimal(18), _[t] = i, i; | ||
const i = new S(e.Ethereum, G, s); | ||
return i.setDecimal(18), R[t] = i, i; | ||
} | ||
@@ -355,6 +358,6 @@ default: | ||
pools: A, | ||
priceAmount: R | ||
priceAmount: m | ||
}) { | ||
const I = a.fromAssetAmount( | ||
R ? R.assetAmount : 1, | ||
m ? m.assetAmount : 1, | ||
i.decimal | ||
@@ -381,5 +384,5 @@ ); | ||
} else if (!i.isRUNE() && !n.isRUNE()) { | ||
const h = D(i, A), M = D(n, A); | ||
h && M && (this.unitPrice = h.assetPriceInRune.div( | ||
M.assetPriceInRune | ||
const h = D(i, A), b = D(n, A); | ||
h && b && (this.unitPrice = h.assetPriceInRune.div( | ||
b.assetPriceInRune | ||
).assetAmount); | ||
@@ -405,5 +408,5 @@ } else | ||
toCurrencyFormat(i = 8, n = !0) { | ||
var R; | ||
var m; | ||
const o = n ? this.toAbbreviateRaw(i) : this.toFixedRaw(i); | ||
return !this.quoteAsset || this.quoteAsset.ticker === "USD" ? `$${o}` : `${o} ${(R = this.quoteAsset) == null ? void 0 : R.ticker}`; | ||
return !this.quoteAsset || this.quoteAsset.ticker === "USD" ? `$${o}` : `${o} ${(m = this.quoteAsset) == null ? void 0 : m.ticker}`; | ||
} | ||
@@ -413,6 +416,6 @@ toAbbreviateRaw(i = 2) { | ||
} | ||
toFixedRaw(i = 8, n = N, o = l.ROUND_DOWN) { | ||
toFixedRaw(i = 8, n = N, o = d.ROUND_DOWN) { | ||
return a.fromAssetAmount(this.price, 8).toFixed(i, n, o); | ||
} | ||
toFixedInverted(i = 8, n = N, o = l.ROUND_DOWN) { | ||
toFixedInverted(i = 8, n = N, o = d.ROUND_DOWN) { | ||
return a.fromAssetAmount(this.invert(), 8).toFixed(i, n, o); | ||
@@ -465,6 +468,6 @@ } | ||
format: N, | ||
rounding: l.ROUND_DOWN | ||
rounding: d.ROUND_DOWN | ||
}, A = !1) { | ||
const R = super.toSignificant(i, 8, n, o); | ||
return A ? `${this.asset.ticker} ${R}` : `${R} ${this.asset.ticker}`; | ||
const m = super.toSignificant(i, 8, n, o); | ||
return A ? `${this.asset.ticker} ${m}` : `${m} ${this.asset.ticker}`; | ||
} | ||
@@ -503,3 +506,3 @@ totalPriceIn(i, n) { | ||
c(this, "detail"); | ||
this.asset = s, this.runeDepth = i, this.assetDepth = n, this.detail = o, this.assetUSDPrice = a.fromAssetAmount(o.assetPriceUSD, m.THOR); | ||
this.asset = s, this.runeDepth = i, this.assetDepth = n, this.detail = o, this.assetUSDPrice = a.fromAssetAmount(o.assetPriceUSD, _.THOR); | ||
} | ||
@@ -509,4 +512,4 @@ static fromPoolData(s) { | ||
if (A && n && o) { | ||
const R = a.fromBaseAmount(n, m.THOR), I = a.fromBaseAmount(o, m.THOR); | ||
return new L(A, R, I, s); | ||
const m = a.fromBaseAmount(n, _.THOR), I = a.fromBaseAmount(o, _.THOR); | ||
return new L(A, m, I, s); | ||
} | ||
@@ -528,6 +531,6 @@ return null; | ||
N as BN_FORMAT, | ||
F as EMPTY_FORMAT, | ||
y as EMPTY_FORMAT, | ||
L as Pool, | ||
g as Price, | ||
l as Rounding, | ||
d as Rounding, | ||
k as formatBigNumber, | ||
@@ -534,0 +537,0 @@ q as getMinAmountByChain, |
@@ -5,3 +5,3 @@ { | ||
"tiny-invariant": "1.3.1", | ||
"@coinmasters/types": "4.1.0" | ||
"@coinmasters/types": "4.2.0" | ||
}, | ||
@@ -14,3 +14,3 @@ "description": "SwapKit Lib swapkit-entities", | ||
"vitest": "0.34.6", | ||
"@internal/config": "2.1.0" | ||
"@internal/config": "2.2.0" | ||
}, | ||
@@ -46,3 +46,3 @@ "eslintConfig": { | ||
"types": "./dist/index.d.ts", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"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
98371
1480
+ Added@coinmasters/types@4.2.0(transitive)
- Removed@coinmasters/types@4.1.0(transitive)
Updated@coinmasters/types@4.2.0