@coinmasters/swapkit-entities
Advanced tools
Comparing version 3.4.2 to 3.4.3
@@ -1,4 +0,4 @@ | ||
var H = Object.defineProperty; | ||
var L = (t, s, e) => s in t ? H(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e; | ||
var c = (t, s, e) => (L(t, typeof s != "symbol" ? s + "" : s, e), e); | ||
var L = Object.defineProperty; | ||
var H = (t, s, e) => s in t ? L(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e; | ||
var c = (t, s, e) => (H(t, typeof s != "symbol" ? s + "" : s, e), e); | ||
import { BigNumber as E } from "bignumber.js"; | ||
@@ -34,3 +34,3 @@ 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 || {}); | ||
w[i[t]], i[t]; | ||
var O = /* @__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))(O || {}); | ||
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 || {}); | ||
const p = [ | ||
@@ -46,4 +46,4 @@ "ETH", | ||
]; | ||
var l = /* @__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))(l || {}), 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://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))(b || {}); | ||
const C = Object.values(i), v = Object.keys(i), U = C.reduce( | ||
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://rpc.thorswap.net", t.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", t))(b || {}); | ||
const l = Object.values(i), v = Object.keys(i), U = l.reduce( | ||
(t, s) => { | ||
@@ -55,18 +55,17 @@ const e = v.find((n) => i[n] === s); | ||
); | ||
C.reduce( | ||
(t, s) => (t[s] = l[U[s]], t), | ||
l.reduce( | ||
(t, s) => (t[s] = B[U[s]], t), | ||
{} | ||
); | ||
C.reduce( | ||
l.reduce( | ||
(t, s) => (t[s] = b[U[s]], t), | ||
{} | ||
); | ||
C.reduce( | ||
l.reduce( | ||
(t, s) => { | ||
const e = `${U[s]}Hex`; | ||
return t[s] = l[e], t; | ||
return t[s] = B[e], t; | ||
}, | ||
{} | ||
); | ||
l.Maya + ""; | ||
const V = [ | ||
@@ -91,4 +90,4 @@ i.Arbitrum, | ||
i.Cosmos, i.Arbitrum, i.Base, i.Avalanche, i.Binance, i.BinanceSmartChain, i.Bitcoin, i.BitcoinCash, i.Cosmos, i.Dogecoin, i.Ethereum, i.Litecoin, i.Optimism, i.Polygon, i.THORChain, i.Bitcoin, i.BitcoinCash, i.Litecoin, i.Dogecoin, i.Ethereum, i.Arbitrum, i.Avalanche, i.Binance, i.BinanceSmartChain, i.Bitcoin, i.BitcoinCash, i.Cosmos, i.Osmosis, i.Ripple, i.Dogecoin, i.Dash, i.Mayachain, i.Ethereum, i.Litecoin, i.Optimism, i.Polygon, i.THORChain, i.Arbitrum, i.Avalanche, i.BinanceSmartChain, i.Bitcoin, i.BitcoinCash, i.Cosmos, i.Dogecoin, i.Ethereum, i.Litecoin, i.Optimism, i.Polygon, i.THORChain, i.Arbitrum, i.Avalanche, i.Binance, i.BinanceSmartChain, i.Bitcoin, i.BitcoinCash, i.Cosmos, i.Ripple, i.Dogecoin, i.Ethereum, i.Litecoin, i.Optimism, i.Polygon, i.THORChain, i.Ethereum, i.Binance, i.BinanceSmartChain, i.Avalanche, i.THORChain, i.Ethereum, i.Avalanche, i.BinanceSmartChain, i.Bitcoin, i.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 = { | ||
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 || {}), _ = /* @__PURE__ */ ((t) => (t[t.BASE_AMOUNT = 0] = "BASE_AMOUNT", t[t.ASSET_AMOUNT = 1] = "ASSET_AMOUNT", t))(_ || {}); | ||
const C = { | ||
0: E.ROUND_DOWN, | ||
@@ -120,3 +119,3 @@ 1: E.ROUND_HALF_UP, | ||
static fromMidgard(s) { | ||
return new r(s || 0, 0, O.THOR); | ||
return new r(s || 0, 0, u.THOR); | ||
} | ||
@@ -188,3 +187,3 @@ static fromBaseAmount(s, e) { | ||
throw new Error(`${s} is not positive.`); | ||
return E.config({ FORMAT: e }), new E(this.assetAmount.toFixed(s, B[n])).toFormat(); | ||
return E.config({ FORMAT: e }), new E(this.assetAmount.toFixed(s, C[n])).toFormat(); | ||
} | ||
@@ -205,6 +204,6 @@ toFixed(s = 8, e = I, n = 0) { | ||
new E( | ||
this.baseAmount.dividedBy(10 ** this.decimal).multipliedBy(10 ** O.THOR).toFixed() | ||
this.baseAmount.dividedBy(10 ** this.decimal).multipliedBy(10 ** u.THOR).toFixed() | ||
), | ||
0, | ||
O.THOR | ||
u.THOR | ||
); | ||
@@ -217,6 +216,6 @@ } | ||
throw new Error(`${s} is not positive.`); | ||
return E.config({ FORMAT: e }), new E(this.assetAmount.toPrecision(s, B[n])); | ||
return E.config({ FORMAT: e }), new E(this.assetAmount.toPrecision(s, C[n])); | ||
} | ||
} | ||
const Y = (t, s = 8, e = 0) => (E.config({ FORMAT: I }), new E(t.toFixed(s, B[e])).toFormat()), T = class T { | ||
const $ = (t, s = 8, e = 0) => (E.config({ FORMAT: I }), new E(t.toFixed(s, C[e])).toFormat()), T = class T { | ||
constructor(s, e, n = !1, o) { | ||
@@ -233,5 +232,5 @@ c(this, "chain"); | ||
c(this, "setDecimal", (s) => { | ||
this.decimal = s || O[this.chain] || O.THOR; | ||
this.decimal = s || u[this.chain] || u.THOR; | ||
}); | ||
this.chain = s, this.symbol = e.toUpperCase(), this.ticker = o || e.toUpperCase().split("-")[0], this.type = "Broken - MIGRATION", this.name = n ? `Synth ${this.ticker}` : this.ticker, this.network = "Broken - MIGRATION", this.decimal = n ? O.THOR : O[s], this.isSynth = n, this.L1Chain = n ? i.THORChain : s; | ||
this.chain = s, this.symbol = e.toUpperCase(), this.ticker = o || e.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 ? i.THORChain : s; | ||
} | ||
@@ -295,3 +294,3 @@ static fromAssetString(s) { | ||
let S = T; | ||
const G = "THOR-0xa5f2211B9b8170F694421f2046281775E8468044", F = "VTHOR-0x815C23eCA83261b6Ec689b60Cc4a58b54BC24D8D", R = {}, f = (t, s = !1) => { | ||
const F = "THOR-0xa5f2211B9b8170F694421f2046281775E8468044", G = "VTHOR-0x815C23eCA83261b6Ec689b60Cc4a58b54BC24D8D", R = {}, f = (t, s = !1) => { | ||
if (R[t]) | ||
@@ -336,7 +335,7 @@ return R[t]; | ||
case "ETH_THOR": { | ||
const e = new S(i.Ethereum, G, s); | ||
const e = new S(i.Ethereum, F, s); | ||
return e.setDecimal(18), R[t] = e, e; | ||
} | ||
case "ETH_VTHOR": { | ||
const e = new S(i.Ethereum, F, s); | ||
const e = new S(i.Ethereum, G, s); | ||
return e.setDecimal(18), R[t] = e, e; | ||
@@ -347,3 +346,3 @@ } | ||
} | ||
}, $ = (t) => t.eq(f(t.chain)), D = (t, s) => s.find((e) => t.shallowEq(e.asset)); | ||
}, Y = (t) => t.eq(f(t.chain)), D = (t, s) => s.find((e) => t.shallowEq(e.asset)); | ||
class g extends r { | ||
@@ -357,7 +356,7 @@ constructor({ | ||
}) { | ||
const _ = r.fromAssetAmount( | ||
const O = r.fromAssetAmount( | ||
m ? m.assetAmount : 1, | ||
e.decimal | ||
); | ||
super(_.assetAmount, u.ASSET_AMOUNT, e.decimal); | ||
super(O.assetAmount, _.ASSET_AMOUNT, e.decimal); | ||
c(this, "baseAsset"); | ||
@@ -368,4 +367,4 @@ c(this, "quoteAsset"); | ||
c(this, "amount"); | ||
if (this.amount = _, this.baseAsset = e, this.quoteAsset = n, o !== void 0) | ||
this.unitPrice = o, this.price = _.assetAmount.multipliedBy(o); | ||
if (this.amount = O, this.baseAsset = e, this.quoteAsset = n, o !== void 0) | ||
this.unitPrice = o, this.price = O.assetAmount.multipliedBy(o); | ||
else { | ||
@@ -395,3 +394,3 @@ if (!A) | ||
} | ||
this.price = this.unitPrice.multipliedBy(_.assetAmount); | ||
this.price = this.unitPrice.multipliedBy(O.assetAmount); | ||
} | ||
@@ -422,6 +421,6 @@ } | ||
constructor(e, n) { | ||
super(n.assetAmount, u.ASSET_AMOUNT, n.decimal); | ||
super(n.assetAmount, _.ASSET_AMOUNT, n.decimal); | ||
c(this, "asset"); | ||
c(this, "amount"); | ||
this.asset = e, this.amount = new r(n.assetAmount, u.ASSET_AMOUNT, n.decimal); | ||
this.asset = e, this.amount = new r(n.assetAmount, _.ASSET_AMOUNT, n.decimal); | ||
} | ||
@@ -442,7 +441,7 @@ add(e) { | ||
this.assetAmount.multipliedBy(e.assetAmount), | ||
u.ASSET_AMOUNT, | ||
_.ASSET_AMOUNT, | ||
this.decimal | ||
) : n = new r( | ||
this.assetAmount.multipliedBy(e), | ||
u.ASSET_AMOUNT, | ||
_.ASSET_AMOUNT, | ||
this.decimal | ||
@@ -455,5 +454,5 @@ ), new N(this.asset, n); | ||
this.assetAmount.dividedBy(e.assetAmount), | ||
u.ASSET_AMOUNT, | ||
_.ASSET_AMOUNT, | ||
this.decimal | ||
) : n = new r(this.assetAmount.dividedBy(e), u.ASSET_AMOUNT, this.decimal), new N(this.asset, n); | ||
) : n = new r(this.assetAmount.dividedBy(e), _.ASSET_AMOUNT, this.decimal), new N(this.asset, n); | ||
} | ||
@@ -504,3 +503,3 @@ toCurrencyFormat({ | ||
c(this, "detail"); | ||
this.asset = s, this.runeDepth = e, this.assetDepth = n, this.detail = o, this.assetUSDPrice = r.fromAssetAmount(o.assetPriceUSD, O.THOR); | ||
this.asset = s, this.runeDepth = e, this.assetDepth = n, this.detail = o, this.assetUSDPrice = r.fromAssetAmount(o.assetPriceUSD, u.THOR); | ||
} | ||
@@ -510,4 +509,4 @@ static fromPoolData(s) { | ||
if (A && n && o) { | ||
const m = r.fromBaseAmount(n, O.THOR), _ = r.fromBaseAmount(o, O.THOR); | ||
return new M(A, m, _, s); | ||
const m = r.fromBaseAmount(n, u.THOR), O = r.fromBaseAmount(o, u.THOR); | ||
return new M(A, m, O, s); | ||
} | ||
@@ -525,3 +524,3 @@ return null; | ||
r as Amount, | ||
u as AmountType, | ||
_ as AmountType, | ||
N as AssetAmount, | ||
@@ -534,6 +533,6 @@ S as AssetEntity, | ||
d as Rounding, | ||
Y as formatBigNumber, | ||
$ as formatBigNumber, | ||
q as getMinAmountByChain, | ||
f as getSignatureAssetFor, | ||
$ as isGasAsset | ||
Y as isGasAsset | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"tiny-invariant": "1.3.1", | ||
"@coinmasters/types": "4.4.2" | ||
"@coinmasters/types": "4.4.3" | ||
}, | ||
@@ -14,3 +14,3 @@ "description": "SwapKit Lib swapkit-entities", | ||
"vitest": "0.34.6", | ||
"@internal/config": "2.4.2" | ||
"@internal/config": "2.4.3" | ||
}, | ||
@@ -46,3 +46,3 @@ "eslintConfig": { | ||
"types": "./dist/index.d.ts", | ||
"version": "3.4.2", | ||
"version": "3.4.3", | ||
"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
99677
1484
+ Added@coinmasters/types@4.4.3(transitive)
- Removed@coinmasters/types@4.4.2(transitive)
Updated@coinmasters/types@4.4.3