@swapkit/core 1.0.0-rc.7 → 1.0.0-rc.71
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 +3 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.es.js +1353 -863
- package/dist/index.es.js.map +1 -0
- package/package.json +17 -20
- package/src/client/__tests__/helpers.test.ts +41 -33
- package/src/client/explorerUrls.ts +7 -8
- package/src/client/index.ts +110 -69
- package/src/client/thornode.ts +3 -3
- package/dist/index-9e36735e.cjs +0 -1
- package/dist/index-cf1865cd.js +0 -649
package/dist/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var qe = Object.defineProperty;
|
|
2
|
+
var We = (e, t, n) => t in e ? qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var T = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), n), je = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var f = (e, t, n) => (je(e, t, "read from private field"), n ? n.call(e) : t.get(e)), P = (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
|
|
13
|
-
const
|
|
12
|
+
var Ke = Object.defineProperty, Xe = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Xe(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
+
const fn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -108,7 +108,7 @@ const Vt = [
|
|
|
108
108
|
stateMutability: "nonpayable",
|
|
109
109
|
type: "function"
|
|
110
110
|
}
|
|
111
|
-
],
|
|
111
|
+
], Ye = [
|
|
112
112
|
{
|
|
113
113
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
114
114
|
stateMutability: "nonpayable",
|
|
@@ -283,7 +283,7 @@ const Vt = [
|
|
|
283
283
|
stateMutability: "view",
|
|
284
284
|
type: "function"
|
|
285
285
|
}
|
|
286
|
-
],
|
|
286
|
+
], Je = [
|
|
287
287
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
288
288
|
{
|
|
289
289
|
anonymous: !1,
|
|
@@ -447,7 +447,7 @@ const Vt = [
|
|
|
447
447
|
stateMutability: "view",
|
|
448
448
|
type: "function"
|
|
449
449
|
}
|
|
450
|
-
],
|
|
450
|
+
], Qe = [
|
|
451
451
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
452
452
|
{
|
|
453
453
|
anonymous: !1,
|
|
@@ -600,13 +600,13 @@ const Vt = [
|
|
|
600
600
|
type: "function"
|
|
601
601
|
}
|
|
602
602
|
];
|
|
603
|
-
var
|
|
604
|
-
const
|
|
603
|
+
var ze = /* @__PURE__ */ ((e) => (e.TC_SUPPORTED_TO_TC_SUPPORTED = "TC-TC", e.TC_SUPPORTED_TO_ETH = "TC-ERC20", e.TC_SUPPORTED_TO_AVAX = "TC-ARC20", e.TC_SUPPORTED_TO_BSC = "TC-BEP20", e.ETH_TO_TC_SUPPORTED = "ERC20-TC", e.ETH_TO_ETH = "ERC20-ERC20", e.ETH_TO_AVAX = "ERC20-ARC20", e.ETH_TO_BSC = "ERC20-BEP20", e.AVAX_TO_TC_SUPPORTED = "ARC20-TC", e.AVAX_TO_ETH = "ARC20-ERC20", e.AVAX_TO_AVAX = "ARC20-ARC20", e.AVAX_TO_BSC = "ARC20-BEP20", e.BSC_TO_TC_SUPPORTED = "BEP20-TC", e.BSC_TO_ETH = "BEP20-ERC20", e.BSC_TO_AVAX = "BEP20-ARC20", e.BSC_TO_BSC = "BEP20-BEP20", e))(ze || {});
|
|
604
|
+
const Ze = [
|
|
605
605
|
"ERC20-ERC20",
|
|
606
606
|
"ARC20-ARC20",
|
|
607
607
|
"BEP20-BEP20"
|
|
608
608
|
/* BSC_TO_BSC */
|
|
609
|
-
],
|
|
609
|
+
], et = [
|
|
610
610
|
"ERC20-TC",
|
|
611
611
|
"ERC20-ARC20",
|
|
612
612
|
"ERC20-BEP20",
|
|
@@ -617,95 +617,95 @@ const Ue = [
|
|
|
617
617
|
"BEP20-ERC20",
|
|
618
618
|
"BEP20-ARC20"
|
|
619
619
|
/* BSC_TO_AVAX */
|
|
620
|
-
],
|
|
620
|
+
], tt = [
|
|
621
621
|
"TC-TC",
|
|
622
622
|
"TC-ERC20",
|
|
623
623
|
"TC-ARC20",
|
|
624
624
|
"TC-BEP20"
|
|
625
625
|
/* TC_SUPPORTED_TO_BSC */
|
|
626
626
|
];
|
|
627
|
-
var
|
|
628
|
-
const
|
|
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
|
-
let n =
|
|
627
|
+
var Ie = /* @__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))(Ie || {}), nt = /* @__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))(nt || {}), y = /* @__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.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))(y || {});
|
|
628
|
+
const at = {
|
|
629
|
+
[y.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
|
+
[y.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
|
+
[y.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
632
|
+
[y.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
|
|
633
|
+
[y.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
|
|
634
|
+
[y.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
|
|
635
|
+
[y.INVALID_TYPE_GENERIC]: "Invalid type",
|
|
636
|
+
[y.INVALID_NUMBER_STRING]: "Invalid number string.",
|
|
637
|
+
[y.INVALID_NUMBER]: "Invalid number.",
|
|
638
|
+
[y.INVALID_BOOLEAN]: "Invalid boolean.",
|
|
639
|
+
[y.INVALID_OBJECT]: "Invalid object.",
|
|
640
|
+
[y.INVALID_ARRAY]: "Invalid array.",
|
|
641
|
+
[y.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
|
|
642
|
+
[y.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
|
|
643
|
+
[y.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
|
|
644
|
+
[y.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
|
|
645
|
+
[y.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
|
|
646
|
+
[y.AFF_BPS_INTEGER_MAX_500]: "affiliateBasisPoints must be an integer between 0 and 100.",
|
|
647
|
+
[y.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
|
|
648
|
+
[y.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
|
|
649
|
+
[y.PREFERRED_PROVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
|
|
650
|
+
[y.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
651
|
+
[y.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
652
|
+
[y.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
653
|
+
[y.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
|
|
654
|
+
[y.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
|
|
655
|
+
[y.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
|
|
656
|
+
[y.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
|
|
657
|
+
[y.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
|
|
658
|
+
[y.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
|
|
659
|
+
[y.INVALID_CHAIN]: "Invalid chain {0}.",
|
|
660
|
+
[y.INVALID_ASSET]: "Invalid asset {0}.",
|
|
661
|
+
[y.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
|
|
662
|
+
[y.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
|
|
663
|
+
[y.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
|
|
664
|
+
[y.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
|
|
665
|
+
[y.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
|
|
666
|
+
[y.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
|
|
667
|
+
[y.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
|
|
668
|
+
[y.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
|
|
669
|
+
[y.INVALID_QUOTE_MODE]: "Invalid quote mode.",
|
|
670
|
+
[y.NO_QUOTES]: "No quotes to service this request.",
|
|
671
|
+
[y.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
|
|
672
|
+
[y.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
|
|
673
|
+
[y.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
|
|
674
|
+
[y.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
|
|
675
|
+
[y.NO_PRICE]: "No price for asset {0}.",
|
|
676
|
+
[y.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
677
|
+
[y.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
678
|
+
[y.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
679
|
+
}, pe = (e, t) => {
|
|
680
|
+
let n = at[e];
|
|
681
681
|
for (let a = 0; a < t.length; a++)
|
|
682
682
|
n = n.replace(`{${a}}`, t[a]);
|
|
683
683
|
return t.length === 0 ? n.replace("{0}", "") : n;
|
|
684
684
|
};
|
|
685
|
-
class
|
|
685
|
+
let bn = class ve extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
689
689
|
module: a,
|
|
690
|
-
code:
|
|
690
|
+
code: s,
|
|
691
691
|
message: r,
|
|
692
|
-
type:
|
|
693
|
-
options: { shouldLog:
|
|
692
|
+
type: o,
|
|
693
|
+
options: { shouldLog: p, shouldThrow: d, shouldTrace: l } = {
|
|
694
694
|
shouldLog: !0,
|
|
695
695
|
shouldThrow: !0,
|
|
696
696
|
shouldTrace: !0
|
|
697
697
|
},
|
|
698
698
|
displayMessageParams: u
|
|
699
699
|
}) {
|
|
700
|
-
const
|
|
701
|
-
super(
|
|
702
|
-
shouldLog:
|
|
703
|
-
shouldTrace:
|
|
704
|
-
shouldThrow:
|
|
700
|
+
const m = r || pe(s, u || []) || "";
|
|
701
|
+
super(m), C(this, "status"), C(this, "revision"), C(this, "type"), C(this, "module"), C(this, "code"), C(this, "message"), C(this, "display"), C(this, "stack"), C(this, "options"), C(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = m, this.display = pe(s, u || []), this.code = s, this.type = o || Ie.UNHANDLED_ERROR, this.options = {
|
|
702
|
+
shouldLog: p || !0,
|
|
703
|
+
shouldTrace: l || !0,
|
|
704
|
+
shouldThrow: d || !1
|
|
705
705
|
}, this.displayMessageParams = u || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new ve(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -714,7 +714,7 @@ class Ae extends Error {
|
|
|
714
714
|
return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
|
|
715
715
|
}
|
|
716
716
|
get displayMessage() {
|
|
717
|
-
return
|
|
717
|
+
return pe(this.code, this.displayMessageParams || []);
|
|
718
718
|
}
|
|
719
719
|
handle() {
|
|
720
720
|
const t = `[${this.identifier}]: ${this.message}`;
|
|
@@ -723,9 +723,9 @@ class Ae extends Error {
|
|
|
723
723
|
throw Error(t, { cause: this.stack });
|
|
724
724
|
return this.toErrorInfo();
|
|
725
725
|
}
|
|
726
|
-
}
|
|
727
|
-
var
|
|
728
|
-
const
|
|
726
|
+
};
|
|
727
|
+
var i = /* @__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))(i || {}), st = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(st || {}), it = /* @__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.ETH = "m/44'/60'/0'/0", 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))(it || {});
|
|
728
|
+
const wn = {
|
|
729
729
|
ARB: [44, 60, 0, 0, 0],
|
|
730
730
|
AVAX: [44, 60, 0, 0, 0],
|
|
731
731
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -742,8 +742,8 @@ const Lt = {
|
|
|
742
742
|
OP: [44, 60, 0, 0, 0],
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
|
-
var
|
|
746
|
-
const
|
|
745
|
+
var b = /* @__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))(b || {});
|
|
746
|
+
const rt = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,38 +751,50 @@ const Ut = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], An = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], En = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
|
+
], Rn = [
|
|
766
|
+
"AVAX",
|
|
767
|
+
"BNB",
|
|
768
|
+
"BSC",
|
|
769
|
+
"BTC",
|
|
770
|
+
"BCH",
|
|
771
|
+
"GAIA",
|
|
772
|
+
"DOGE",
|
|
773
|
+
"ETH",
|
|
774
|
+
"LTC",
|
|
775
|
+
"THOR"
|
|
776
|
+
/* THORChain */
|
|
765
777
|
];
|
|
766
|
-
var
|
|
767
|
-
const
|
|
778
|
+
var _e = /* @__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))(_e || {}), Ce = /* @__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))(Ce || {}), 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 || {});
|
|
779
|
+
const ie = Object.values(i), ot = Object.keys(i), fe = ie.reduce(
|
|
768
780
|
(e, t) => {
|
|
769
|
-
const n =
|
|
781
|
+
const n = ot.find((a) => i[a] === t);
|
|
770
782
|
return n && (e[t] = n), e;
|
|
771
783
|
},
|
|
772
784
|
{}
|
|
773
|
-
),
|
|
774
|
-
(e, t) => (e[t] =
|
|
785
|
+
), pt = ie.reduce(
|
|
786
|
+
(e, t) => (e[t] = _e[fe[t]], e),
|
|
775
787
|
{}
|
|
776
|
-
),
|
|
777
|
-
(e, t) => (e[t] =
|
|
788
|
+
), dt = ie.reduce(
|
|
789
|
+
(e, t) => (e[t] = Ce[fe[t]], e),
|
|
778
790
|
{}
|
|
779
|
-
),
|
|
791
|
+
), gn = ie.reduce(
|
|
780
792
|
(e, t) => {
|
|
781
|
-
const n = `${
|
|
782
|
-
return e[t] =
|
|
793
|
+
const n = `${fe[t]}Hex`;
|
|
794
|
+
return e[t] = _e[n], e;
|
|
783
795
|
},
|
|
784
796
|
{}
|
|
785
|
-
),
|
|
797
|
+
), On = {
|
|
786
798
|
"0xa4b1": "ARB",
|
|
787
799
|
42161: "ARB",
|
|
788
800
|
"0xa86a": "AVAX",
|
|
@@ -807,332 +819,709 @@ const Z = Object.values(s), qe = Object.keys(s), ce = Z.reduce(
|
|
|
807
819
|
"thorchain-stagenet-v2": "THOR",
|
|
808
820
|
"thorchain-mainnet-v1": "THOR"
|
|
809
821
|
/* THORChain */
|
|
810
|
-
},
|
|
822
|
+
}, Me = {
|
|
811
823
|
ARB: "https://arbiscan.io",
|
|
812
824
|
AVAX: "https://snowtrace.io",
|
|
813
825
|
BSC: "https://bscscan.com",
|
|
814
826
|
BNB: "https://explorer.binance.org",
|
|
815
|
-
BCH: "https://www.
|
|
816
|
-
BTC: "https://
|
|
827
|
+
BCH: "https://www.blockchair.com/bitcoin-cash",
|
|
828
|
+
BTC: "https://blockchair.com/bitcoin",
|
|
817
829
|
GAIA: "https://cosmos.bigdipper.live",
|
|
818
830
|
DOGE: "https://blockchair.com/dogecoin",
|
|
819
831
|
KUJI: "https://finder.kujira.network/kaiyo-1",
|
|
820
832
|
ETH: "https://etherscan.io",
|
|
821
|
-
LTC: "https://
|
|
833
|
+
LTC: "https://blockchair.com/litecoin",
|
|
822
834
|
MAYA: "https://www.mayascan.org",
|
|
823
835
|
OP: "https://optimistic.etherscan.io",
|
|
824
836
|
MATIC: "https://polygonscan.com",
|
|
825
|
-
THOR: "https://
|
|
837
|
+
THOR: "https://runescan.io"
|
|
826
838
|
};
|
|
827
|
-
var
|
|
839
|
+
var ut = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(ut || {}), h = /* @__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))(h || {}), F = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(F || {}), lt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", 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))(lt || {}), yt = Object.defineProperty, ct = (e, t, n) => t in e ? yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, I = (e, t, n) => (ct(e, typeof t != "symbol" ? t + "" : t, n), n), mt = (e, t, n) => {
|
|
828
840
|
if (!t.has(e))
|
|
829
841
|
throw TypeError("Cannot " + n);
|
|
830
|
-
},
|
|
842
|
+
}, H = (e, t, n) => {
|
|
831
843
|
if (t.has(e))
|
|
832
844
|
throw TypeError("Cannot add the same private member more than once");
|
|
833
845
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
834
|
-
},
|
|
835
|
-
const
|
|
836
|
-
if (e < 0)
|
|
837
|
-
throw new Error("Invalid number of year");
|
|
838
|
-
return 10 + e;
|
|
839
|
-
}, Wt = (e) => {
|
|
840
|
-
if (e.length > 30)
|
|
841
|
-
return !1;
|
|
842
|
-
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
843
|
-
return !!e.match(t);
|
|
844
|
-
}, qt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`, Re = async (e, t) => {
|
|
845
|
-
try {
|
|
846
|
-
const n = Object.entries(t || {}).reduce(
|
|
847
|
-
(a, [i, r]) => (r && (a[i] = r), a),
|
|
848
|
-
{}
|
|
849
|
-
);
|
|
850
|
-
return (await fetch(
|
|
851
|
-
`${e}${t ? `?${new URLSearchParams(n).toString()}` : ""}`,
|
|
852
|
-
{ method: "GET", mode: "cors", credentials: "omit", referrer: "https://sk.thorswap.net" }
|
|
853
|
-
)).json();
|
|
854
|
-
} catch (n) {
|
|
855
|
-
return console.error(n), {};
|
|
856
|
-
}
|
|
857
|
-
}, Ze = async (e, t, n, a = !1) => {
|
|
858
|
-
try {
|
|
859
|
-
const i = await fetch(`${e}`, {
|
|
860
|
-
body: t,
|
|
861
|
-
headers: n,
|
|
862
|
-
method: "POST",
|
|
863
|
-
referrer: "https://sk.thorswap.net"
|
|
864
|
-
});
|
|
865
|
-
return a ? i.text() : i.json();
|
|
866
|
-
} catch {
|
|
867
|
-
return {};
|
|
868
|
-
}
|
|
869
|
-
}, et = "0x313ce567", Oe = async ({ chain: e, to: t }) => {
|
|
846
|
+
}, R = (e, t, n) => (mt(e, t, "access private method"), n);
|
|
847
|
+
const Tt = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
870
848
|
try {
|
|
871
|
-
const n = await
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
849
|
+
const { result: n } = await we.post(dt[e], {
|
|
850
|
+
headers: {
|
|
851
|
+
accept: "*/*",
|
|
852
|
+
"content-type": "application/json",
|
|
853
|
+
"cache-control": "no-cache"
|
|
854
|
+
},
|
|
855
|
+
body: JSON.stringify({
|
|
876
856
|
id: 44,
|
|
877
|
-
jsonrpc: "2.0"
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
return parseInt(BigInt(
|
|
857
|
+
jsonrpc: "2.0",
|
|
858
|
+
method: "eth_call",
|
|
859
|
+
params: [{ to: t.toLowerCase(), data: Tt }, "latest"]
|
|
860
|
+
})
|
|
861
|
+
});
|
|
862
|
+
return parseInt(BigInt(n).toString());
|
|
883
863
|
} catch (n) {
|
|
884
|
-
return console.error(n),
|
|
864
|
+
return console.error(n), b[e];
|
|
885
865
|
}
|
|
886
|
-
},
|
|
887
|
-
if (e ===
|
|
888
|
-
return
|
|
866
|
+
}, ht = async (e) => {
|
|
867
|
+
if (e === i.Ethereum)
|
|
868
|
+
return b.ETH;
|
|
889
869
|
const [, t] = e.split("-");
|
|
890
|
-
return t != null && t.startsWith("0x") ?
|
|
891
|
-
},
|
|
870
|
+
return t != null && t.startsWith("0x") ? Ne({ chain: i.Ethereum, to: t }) : b.ETH;
|
|
871
|
+
}, _t = async (e) => {
|
|
892
872
|
const [, t] = e.split("-");
|
|
893
|
-
return t != null && t.startsWith("0x") ?
|
|
894
|
-
},
|
|
873
|
+
return t != null && t.startsWith("0x") ? Ne({ chain: i.Avalanche, to: t.toLowerCase() }) : b.AVAX;
|
|
874
|
+
}, ft = async (e) => (e === i.BinanceSmartChain, b.BSC), bt = async ({ chain: e, symbol: t }) => {
|
|
895
875
|
switch (e) {
|
|
896
|
-
case
|
|
897
|
-
return
|
|
898
|
-
case
|
|
899
|
-
return
|
|
900
|
-
case
|
|
901
|
-
return
|
|
876
|
+
case i.Ethereum:
|
|
877
|
+
return ht(t);
|
|
878
|
+
case i.Avalanche:
|
|
879
|
+
return _t(t);
|
|
880
|
+
case i.BinanceSmartChain:
|
|
881
|
+
return ft(t);
|
|
902
882
|
default:
|
|
903
|
-
return
|
|
883
|
+
return b[e];
|
|
904
884
|
}
|
|
905
|
-
},
|
|
906
|
-
[
|
|
907
|
-
[
|
|
908
|
-
[
|
|
909
|
-
},
|
|
885
|
+
}, wt = {
|
|
886
|
+
[F.Average]: 1.2,
|
|
887
|
+
[F.Fast]: 1.5,
|
|
888
|
+
[F.Fastest]: 2
|
|
889
|
+
}, xe = ({ chain: e, symbol: t }) => {
|
|
910
890
|
switch (e) {
|
|
911
|
-
case
|
|
912
|
-
case
|
|
913
|
-
case
|
|
914
|
-
case
|
|
915
|
-
case
|
|
916
|
-
case
|
|
917
|
-
case
|
|
891
|
+
case i.Bitcoin:
|
|
892
|
+
case i.BitcoinCash:
|
|
893
|
+
case i.Litecoin:
|
|
894
|
+
case i.Dogecoin:
|
|
895
|
+
case i.Binance:
|
|
896
|
+
case i.Ethereum:
|
|
897
|
+
case i.Avalanche:
|
|
918
898
|
return t === e;
|
|
919
|
-
case
|
|
920
|
-
case
|
|
899
|
+
case i.Arbitrum:
|
|
900
|
+
case i.Optimism:
|
|
921
901
|
return t === "ETH";
|
|
922
|
-
case
|
|
902
|
+
case i.Maya:
|
|
923
903
|
return t === "CACAO";
|
|
924
|
-
case
|
|
904
|
+
case i.Kujira:
|
|
925
905
|
return t === "KUJI";
|
|
926
|
-
case
|
|
906
|
+
case i.Cosmos:
|
|
927
907
|
return t === "ATOM";
|
|
928
|
-
case
|
|
908
|
+
case i.Polygon:
|
|
929
909
|
return t === "MATIC";
|
|
930
|
-
case
|
|
910
|
+
case i.BinanceSmartChain:
|
|
931
911
|
return t === "BNB";
|
|
932
|
-
case
|
|
912
|
+
case i.THORChain:
|
|
933
913
|
return t === "RUNE";
|
|
934
914
|
}
|
|
935
|
-
},
|
|
915
|
+
}, At = (e) => {
|
|
936
916
|
switch (e) {
|
|
937
917
|
case "ETH.THOR":
|
|
938
918
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
939
919
|
case "ETH.vTHOR":
|
|
940
920
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
941
|
-
case
|
|
942
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
943
|
-
case
|
|
944
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
945
|
-
case
|
|
946
|
-
return { identifier: "BSC.BNB", decimal:
|
|
947
|
-
case
|
|
948
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
921
|
+
case i.Cosmos:
|
|
922
|
+
return { identifier: "GAIA.ATOM", decimal: b[e] };
|
|
923
|
+
case i.THORChain:
|
|
924
|
+
return { identifier: "THOR.RUNE", decimal: b[e] };
|
|
925
|
+
case i.BinanceSmartChain:
|
|
926
|
+
return { identifier: "BSC.BNB", decimal: b[e] };
|
|
927
|
+
case i.Maya:
|
|
928
|
+
return { identifier: "MAYA.CACAO", decimal: b.MAYA };
|
|
949
929
|
case "MAYA.MAYA":
|
|
950
930
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
951
|
-
case
|
|
952
|
-
case
|
|
953
|
-
case
|
|
954
|
-
case
|
|
955
|
-
case
|
|
956
|
-
case
|
|
957
|
-
case
|
|
958
|
-
case
|
|
959
|
-
case
|
|
960
|
-
case
|
|
961
|
-
case
|
|
962
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
963
|
-
}
|
|
964
|
-
},
|
|
931
|
+
case i.Kujira:
|
|
932
|
+
case i.Arbitrum:
|
|
933
|
+
case i.Optimism:
|
|
934
|
+
case i.BitcoinCash:
|
|
935
|
+
case i.Litecoin:
|
|
936
|
+
case i.Dogecoin:
|
|
937
|
+
case i.Binance:
|
|
938
|
+
case i.Avalanche:
|
|
939
|
+
case i.Polygon:
|
|
940
|
+
case i.Bitcoin:
|
|
941
|
+
case i.Ethereum:
|
|
942
|
+
return { identifier: `${e}.${e}`, decimal: b[e] };
|
|
943
|
+
}
|
|
944
|
+
}, Et = ({ chain: e, symbol: t }) => {
|
|
965
945
|
if (t.includes("/"))
|
|
966
946
|
return "Synth";
|
|
967
947
|
switch (e) {
|
|
968
|
-
case
|
|
969
|
-
case
|
|
970
|
-
case
|
|
971
|
-
case
|
|
972
|
-
case
|
|
973
|
-
case
|
|
948
|
+
case i.Bitcoin:
|
|
949
|
+
case i.BitcoinCash:
|
|
950
|
+
case i.Dogecoin:
|
|
951
|
+
case i.Litecoin:
|
|
952
|
+
case i.Maya:
|
|
953
|
+
case i.THORChain:
|
|
974
954
|
return "Native";
|
|
975
|
-
case
|
|
976
|
-
return t === "ATOM" ? "Native" :
|
|
977
|
-
case
|
|
978
|
-
return t ===
|
|
979
|
-
case
|
|
980
|
-
return t ===
|
|
981
|
-
case
|
|
982
|
-
return t ===
|
|
983
|
-
case
|
|
984
|
-
return t ===
|
|
985
|
-
case
|
|
986
|
-
return t ===
|
|
987
|
-
case
|
|
988
|
-
return t ===
|
|
989
|
-
case
|
|
990
|
-
return [
|
|
991
|
-
case
|
|
992
|
-
return [
|
|
993
|
-
}
|
|
994
|
-
},
|
|
955
|
+
case i.Cosmos:
|
|
956
|
+
return t === "ATOM" ? "Native" : i.Cosmos;
|
|
957
|
+
case i.Kujira:
|
|
958
|
+
return t === i.Kujira ? "Native" : i.Kujira;
|
|
959
|
+
case i.Binance:
|
|
960
|
+
return t === i.Binance ? "Native" : "BEP2";
|
|
961
|
+
case i.BinanceSmartChain:
|
|
962
|
+
return t === i.Binance ? "Native" : "BEP20";
|
|
963
|
+
case i.Ethereum:
|
|
964
|
+
return t === i.Ethereum ? "Native" : "ERC20";
|
|
965
|
+
case i.Avalanche:
|
|
966
|
+
return t === i.Avalanche ? "Native" : i.Avalanche;
|
|
967
|
+
case i.Polygon:
|
|
968
|
+
return t === i.Polygon ? "Native" : "POLYGON";
|
|
969
|
+
case i.Arbitrum:
|
|
970
|
+
return [i.Ethereum, i.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
|
|
971
|
+
case i.Optimism:
|
|
972
|
+
return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
973
|
+
}
|
|
974
|
+
}, Sn = (e) => {
|
|
995
975
|
var t;
|
|
996
|
-
const [n, ...a] = e.split("."),
|
|
997
|
-
return { chain: n, symbol: r, ticker:
|
|
998
|
-
},
|
|
976
|
+
const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
977
|
+
return { chain: n, symbol: r, ticker: o, synth: s };
|
|
978
|
+
}, Rt = new RegExp(
|
|
979
|
+
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
980
|
+
"gmi"
|
|
981
|
+
), gt = (e) => {
|
|
982
|
+
const [t, n] = e.split(".");
|
|
983
|
+
if (!rt.includes(t))
|
|
984
|
+
return !0;
|
|
985
|
+
const [, a] = n.split("-");
|
|
986
|
+
return xe({ chain: t, symbol: n }) || !!a;
|
|
987
|
+
}, In = (e) => e.filter((t) => {
|
|
988
|
+
const n = `${t.chain}.${t.symbol}`;
|
|
989
|
+
return !Rt.test(n) && gt(n) && t.value !== "0";
|
|
990
|
+
});
|
|
991
|
+
function Ot({
|
|
999
992
|
liquidityUnits: e,
|
|
1000
993
|
poolUnits: t,
|
|
1001
994
|
runeDepth: n
|
|
1002
|
-
})
|
|
1003
|
-
const a =
|
|
1004
|
-
return
|
|
1005
|
-
}
|
|
995
|
+
}) {
|
|
996
|
+
const a = g(e), s = g(t), r = g(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), l = a.mul(a), u = s.mul(s).mul(s);
|
|
997
|
+
return o.mul(p.sub(d).add(l)).div(u);
|
|
998
|
+
}
|
|
999
|
+
function St({
|
|
1006
1000
|
liquidityUnits: e,
|
|
1007
1001
|
poolUnits: t,
|
|
1008
1002
|
assetDepth: n
|
|
1009
|
-
})
|
|
1010
|
-
const a =
|
|
1011
|
-
return u.div(
|
|
1012
|
-
}
|
|
1003
|
+
}) {
|
|
1004
|
+
const a = g(e), s = g(t), r = g(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), l = a.mul(a), u = o.mul(p.sub(d).add(l)), m = s.mul(s).mul(s);
|
|
1005
|
+
return u.div(m);
|
|
1006
|
+
}
|
|
1007
|
+
function vn({
|
|
1013
1008
|
percent: e,
|
|
1014
1009
|
runeDepth: t,
|
|
1015
1010
|
liquidityUnits: n,
|
|
1016
1011
|
poolUnits: a
|
|
1017
|
-
})
|
|
1012
|
+
}) {
|
|
1013
|
+
return Ot({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1014
|
+
}
|
|
1015
|
+
function Cn({
|
|
1018
1016
|
percent: e,
|
|
1019
1017
|
assetDepth: t,
|
|
1020
1018
|
liquidityUnits: n,
|
|
1021
1019
|
poolUnits: a
|
|
1022
|
-
})
|
|
1020
|
+
}) {
|
|
1021
|
+
return St({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1022
|
+
}
|
|
1023
|
+
function g(e) {
|
|
1024
|
+
return x.fromBigInt(BigInt(e), b.THOR);
|
|
1025
|
+
}
|
|
1026
|
+
function It({
|
|
1023
1027
|
liquidityUnits: e,
|
|
1024
1028
|
poolUnits: t,
|
|
1025
1029
|
runeDepth: n,
|
|
1026
1030
|
assetDepth: a
|
|
1027
|
-
})
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
+
}) {
|
|
1032
|
+
return {
|
|
1033
|
+
assetAmount: g(a).mul(e).div(t),
|
|
1034
|
+
runeAmount: g(n).mul(e).div(t)
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
function Mn({
|
|
1031
1038
|
liquidityUnits: e,
|
|
1032
1039
|
poolUnits: t,
|
|
1033
1040
|
runeDepth: n,
|
|
1034
1041
|
assetDepth: a,
|
|
1035
|
-
percent:
|
|
1036
|
-
})
|
|
1037
|
-
Object.
|
|
1038
|
-
(
|
|
1039
|
-
|
|
1040
|
-
)
|
|
1042
|
+
percent: s
|
|
1043
|
+
}) {
|
|
1044
|
+
return Object.fromEntries(
|
|
1045
|
+
Object.entries(It({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1046
|
+
([r, o]) => [r, o.mul(s)]
|
|
1047
|
+
)
|
|
1048
|
+
);
|
|
1049
|
+
}
|
|
1050
|
+
function Nn({
|
|
1041
1051
|
runeDepth: e,
|
|
1042
1052
|
poolUnits: t,
|
|
1043
1053
|
assetDepth: n,
|
|
1044
1054
|
liquidityUnits: a,
|
|
1045
|
-
runeAmount:
|
|
1055
|
+
runeAmount: s,
|
|
1046
1056
|
assetAmount: r
|
|
1047
|
-
})
|
|
1048
|
-
const
|
|
1049
|
-
if (
|
|
1050
|
-
return
|
|
1051
|
-
const
|
|
1052
|
-
return
|
|
1053
|
-
}
|
|
1057
|
+
}) {
|
|
1058
|
+
const o = new x({ value: e, decimal: 8 }), p = new x({ value: n, decimal: 8 }), d = new x({ value: t, decimal: 8 }), l = new x({ value: s, decimal: 8 }), u = new x({ value: r, decimal: 8 }), m = l.mul(p), _ = u.mul(o), w = l.mul(u), A = o.mul(p), E = d.mul(m.add(_.add(w.mul(2)))), O = m.add(_.add(A.mul(2))), S = E.div(O), D = g(a).add(S);
|
|
1059
|
+
if (S.getBaseValue("number") === 0)
|
|
1060
|
+
return D.div(d).getBaseValue("number");
|
|
1061
|
+
const oe = d.add(D);
|
|
1062
|
+
return D.div(oe).getBaseValue("number");
|
|
1063
|
+
}
|
|
1064
|
+
function xn({
|
|
1054
1065
|
runeAmount: e,
|
|
1055
1066
|
assetAmount: t,
|
|
1056
1067
|
runeDepth: n,
|
|
1057
1068
|
assetDepth: a
|
|
1058
|
-
})
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, D = (e, t) => {
|
|
1069
|
+
}) {
|
|
1070
|
+
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1071
|
+
return 0;
|
|
1072
|
+
const s = g(n), r = g(a), o = g(t), p = g(e), d = o.mul(s).sub(r.mul(p)), l = r.mul(p).add(s.mul(r));
|
|
1073
|
+
return Math.abs(d.div(l).getBaseValue("number"));
|
|
1074
|
+
}
|
|
1075
|
+
const M = (e, t) => {
|
|
1066
1076
|
switch (e) {
|
|
1067
|
-
case
|
|
1068
|
-
case
|
|
1077
|
+
case h.LEAVE:
|
|
1078
|
+
case h.BOND: {
|
|
1069
1079
|
const { address: n } = t;
|
|
1070
1080
|
return `${e}:${n}`;
|
|
1071
1081
|
}
|
|
1072
|
-
case
|
|
1082
|
+
case h.UNBOND: {
|
|
1073
1083
|
const { address: n, unbondAmount: a } = t;
|
|
1074
1084
|
return `${e}:${n}:${a * 10 ** 8}`;
|
|
1075
1085
|
}
|
|
1076
|
-
case
|
|
1077
|
-
const { name: n, chain: a, address:
|
|
1078
|
-
return `${e}:${n}:${a}:${
|
|
1086
|
+
case h.THORNAME_REGISTER: {
|
|
1087
|
+
const { name: n, chain: a, address: s, owner: r } = t;
|
|
1088
|
+
return `${e}:${n}:${a}:${s}${r ? `:${r}` : ""}`;
|
|
1079
1089
|
}
|
|
1080
|
-
case
|
|
1081
|
-
const { chain: n, symbol: a, address:
|
|
1082
|
-
return r ? `${e}:${n}/${a}::t:0` : `${e}:${
|
|
1090
|
+
case h.DEPOSIT: {
|
|
1091
|
+
const { chain: n, symbol: a, address: s, singleSide: r } = t;
|
|
1092
|
+
return r ? `${e}:${n}/${a}::t:0` : `${e}:${((o, p) => {
|
|
1093
|
+
switch (o) {
|
|
1094
|
+
case i.Litecoin:
|
|
1095
|
+
return "l";
|
|
1096
|
+
case i.Dogecoin:
|
|
1097
|
+
return "d";
|
|
1098
|
+
case i.BitcoinCash:
|
|
1099
|
+
return "c";
|
|
1100
|
+
default:
|
|
1101
|
+
return `${o}.${p}`;
|
|
1102
|
+
}
|
|
1103
|
+
})(n, a)}:${s || ""}:t:0`;
|
|
1083
1104
|
}
|
|
1084
|
-
case
|
|
1085
|
-
const { chain: n, ticker: a, symbol:
|
|
1086
|
-
return `${e}:${n}${
|
|
1105
|
+
case h.WITHDRAW: {
|
|
1106
|
+
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = n === "ETH" && a !== "ETH" ? `${a}-${s.slice(-3)}` : s, l = !p && o ? `:${o}` : "";
|
|
1107
|
+
return `${e}:${n}${p ? "/" : "."}${d}:${r}${l}`;
|
|
1087
1108
|
}
|
|
1088
|
-
case
|
|
1089
|
-
case
|
|
1109
|
+
case h.OPEN_LOAN:
|
|
1110
|
+
case h.CLOSE_LOAN: {
|
|
1090
1111
|
const { asset: n, address: a } = t;
|
|
1091
1112
|
return `${e}:${n}:${a}`;
|
|
1092
1113
|
}
|
|
1093
1114
|
default:
|
|
1094
1115
|
return "";
|
|
1095
1116
|
}
|
|
1096
|
-
}
|
|
1117
|
+
};
|
|
1118
|
+
function Dn(e) {
|
|
1119
|
+
if (e < 0)
|
|
1120
|
+
throw new Error("Invalid number of year");
|
|
1121
|
+
return 10 + e;
|
|
1122
|
+
}
|
|
1123
|
+
function Pn(e) {
|
|
1124
|
+
if (e.length > 30)
|
|
1125
|
+
return !1;
|
|
1126
|
+
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1127
|
+
return !!e.match(t);
|
|
1128
|
+
}
|
|
1129
|
+
function Bn([e, t, n, a, s]) {
|
|
1130
|
+
return `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1131
|
+
}
|
|
1132
|
+
class Ae extends Error {
|
|
1133
|
+
constructor(t, n, a) {
|
|
1134
|
+
const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
|
|
1135
|
+
super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
|
|
1136
|
+
enumerable: !0,
|
|
1137
|
+
configurable: !0,
|
|
1138
|
+
writable: !0,
|
|
1139
|
+
value: void 0
|
|
1140
|
+
}), Object.defineProperty(this, "request", {
|
|
1141
|
+
enumerable: !0,
|
|
1142
|
+
configurable: !0,
|
|
1143
|
+
writable: !0,
|
|
1144
|
+
value: void 0
|
|
1145
|
+
}), Object.defineProperty(this, "options", {
|
|
1146
|
+
enumerable: !0,
|
|
1147
|
+
configurable: !0,
|
|
1148
|
+
writable: !0,
|
|
1149
|
+
value: void 0
|
|
1150
|
+
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
class De extends Error {
|
|
1154
|
+
constructor(t) {
|
|
1155
|
+
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
1156
|
+
enumerable: !0,
|
|
1157
|
+
configurable: !0,
|
|
1158
|
+
writable: !0,
|
|
1159
|
+
value: void 0
|
|
1160
|
+
}), this.name = "TimeoutError", this.request = t;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
const z = (e) => e !== null && typeof e == "object", Q = (...e) => {
|
|
1164
|
+
for (const t of e)
|
|
1165
|
+
if ((!z(t) || Array.isArray(t)) && t !== void 0)
|
|
1166
|
+
throw new TypeError("The `options` argument must be an object");
|
|
1167
|
+
return be({}, ...e);
|
|
1168
|
+
}, Pe = (e = {}, t = {}) => {
|
|
1169
|
+
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
|
|
1170
|
+
for (const [r, o] of s.entries())
|
|
1171
|
+
a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
|
|
1172
|
+
return n;
|
|
1173
|
+
}, be = (...e) => {
|
|
1174
|
+
let t = {}, n = {};
|
|
1175
|
+
for (const a of e)
|
|
1176
|
+
if (Array.isArray(a))
|
|
1177
|
+
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
1178
|
+
else if (z(a)) {
|
|
1179
|
+
for (let [s, r] of Object.entries(a))
|
|
1180
|
+
z(r) && s in t && (r = be(t[s], r)), t = { ...t, [s]: r };
|
|
1181
|
+
z(a.headers) && (n = Pe(n, a.headers), t.headers = n);
|
|
1182
|
+
}
|
|
1183
|
+
return t;
|
|
1184
|
+
}, vt = (() => {
|
|
1185
|
+
let e = !1, t = !1;
|
|
1186
|
+
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
1187
|
+
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
1188
|
+
body: new globalThis.ReadableStream(),
|
|
1189
|
+
method: "POST",
|
|
1190
|
+
// @ts-expect-error - Types are outdated.
|
|
1191
|
+
get duplex() {
|
|
1192
|
+
return e = !0, "half";
|
|
1193
|
+
}
|
|
1194
|
+
}).headers.has("Content-Type")), e && !t;
|
|
1195
|
+
})(), Ct = typeof globalThis.AbortController == "function", Mt = typeof globalThis.ReadableStream == "function", Nt = typeof globalThis.FormData == "function", Be = ["get", "post", "put", "patch", "head", "delete"], xt = {
|
|
1196
|
+
json: "application/json",
|
|
1197
|
+
text: "text/*",
|
|
1198
|
+
formData: "multipart/form-data",
|
|
1199
|
+
arrayBuffer: "*/*",
|
|
1200
|
+
blob: "*/*"
|
|
1201
|
+
}, de = 2147483647, Le = Symbol("stop"), Dt = {
|
|
1202
|
+
json: !0,
|
|
1203
|
+
parseJson: !0,
|
|
1204
|
+
searchParams: !0,
|
|
1205
|
+
prefixUrl: !0,
|
|
1206
|
+
retry: !0,
|
|
1207
|
+
timeout: !0,
|
|
1208
|
+
hooks: !0,
|
|
1209
|
+
throwHttpErrors: !0,
|
|
1210
|
+
onDownloadProgress: !0,
|
|
1211
|
+
fetch: !0
|
|
1212
|
+
}, Pt = {
|
|
1213
|
+
method: !0,
|
|
1214
|
+
headers: !0,
|
|
1215
|
+
body: !0,
|
|
1216
|
+
mode: !0,
|
|
1217
|
+
credentials: !0,
|
|
1218
|
+
cache: !0,
|
|
1219
|
+
redirect: !0,
|
|
1220
|
+
referrer: !0,
|
|
1221
|
+
referrerPolicy: !0,
|
|
1222
|
+
integrity: !0,
|
|
1223
|
+
keepalive: !0,
|
|
1224
|
+
signal: !0,
|
|
1225
|
+
window: !0,
|
|
1226
|
+
dispatcher: !0,
|
|
1227
|
+
duplex: !0
|
|
1228
|
+
}, Bt = (e) => Be.includes(e) ? e.toUpperCase() : e, Lt = ["get", "put", "head", "delete", "options", "trace"], Vt = [408, 413, 429, 500, 502, 503, 504], Ve = [413, 429, 503], Ee = {
|
|
1229
|
+
limit: 2,
|
|
1230
|
+
methods: Lt,
|
|
1231
|
+
statusCodes: Vt,
|
|
1232
|
+
afterStatusCodes: Ve,
|
|
1233
|
+
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1234
|
+
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1235
|
+
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1236
|
+
}, Ut = (e = {}) => {
|
|
1237
|
+
if (typeof e == "number")
|
|
1238
|
+
return {
|
|
1239
|
+
...Ee,
|
|
1240
|
+
limit: e
|
|
1241
|
+
};
|
|
1242
|
+
if (e.methods && !Array.isArray(e.methods))
|
|
1243
|
+
throw new Error("retry.methods must be an array");
|
|
1244
|
+
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
1245
|
+
throw new Error("retry.statusCodes must be an array");
|
|
1246
|
+
return {
|
|
1247
|
+
...Ee,
|
|
1248
|
+
...e,
|
|
1249
|
+
afterStatusCodes: Ve
|
|
1250
|
+
};
|
|
1251
|
+
};
|
|
1252
|
+
async function $t(e, t, n, a) {
|
|
1253
|
+
return new Promise((s, r) => {
|
|
1254
|
+
const o = setTimeout(() => {
|
|
1255
|
+
n && n.abort(), r(new De(e));
|
|
1256
|
+
}, a.timeout);
|
|
1257
|
+
a.fetch(e, t).then(s).catch(r).then(() => {
|
|
1258
|
+
clearTimeout(o);
|
|
1259
|
+
});
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
async function Ht(e, { signal: t }) {
|
|
1263
|
+
return new Promise((n, a) => {
|
|
1264
|
+
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
|
|
1265
|
+
function s() {
|
|
1266
|
+
clearTimeout(r), a(t.reason);
|
|
1267
|
+
}
|
|
1268
|
+
const r = setTimeout(() => {
|
|
1269
|
+
t == null || t.removeEventListener("abort", s), n();
|
|
1270
|
+
}, e);
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
const kt = (e, t) => {
|
|
1274
|
+
const n = {};
|
|
1275
|
+
for (const a in t)
|
|
1276
|
+
!(a in Pt) && !(a in Dt) && !(a in e) && (n[a] = t[a]);
|
|
1277
|
+
return n;
|
|
1278
|
+
};
|
|
1279
|
+
class te {
|
|
1280
|
+
static create(t, n) {
|
|
1281
|
+
const a = new te(t, n), s = async () => {
|
|
1282
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > de)
|
|
1283
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${de}`);
|
|
1284
|
+
await Promise.resolve();
|
|
1285
|
+
let o = await a._fetch();
|
|
1286
|
+
for (const p of a._options.hooks.afterResponse) {
|
|
1287
|
+
const d = await p(a.request, a._options, a._decorateResponse(o.clone()));
|
|
1288
|
+
d instanceof globalThis.Response && (o = d);
|
|
1289
|
+
}
|
|
1290
|
+
if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
|
|
1291
|
+
let p = new Ae(o, a.request, a._options);
|
|
1292
|
+
for (const d of a._options.hooks.beforeError)
|
|
1293
|
+
p = await d(p);
|
|
1294
|
+
throw p;
|
|
1295
|
+
}
|
|
1296
|
+
if (a._options.onDownloadProgress) {
|
|
1297
|
+
if (typeof a._options.onDownloadProgress != "function")
|
|
1298
|
+
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
1299
|
+
if (!Mt)
|
|
1300
|
+
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
1301
|
+
return a._stream(o.clone(), a._options.onDownloadProgress);
|
|
1302
|
+
}
|
|
1303
|
+
return o;
|
|
1304
|
+
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
|
|
1305
|
+
for (const [o, p] of Object.entries(xt))
|
|
1306
|
+
r[o] = async () => {
|
|
1307
|
+
a.request.headers.set("accept", a.request.headers.get("accept") || p);
|
|
1308
|
+
const d = (await r).clone();
|
|
1309
|
+
if (o === "json") {
|
|
1310
|
+
if (d.status === 204 || (await d.clone().arrayBuffer()).byteLength === 0)
|
|
1311
|
+
return "";
|
|
1312
|
+
if (n.parseJson)
|
|
1313
|
+
return n.parseJson(await d.text());
|
|
1314
|
+
}
|
|
1315
|
+
return d[o]();
|
|
1316
|
+
};
|
|
1317
|
+
return r;
|
|
1318
|
+
}
|
|
1319
|
+
// eslint-disable-next-line complexity
|
|
1320
|
+
constructor(t, n = {}) {
|
|
1321
|
+
if (Object.defineProperty(this, "request", {
|
|
1322
|
+
enumerable: !0,
|
|
1323
|
+
configurable: !0,
|
|
1324
|
+
writable: !0,
|
|
1325
|
+
value: void 0
|
|
1326
|
+
}), Object.defineProperty(this, "abortController", {
|
|
1327
|
+
enumerable: !0,
|
|
1328
|
+
configurable: !0,
|
|
1329
|
+
writable: !0,
|
|
1330
|
+
value: void 0
|
|
1331
|
+
}), Object.defineProperty(this, "_retryCount", {
|
|
1332
|
+
enumerable: !0,
|
|
1333
|
+
configurable: !0,
|
|
1334
|
+
writable: !0,
|
|
1335
|
+
value: 0
|
|
1336
|
+
}), Object.defineProperty(this, "_input", {
|
|
1337
|
+
enumerable: !0,
|
|
1338
|
+
configurable: !0,
|
|
1339
|
+
writable: !0,
|
|
1340
|
+
value: void 0
|
|
1341
|
+
}), Object.defineProperty(this, "_options", {
|
|
1342
|
+
enumerable: !0,
|
|
1343
|
+
configurable: !0,
|
|
1344
|
+
writable: !0,
|
|
1345
|
+
value: void 0
|
|
1346
|
+
}), this._input = t, this._options = {
|
|
1347
|
+
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
1348
|
+
credentials: this._input.credentials || "same-origin",
|
|
1349
|
+
...n,
|
|
1350
|
+
headers: Pe(this._input.headers, n.headers),
|
|
1351
|
+
hooks: be({
|
|
1352
|
+
beforeRequest: [],
|
|
1353
|
+
beforeRetry: [],
|
|
1354
|
+
beforeError: [],
|
|
1355
|
+
afterResponse: []
|
|
1356
|
+
}, n.hooks),
|
|
1357
|
+
method: Bt(n.method ?? this._input.method),
|
|
1358
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1359
|
+
prefixUrl: String(n.prefixUrl || ""),
|
|
1360
|
+
retry: Ut(n.retry),
|
|
1361
|
+
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1362
|
+
timeout: n.timeout ?? 1e4,
|
|
1363
|
+
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
1364
|
+
}, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
|
|
1365
|
+
throw new TypeError("`input` must be a string, URL, or Request");
|
|
1366
|
+
if (this._options.prefixUrl && typeof this._input == "string") {
|
|
1367
|
+
if (this._input.startsWith("/"))
|
|
1368
|
+
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1369
|
+
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1370
|
+
}
|
|
1371
|
+
if (Ct) {
|
|
1372
|
+
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1373
|
+
const a = this._options.signal;
|
|
1374
|
+
this._options.signal.addEventListener("abort", () => {
|
|
1375
|
+
this.abortController.abort(a.reason);
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
this._options.signal = this.abortController.signal;
|
|
1379
|
+
}
|
|
1380
|
+
if (vt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1381
|
+
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1382
|
+
(Nt && 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(s, { ...this.request }), this._options);
|
|
1383
|
+
}
|
|
1384
|
+
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 }));
|
|
1385
|
+
}
|
|
1386
|
+
_calculateRetryDelay(t) {
|
|
1387
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof De)) {
|
|
1388
|
+
if (t instanceof Ae) {
|
|
1389
|
+
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1390
|
+
return 0;
|
|
1391
|
+
const a = t.response.headers.get("Retry-After");
|
|
1392
|
+
if (a && this._options.retry.afterStatusCodes.includes(t.response.status)) {
|
|
1393
|
+
let s = Number(a);
|
|
1394
|
+
return Number.isNaN(s) ? s = Date.parse(a) - Date.now() : s *= 1e3, this._options.retry.maxRetryAfter !== void 0 && s > this._options.retry.maxRetryAfter ? 0 : s;
|
|
1395
|
+
}
|
|
1396
|
+
if (t.response.status === 413)
|
|
1397
|
+
return 0;
|
|
1398
|
+
}
|
|
1399
|
+
const n = this._options.retry.delay(this._retryCount);
|
|
1400
|
+
return Math.min(this._options.retry.backoffLimit, n);
|
|
1401
|
+
}
|
|
1402
|
+
return 0;
|
|
1403
|
+
}
|
|
1404
|
+
_decorateResponse(t) {
|
|
1405
|
+
return this._options.parseJson && (t.json = async () => this._options.parseJson(await t.text())), t;
|
|
1406
|
+
}
|
|
1407
|
+
async _retry(t) {
|
|
1408
|
+
try {
|
|
1409
|
+
return await t();
|
|
1410
|
+
} catch (n) {
|
|
1411
|
+
const a = Math.min(this._calculateRetryDelay(n), de);
|
|
1412
|
+
if (a !== 0 && this._retryCount > 0) {
|
|
1413
|
+
await Ht(a, { signal: this._options.signal });
|
|
1414
|
+
for (const s of this._options.hooks.beforeRetry)
|
|
1415
|
+
if (await s({
|
|
1416
|
+
request: this.request,
|
|
1417
|
+
options: this._options,
|
|
1418
|
+
error: n,
|
|
1419
|
+
retryCount: this._retryCount
|
|
1420
|
+
}) === Le)
|
|
1421
|
+
return;
|
|
1422
|
+
return this._retry(t);
|
|
1423
|
+
}
|
|
1424
|
+
throw n;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
async _fetch() {
|
|
1428
|
+
for (const n of this._options.hooks.beforeRequest) {
|
|
1429
|
+
const a = await n(this.request, this._options);
|
|
1430
|
+
if (a instanceof Request) {
|
|
1431
|
+
this.request = a;
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1434
|
+
if (a instanceof Response)
|
|
1435
|
+
return a;
|
|
1436
|
+
}
|
|
1437
|
+
const t = kt(this.request, this._options);
|
|
1438
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : $t(this.request.clone(), t, this.abortController, this._options);
|
|
1439
|
+
}
|
|
1440
|
+
/* istanbul ignore next */
|
|
1441
|
+
_stream(t, n) {
|
|
1442
|
+
const a = Number(t.headers.get("content-length")) || 0;
|
|
1443
|
+
let s = 0;
|
|
1444
|
+
return t.status === 204 ? (n && n({ percent: 1, totalBytes: a, transferredBytes: s }, new Uint8Array()), new globalThis.Response(null, {
|
|
1445
|
+
status: t.status,
|
|
1446
|
+
statusText: t.statusText,
|
|
1447
|
+
headers: t.headers
|
|
1448
|
+
})) : new globalThis.Response(new globalThis.ReadableStream({
|
|
1449
|
+
async start(r) {
|
|
1450
|
+
const o = t.body.getReader();
|
|
1451
|
+
n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
|
|
1452
|
+
async function p() {
|
|
1453
|
+
const { done: d, value: l } = await o.read();
|
|
1454
|
+
if (d) {
|
|
1455
|
+
r.close();
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
if (n) {
|
|
1459
|
+
s += l.byteLength;
|
|
1460
|
+
const u = a === 0 ? 0 : s / a;
|
|
1461
|
+
n({ percent: u, transferredBytes: s, totalBytes: a }, l);
|
|
1462
|
+
}
|
|
1463
|
+
r.enqueue(l), await p();
|
|
1464
|
+
}
|
|
1465
|
+
await p();
|
|
1466
|
+
}
|
|
1467
|
+
}), {
|
|
1468
|
+
status: t.status,
|
|
1469
|
+
statusText: t.statusText,
|
|
1470
|
+
headers: t.headers
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
/*! MIT License © Sindre Sorhus */
|
|
1475
|
+
const ce = (e) => {
|
|
1476
|
+
const t = (n, a) => te.create(n, Q(e, a));
|
|
1477
|
+
for (const n of Be)
|
|
1478
|
+
t[n] = (a, s) => te.create(a, Q(e, s, { method: n }));
|
|
1479
|
+
return t.create = (n) => ce(Q(n)), t.extend = (n) => ce(Q(e, n)), t.stop = Le, t;
|
|
1480
|
+
}, Ft = ce(), Gt = Ft, qt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Re = Gt.create({ headers: qt }), we = {
|
|
1481
|
+
get: (e, t) => Re.get(e, t).json(),
|
|
1482
|
+
post: (e, t) => Re.post(e, t).json()
|
|
1483
|
+
}, ge = [...Object.values(i), "TERRA"];
|
|
1484
|
+
function Wt(e = "") {
|
|
1097
1485
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1098
|
-
if (
|
|
1486
|
+
if (ge.includes(n))
|
|
1099
1487
|
return !0;
|
|
1100
1488
|
const [a] = t.split("/");
|
|
1101
|
-
if (
|
|
1489
|
+
if (ge.includes(a))
|
|
1102
1490
|
return !0;
|
|
1103
1491
|
throw new Error(
|
|
1104
1492
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1105
1493
|
);
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1494
|
+
}
|
|
1495
|
+
const K = 8, L = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
|
|
1496
|
+
function re({
|
|
1108
1497
|
value: e,
|
|
1109
|
-
bigIntDecimal: t =
|
|
1110
|
-
decimal: n =
|
|
1498
|
+
bigIntDecimal: t = K,
|
|
1499
|
+
decimal: n = K
|
|
1111
1500
|
}) {
|
|
1501
|
+
if (n === 0)
|
|
1502
|
+
return e.toString();
|
|
1112
1503
|
const a = e < 0n;
|
|
1113
|
-
let
|
|
1114
|
-
const r = n - (
|
|
1115
|
-
r > 0 && (
|
|
1116
|
-
const
|
|
1117
|
-
let
|
|
1118
|
-
return parseInt(
|
|
1504
|
+
let s = e.toString().substring(a ? 1 : 0);
|
|
1505
|
+
const r = n - (s.length - 1);
|
|
1506
|
+
r > 0 && (s = "0".repeat(r) + s);
|
|
1507
|
+
const o = s.length - n;
|
|
1508
|
+
let p = s.slice(-n);
|
|
1509
|
+
return parseInt(p[t]) >= 5 ? p = `${p.substring(0, t - 1)}${(parseInt(p[t - 1]) + 1).toString()}` : p = p.substring(0, t), `${a ? "-" : ""}${s.slice(0, o)}.${p}`.replace(
|
|
1119
1510
|
/\.?0*$/,
|
|
1120
1511
|
""
|
|
1121
1512
|
);
|
|
1122
1513
|
}
|
|
1123
|
-
var
|
|
1124
|
-
const
|
|
1514
|
+
var U, k, B, $, me, Ue, Z, ue, ne, Te;
|
|
1515
|
+
const jt = class $e {
|
|
1125
1516
|
constructor(t) {
|
|
1126
|
-
|
|
1127
|
-
const n =
|
|
1128
|
-
this.decimal =
|
|
1129
|
-
Math.max(g(this, J, re).call(this, g(this, H, G).call(this, n)), this.decimal || 0)
|
|
1130
|
-
), g(this, ae, Se).call(this, n);
|
|
1517
|
+
H(this, U), H(this, B), H(this, me), H(this, Z), H(this, ne), I(this, "decimalMultiplier", 10n ** 8n), I(this, "bigIntValue", 0n), I(this, "decimal");
|
|
1518
|
+
const n = he(t), a = typeof t == "object";
|
|
1519
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(ke(ae(n)), this.decimal || 0)), R(this, me, Ue).call(this, n);
|
|
1131
1520
|
}
|
|
1132
1521
|
static fromBigInt(t, n) {
|
|
1133
|
-
return new
|
|
1522
|
+
return new $e({
|
|
1134
1523
|
decimal: n,
|
|
1135
|
-
value:
|
|
1524
|
+
value: re({ value: t, bigIntDecimal: n, decimal: n })
|
|
1136
1525
|
});
|
|
1137
1526
|
}
|
|
1138
1527
|
static shiftDecimals({
|
|
@@ -1140,238 +1529,291 @@ const ct = class j {
|
|
|
1140
1529
|
from: n,
|
|
1141
1530
|
to: a
|
|
1142
1531
|
}) {
|
|
1143
|
-
return
|
|
1144
|
-
|
|
1532
|
+
return this.fromBigInt(
|
|
1533
|
+
t.getBaseValue("bigint") * L(a) / L(n),
|
|
1145
1534
|
a
|
|
1146
1535
|
);
|
|
1147
1536
|
}
|
|
1148
|
-
get baseValue() {
|
|
1149
|
-
return this.getBaseValue("string");
|
|
1150
|
-
}
|
|
1151
|
-
get baseValueNumber() {
|
|
1152
|
-
return this.getBaseValue("number");
|
|
1153
|
-
}
|
|
1154
|
-
get baseValueBigInt() {
|
|
1155
|
-
return this.getBaseValue("bigint");
|
|
1156
|
-
}
|
|
1157
1537
|
set(t) {
|
|
1158
1538
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1159
1539
|
}
|
|
1160
1540
|
add(...t) {
|
|
1161
|
-
return
|
|
1541
|
+
return R(this, U, k).call(this, "add", ...t);
|
|
1162
1542
|
}
|
|
1163
1543
|
sub(...t) {
|
|
1164
|
-
return
|
|
1544
|
+
return R(this, U, k).call(this, "sub", ...t);
|
|
1165
1545
|
}
|
|
1166
1546
|
mul(...t) {
|
|
1167
|
-
return
|
|
1547
|
+
return R(this, U, k).call(this, "mul", ...t);
|
|
1168
1548
|
}
|
|
1169
1549
|
div(...t) {
|
|
1170
|
-
return
|
|
1550
|
+
return R(this, U, k).call(this, "div", ...t);
|
|
1171
1551
|
}
|
|
1172
1552
|
gt(t) {
|
|
1173
|
-
return this
|
|
1553
|
+
return R(this, B, $).call(this, "gt", t);
|
|
1174
1554
|
}
|
|
1175
1555
|
gte(t) {
|
|
1176
|
-
return this
|
|
1556
|
+
return R(this, B, $).call(this, "gte", t);
|
|
1177
1557
|
}
|
|
1178
1558
|
lt(t) {
|
|
1179
|
-
return this
|
|
1559
|
+
return R(this, B, $).call(this, "lt", t);
|
|
1180
1560
|
}
|
|
1181
1561
|
lte(t) {
|
|
1182
|
-
return this
|
|
1562
|
+
return R(this, B, $).call(this, "lte", t);
|
|
1183
1563
|
}
|
|
1184
1564
|
eqValue(t) {
|
|
1185
|
-
return this
|
|
1565
|
+
return R(this, B, $).call(this, "eqValue", t);
|
|
1186
1566
|
}
|
|
1567
|
+
// @ts-expect-error False positive
|
|
1187
1568
|
getValue(t) {
|
|
1188
1569
|
const n = this.formatBigIntToSafeValue(
|
|
1189
1570
|
this.bigIntValue,
|
|
1190
|
-
this.decimal ||
|
|
1571
|
+
this.decimal || G(this.decimalMultiplier)
|
|
1191
1572
|
);
|
|
1192
1573
|
switch (t) {
|
|
1193
1574
|
case "number":
|
|
1194
1575
|
return Number(n);
|
|
1195
1576
|
case "string":
|
|
1196
1577
|
return n;
|
|
1197
|
-
|
|
1198
|
-
return this.bigIntValue;
|
|
1578
|
+
case "bigint":
|
|
1579
|
+
return this.bigIntValue * 10n ** BigInt(this.decimal || 8n) / this.decimalMultiplier;
|
|
1199
1580
|
}
|
|
1200
1581
|
}
|
|
1582
|
+
// @ts-expect-error
|
|
1201
1583
|
getBaseValue(t) {
|
|
1202
|
-
const n = this.decimalMultiplier /
|
|
1584
|
+
const n = this.decimalMultiplier / L(this.decimal || b.THOR), a = this.bigIntValue / n;
|
|
1203
1585
|
switch (t) {
|
|
1204
1586
|
case "number":
|
|
1205
1587
|
return Number(a);
|
|
1206
1588
|
case "string":
|
|
1207
1589
|
return a.toString();
|
|
1208
|
-
|
|
1209
|
-
return
|
|
1590
|
+
case "bigint":
|
|
1591
|
+
return a;
|
|
1210
1592
|
}
|
|
1211
1593
|
}
|
|
1212
1594
|
getBigIntValue(t, n) {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
a,
|
|
1218
|
-
F(this.decimalMultiplier)
|
|
1219
|
-
), r = t < 0n, p = t.toString().substring(r ? 1 : 0), o = i - (p.length - 1), y = o > 0 ? "0".repeat(o) + p : p, T = y.length - i;
|
|
1220
|
-
let u = y.slice(-i);
|
|
1221
|
-
return parseInt(u[a]) >= 5 ? u = `${u.substring(0, a - 1)}${(parseInt(u[a - 1]) + 1).toString()}` : u = u.substring(0, a), `${r ? "-" : ""}${y.slice(
|
|
1222
|
-
0,
|
|
1223
|
-
T
|
|
1224
|
-
)}.${u}`.replace(/\.?0*$/, "");
|
|
1595
|
+
if (!n && typeof t == "object")
|
|
1596
|
+
return t.bigIntValue;
|
|
1597
|
+
const a = he(t), s = ae(a);
|
|
1598
|
+
return s === "0" || s === "undefined" ? 0n : R(this, ne, Te).call(this, s, n);
|
|
1225
1599
|
}
|
|
1226
1600
|
toSignificant(t = 6) {
|
|
1227
|
-
const [n, a] = this.getValue("string").split("."),
|
|
1228
|
-
if (
|
|
1601
|
+
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
1602
|
+
if ((parseInt(s) ? s.length + r.length : r.length) <= t)
|
|
1229
1603
|
return this.getValue("string");
|
|
1230
|
-
if (
|
|
1231
|
-
return
|
|
1232
|
-
if (parseInt(
|
|
1233
|
-
return `${
|
|
1234
|
-
|
|
1604
|
+
if (s.length >= t)
|
|
1605
|
+
return s.slice(0, t).padEnd(s.length, "0");
|
|
1606
|
+
if (parseInt(s))
|
|
1607
|
+
return `${s}.${r.slice(0, t - s.length)}`.padEnd(
|
|
1608
|
+
t - s.length,
|
|
1235
1609
|
"0"
|
|
1236
1610
|
);
|
|
1237
|
-
const o = parseInt(r),
|
|
1238
|
-
return `0.${
|
|
1239
|
-
r.length - `${o}`.length +
|
|
1611
|
+
const o = parseInt(r), p = `${o}`.slice(0, t);
|
|
1612
|
+
return `0.${p.padStart(
|
|
1613
|
+
r.length - `${o}`.length + p.length,
|
|
1614
|
+
"0"
|
|
1615
|
+
)}`;
|
|
1616
|
+
}
|
|
1617
|
+
toFixed(t = 6) {
|
|
1618
|
+
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
1619
|
+
if (parseInt(s))
|
|
1620
|
+
return `${s}.${r.slice(0, t)}`.padEnd(t, "0");
|
|
1621
|
+
const o = parseInt(r), p = `${o}`.slice(0, t);
|
|
1622
|
+
return `0.${p.padStart(
|
|
1623
|
+
r.length - `${o}`.length + p.length,
|
|
1240
1624
|
"0"
|
|
1241
1625
|
)}`;
|
|
1242
1626
|
}
|
|
1627
|
+
toAbbreviation(t = 2) {
|
|
1628
|
+
const n = this.getValue("number"), a = ["", "K", "M", "B", "T", "Q", "Qi", "S"], s = Math.floor(Math.log10(Math.abs(n)) / 3), r = a[s];
|
|
1629
|
+
if (!r)
|
|
1630
|
+
return this.getValue("string");
|
|
1631
|
+
const o = 10 ** (s * 3);
|
|
1632
|
+
return `${(n / o).toFixed(t)}${r}`;
|
|
1633
|
+
}
|
|
1634
|
+
toCurrency(t = "$", {
|
|
1635
|
+
currencyPosition: n = "start",
|
|
1636
|
+
decimal: a = 2,
|
|
1637
|
+
decimalSeparator: s = ".",
|
|
1638
|
+
thousandSeparator: r = ","
|
|
1639
|
+
} = {}) {
|
|
1640
|
+
const o = this.getValue("number"), [p, d = ""] = o.toFixed(6).split("."), l = p.replace(/\B(?=(\d{3})+(?!\d))/g, r), u = !p && !d ? "0.00" : p === "0" ? `${parseFloat(`0.${d}`)}`.replace(".", s) : `${l}${parseInt(d) ? `${s}${d.slice(0, a)}` : ""}`;
|
|
1641
|
+
return `${n === "start" ? t : ""}${u}${n === "end" ? t : ""}`;
|
|
1642
|
+
}
|
|
1643
|
+
formatBigIntToSafeValue(t, n) {
|
|
1644
|
+
const a = n || this.decimal || K, s = Math.max(
|
|
1645
|
+
a,
|
|
1646
|
+
G(this.decimalMultiplier)
|
|
1647
|
+
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o, l = d.length - s;
|
|
1648
|
+
let u = d.slice(-s);
|
|
1649
|
+
return parseInt(u[a]) >= 5 ? u = `${u.substring(0, a - 1)}${(parseInt(u[a - 1]) + 1).toString()}` : u = u.substring(0, a), `${r ? "-" : ""}${d.slice(
|
|
1650
|
+
0,
|
|
1651
|
+
l
|
|
1652
|
+
)}.${u}`.replace(/\.?0*$/, "");
|
|
1653
|
+
}
|
|
1243
1654
|
};
|
|
1244
|
-
|
|
1245
|
-
const n =
|
|
1246
|
-
(p,
|
|
1247
|
-
const
|
|
1655
|
+
U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
1656
|
+
const n = R(this, Z, ue).call(this, this, ...t), a = Math.max(n, G(this.decimalMultiplier)), s = L(a), r = t.reduce(
|
|
1657
|
+
(p, d) => {
|
|
1658
|
+
const l = this.getBigIntValue(d, a);
|
|
1248
1659
|
switch (e) {
|
|
1249
1660
|
case "add":
|
|
1250
|
-
return p +
|
|
1661
|
+
return p + l;
|
|
1251
1662
|
case "sub":
|
|
1252
|
-
return p -
|
|
1663
|
+
return p - l;
|
|
1253
1664
|
case "mul":
|
|
1254
|
-
return p *
|
|
1665
|
+
return p * l / s;
|
|
1255
1666
|
case "div": {
|
|
1256
|
-
if (
|
|
1667
|
+
if (l === 0n)
|
|
1257
1668
|
throw new RangeError("Division by zero");
|
|
1258
|
-
return p *
|
|
1669
|
+
return p * s / l;
|
|
1259
1670
|
}
|
|
1260
1671
|
default:
|
|
1261
1672
|
return p;
|
|
1262
1673
|
}
|
|
1263
1674
|
},
|
|
1264
1675
|
//normalize is to precision multiplier base
|
|
1265
|
-
this.bigIntValue *
|
|
1266
|
-
),
|
|
1267
|
-
bigIntDecimal:
|
|
1268
|
-
decimal:
|
|
1269
|
-
value:
|
|
1676
|
+
this.bigIntValue * s / this.decimalMultiplier
|
|
1677
|
+
), o = re({
|
|
1678
|
+
bigIntDecimal: a,
|
|
1679
|
+
decimal: a,
|
|
1680
|
+
value: r
|
|
1270
1681
|
});
|
|
1271
|
-
return new this.constructor({
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
).
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1682
|
+
return new this.constructor({
|
|
1683
|
+
decimalMultiplier: L(a),
|
|
1684
|
+
decimal: this.decimal,
|
|
1685
|
+
value: o,
|
|
1686
|
+
identifier: this.toString()
|
|
1687
|
+
});
|
|
1688
|
+
}, B = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1689
|
+
const n = R(this, Z, ue).call(this, this, ...t), a = this.getBigIntValue(t[0], n), s = this.getBigIntValue(this, n);
|
|
1690
|
+
switch (e) {
|
|
1691
|
+
case "gt":
|
|
1692
|
+
return s > a;
|
|
1693
|
+
case "gte":
|
|
1694
|
+
return s >= a;
|
|
1695
|
+
case "lt":
|
|
1696
|
+
return s < a;
|
|
1697
|
+
case "lte":
|
|
1698
|
+
return s <= a;
|
|
1699
|
+
case "eqValue":
|
|
1700
|
+
return s === a;
|
|
1701
|
+
}
|
|
1702
|
+
}, me = /* @__PURE__ */ new WeakSet(), Ue = function(e) {
|
|
1703
|
+
const t = ae(e) || "0";
|
|
1704
|
+
this.bigIntValue = R(this, ne, Te).call(this, t);
|
|
1705
|
+
}, Z = /* @__PURE__ */ new WeakSet(), ue = function(...e) {
|
|
1706
|
+
const t = e.map((n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) : ke(ae(n))).filter(Boolean);
|
|
1707
|
+
return Math.max(...t, K);
|
|
1708
|
+
}, ne = /* @__PURE__ */ new WeakSet(), Te = function(e, t) {
|
|
1709
|
+
const n = t ? L(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
|
|
1710
|
+
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1711
|
+
};
|
|
1712
|
+
let He = jt;
|
|
1713
|
+
const Kt = Intl.NumberFormat("fullwide", {
|
|
1714
|
+
useGrouping: !1,
|
|
1715
|
+
maximumFractionDigits: 20
|
|
1716
|
+
});
|
|
1717
|
+
function ae(e) {
|
|
1718
|
+
const t = `${typeof e == "number" ? Kt.format(e) : he(e)}`.replaceAll(",", ".").split(".");
|
|
1288
1719
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1289
|
-
}
|
|
1720
|
+
}
|
|
1721
|
+
function ke(e) {
|
|
1290
1722
|
var t;
|
|
1291
1723
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1292
|
-
return Math.max(n,
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
function oe(e) {
|
|
1724
|
+
return Math.max(n, K);
|
|
1725
|
+
}
|
|
1726
|
+
function he(e) {
|
|
1296
1727
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1297
1728
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
t.value instanceof pe ? t.value : { decimal: t.decimal, value: t.value }
|
|
1312
|
-
), N(this, "address"), N(this, "chain"), N(this, "isSynthetic", !1), N(this, "isGasAsset", !1), N(this, "symbol"), N(this, "ticker"), N(this, "type");
|
|
1313
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = ue(n);
|
|
1314
|
-
this.type = pt(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
|
|
1315
|
-
}
|
|
1316
|
-
get assetValue() {
|
|
1317
|
-
return `${this.getValue("string")} ${this.ticker}`;
|
|
1729
|
+
const q = /* @__PURE__ */ new Map();
|
|
1730
|
+
class N extends He {
|
|
1731
|
+
constructor({
|
|
1732
|
+
value: t,
|
|
1733
|
+
decimal: n,
|
|
1734
|
+
tax: a,
|
|
1735
|
+
chain: s,
|
|
1736
|
+
symbol: r,
|
|
1737
|
+
identifier: o
|
|
1738
|
+
}) {
|
|
1739
|
+
super(typeof t == "object" ? t : { decimal: n, value: t }), I(this, "address"), I(this, "chain"), I(this, "isGasAsset", !1), I(this, "isSynthetic", !1), I(this, "symbol"), I(this, "tax"), I(this, "ticker"), I(this, "type");
|
|
1740
|
+
const p = ee(o || `${s}.${r}`);
|
|
1741
|
+
this.type = Et(p), this.tax = a, this.chain = p.chain, this.ticker = p.ticker, this.symbol = p.symbol, this.address = p.address, this.isSynthetic = p.isSynthetic, this.isGasAsset = p.isGasAsset;
|
|
1318
1742
|
}
|
|
1319
1743
|
toString() {
|
|
1320
|
-
return `${this.chain}.${this.symbol}`;
|
|
1744
|
+
return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
|
|
1745
|
+
}
|
|
1746
|
+
toUrl() {
|
|
1747
|
+
return this.isSynthetic ? `${this.chain}.${this.symbol.replace("/", ".")}` : this.toString();
|
|
1321
1748
|
}
|
|
1322
1749
|
eq({ chain: t, symbol: n }) {
|
|
1323
1750
|
return this.chain === t && this.symbol === n;
|
|
1324
1751
|
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1752
|
+
// THOR.RUNE
|
|
1753
|
+
// THOR.ETH.ETH
|
|
1754
|
+
// ETH.THOR-0x1234567890
|
|
1755
|
+
static fromUrl(t, n = 0) {
|
|
1756
|
+
const [a, s, r] = t.split(".");
|
|
1757
|
+
if (!a || !s)
|
|
1758
|
+
throw new Error("Invalid asset url");
|
|
1759
|
+
const o = a === i.THORChain && r ? `${a}.${s}/${r}` : t;
|
|
1760
|
+
return ye(o, n);
|
|
1761
|
+
}
|
|
1762
|
+
static fromString(t, n = 0) {
|
|
1763
|
+
return ye(t, n);
|
|
1764
|
+
}
|
|
1765
|
+
static fromIdentifier(t, n = 0) {
|
|
1766
|
+
return ye(t, n);
|
|
1327
1767
|
}
|
|
1328
1768
|
static fromStringSync(t, n = 0) {
|
|
1329
|
-
const {
|
|
1330
|
-
|
|
1769
|
+
const { chain: a, isSynthetic: s } = ee(t), r = q.get(t.toUpperCase());
|
|
1770
|
+
if (s)
|
|
1771
|
+
return Oe(t, n);
|
|
1772
|
+
r || console.error(
|
|
1773
|
+
`Asset ${t} is not loaded. Use AssetValue.loadStaticAssets() to load it`
|
|
1331
1774
|
);
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1775
|
+
const { tax: o, decimal: p, identifier: d } = r || {
|
|
1776
|
+
decimal: b[a],
|
|
1777
|
+
identifier: t
|
|
1778
|
+
};
|
|
1779
|
+
return new N({
|
|
1780
|
+
tax: o,
|
|
1781
|
+
value: W(n, p),
|
|
1782
|
+
identifier: s ? t : d,
|
|
1783
|
+
decimal: s ? 8 : p
|
|
1784
|
+
});
|
|
1336
1785
|
}
|
|
1337
1786
|
static fromIdentifierSync(t, n = 0) {
|
|
1338
|
-
const {
|
|
1339
|
-
|
|
1787
|
+
const { chain: a, isSynthetic: s } = ee(t), r = q.get(t);
|
|
1788
|
+
if (s)
|
|
1789
|
+
return Oe(t, n);
|
|
1790
|
+
r || console.error(
|
|
1791
|
+
`Asset ${t} is not loaded. - Loading with base Chain. Use AssetValue.loadStaticAssets() to load it`
|
|
1792
|
+
);
|
|
1793
|
+
const { tax: o, decimal: p, identifier: d } = r || {
|
|
1794
|
+
decimal: b[a],
|
|
1795
|
+
identifier: t
|
|
1796
|
+
};
|
|
1797
|
+
return new N({ tax: o, decimal: p, identifier: d, value: W(n, p) });
|
|
1340
1798
|
}
|
|
1341
1799
|
static fromChainOrSignature(t, n = 0) {
|
|
1342
|
-
const { decimal: a, identifier:
|
|
1343
|
-
return new
|
|
1344
|
-
}
|
|
1345
|
-
static async fromTCQuote(t, n = 0) {
|
|
1346
|
-
const a = await Ie(ue(t)), i = this.shiftDecimals({ value: n, from: E.THOR, to: a });
|
|
1347
|
-
return new v({ value: i, identifier: t, decimal: a });
|
|
1348
|
-
}
|
|
1349
|
-
static fromTCQuoteStatic(t, n = 0) {
|
|
1350
|
-
const a = ne(t), i = this.shiftDecimals({
|
|
1351
|
-
value: n,
|
|
1352
|
-
from: E.THOR,
|
|
1353
|
-
to: a.decimal
|
|
1354
|
-
});
|
|
1355
|
-
return new v({ ...a, value: i });
|
|
1800
|
+
const { decimal: a, identifier: s } = At(t);
|
|
1801
|
+
return new N({ value: W(n, a), decimal: a, identifier: s });
|
|
1356
1802
|
}
|
|
1357
|
-
static
|
|
1803
|
+
static loadStaticAssets() {
|
|
1358
1804
|
return new Promise(
|
|
1359
1805
|
async (t, n) => {
|
|
1360
1806
|
try {
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
p.set(y, { identifier: y, decimal: l });
|
|
1372
|
-
}), p),
|
|
1373
|
-
/* @__PURE__ */ new Map()
|
|
1374
|
-
), t({ ok: !0 });
|
|
1807
|
+
const a = await import("@swapkit/tokens");
|
|
1808
|
+
Object.values(a).forEach((s) => {
|
|
1809
|
+
var r;
|
|
1810
|
+
(r = s == null ? void 0 : s.tokens) == null || r.forEach(({ identifier: o, chain: p, ...d }) => {
|
|
1811
|
+
q.set(o.toUpperCase(), {
|
|
1812
|
+
identifier: o,
|
|
1813
|
+
decimal: "decimals" in d ? d.decimals : b[p]
|
|
1814
|
+
});
|
|
1815
|
+
});
|
|
1816
|
+
}), t({ ok: !0 });
|
|
1375
1817
|
} catch (a) {
|
|
1376
1818
|
console.error(a), n({
|
|
1377
1819
|
ok: !1,
|
|
@@ -1383,35 +1825,53 @@ class v extends pe {
|
|
|
1383
1825
|
);
|
|
1384
1826
|
}
|
|
1385
1827
|
}
|
|
1386
|
-
|
|
1387
|
-
const t =
|
|
1828
|
+
function le(e) {
|
|
1829
|
+
const t = N.fromChainOrSignature(e);
|
|
1388
1830
|
switch (e) {
|
|
1389
|
-
case
|
|
1390
|
-
case
|
|
1391
|
-
case
|
|
1392
|
-
return t.
|
|
1393
|
-
case
|
|
1394
|
-
return t.
|
|
1395
|
-
case
|
|
1396
|
-
case
|
|
1397
|
-
return t.
|
|
1398
|
-
case
|
|
1399
|
-
case
|
|
1400
|
-
return t.
|
|
1831
|
+
case i.Bitcoin:
|
|
1832
|
+
case i.Litecoin:
|
|
1833
|
+
case i.BitcoinCash:
|
|
1834
|
+
return t.set(10001e-8);
|
|
1835
|
+
case i.Dogecoin:
|
|
1836
|
+
return t.set(1.00000001);
|
|
1837
|
+
case i.Avalanche:
|
|
1838
|
+
case i.Ethereum:
|
|
1839
|
+
return t.set(1e-8);
|
|
1840
|
+
case i.THORChain:
|
|
1841
|
+
case i.Maya:
|
|
1842
|
+
return t.set(0);
|
|
1401
1843
|
default:
|
|
1402
|
-
return t.
|
|
1844
|
+
return t.set(1e-8);
|
|
1403
1845
|
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1846
|
+
}
|
|
1847
|
+
async function ye(e, t = 0) {
|
|
1848
|
+
Wt(e);
|
|
1849
|
+
const n = q.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await bt(ee(e));
|
|
1850
|
+
return n || q.set(e.toUpperCase(), { identifier: e, decimal: a }), new N({ decimal: a, value: W(t, a), identifier: e });
|
|
1851
|
+
}
|
|
1852
|
+
function Oe(e, t = 0) {
|
|
1853
|
+
const [n, a] = e.split("/");
|
|
1854
|
+
return new N({
|
|
1855
|
+
decimal: 8,
|
|
1856
|
+
value: W(t, 8),
|
|
1857
|
+
identifier: `${i.THORChain}.${n}/${a}`
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
function W(e, t) {
|
|
1861
|
+
return typeof e == "bigint" ? re({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1862
|
+
}
|
|
1863
|
+
function ee(e) {
|
|
1864
|
+
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".").pop().split("/"), s = e.includes(".") && !t ? e : `${i.THORChain}.${a}`, [r, o] = s.split("."), [p, d] = (t ? a : o).split("-");
|
|
1406
1865
|
return {
|
|
1407
|
-
address:
|
|
1408
|
-
chain:
|
|
1409
|
-
isGasAsset:
|
|
1866
|
+
address: d == null ? void 0 : d.toLowerCase(),
|
|
1867
|
+
chain: r,
|
|
1868
|
+
isGasAsset: xe({ chain: r, symbol: o }),
|
|
1410
1869
|
isSynthetic: t,
|
|
1411
|
-
symbol:
|
|
1412
|
-
ticker:
|
|
1870
|
+
symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
|
|
1871
|
+
ticker: p
|
|
1413
1872
|
};
|
|
1414
|
-
}
|
|
1873
|
+
}
|
|
1874
|
+
const Xt = {
|
|
1415
1875
|
/**
|
|
1416
1876
|
* Core
|
|
1417
1877
|
*/
|
|
@@ -1458,6 +1918,7 @@ const he = (e) => {
|
|
|
1458
1918
|
core_transaction_deposit_to_pool_error: 10310,
|
|
1459
1919
|
core_transaction_deposit_insufficient_funds_error: 10311,
|
|
1460
1920
|
core_transaction_deposit_gas_error: 10312,
|
|
1921
|
+
core_transaction_invalid_sender_address: 10313,
|
|
1461
1922
|
core_transaction_deposit_server_error: 10313,
|
|
1462
1923
|
/**
|
|
1463
1924
|
* Wallets
|
|
@@ -1470,15 +1931,21 @@ const he = (e) => {
|
|
|
1470
1931
|
};
|
|
1471
1932
|
class c extends Error {
|
|
1472
1933
|
constructor(t, n) {
|
|
1473
|
-
console.error(n), super(t, { cause: { code:
|
|
1934
|
+
console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: Xt[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
|
|
1474
1935
|
}
|
|
1475
1936
|
}
|
|
1476
|
-
class
|
|
1937
|
+
class x extends He {
|
|
1477
1938
|
eq(t) {
|
|
1478
1939
|
return this.eqValue(t);
|
|
1479
1940
|
}
|
|
1941
|
+
static fromBigInt(t, n) {
|
|
1942
|
+
return new x({
|
|
1943
|
+
decimal: n,
|
|
1944
|
+
value: re({ value: t, bigIntDecimal: n, decimal: n })
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1480
1947
|
}
|
|
1481
|
-
const
|
|
1948
|
+
const Yt = [
|
|
1482
1949
|
{
|
|
1483
1950
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1484
1951
|
stateMutability: "nonpayable",
|
|
@@ -1569,7 +2036,7 @@ const Tt = [
|
|
|
1569
2036
|
type: "function"
|
|
1570
2037
|
},
|
|
1571
2038
|
{ stateMutability: "payable", type: "receive" }
|
|
1572
|
-
],
|
|
2039
|
+
], Jt = [
|
|
1573
2040
|
{
|
|
1574
2041
|
inputs: [
|
|
1575
2042
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -1713,7 +2180,7 @@ const Tt = [
|
|
|
1713
2180
|
type: "function"
|
|
1714
2181
|
},
|
|
1715
2182
|
{ stateMutability: "payable", type: "receive" }
|
|
1716
|
-
],
|
|
2183
|
+
], Qt = [
|
|
1717
2184
|
{
|
|
1718
2185
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1719
2186
|
stateMutability: "nonpayable",
|
|
@@ -1818,7 +2285,7 @@ const Tt = [
|
|
|
1818
2285
|
type: "function"
|
|
1819
2286
|
},
|
|
1820
2287
|
{ stateMutability: "payable", type: "receive" }
|
|
1821
|
-
],
|
|
2288
|
+
], zt = [
|
|
1822
2289
|
{
|
|
1823
2290
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1824
2291
|
stateMutability: "nonpayable",
|
|
@@ -1909,7 +2376,7 @@ const Tt = [
|
|
|
1909
2376
|
type: "function"
|
|
1910
2377
|
},
|
|
1911
2378
|
{ stateMutability: "payable", type: "receive" }
|
|
1912
|
-
],
|
|
2379
|
+
], Zt = [
|
|
1913
2380
|
{
|
|
1914
2381
|
inputs: [
|
|
1915
2382
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2053,7 +2520,7 @@ const Tt = [
|
|
|
2053
2520
|
type: "function"
|
|
2054
2521
|
},
|
|
2055
2522
|
{ stateMutability: "payable", type: "receive" }
|
|
2056
|
-
],
|
|
2523
|
+
], en = [
|
|
2057
2524
|
{
|
|
2058
2525
|
inputs: [
|
|
2059
2526
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2172,7 +2639,7 @@ const Tt = [
|
|
|
2172
2639
|
type: "function"
|
|
2173
2640
|
},
|
|
2174
2641
|
{ stateMutability: "payable", type: "receive" }
|
|
2175
|
-
],
|
|
2642
|
+
], tn = [
|
|
2176
2643
|
{
|
|
2177
2644
|
inputs: [
|
|
2178
2645
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2291,7 +2758,7 @@ const Tt = [
|
|
|
2291
2758
|
type: "function"
|
|
2292
2759
|
},
|
|
2293
2760
|
{ stateMutability: "payable", type: "receive" }
|
|
2294
|
-
],
|
|
2761
|
+
], nn = [
|
|
2295
2762
|
{
|
|
2296
2763
|
inputs: [
|
|
2297
2764
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2410,7 +2877,7 @@ const Tt = [
|
|
|
2410
2877
|
type: "function"
|
|
2411
2878
|
},
|
|
2412
2879
|
{ stateMutability: "payable", type: "receive" }
|
|
2413
|
-
],
|
|
2880
|
+
], an = [
|
|
2414
2881
|
{
|
|
2415
2882
|
inputs: [
|
|
2416
2883
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2529,7 +2996,7 @@ const Tt = [
|
|
|
2529
2996
|
type: "function"
|
|
2530
2997
|
},
|
|
2531
2998
|
{ stateMutability: "payable", type: "receive" }
|
|
2532
|
-
],
|
|
2999
|
+
], sn = [
|
|
2533
3000
|
{
|
|
2534
3001
|
inputs: [
|
|
2535
3002
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2656,7 +3123,7 @@ const Tt = [
|
|
|
2656
3123
|
type: "function"
|
|
2657
3124
|
},
|
|
2658
3125
|
{ stateMutability: "payable", type: "receive" }
|
|
2659
|
-
],
|
|
3126
|
+
], rn = [
|
|
2660
3127
|
{
|
|
2661
3128
|
inputs: [
|
|
2662
3129
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2783,7 +3250,7 @@ const Tt = [
|
|
|
2783
3250
|
type: "function"
|
|
2784
3251
|
},
|
|
2785
3252
|
{ stateMutability: "payable", type: "receive" }
|
|
2786
|
-
],
|
|
3253
|
+
], on = [
|
|
2787
3254
|
{
|
|
2788
3255
|
inputs: [
|
|
2789
3256
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2910,7 +3377,7 @@ const Tt = [
|
|
|
2910
3377
|
type: "function"
|
|
2911
3378
|
},
|
|
2912
3379
|
{ stateMutability: "payable", type: "receive" }
|
|
2913
|
-
],
|
|
3380
|
+
], pn = [
|
|
2914
3381
|
{
|
|
2915
3382
|
inputs: [
|
|
2916
3383
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3037,7 +3504,7 @@ const Tt = [
|
|
|
3037
3504
|
type: "function"
|
|
3038
3505
|
},
|
|
3039
3506
|
{ stateMutability: "payable", type: "receive" }
|
|
3040
|
-
],
|
|
3507
|
+
], dn = [
|
|
3041
3508
|
{
|
|
3042
3509
|
inputs: [
|
|
3043
3510
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3164,297 +3631,312 @@ const Tt = [
|
|
|
3164
3631
|
type: "function"
|
|
3165
3632
|
},
|
|
3166
3633
|
{ stateMutability: "payable", type: "receive" }
|
|
3167
|
-
],
|
|
3168
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3169
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3170
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3171
|
-
},
|
|
3172
|
-
...
|
|
3634
|
+
], Fe = {
|
|
3635
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Yt,
|
|
3636
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Qt,
|
|
3637
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: zt
|
|
3638
|
+
}, un = {
|
|
3639
|
+
...Fe,
|
|
3173
3640
|
// AVAX
|
|
3174
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3175
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3176
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3641
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: en,
|
|
3642
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Jt,
|
|
3643
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: nn,
|
|
3177
3644
|
// BSC
|
|
3178
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3645
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Zt,
|
|
3179
3646
|
// ETH
|
|
3180
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3181
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3182
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3183
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3184
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3185
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3186
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3187
|
-
},
|
|
3647
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: tn,
|
|
3648
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: an,
|
|
3649
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: sn,
|
|
3650
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: rn,
|
|
3651
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: on,
|
|
3652
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: pn,
|
|
3653
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: dn
|
|
3654
|
+
}, ln = ({
|
|
3188
3655
|
streamSwap: e,
|
|
3189
3656
|
contractAddress: t,
|
|
3190
3657
|
recipient: n,
|
|
3191
3658
|
toChecksumAddress: a,
|
|
3192
3659
|
calldata: {
|
|
3193
|
-
amount:
|
|
3660
|
+
amount: s,
|
|
3194
3661
|
amountOutMin: r = "",
|
|
3195
|
-
data:
|
|
3196
|
-
deadline:
|
|
3197
|
-
memo:
|
|
3198
|
-
router:
|
|
3662
|
+
data: o = "",
|
|
3663
|
+
deadline: p,
|
|
3664
|
+
memo: d,
|
|
3665
|
+
router: l,
|
|
3199
3666
|
memoStreamingSwap: u,
|
|
3200
|
-
tcMemo:
|
|
3201
|
-
tcRouter:
|
|
3202
|
-
tcVault:
|
|
3203
|
-
vault:
|
|
3204
|
-
token:
|
|
3667
|
+
tcMemo: m,
|
|
3668
|
+
tcRouter: _,
|
|
3669
|
+
tcVault: w,
|
|
3670
|
+
vault: A,
|
|
3671
|
+
token: E
|
|
3205
3672
|
}
|
|
3206
3673
|
}) => {
|
|
3207
|
-
const
|
|
3208
|
-
if (
|
|
3674
|
+
const O = !!Fe[t.toLowerCase()];
|
|
3675
|
+
if (O && !l)
|
|
3209
3676
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3210
|
-
const
|
|
3211
|
-
if (!
|
|
3677
|
+
const S = m || d, D = e && u || S;
|
|
3678
|
+
if (!w && !A)
|
|
3212
3679
|
throw new Error("TC Vault is required on calldata");
|
|
3213
|
-
if (!
|
|
3680
|
+
if (!_ && !l)
|
|
3214
3681
|
throw new Error("TC Router is required on calldata");
|
|
3215
|
-
if (!
|
|
3682
|
+
if (!D)
|
|
3216
3683
|
throw new Error("TC Memo is required on calldata");
|
|
3217
|
-
if (!
|
|
3684
|
+
if (!E)
|
|
3218
3685
|
throw new Error("Token is required on calldata");
|
|
3219
|
-
const
|
|
3686
|
+
const oe = [
|
|
3220
3687
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3221
|
-
a(
|
|
3222
|
-
a(
|
|
3223
|
-
|
|
3224
|
-
a(
|
|
3225
|
-
|
|
3226
|
-
],
|
|
3227
|
-
return [...
|
|
3228
|
-
},
|
|
3229
|
-
const n =
|
|
3688
|
+
a(_ || l),
|
|
3689
|
+
a(w || A),
|
|
3690
|
+
D.replace("{recipientAddress}", n),
|
|
3691
|
+
a(E),
|
|
3692
|
+
s
|
|
3693
|
+
], Ge = O ? [a(l), o, p] : [r, p];
|
|
3694
|
+
return [...oe, ...Ge];
|
|
3695
|
+
}, yn = ({ chain: e, txHash: t }) => {
|
|
3696
|
+
const n = Me[e];
|
|
3230
3697
|
switch (e) {
|
|
3231
|
-
case
|
|
3232
|
-
case
|
|
3233
|
-
case
|
|
3234
|
-
case
|
|
3235
|
-
|
|
3236
|
-
case
|
|
3237
|
-
|
|
3238
|
-
case
|
|
3239
|
-
case
|
|
3240
|
-
case
|
|
3241
|
-
case
|
|
3242
|
-
case s.Optimism:
|
|
3243
|
-
case s.Polygon:
|
|
3698
|
+
case i.Binance:
|
|
3699
|
+
case i.Maya:
|
|
3700
|
+
case i.Kujira:
|
|
3701
|
+
case i.THORChain:
|
|
3702
|
+
return `${n}/tx/${t.startsWith("0x") ? t.slice(2) : t}`;
|
|
3703
|
+
case i.Arbitrum:
|
|
3704
|
+
case i.Avalanche:
|
|
3705
|
+
case i.BinanceSmartChain:
|
|
3706
|
+
case i.Ethereum:
|
|
3707
|
+
case i.Optimism:
|
|
3708
|
+
case i.Polygon:
|
|
3244
3709
|
return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
|
|
3245
|
-
case
|
|
3710
|
+
case i.Cosmos:
|
|
3246
3711
|
return `${n}/transactions/${t}`;
|
|
3247
|
-
case
|
|
3712
|
+
case i.Litecoin:
|
|
3713
|
+
case i.Bitcoin:
|
|
3714
|
+
case i.BitcoinCash:
|
|
3715
|
+
case i.Dogecoin:
|
|
3248
3716
|
return `${n}/transaction/${t.toLowerCase()}`;
|
|
3249
|
-
case s.Litecoin:
|
|
3250
|
-
return `${n}/${t}`;
|
|
3251
3717
|
default:
|
|
3252
3718
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3253
3719
|
}
|
|
3254
|
-
},
|
|
3255
|
-
const n =
|
|
3720
|
+
}, cn = ({ chain: e, address: t }) => {
|
|
3721
|
+
const n = Me[e];
|
|
3256
3722
|
switch (e) {
|
|
3257
|
-
case
|
|
3258
|
-
case
|
|
3259
|
-
case
|
|
3260
|
-
case
|
|
3261
|
-
case
|
|
3262
|
-
case
|
|
3263
|
-
case
|
|
3264
|
-
case
|
|
3265
|
-
case
|
|
3266
|
-
case
|
|
3267
|
-
case
|
|
3268
|
-
case
|
|
3269
|
-
case
|
|
3723
|
+
case i.Arbitrum:
|
|
3724
|
+
case i.Avalanche:
|
|
3725
|
+
case i.Binance:
|
|
3726
|
+
case i.BinanceSmartChain:
|
|
3727
|
+
case i.Bitcoin:
|
|
3728
|
+
case i.BitcoinCash:
|
|
3729
|
+
case i.Dogecoin:
|
|
3730
|
+
case i.Ethereum:
|
|
3731
|
+
case i.Kujira:
|
|
3732
|
+
case i.Litecoin:
|
|
3733
|
+
case i.Maya:
|
|
3734
|
+
case i.Optimism:
|
|
3735
|
+
case i.Polygon:
|
|
3736
|
+
case i.THORChain:
|
|
3270
3737
|
return `${n}/address/${t}`;
|
|
3271
|
-
case
|
|
3738
|
+
case i.Cosmos:
|
|
3272
3739
|
return `${n}/account/${t}`;
|
|
3273
|
-
case s.Litecoin:
|
|
3274
|
-
return `${n}/${t}`;
|
|
3275
3740
|
default:
|
|
3276
3741
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3277
3742
|
}
|
|
3278
|
-
},
|
|
3279
|
-
const t = e ?
|
|
3280
|
-
return
|
|
3281
|
-
},
|
|
3282
|
-
const t = e ?
|
|
3283
|
-
return
|
|
3284
|
-
},
|
|
3743
|
+
}, mn = (e) => {
|
|
3744
|
+
const t = e ? j.ThornodeStagenet : j.ThornodeMainnet;
|
|
3745
|
+
return we.get(`${t}/thorchain/inbound_addresses`);
|
|
3746
|
+
}, Tn = (e) => {
|
|
3747
|
+
const t = e ? j.ThornodeStagenet : j.ThornodeMainnet;
|
|
3748
|
+
return we.get(`${t}/thorchain/mimir`);
|
|
3749
|
+
}, Se = () => Object.values(i).reduce(
|
|
3285
3750
|
(e, t) => (e[t] = null, e),
|
|
3286
3751
|
{}
|
|
3287
|
-
)
|
|
3288
|
-
|
|
3289
|
-
|
|
3752
|
+
), hn = async ({ chain: e, address: t }) => {
|
|
3753
|
+
if (!t)
|
|
3754
|
+
return !1;
|
|
3755
|
+
switch (e) {
|
|
3756
|
+
case i.Bitcoin:
|
|
3757
|
+
return !t.startsWith("bc1p");
|
|
3758
|
+
default:
|
|
3759
|
+
return !0;
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
var V, se, X, v, Y, J;
|
|
3763
|
+
class Ln {
|
|
3290
3764
|
constructor({ stagenet: t } = {}) {
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3765
|
+
T(this, "connectedChains", Se());
|
|
3766
|
+
T(this, "connectedWallets", Se());
|
|
3767
|
+
T(this, "stagenet", !1);
|
|
3768
|
+
T(this, "getAddress", (t) => {
|
|
3295
3769
|
var n;
|
|
3296
3770
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3297
3771
|
});
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
if (!n)
|
|
3304
|
-
return ((i = this.connectedChains[t]) == null ? void 0 : i.balance) || [];
|
|
3305
|
-
const a = await this.getWalletByChain(t);
|
|
3772
|
+
T(this, "getExplorerTxUrl", (t, n) => yn({ chain: t, txHash: n }));
|
|
3773
|
+
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3774
|
+
T(this, "getExplorerAddressUrl", (t, n) => cn({ chain: t, address: n }));
|
|
3775
|
+
T(this, "getBalance", async (t, n) => {
|
|
3776
|
+
const a = await this.getWalletByChain(t, n);
|
|
3306
3777
|
return (a == null ? void 0 : a.balance) || [];
|
|
3307
3778
|
});
|
|
3308
|
-
|
|
3309
|
-
var
|
|
3310
|
-
const { quoteMode: r } = a.meta,
|
|
3779
|
+
T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
|
|
3780
|
+
var p, d;
|
|
3781
|
+
const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
|
|
3311
3782
|
if (!a.complete)
|
|
3312
3783
|
throw new c("core_swap_route_not_complete");
|
|
3313
3784
|
try {
|
|
3314
|
-
if (
|
|
3315
|
-
const l = this.connectedWallets[
|
|
3785
|
+
if (Ze.includes(r)) {
|
|
3786
|
+
const l = this.connectedWallets[o];
|
|
3316
3787
|
if (!(l != null && l.sendTransaction))
|
|
3317
3788
|
throw new c("core_wallet_connection_not_found");
|
|
3318
|
-
if (!(t ? (
|
|
3789
|
+
if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
|
|
3319
3790
|
throw new c("core_swap_route_transaction_not_found");
|
|
3320
|
-
const {
|
|
3321
|
-
data:
|
|
3322
|
-
from:
|
|
3323
|
-
to:
|
|
3324
|
-
chainId: BigInt(
|
|
3325
|
-
value:
|
|
3326
|
-
value: _(b) ? b : R(b, "wei").toString(16)
|
|
3327
|
-
}).baseValueBigInt : 0n
|
|
3791
|
+
const { data: m, from: _, to: w, value: A } = a.transaction, E = {
|
|
3792
|
+
data: m,
|
|
3793
|
+
from: _,
|
|
3794
|
+
to: w.toLowerCase(),
|
|
3795
|
+
chainId: BigInt(pt[o]),
|
|
3796
|
+
value: A ? BigInt(A) : 0n
|
|
3328
3797
|
};
|
|
3329
|
-
return l.sendTransaction(
|
|
3798
|
+
return l.sendTransaction(E, s);
|
|
3330
3799
|
}
|
|
3331
|
-
if (
|
|
3800
|
+
if (tt.includes(r)) {
|
|
3332
3801
|
if (!a.calldata.fromAsset)
|
|
3333
3802
|
throw new c("core_swap_asset_not_recognized");
|
|
3334
|
-
const l = await
|
|
3803
|
+
const l = await N.fromString(a.calldata.fromAsset);
|
|
3335
3804
|
if (!l)
|
|
3336
3805
|
throw new c("core_swap_asset_not_recognized");
|
|
3337
|
-
const { address:
|
|
3338
|
-
contract:
|
|
3339
|
-
calldata: { amountIn:
|
|
3340
|
-
} = a,
|
|
3341
|
-
return this.deposit({
|
|
3806
|
+
const { address: u } = await f(this, V).call(this, l.chain), {
|
|
3807
|
+
contract: m,
|
|
3808
|
+
calldata: { expiration: _, amountIn: w, memo: A, memoStreamingSwap: E }
|
|
3809
|
+
} = a, O = l.add(x.fromBigInt(BigInt(w), l.decimal)), S = t && E || A;
|
|
3810
|
+
return this.deposit({
|
|
3811
|
+
expiration: _,
|
|
3812
|
+
assetValue: O,
|
|
3813
|
+
memo: S,
|
|
3814
|
+
feeOptionKey: s,
|
|
3815
|
+
router: m,
|
|
3816
|
+
recipient: u
|
|
3817
|
+
});
|
|
3342
3818
|
}
|
|
3343
|
-
if (
|
|
3344
|
-
const { calldata: l, contract:
|
|
3345
|
-
if (!
|
|
3819
|
+
if (et.includes(r)) {
|
|
3820
|
+
const { calldata: l, contract: u } = a;
|
|
3821
|
+
if (!u)
|
|
3346
3822
|
throw new c("core_swap_contract_not_found");
|
|
3347
|
-
const
|
|
3348
|
-
if (!(
|
|
3823
|
+
const m = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3824
|
+
if (!(m != null && m.sendTransaction) || !_)
|
|
3349
3825
|
throw new c("core_wallet_connection_not_found");
|
|
3350
|
-
const { getProvider:
|
|
3351
|
-
if (!
|
|
3352
|
-
throw new c("core_swap_contract_not_supported", { contractAddress:
|
|
3353
|
-
const
|
|
3354
|
-
|
|
3355
|
-
...Ct({
|
|
3826
|
+
const { getProvider: w, toChecksumAddress: A } = await import("@swapkit/toolbox-evm"), E = w(o), O = un[u.toLowerCase()];
|
|
3827
|
+
if (!O)
|
|
3828
|
+
throw new c("core_swap_contract_not_supported", { contractAddress: u });
|
|
3829
|
+
const D = await (await ((d = m.createContract) == null ? void 0 : d.call(m, u, O, E))).getFunction("swapIn").populateTransaction(
|
|
3830
|
+
...ln({
|
|
3356
3831
|
streamSwap: t,
|
|
3357
|
-
toChecksumAddress:
|
|
3358
|
-
contractAddress:
|
|
3832
|
+
toChecksumAddress: A,
|
|
3833
|
+
contractAddress: u,
|
|
3359
3834
|
recipient: n,
|
|
3360
3835
|
calldata: l
|
|
3361
3836
|
}),
|
|
3362
|
-
{ from:
|
|
3363
|
-
)
|
|
3364
|
-
return
|
|
3837
|
+
{ from: _ }
|
|
3838
|
+
);
|
|
3839
|
+
return m.sendTransaction(D, s);
|
|
3365
3840
|
}
|
|
3366
3841
|
throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3367
3842
|
} catch (l) {
|
|
3368
3843
|
throw new c("core_swap_transaction_error", l);
|
|
3369
3844
|
}
|
|
3370
3845
|
});
|
|
3371
|
-
|
|
3372
|
-
var
|
|
3373
|
-
const
|
|
3374
|
-
if (!
|
|
3846
|
+
T(this, "getWalletByChain", async (t, n) => {
|
|
3847
|
+
var o, p;
|
|
3848
|
+
const a = this.getAddress(t);
|
|
3849
|
+
if (!a)
|
|
3375
3850
|
return null;
|
|
3376
|
-
const
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3851
|
+
const s = [N.fromChainOrSignature(t)], r = (o = this.connectedChains[t]) == null ? void 0 : o.walletType;
|
|
3852
|
+
try {
|
|
3853
|
+
const d = await ((p = this.getWallet(t)) == null ? void 0 : p.getBalance(a, n));
|
|
3854
|
+
return this.connectedChains[t] = {
|
|
3855
|
+
address: a,
|
|
3856
|
+
balance: d != null && d.length ? d : s,
|
|
3857
|
+
walletType: r
|
|
3858
|
+
}, { ...this.connectedChains[t] };
|
|
3859
|
+
} catch (d) {
|
|
3860
|
+
return console.error(d), { address: a, balance: s, walletType: r };
|
|
3861
|
+
}
|
|
3384
3862
|
});
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
var a,
|
|
3389
|
-
return (
|
|
3863
|
+
T(this, "approveAssetValue", (t, n) => f(this, X).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
3864
|
+
T(this, "isAssetValueApproved", (t, n) => f(this, X).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
3865
|
+
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3866
|
+
var a, s;
|
|
3867
|
+
return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
|
|
3390
3868
|
});
|
|
3391
|
-
|
|
3869
|
+
T(this, "transfer", async (t) => {
|
|
3392
3870
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
3393
3871
|
if (!n)
|
|
3394
3872
|
throw new c("core_wallet_connection_not_found");
|
|
3395
3873
|
try {
|
|
3396
|
-
return await n.transfer(
|
|
3874
|
+
return await n.transfer(f(this, J).call(this, t));
|
|
3397
3875
|
} catch (a) {
|
|
3398
3876
|
throw new c("core_swap_transaction_error", a);
|
|
3399
3877
|
}
|
|
3400
3878
|
});
|
|
3401
|
-
|
|
3879
|
+
T(this, "deposit", async ({
|
|
3402
3880
|
assetValue: t,
|
|
3403
3881
|
recipient: n,
|
|
3404
3882
|
router: a,
|
|
3405
|
-
...
|
|
3883
|
+
...s
|
|
3406
3884
|
}) => {
|
|
3407
|
-
const { chain: r, symbol:
|
|
3408
|
-
if (!
|
|
3885
|
+
const { chain: r, symbol: o, ticker: p } = t, d = this.connectedWallets[r];
|
|
3886
|
+
if (!await hn({ address: await (d == null ? void 0 : d.getAddress()), chain: r }))
|
|
3887
|
+
throw new c("core_transaction_invalid_sender_address");
|
|
3888
|
+
if (!d)
|
|
3409
3889
|
throw new c("core_wallet_connection_not_found");
|
|
3410
|
-
const
|
|
3890
|
+
const l = f(this, J).call(this, { assetValue: t, recipient: n, router: a, ...s });
|
|
3411
3891
|
try {
|
|
3412
3892
|
switch (r) {
|
|
3413
|
-
case
|
|
3414
|
-
const u =
|
|
3415
|
-
return await (n === "" ? u.deposit(
|
|
3893
|
+
case i.THORChain: {
|
|
3894
|
+
const u = d;
|
|
3895
|
+
return await (n === "" ? u.deposit(l) : u.transfer(l));
|
|
3416
3896
|
}
|
|
3417
|
-
case
|
|
3418
|
-
case
|
|
3419
|
-
case
|
|
3420
|
-
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"),
|
|
3421
|
-
return await
|
|
3422
|
-
abi:
|
|
3423
|
-
contractAddress: a || (await
|
|
3897
|
+
case i.Ethereum:
|
|
3898
|
+
case i.BinanceSmartChain:
|
|
3899
|
+
case i.Avalanche: {
|
|
3900
|
+
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), m = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Ye;
|
|
3901
|
+
return await d.call({
|
|
3902
|
+
abi: m,
|
|
3903
|
+
contractAddress: a || (await f(this, V).call(this, r)).router,
|
|
3424
3904
|
funcName: "depositWithExpiry",
|
|
3425
3905
|
funcParams: [
|
|
3426
3906
|
n,
|
|
3427
|
-
u({ chain: r, symbol:
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
i.expiration
|
|
3907
|
+
u({ chain: r, symbol: o, ticker: p }, r),
|
|
3908
|
+
t.getBaseValue("string"),
|
|
3909
|
+
l.memo,
|
|
3910
|
+
s.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
3432
3911
|
],
|
|
3433
|
-
txOverrides: {
|
|
3912
|
+
txOverrides: {
|
|
3913
|
+
from: l.from,
|
|
3914
|
+
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
3915
|
+
}
|
|
3434
3916
|
});
|
|
3435
3917
|
}
|
|
3436
3918
|
default:
|
|
3437
|
-
return await
|
|
3919
|
+
return await d.transfer(l);
|
|
3438
3920
|
}
|
|
3439
3921
|
} catch (u) {
|
|
3440
|
-
const
|
|
3441
|
-
throw new c(
|
|
3922
|
+
const m = ((u == null ? void 0 : u.message) || (u == null ? void 0 : u.toString())).toLowerCase(), _ = m == null ? void 0 : m.includes("insufficient funds"), w = m == null ? void 0 : m.includes("gas"), A = m == null ? void 0 : m.includes("server"), E = _ ? "core_transaction_deposit_insufficient_funds_error" : w ? "core_transaction_deposit_gas_error" : A ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
|
|
3923
|
+
throw new c(E, u);
|
|
3442
3924
|
}
|
|
3443
3925
|
});
|
|
3444
3926
|
/**
|
|
3445
3927
|
* TC related Methods
|
|
3446
3928
|
*/
|
|
3447
|
-
|
|
3929
|
+
T(this, "createLiquidity", async ({
|
|
3448
3930
|
runeAssetValue: t,
|
|
3449
3931
|
assetValue: n
|
|
3450
3932
|
}) => {
|
|
3451
3933
|
if (t.lte(0) || n.lte(0))
|
|
3452
3934
|
throw new c("core_transaction_create_liquidity_invalid_params");
|
|
3453
|
-
let a = "",
|
|
3935
|
+
let a = "", s = "";
|
|
3454
3936
|
try {
|
|
3455
|
-
a = await
|
|
3937
|
+
a = await f(this, v).call(this, {
|
|
3456
3938
|
assetValue: t,
|
|
3457
|
-
memo:
|
|
3939
|
+
memo: M(h.DEPOSIT, {
|
|
3458
3940
|
...n,
|
|
3459
3941
|
address: this.getAddress(n.chain)
|
|
3460
3942
|
})
|
|
@@ -3463,166 +3945,172 @@ class zt {
|
|
|
3463
3945
|
throw new c("core_transaction_create_liquidity_rune_error", r);
|
|
3464
3946
|
}
|
|
3465
3947
|
try {
|
|
3466
|
-
|
|
3948
|
+
s = await f(this, v).call(this, {
|
|
3467
3949
|
assetValue: n,
|
|
3468
|
-
memo:
|
|
3950
|
+
memo: M(h.DEPOSIT, {
|
|
3469
3951
|
...n,
|
|
3470
|
-
address: this.getAddress(
|
|
3952
|
+
address: this.getAddress(i.THORChain)
|
|
3471
3953
|
})
|
|
3472
3954
|
});
|
|
3473
3955
|
} catch (r) {
|
|
3474
3956
|
throw new c("core_transaction_create_liquidity_asset_error", r);
|
|
3475
3957
|
}
|
|
3476
|
-
return { runeTx: a, assetTx:
|
|
3958
|
+
return { runeTx: a, assetTx: s };
|
|
3477
3959
|
});
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
isPendingSymmAsset: p,
|
|
3960
|
+
T(this, "addLiquidity", async ({
|
|
3961
|
+
runeAssetValue: t,
|
|
3962
|
+
assetValue: n,
|
|
3963
|
+
runeAddr: a,
|
|
3964
|
+
assetAddr: s,
|
|
3965
|
+
isPendingSymmAsset: r,
|
|
3485
3966
|
mode: o = "sym"
|
|
3486
3967
|
}) => {
|
|
3487
|
-
const
|
|
3488
|
-
if (!
|
|
3968
|
+
const { chain: p, symbol: d } = n, l = o === "sym", u = (t == null ? void 0 : t.gt(0)) && (l || o === "rune"), m = (n == null ? void 0 : n.gt(0)) && (l || o === "asset"), _ = r || u, w = _ ? a || this.getAddress(i.THORChain) : "", A = l || o === "asset" ? s || this.getAddress(p) : "";
|
|
3969
|
+
if (!u && !m)
|
|
3489
3970
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
3490
|
-
if (_ && !
|
|
3971
|
+
if (_ && !w)
|
|
3491
3972
|
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
3492
|
-
let
|
|
3493
|
-
|
|
3494
|
-
if (l && n)
|
|
3973
|
+
let E, O;
|
|
3974
|
+
if (u && t)
|
|
3495
3975
|
try {
|
|
3496
|
-
|
|
3497
|
-
assetValue:
|
|
3498
|
-
memo:
|
|
3976
|
+
E = await f(this, v).call(this, {
|
|
3977
|
+
assetValue: t,
|
|
3978
|
+
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: A })
|
|
3499
3979
|
});
|
|
3500
|
-
} catch (
|
|
3501
|
-
throw new c("core_transaction_add_liquidity_rune_error",
|
|
3980
|
+
} catch (S) {
|
|
3981
|
+
throw new c("core_transaction_add_liquidity_rune_error", S);
|
|
3502
3982
|
}
|
|
3503
|
-
if (
|
|
3983
|
+
if (m && n)
|
|
3504
3984
|
try {
|
|
3505
|
-
|
|
3506
|
-
assetValue:
|
|
3507
|
-
memo:
|
|
3985
|
+
O = await f(this, v).call(this, {
|
|
3986
|
+
assetValue: n,
|
|
3987
|
+
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: w })
|
|
3508
3988
|
});
|
|
3509
|
-
} catch (
|
|
3510
|
-
throw new c("core_transaction_add_liquidity_asset_error",
|
|
3989
|
+
} catch (S) {
|
|
3990
|
+
throw new c("core_transaction_add_liquidity_asset_error", S);
|
|
3511
3991
|
}
|
|
3512
|
-
return { runeTx:
|
|
3992
|
+
return { runeTx: E, assetTx: O };
|
|
3513
3993
|
});
|
|
3514
|
-
|
|
3994
|
+
T(this, "addLiquidityPart", ({
|
|
3995
|
+
assetValue: t,
|
|
3996
|
+
poolAddress: n,
|
|
3997
|
+
address: a,
|
|
3998
|
+
symmetric: s
|
|
3999
|
+
}) => {
|
|
4000
|
+
if (s && !a)
|
|
4001
|
+
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
4002
|
+
const r = M(h.DEPOSIT, {
|
|
4003
|
+
chain: n.split(".")[0],
|
|
4004
|
+
symbol: n.split(".")[1],
|
|
4005
|
+
address: s ? a : ""
|
|
4006
|
+
});
|
|
4007
|
+
return f(this, v).call(this, { assetValue: t, memo: r });
|
|
4008
|
+
});
|
|
4009
|
+
T(this, "withdraw", async ({
|
|
3515
4010
|
memo: t,
|
|
3516
4011
|
assetValue: n,
|
|
3517
4012
|
percent: a,
|
|
3518
|
-
from:
|
|
4013
|
+
from: s,
|
|
3519
4014
|
to: r
|
|
3520
4015
|
}) => {
|
|
3521
|
-
const
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
targetAssetString: p == null ? void 0 : p.toString(),
|
|
3531
|
-
singleSide: !1
|
|
3532
|
-
})
|
|
3533
|
-
});
|
|
3534
|
-
} catch (o) {
|
|
3535
|
-
throw new c("core_transaction_withdraw_error", o);
|
|
3536
|
-
}
|
|
4016
|
+
const o = r === "rune" ? N.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n, p = le(s === "asset" ? n.chain : i.THORChain), d = t || M(h.WITHDRAW, {
|
|
4017
|
+
symbol: n.symbol,
|
|
4018
|
+
chain: n.chain,
|
|
4019
|
+
ticker: n.ticker,
|
|
4020
|
+
basisPoints: Math.min(1e4, Math.round(a * 100)),
|
|
4021
|
+
targetAssetString: o == null ? void 0 : o.toString(),
|
|
4022
|
+
singleSide: !1
|
|
4023
|
+
});
|
|
4024
|
+
return f(this, v).call(this, { assetValue: p, memo: d });
|
|
3537
4025
|
});
|
|
3538
|
-
|
|
4026
|
+
T(this, "savings", async ({
|
|
3539
4027
|
assetValue: t,
|
|
3540
4028
|
memo: n,
|
|
3541
4029
|
percent: a,
|
|
3542
|
-
type:
|
|
4030
|
+
type: s
|
|
3543
4031
|
}) => {
|
|
3544
|
-
const r =
|
|
4032
|
+
const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || M(r, {
|
|
3545
4033
|
ticker: t.ticker,
|
|
3546
4034
|
symbol: t.symbol,
|
|
3547
4035
|
chain: t.chain,
|
|
3548
4036
|
singleSide: !0,
|
|
3549
|
-
basisPoints: a ? Math.
|
|
3550
|
-
});
|
|
3551
|
-
return
|
|
4037
|
+
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
4038
|
+
}), p = r === h.DEPOSIT ? t : le(t.chain);
|
|
4039
|
+
return f(this, v).call(this, { memo: o, assetValue: p });
|
|
3552
4040
|
});
|
|
3553
|
-
|
|
4041
|
+
T(this, "loan", ({
|
|
3554
4042
|
assetValue: t,
|
|
3555
4043
|
memo: n,
|
|
3556
4044
|
minAmount: a,
|
|
3557
|
-
type:
|
|
3558
|
-
}) =>
|
|
4045
|
+
type: s
|
|
4046
|
+
}) => f(this, v).call(this, {
|
|
3559
4047
|
assetValue: t,
|
|
3560
|
-
memo: n ||
|
|
4048
|
+
memo: n || M(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
|
|
3561
4049
|
asset: t.toString(),
|
|
3562
4050
|
minAmount: a.toString(),
|
|
3563
4051
|
address: this.getAddress(t.chain)
|
|
3564
4052
|
})
|
|
3565
4053
|
}));
|
|
3566
|
-
|
|
4054
|
+
T(this, "nodeAction", ({
|
|
3567
4055
|
type: t,
|
|
3568
4056
|
assetValue: n,
|
|
3569
4057
|
address: a
|
|
3570
4058
|
}) => {
|
|
3571
|
-
const
|
|
4059
|
+
const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = M(s, {
|
|
3572
4060
|
address: a,
|
|
3573
|
-
unbondAmount: t === "unbond" ? n.
|
|
4061
|
+
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
3574
4062
|
});
|
|
3575
|
-
return
|
|
4063
|
+
return f(this, Y).call(this, {
|
|
3576
4064
|
memo: r,
|
|
3577
|
-
assetValue: t === "bond" ? n :
|
|
4065
|
+
assetValue: t === "bond" ? n : le(i.THORChain)
|
|
3578
4066
|
});
|
|
3579
4067
|
});
|
|
3580
|
-
|
|
4068
|
+
T(this, "registerThorname", ({
|
|
3581
4069
|
assetValue: t,
|
|
3582
4070
|
...n
|
|
3583
|
-
}) =>
|
|
3584
|
-
|
|
4071
|
+
}) => f(this, Y).call(this, { assetValue: t, memo: M(h.THORNAME_REGISTER, n) }));
|
|
4072
|
+
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
|
|
3585
4073
|
try {
|
|
3586
4074
|
t.forEach((r) => {
|
|
3587
4075
|
this[r.connectMethodName] = r.connect({
|
|
3588
|
-
addChain:
|
|
4076
|
+
addChain: f(this, se),
|
|
3589
4077
|
config: n || {},
|
|
3590
4078
|
apis: a,
|
|
3591
|
-
rpcUrls:
|
|
4079
|
+
rpcUrls: s
|
|
3592
4080
|
});
|
|
3593
4081
|
});
|
|
3594
4082
|
} catch (r) {
|
|
3595
4083
|
throw new c("core_extend_error", r);
|
|
3596
4084
|
}
|
|
3597
4085
|
});
|
|
3598
|
-
|
|
4086
|
+
T(this, "estimateMaxSendableAmount", async ({
|
|
3599
4087
|
chain: t,
|
|
3600
4088
|
params: n
|
|
3601
4089
|
}) => {
|
|
3602
4090
|
const a = this.getWallet(t);
|
|
3603
4091
|
switch (t) {
|
|
3604
|
-
case
|
|
3605
|
-
case
|
|
3606
|
-
case
|
|
3607
|
-
case
|
|
3608
|
-
case
|
|
3609
|
-
case
|
|
3610
|
-
const { estimateMaxSendableAmount:
|
|
3611
|
-
return
|
|
4092
|
+
case i.Arbitrum:
|
|
4093
|
+
case i.Avalanche:
|
|
4094
|
+
case i.BinanceSmartChain:
|
|
4095
|
+
case i.Ethereum:
|
|
4096
|
+
case i.Optimism:
|
|
4097
|
+
case i.Polygon: {
|
|
4098
|
+
const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-evm");
|
|
4099
|
+
return s({
|
|
3612
4100
|
...n,
|
|
3613
4101
|
toolbox: a
|
|
3614
4102
|
});
|
|
3615
4103
|
}
|
|
3616
|
-
case
|
|
3617
|
-
case
|
|
3618
|
-
case
|
|
3619
|
-
case
|
|
4104
|
+
case i.Bitcoin:
|
|
4105
|
+
case i.BitcoinCash:
|
|
4106
|
+
case i.Dogecoin:
|
|
4107
|
+
case i.Litecoin:
|
|
3620
4108
|
return a.estimateMaxSendableAmount(n);
|
|
3621
|
-
case
|
|
3622
|
-
case
|
|
3623
|
-
case
|
|
3624
|
-
const { estimateMaxSendableAmount:
|
|
3625
|
-
return
|
|
4109
|
+
case i.Binance:
|
|
4110
|
+
case i.THORChain:
|
|
4111
|
+
case i.Cosmos: {
|
|
4112
|
+
const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-cosmos");
|
|
4113
|
+
return s({
|
|
3626
4114
|
...n,
|
|
3627
4115
|
toolbox: a
|
|
3628
4116
|
});
|
|
@@ -3634,99 +4122,99 @@ class zt {
|
|
|
3634
4122
|
/**
|
|
3635
4123
|
* Wallet connection methods
|
|
3636
4124
|
*/
|
|
3637
|
-
|
|
4125
|
+
T(this, "connectXDEFI", async (t) => {
|
|
3638
4126
|
throw new c("core_wallet_xdefi_not_installed");
|
|
3639
4127
|
});
|
|
3640
|
-
|
|
4128
|
+
T(this, "connectEVMWallet", async (t, n) => {
|
|
3641
4129
|
throw new c("core_wallet_evmwallet_not_installed");
|
|
3642
4130
|
});
|
|
3643
|
-
|
|
4131
|
+
T(this, "connectWalletconnect", async (t, n) => {
|
|
3644
4132
|
throw new c("core_wallet_walletconnect_not_installed");
|
|
3645
4133
|
});
|
|
3646
|
-
|
|
4134
|
+
T(this, "connectKeystore", async (t, n) => {
|
|
3647
4135
|
throw new c("core_wallet_keystore_not_installed");
|
|
3648
4136
|
});
|
|
3649
|
-
|
|
4137
|
+
T(this, "connectLedger", async (t, n) => {
|
|
3650
4138
|
throw new c("core_wallet_ledger_not_installed");
|
|
3651
4139
|
});
|
|
3652
|
-
|
|
4140
|
+
T(this, "connectTrezor", async (t, n) => {
|
|
3653
4141
|
throw new c("core_wallet_trezor_not_installed");
|
|
3654
4142
|
});
|
|
3655
|
-
|
|
4143
|
+
T(this, "connectKeplr", async (t) => {
|
|
3656
4144
|
throw new c("core_wallet_keplr_not_installed");
|
|
3657
4145
|
});
|
|
3658
|
-
|
|
4146
|
+
T(this, "connectOkx", async (t) => {
|
|
3659
4147
|
throw new c("core_wallet_okx_not_installed");
|
|
3660
4148
|
});
|
|
3661
|
-
|
|
4149
|
+
T(this, "disconnectChain", (t) => {
|
|
3662
4150
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
3663
4151
|
});
|
|
3664
|
-
|
|
3665
|
-
if (t ===
|
|
4152
|
+
P(this, V, async (t) => {
|
|
4153
|
+
if (t === i.THORChain)
|
|
3666
4154
|
return {
|
|
3667
4155
|
gas_rate: "0",
|
|
3668
4156
|
router: "0",
|
|
3669
4157
|
address: "",
|
|
3670
4158
|
halted: !1,
|
|
3671
|
-
chain:
|
|
4159
|
+
chain: i.THORChain
|
|
3672
4160
|
};
|
|
3673
|
-
const a = (await
|
|
4161
|
+
const a = (await mn(this.stagenet)).find((s) => s.chain === t);
|
|
3674
4162
|
if (!a)
|
|
3675
4163
|
throw new c("core_inbound_data_not_found");
|
|
3676
4164
|
if (a != null && a.halted)
|
|
3677
4165
|
throw new c("core_chain_halted");
|
|
3678
4166
|
return a;
|
|
3679
4167
|
});
|
|
3680
|
-
|
|
4168
|
+
P(this, se, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
3681
4169
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
3682
4170
|
});
|
|
3683
|
-
|
|
3684
|
-
assetValue:
|
|
3685
|
-
type:
|
|
3686
|
-
contractAddress:
|
|
4171
|
+
P(this, X, async ({
|
|
4172
|
+
assetValue: t,
|
|
4173
|
+
type: n = "checkOnly",
|
|
4174
|
+
contractAddress: a
|
|
3687
4175
|
}) => {
|
|
3688
|
-
const
|
|
3689
|
-
if (
|
|
4176
|
+
const { address: s, chain: r, isGasAsset: o, isSynthetic: p } = t, d = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(r);
|
|
4177
|
+
if (d && o || !d || p)
|
|
3690
4178
|
return !0;
|
|
3691
|
-
const u = this.connectedWallets[
|
|
3692
|
-
if (!
|
|
4179
|
+
const u = this.connectedWallets[r], m = n === "checkOnly" ? u == null ? void 0 : u.isApproved : u == null ? void 0 : u.approve;
|
|
4180
|
+
if (!m)
|
|
3693
4181
|
throw new c("core_wallet_connection_not_found");
|
|
3694
|
-
const
|
|
3695
|
-
if (!
|
|
4182
|
+
const _ = this.getAddress(r);
|
|
4183
|
+
if (!s || !_)
|
|
3696
4184
|
throw new c("core_approve_asset_address_or_from_not_found");
|
|
3697
|
-
const
|
|
3698
|
-
return
|
|
3699
|
-
amount: t,
|
|
3700
|
-
assetAddress:
|
|
3701
|
-
from:
|
|
3702
|
-
spenderAddress:
|
|
4185
|
+
const w = a || (await f(this, V).call(this, r)).router;
|
|
4186
|
+
return m({
|
|
4187
|
+
amount: t.getBaseValue("bigint"),
|
|
4188
|
+
assetAddress: s,
|
|
4189
|
+
from: _,
|
|
4190
|
+
spenderAddress: w
|
|
3703
4191
|
});
|
|
3704
4192
|
});
|
|
3705
|
-
|
|
4193
|
+
P(this, v, async ({
|
|
3706
4194
|
assetValue: t,
|
|
3707
4195
|
memo: n,
|
|
3708
|
-
feeOptionKey: a =
|
|
4196
|
+
feeOptionKey: a = F.Fast
|
|
3709
4197
|
}) => {
|
|
3710
4198
|
const {
|
|
3711
|
-
gas_rate:
|
|
4199
|
+
gas_rate: s,
|
|
3712
4200
|
router: r,
|
|
3713
|
-
address:
|
|
3714
|
-
} = await
|
|
4201
|
+
address: o
|
|
4202
|
+
} = await f(this, V).call(this, t.chain), p = (parseInt(s) || 0) * wt[a];
|
|
3715
4203
|
return this.deposit({
|
|
3716
4204
|
assetValue: t,
|
|
3717
|
-
recipient:
|
|
4205
|
+
recipient: o,
|
|
3718
4206
|
memo: n,
|
|
3719
4207
|
router: r,
|
|
3720
|
-
feeRate:
|
|
4208
|
+
feeRate: p
|
|
3721
4209
|
});
|
|
3722
4210
|
});
|
|
3723
|
-
|
|
3724
|
-
const a = await
|
|
4211
|
+
P(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
4212
|
+
const a = await Tn(this.stagenet);
|
|
3725
4213
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
3726
4214
|
throw new c("core_chain_halted");
|
|
3727
4215
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
3728
4216
|
});
|
|
3729
|
-
|
|
4217
|
+
P(this, J, ({ assetValue: t, ...n }) => ({
|
|
3730
4218
|
...n,
|
|
3731
4219
|
memo: n.memo || "",
|
|
3732
4220
|
from: this.getAddress(t.chain),
|
|
@@ -3735,65 +4223,67 @@ class zt {
|
|
|
3735
4223
|
this.stagenet = !!t;
|
|
3736
4224
|
}
|
|
3737
4225
|
}
|
|
3738
|
-
|
|
4226
|
+
V = new WeakMap(), se = new WeakMap(), X = new WeakMap(), v = new WeakMap(), Y = new WeakMap(), J = new WeakMap();
|
|
3739
4227
|
export {
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
4228
|
+
Ze as AGG_SWAP,
|
|
4229
|
+
bn as ApiError,
|
|
4230
|
+
j as ApiUrl,
|
|
4231
|
+
N as AssetValue,
|
|
4232
|
+
b as BaseDecimal,
|
|
4233
|
+
He as BigIntArithmetics,
|
|
4234
|
+
i as Chain,
|
|
4235
|
+
_e as ChainId,
|
|
4236
|
+
On as ChainIdToChain,
|
|
4237
|
+
pt as ChainToChainId,
|
|
4238
|
+
Me as ChainToExplorerUrl,
|
|
4239
|
+
gn as ChainToHexChainId,
|
|
4240
|
+
dt as ChainToRPC,
|
|
4241
|
+
st as ContractAddress,
|
|
4242
|
+
En as CosmosChainList,
|
|
4243
|
+
it as DerivationPath,
|
|
4244
|
+
y as ERROR_CODE,
|
|
4245
|
+
nt as ERROR_MODULE,
|
|
4246
|
+
Ie as ERROR_TYPE,
|
|
4247
|
+
rt as EVMChainList,
|
|
4248
|
+
ut as ErrorCode,
|
|
4249
|
+
F as FeeOption,
|
|
4250
|
+
h as MemoType,
|
|
4251
|
+
wn as NetworkDerivationPath,
|
|
4252
|
+
ze as QuoteMode,
|
|
4253
|
+
Ce as RPCUrl,
|
|
4254
|
+
we as RequestClient,
|
|
4255
|
+
et as SWAP_IN,
|
|
4256
|
+
tt as SWAP_OUT,
|
|
4257
|
+
Ln as SwapKitCore,
|
|
3769
4258
|
c as SwapKitError,
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
4259
|
+
x as SwapKitNumber,
|
|
4260
|
+
Je as TCAvalancheDepositABI,
|
|
4261
|
+
Qe as TCBscDepositABI,
|
|
4262
|
+
Ye as TCEthereumVaultAbi,
|
|
4263
|
+
Rn as TCSupportedChainList,
|
|
4264
|
+
An as UTXOChainList,
|
|
4265
|
+
lt as WalletOption,
|
|
4266
|
+
Sn as assetFromString,
|
|
4267
|
+
Bn as derivationPathToString,
|
|
4268
|
+
fn as erc20ABI,
|
|
4269
|
+
In as filterAssets,
|
|
4270
|
+
re as formatBigIntToSafeValue,
|
|
4271
|
+
wt as gasFeeMultiplier,
|
|
4272
|
+
Et as getAssetType,
|
|
4273
|
+
St as getAsymmetricAssetShare,
|
|
4274
|
+
Cn as getAsymmetricAssetWithdrawAmount,
|
|
4275
|
+
Ot as getAsymmetricRuneShare,
|
|
4276
|
+
vn as getAsymmetricRuneWithdrawAmount,
|
|
4277
|
+
At as getCommonAssetInfo,
|
|
4278
|
+
bt as getDecimal,
|
|
4279
|
+
Nn as getEstimatedPoolShare,
|
|
4280
|
+
xn as getLiquiditySlippage,
|
|
4281
|
+
M as getMemoFor,
|
|
4282
|
+
le as getMinAmountByChain,
|
|
4283
|
+
It as getSymmetricPoolShare,
|
|
4284
|
+
Mn as getSymmetricWithdraw,
|
|
4285
|
+
Dn as getTHORNameCost,
|
|
4286
|
+
xe as isGasAsset,
|
|
4287
|
+
Pn as validateTHORName
|
|
3799
4288
|
};
|
|
4289
|
+
//# sourceMappingURL=index.es.js.map
|