@swapkit/core 1.0.0-rc.98 → 1.0.0-rc.99
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.es.js +356 -333
- package/dist/index.es.js.map +1 -1
- package/package.json +10 -10
package/dist/index.es.js
CHANGED
|
@@ -4,12 +4,12 @@ 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 h = (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
|
-
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,
|
|
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, D = (e, t, n) => (yt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
13
|
const Gn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
@@ -624,60 +624,60 @@ const Tt = [
|
|
|
624
624
|
"TC-BEP20"
|
|
625
625
|
/* TC_SUPPORTED_TO_BSC */
|
|
626
626
|
];
|
|
627
|
-
var
|
|
627
|
+
var He = /* @__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))(He || {}), _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 || {}), 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 || {});
|
|
628
628
|
const ft = {
|
|
629
|
-
[
|
|
630
|
-
[
|
|
631
|
-
[
|
|
632
|
-
[
|
|
633
|
-
[
|
|
634
|
-
[
|
|
635
|
-
[
|
|
636
|
-
[
|
|
637
|
-
[
|
|
638
|
-
[
|
|
639
|
-
[
|
|
640
|
-
[
|
|
641
|
-
[
|
|
642
|
-
[
|
|
643
|
-
[
|
|
644
|
-
[
|
|
645
|
-
[
|
|
646
|
-
[
|
|
647
|
-
[
|
|
648
|
-
[
|
|
649
|
-
[
|
|
650
|
-
[
|
|
651
|
-
[
|
|
652
|
-
[
|
|
653
|
-
[
|
|
654
|
-
[
|
|
655
|
-
[
|
|
656
|
-
[
|
|
657
|
-
[
|
|
658
|
-
[
|
|
659
|
-
[
|
|
660
|
-
[
|
|
661
|
-
[
|
|
662
|
-
[
|
|
663
|
-
[
|
|
664
|
-
[
|
|
665
|
-
[
|
|
666
|
-
[
|
|
667
|
-
[
|
|
668
|
-
[
|
|
669
|
-
[
|
|
670
|
-
[
|
|
671
|
-
[
|
|
672
|
-
[
|
|
673
|
-
[
|
|
674
|
-
[
|
|
675
|
-
[
|
|
676
|
-
[
|
|
677
|
-
[
|
|
678
|
-
[
|
|
679
|
-
[
|
|
680
|
-
[
|
|
629
|
+
[d.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
|
+
[d.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
|
+
[d.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
632
|
+
[d.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
|
|
633
|
+
[d.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
|
|
634
|
+
[d.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
|
|
635
|
+
[d.INVALID_TYPE_GENERIC]: "Invalid type",
|
|
636
|
+
[d.INVALID_NUMBER_STRING]: "Invalid number string.",
|
|
637
|
+
[d.INVALID_NUMBER]: "Invalid number.",
|
|
638
|
+
[d.INVALID_BOOLEAN]: "Invalid boolean.",
|
|
639
|
+
[d.INVALID_OBJECT]: "Invalid object.",
|
|
640
|
+
[d.INVALID_ARRAY]: "Invalid array.",
|
|
641
|
+
[d.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
|
|
642
|
+
[d.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
|
|
643
|
+
[d.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
|
|
644
|
+
[d.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
|
|
645
|
+
[d.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 4 characters max.",
|
|
646
|
+
[d.AFF_BPS_INTEGER_MAX_500]: "affiliateBasisPoints must be an integer between 0 and 100.",
|
|
647
|
+
[d.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
|
|
648
|
+
[d.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
|
|
649
|
+
[d.PREFERRED_PROVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
|
|
650
|
+
[d.SOURCE_ADDRESS_SMART_CONTRACT]: "Source address is a smart contract.",
|
|
651
|
+
[d.SWAP_AMOUNT_TOO_LOW]: "Swap amount too low for this pair.",
|
|
652
|
+
[d.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
653
|
+
[d.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
654
|
+
[d.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
655
|
+
[d.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
|
|
656
|
+
[d.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
|
|
657
|
+
[d.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
|
|
658
|
+
[d.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
|
|
659
|
+
[d.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
|
|
660
|
+
[d.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
|
|
661
|
+
[d.INVALID_CHAIN]: "Invalid chain {0}.",
|
|
662
|
+
[d.INVALID_ASSET]: "Invalid asset {0}.",
|
|
663
|
+
[d.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
|
|
664
|
+
[d.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
|
|
665
|
+
[d.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
|
|
666
|
+
[d.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
|
|
667
|
+
[d.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
|
|
668
|
+
[d.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
|
|
669
|
+
[d.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
|
|
670
|
+
[d.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
|
|
671
|
+
[d.INVALID_QUOTE_MODE]: "Invalid quote mode.",
|
|
672
|
+
[d.NO_QUOTES]: "No quotes to service this request.",
|
|
673
|
+
[d.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
|
|
674
|
+
[d.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
|
|
675
|
+
[d.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
|
|
676
|
+
[d.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
|
|
677
|
+
[d.NO_PRICE]: "No price for asset {0}.",
|
|
678
|
+
[d.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
679
|
+
[d.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
680
|
+
[d.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
681
681
|
}, ce = (e, t) => {
|
|
682
682
|
let n = ft[e];
|
|
683
683
|
if (!n)
|
|
@@ -686,7 +686,7 @@ const ft = {
|
|
|
686
686
|
n = (n == null ? void 0 : n.replace(`{${a}}`, t[a])) ?? "";
|
|
687
687
|
return n;
|
|
688
688
|
};
|
|
689
|
-
let Xn = class
|
|
689
|
+
let Xn = class Fe extends Error {
|
|
690
690
|
constructor({
|
|
691
691
|
status: t,
|
|
692
692
|
revision: n,
|
|
@@ -694,7 +694,7 @@ let Xn = class He extends Error {
|
|
|
694
694
|
code: i,
|
|
695
695
|
message: s,
|
|
696
696
|
type: p,
|
|
697
|
-
options: { shouldLog: u, shouldThrow: y, shouldTrace:
|
|
697
|
+
options: { shouldLog: u, shouldThrow: y, shouldTrace: o } = {
|
|
698
698
|
shouldLog: !0,
|
|
699
699
|
shouldThrow: !0,
|
|
700
700
|
shouldTrace: !0
|
|
@@ -702,14 +702,14 @@ let Xn = class He extends Error {
|
|
|
702
702
|
displayMessageParams: m
|
|
703
703
|
}) {
|
|
704
704
|
const T = s || ce(i, m || []) || "";
|
|
705
|
-
super(T),
|
|
705
|
+
super(T), D(this, "status"), D(this, "revision"), D(this, "type"), D(this, "module"), D(this, "code"), D(this, "message"), D(this, "display"), D(this, "stack"), D(this, "options"), D(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = T, this.display = ce(i, m || []), this.code = i, this.type = p || He.UNHANDLED_ERROR, this.options = {
|
|
706
706
|
shouldLog: u || !0,
|
|
707
|
-
shouldTrace:
|
|
707
|
+
shouldTrace: o || !0,
|
|
708
708
|
shouldThrow: y || !1
|
|
709
709
|
}, this.displayMessageParams = m || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
710
710
|
}
|
|
711
711
|
static fromErrorInfo(t) {
|
|
712
|
-
return new
|
|
712
|
+
return new Fe(t);
|
|
713
713
|
}
|
|
714
714
|
toErrorInfo() {
|
|
715
715
|
return { ...this, identifier: this.identifier };
|
|
@@ -750,7 +750,7 @@ const jn = {
|
|
|
750
750
|
DOT: [0, 0, 0, 0, 0],
|
|
751
751
|
FLIP: [0, 0, 0, 0, 0]
|
|
752
752
|
};
|
|
753
|
-
var
|
|
753
|
+
var A = /* @__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.ZEC = 8] = "ZEC", e))(A || {});
|
|
754
754
|
const Kn = [
|
|
755
755
|
"DOT",
|
|
756
756
|
"FLIP"
|
|
@@ -788,23 +788,23 @@ const Kn = [
|
|
|
788
788
|
"THOR"
|
|
789
789
|
/* THORChain */
|
|
790
790
|
], Jn = wt;
|
|
791
|
-
var
|
|
792
|
-
const oe = Object.values(r), Mt = Object.keys(r),
|
|
791
|
+
var 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.Dash = "dash", 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 || {}), Ue = /* @__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.Dash = "https://node-router.thorswap.net/dash", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Kujira = "https://rpc-kujira.synergynodes.com/", 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))(Ue || {}), J = /* @__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))(J || {});
|
|
792
|
+
const oe = Object.values(r), Mt = Object.keys(r), Ie = oe.reduce(
|
|
793
793
|
(e, t) => {
|
|
794
794
|
const n = Mt.find((a) => r[a] === t);
|
|
795
795
|
return n && (e[t] = n), e;
|
|
796
796
|
},
|
|
797
797
|
{}
|
|
798
|
-
),
|
|
799
|
-
(e, t) => (e[t] =
|
|
798
|
+
), We = oe.reduce(
|
|
799
|
+
(e, t) => (e[t] = Me[Ie[t]], e),
|
|
800
800
|
{}
|
|
801
801
|
), It = oe.reduce(
|
|
802
|
-
(e, t) => (e[t] =
|
|
802
|
+
(e, t) => (e[t] = Ue[Ie[t]], e),
|
|
803
803
|
{}
|
|
804
804
|
), Zn = oe.reduce(
|
|
805
805
|
(e, t) => {
|
|
806
|
-
const n = `${
|
|
807
|
-
return e[t] =
|
|
806
|
+
const n = `${Ie[t]}Hex`;
|
|
807
|
+
return e[t] = Me[n], e;
|
|
808
808
|
},
|
|
809
809
|
{}
|
|
810
810
|
), zn = {
|
|
@@ -835,7 +835,7 @@ const oe = Object.values(r), Mt = Object.keys(r), we = oe.reduce(
|
|
|
835
835
|
"thorchain-stagenet-v2": "THOR",
|
|
836
836
|
"thorchain-mainnet-v1": "THOR"
|
|
837
837
|
/* THORChain */
|
|
838
|
-
},
|
|
838
|
+
}, $e = {
|
|
839
839
|
ARB: "https://arbiscan.io",
|
|
840
840
|
AVAX: "https://snowtrace.io",
|
|
841
841
|
BSC: "https://bscscan.com",
|
|
@@ -855,17 +855,17 @@ const oe = Object.values(r), Mt = Object.keys(r), we = oe.reduce(
|
|
|
855
855
|
MATIC: "https://polygonscan.com",
|
|
856
856
|
THOR: "https://runescan.io"
|
|
857
857
|
};
|
|
858
|
-
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 || {}),
|
|
858
|
+
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 || {}), Y = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(Y || {}), gt = /* @__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))(gt || {}), Ct = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(Ct || {}), vt = Object.defineProperty, Nt = (e, t, n) => t in e ? vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, v = (e, t, n) => (Nt(e, typeof t != "symbol" ? t + "" : t, n), n), Dt = (e, t, n) => {
|
|
859
859
|
if (!t.has(e))
|
|
860
860
|
throw TypeError("Cannot " + n);
|
|
861
|
-
},
|
|
861
|
+
}, X = (e, t, n) => {
|
|
862
862
|
if (t.has(e))
|
|
863
863
|
throw TypeError("Cannot add the same private member more than once");
|
|
864
864
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
865
|
-
}, M = (e, t, n) => (Dt(e, t, "access private method"), n),
|
|
866
|
-
|
|
867
|
-
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.Dash = "DASH", 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 || {}),
|
|
868
|
-
const le = Object.values(de), Pt = Object.keys(de),
|
|
865
|
+
}, M = (e, t, n) => (Dt(e, t, "access private method"), n), l = /* @__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))(l || {});
|
|
866
|
+
l.INVALID_INPUT_PARAMETERS + "", l.UNKNOWN_PROVIDERS + "", l.CANNOT_FIND_INBOUND_ADDRESS + "", l.NO_INBOUND_ADDRESSES + "", l.CHAIN_HALTED_OR_UNSUPPORTED + "", l.MISSING_INPUT_PARAMETER + "", l.INVALID_TYPE_GENERIC + "", l.INVALID_NUMBER_STRING + "", l.INVALID_NUMBER + "", l.INVALID_BOOLEAN + "", l.INVALID_OBJECT + "", l.INVALID_ARRAY + "", l.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", l.SELL_BUY_ASSETS_ARE_THE_SAME + "", l.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", l.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", l.AFF_ADDRESS_TOO_LONG + "", l.AFF_BPS_INTEGER_MAX_500 + "", l.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", l.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", l.PREFERRED_PROVIDER_NOT_SUPPORTED + "", l.SOURCE_ADDRESS_SMART_CONTRACT + "", l.SWAP_AMOUNT_TOO_LOW + "", l.DESTINATION_ADDRESS_SMART_CONTRACT + "", l.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", l.INVALID_PROVIDER + "", l.MISSING_CROSS_CHAIN_PROVIDER + "", l.MISSING_AVAX_PROVIDER + "", l.MISSING_BSC_PROVIDER + "", l.MISSING_ETH_PROVIDER + "", l.MISSING_ARB_PROVIDER + "", l.INVALID_PROVIDER_FOR_SWAP_OUT + "", l.INVALID_CHAIN + "", l.INVALID_ASSET + "", l.UNSUPPORTED_CHAIN + "", l.UNSUPPORTED_ASSET + "", l.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", l.THORNODE_QUOTE_GENERIC_ERROR + "", l.INVALID_SOURCE_ADDRESS + "", l.INVALID_DESTINATION_ADDRESS + "", l.NOT_ENOUGH_SYNTH_BALANCE + "", l.SYNTH_MINTING_CAP_REACHED + "", l.INVALID_QUOTE_MODE + "", l.NO_QUOTES + "", l.SERVICE_UNAVAILABLE_GENERIC + "", l.MISSING_GAS_DATA_GENERIC + "", l.MISSING_TOKEN_INFO_GENERIC + "", l.CANT_FIND_TOKEN_LIST + "", l.NO_PRICE + "", l.PRICE_IS_STALE + "", l.ADDRESS_NOT_WHITELISTED + "", l.ADDRESS_ALREADY_CLAIMED + "";
|
|
867
|
+
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.Dash = "DASH", 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 || {}), ge = /* @__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.Dash = "dash", 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))(ge || {}), qe = /* @__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.Dash = "https://node-router.thorswap.net/dash", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Kujira = "https://rpc-kujira.synergynodes.com/", 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))(qe || {}), 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 || {});
|
|
868
|
+
const le = Object.values(de), Pt = Object.keys(de), Ce = le.reduce(
|
|
869
869
|
(e, t) => {
|
|
870
870
|
const n = Pt.find((a) => de[a] === t);
|
|
871
871
|
return n && (e[t] = n), e;
|
|
@@ -873,21 +873,21 @@ const le = Object.values(de), Pt = Object.keys(de), Ie = le.reduce(
|
|
|
873
873
|
{}
|
|
874
874
|
);
|
|
875
875
|
le.reduce(
|
|
876
|
-
(e, t) => (e[t] =
|
|
876
|
+
(e, t) => (e[t] = ge[Ce[t]], e),
|
|
877
877
|
{}
|
|
878
878
|
);
|
|
879
879
|
le.reduce(
|
|
880
|
-
(e, t) => (e[t] =
|
|
880
|
+
(e, t) => (e[t] = qe[Ce[t]], e),
|
|
881
881
|
{}
|
|
882
882
|
);
|
|
883
883
|
le.reduce(
|
|
884
884
|
(e, t) => {
|
|
885
|
-
const n = `${
|
|
886
|
-
return e[t] =
|
|
885
|
+
const n = `${Ce[t]}Hex`;
|
|
886
|
+
return e[t] = ge[n], e;
|
|
887
887
|
},
|
|
888
888
|
{}
|
|
889
889
|
);
|
|
890
|
-
class
|
|
890
|
+
class Ne extends Error {
|
|
891
891
|
constructor(t, n, a) {
|
|
892
892
|
const i = t.status || t.status === 0 ? t.status : "", s = t.statusText || "", p = `${i} ${s}`.trim(), u = p ? `status code ${p}` : "an unknown error";
|
|
893
893
|
super(`Request failed with ${u}`), Object.defineProperty(this, "response", {
|
|
@@ -908,7 +908,7 @@ class Ce extends Error {
|
|
|
908
908
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
|
-
class
|
|
911
|
+
class Ge extends Error {
|
|
912
912
|
constructor(t) {
|
|
913
913
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
914
914
|
enumerable: !0,
|
|
@@ -918,25 +918,25 @@ class qe extends Error {
|
|
|
918
918
|
}), this.name = "TimeoutError", this.request = t;
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
|
-
const
|
|
921
|
+
const ae = (e) => e !== null && typeof e == "object", ne = (...e) => {
|
|
922
922
|
for (const t of e)
|
|
923
|
-
if ((!
|
|
923
|
+
if ((!ae(t) || Array.isArray(t)) && t !== void 0)
|
|
924
924
|
throw new TypeError("The `options` argument must be an object");
|
|
925
|
-
return
|
|
926
|
-
},
|
|
925
|
+
return ve({}, ...e);
|
|
926
|
+
}, Xe = (e = {}, t = {}) => {
|
|
927
927
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, i = new globalThis.Headers(t);
|
|
928
928
|
for (const [s, p] of i.entries())
|
|
929
929
|
a && p === "undefined" || p === void 0 ? n.delete(s) : n.set(s, p);
|
|
930
930
|
return n;
|
|
931
|
-
},
|
|
931
|
+
}, ve = (...e) => {
|
|
932
932
|
let t = {}, n = {};
|
|
933
933
|
for (const a of e)
|
|
934
934
|
if (Array.isArray(a))
|
|
935
935
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
936
|
-
else if (
|
|
936
|
+
else if (ae(a)) {
|
|
937
937
|
for (let [i, s] of Object.entries(a))
|
|
938
|
-
|
|
939
|
-
|
|
938
|
+
ae(s) && i in t && (s = ve(t[i], s)), t = { ...t, [i]: s };
|
|
939
|
+
ae(a.headers) && (n = Xe(n, a.headers), t.headers = n);
|
|
940
940
|
}
|
|
941
941
|
return t;
|
|
942
942
|
}, kt = (() => {
|
|
@@ -950,13 +950,13 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
950
950
|
return e = !0, "half";
|
|
951
951
|
}
|
|
952
952
|
}).headers.has("Content-Type")), e && !t;
|
|
953
|
-
})(), xt = typeof globalThis.AbortController == "function", Bt = typeof globalThis.ReadableStream == "function", Lt = typeof globalThis.FormData == "function",
|
|
953
|
+
})(), xt = typeof globalThis.AbortController == "function", Bt = typeof globalThis.ReadableStream == "function", Lt = typeof globalThis.FormData == "function", je = ["get", "post", "put", "patch", "head", "delete"], Vt = {
|
|
954
954
|
json: "application/json",
|
|
955
955
|
text: "text/*",
|
|
956
956
|
formData: "multipart/form-data",
|
|
957
957
|
arrayBuffer: "*/*",
|
|
958
958
|
blob: "*/*"
|
|
959
|
-
}, be = 2147483647,
|
|
959
|
+
}, be = 2147483647, Ke = Symbol("stop"), Ht = {
|
|
960
960
|
json: !0,
|
|
961
961
|
parseJson: !0,
|
|
962
962
|
searchParams: !0,
|
|
@@ -983,18 +983,18 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
983
983
|
window: !0,
|
|
984
984
|
dispatcher: !0,
|
|
985
985
|
duplex: !0
|
|
986
|
-
}, Ut = (e) =>
|
|
986
|
+
}, Ut = (e) => je.includes(e) ? e.toUpperCase() : e, Wt = ["get", "put", "head", "delete", "options", "trace"], $t = [408, 413, 429, 500, 502, 503, 504], Ye = [413, 429, 503], De = {
|
|
987
987
|
limit: 2,
|
|
988
988
|
methods: Wt,
|
|
989
989
|
statusCodes: $t,
|
|
990
|
-
afterStatusCodes:
|
|
990
|
+
afterStatusCodes: Ye,
|
|
991
991
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
992
992
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
993
993
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
994
994
|
}, qt = (e = {}) => {
|
|
995
995
|
if (typeof e == "number")
|
|
996
996
|
return {
|
|
997
|
-
...
|
|
997
|
+
...De,
|
|
998
998
|
limit: e
|
|
999
999
|
};
|
|
1000
1000
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -1002,15 +1002,15 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
1002
1002
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
1003
1003
|
throw new Error("retry.statusCodes must be an array");
|
|
1004
1004
|
return {
|
|
1005
|
-
...
|
|
1005
|
+
...De,
|
|
1006
1006
|
...e,
|
|
1007
|
-
afterStatusCodes:
|
|
1007
|
+
afterStatusCodes: Ye
|
|
1008
1008
|
};
|
|
1009
1009
|
};
|
|
1010
1010
|
async function Gt(e, t, n, a) {
|
|
1011
1011
|
return new Promise((i, s) => {
|
|
1012
1012
|
const p = setTimeout(() => {
|
|
1013
|
-
n && n.abort(), s(new
|
|
1013
|
+
n && n.abort(), s(new Ge(e));
|
|
1014
1014
|
}, a.timeout);
|
|
1015
1015
|
a.fetch(e, t).then(i).catch(s).then(() => {
|
|
1016
1016
|
clearTimeout(p);
|
|
@@ -1046,7 +1046,7 @@ class re {
|
|
|
1046
1046
|
y instanceof globalThis.Response && (p = y);
|
|
1047
1047
|
}
|
|
1048
1048
|
if (a._decorateResponse(p), !p.ok && a._options.throwHttpErrors) {
|
|
1049
|
-
let u = new
|
|
1049
|
+
let u = new Ne(p, a.request, a._options);
|
|
1050
1050
|
for (const y of a._options.hooks.beforeError)
|
|
1051
1051
|
u = await y(u);
|
|
1052
1052
|
throw u;
|
|
@@ -1105,8 +1105,8 @@ class re {
|
|
|
1105
1105
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
1106
1106
|
credentials: this._input.credentials || "same-origin",
|
|
1107
1107
|
...n,
|
|
1108
|
-
headers:
|
|
1109
|
-
hooks:
|
|
1108
|
+
headers: Xe(this._input.headers, n.headers),
|
|
1109
|
+
hooks: ve({
|
|
1110
1110
|
beforeRequest: [],
|
|
1111
1111
|
beforeRetry: [],
|
|
1112
1112
|
beforeError: [],
|
|
@@ -1142,8 +1142,8 @@ class re {
|
|
|
1142
1142
|
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 }));
|
|
1143
1143
|
}
|
|
1144
1144
|
_calculateRetryDelay(t) {
|
|
1145
|
-
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof
|
|
1146
|
-
if (t instanceof
|
|
1145
|
+
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof Ge)) {
|
|
1146
|
+
if (t instanceof Ne) {
|
|
1147
1147
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1148
1148
|
return 0;
|
|
1149
1149
|
const a = t.response.headers.get("Retry-After");
|
|
@@ -1175,7 +1175,7 @@ class re {
|
|
|
1175
1175
|
options: this._options,
|
|
1176
1176
|
error: n,
|
|
1177
1177
|
retryCount: this._retryCount
|
|
1178
|
-
}) ===
|
|
1178
|
+
}) === Ke)
|
|
1179
1179
|
return;
|
|
1180
1180
|
return this._retry(t);
|
|
1181
1181
|
}
|
|
@@ -1208,17 +1208,17 @@ class re {
|
|
|
1208
1208
|
const p = t.body.getReader();
|
|
1209
1209
|
n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
|
|
1210
1210
|
async function u() {
|
|
1211
|
-
const { done: y, value:
|
|
1211
|
+
const { done: y, value: o } = await p.read();
|
|
1212
1212
|
if (y) {
|
|
1213
1213
|
s.close();
|
|
1214
1214
|
return;
|
|
1215
1215
|
}
|
|
1216
1216
|
if (n) {
|
|
1217
|
-
i +=
|
|
1217
|
+
i += o.byteLength;
|
|
1218
1218
|
const m = a === 0 ? 0 : i / a;
|
|
1219
|
-
n({ percent: m, transferredBytes: i, totalBytes: a },
|
|
1219
|
+
n({ percent: m, transferredBytes: i, totalBytes: a }, o);
|
|
1220
1220
|
}
|
|
1221
|
-
s.enqueue(
|
|
1221
|
+
s.enqueue(o), await u();
|
|
1222
1222
|
}
|
|
1223
1223
|
await u();
|
|
1224
1224
|
}
|
|
@@ -1230,14 +1230,14 @@ class re {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
1232
|
/*! MIT License © Sindre Sorhus */
|
|
1233
|
-
const
|
|
1234
|
-
const t = (n, a) => re.create(n,
|
|
1235
|
-
for (const n of
|
|
1236
|
-
t[n] = (a, i) => re.create(a,
|
|
1237
|
-
return t.create = (n) =>
|
|
1238
|
-
},
|
|
1239
|
-
let
|
|
1240
|
-
const
|
|
1233
|
+
const Ee = (e) => {
|
|
1234
|
+
const t = (n, a) => re.create(n, ne(e, a));
|
|
1235
|
+
for (const n of je)
|
|
1236
|
+
t[n] = (a, i) => re.create(a, ne(e, i, { method: n }));
|
|
1237
|
+
return t.create = (n) => Ee(ne(n)), t.extend = (n) => Ee(ne(e, n)), t.stop = Ke, t;
|
|
1238
|
+
}, Qe = Ee();
|
|
1239
|
+
let ie;
|
|
1240
|
+
const x = {
|
|
1241
1241
|
CachedPrices: `${L.ThorswapApi}/tokenlist/cached-price`,
|
|
1242
1242
|
GasRates: `${L.ThorswapApi}/resource-worker/gasPrice/getAll`,
|
|
1243
1243
|
Quote: `${L.ThorswapApi}/aggregator/tokens/quote`,
|
|
@@ -1245,33 +1245,33 @@ const k = {
|
|
|
1245
1245
|
TokenlistProviders: `${L.ThorswapApi}/tokenlist/providers`,
|
|
1246
1246
|
TokenList: `${L.ThorswapStatic}/token-list`,
|
|
1247
1247
|
Thorname: `${L.ThorswapApi}/thorname`
|
|
1248
|
-
},
|
|
1249
|
-
|
|
1248
|
+
}, Je = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Pe = () => ie || (ie = Qe.create({ headers: Je }), ie), ea = ({ apiKey: e, ...t }) => {
|
|
1249
|
+
ie = Qe.create({
|
|
1250
1250
|
...t,
|
|
1251
|
-
headers: { ...
|
|
1251
|
+
headers: { ...Je, ...t.headers, "x-api-key": e }
|
|
1252
1252
|
});
|
|
1253
1253
|
}, g = {
|
|
1254
|
-
get: (e, t) =>
|
|
1255
|
-
post: (e, t) =>
|
|
1254
|
+
get: (e, t) => Pe().get(e, t).json(),
|
|
1255
|
+
post: (e, t) => Pe().post(e, t).json()
|
|
1256
1256
|
}, Kt = ({ tokens: e, ...t }) => {
|
|
1257
1257
|
const n = new URLSearchParams();
|
|
1258
|
-
return e.filter((a, i, s) => s.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(
|
|
1258
|
+
return e.filter((a, i, s) => s.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(x.CachedPrices, {
|
|
1259
1259
|
body: n.toString(),
|
|
1260
1260
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1261
1261
|
});
|
|
1262
1262
|
}, ta = {
|
|
1263
1263
|
getCachedPrices: Kt,
|
|
1264
|
-
getQuote: (e) => g.get(
|
|
1265
|
-
getGasRates: () => g.get(
|
|
1266
|
-
getTxnDetails: (e) => g.get(
|
|
1267
|
-
getTokenlistProviders: () => g.get(
|
|
1268
|
-
getTokenList: (e) => g.get(`${
|
|
1269
|
-
getThornameAddresses: (e) => g.get(`${
|
|
1270
|
-
getThornameRegisteredChains: (e) => g.get(`${
|
|
1271
|
-
getThornameRlookup: (e, t) => g.get(`${
|
|
1264
|
+
getQuote: (e) => g.get(x.Quote, { searchParams: e }),
|
|
1265
|
+
getGasRates: () => g.get(x.GasRates),
|
|
1266
|
+
getTxnDetails: (e) => g.get(x.Txn, { searchParams: e }),
|
|
1267
|
+
getTokenlistProviders: () => g.get(x.TokenlistProviders),
|
|
1268
|
+
getTokenList: (e) => g.get(`${x.TokenList}/${e}.json`),
|
|
1269
|
+
getThornameAddresses: (e) => g.get(`${x.Thorname}/${e}`),
|
|
1270
|
+
getThornameRegisteredChains: (e) => g.get(`${x.Thorname}/chains/${e}`),
|
|
1271
|
+
getThornameRlookup: (e, t) => g.get(`${x.Thorname}/rlookup`, { searchParams: { address: e, chain: t } })
|
|
1272
1272
|
};
|
|
1273
1273
|
var Yt = /* @__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))(Yt || {}), Qt = /* @__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))(Qt || {}), Jt = /* @__PURE__ */ ((e) => (e[e.NOT_STARTED = 0] = "NOT_STARTED", e[e.SUCCESS = 1] = "SUCCESS", e[e.REFUNDED = 2] = "REFUNDED", e))(Jt || {});
|
|
1274
|
-
const Zt = "0x313ce567",
|
|
1274
|
+
const Zt = "0x313ce567", Ze = async ({ chain: e, to: t }) => {
|
|
1275
1275
|
try {
|
|
1276
1276
|
const { result: n } = await g.post(It[e], {
|
|
1277
1277
|
headers: {
|
|
@@ -1288,17 +1288,17 @@ const Zt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1288
1288
|
});
|
|
1289
1289
|
return parseInt(BigInt(n).toString());
|
|
1290
1290
|
} catch (n) {
|
|
1291
|
-
return console.error(n),
|
|
1291
|
+
return console.error(n), A[e];
|
|
1292
1292
|
}
|
|
1293
1293
|
}, zt = async (e) => {
|
|
1294
1294
|
if (e === r.Ethereum)
|
|
1295
|
-
return
|
|
1295
|
+
return A.ETH;
|
|
1296
1296
|
const [, t] = e.split("-");
|
|
1297
|
-
return t != null && t.startsWith("0x") ?
|
|
1297
|
+
return t != null && t.startsWith("0x") ? Ze({ chain: r.Ethereum, to: t }) : A.ETH;
|
|
1298
1298
|
}, en = async (e) => {
|
|
1299
1299
|
const [, t] = e.split("-");
|
|
1300
|
-
return t != null && t.startsWith("0x") ?
|
|
1301
|
-
}, tn = async (e) => (e === r.BinanceSmartChain,
|
|
1300
|
+
return t != null && t.startsWith("0x") ? Ze({ chain: r.Avalanche, to: t.toLowerCase() }) : A.AVAX;
|
|
1301
|
+
}, tn = async (e) => (e === r.BinanceSmartChain, A.BSC), nn = async ({ chain: e, symbol: t }) => {
|
|
1302
1302
|
switch (e) {
|
|
1303
1303
|
case r.Ethereum:
|
|
1304
1304
|
return zt(t);
|
|
@@ -1307,13 +1307,13 @@ const Zt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1307
1307
|
case r.BinanceSmartChain:
|
|
1308
1308
|
return tn(t);
|
|
1309
1309
|
default:
|
|
1310
|
-
return
|
|
1310
|
+
return A[e];
|
|
1311
1311
|
}
|
|
1312
1312
|
}, an = {
|
|
1313
|
-
[
|
|
1314
|
-
[
|
|
1315
|
-
[
|
|
1316
|
-
},
|
|
1313
|
+
[Y.Average]: 1.2,
|
|
1314
|
+
[Y.Fast]: 1.5,
|
|
1315
|
+
[Y.Fastest]: 2
|
|
1316
|
+
}, ze = ({ chain: e, symbol: t }) => {
|
|
1317
1317
|
switch (e) {
|
|
1318
1318
|
case r.Arbitrum:
|
|
1319
1319
|
case r.Optimism:
|
|
@@ -1340,19 +1340,19 @@ const Zt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1340
1340
|
case `${r.Ethereum}.vTHOR`:
|
|
1341
1341
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
1342
1342
|
case r.Cosmos:
|
|
1343
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
1343
|
+
return { identifier: "GAIA.ATOM", decimal: A[e] };
|
|
1344
1344
|
case r.THORChain:
|
|
1345
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
1345
|
+
return { identifier: "THOR.RUNE", decimal: A[e] };
|
|
1346
1346
|
case r.BinanceSmartChain:
|
|
1347
|
-
return { identifier: "BSC.BNB", decimal:
|
|
1347
|
+
return { identifier: "BSC.BNB", decimal: A[e] };
|
|
1348
1348
|
case r.Maya:
|
|
1349
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
1349
|
+
return { identifier: "MAYA.CACAO", decimal: A.MAYA };
|
|
1350
1350
|
case `${r.Maya}.MAYA`:
|
|
1351
1351
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
1352
1352
|
case `${r.Kujira}.USK`:
|
|
1353
1353
|
return { identifier: `${r.Kujira}.USK`, decimal: 6 };
|
|
1354
1354
|
default:
|
|
1355
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
1355
|
+
return { identifier: `${e}.${e}`, decimal: A[e] };
|
|
1356
1356
|
}
|
|
1357
1357
|
}, rn = ({ chain: e, symbol: t }) => {
|
|
1358
1358
|
if (t.includes("/"))
|
|
@@ -1391,7 +1391,7 @@ const Zt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1391
1391
|
if (!Rt.includes(t))
|
|
1392
1392
|
return !0;
|
|
1393
1393
|
const [, a] = n.split("-");
|
|
1394
|
-
return
|
|
1394
|
+
return ze({ chain: t, symbol: n }) || !!a;
|
|
1395
1395
|
}, aa = (e) => e.filter(({ chain: t, value: n, symbol: a }) => {
|
|
1396
1396
|
const i = `${t}.${a}`;
|
|
1397
1397
|
return !pn.test(i) && un(i) && n !== "0";
|
|
@@ -1401,15 +1401,15 @@ function yn({
|
|
|
1401
1401
|
poolUnits: t,
|
|
1402
1402
|
runeDepth: n
|
|
1403
1403
|
}) {
|
|
1404
|
-
const a = I(e), i = I(t), s = I(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2),
|
|
1405
|
-
return p.mul(u.sub(y).add(
|
|
1404
|
+
const a = I(e), i = I(t), s = I(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2), o = a.mul(a), m = i.mul(i).mul(i);
|
|
1405
|
+
return p.mul(u.sub(y).add(o)).div(m);
|
|
1406
1406
|
}
|
|
1407
1407
|
function on({
|
|
1408
1408
|
liquidityUnits: e,
|
|
1409
1409
|
poolUnits: t,
|
|
1410
1410
|
assetDepth: n
|
|
1411
1411
|
}) {
|
|
1412
|
-
const a = I(e), i = I(t), s = I(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2),
|
|
1412
|
+
const a = I(e), i = I(t), s = I(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2), o = a.mul(a), m = p.mul(u.sub(y).add(o)), T = i.mul(i).mul(i);
|
|
1413
1413
|
return m.div(T);
|
|
1414
1414
|
}
|
|
1415
1415
|
function ia({
|
|
@@ -1429,7 +1429,7 @@ function sa({
|
|
|
1429
1429
|
return on({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1430
1430
|
}
|
|
1431
1431
|
function I(e) {
|
|
1432
|
-
return
|
|
1432
|
+
return k.fromBigInt(BigInt(e), A.THOR);
|
|
1433
1433
|
}
|
|
1434
1434
|
function dn({
|
|
1435
1435
|
liquidityUnits: e,
|
|
@@ -1463,7 +1463,7 @@ function pa({
|
|
|
1463
1463
|
runeAmount: i,
|
|
1464
1464
|
assetAmount: s
|
|
1465
1465
|
}) {
|
|
1466
|
-
const p = new
|
|
1466
|
+
const p = new k({ value: e, decimal: 8 }), u = new k({ value: n, decimal: 8 }), y = new k({ value: t, decimal: 8 }), o = new k({ value: i, decimal: 8 }), m = new k({ value: s, decimal: 8 }), T = o.mul(u), _ = m.mul(p), E = o.mul(m), R = p.mul(u), O = y.mul(T.add(_.add(E.mul(2)))), S = T.add(_.add(R.mul(2))), w = O.div(S), B = I(a).add(w);
|
|
1467
1467
|
if (w.getBaseValue("number") === 0)
|
|
1468
1468
|
return B.div(y).getBaseValue("number");
|
|
1469
1469
|
const Te = y.add(B);
|
|
@@ -1477,10 +1477,10 @@ function ua({
|
|
|
1477
1477
|
}) {
|
|
1478
1478
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1479
1479
|
return 0;
|
|
1480
|
-
const i = I(n), s = I(a), p = I(t), u = I(e), y = p.mul(i).sub(s.mul(u)),
|
|
1481
|
-
return Math.abs(y.div(
|
|
1480
|
+
const i = I(n), s = I(a), p = I(t), u = I(e), y = p.mul(i).sub(s.mul(u)), o = s.mul(u).add(i.mul(s));
|
|
1481
|
+
return Math.abs(y.div(o).getBaseValue("number"));
|
|
1482
1482
|
}
|
|
1483
|
-
const
|
|
1483
|
+
const P = (e, t) => {
|
|
1484
1484
|
switch (e) {
|
|
1485
1485
|
case f.LEAVE:
|
|
1486
1486
|
case f.BOND: {
|
|
@@ -1511,8 +1511,8 @@ const D = (e, t) => {
|
|
|
1511
1511
|
})(n, a)}:${i || ""}`;
|
|
1512
1512
|
}
|
|
1513
1513
|
case f.WITHDRAW: {
|
|
1514
|
-
const { chain: n, ticker: a, symbol: i, basisPoints: s, targetAssetString: p, singleSide: u } = t, y = n === "ETH" && a !== "ETH" ? `${a}-${i.slice(-3)}` : i,
|
|
1515
|
-
return `${e}:${n}${u ? "/" : "."}${y}:${s}${
|
|
1514
|
+
const { chain: n, ticker: a, symbol: i, basisPoints: s, targetAssetString: p, singleSide: u } = t, y = n === "ETH" && a !== "ETH" ? `${a}-${i.slice(-3)}` : i, o = !u && p ? `:${p}` : "";
|
|
1515
|
+
return `${e}:${n}${u ? "/" : "."}${y}:${s}${o}`;
|
|
1516
1516
|
}
|
|
1517
1517
|
case f.OPEN_LOAN:
|
|
1518
1518
|
case f.CLOSE_LOAN: {
|
|
@@ -1537,23 +1537,23 @@ function oa(e) {
|
|
|
1537
1537
|
function da([e, t, n, a, i]) {
|
|
1538
1538
|
return `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`;
|
|
1539
1539
|
}
|
|
1540
|
-
const
|
|
1540
|
+
const ke = [...Object.values(r), "TERRA"];
|
|
1541
1541
|
function ln(e = "") {
|
|
1542
1542
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1543
|
-
if (
|
|
1543
|
+
if (ke.includes(n))
|
|
1544
1544
|
return !0;
|
|
1545
1545
|
const [a] = t.split("/");
|
|
1546
|
-
if (
|
|
1546
|
+
if (ke.includes(a))
|
|
1547
1547
|
return !0;
|
|
1548
1548
|
throw new Error(
|
|
1549
1549
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1550
1550
|
);
|
|
1551
1551
|
}
|
|
1552
|
-
const
|
|
1552
|
+
const Z = 8, F = (e) => 10n ** BigInt(e), Q = (e) => Math.log10(parseFloat(e.toString()));
|
|
1553
1553
|
function me({
|
|
1554
1554
|
value: e,
|
|
1555
|
-
bigIntDecimal: t =
|
|
1556
|
-
decimal: n =
|
|
1555
|
+
bigIntDecimal: t = Z,
|
|
1556
|
+
decimal: n = Z
|
|
1557
1557
|
}) {
|
|
1558
1558
|
if (n === 0)
|
|
1559
1559
|
return e.toString();
|
|
@@ -1568,15 +1568,15 @@ function me({
|
|
|
1568
1568
|
""
|
|
1569
1569
|
);
|
|
1570
1570
|
}
|
|
1571
|
-
var W,
|
|
1572
|
-
const mn = class
|
|
1571
|
+
var W, j, H, $, Re, et, se, _e, pe, Oe;
|
|
1572
|
+
const mn = class tt {
|
|
1573
1573
|
constructor(t) {
|
|
1574
|
-
|
|
1575
|
-
const n =
|
|
1576
|
-
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,
|
|
1574
|
+
X(this, W), X(this, H), X(this, Re), X(this, se), X(this, pe), v(this, "decimalMultiplier", 10n ** 8n), v(this, "bigIntValue", 0n), v(this, "decimal");
|
|
1575
|
+
const n = we(t), a = typeof t == "object";
|
|
1576
|
+
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, Re, et).call(this, n);
|
|
1577
1577
|
}
|
|
1578
1578
|
static fromBigInt(t, n) {
|
|
1579
|
-
return new
|
|
1579
|
+
return new tt({
|
|
1580
1580
|
decimal: n,
|
|
1581
1581
|
value: me({ value: t, bigIntDecimal: n, decimal: n })
|
|
1582
1582
|
});
|
|
@@ -1595,16 +1595,16 @@ const mn = class et {
|
|
|
1595
1595
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1596
1596
|
}
|
|
1597
1597
|
add(...t) {
|
|
1598
|
-
return M(this, W,
|
|
1598
|
+
return M(this, W, j).call(this, "add", ...t);
|
|
1599
1599
|
}
|
|
1600
1600
|
sub(...t) {
|
|
1601
|
-
return M(this, W,
|
|
1601
|
+
return M(this, W, j).call(this, "sub", ...t);
|
|
1602
1602
|
}
|
|
1603
1603
|
mul(...t) {
|
|
1604
|
-
return M(this, W,
|
|
1604
|
+
return M(this, W, j).call(this, "mul", ...t);
|
|
1605
1605
|
}
|
|
1606
1606
|
div(...t) {
|
|
1607
|
-
return M(this, W,
|
|
1607
|
+
return M(this, W, j).call(this, "div", ...t);
|
|
1608
1608
|
}
|
|
1609
1609
|
gt(t) {
|
|
1610
1610
|
return M(this, H, $).call(this, "gt", t);
|
|
@@ -1625,7 +1625,7 @@ const mn = class et {
|
|
|
1625
1625
|
getValue(t) {
|
|
1626
1626
|
const n = this.formatBigIntToSafeValue(
|
|
1627
1627
|
this.bigIntValue,
|
|
1628
|
-
this.decimal ||
|
|
1628
|
+
this.decimal || Q(this.decimalMultiplier)
|
|
1629
1629
|
);
|
|
1630
1630
|
switch (t) {
|
|
1631
1631
|
case "number":
|
|
@@ -1638,7 +1638,7 @@ const mn = class et {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
// @ts-expect-error
|
|
1640
1640
|
getBaseValue(t) {
|
|
1641
|
-
const n = this.decimalMultiplier / F(this.decimal ||
|
|
1641
|
+
const n = this.decimalMultiplier / F(this.decimal || A.THOR), a = this.bigIntValue / n;
|
|
1642
1642
|
switch (t) {
|
|
1643
1643
|
case "number":
|
|
1644
1644
|
return Number(a);
|
|
@@ -1651,8 +1651,8 @@ const mn = class et {
|
|
|
1651
1651
|
getBigIntValue(t, n) {
|
|
1652
1652
|
if (!n && typeof t == "object")
|
|
1653
1653
|
return t.bigIntValue;
|
|
1654
|
-
const a =
|
|
1655
|
-
return i === "0" || i === "undefined" ? 0n : M(this, pe,
|
|
1654
|
+
const a = we(t), i = ue(a);
|
|
1655
|
+
return i === "0" || i === "undefined" ? 0n : M(this, pe, Oe).call(this, i, n);
|
|
1656
1656
|
}
|
|
1657
1657
|
toSignificant(t = 6) {
|
|
1658
1658
|
const [n, a] = this.getValue("string").split("."), i = n || "", s = a || "";
|
|
@@ -1694,36 +1694,36 @@ const mn = class et {
|
|
|
1694
1694
|
decimalSeparator: i = ".",
|
|
1695
1695
|
thousandSeparator: s = ","
|
|
1696
1696
|
} = {}) {
|
|
1697
|
-
const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."),
|
|
1697
|
+
const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."), o = u.replace(/\B(?=(\d{3})+(?!\d))/g, s), m = !u && !y ? "0.00" : u === "0" ? `${parseFloat(`0.${y}`)}`.replace(".", i) : `${o}${parseInt(y) ? `${i}${y.slice(0, a)}` : ""}`;
|
|
1698
1698
|
return `${n === "start" ? t : ""}${m}${n === "end" ? t : ""}`;
|
|
1699
1699
|
}
|
|
1700
1700
|
formatBigIntToSafeValue(t, n) {
|
|
1701
|
-
const a = n || this.decimal ||
|
|
1701
|
+
const a = n || this.decimal || Z, i = Math.max(
|
|
1702
1702
|
a,
|
|
1703
|
-
|
|
1704
|
-
), s = t < 0n, p = t.toString().substring(s ? 1 : 0), u = i - (p.length - 1), y = u > 0 ? "0".repeat(u) + p : p,
|
|
1703
|
+
Q(this.decimalMultiplier)
|
|
1704
|
+
), s = t < 0n, p = t.toString().substring(s ? 1 : 0), u = i - (p.length - 1), y = u > 0 ? "0".repeat(u) + p : p, o = y.length - i;
|
|
1705
1705
|
let m = y.slice(-i);
|
|
1706
1706
|
return parseInt(m[a]) >= 5 ? m = `${m.substring(0, a - 1)}${(parseInt(m[a - 1]) + 1).toString()}` : m = m.substring(0, a), `${s ? "-" : ""}${y.slice(
|
|
1707
1707
|
0,
|
|
1708
|
-
|
|
1708
|
+
o
|
|
1709
1709
|
)}.${m}`.replace(/\.?0*$/, "");
|
|
1710
1710
|
}
|
|
1711
1711
|
};
|
|
1712
|
-
W = /* @__PURE__ */ new WeakSet(),
|
|
1713
|
-
const n = M(this,
|
|
1712
|
+
W = /* @__PURE__ */ new WeakSet(), j = function(e, ...t) {
|
|
1713
|
+
const n = M(this, se, _e).call(this, this, ...t), a = Math.max(n, Q(this.decimalMultiplier)), i = F(a), s = t.reduce(
|
|
1714
1714
|
(u, y) => {
|
|
1715
|
-
const
|
|
1715
|
+
const o = this.getBigIntValue(y, a);
|
|
1716
1716
|
switch (e) {
|
|
1717
1717
|
case "add":
|
|
1718
|
-
return u +
|
|
1718
|
+
return u + o;
|
|
1719
1719
|
case "sub":
|
|
1720
|
-
return u -
|
|
1720
|
+
return u - o;
|
|
1721
1721
|
case "mul":
|
|
1722
|
-
return u *
|
|
1722
|
+
return u * o / i;
|
|
1723
1723
|
case "div": {
|
|
1724
|
-
if (
|
|
1724
|
+
if (o === 0n)
|
|
1725
1725
|
throw new RangeError("Division by zero");
|
|
1726
|
-
return u * i /
|
|
1726
|
+
return u * i / o;
|
|
1727
1727
|
}
|
|
1728
1728
|
default:
|
|
1729
1729
|
return u;
|
|
@@ -1743,7 +1743,7 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1743
1743
|
identifier: this.toString()
|
|
1744
1744
|
});
|
|
1745
1745
|
}, H = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1746
|
-
const n = M(this,
|
|
1746
|
+
const n = M(this, se, _e).call(this, this, ...t), a = this.getBigIntValue(t[0], n), i = this.getBigIntValue(this, n);
|
|
1747
1747
|
switch (e) {
|
|
1748
1748
|
case "gt":
|
|
1749
1749
|
return i > a;
|
|
@@ -1756,35 +1756,46 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1756
1756
|
case "eqValue":
|
|
1757
1757
|
return i === a;
|
|
1758
1758
|
}
|
|
1759
|
-
},
|
|
1759
|
+
}, Re = /* @__PURE__ */ new WeakSet(), et = function(e) {
|
|
1760
1760
|
const t = ue(e) || "0";
|
|
1761
|
-
this.bigIntValue = M(this, pe,
|
|
1762
|
-
},
|
|
1763
|
-
const t = e.map((n) => typeof n == "object" ? n.decimal ||
|
|
1764
|
-
return Math.max(...t,
|
|
1765
|
-
}, pe = /* @__PURE__ */ new WeakSet(),
|
|
1766
|
-
const n = t ? F(t) : this.decimalMultiplier, a =
|
|
1761
|
+
this.bigIntValue = M(this, pe, Oe).call(this, t);
|
|
1762
|
+
}, se = /* @__PURE__ */ new WeakSet(), _e = function(...e) {
|
|
1763
|
+
const t = e.map((n) => typeof n == "object" ? n.decimal || Q(n.decimalMultiplier) : nt(ue(n))).filter(Boolean);
|
|
1764
|
+
return Math.max(...t, Z);
|
|
1765
|
+
}, pe = /* @__PURE__ */ new WeakSet(), Oe = function(e, t) {
|
|
1766
|
+
const n = t ? F(t) : this.decimalMultiplier, a = Q(n), [i = "", s = ""] = e.split(".");
|
|
1767
1767
|
return BigInt(`${i}${s.padEnd(a, "0")}`);
|
|
1768
1768
|
};
|
|
1769
|
-
let
|
|
1769
|
+
let Se = mn;
|
|
1770
1770
|
const Tn = Intl.NumberFormat("fullwide", {
|
|
1771
1771
|
useGrouping: !1,
|
|
1772
1772
|
maximumFractionDigits: 20
|
|
1773
1773
|
});
|
|
1774
1774
|
function ue(e) {
|
|
1775
|
-
const t = `${typeof e == "number" ? Tn.format(e) :
|
|
1775
|
+
const t = `${typeof e == "number" ? Tn.format(e) : we(e)}`.replaceAll(",", ".").split(".");
|
|
1776
1776
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1777
1777
|
}
|
|
1778
1778
|
function nt(e) {
|
|
1779
1779
|
var t;
|
|
1780
1780
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1781
|
-
return Math.max(n,
|
|
1781
|
+
return Math.max(n, Z);
|
|
1782
1782
|
}
|
|
1783
|
-
function
|
|
1783
|
+
function we(e) {
|
|
1784
1784
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1785
1785
|
}
|
|
1786
|
-
|
|
1787
|
-
|
|
1786
|
+
class k extends Se {
|
|
1787
|
+
eq(t) {
|
|
1788
|
+
return this.eqValue(t);
|
|
1789
|
+
}
|
|
1790
|
+
static fromBigInt(t, n) {
|
|
1791
|
+
return new k({
|
|
1792
|
+
decimal: n,
|
|
1793
|
+
value: me({ value: t, bigIntDecimal: n, decimal: n })
|
|
1794
|
+
});
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
const q = /* @__PURE__ */ new Map();
|
|
1798
|
+
class C extends Se {
|
|
1788
1799
|
constructor({
|
|
1789
1800
|
value: t,
|
|
1790
1801
|
decimal: n,
|
|
@@ -1793,8 +1804,8 @@ class P extends tt {
|
|
|
1793
1804
|
symbol: s,
|
|
1794
1805
|
identifier: p
|
|
1795
1806
|
}) {
|
|
1796
|
-
super(typeof t == "object" ? t : { decimal: n, value: t }),
|
|
1797
|
-
const u =
|
|
1807
|
+
super(typeof t == "object" ? t : { decimal: n, value: t }), v(this, "address"), v(this, "chain"), v(this, "isGasAsset", !1), v(this, "isSynthetic", !1), v(this, "symbol"), v(this, "tax"), v(this, "ticker"), v(this, "type");
|
|
1808
|
+
const u = K(p || `${i}.${s}`);
|
|
1798
1809
|
this.type = rn(u), this.tax = a, this.chain = u.chain, this.ticker = u.ticker, this.symbol = u.symbol, this.address = u.address, this.isSynthetic = u.isSynthetic, this.isGasAsset = u.isGasAsset;
|
|
1799
1810
|
}
|
|
1800
1811
|
toString() {
|
|
@@ -1807,7 +1818,7 @@ class P extends tt {
|
|
|
1807
1818
|
return this.chain === t && this.symbol === n;
|
|
1808
1819
|
}
|
|
1809
1820
|
chainId() {
|
|
1810
|
-
return
|
|
1821
|
+
return We[this.chain];
|
|
1811
1822
|
}
|
|
1812
1823
|
// THOR.RUNE
|
|
1813
1824
|
// THOR.ETH.ETH
|
|
@@ -1826,33 +1837,56 @@ class P extends tt {
|
|
|
1826
1837
|
return Ae(t, n);
|
|
1827
1838
|
}
|
|
1828
1839
|
static fromStringSync(t, n = 0) {
|
|
1829
|
-
const { chain: a, isSynthetic: i } =
|
|
1840
|
+
const { chain: a, isSynthetic: i } = K(t), s = q.get(t.toUpperCase());
|
|
1830
1841
|
if (i)
|
|
1831
|
-
return
|
|
1842
|
+
return he(t, n);
|
|
1832
1843
|
const { tax: p, decimal: u, identifier: y } = s || {
|
|
1833
|
-
decimal:
|
|
1844
|
+
decimal: A[a],
|
|
1834
1845
|
identifier: t
|
|
1835
1846
|
};
|
|
1836
|
-
return new
|
|
1847
|
+
return new C({
|
|
1837
1848
|
tax: p,
|
|
1838
|
-
value:
|
|
1849
|
+
value: G(n, u),
|
|
1839
1850
|
identifier: i ? t : y,
|
|
1840
1851
|
decimal: i ? 8 : u
|
|
1841
1852
|
});
|
|
1842
1853
|
}
|
|
1854
|
+
static async fromStringWithBase(t, n = 0, a = A.THOR) {
|
|
1855
|
+
const i = Se.shiftDecimals({
|
|
1856
|
+
value: k.fromBigInt(BigInt(n)),
|
|
1857
|
+
from: 0,
|
|
1858
|
+
to: a
|
|
1859
|
+
}).getBaseValue("string");
|
|
1860
|
+
return (await C.fromString(t, n)).set(i);
|
|
1861
|
+
}
|
|
1862
|
+
static fromStringWithBaseSync(t, n = 0, a = A.THOR) {
|
|
1863
|
+
const { chain: i, isSynthetic: s } = K(t), p = q.get(t.toUpperCase());
|
|
1864
|
+
if (s)
|
|
1865
|
+
return he(t, n);
|
|
1866
|
+
const { tax: u, decimal: y, identifier: o } = p || {
|
|
1867
|
+
decimal: A[i],
|
|
1868
|
+
identifier: t
|
|
1869
|
+
};
|
|
1870
|
+
return new C({
|
|
1871
|
+
tax: u,
|
|
1872
|
+
value: G(BigInt(n), a),
|
|
1873
|
+
identifier: o,
|
|
1874
|
+
decimal: y
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1843
1877
|
static fromIdentifierSync(t, n = 0) {
|
|
1844
|
-
const { chain: a, isSynthetic: i } =
|
|
1878
|
+
const { chain: a, isSynthetic: i } = K(t), s = q.get(t);
|
|
1845
1879
|
if (i)
|
|
1846
|
-
return
|
|
1880
|
+
return he(t, n);
|
|
1847
1881
|
const { tax: p, decimal: u, identifier: y } = s || {
|
|
1848
|
-
decimal:
|
|
1882
|
+
decimal: A[a],
|
|
1849
1883
|
identifier: t
|
|
1850
1884
|
};
|
|
1851
|
-
return new
|
|
1885
|
+
return new C({ tax: p, decimal: u, identifier: y, value: G(n, u) });
|
|
1852
1886
|
}
|
|
1853
1887
|
static fromChainOrSignature(t, n = 0) {
|
|
1854
1888
|
const { decimal: a, identifier: i } = sn(t);
|
|
1855
|
-
return new
|
|
1889
|
+
return new C({ value: G(n, a), decimal: a, identifier: i });
|
|
1856
1890
|
}
|
|
1857
1891
|
static loadStaticAssets() {
|
|
1858
1892
|
return new Promise(
|
|
@@ -1862,9 +1896,9 @@ class P extends tt {
|
|
|
1862
1896
|
Object.values(a).forEach((i) => {
|
|
1863
1897
|
var s;
|
|
1864
1898
|
(s = i == null ? void 0 : i.tokens) == null || s.forEach(({ identifier: p, chain: u, ...y }) => {
|
|
1865
|
-
|
|
1899
|
+
q.set(p.toUpperCase(), {
|
|
1866
1900
|
identifier: p,
|
|
1867
|
-
decimal: "decimals" in y ? y.decimals :
|
|
1901
|
+
decimal: "decimals" in y ? y.decimals : A[u]
|
|
1868
1902
|
});
|
|
1869
1903
|
});
|
|
1870
1904
|
}), t({ ok: !0 });
|
|
@@ -1880,7 +1914,7 @@ class P extends tt {
|
|
|
1880
1914
|
}
|
|
1881
1915
|
}
|
|
1882
1916
|
function fe(e) {
|
|
1883
|
-
const t =
|
|
1917
|
+
const t = C.fromChainOrSignature(e);
|
|
1884
1918
|
switch (e) {
|
|
1885
1919
|
case r.Bitcoin:
|
|
1886
1920
|
case r.Litecoin:
|
|
@@ -1902,33 +1936,33 @@ function fe(e) {
|
|
|
1902
1936
|
}
|
|
1903
1937
|
async function Ae(e, t = 0) {
|
|
1904
1938
|
ln(e);
|
|
1905
|
-
const n =
|
|
1906
|
-
return n ||
|
|
1939
|
+
const n = q.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await nn(K(e));
|
|
1940
|
+
return n || q.set(e.toUpperCase(), { identifier: e, decimal: a }), new C({ decimal: a, value: G(t, a), identifier: e });
|
|
1907
1941
|
}
|
|
1908
|
-
function
|
|
1942
|
+
function he(e, t = 0) {
|
|
1909
1943
|
const [n, a] = e.split(".")[0].toUpperCase() === r.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1910
1944
|
if (!n || !a)
|
|
1911
1945
|
throw new Error("Invalid asset identifier");
|
|
1912
|
-
return new
|
|
1946
|
+
return new C({
|
|
1913
1947
|
decimal: 8,
|
|
1914
|
-
value:
|
|
1948
|
+
value: G(t, 8),
|
|
1915
1949
|
identifier: `${r.THORChain}.${n}/${a}`
|
|
1916
1950
|
});
|
|
1917
1951
|
}
|
|
1918
|
-
function
|
|
1952
|
+
function G(e, t) {
|
|
1919
1953
|
return typeof e == "bigint" ? me({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1920
1954
|
}
|
|
1921
|
-
function
|
|
1955
|
+
function K(e) {
|
|
1922
1956
|
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".")[0].toUpperCase() === r.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1923
1957
|
if (t && (!n || !a))
|
|
1924
1958
|
throw new Error("Invalid asset identifier");
|
|
1925
|
-
const i = e.includes(".") && !t ? e : `${r.THORChain}.${a}`, [s, ...p] = i.split("."), [u, y] = (t ? a : p.join(".")).split("-"),
|
|
1959
|
+
const i = e.includes(".") && !t ? e : `${r.THORChain}.${a}`, [s, ...p] = i.split("."), [u, y] = (t ? a : p.join(".")).split("-"), o = t ? a : p.join(".");
|
|
1926
1960
|
return {
|
|
1927
1961
|
address: y == null ? void 0 : y.toLowerCase(),
|
|
1928
1962
|
chain: s,
|
|
1929
|
-
isGasAsset:
|
|
1963
|
+
isGasAsset: ze({ chain: s, symbol: o }),
|
|
1930
1964
|
isSynthetic: t,
|
|
1931
|
-
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` :
|
|
1965
|
+
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` : o),
|
|
1932
1966
|
ticker: u
|
|
1933
1967
|
};
|
|
1934
1968
|
}
|
|
@@ -2001,17 +2035,6 @@ class c extends Error {
|
|
|
2001
2035
|
n && console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: cn[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
|
|
2002
2036
|
}
|
|
2003
2037
|
}
|
|
2004
|
-
class x extends tt {
|
|
2005
|
-
eq(t) {
|
|
2006
|
-
return this.eqValue(t);
|
|
2007
|
-
}
|
|
2008
|
-
static fromBigInt(t, n) {
|
|
2009
|
-
return new x({
|
|
2010
|
-
decimal: n,
|
|
2011
|
-
value: me({ value: t, bigIntDecimal: n, decimal: n })
|
|
2012
|
-
});
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
2038
|
const bn = [
|
|
2016
2039
|
{
|
|
2017
2040
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
@@ -2706,7 +2729,7 @@ const bn = [
|
|
|
2706
2729
|
type: "function"
|
|
2707
2730
|
},
|
|
2708
2731
|
{ stateMutability: "payable", type: "receive" }
|
|
2709
|
-
],
|
|
2732
|
+
], xe = [
|
|
2710
2733
|
{
|
|
2711
2734
|
inputs: [{ internalType: "address", name: "_WETH", type: "address" }],
|
|
2712
2735
|
stateMutability: "nonpayable",
|
|
@@ -3107,7 +3130,7 @@ const bn = [
|
|
|
3107
3130
|
type: "function"
|
|
3108
3131
|
},
|
|
3109
3132
|
{ stateMutability: "payable", type: "receive" }
|
|
3110
|
-
],
|
|
3133
|
+
], Be = [
|
|
3111
3134
|
{
|
|
3112
3135
|
inputs: [
|
|
3113
3136
|
{
|
|
@@ -5294,7 +5317,7 @@ const bn = [
|
|
|
5294
5317
|
stateMutability: "payable",
|
|
5295
5318
|
type: "receive"
|
|
5296
5319
|
}
|
|
5297
|
-
],
|
|
5320
|
+
], Le = [
|
|
5298
5321
|
{
|
|
5299
5322
|
inputs: [
|
|
5300
5323
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7417,17 +7440,17 @@ const bn = [
|
|
|
7417
7440
|
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: Rn,
|
|
7418
7441
|
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: In,
|
|
7419
7442
|
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: Sn,
|
|
7420
|
-
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]:
|
|
7421
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7443
|
+
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: Be,
|
|
7444
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: xe,
|
|
7422
7445
|
// BSC
|
|
7423
|
-
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]:
|
|
7446
|
+
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Le,
|
|
7424
7447
|
// ETH
|
|
7425
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7448
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: xe,
|
|
7426
7449
|
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: On,
|
|
7427
|
-
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]:
|
|
7450
|
+
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Le,
|
|
7428
7451
|
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: wn,
|
|
7429
7452
|
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: Mn,
|
|
7430
|
-
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]:
|
|
7453
|
+
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: Be
|
|
7431
7454
|
}, Cn = [
|
|
7432
7455
|
{
|
|
7433
7456
|
inputs: [
|
|
@@ -8452,22 +8475,22 @@ const bn = [
|
|
|
8452
8475
|
data: p = "",
|
|
8453
8476
|
deadline: u,
|
|
8454
8477
|
memo: y,
|
|
8455
|
-
router:
|
|
8478
|
+
router: o,
|
|
8456
8479
|
memoStreamingSwap: m,
|
|
8457
8480
|
tcMemo: T,
|
|
8458
8481
|
tcRouter: _,
|
|
8459
|
-
tcVault:
|
|
8482
|
+
tcVault: E,
|
|
8460
8483
|
vault: R,
|
|
8461
8484
|
token: O
|
|
8462
8485
|
}
|
|
8463
8486
|
}) => {
|
|
8464
8487
|
const S = !!at[t.toLowerCase()];
|
|
8465
|
-
if (S && !
|
|
8488
|
+
if (S && !o)
|
|
8466
8489
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8467
8490
|
const w = T || y, B = e && m || w;
|
|
8468
|
-
if (!
|
|
8491
|
+
if (!E && !R)
|
|
8469
8492
|
throw new Error("TC Vault is required on calldata");
|
|
8470
|
-
if (!_ && !
|
|
8493
|
+
if (!_ && !o)
|
|
8471
8494
|
throw new Error("TC Router is required on calldata");
|
|
8472
8495
|
if (!B)
|
|
8473
8496
|
throw new Error("TC Memo is required on calldata");
|
|
@@ -8475,15 +8498,15 @@ const bn = [
|
|
|
8475
8498
|
throw new Error("Token is required on calldata");
|
|
8476
8499
|
const Te = [
|
|
8477
8500
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8478
|
-
a(_ ||
|
|
8479
|
-
a(
|
|
8501
|
+
a(_ || o),
|
|
8502
|
+
a(E || R),
|
|
8480
8503
|
B.replace("{recipientAddress}", n),
|
|
8481
8504
|
a(O),
|
|
8482
8505
|
i
|
|
8483
|
-
], it = S ? [a(
|
|
8506
|
+
], it = S ? [a(o), p, u] : [s, u];
|
|
8484
8507
|
return [...Te, ...it];
|
|
8485
8508
|
}, Hn = ({ chain: e, txHash: t }) => {
|
|
8486
|
-
const n =
|
|
8509
|
+
const n = $e[e];
|
|
8487
8510
|
switch (e) {
|
|
8488
8511
|
case r.Binance:
|
|
8489
8512
|
case r.Maya:
|
|
@@ -8508,7 +8531,7 @@ const bn = [
|
|
|
8508
8531
|
throw new Error(`Unsupported chain: ${e}`);
|
|
8509
8532
|
}
|
|
8510
8533
|
}, Fn = ({ chain: e, address: t }) => {
|
|
8511
|
-
const n =
|
|
8534
|
+
const n = $e[e];
|
|
8512
8535
|
switch (e) {
|
|
8513
8536
|
case r.Arbitrum:
|
|
8514
8537
|
case r.Avalanche:
|
|
@@ -8531,12 +8554,12 @@ const bn = [
|
|
|
8531
8554
|
throw new Error(`Unsupported chain: ${e}`);
|
|
8532
8555
|
}
|
|
8533
8556
|
}, Un = (e) => {
|
|
8534
|
-
const t = e ?
|
|
8557
|
+
const t = e ? J.ThornodeStagenet : J.ThornodeMainnet;
|
|
8535
8558
|
return g.get(`${t}/thorchain/inbound_addresses`);
|
|
8536
8559
|
}, Wn = (e) => {
|
|
8537
|
-
const t = e ?
|
|
8560
|
+
const t = e ? J.ThornodeStagenet : J.ThornodeMainnet;
|
|
8538
8561
|
return g.get(`${t}/thorchain/mimir`);
|
|
8539
|
-
},
|
|
8562
|
+
}, Ve = () => Object.values(r).reduce(
|
|
8540
8563
|
(e, t) => (e[t] = null, e),
|
|
8541
8564
|
{}
|
|
8542
8565
|
), $n = async ({ chain: e, address: t }) => {
|
|
@@ -8549,11 +8572,11 @@ const bn = [
|
|
|
8549
8572
|
return !0;
|
|
8550
8573
|
}
|
|
8551
8574
|
};
|
|
8552
|
-
var U, ye,
|
|
8575
|
+
var U, ye, z, N, ee, te;
|
|
8553
8576
|
class la {
|
|
8554
8577
|
constructor({ stagenet: t } = {}) {
|
|
8555
|
-
b(this, "connectedChains",
|
|
8556
|
-
b(this, "connectedWallets",
|
|
8578
|
+
b(this, "connectedChains", Ve());
|
|
8579
|
+
b(this, "connectedWallets", Ve());
|
|
8557
8580
|
b(this, "stagenet", !1);
|
|
8558
8581
|
b(this, "getAddress", (t) => {
|
|
8559
8582
|
var n;
|
|
@@ -8575,30 +8598,30 @@ class la {
|
|
|
8575
8598
|
if (!a.complete)
|
|
8576
8599
|
throw new c("core_swap_route_not_complete");
|
|
8577
8600
|
if (Tt.includes(s) && p) {
|
|
8578
|
-
const
|
|
8579
|
-
if (!(
|
|
8601
|
+
const o = this.connectedWallets[p];
|
|
8602
|
+
if (!(o != null && o.sendTransaction))
|
|
8580
8603
|
throw new c("core_wallet_connection_not_found");
|
|
8581
8604
|
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8582
8605
|
throw new c("core_swap_route_transaction_not_found");
|
|
8583
|
-
const { data: T, from: _, to:
|
|
8606
|
+
const { data: T, from: _, to: E, value: R } = a.transaction, O = {
|
|
8584
8607
|
data: T,
|
|
8585
8608
|
from: _,
|
|
8586
|
-
to:
|
|
8587
|
-
chainId: BigInt(
|
|
8609
|
+
to: E.toLowerCase(),
|
|
8610
|
+
chainId: BigInt(We[p]),
|
|
8588
8611
|
value: R ? BigInt(R) : 0n
|
|
8589
8612
|
};
|
|
8590
|
-
return
|
|
8613
|
+
return o.sendTransaction(O, i);
|
|
8591
8614
|
}
|
|
8592
8615
|
if (bt.includes(s)) {
|
|
8593
8616
|
if (!a.calldata.fromAsset)
|
|
8594
8617
|
throw new c("core_swap_asset_not_recognized");
|
|
8595
|
-
const
|
|
8596
|
-
if (!
|
|
8618
|
+
const o = await C.fromString(a.calldata.fromAsset);
|
|
8619
|
+
if (!o)
|
|
8597
8620
|
throw new c("core_swap_asset_not_recognized");
|
|
8598
|
-
const { address: m } = await
|
|
8621
|
+
const { address: m } = await h(this, U).call(this, o.chain), {
|
|
8599
8622
|
contract: T,
|
|
8600
|
-
calldata: { expiration: _, amountIn:
|
|
8601
|
-
} = a, S =
|
|
8623
|
+
calldata: { expiration: _, amountIn: E, memo: R, memoStreamingSwap: O }
|
|
8624
|
+
} = a, S = o.add(k.fromBigInt(BigInt(E), o.decimal)), w = t && O || R;
|
|
8602
8625
|
return this.deposit({
|
|
8603
8626
|
expiration: _,
|
|
8604
8627
|
assetValue: S,
|
|
@@ -8609,13 +8632,13 @@ class la {
|
|
|
8609
8632
|
});
|
|
8610
8633
|
}
|
|
8611
8634
|
if (ct.includes(s) && p) {
|
|
8612
|
-
const { calldata:
|
|
8635
|
+
const { calldata: o, contract: m } = a;
|
|
8613
8636
|
if (!m)
|
|
8614
8637
|
throw new c("core_swap_contract_not_found");
|
|
8615
8638
|
const T = this.connectedWallets[p], _ = this.getAddress(p);
|
|
8616
8639
|
if (!(T != null && T.sendTransaction) || !_)
|
|
8617
8640
|
throw new c("core_wallet_connection_not_found");
|
|
8618
|
-
const { getProvider:
|
|
8641
|
+
const { getProvider: E, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = E(p), S = Ln[m.toLowerCase()];
|
|
8619
8642
|
if (!S)
|
|
8620
8643
|
throw new c("core_swap_contract_not_supported", { contractAddress: m });
|
|
8621
8644
|
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T, m, S, O))).getFunction("swapIn").populateTransaction(
|
|
@@ -8624,7 +8647,7 @@ class la {
|
|
|
8624
8647
|
toChecksumAddress: R,
|
|
8625
8648
|
contractAddress: m,
|
|
8626
8649
|
recipient: n,
|
|
8627
|
-
calldata:
|
|
8650
|
+
calldata: o
|
|
8628
8651
|
}),
|
|
8629
8652
|
{ from: _ }
|
|
8630
8653
|
);
|
|
@@ -8637,7 +8660,7 @@ class la {
|
|
|
8637
8660
|
const a = this.getAddress(t);
|
|
8638
8661
|
if (!a)
|
|
8639
8662
|
return null;
|
|
8640
|
-
const i = [
|
|
8663
|
+
const i = [C.fromChainOrSignature(t)], s = (p = this.connectedChains[t]) == null ? void 0 : p.walletType;
|
|
8641
8664
|
try {
|
|
8642
8665
|
const y = await ((u = this.getWallet(t)) == null ? void 0 : u.getBalance(a, n));
|
|
8643
8666
|
return this.connectedChains[t] = {
|
|
@@ -8649,8 +8672,8 @@ class la {
|
|
|
8649
8672
|
return console.error(y), { address: a, balance: i, walletType: s };
|
|
8650
8673
|
}
|
|
8651
8674
|
});
|
|
8652
|
-
b(this, "approveAssetValue", (t, n) =>
|
|
8653
|
-
b(this, "isAssetValueApproved", (t, n) =>
|
|
8675
|
+
b(this, "approveAssetValue", (t, n) => h(this, z).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
8676
|
+
b(this, "isAssetValueApproved", (t, n) => h(this, z).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
8654
8677
|
b(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
8655
8678
|
var a, i;
|
|
8656
8679
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
@@ -8660,7 +8683,7 @@ class la {
|
|
|
8660
8683
|
if (!n)
|
|
8661
8684
|
throw new c("core_wallet_connection_not_found");
|
|
8662
8685
|
try {
|
|
8663
|
-
return await n.transfer(
|
|
8686
|
+
return await n.transfer(h(this, te).call(this, t));
|
|
8664
8687
|
} catch (a) {
|
|
8665
8688
|
throw new c("core_swap_transaction_error", a);
|
|
8666
8689
|
}
|
|
@@ -8679,7 +8702,7 @@ class la {
|
|
|
8679
8702
|
throw new c("core_transaction_invalid_sender_address");
|
|
8680
8703
|
if (!y)
|
|
8681
8704
|
throw new c("core_wallet_connection_not_found");
|
|
8682
|
-
const m =
|
|
8705
|
+
const m = h(this, te).call(this, { assetValue: t, recipient: n, router: a, ...i });
|
|
8683
8706
|
try {
|
|
8684
8707
|
switch (s) {
|
|
8685
8708
|
case r.THORChain:
|
|
@@ -8693,7 +8716,7 @@ class la {
|
|
|
8693
8716
|
const { getChecksumAddressFromAsset: T } = await import("@swapkit/toolbox-evm"), _ = s === r.Avalanche ? dt : s === r.BinanceSmartChain ? lt : ot;
|
|
8694
8717
|
return await y.call({
|
|
8695
8718
|
abi: _,
|
|
8696
|
-
contractAddress: a || (await
|
|
8719
|
+
contractAddress: a || (await h(this, U).call(this, s)).router,
|
|
8697
8720
|
funcName: "depositWithExpiry",
|
|
8698
8721
|
funcParams: [
|
|
8699
8722
|
n,
|
|
@@ -8712,7 +8735,7 @@ class la {
|
|
|
8712
8735
|
return await y.transfer(m);
|
|
8713
8736
|
}
|
|
8714
8737
|
} catch (T) {
|
|
8715
|
-
const _ = ((T == null ? void 0 : T.message) || (T == null ? void 0 : T.toString())).toLowerCase(),
|
|
8738
|
+
const _ = ((T == null ? void 0 : T.message) || (T == null ? void 0 : T.toString())).toLowerCase(), E = _ == null ? void 0 : _.includes("insufficient funds"), R = _ == null ? void 0 : _.includes("gas"), O = _ == null ? void 0 : _.includes("server"), S = _ == null ? void 0 : _.includes("user rejected"), w = E ? "core_transaction_deposit_insufficient_funds_error" : R ? "core_transaction_deposit_gas_error" : O ? "core_transaction_deposit_server_error" : S ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
|
|
8716
8739
|
throw new c(w, T);
|
|
8717
8740
|
}
|
|
8718
8741
|
});
|
|
@@ -8727,9 +8750,9 @@ class la {
|
|
|
8727
8750
|
throw new c("core_transaction_create_liquidity_invalid_params");
|
|
8728
8751
|
let a = "", i = "";
|
|
8729
8752
|
try {
|
|
8730
|
-
a = await
|
|
8753
|
+
a = await h(this, N).call(this, {
|
|
8731
8754
|
assetValue: t,
|
|
8732
|
-
memo:
|
|
8755
|
+
memo: P(f.DEPOSIT, {
|
|
8733
8756
|
...n,
|
|
8734
8757
|
address: this.getAddress(n.chain)
|
|
8735
8758
|
})
|
|
@@ -8738,9 +8761,9 @@ class la {
|
|
|
8738
8761
|
throw new c("core_transaction_create_liquidity_rune_error", s);
|
|
8739
8762
|
}
|
|
8740
8763
|
try {
|
|
8741
|
-
i = await
|
|
8764
|
+
i = await h(this, N).call(this, {
|
|
8742
8765
|
assetValue: n,
|
|
8743
|
-
memo:
|
|
8766
|
+
memo: P(f.DEPOSIT, {
|
|
8744
8767
|
...n,
|
|
8745
8768
|
address: this.getAddress(r.THORChain)
|
|
8746
8769
|
})
|
|
@@ -8758,26 +8781,26 @@ class la {
|
|
|
8758
8781
|
isPendingSymmAsset: s,
|
|
8759
8782
|
mode: p = "sym"
|
|
8760
8783
|
}) => {
|
|
8761
|
-
const { chain: u, symbol: y } = n,
|
|
8784
|
+
const { chain: u, symbol: y } = n, o = p === "sym", m = (t == null ? void 0 : t.gt(0)) && (o || p === "rune"), T = (n == null ? void 0 : n.gt(0)) && (o || p === "asset"), _ = s || m, E = _ ? a || this.getAddress(r.THORChain) : "", R = o || p === "asset" ? i || this.getAddress(u) : "";
|
|
8762
8785
|
if (!m && !T)
|
|
8763
8786
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8764
|
-
if (_ && !
|
|
8787
|
+
if (_ && !E)
|
|
8765
8788
|
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
8766
8789
|
let O, S;
|
|
8767
8790
|
if (m && t)
|
|
8768
8791
|
try {
|
|
8769
|
-
O = await
|
|
8792
|
+
O = await h(this, N).call(this, {
|
|
8770
8793
|
assetValue: t,
|
|
8771
|
-
memo:
|
|
8794
|
+
memo: P(f.DEPOSIT, { chain: u, symbol: y, address: R })
|
|
8772
8795
|
});
|
|
8773
8796
|
} catch (w) {
|
|
8774
8797
|
throw new c("core_transaction_add_liquidity_rune_error", w);
|
|
8775
8798
|
}
|
|
8776
8799
|
if (T && n)
|
|
8777
8800
|
try {
|
|
8778
|
-
S = await
|
|
8801
|
+
S = await h(this, N).call(this, {
|
|
8779
8802
|
assetValue: n,
|
|
8780
|
-
memo:
|
|
8803
|
+
memo: P(f.DEPOSIT, { chain: u, symbol: y, address: E })
|
|
8781
8804
|
});
|
|
8782
8805
|
} catch (w) {
|
|
8783
8806
|
throw new c("core_transaction_add_liquidity_asset_error", w);
|
|
@@ -8792,12 +8815,12 @@ class la {
|
|
|
8792
8815
|
}) => {
|
|
8793
8816
|
if (i && !a)
|
|
8794
8817
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8795
|
-
const s =
|
|
8818
|
+
const s = P(f.DEPOSIT, {
|
|
8796
8819
|
chain: n.split(".")[0],
|
|
8797
8820
|
symbol: n.split(".")[1],
|
|
8798
8821
|
address: i ? a : ""
|
|
8799
8822
|
});
|
|
8800
|
-
return
|
|
8823
|
+
return h(this, N).call(this, { assetValue: t, memo: s });
|
|
8801
8824
|
});
|
|
8802
8825
|
b(this, "withdraw", async ({
|
|
8803
8826
|
memo: t,
|
|
@@ -8806,7 +8829,7 @@ class la {
|
|
|
8806
8829
|
from: i,
|
|
8807
8830
|
to: s
|
|
8808
8831
|
}) => {
|
|
8809
|
-
const p = s === "rune" && i !== "rune" ?
|
|
8832
|
+
const p = s === "rune" && i !== "rune" ? C.fromChainOrSignature(r.THORChain) : i === "sym" && s === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = fe(i === "asset" ? n.chain : r.THORChain), y = t || P(f.WITHDRAW, {
|
|
8810
8833
|
symbol: n.symbol,
|
|
8811
8834
|
chain: n.chain,
|
|
8812
8835
|
ticker: n.ticker,
|
|
@@ -8814,7 +8837,7 @@ class la {
|
|
|
8814
8837
|
targetAssetString: p == null ? void 0 : p.toString(),
|
|
8815
8838
|
singleSide: !1
|
|
8816
8839
|
});
|
|
8817
|
-
return
|
|
8840
|
+
return h(this, N).call(this, { assetValue: u, memo: y });
|
|
8818
8841
|
});
|
|
8819
8842
|
b(this, "savings", async ({
|
|
8820
8843
|
assetValue: t,
|
|
@@ -8822,23 +8845,23 @@ class la {
|
|
|
8822
8845
|
percent: a,
|
|
8823
8846
|
type: i
|
|
8824
8847
|
}) => {
|
|
8825
|
-
const s = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n ||
|
|
8848
|
+
const s = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n || P(s, {
|
|
8826
8849
|
ticker: t.ticker,
|
|
8827
8850
|
symbol: t.symbol,
|
|
8828
8851
|
chain: t.chain,
|
|
8829
8852
|
singleSide: !0,
|
|
8830
8853
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
8831
8854
|
}), u = s === f.DEPOSIT ? t : fe(t.chain);
|
|
8832
|
-
return
|
|
8855
|
+
return h(this, N).call(this, { memo: p, assetValue: u });
|
|
8833
8856
|
});
|
|
8834
8857
|
b(this, "loan", ({
|
|
8835
8858
|
assetValue: t,
|
|
8836
8859
|
memo: n,
|
|
8837
8860
|
minAmount: a,
|
|
8838
8861
|
type: i
|
|
8839
|
-
}) =>
|
|
8862
|
+
}) => h(this, N).call(this, {
|
|
8840
8863
|
assetValue: t,
|
|
8841
|
-
memo: n ||
|
|
8864
|
+
memo: n || P(i === "open" ? f.OPEN_LOAN : f.CLOSE_LOAN, {
|
|
8842
8865
|
asset: t.toString(),
|
|
8843
8866
|
minAmount: a.toString(),
|
|
8844
8867
|
address: this.getAddress(t.chain)
|
|
@@ -8849,11 +8872,11 @@ class la {
|
|
|
8849
8872
|
assetValue: n,
|
|
8850
8873
|
address: a
|
|
8851
8874
|
}) => {
|
|
8852
|
-
const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, s =
|
|
8875
|
+
const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, s = P(i, {
|
|
8853
8876
|
address: a,
|
|
8854
8877
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
8855
8878
|
});
|
|
8856
|
-
return
|
|
8879
|
+
return h(this, ee).call(this, {
|
|
8857
8880
|
memo: s,
|
|
8858
8881
|
assetValue: t === "bond" ? n : fe(r.THORChain)
|
|
8859
8882
|
});
|
|
@@ -8861,12 +8884,12 @@ class la {
|
|
|
8861
8884
|
b(this, "registerThorname", ({
|
|
8862
8885
|
assetValue: t,
|
|
8863
8886
|
...n
|
|
8864
|
-
}) =>
|
|
8887
|
+
}) => h(this, ee).call(this, { assetValue: t, memo: P(f.THORNAME_REGISTER, n) }));
|
|
8865
8888
|
b(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
8866
8889
|
try {
|
|
8867
8890
|
t.forEach((s) => {
|
|
8868
8891
|
this[s.connectMethodName] = s.connect({
|
|
8869
|
-
addChain:
|
|
8892
|
+
addChain: h(this, ye),
|
|
8870
8893
|
config: n || {},
|
|
8871
8894
|
apis: a,
|
|
8872
8895
|
rpcUrls: i
|
|
@@ -8963,7 +8986,7 @@ class la {
|
|
|
8963
8986
|
V(this, ye, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
8964
8987
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
8965
8988
|
});
|
|
8966
|
-
V(this,
|
|
8989
|
+
V(this, z, async ({
|
|
8967
8990
|
assetValue: t,
|
|
8968
8991
|
type: n = "checkOnly",
|
|
8969
8992
|
contractAddress: a
|
|
@@ -8977,24 +9000,24 @@ class la {
|
|
|
8977
9000
|
const _ = this.getAddress(s);
|
|
8978
9001
|
if (!i || !_)
|
|
8979
9002
|
throw new c("core_approve_asset_address_or_from_not_found");
|
|
8980
|
-
const
|
|
9003
|
+
const E = a || (await h(this, U).call(this, s)).router;
|
|
8981
9004
|
return T({
|
|
8982
9005
|
amount: t.getBaseValue("bigint"),
|
|
8983
9006
|
assetAddress: i,
|
|
8984
9007
|
from: _,
|
|
8985
|
-
spenderAddress:
|
|
9008
|
+
spenderAddress: E
|
|
8986
9009
|
});
|
|
8987
9010
|
});
|
|
8988
|
-
V(this,
|
|
9011
|
+
V(this, N, async ({
|
|
8989
9012
|
assetValue: t,
|
|
8990
9013
|
memo: n,
|
|
8991
|
-
feeOptionKey: a =
|
|
9014
|
+
feeOptionKey: a = Y.Fast
|
|
8992
9015
|
}) => {
|
|
8993
9016
|
const {
|
|
8994
9017
|
gas_rate: i,
|
|
8995
9018
|
router: s,
|
|
8996
9019
|
address: p
|
|
8997
|
-
} = await
|
|
9020
|
+
} = await h(this, U).call(this, t.chain), u = (parseInt(i) || 0) * an[a];
|
|
8998
9021
|
return this.deposit({
|
|
8999
9022
|
assetValue: t,
|
|
9000
9023
|
recipient: p,
|
|
@@ -9003,13 +9026,13 @@ class la {
|
|
|
9003
9026
|
feeRate: u
|
|
9004
9027
|
});
|
|
9005
9028
|
});
|
|
9006
|
-
V(this,
|
|
9029
|
+
V(this, ee, async ({ memo: t, assetValue: n }) => {
|
|
9007
9030
|
const a = await Wn(this.stagenet);
|
|
9008
9031
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
9009
9032
|
throw new c("core_chain_halted");
|
|
9010
9033
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
9011
9034
|
});
|
|
9012
|
-
V(this,
|
|
9035
|
+
V(this, te, ({ assetValue: t, ...n }) => ({
|
|
9013
9036
|
...n,
|
|
9014
9037
|
memo: n.memo || "",
|
|
9015
9038
|
from: this.getAddress(t.chain),
|
|
@@ -9018,37 +9041,37 @@ class la {
|
|
|
9018
9041
|
this.stagenet = !!t;
|
|
9019
9042
|
}
|
|
9020
9043
|
}
|
|
9021
|
-
U = new WeakMap(), ye = new WeakMap(),
|
|
9044
|
+
U = new WeakMap(), ye = new WeakMap(), z = new WeakMap(), N = new WeakMap(), ee = new WeakMap(), te = new WeakMap();
|
|
9022
9045
|
export {
|
|
9023
9046
|
Tt as AGG_SWAP,
|
|
9024
|
-
|
|
9047
|
+
x as ApiEndpoints,
|
|
9025
9048
|
Xn as ApiError,
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9049
|
+
J as ApiUrl,
|
|
9050
|
+
C as AssetValue,
|
|
9051
|
+
A as BaseDecimal,
|
|
9052
|
+
Se as BigIntArithmetics,
|
|
9030
9053
|
r as Chain,
|
|
9031
|
-
|
|
9054
|
+
Me as ChainId,
|
|
9032
9055
|
zn as ChainIdToChain,
|
|
9033
|
-
|
|
9034
|
-
|
|
9056
|
+
We as ChainToChainId,
|
|
9057
|
+
$e as ChainToExplorerUrl,
|
|
9035
9058
|
Zn as ChainToHexChainId,
|
|
9036
9059
|
It as ChainToRPC,
|
|
9037
9060
|
At as ContractAddress,
|
|
9038
9061
|
Qn as CosmosChainList,
|
|
9039
9062
|
St as CosmosChains,
|
|
9040
9063
|
ht as DerivationPath,
|
|
9041
|
-
|
|
9064
|
+
d as ERROR_CODE,
|
|
9042
9065
|
_t as ERROR_MODULE,
|
|
9043
|
-
|
|
9066
|
+
He as ERROR_TYPE,
|
|
9044
9067
|
Rt as EVMChainList,
|
|
9045
9068
|
Et as EVMChains,
|
|
9046
|
-
|
|
9069
|
+
Y as FeeOption,
|
|
9047
9070
|
Ct as LedgerErrorCode,
|
|
9048
9071
|
f as MemoType,
|
|
9049
9072
|
jn as NetworkDerivationPath,
|
|
9050
9073
|
mt as QuoteMode,
|
|
9051
|
-
|
|
9074
|
+
Ue as RPCUrl,
|
|
9052
9075
|
g as RequestClient,
|
|
9053
9076
|
ct as SWAP_IN,
|
|
9054
9077
|
bt as SWAP_OUT,
|
|
@@ -9057,7 +9080,7 @@ export {
|
|
|
9057
9080
|
ta as SwapKitApi,
|
|
9058
9081
|
la as SwapKitCore,
|
|
9059
9082
|
c as SwapKitError,
|
|
9060
|
-
|
|
9083
|
+
k as SwapKitNumber,
|
|
9061
9084
|
dt as TCAvalancheDepositABI,
|
|
9062
9085
|
lt as TCBscDepositABI,
|
|
9063
9086
|
ot as TCEthereumVaultAbi,
|
|
@@ -9069,7 +9092,7 @@ export {
|
|
|
9069
9092
|
Ot as UTXOChains,
|
|
9070
9093
|
gt as WalletOption,
|
|
9071
9094
|
na as assetFromString,
|
|
9072
|
-
|
|
9095
|
+
Je as defaultRequestHeaders,
|
|
9073
9096
|
da as derivationPathToString,
|
|
9074
9097
|
Gn as erc20ABI,
|
|
9075
9098
|
aa as filterAssets,
|
|
@@ -9084,12 +9107,12 @@ export {
|
|
|
9084
9107
|
nn as getDecimal,
|
|
9085
9108
|
pa as getEstimatedPoolShare,
|
|
9086
9109
|
ua as getLiquiditySlippage,
|
|
9087
|
-
|
|
9110
|
+
P as getMemoFor,
|
|
9088
9111
|
fe as getMinAmountByChain,
|
|
9089
9112
|
dn as getSymmetricPoolShare,
|
|
9090
9113
|
ra as getSymmetricWithdraw,
|
|
9091
9114
|
ya as getTHORNameCost,
|
|
9092
|
-
|
|
9115
|
+
ze as isGasAsset,
|
|
9093
9116
|
ea as setRequestClientConfig,
|
|
9094
9117
|
oa as validateTHORName
|
|
9095
9118
|
};
|