@swapkit/core 1.0.0-rc.92 → 1.0.0-rc.94
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +211 -193
- package/dist/index.es.js.map +1 -1
- package/package.json +13 -11
- package/src/client/types.ts +6 -0
package/dist/index.es.js
CHANGED
|
@@ -4,13 +4,13 @@ var b = (e, t, n) => (rt(e, typeof t != "symbol" ? t + "" : t, n), n), pt = (e,
|
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var A = (e, t, n) => (pt(e, t, "read from private field"), n ? n.call(e) : t.get(e)), V = (e, t, n) => {
|
|
8
8
|
if (t.has(e))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
11
11
|
};
|
|
12
12
|
var ut = Object.defineProperty, yt = (e, t, n) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, N = (e, t, n) => (yt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
-
const
|
|
13
|
+
const Un = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -625,7 +625,7 @@ const Tt = [
|
|
|
625
625
|
/* TC_SUPPORTED_TO_BSC */
|
|
626
626
|
];
|
|
627
627
|
var Ve = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e))(Ve || {}), _t = /* @__PURE__ */ ((e) => (e.HEALTH_CONTROLLER = "1000", e.LIQUIDITY_CONTROLLER = "1001", e.PROVIDER_CONTROLLER = "1002", e.QUOTE_CONTROLLER = "1003", e.SWAP_CONTROLLER = "1004", e.UTIL_CONTROLLER = "1005", e.AIRDROP_CONTROLLER = "1006", e.PROVIDER = "2000", e.ASSET = "2001", e.TOKEN_LIST = "2002", e.QUOTE = "2100", e.QUOTE_TXN_DETAILS = "2101", e.THORCHAIN_PROVIDER = "3000", e.UNISWAPV2_ETH_PROVIDER = "3001", e.UNISWAPV3_ETH_PROVIDER = "3002", e.SUSHISWAP_ETH_PROVIDER = "3003", e.PANCAKESWAP_BSC_PROVIDER = "3004", e.PANCAKESWAP_ETH_PROVIDER = "3005", e.ONEINCH_ETH_PROVIDER = "3006", e.ONEINCH_BSC_PROVIDER = "3007", e.ONEINCH_AVAX_PROVIDER = "3008", e.ZEROX_ETH_PROVIDER = "3009", e.WOOFI_AVAX_PROVIDER = "3010", e.PANGOLIN_AVAX_PROVIDER = "3011", e.TRADERJOE_AVAX_PROVIDER = "3012", e.KYBER_ETH_PROVIDER = "3013", e.KYBER_AVAX_PROVIDER = "3014", e.WOOFI_BSC_PROVIDER = "3015", e.STARGATE_PROVIDER = "3016", e.PROVIDER_UTIL = "4000", e.TXN_DETAILS = "5000", e.AIRDROP_UTIL = "6000", e))(_t || {}), o = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.SWAP_AMOUNT_TOO_LOW = "2012", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(o || {});
|
|
628
|
-
const
|
|
628
|
+
const ft = {
|
|
629
629
|
[o.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
630
|
[o.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
631
|
[o.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
@@ -679,7 +679,7 @@ const At = {
|
|
|
679
679
|
[o.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
680
680
|
[o.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
681
681
|
}, ce = (e, t) => {
|
|
682
|
-
let n =
|
|
682
|
+
let n = ft[e];
|
|
683
683
|
if (!n)
|
|
684
684
|
return "";
|
|
685
685
|
for (let a = 0; a < t.length; a++)
|
|
@@ -728,7 +728,7 @@ let Wn = class He extends Error {
|
|
|
728
728
|
return this.toErrorInfo();
|
|
729
729
|
}
|
|
730
730
|
};
|
|
731
|
-
var s = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}),
|
|
731
|
+
var s = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}), At = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(At || {}), ht = /* @__PURE__ */ ((e) => (e.ARB = "m/44'/60'/0'/0", e.AVAX = "m/44'/60'/0'/0", e.BCH = "m/44'/145'/0'/0", e.BNB = "m/44'/714'/0'/0", e.BSC = "m/44'/60'/0'/0", e.BTC = "m/84'/0'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.DOT = "////", e.ETH = "m/44'/60'/0'/0", e.FLIP = "////", e.GAIA = "m/44'/118'/0'/0", e.KUJI = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.MATIC = "m/44'/60'/0'/0", e.MAYA = "m/44'/931'/0'/0", e.OP = "m/44'/60'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(ht || {});
|
|
732
732
|
const $n = {
|
|
733
733
|
ARB: [44, 60, 0, 0, 0],
|
|
734
734
|
AVAX: [44, 60, 0, 0, 0],
|
|
@@ -744,10 +744,17 @@ const $n = {
|
|
|
744
744
|
MATIC: [44, 60, 0, 0, 0],
|
|
745
745
|
MAYA: [44, 931, 0, 0, 0],
|
|
746
746
|
OP: [44, 60, 0, 0, 0],
|
|
747
|
-
THOR: [44, 931, 0, 0, 0]
|
|
747
|
+
THOR: [44, 931, 0, 0, 0],
|
|
748
|
+
// Polkadot and related network derivation path is not number based
|
|
749
|
+
DOT: [0, 0, 0, 0, 0],
|
|
750
|
+
FLIP: [0, 0, 0, 0, 0]
|
|
748
751
|
};
|
|
749
|
-
var E = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(E || {});
|
|
750
|
-
const
|
|
752
|
+
var E = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.DOT = 10] = "DOT", e[e.ETH = 18] = "ETH", e[e.FLIP = 18] = "FLIP", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(E || {});
|
|
753
|
+
const qn = [
|
|
754
|
+
"DOT",
|
|
755
|
+
"FLIP"
|
|
756
|
+
/* Chainflip */
|
|
757
|
+
], Et = [
|
|
751
758
|
"ETH",
|
|
752
759
|
"AVAX",
|
|
753
760
|
"BSC",
|
|
@@ -755,18 +762,18 @@ const Et = [
|
|
|
755
762
|
"OP",
|
|
756
763
|
"MATIC"
|
|
757
764
|
/* Polygon */
|
|
758
|
-
],
|
|
765
|
+
], Gn = [
|
|
759
766
|
"BTC",
|
|
760
767
|
"BCH",
|
|
761
768
|
"DOGE",
|
|
762
769
|
"LTC"
|
|
763
770
|
/* Litecoin */
|
|
764
|
-
],
|
|
771
|
+
], Xn = [
|
|
765
772
|
"GAIA",
|
|
766
773
|
"THOR",
|
|
767
774
|
"BNB"
|
|
768
775
|
/* Binance */
|
|
769
|
-
],
|
|
776
|
+
], jn = [
|
|
770
777
|
"AVAX",
|
|
771
778
|
"BNB",
|
|
772
779
|
"BSC",
|
|
@@ -779,26 +786,26 @@ const Et = [
|
|
|
779
786
|
"THOR"
|
|
780
787
|
/* THORChain */
|
|
781
788
|
];
|
|
782
|
-
var
|
|
783
|
-
const oe = Object.values(s), Rt = Object.keys(s),
|
|
789
|
+
var we = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Chainflip = "chainflip", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polkadot = "polkadot", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(we || {}), Fe = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Chainflip = "wss://mainnet-archive.chainflip.io", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polkadot = "wss://rpc.polkadot.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(Fe || {}), Q = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(Q || {});
|
|
790
|
+
const oe = Object.values(s), Rt = Object.keys(s), Se = oe.reduce(
|
|
784
791
|
(e, t) => {
|
|
785
792
|
const n = Rt.find((a) => s[a] === t);
|
|
786
793
|
return n && (e[t] = n), e;
|
|
787
794
|
},
|
|
788
795
|
{}
|
|
789
|
-
),
|
|
790
|
-
(e, t) => (e[t] = Se[
|
|
796
|
+
), Ue = oe.reduce(
|
|
797
|
+
(e, t) => (e[t] = we[Se[t]], e),
|
|
791
798
|
{}
|
|
792
799
|
), Ot = oe.reduce(
|
|
793
|
-
(e, t) => (e[t] =
|
|
800
|
+
(e, t) => (e[t] = Fe[Se[t]], e),
|
|
794
801
|
{}
|
|
795
|
-
),
|
|
802
|
+
), Kn = oe.reduce(
|
|
796
803
|
(e, t) => {
|
|
797
|
-
const n = `${
|
|
798
|
-
return e[t] =
|
|
804
|
+
const n = `${Se[t]}Hex`;
|
|
805
|
+
return e[t] = we[n], e;
|
|
799
806
|
},
|
|
800
807
|
{}
|
|
801
|
-
),
|
|
808
|
+
), Yn = {
|
|
802
809
|
"0xa4b1": "ARB",
|
|
803
810
|
42161: "ARB",
|
|
804
811
|
"0xa86a": "AVAX",
|
|
@@ -808,6 +815,7 @@ const oe = Object.values(s), Rt = Object.keys(s), we = oe.reduce(
|
|
|
808
815
|
"Binance-Chain-Tigris": "BNB",
|
|
809
816
|
bitcoincash: "BCH",
|
|
810
817
|
bitcoin: "BTC",
|
|
818
|
+
chainflip: "FLIP",
|
|
811
819
|
"cosmoshub-4": "GAIA",
|
|
812
820
|
dogecoin: "DOGE",
|
|
813
821
|
"0x1": "ETH",
|
|
@@ -818,6 +826,7 @@ const oe = Object.values(s), Rt = Object.keys(s), we = oe.reduce(
|
|
|
818
826
|
"mayachain-mainnet-v1": "MAYA",
|
|
819
827
|
"0xa": "OP",
|
|
820
828
|
10: "OP",
|
|
829
|
+
polkadot: "DOT",
|
|
821
830
|
"0x89": "MATIC",
|
|
822
831
|
137: "MATIC",
|
|
823
832
|
"thorchain-stagenet-v2": "THOR",
|
|
@@ -830,6 +839,7 @@ const oe = Object.values(s), Rt = Object.keys(s), we = oe.reduce(
|
|
|
830
839
|
BNB: "https://explorer.binance.org",
|
|
831
840
|
BCH: "https://www.blockchair.com/bitcoin-cash",
|
|
832
841
|
BTC: "https://blockchair.com/bitcoin",
|
|
842
|
+
FLIP: "https://explorer.polkascan.io/polkadot",
|
|
833
843
|
GAIA: "https://cosmos.bigdipper.live",
|
|
834
844
|
DOGE: "https://blockchair.com/dogecoin",
|
|
835
845
|
KUJI: "https://finder.kujira.network/kaiyo-1",
|
|
@@ -837,10 +847,11 @@ const oe = Object.values(s), Rt = Object.keys(s), we = oe.reduce(
|
|
|
837
847
|
LTC: "https://blockchair.com/litecoin",
|
|
838
848
|
MAYA: "https://www.mayascan.org",
|
|
839
849
|
OP: "https://optimistic.etherscan.io",
|
|
850
|
+
DOT: "https://explorer.polkascan.io/polkadot",
|
|
840
851
|
MATIC: "https://polygonscan.com",
|
|
841
852
|
THOR: "https://runescan.io"
|
|
842
853
|
};
|
|
843
|
-
var
|
|
854
|
+
var f = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(f || {}), X = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(X || {}), wt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.KEEPKEY = "KEEPKEY", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.OKX_MOBILE = "OKX_MOBILE", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(wt || {}), St = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(St || {}), Mt = Object.defineProperty, It = (e, t, n) => t in e ? Mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (It(e, typeof t != "symbol" ? t + "" : t, n), n), gt = (e, t, n) => {
|
|
844
855
|
if (!t.has(e))
|
|
845
856
|
throw TypeError("Cannot " + n);
|
|
846
857
|
}, q = (e, t, n) => {
|
|
@@ -849,7 +860,7 @@ var A = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LE
|
|
|
849
860
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
850
861
|
}, M = (e, t, n) => (gt(e, t, "access private method"), n), d = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.SWAP_AMOUNT_TOO_LOW = "2012", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(d || {});
|
|
851
862
|
d.INVALID_INPUT_PARAMETERS + "", d.UNKNOWN_PROVIDERS + "", d.CANNOT_FIND_INBOUND_ADDRESS + "", d.NO_INBOUND_ADDRESSES + "", d.CHAIN_HALTED_OR_UNSUPPORTED + "", d.MISSING_INPUT_PARAMETER + "", d.INVALID_TYPE_GENERIC + "", d.INVALID_NUMBER_STRING + "", d.INVALID_NUMBER + "", d.INVALID_BOOLEAN + "", d.INVALID_OBJECT + "", d.INVALID_ARRAY + "", d.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", d.SELL_BUY_ASSETS_ARE_THE_SAME + "", d.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", d.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", d.AFF_ADDRESS_TOO_LONG + "", d.AFF_BPS_INTEGER_MAX_500 + "", d.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", d.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", d.PREFERRED_PROVIDER_NOT_SUPPORTED + "", d.SOURCE_ADDRESS_SMART_CONTRACT + "", d.SWAP_AMOUNT_TOO_LOW + "", d.DESTINATION_ADDRESS_SMART_CONTRACT + "", d.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", d.INVALID_PROVIDER + "", d.MISSING_CROSS_CHAIN_PROVIDER + "", d.MISSING_AVAX_PROVIDER + "", d.MISSING_BSC_PROVIDER + "", d.MISSING_ETH_PROVIDER + "", d.MISSING_ARB_PROVIDER + "", d.INVALID_PROVIDER_FOR_SWAP_OUT + "", d.INVALID_CHAIN + "", d.INVALID_ASSET + "", d.UNSUPPORTED_CHAIN + "", d.UNSUPPORTED_ASSET + "", d.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", d.THORNODE_QUOTE_GENERIC_ERROR + "", d.INVALID_SOURCE_ADDRESS + "", d.INVALID_DESTINATION_ADDRESS + "", d.NOT_ENOUGH_SYNTH_BALANCE + "", d.SYNTH_MINTING_CAP_REACHED + "", d.INVALID_QUOTE_MODE + "", d.NO_QUOTES + "", d.SERVICE_UNAVAILABLE_GENERIC + "", d.MISSING_GAS_DATA_GENERIC + "", d.MISSING_TOKEN_INFO_GENERIC + "", d.CANT_FIND_TOKEN_LIST + "", d.NO_PRICE + "", d.PRICE_IS_STALE + "", d.ADDRESS_NOT_WHITELISTED + "", d.ADDRESS_ALREADY_CLAIMED + "";
|
|
852
|
-
var de = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(de || {}), Me = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(Me || {}), $e = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))($e || {}), L = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(L || {});
|
|
863
|
+
var de = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(de || {}), Me = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Chainflip = "chainflip", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polkadot = "polkadot", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(Me || {}), $e = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Chainflip = "wss://mainnet-archive.chainflip.io", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polkadot = "wss://rpc.polkadot.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))($e || {}), L = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(L || {});
|
|
853
864
|
const le = Object.values(de), Ct = Object.keys(de), Ie = le.reduce(
|
|
854
865
|
(e, t) => {
|
|
855
866
|
const n = Ct.find((a) => de[a] === t);
|
|
@@ -935,13 +946,13 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
935
946
|
return e = !0, "half";
|
|
936
947
|
}
|
|
937
948
|
}).headers.has("Content-Type")), e && !t;
|
|
938
|
-
})(), Nt = typeof globalThis.AbortController == "function", Dt = typeof globalThis.ReadableStream == "function",
|
|
949
|
+
})(), Nt = typeof globalThis.AbortController == "function", Dt = typeof globalThis.ReadableStream == "function", Pt = typeof globalThis.FormData == "function", Xe = ["get", "post", "put", "patch", "head", "delete"], kt = {
|
|
939
950
|
json: "application/json",
|
|
940
951
|
text: "text/*",
|
|
941
952
|
formData: "multipart/form-data",
|
|
942
953
|
arrayBuffer: "*/*",
|
|
943
954
|
blob: "*/*"
|
|
944
|
-
}, be = 2147483647, je = Symbol("stop"),
|
|
955
|
+
}, be = 2147483647, je = Symbol("stop"), xt = {
|
|
945
956
|
json: !0,
|
|
946
957
|
parseJson: !0,
|
|
947
958
|
searchParams: !0,
|
|
@@ -976,7 +987,7 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
976
987
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
977
988
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
978
989
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
979
|
-
},
|
|
990
|
+
}, Ft = (e = {}) => {
|
|
980
991
|
if (typeof e == "number")
|
|
981
992
|
return {
|
|
982
993
|
...ve,
|
|
@@ -992,7 +1003,7 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
992
1003
|
afterStatusCodes: Ke
|
|
993
1004
|
};
|
|
994
1005
|
};
|
|
995
|
-
async function
|
|
1006
|
+
async function Ut(e, t, n, a) {
|
|
996
1007
|
return new Promise((i, r) => {
|
|
997
1008
|
const p = setTimeout(() => {
|
|
998
1009
|
n && n.abort(), r(new qe(e));
|
|
@@ -1016,7 +1027,7 @@ async function Wt(e, { signal: t }) {
|
|
|
1016
1027
|
const $t = (e, t) => {
|
|
1017
1028
|
const n = {};
|
|
1018
1029
|
for (const a in t)
|
|
1019
|
-
!(a in Bt) && !(a in
|
|
1030
|
+
!(a in Bt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
|
|
1020
1031
|
return n;
|
|
1021
1032
|
};
|
|
1022
1033
|
class re {
|
|
@@ -1045,7 +1056,7 @@ class re {
|
|
|
1045
1056
|
}
|
|
1046
1057
|
return p;
|
|
1047
1058
|
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(i) : i();
|
|
1048
|
-
for (const [p, u] of Object.entries(
|
|
1059
|
+
for (const [p, u] of Object.entries(kt))
|
|
1049
1060
|
r[p] = async () => {
|
|
1050
1061
|
a.request.headers.set("accept", a.request.headers.get("accept") || u);
|
|
1051
1062
|
const y = (await r).clone();
|
|
@@ -1100,7 +1111,7 @@ class re {
|
|
|
1100
1111
|
method: Lt(n.method ?? this._input.method),
|
|
1101
1112
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1102
1113
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1103
|
-
retry:
|
|
1114
|
+
retry: Ft(n.retry),
|
|
1104
1115
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1105
1116
|
timeout: n.timeout ?? 1e4,
|
|
1106
1117
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1122,7 +1133,7 @@ class re {
|
|
|
1122
1133
|
}
|
|
1123
1134
|
if (vt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1124
1135
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1125
|
-
(
|
|
1136
|
+
(Pt && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(i, { ...this.request }), this._options);
|
|
1126
1137
|
}
|
|
1127
1138
|
this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
|
|
1128
1139
|
}
|
|
@@ -1178,7 +1189,7 @@ class re {
|
|
|
1178
1189
|
return a;
|
|
1179
1190
|
}
|
|
1180
1191
|
const t = $t(this.request, this._options);
|
|
1181
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1192
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ut(this.request.clone(), t, this.abortController, this._options);
|
|
1182
1193
|
}
|
|
1183
1194
|
/* istanbul ignore next */
|
|
1184
1195
|
_stream(t, n) {
|
|
@@ -1222,7 +1233,7 @@ const he = (e) => {
|
|
|
1222
1233
|
return t.create = (n) => he(te(n)), t.extend = (n) => he(te(e, n)), t.stop = je, t;
|
|
1223
1234
|
}, Ye = he();
|
|
1224
1235
|
let ae;
|
|
1225
|
-
const
|
|
1236
|
+
const k = {
|
|
1226
1237
|
CachedPrices: `${L.ThorswapApi}/tokenlist/cached-price`,
|
|
1227
1238
|
GasRates: `${L.ThorswapApi}/resource-worker/gasPrice/getAll`,
|
|
1228
1239
|
Quote: `${L.ThorswapApi}/aggregator/tokens/quote`,
|
|
@@ -1230,7 +1241,7 @@ const P = {
|
|
|
1230
1241
|
TokenlistProviders: `${L.ThorswapApi}/tokenlist/providers`,
|
|
1231
1242
|
TokenList: `${L.ThorswapStatic}/token-list`,
|
|
1232
1243
|
Thorname: `${L.ThorswapApi}/thorname`
|
|
1233
|
-
}, Qe = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ne = () => ae || (ae = Ye.create({ headers: Qe }), ae),
|
|
1244
|
+
}, Qe = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ne = () => ae || (ae = Ye.create({ headers: Qe }), ae), Qn = ({ apiKey: e, ...t }) => {
|
|
1234
1245
|
ae = Ye.create({
|
|
1235
1246
|
...t,
|
|
1236
1247
|
headers: { ...Qe, ...t.headers, "x-api-key": e }
|
|
@@ -1240,20 +1251,20 @@ const P = {
|
|
|
1240
1251
|
post: (e, t) => Ne().post(e, t).json()
|
|
1241
1252
|
}, qt = ({ tokens: e, ...t }) => {
|
|
1242
1253
|
const n = new URLSearchParams();
|
|
1243
|
-
return e.filter((a, i, r) => r.findIndex((p) => p === a) === i).forEach((a) => n.append("tokens", JSON.stringify(a))), t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), g.post(
|
|
1254
|
+
return e.filter((a, i, r) => r.findIndex((p) => p === a) === i).forEach((a) => n.append("tokens", JSON.stringify(a))), t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), g.post(k.CachedPrices, {
|
|
1244
1255
|
body: n.toString(),
|
|
1245
1256
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1246
1257
|
});
|
|
1247
|
-
},
|
|
1258
|
+
}, Jn = {
|
|
1248
1259
|
getCachedPrices: qt,
|
|
1249
|
-
getQuote: (e) => g.get(
|
|
1250
|
-
getGasRates: () => g.get(
|
|
1251
|
-
getTxnDetails: (e) => g.get(
|
|
1252
|
-
getTokenlistProviders: () => g.get(
|
|
1253
|
-
getTokenList: (e) => g.get(`${
|
|
1254
|
-
getThornameAddresses: (e) => g.get(`${
|
|
1255
|
-
getThornameRegisteredChains: (e) => g.get(`${
|
|
1256
|
-
getThornameRlookup: (e, t) => g.get(`${
|
|
1260
|
+
getQuote: (e) => g.get(k.Quote, { searchParams: e }),
|
|
1261
|
+
getGasRates: () => g.get(k.GasRates),
|
|
1262
|
+
getTxnDetails: (e) => g.get(k.Txn, { searchParams: e }),
|
|
1263
|
+
getTokenlistProviders: () => g.get(k.TokenlistProviders),
|
|
1264
|
+
getTokenList: (e) => g.get(`${k.TokenList}/${e}.json`),
|
|
1265
|
+
getThornameAddresses: (e) => g.get(`${k.Thorname}/${e}`),
|
|
1266
|
+
getThornameRegisteredChains: (e) => g.get(`${k.Thorname}/chains/${e}`),
|
|
1267
|
+
getThornameRlookup: (e, t) => g.get(`${k.Thorname}/rlookup`, { searchParams: { address: e, chain: t } })
|
|
1257
1268
|
};
|
|
1258
1269
|
var Gt = /* @__PURE__ */ ((e) => (e.SWAP_TC_TO_TC = "SWAP:TC-TC", e.SWAP_ETH_TO_TC = "SWAP:ERC20-TC", e.SWAP_TC_TO_ETH = "SWAP:TC-ERC20", e.SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20", e.SWAP_AVAX_TO_TC = "SWAP:AVAX-TC", e.SWAP_TC_TO_AVAX = "SWAP:TC-AVAX", e.SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX", e.SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX", e.SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH", e.SWAP_TC_TO_GAIA = "SWAP:TC-GAIA", e.SWAP_GAIA_TO_TC = "SWAP:GAIA-TC", e.SWAP_TC_TO_BNB = "SWAP:TC-BNB", e.SWAP_BNB_TO_TC = "SWAP:BNB-TC", e.SWAP_TC_TO_BTC = "SWAP:TC-BTC", e.SWAP_BTC_TO_TC = "SWAP:BTC-TC", e.SWAP_TC_TO_BCH = "SWAP:TC-BCH", e.SWAP_BCH_TO_TC = "SWAP:BCH-TC", e.SWAP_TC_TO_LTC = "SWAP:TC-LTC", e.SWAP_LTC_TO_TC = "SWAP:LTC-TC", e.SWAP_TC_TO_DOGE = "SWAP:TC-DOGE", e.SWAP_DOGE_TO_TC = "SWAP:DOGE-TC", e.TC_STATUS = "TC:STATUS", e.TC_TRANSFER = "TC:TRANSFER", e.TC_DEPOSIT = "TC:DEPOSIT", e.TC_SEND = "TC:SEND", e.TC_SWITCH = "TC:SWITCH", e.TC_LP_ADD = "TC:ADDLIQUIDITY", e.TC_LP_WITHDRAW = "TC:WITHDRAW", e.TC_TNS_CREATE = "TC:TNS-CREATE", e.TC_TNS_EXTEND = "TC:TNS-EXTEND", e.TC_TNS_UPDATE = "TC:TNS-UPDATE", e.TC_SAVINGS_ADD = "TC:ADDSAVINGS", e.TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS", e.TC_LENDING_OPEN = "TC:LENDINGOPEN", e.TC_LENDING_CLOSE = "TC:LENDINGCLOSE", e.ETH_APPROVAL = "ETH:APPROVAL", e.ETH_STATUS = "ETH:STATUS", e.ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN", e.ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT", e.AVAX_APPROVAL = "AVAX:APPROVAL", e.AVAX_STATUS = "AVAX:STATUS", e.AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN", e.AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT", e.BSC_APPROVAL = "BSC:APPROVAL", e.BSC_STATUS = "BSC:STATUS", e.BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN", e.BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT", e.APPROVAL = "APPROVAL", e.STATUS = "STATUS", e.TRANSFER_TO_TC = "TRANSFER:IN", e.TRANSFER_FROM_TC = "TRANSFER:OUT", e.UNSUPPORTED = "UNSUPPORTED", e.TC_LENDING = "TC:LENDING", e))(Gt || {}), Xt = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.SUCCESS = "success", e.CANCELLED = "cancelled", e.REFUNDED = "refunded", e.REPLACED = "replaced", e.ERROR = "error", e.UNKNOWN = "unknown", e.NOT_STARTED = "not_started", e.NOT_FOUND = "not_found", e.RETRIES_EXCEEDED = "retries_exceeded", e.STREAMING = "streaming", e))(Xt || {}), jt = /* @__PURE__ */ ((e) => (e[e.NOT_STARTED = 0] = "NOT_STARTED", e[e.SUCCESS = 1] = "SUCCESS", e[e.REFUNDED = 2] = "REFUNDED", e))(jt || {});
|
|
1259
1270
|
const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
@@ -1307,6 +1318,8 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1307
1318
|
case s.Binance:
|
|
1308
1319
|
case s.Ethereum:
|
|
1309
1320
|
case s.Avalanche:
|
|
1321
|
+
case s.Polkadot:
|
|
1322
|
+
case s.Chainflip:
|
|
1310
1323
|
return t === e;
|
|
1311
1324
|
case s.Arbitrum:
|
|
1312
1325
|
case s.Optimism:
|
|
@@ -1350,7 +1363,9 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1350
1363
|
case s.Dogecoin:
|
|
1351
1364
|
case s.Binance:
|
|
1352
1365
|
case s.Avalanche:
|
|
1366
|
+
case s.Chainflip:
|
|
1353
1367
|
case s.Polygon:
|
|
1368
|
+
case s.Polkadot:
|
|
1354
1369
|
case s.Bitcoin:
|
|
1355
1370
|
case s.Ethereum:
|
|
1356
1371
|
return { identifier: `${e}.${e}`, decimal: E[e] };
|
|
@@ -1365,6 +1380,8 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1365
1380
|
case s.Litecoin:
|
|
1366
1381
|
case s.Maya:
|
|
1367
1382
|
case s.THORChain:
|
|
1383
|
+
case s.Polkadot:
|
|
1384
|
+
case s.Chainflip:
|
|
1368
1385
|
return "Native";
|
|
1369
1386
|
case s.Cosmos:
|
|
1370
1387
|
return t === "ATOM" ? "Native" : s.Cosmos;
|
|
@@ -1385,7 +1402,7 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1385
1402
|
case s.Optimism:
|
|
1386
1403
|
return [s.Ethereum, s.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
1387
1404
|
}
|
|
1388
|
-
},
|
|
1405
|
+
}, Zn = (e) => {
|
|
1389
1406
|
var t;
|
|
1390
1407
|
const [n, ...a] = e.split("."), i = e.includes("/"), r = a.join("."), p = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
1391
1408
|
return { chain: n, symbol: r, ticker: p, synth: i };
|
|
@@ -1398,7 +1415,7 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1398
1415
|
return !0;
|
|
1399
1416
|
const [, a] = n.split("-");
|
|
1400
1417
|
return Ze({ chain: t, symbol: n }) || !!a;
|
|
1401
|
-
},
|
|
1418
|
+
}, zn = (e) => e.filter((t) => {
|
|
1402
1419
|
const n = `${t.chain}.${t.symbol}`;
|
|
1403
1420
|
return !nn.test(n) && an(n) && t.value !== "0";
|
|
1404
1421
|
});
|
|
@@ -1418,7 +1435,7 @@ function rn({
|
|
|
1418
1435
|
const a = I(e), i = I(t), r = I(n), p = a.mul(r), u = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), m = p.mul(u.sub(y).add(l)), T = i.mul(i).mul(i);
|
|
1419
1436
|
return m.div(T);
|
|
1420
1437
|
}
|
|
1421
|
-
function
|
|
1438
|
+
function ea({
|
|
1422
1439
|
percent: e,
|
|
1423
1440
|
runeDepth: t,
|
|
1424
1441
|
liquidityUnits: n,
|
|
@@ -1426,7 +1443,7 @@ function zn({
|
|
|
1426
1443
|
}) {
|
|
1427
1444
|
return sn({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1428
1445
|
}
|
|
1429
|
-
function
|
|
1446
|
+
function ta({
|
|
1430
1447
|
percent: e,
|
|
1431
1448
|
assetDepth: t,
|
|
1432
1449
|
liquidityUnits: n,
|
|
@@ -1435,7 +1452,7 @@ function ea({
|
|
|
1435
1452
|
return rn({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1436
1453
|
}
|
|
1437
1454
|
function I(e) {
|
|
1438
|
-
return
|
|
1455
|
+
return x.fromBigInt(BigInt(e), E.THOR);
|
|
1439
1456
|
}
|
|
1440
1457
|
function pn({
|
|
1441
1458
|
liquidityUnits: e,
|
|
@@ -1448,7 +1465,7 @@ function pn({
|
|
|
1448
1465
|
runeAmount: I(n).mul(e).div(t)
|
|
1449
1466
|
};
|
|
1450
1467
|
}
|
|
1451
|
-
function
|
|
1468
|
+
function na({
|
|
1452
1469
|
liquidityUnits: e,
|
|
1453
1470
|
poolUnits: t,
|
|
1454
1471
|
runeDepth: n,
|
|
@@ -1461,7 +1478,7 @@ function ta({
|
|
|
1461
1478
|
)
|
|
1462
1479
|
);
|
|
1463
1480
|
}
|
|
1464
|
-
function
|
|
1481
|
+
function aa({
|
|
1465
1482
|
runeDepth: e,
|
|
1466
1483
|
poolUnits: t,
|
|
1467
1484
|
assetDepth: n,
|
|
@@ -1469,13 +1486,13 @@ function na({
|
|
|
1469
1486
|
runeAmount: i,
|
|
1470
1487
|
assetAmount: r
|
|
1471
1488
|
}) {
|
|
1472
|
-
const p = new
|
|
1473
|
-
if (
|
|
1489
|
+
const p = new x({ value: e, decimal: 8 }), u = new x({ value: n, decimal: 8 }), y = new x({ value: t, decimal: 8 }), l = new x({ value: i, decimal: 8 }), m = new x({ value: r, decimal: 8 }), T = l.mul(u), _ = m.mul(p), h = l.mul(m), R = p.mul(u), O = y.mul(T.add(_.add(h.mul(2)))), w = T.add(_.add(R.mul(2))), S = O.div(w), B = I(a).add(S);
|
|
1490
|
+
if (S.getBaseValue("number") === 0)
|
|
1474
1491
|
return B.div(y).getBaseValue("number");
|
|
1475
1492
|
const Te = y.add(B);
|
|
1476
1493
|
return B.div(Te).getBaseValue("number");
|
|
1477
1494
|
}
|
|
1478
|
-
function
|
|
1495
|
+
function ia({
|
|
1479
1496
|
runeAmount: e,
|
|
1480
1497
|
assetAmount: t,
|
|
1481
1498
|
runeDepth: n,
|
|
@@ -1488,20 +1505,20 @@ function aa({
|
|
|
1488
1505
|
}
|
|
1489
1506
|
const D = (e, t) => {
|
|
1490
1507
|
switch (e) {
|
|
1491
|
-
case
|
|
1492
|
-
case
|
|
1508
|
+
case f.LEAVE:
|
|
1509
|
+
case f.BOND: {
|
|
1493
1510
|
const { address: n } = t;
|
|
1494
1511
|
return `${e}:${n}`;
|
|
1495
1512
|
}
|
|
1496
|
-
case
|
|
1513
|
+
case f.UNBOND: {
|
|
1497
1514
|
const { address: n, unbondAmount: a } = t;
|
|
1498
1515
|
return `${e}:${n}:${a}`;
|
|
1499
1516
|
}
|
|
1500
|
-
case
|
|
1517
|
+
case f.THORNAME_REGISTER: {
|
|
1501
1518
|
const { name: n, chain: a, address: i, owner: r } = t;
|
|
1502
1519
|
return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
|
|
1503
1520
|
}
|
|
1504
|
-
case
|
|
1521
|
+
case f.DEPOSIT: {
|
|
1505
1522
|
const { chain: n, symbol: a, address: i, singleSide: r } = t;
|
|
1506
1523
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${((p, u) => {
|
|
1507
1524
|
switch (p) {
|
|
@@ -1516,12 +1533,12 @@ const D = (e, t) => {
|
|
|
1516
1533
|
}
|
|
1517
1534
|
})(n, a)}:${i || ""}:t:0`;
|
|
1518
1535
|
}
|
|
1519
|
-
case
|
|
1536
|
+
case f.WITHDRAW: {
|
|
1520
1537
|
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: u } = t, y = n === "ETH" && a !== "ETH" ? `${a}-${i.slice(-3)}` : i, l = !u && p ? `:${p}` : "";
|
|
1521
1538
|
return `${e}:${n}${u ? "/" : "."}${y}:${r}${l}`;
|
|
1522
1539
|
}
|
|
1523
|
-
case
|
|
1524
|
-
case
|
|
1540
|
+
case f.OPEN_LOAN:
|
|
1541
|
+
case f.CLOSE_LOAN: {
|
|
1525
1542
|
const { asset: n, address: a } = t;
|
|
1526
1543
|
return `${e}:${n}:${a}`;
|
|
1527
1544
|
}
|
|
@@ -1529,18 +1546,18 @@ const D = (e, t) => {
|
|
|
1529
1546
|
return "";
|
|
1530
1547
|
}
|
|
1531
1548
|
};
|
|
1532
|
-
function
|
|
1549
|
+
function sa(e) {
|
|
1533
1550
|
if (e < 0)
|
|
1534
1551
|
throw new Error("Invalid number of year");
|
|
1535
1552
|
return 10 + e;
|
|
1536
1553
|
}
|
|
1537
|
-
function
|
|
1554
|
+
function ra(e) {
|
|
1538
1555
|
if (e.length > 30)
|
|
1539
1556
|
return !1;
|
|
1540
1557
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1541
1558
|
return !!e.match(t);
|
|
1542
1559
|
}
|
|
1543
|
-
function
|
|
1560
|
+
function pa([e, t, n, a, i]) {
|
|
1544
1561
|
return `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`;
|
|
1545
1562
|
}
|
|
1546
1563
|
const De = [...Object.values(s), "TERRA"];
|
|
@@ -1555,7 +1572,7 @@ function un(e = "") {
|
|
|
1555
1572
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1556
1573
|
);
|
|
1557
1574
|
}
|
|
1558
|
-
const J = 8,
|
|
1575
|
+
const J = 8, F = (e) => 10n ** BigInt(e), j = (e) => Math.log10(parseFloat(e.toString()));
|
|
1559
1576
|
function me({
|
|
1560
1577
|
value: e,
|
|
1561
1578
|
bigIntDecimal: t = J,
|
|
@@ -1579,7 +1596,7 @@ const yn = class et {
|
|
|
1579
1596
|
constructor(t) {
|
|
1580
1597
|
q(this, W), q(this, H), q(this, Ee), q(this, ie), q(this, pe), C(this, "decimalMultiplier", 10n ** 8n), C(this, "bigIntValue", 0n), C(this, "decimal");
|
|
1581
1598
|
const n = Oe(t), a = typeof t == "object";
|
|
1582
|
-
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier :
|
|
1599
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : F(Math.max(nt(ue(n)), this.decimal || 0)), M(this, Ee, ze).call(this, n);
|
|
1583
1600
|
}
|
|
1584
1601
|
static fromBigInt(t, n) {
|
|
1585
1602
|
return new et({
|
|
@@ -1593,7 +1610,7 @@ const yn = class et {
|
|
|
1593
1610
|
to: a
|
|
1594
1611
|
}) {
|
|
1595
1612
|
return this.fromBigInt(
|
|
1596
|
-
t.getBaseValue("bigint") *
|
|
1613
|
+
t.getBaseValue("bigint") * F(a) / F(n),
|
|
1597
1614
|
a
|
|
1598
1615
|
);
|
|
1599
1616
|
}
|
|
@@ -1644,7 +1661,7 @@ const yn = class et {
|
|
|
1644
1661
|
}
|
|
1645
1662
|
// @ts-expect-error
|
|
1646
1663
|
getBaseValue(t) {
|
|
1647
|
-
const n = this.decimalMultiplier /
|
|
1664
|
+
const n = this.decimalMultiplier / F(this.decimal || E.THOR), a = this.bigIntValue / n;
|
|
1648
1665
|
switch (t) {
|
|
1649
1666
|
case "number":
|
|
1650
1667
|
return Number(a);
|
|
@@ -1716,7 +1733,7 @@ const yn = class et {
|
|
|
1716
1733
|
}
|
|
1717
1734
|
};
|
|
1718
1735
|
W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
1719
|
-
const n = M(this, ie, _e).call(this, this, ...t), a = Math.max(n, j(this.decimalMultiplier)), i =
|
|
1736
|
+
const n = M(this, ie, _e).call(this, this, ...t), a = Math.max(n, j(this.decimalMultiplier)), i = F(a), r = t.reduce(
|
|
1720
1737
|
(u, y) => {
|
|
1721
1738
|
const l = this.getBigIntValue(y, a);
|
|
1722
1739
|
switch (e) {
|
|
@@ -1743,7 +1760,7 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1743
1760
|
value: r
|
|
1744
1761
|
});
|
|
1745
1762
|
return new this.constructor({
|
|
1746
|
-
decimalMultiplier:
|
|
1763
|
+
decimalMultiplier: F(a),
|
|
1747
1764
|
decimal: this.decimal,
|
|
1748
1765
|
value: p,
|
|
1749
1766
|
identifier: this.toString()
|
|
@@ -1769,7 +1786,7 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1769
1786
|
const t = e.map((n) => typeof n == "object" ? n.decimal || j(n.decimalMultiplier) : nt(ue(n))).filter(Boolean);
|
|
1770
1787
|
return Math.max(...t, J);
|
|
1771
1788
|
}, pe = /* @__PURE__ */ new WeakSet(), Re = function(e, t) {
|
|
1772
|
-
const n = t ?
|
|
1789
|
+
const n = t ? F(t) : this.decimalMultiplier, a = j(n), [i = "", r = ""] = e.split(".");
|
|
1773
1790
|
return BigInt(`${i}${r.padEnd(a, "0")}`);
|
|
1774
1791
|
};
|
|
1775
1792
|
let tt = yn;
|
|
@@ -1790,7 +1807,7 @@ function Oe(e) {
|
|
|
1790
1807
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1791
1808
|
}
|
|
1792
1809
|
const K = /* @__PURE__ */ new Map();
|
|
1793
|
-
class
|
|
1810
|
+
class P extends tt {
|
|
1794
1811
|
constructor({
|
|
1795
1812
|
value: t,
|
|
1796
1813
|
decimal: n,
|
|
@@ -1813,7 +1830,7 @@ class x extends tt {
|
|
|
1813
1830
|
return this.chain === t && this.symbol === n;
|
|
1814
1831
|
}
|
|
1815
1832
|
chainId() {
|
|
1816
|
-
return
|
|
1833
|
+
return Ue[this.chain];
|
|
1817
1834
|
}
|
|
1818
1835
|
// THOR.RUNE
|
|
1819
1836
|
// THOR.ETH.ETH
|
|
@@ -1823,23 +1840,23 @@ class x extends tt {
|
|
|
1823
1840
|
if (!a || !i)
|
|
1824
1841
|
throw new Error("Invalid asset url");
|
|
1825
1842
|
const p = a === s.THORChain && r ? `${a}.${i}/${r}` : t;
|
|
1826
|
-
return
|
|
1843
|
+
return Ae(p, n);
|
|
1827
1844
|
}
|
|
1828
1845
|
static fromString(t, n = 0) {
|
|
1829
|
-
return
|
|
1846
|
+
return Ae(t, n);
|
|
1830
1847
|
}
|
|
1831
1848
|
static fromIdentifier(t, n = 0) {
|
|
1832
|
-
return
|
|
1849
|
+
return Ae(t, n);
|
|
1833
1850
|
}
|
|
1834
1851
|
static fromStringSync(t, n = 0) {
|
|
1835
1852
|
const { chain: a, isSynthetic: i } = se(t), r = K.get(t.toUpperCase());
|
|
1836
1853
|
if (i)
|
|
1837
|
-
return
|
|
1854
|
+
return Pe(t, n);
|
|
1838
1855
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1839
1856
|
decimal: E[a],
|
|
1840
1857
|
identifier: t
|
|
1841
1858
|
};
|
|
1842
|
-
return new
|
|
1859
|
+
return new P({
|
|
1843
1860
|
tax: p,
|
|
1844
1861
|
value: Y(n, u),
|
|
1845
1862
|
identifier: i ? t : y,
|
|
@@ -1849,16 +1866,16 @@ class x extends tt {
|
|
|
1849
1866
|
static fromIdentifierSync(t, n = 0) {
|
|
1850
1867
|
const { chain: a, isSynthetic: i } = se(t), r = K.get(t);
|
|
1851
1868
|
if (i)
|
|
1852
|
-
return
|
|
1869
|
+
return Pe(t, n);
|
|
1853
1870
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1854
1871
|
decimal: E[a],
|
|
1855
1872
|
identifier: t
|
|
1856
1873
|
};
|
|
1857
|
-
return new
|
|
1874
|
+
return new P({ tax: p, decimal: u, identifier: y, value: Y(n, u) });
|
|
1858
1875
|
}
|
|
1859
1876
|
static fromChainOrSignature(t, n = 0) {
|
|
1860
1877
|
const { decimal: a, identifier: i } = en(t);
|
|
1861
|
-
return new
|
|
1878
|
+
return new P({ value: Y(n, a), decimal: a, identifier: i });
|
|
1862
1879
|
}
|
|
1863
1880
|
static loadStaticAssets() {
|
|
1864
1881
|
return new Promise(
|
|
@@ -1885,8 +1902,8 @@ class x extends tt {
|
|
|
1885
1902
|
);
|
|
1886
1903
|
}
|
|
1887
1904
|
}
|
|
1888
|
-
function
|
|
1889
|
-
const t =
|
|
1905
|
+
function fe(e) {
|
|
1906
|
+
const t = P.fromChainOrSignature(e);
|
|
1890
1907
|
switch (e) {
|
|
1891
1908
|
case s.Bitcoin:
|
|
1892
1909
|
case s.Litecoin:
|
|
@@ -1906,16 +1923,16 @@ function Ae(e) {
|
|
|
1906
1923
|
return t.set(1e-8);
|
|
1907
1924
|
}
|
|
1908
1925
|
}
|
|
1909
|
-
async function
|
|
1926
|
+
async function Ae(e, t = 0) {
|
|
1910
1927
|
un(e);
|
|
1911
1928
|
const n = K.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await Zt(se(e));
|
|
1912
|
-
return n || K.set(e.toUpperCase(), { identifier: e, decimal: a }), new
|
|
1929
|
+
return n || K.set(e.toUpperCase(), { identifier: e, decimal: a }), new P({ decimal: a, value: Y(t, a), identifier: e });
|
|
1913
1930
|
}
|
|
1914
|
-
function
|
|
1931
|
+
function Pe(e, t = 0) {
|
|
1915
1932
|
const [n, a] = e.split(".")[0].toUpperCase() === s.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1916
1933
|
if (!n || !a)
|
|
1917
1934
|
throw new Error("Invalid asset identifier");
|
|
1918
|
-
return new
|
|
1935
|
+
return new P({
|
|
1919
1936
|
decimal: 8,
|
|
1920
1937
|
value: Y(t, 8),
|
|
1921
1938
|
identifier: `${s.THORChain}.${n}/${a}`
|
|
@@ -2007,12 +2024,12 @@ class c extends Error {
|
|
|
2007
2024
|
n && console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: dn[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
|
|
2008
2025
|
}
|
|
2009
2026
|
}
|
|
2010
|
-
class
|
|
2027
|
+
class x extends tt {
|
|
2011
2028
|
eq(t) {
|
|
2012
2029
|
return this.eqValue(t);
|
|
2013
2030
|
}
|
|
2014
2031
|
static fromBigInt(t, n) {
|
|
2015
|
-
return new
|
|
2032
|
+
return new x({
|
|
2016
2033
|
decimal: n,
|
|
2017
2034
|
value: me({ value: t, bigIntDecimal: n, decimal: n })
|
|
2018
2035
|
});
|
|
@@ -2712,7 +2729,7 @@ const ln = [
|
|
|
2712
2729
|
type: "function"
|
|
2713
2730
|
},
|
|
2714
2731
|
{ stateMutability: "payable", type: "receive" }
|
|
2715
|
-
],
|
|
2732
|
+
], ke = [
|
|
2716
2733
|
{
|
|
2717
2734
|
inputs: [{ internalType: "address", name: "_WETH", type: "address" }],
|
|
2718
2735
|
stateMutability: "nonpayable",
|
|
@@ -3113,7 +3130,7 @@ const ln = [
|
|
|
3113
3130
|
type: "function"
|
|
3114
3131
|
},
|
|
3115
3132
|
{ stateMutability: "payable", type: "receive" }
|
|
3116
|
-
],
|
|
3133
|
+
], xe = [
|
|
3117
3134
|
{
|
|
3118
3135
|
inputs: [
|
|
3119
3136
|
{
|
|
@@ -5639,7 +5656,7 @@ const ln = [
|
|
|
5639
5656
|
type: "function"
|
|
5640
5657
|
},
|
|
5641
5658
|
{ stateMutability: "payable", type: "receive" }
|
|
5642
|
-
],
|
|
5659
|
+
], fn = [
|
|
5643
5660
|
{
|
|
5644
5661
|
inputs: [
|
|
5645
5662
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -5978,7 +5995,7 @@ const ln = [
|
|
|
5978
5995
|
type: "function"
|
|
5979
5996
|
},
|
|
5980
5997
|
{ stateMutability: "payable", type: "receive" }
|
|
5981
|
-
],
|
|
5998
|
+
], An = [
|
|
5982
5999
|
{
|
|
5983
6000
|
inputs: [
|
|
5984
6001
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7418,23 +7435,23 @@ const ln = [
|
|
|
7418
7435
|
type: "function"
|
|
7419
7436
|
},
|
|
7420
7437
|
{ stateMutability: "payable", type: "receive" }
|
|
7421
|
-
],
|
|
7438
|
+
], wn = {
|
|
7422
7439
|
// AVAX
|
|
7423
|
-
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]:
|
|
7440
|
+
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: fn,
|
|
7424
7441
|
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: On,
|
|
7425
7442
|
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: hn,
|
|
7426
|
-
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]:
|
|
7427
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7443
|
+
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: xe,
|
|
7444
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: ke,
|
|
7428
7445
|
// BSC
|
|
7429
7446
|
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Be,
|
|
7430
7447
|
// ETH
|
|
7431
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7432
|
-
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]:
|
|
7448
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: ke,
|
|
7449
|
+
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: An,
|
|
7433
7450
|
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Be,
|
|
7434
7451
|
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: En,
|
|
7435
7452
|
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: Rn,
|
|
7436
|
-
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]:
|
|
7437
|
-
},
|
|
7453
|
+
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: xe
|
|
7454
|
+
}, Sn = [
|
|
7438
7455
|
{
|
|
7439
7456
|
inputs: [
|
|
7440
7457
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8430,8 +8447,8 @@ const ln = [
|
|
|
8430
8447
|
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: ln,
|
|
8431
8448
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Tn,
|
|
8432
8449
|
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: cn
|
|
8433
|
-
},
|
|
8434
|
-
...
|
|
8450
|
+
}, Pn = {
|
|
8451
|
+
...wn,
|
|
8435
8452
|
...at,
|
|
8436
8453
|
// AVAX
|
|
8437
8454
|
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: _n,
|
|
@@ -8440,14 +8457,14 @@ const ln = [
|
|
|
8440
8457
|
// BSC
|
|
8441
8458
|
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: bn,
|
|
8442
8459
|
// ETH
|
|
8443
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
8460
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Sn,
|
|
8444
8461
|
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: In,
|
|
8445
8462
|
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: gn,
|
|
8446
8463
|
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Cn,
|
|
8447
8464
|
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: vn,
|
|
8448
8465
|
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: Nn,
|
|
8449
8466
|
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Dn
|
|
8450
|
-
},
|
|
8467
|
+
}, kn = ({
|
|
8451
8468
|
streamSwap: e,
|
|
8452
8469
|
contractAddress: t,
|
|
8453
8470
|
recipient: n,
|
|
@@ -8467,10 +8484,10 @@ const ln = [
|
|
|
8467
8484
|
token: O
|
|
8468
8485
|
}
|
|
8469
8486
|
}) => {
|
|
8470
|
-
const
|
|
8471
|
-
if (
|
|
8487
|
+
const w = !!at[t.toLowerCase()];
|
|
8488
|
+
if (w && !l)
|
|
8472
8489
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8473
|
-
const
|
|
8490
|
+
const S = T || y, B = e && m || S;
|
|
8474
8491
|
if (!h && !R)
|
|
8475
8492
|
throw new Error("TC Vault is required on calldata");
|
|
8476
8493
|
if (!_ && !l)
|
|
@@ -8486,9 +8503,9 @@ const ln = [
|
|
|
8486
8503
|
B.replace("{recipientAddress}", n),
|
|
8487
8504
|
a(O),
|
|
8488
8505
|
i
|
|
8489
|
-
], it =
|
|
8506
|
+
], it = w ? [a(l), p, u] : [r, u];
|
|
8490
8507
|
return [...Te, ...it];
|
|
8491
|
-
},
|
|
8508
|
+
}, xn = ({ chain: e, txHash: t }) => {
|
|
8492
8509
|
const n = We[e];
|
|
8493
8510
|
switch (e) {
|
|
8494
8511
|
case s.Binance:
|
|
@@ -8555,8 +8572,8 @@ const ln = [
|
|
|
8555
8572
|
return !0;
|
|
8556
8573
|
}
|
|
8557
8574
|
};
|
|
8558
|
-
var
|
|
8559
|
-
class
|
|
8575
|
+
var U, ye, Z, v, z, ee;
|
|
8576
|
+
class ua {
|
|
8560
8577
|
constructor({ stagenet: t } = {}) {
|
|
8561
8578
|
b(this, "connectedChains", Le());
|
|
8562
8579
|
b(this, "connectedWallets", Le());
|
|
@@ -8565,7 +8582,7 @@ class pa {
|
|
|
8565
8582
|
var n;
|
|
8566
8583
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
8567
8584
|
});
|
|
8568
|
-
b(this, "getExplorerTxUrl", (t, n) =>
|
|
8585
|
+
b(this, "getExplorerTxUrl", (t, n) => xn({ chain: t, txHash: n }));
|
|
8569
8586
|
b(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
8570
8587
|
b(this, "getExplorerAddressUrl", (t, n) => Bn({ chain: t, address: n }));
|
|
8571
8588
|
b(this, "getBalance", async (t, n) => {
|
|
@@ -8590,7 +8607,7 @@ class pa {
|
|
|
8590
8607
|
data: T,
|
|
8591
8608
|
from: _,
|
|
8592
8609
|
to: h.toLowerCase(),
|
|
8593
|
-
chainId: BigInt(
|
|
8610
|
+
chainId: BigInt(Ue[p]),
|
|
8594
8611
|
value: R ? BigInt(R) : 0n
|
|
8595
8612
|
};
|
|
8596
8613
|
return l.sendTransaction(O, i);
|
|
@@ -8598,17 +8615,17 @@ class pa {
|
|
|
8598
8615
|
if (bt.includes(r)) {
|
|
8599
8616
|
if (!a.calldata.fromAsset)
|
|
8600
8617
|
throw new c("core_swap_asset_not_recognized");
|
|
8601
|
-
const l = await
|
|
8618
|
+
const l = await P.fromString(a.calldata.fromAsset);
|
|
8602
8619
|
if (!l)
|
|
8603
8620
|
throw new c("core_swap_asset_not_recognized");
|
|
8604
|
-
const { address: m } = await
|
|
8621
|
+
const { address: m } = await A(this, U).call(this, l.chain), {
|
|
8605
8622
|
contract: T,
|
|
8606
8623
|
calldata: { expiration: _, amountIn: h, memo: R, memoStreamingSwap: O }
|
|
8607
|
-
} = a,
|
|
8624
|
+
} = a, w = l.add(x.fromBigInt(BigInt(h), l.decimal)), S = t && O || R;
|
|
8608
8625
|
return this.deposit({
|
|
8609
8626
|
expiration: _,
|
|
8610
|
-
assetValue:
|
|
8611
|
-
memo:
|
|
8627
|
+
assetValue: w,
|
|
8628
|
+
memo: S,
|
|
8612
8629
|
feeOptionKey: i,
|
|
8613
8630
|
router: T,
|
|
8614
8631
|
recipient: m
|
|
@@ -8621,11 +8638,11 @@ class pa {
|
|
|
8621
8638
|
const T = this.connectedWallets[p], _ = this.getAddress(p);
|
|
8622
8639
|
if (!(T != null && T.sendTransaction) || !_)
|
|
8623
8640
|
throw new c("core_wallet_connection_not_found");
|
|
8624
|
-
const { getProvider: h, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = h(p),
|
|
8625
|
-
if (!
|
|
8641
|
+
const { getProvider: h, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = h(p), w = Pn[m.toLowerCase()];
|
|
8642
|
+
if (!w)
|
|
8626
8643
|
throw new c("core_swap_contract_not_supported", { contractAddress: m });
|
|
8627
|
-
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T, m,
|
|
8628
|
-
...
|
|
8644
|
+
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T, m, w, O))).getFunction("swapIn").populateTransaction(
|
|
8645
|
+
...kn({
|
|
8629
8646
|
streamSwap: t,
|
|
8630
8647
|
toChecksumAddress: R,
|
|
8631
8648
|
contractAddress: m,
|
|
@@ -8643,7 +8660,7 @@ class pa {
|
|
|
8643
8660
|
const a = this.getAddress(t);
|
|
8644
8661
|
if (!a)
|
|
8645
8662
|
return null;
|
|
8646
|
-
const i = [
|
|
8663
|
+
const i = [P.fromChainOrSignature(t)], r = (p = this.connectedChains[t]) == null ? void 0 : p.walletType;
|
|
8647
8664
|
try {
|
|
8648
8665
|
const y = await ((u = this.getWallet(t)) == null ? void 0 : u.getBalance(a, n));
|
|
8649
8666
|
return this.connectedChains[t] = {
|
|
@@ -8655,8 +8672,8 @@ class pa {
|
|
|
8655
8672
|
return console.error(y), { address: a, balance: i, walletType: r };
|
|
8656
8673
|
}
|
|
8657
8674
|
});
|
|
8658
|
-
b(this, "approveAssetValue", (t, n) =>
|
|
8659
|
-
b(this, "isAssetValueApproved", (t, n) =>
|
|
8675
|
+
b(this, "approveAssetValue", (t, n) => A(this, Z).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
8676
|
+
b(this, "isAssetValueApproved", (t, n) => A(this, Z).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
8660
8677
|
b(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
8661
8678
|
var a, i;
|
|
8662
8679
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
@@ -8666,7 +8683,7 @@ class pa {
|
|
|
8666
8683
|
if (!n)
|
|
8667
8684
|
throw new c("core_wallet_connection_not_found");
|
|
8668
8685
|
try {
|
|
8669
|
-
return await n.transfer(
|
|
8686
|
+
return await n.transfer(A(this, ee).call(this, t));
|
|
8670
8687
|
} catch (a) {
|
|
8671
8688
|
throw new c("core_swap_transaction_error", a);
|
|
8672
8689
|
}
|
|
@@ -8685,7 +8702,7 @@ class pa {
|
|
|
8685
8702
|
throw new c("core_transaction_invalid_sender_address");
|
|
8686
8703
|
if (!y)
|
|
8687
8704
|
throw new c("core_wallet_connection_not_found");
|
|
8688
|
-
const m =
|
|
8705
|
+
const m = A(this, ee).call(this, { assetValue: t, recipient: n, router: a, ...i });
|
|
8689
8706
|
try {
|
|
8690
8707
|
switch (r) {
|
|
8691
8708
|
case s.THORChain:
|
|
@@ -8699,7 +8716,7 @@ class pa {
|
|
|
8699
8716
|
const { getChecksumAddressFromAsset: T } = await import("@swapkit/toolbox-evm"), _ = r === s.Avalanche ? dt : r === s.BinanceSmartChain ? lt : ot;
|
|
8700
8717
|
return await y.call({
|
|
8701
8718
|
abi: _,
|
|
8702
|
-
contractAddress: a || (await
|
|
8719
|
+
contractAddress: a || (await A(this, U).call(this, r)).router,
|
|
8703
8720
|
funcName: "depositWithExpiry",
|
|
8704
8721
|
funcParams: [
|
|
8705
8722
|
n,
|
|
@@ -8718,8 +8735,8 @@ class pa {
|
|
|
8718
8735
|
return await y.transfer(m);
|
|
8719
8736
|
}
|
|
8720
8737
|
} catch (T) {
|
|
8721
|
-
const _ = ((T == null ? void 0 : T.message) || (T == null ? void 0 : T.toString())).toLowerCase(), h = _ == null ? void 0 : _.includes("insufficient funds"), R = _ == null ? void 0 : _.includes("gas"), O = _ == null ? void 0 : _.includes("server"),
|
|
8722
|
-
throw new c(
|
|
8738
|
+
const _ = ((T == null ? void 0 : T.message) || (T == null ? void 0 : T.toString())).toLowerCase(), h = _ == null ? void 0 : _.includes("insufficient funds"), R = _ == null ? void 0 : _.includes("gas"), O = _ == null ? void 0 : _.includes("server"), w = _ == null ? void 0 : _.includes("user rejected"), S = h ? "core_transaction_deposit_insufficient_funds_error" : R ? "core_transaction_deposit_gas_error" : O ? "core_transaction_deposit_server_error" : w ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
|
|
8739
|
+
throw new c(S, T);
|
|
8723
8740
|
}
|
|
8724
8741
|
});
|
|
8725
8742
|
/**
|
|
@@ -8733,9 +8750,9 @@ class pa {
|
|
|
8733
8750
|
throw new c("core_transaction_create_liquidity_invalid_params");
|
|
8734
8751
|
let a = "", i = "";
|
|
8735
8752
|
try {
|
|
8736
|
-
a = await
|
|
8753
|
+
a = await A(this, v).call(this, {
|
|
8737
8754
|
assetValue: t,
|
|
8738
|
-
memo: D(
|
|
8755
|
+
memo: D(f.DEPOSIT, {
|
|
8739
8756
|
...n,
|
|
8740
8757
|
address: this.getAddress(n.chain)
|
|
8741
8758
|
})
|
|
@@ -8744,9 +8761,9 @@ class pa {
|
|
|
8744
8761
|
throw new c("core_transaction_create_liquidity_rune_error", r);
|
|
8745
8762
|
}
|
|
8746
8763
|
try {
|
|
8747
|
-
i = await
|
|
8764
|
+
i = await A(this, v).call(this, {
|
|
8748
8765
|
assetValue: n,
|
|
8749
|
-
memo: D(
|
|
8766
|
+
memo: D(f.DEPOSIT, {
|
|
8750
8767
|
...n,
|
|
8751
8768
|
address: this.getAddress(s.THORChain)
|
|
8752
8769
|
})
|
|
@@ -8769,26 +8786,26 @@ class pa {
|
|
|
8769
8786
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8770
8787
|
if (_ && !h)
|
|
8771
8788
|
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
8772
|
-
let O,
|
|
8789
|
+
let O, w;
|
|
8773
8790
|
if (m && t)
|
|
8774
8791
|
try {
|
|
8775
|
-
O = await
|
|
8792
|
+
O = await A(this, v).call(this, {
|
|
8776
8793
|
assetValue: t,
|
|
8777
|
-
memo: D(
|
|
8794
|
+
memo: D(f.DEPOSIT, { chain: u, symbol: y, address: R })
|
|
8778
8795
|
});
|
|
8779
|
-
} catch (
|
|
8780
|
-
throw new c("core_transaction_add_liquidity_rune_error",
|
|
8796
|
+
} catch (S) {
|
|
8797
|
+
throw new c("core_transaction_add_liquidity_rune_error", S);
|
|
8781
8798
|
}
|
|
8782
8799
|
if (T && n)
|
|
8783
8800
|
try {
|
|
8784
|
-
|
|
8801
|
+
w = await A(this, v).call(this, {
|
|
8785
8802
|
assetValue: n,
|
|
8786
|
-
memo: D(
|
|
8803
|
+
memo: D(f.DEPOSIT, { chain: u, symbol: y, address: h })
|
|
8787
8804
|
});
|
|
8788
|
-
} catch (
|
|
8789
|
-
throw new c("core_transaction_add_liquidity_asset_error",
|
|
8805
|
+
} catch (S) {
|
|
8806
|
+
throw new c("core_transaction_add_liquidity_asset_error", S);
|
|
8790
8807
|
}
|
|
8791
|
-
return { runeTx: O, assetTx:
|
|
8808
|
+
return { runeTx: O, assetTx: w };
|
|
8792
8809
|
});
|
|
8793
8810
|
b(this, "addLiquidityPart", ({
|
|
8794
8811
|
assetValue: t,
|
|
@@ -8798,12 +8815,12 @@ class pa {
|
|
|
8798
8815
|
}) => {
|
|
8799
8816
|
if (i && !a)
|
|
8800
8817
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8801
|
-
const r = D(
|
|
8818
|
+
const r = D(f.DEPOSIT, {
|
|
8802
8819
|
chain: n.split(".")[0],
|
|
8803
8820
|
symbol: n.split(".")[1],
|
|
8804
8821
|
address: i ? a : ""
|
|
8805
8822
|
});
|
|
8806
|
-
return
|
|
8823
|
+
return A(this, v).call(this, { assetValue: t, memo: r });
|
|
8807
8824
|
});
|
|
8808
8825
|
b(this, "withdraw", async ({
|
|
8809
8826
|
memo: t,
|
|
@@ -8812,7 +8829,7 @@ class pa {
|
|
|
8812
8829
|
from: i,
|
|
8813
8830
|
to: r
|
|
8814
8831
|
}) => {
|
|
8815
|
-
const p = r === "rune" && i !== "rune" ?
|
|
8832
|
+
const p = r === "rune" && i !== "rune" ? P.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = fe(i === "asset" ? n.chain : s.THORChain), y = t || D(f.WITHDRAW, {
|
|
8816
8833
|
symbol: n.symbol,
|
|
8817
8834
|
chain: n.chain,
|
|
8818
8835
|
ticker: n.ticker,
|
|
@@ -8820,7 +8837,7 @@ class pa {
|
|
|
8820
8837
|
targetAssetString: p == null ? void 0 : p.toString(),
|
|
8821
8838
|
singleSide: !1
|
|
8822
8839
|
});
|
|
8823
|
-
return
|
|
8840
|
+
return A(this, v).call(this, { assetValue: u, memo: y });
|
|
8824
8841
|
});
|
|
8825
8842
|
b(this, "savings", async ({
|
|
8826
8843
|
assetValue: t,
|
|
@@ -8828,23 +8845,23 @@ class pa {
|
|
|
8828
8845
|
percent: a,
|
|
8829
8846
|
type: i
|
|
8830
8847
|
}) => {
|
|
8831
|
-
const r = i === "add" ?
|
|
8848
|
+
const r = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n || D(r, {
|
|
8832
8849
|
ticker: t.ticker,
|
|
8833
8850
|
symbol: t.symbol,
|
|
8834
8851
|
chain: t.chain,
|
|
8835
8852
|
singleSide: !0,
|
|
8836
8853
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
8837
|
-
}), u = r ===
|
|
8838
|
-
return
|
|
8854
|
+
}), u = r === f.DEPOSIT ? t : fe(t.chain);
|
|
8855
|
+
return A(this, v).call(this, { memo: p, assetValue: u });
|
|
8839
8856
|
});
|
|
8840
8857
|
b(this, "loan", ({
|
|
8841
8858
|
assetValue: t,
|
|
8842
8859
|
memo: n,
|
|
8843
8860
|
minAmount: a,
|
|
8844
8861
|
type: i
|
|
8845
|
-
}) =>
|
|
8862
|
+
}) => A(this, v).call(this, {
|
|
8846
8863
|
assetValue: t,
|
|
8847
|
-
memo: n || D(i === "open" ?
|
|
8864
|
+
memo: n || D(i === "open" ? f.OPEN_LOAN : f.CLOSE_LOAN, {
|
|
8848
8865
|
asset: t.toString(),
|
|
8849
8866
|
minAmount: a.toString(),
|
|
8850
8867
|
address: this.getAddress(t.chain)
|
|
@@ -8855,24 +8872,24 @@ class pa {
|
|
|
8855
8872
|
assetValue: n,
|
|
8856
8873
|
address: a
|
|
8857
8874
|
}) => {
|
|
8858
|
-
const i = t === "bond" ?
|
|
8875
|
+
const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, r = D(i, {
|
|
8859
8876
|
address: a,
|
|
8860
8877
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
8861
8878
|
});
|
|
8862
|
-
return
|
|
8879
|
+
return A(this, z).call(this, {
|
|
8863
8880
|
memo: r,
|
|
8864
|
-
assetValue: t === "bond" ? n :
|
|
8881
|
+
assetValue: t === "bond" ? n : fe(s.THORChain)
|
|
8865
8882
|
});
|
|
8866
8883
|
});
|
|
8867
8884
|
b(this, "registerThorname", ({
|
|
8868
8885
|
assetValue: t,
|
|
8869
8886
|
...n
|
|
8870
|
-
}) =>
|
|
8887
|
+
}) => A(this, z).call(this, { assetValue: t, memo: D(f.THORNAME_REGISTER, n) }));
|
|
8871
8888
|
b(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
8872
8889
|
try {
|
|
8873
8890
|
t.forEach((r) => {
|
|
8874
8891
|
this[r.connectMethodName] = r.connect({
|
|
8875
|
-
addChain:
|
|
8892
|
+
addChain: A(this, ye),
|
|
8876
8893
|
config: n || {},
|
|
8877
8894
|
apis: a,
|
|
8878
8895
|
rpcUrls: i
|
|
@@ -8951,7 +8968,7 @@ class pa {
|
|
|
8951
8968
|
b(this, "disconnectChain", (t) => {
|
|
8952
8969
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
8953
8970
|
});
|
|
8954
|
-
V(this,
|
|
8971
|
+
V(this, U, async (t) => {
|
|
8955
8972
|
switch (t) {
|
|
8956
8973
|
case s.Maya:
|
|
8957
8974
|
case s.THORChain:
|
|
@@ -8983,7 +9000,7 @@ class pa {
|
|
|
8983
9000
|
const _ = this.getAddress(r);
|
|
8984
9001
|
if (!i || !_)
|
|
8985
9002
|
throw new c("core_approve_asset_address_or_from_not_found");
|
|
8986
|
-
const h = a || (await
|
|
9003
|
+
const h = a || (await A(this, U).call(this, r)).router;
|
|
8987
9004
|
return T({
|
|
8988
9005
|
amount: t.getBaseValue("bigint"),
|
|
8989
9006
|
assetAddress: i,
|
|
@@ -9000,7 +9017,7 @@ class pa {
|
|
|
9000
9017
|
gas_rate: i,
|
|
9001
9018
|
router: r,
|
|
9002
9019
|
address: p
|
|
9003
|
-
} = await
|
|
9020
|
+
} = await A(this, U).call(this, t.chain), u = (parseInt(i) || 0) * zt[a];
|
|
9004
9021
|
return this.deposit({
|
|
9005
9022
|
assetValue: t,
|
|
9006
9023
|
recipient: p,
|
|
@@ -9024,74 +9041,75 @@ class pa {
|
|
|
9024
9041
|
this.stagenet = !!t;
|
|
9025
9042
|
}
|
|
9026
9043
|
}
|
|
9027
|
-
|
|
9044
|
+
U = new WeakMap(), ye = new WeakMap(), Z = new WeakMap(), v = new WeakMap(), z = new WeakMap(), ee = new WeakMap();
|
|
9028
9045
|
export {
|
|
9029
9046
|
Tt as AGG_SWAP,
|
|
9030
|
-
|
|
9047
|
+
k as ApiEndpoints,
|
|
9031
9048
|
Wn as ApiError,
|
|
9032
9049
|
Q as ApiUrl,
|
|
9033
|
-
|
|
9050
|
+
P as AssetValue,
|
|
9034
9051
|
E as BaseDecimal,
|
|
9035
9052
|
tt as BigIntArithmetics,
|
|
9036
9053
|
s as Chain,
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9054
|
+
we as ChainId,
|
|
9055
|
+
Yn as ChainIdToChain,
|
|
9056
|
+
Ue as ChainToChainId,
|
|
9040
9057
|
We as ChainToExplorerUrl,
|
|
9041
|
-
|
|
9058
|
+
Kn as ChainToHexChainId,
|
|
9042
9059
|
Ot as ChainToRPC,
|
|
9043
|
-
|
|
9044
|
-
|
|
9060
|
+
At as ContractAddress,
|
|
9061
|
+
Xn as CosmosChainList,
|
|
9045
9062
|
ht as DerivationPath,
|
|
9046
9063
|
o as ERROR_CODE,
|
|
9047
9064
|
_t as ERROR_MODULE,
|
|
9048
9065
|
Ve as ERROR_TYPE,
|
|
9049
9066
|
Et as EVMChainList,
|
|
9050
9067
|
X as FeeOption,
|
|
9051
|
-
|
|
9052
|
-
|
|
9068
|
+
St as LedgerErrorCode,
|
|
9069
|
+
f as MemoType,
|
|
9053
9070
|
$n as NetworkDerivationPath,
|
|
9054
9071
|
mt as QuoteMode,
|
|
9055
|
-
|
|
9072
|
+
Fe as RPCUrl,
|
|
9056
9073
|
g as RequestClient,
|
|
9057
9074
|
ct as SWAP_IN,
|
|
9058
9075
|
bt as SWAP_OUT,
|
|
9059
9076
|
jt as StreamingSwapProgressStatus,
|
|
9060
|
-
|
|
9061
|
-
|
|
9077
|
+
qn as SubstrateChainList,
|
|
9078
|
+
Jn as SwapKitApi,
|
|
9079
|
+
ua as SwapKitCore,
|
|
9062
9080
|
c as SwapKitError,
|
|
9063
|
-
|
|
9081
|
+
x as SwapKitNumber,
|
|
9064
9082
|
dt as TCAvalancheDepositABI,
|
|
9065
9083
|
lt as TCBscDepositABI,
|
|
9066
9084
|
ot as TCEthereumVaultAbi,
|
|
9067
|
-
|
|
9085
|
+
jn as TCSupportedChainList,
|
|
9068
9086
|
Gt as TransactionType,
|
|
9069
9087
|
Xt as TxStatus,
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9088
|
+
Gn as UTXOChainList,
|
|
9089
|
+
wt as WalletOption,
|
|
9090
|
+
Zn as assetFromString,
|
|
9073
9091
|
Qe as defaultRequestHeaders,
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9092
|
+
pa as derivationPathToString,
|
|
9093
|
+
Un as erc20ABI,
|
|
9094
|
+
zn as filterAssets,
|
|
9077
9095
|
me as formatBigIntToSafeValue,
|
|
9078
9096
|
zt as gasFeeMultiplier,
|
|
9079
9097
|
tn as getAssetType,
|
|
9080
9098
|
rn as getAsymmetricAssetShare,
|
|
9081
|
-
|
|
9099
|
+
ta as getAsymmetricAssetWithdrawAmount,
|
|
9082
9100
|
sn as getAsymmetricRuneShare,
|
|
9083
|
-
|
|
9101
|
+
ea as getAsymmetricRuneWithdrawAmount,
|
|
9084
9102
|
en as getCommonAssetInfo,
|
|
9085
9103
|
Zt as getDecimal,
|
|
9086
|
-
|
|
9087
|
-
|
|
9104
|
+
aa as getEstimatedPoolShare,
|
|
9105
|
+
ia as getLiquiditySlippage,
|
|
9088
9106
|
D as getMemoFor,
|
|
9089
|
-
|
|
9107
|
+
fe as getMinAmountByChain,
|
|
9090
9108
|
pn as getSymmetricPoolShare,
|
|
9091
|
-
|
|
9092
|
-
|
|
9109
|
+
na as getSymmetricWithdraw,
|
|
9110
|
+
sa as getTHORNameCost,
|
|
9093
9111
|
Ze as isGasAsset,
|
|
9094
|
-
|
|
9095
|
-
|
|
9112
|
+
Qn as setRequestClientConfig,
|
|
9113
|
+
ra as validateTHORName
|
|
9096
9114
|
};
|
|
9097
9115
|
//# sourceMappingURL=index.es.js.map
|