@swapkit/core 1.0.0-rc.6 → 1.0.0-rc.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +9 -4
- package/dist/index.es.js +1328 -858
- package/package.json +18 -18
- package/src/client/__tests__/helpers.test.ts +35 -11
- package/src/client/explorerUrls.ts +1 -1
- package/src/client/index.ts +117 -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 T = (e, t, n) => (
|
|
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, Ye = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Ye(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
+
const bn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -108,7 +108,7 @@ const Lt = [
|
|
|
108
108
|
stateMutability: "nonpayable",
|
|
109
109
|
type: "function"
|
|
110
110
|
}
|
|
111
|
-
],
|
|
111
|
+
], Xe = [
|
|
112
112
|
{
|
|
113
113
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
114
114
|
stateMutability: "nonpayable",
|
|
@@ -283,7 +283,7 @@ const Lt = [
|
|
|
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 Lt = [
|
|
|
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 Lt = [
|
|
|
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 He = [
|
|
|
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 ve = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e))(ve || {}), 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_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_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_0_100]: "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_PROFVIDER_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
|
+
}, re = (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
|
-
let
|
|
685
|
+
let wn = class Ce 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: u } = {
|
|
694
694
|
shouldLog: !0,
|
|
695
695
|
shouldThrow: !0,
|
|
696
696
|
shouldTrace: !0
|
|
697
697
|
},
|
|
698
|
-
displayMessageParams:
|
|
698
|
+
displayMessageParams: l
|
|
699
699
|
}) {
|
|
700
|
-
const
|
|
701
|
-
super(
|
|
702
|
-
shouldLog:
|
|
703
|
-
shouldTrace:
|
|
704
|
-
shouldThrow:
|
|
705
|
-
}, this.displayMessageParams =
|
|
700
|
+
const m = r || re(s, l || []) || "";
|
|
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 = re(s, l || []), this.code = s, this.type = o || ve.UNHANDLED_ERROR, this.options = {
|
|
702
|
+
shouldLog: p || !0,
|
|
703
|
+
shouldTrace: u || !0,
|
|
704
|
+
shouldThrow: d || !1
|
|
705
|
+
}, this.displayMessageParams = l || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new Ce(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -714,7 +714,7 @@ let Ut = class we 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 re(this.code, this.displayMessageParams || []);
|
|
718
718
|
}
|
|
719
719
|
handle() {
|
|
720
720
|
const t = `[${this.identifier}]: ${this.message}`;
|
|
@@ -724,8 +724,8 @@ let Ut = class we extends Error {
|
|
|
724
724
|
return this.toErrorInfo();
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
|
-
var
|
|
728
|
-
const
|
|
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 An = {
|
|
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 Ht = {
|
|
|
742
742
|
OP: [44, 60, 0, 0, 0],
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
|
-
var
|
|
746
|
-
const
|
|
745
|
+
var w = /* @__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))(w || {});
|
|
746
|
+
const rt = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,38 +751,50 @@ const $t = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], En = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], Rn = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
|
+
], gn = [
|
|
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 fe = /* @__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))(fe || {}), Me = /* @__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))(Me || {}), q = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(q || {});
|
|
779
|
+
const ae = Object.values(i), ot = Object.keys(i), be = ae.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 = ae.reduce(
|
|
786
|
+
(e, t) => (e[t] = fe[be[t]], e),
|
|
775
787
|
{}
|
|
776
|
-
),
|
|
777
|
-
(e, t) => (e[t] =
|
|
788
|
+
), dt = ae.reduce(
|
|
789
|
+
(e, t) => (e[t] = Me[be[t]], e),
|
|
778
790
|
{}
|
|
779
|
-
),
|
|
791
|
+
), On = ae.reduce(
|
|
780
792
|
(e, t) => {
|
|
781
|
-
const n = `${
|
|
782
|
-
return e[t] =
|
|
793
|
+
const n = `${be[t]}Hex`;
|
|
794
|
+
return e[t] = fe[n], e;
|
|
783
795
|
},
|
|
784
796
|
{}
|
|
785
|
-
),
|
|
797
|
+
), Sn = {
|
|
786
798
|
"0xa4b1": "ARB",
|
|
787
799
|
42161: "ARB",
|
|
788
800
|
"0xa86a": "AVAX",
|
|
@@ -807,7 +819,7 @@ const te = Object.values(s), Ke = Object.keys(s), me = te.reduce(
|
|
|
807
819
|
"thorchain-stagenet-v2": "THOR",
|
|
808
820
|
"thorchain-mainnet-v1": "THOR"
|
|
809
821
|
/* THORChain */
|
|
810
|
-
},
|
|
822
|
+
}, Ne = {
|
|
811
823
|
ARB: "https://arbiscan.io",
|
|
812
824
|
AVAX: "https://snowtrace.io",
|
|
813
825
|
BSC: "https://bscscan.com",
|
|
@@ -822,308 +834,669 @@ const te = Object.values(s), Ke = Object.keys(s), me = te.reduce(
|
|
|
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.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
|
-
}, R = (e, t, n) => (
|
|
835
|
-
const
|
|
836
|
-
if (e < 0)
|
|
837
|
-
throw new Error("Invalid number of year");
|
|
838
|
-
return 10 + e;
|
|
839
|
-
}, Kt = (e) => {
|
|
840
|
-
if (e.length > 30)
|
|
841
|
-
return !1;
|
|
842
|
-
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
843
|
-
return !!e.match(t);
|
|
844
|
-
}, Yt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`, Oe = async (e, t) => {
|
|
845
|
-
const n = Object.entries(t || {}).reduce(
|
|
846
|
-
(a, [i, r]) => (r && (a[i] = r), a),
|
|
847
|
-
{}
|
|
848
|
-
);
|
|
849
|
-
return (await fetch(
|
|
850
|
-
`${e}${t ? `?${new URLSearchParams(n).toString()}` : ""}`,
|
|
851
|
-
{ method: "GET", mode: "cors", credentials: "omit", referrer: "https://sk.thorswap.net" }
|
|
852
|
-
)).json();
|
|
853
|
-
}, et = async (e, t, n, a = !1) => {
|
|
854
|
-
const i = await fetch(`${e}`, {
|
|
855
|
-
body: t,
|
|
856
|
-
headers: n,
|
|
857
|
-
method: "POST",
|
|
858
|
-
referrer: "https://sk.thorswap.net"
|
|
859
|
-
});
|
|
860
|
-
return a ? i.text() : i.json();
|
|
861
|
-
}, tt = "0x313ce567", Ie = async ({ chain: e, to: t }) => {
|
|
846
|
+
}, R = (e, t, n) => (mt(e, t, "access private method"), n);
|
|
847
|
+
const Tt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
862
848
|
try {
|
|
863
|
-
const n = await
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
849
|
+
const { result: n } = await Ae.post(dt[e], {
|
|
850
|
+
headers: {
|
|
851
|
+
accept: "*/*",
|
|
852
|
+
"content-type": "application/json",
|
|
853
|
+
"cache-control": "no-cache"
|
|
854
|
+
},
|
|
855
|
+
body: JSON.stringify({
|
|
868
856
|
id: 44,
|
|
869
|
-
jsonrpc: "2.0"
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
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());
|
|
875
863
|
} catch (n) {
|
|
876
|
-
return console.error(n),
|
|
864
|
+
return console.error(n), w[e];
|
|
877
865
|
}
|
|
878
|
-
},
|
|
879
|
-
if (e ===
|
|
880
|
-
return
|
|
866
|
+
}, ht = async (e) => {
|
|
867
|
+
if (e === i.Ethereum)
|
|
868
|
+
return w.ETH;
|
|
881
869
|
const [, t] = e.split("-");
|
|
882
|
-
return t != null && t.startsWith("0x") ?
|
|
883
|
-
},
|
|
870
|
+
return t != null && t.startsWith("0x") ? xe({ chain: i.Ethereum, to: t }) : w.ETH;
|
|
871
|
+
}, _t = async (e) => {
|
|
884
872
|
const [, t] = e.split("-");
|
|
885
|
-
return t != null && t.startsWith("0x") ?
|
|
886
|
-
},
|
|
873
|
+
return t != null && t.startsWith("0x") ? xe({ chain: i.Avalanche, to: t.toLowerCase() }) : w.AVAX;
|
|
874
|
+
}, ft = async (e) => (e === i.BinanceSmartChain, w.BSC), bt = async ({ chain: e, symbol: t }) => {
|
|
887
875
|
switch (e) {
|
|
888
|
-
case
|
|
889
|
-
return
|
|
890
|
-
case
|
|
891
|
-
return
|
|
892
|
-
case
|
|
893
|
-
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);
|
|
894
882
|
default:
|
|
895
|
-
return
|
|
883
|
+
return w[e];
|
|
896
884
|
}
|
|
897
|
-
},
|
|
885
|
+
}, wt = {
|
|
898
886
|
[F.Average]: 1.2,
|
|
899
887
|
[F.Fast]: 1.5,
|
|
900
888
|
[F.Fastest]: 2
|
|
901
|
-
},
|
|
889
|
+
}, De = ({ chain: e, symbol: t }) => {
|
|
902
890
|
switch (e) {
|
|
903
|
-
case
|
|
904
|
-
case
|
|
905
|
-
case
|
|
906
|
-
case
|
|
907
|
-
case
|
|
908
|
-
case
|
|
909
|
-
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:
|
|
910
898
|
return t === e;
|
|
911
|
-
case
|
|
912
|
-
case
|
|
899
|
+
case i.Arbitrum:
|
|
900
|
+
case i.Optimism:
|
|
913
901
|
return t === "ETH";
|
|
914
|
-
case
|
|
902
|
+
case i.Maya:
|
|
915
903
|
return t === "CACAO";
|
|
916
|
-
case
|
|
904
|
+
case i.Kujira:
|
|
917
905
|
return t === "KUJI";
|
|
918
|
-
case
|
|
906
|
+
case i.Cosmos:
|
|
919
907
|
return t === "ATOM";
|
|
920
|
-
case
|
|
908
|
+
case i.Polygon:
|
|
921
909
|
return t === "MATIC";
|
|
922
|
-
case
|
|
910
|
+
case i.BinanceSmartChain:
|
|
923
911
|
return t === "BNB";
|
|
924
|
-
case
|
|
912
|
+
case i.THORChain:
|
|
925
913
|
return t === "RUNE";
|
|
926
914
|
}
|
|
927
|
-
},
|
|
915
|
+
}, At = (e) => {
|
|
928
916
|
switch (e) {
|
|
929
917
|
case "ETH.THOR":
|
|
930
918
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
931
919
|
case "ETH.vTHOR":
|
|
932
920
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
933
|
-
case
|
|
934
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
935
|
-
case
|
|
936
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
937
|
-
case
|
|
938
|
-
return { identifier: "BSC.BNB", decimal:
|
|
939
|
-
case
|
|
940
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
921
|
+
case i.Cosmos:
|
|
922
|
+
return { identifier: "GAIA.ATOM", decimal: w[e] };
|
|
923
|
+
case i.THORChain:
|
|
924
|
+
return { identifier: "THOR.RUNE", decimal: w[e] };
|
|
925
|
+
case i.BinanceSmartChain:
|
|
926
|
+
return { identifier: "BSC.BNB", decimal: w[e] };
|
|
927
|
+
case i.Maya:
|
|
928
|
+
return { identifier: "MAYA.CACAO", decimal: w.MAYA };
|
|
941
929
|
case "MAYA.MAYA":
|
|
942
930
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
943
|
-
case
|
|
944
|
-
case
|
|
945
|
-
case
|
|
946
|
-
case
|
|
947
|
-
case
|
|
948
|
-
case
|
|
949
|
-
case
|
|
950
|
-
case
|
|
951
|
-
case
|
|
952
|
-
case
|
|
953
|
-
case
|
|
954
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
955
|
-
}
|
|
956
|
-
},
|
|
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: w[e] };
|
|
943
|
+
}
|
|
944
|
+
}, Et = ({ chain: e, symbol: t }) => {
|
|
957
945
|
if (t.includes("/"))
|
|
958
946
|
return "Synth";
|
|
959
947
|
switch (e) {
|
|
960
|
-
case
|
|
961
|
-
case
|
|
962
|
-
case
|
|
963
|
-
case
|
|
964
|
-
case
|
|
965
|
-
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:
|
|
966
954
|
return "Native";
|
|
967
|
-
case
|
|
968
|
-
return t === "ATOM" ? "Native" :
|
|
969
|
-
case
|
|
970
|
-
return t ===
|
|
971
|
-
case
|
|
972
|
-
return t ===
|
|
973
|
-
case
|
|
974
|
-
return t ===
|
|
975
|
-
case
|
|
976
|
-
return t ===
|
|
977
|
-
case
|
|
978
|
-
return t ===
|
|
979
|
-
case
|
|
980
|
-
return t ===
|
|
981
|
-
case
|
|
982
|
-
return [
|
|
983
|
-
case
|
|
984
|
-
return [
|
|
985
|
-
}
|
|
986
|
-
},
|
|
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
|
+
}, In = (e) => {
|
|
987
975
|
var t;
|
|
988
|
-
const [n, ...a] = e.split("."),
|
|
989
|
-
return { chain: n, symbol: r, ticker:
|
|
990
|
-
},
|
|
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 De({ chain: t, symbol: n }) || !!a;
|
|
987
|
+
}, vn = (e) => e.filter((t) => {
|
|
988
|
+
const n = `${t.chain}.${t.symbol}`;
|
|
989
|
+
return !Rt.test(n) && gt(n) && t.value !== "0";
|
|
990
|
+
}), Ot = ({
|
|
991
991
|
liquidityUnits: e,
|
|
992
992
|
poolUnits: t,
|
|
993
993
|
runeDepth: n
|
|
994
994
|
}) => {
|
|
995
|
-
const a =
|
|
996
|
-
return
|
|
997
|
-
},
|
|
995
|
+
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), u = a.mul(a), l = s.mul(s).mul(s);
|
|
996
|
+
return o.mul(p.sub(d).add(u)).div(l);
|
|
997
|
+
}, St = ({
|
|
998
998
|
liquidityUnits: e,
|
|
999
999
|
poolUnits: t,
|
|
1000
1000
|
assetDepth: n
|
|
1001
1001
|
}) => {
|
|
1002
|
-
const a =
|
|
1003
|
-
return
|
|
1004
|
-
},
|
|
1002
|
+
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), u = a.mul(a), l = o.mul(p.sub(d).add(u)), m = s.mul(s).mul(s);
|
|
1003
|
+
return l.div(m);
|
|
1004
|
+
}, Cn = ({
|
|
1005
1005
|
percent: e,
|
|
1006
1006
|
runeDepth: t,
|
|
1007
1007
|
liquidityUnits: n,
|
|
1008
1008
|
poolUnits: a
|
|
1009
|
-
}) =>
|
|
1009
|
+
}) => Ot({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), Mn = ({
|
|
1010
1010
|
percent: e,
|
|
1011
1011
|
assetDepth: t,
|
|
1012
1012
|
liquidityUnits: n,
|
|
1013
1013
|
poolUnits: a
|
|
1014
|
-
}) =>
|
|
1014
|
+
}) => St({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), g = (e) => x.fromBigInt(BigInt(e), w.THOR), It = ({
|
|
1015
1015
|
liquidityUnits: e,
|
|
1016
1016
|
poolUnits: t,
|
|
1017
1017
|
runeDepth: n,
|
|
1018
1018
|
assetDepth: a
|
|
1019
1019
|
}) => ({
|
|
1020
|
-
assetAmount:
|
|
1021
|
-
runeAmount:
|
|
1022
|
-
}),
|
|
1020
|
+
assetAmount: g(a).mul(e).div(t),
|
|
1021
|
+
runeAmount: g(n).mul(e).div(t)
|
|
1022
|
+
}), Nn = ({
|
|
1023
1023
|
liquidityUnits: e,
|
|
1024
1024
|
poolUnits: t,
|
|
1025
1025
|
runeDepth: n,
|
|
1026
1026
|
assetDepth: a,
|
|
1027
|
-
percent:
|
|
1027
|
+
percent: s
|
|
1028
1028
|
}) => Object.fromEntries(
|
|
1029
|
-
Object.entries(
|
|
1030
|
-
([r,
|
|
1029
|
+
Object.entries(It({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1030
|
+
([r, o]) => [r, o.mul(s)]
|
|
1031
1031
|
)
|
|
1032
|
-
),
|
|
1032
|
+
), xn = ({
|
|
1033
1033
|
runeDepth: e,
|
|
1034
1034
|
poolUnits: t,
|
|
1035
1035
|
assetDepth: n,
|
|
1036
1036
|
liquidityUnits: a,
|
|
1037
|
-
runeAmount:
|
|
1037
|
+
runeAmount: s,
|
|
1038
1038
|
assetAmount: r
|
|
1039
1039
|
}) => {
|
|
1040
|
-
const
|
|
1041
|
-
if (S.
|
|
1042
|
-
return
|
|
1043
|
-
const
|
|
1044
|
-
return
|
|
1045
|
-
},
|
|
1040
|
+
const o = new x({ value: e, decimal: 8 }), p = new x({ value: n, decimal: 8 }), d = new x({ value: t, decimal: 8 }), u = new x({ value: s, decimal: 8 }), l = new x({ value: r, decimal: 8 }), m = u.mul(p), _ = l.mul(o), b = u.mul(l), A = o.mul(p), E = d.mul(m.add(_.add(b.mul(2)))), O = m.add(_.add(A.mul(2))), S = E.div(O), D = g(a).add(S);
|
|
1041
|
+
if (S.getBaseValue("number") === 0)
|
|
1042
|
+
return D.div(d).getBaseValue("number");
|
|
1043
|
+
const ie = d.add(D);
|
|
1044
|
+
return D.div(ie).getBaseValue("number");
|
|
1045
|
+
}, Dn = ({
|
|
1046
1046
|
runeAmount: e,
|
|
1047
1047
|
assetAmount: t,
|
|
1048
1048
|
runeDepth: n,
|
|
1049
1049
|
assetDepth: a
|
|
1050
1050
|
}) => {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1051
|
+
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1052
|
+
return 0;
|
|
1053
|
+
const s = g(n), r = g(a), o = g(t), p = g(e), d = o.mul(s).sub(r.mul(p)), u = r.mul(p).add(s.mul(r));
|
|
1054
|
+
return Math.abs(d.div(u).getBaseValue("number"));
|
|
1055
|
+
}, vt = ({
|
|
1054
1056
|
symbol: e,
|
|
1055
1057
|
ticker: t,
|
|
1056
1058
|
chain: n
|
|
1057
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e,
|
|
1059
|
+
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, M = (e, t) => {
|
|
1058
1060
|
switch (e) {
|
|
1059
|
-
case
|
|
1060
|
-
case
|
|
1061
|
+
case h.LEAVE:
|
|
1062
|
+
case h.BOND: {
|
|
1061
1063
|
const { address: n } = t;
|
|
1062
1064
|
return `${e}:${n}`;
|
|
1063
1065
|
}
|
|
1064
|
-
case
|
|
1066
|
+
case h.UNBOND: {
|
|
1065
1067
|
const { address: n, unbondAmount: a } = t;
|
|
1066
1068
|
return `${e}:${n}:${a * 10 ** 8}`;
|
|
1067
1069
|
}
|
|
1068
|
-
case
|
|
1069
|
-
const { name: n, chain: a, address:
|
|
1070
|
-
return `${e}:${n}:${a}:${
|
|
1070
|
+
case h.THORNAME_REGISTER: {
|
|
1071
|
+
const { name: n, chain: a, address: s, owner: r } = t;
|
|
1072
|
+
return `${e}:${n}:${a}:${s}${r ? `:${r}` : ""}`;
|
|
1071
1073
|
}
|
|
1072
|
-
case
|
|
1073
|
-
const { chain: n, symbol: a, address:
|
|
1074
|
-
return r ? `${e}:${n}/${a}::t:0` : `${e}:${
|
|
1074
|
+
case h.DEPOSIT: {
|
|
1075
|
+
const { chain: n, symbol: a, address: s, singleSide: r } = t;
|
|
1076
|
+
return r ? `${e}:${n}/${a}::t:0` : `${e}:${((o, p) => {
|
|
1077
|
+
switch (o) {
|
|
1078
|
+
case i.Litecoin:
|
|
1079
|
+
return "l";
|
|
1080
|
+
case i.Dogecoin:
|
|
1081
|
+
return "d";
|
|
1082
|
+
case i.BitcoinCash:
|
|
1083
|
+
return "c";
|
|
1084
|
+
default:
|
|
1085
|
+
return `${o}.${p}`;
|
|
1086
|
+
}
|
|
1087
|
+
})(n, a)}:${s || ""}:t:0`;
|
|
1075
1088
|
}
|
|
1076
|
-
case
|
|
1077
|
-
const { chain: n, ticker: a, symbol:
|
|
1078
|
-
return `${e}:${n}${
|
|
1089
|
+
case h.WITHDRAW: {
|
|
1090
|
+
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", u = vt({ chain: n, symbol: s, ticker: a });
|
|
1091
|
+
return `${e}:${n}${p ? "/" : "."}${u}:${r}${d}`;
|
|
1079
1092
|
}
|
|
1080
|
-
case
|
|
1081
|
-
case
|
|
1093
|
+
case h.OPEN_LOAN:
|
|
1094
|
+
case h.CLOSE_LOAN: {
|
|
1082
1095
|
const { asset: n, address: a } = t;
|
|
1083
1096
|
return `${e}:${n}:${a}`;
|
|
1084
1097
|
}
|
|
1085
1098
|
default:
|
|
1086
1099
|
return "";
|
|
1087
1100
|
}
|
|
1088
|
-
},
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
}) => {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
""
|
|
1102
|
-
|
|
1103
|
-
|
|
1101
|
+
}, Pn = (e) => {
|
|
1102
|
+
if (e < 0)
|
|
1103
|
+
throw new Error("Invalid number of year");
|
|
1104
|
+
return 10 + e;
|
|
1105
|
+
}, Bn = (e) => {
|
|
1106
|
+
if (e.length > 30)
|
|
1107
|
+
return !1;
|
|
1108
|
+
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1109
|
+
return !!e.match(t);
|
|
1110
|
+
}, Ln = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1111
|
+
class Ee extends Error {
|
|
1112
|
+
constructor(t, n, a) {
|
|
1113
|
+
const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
|
|
1114
|
+
super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
|
|
1115
|
+
enumerable: !0,
|
|
1116
|
+
configurable: !0,
|
|
1117
|
+
writable: !0,
|
|
1118
|
+
value: void 0
|
|
1119
|
+
}), Object.defineProperty(this, "request", {
|
|
1120
|
+
enumerable: !0,
|
|
1121
|
+
configurable: !0,
|
|
1122
|
+
writable: !0,
|
|
1123
|
+
value: void 0
|
|
1124
|
+
}), Object.defineProperty(this, "options", {
|
|
1125
|
+
enumerable: !0,
|
|
1126
|
+
configurable: !0,
|
|
1127
|
+
writable: !0,
|
|
1128
|
+
value: void 0
|
|
1129
|
+
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
class Pe extends Error {
|
|
1133
|
+
constructor(t) {
|
|
1134
|
+
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
1135
|
+
enumerable: !0,
|
|
1136
|
+
configurable: !0,
|
|
1137
|
+
writable: !0,
|
|
1138
|
+
value: void 0
|
|
1139
|
+
}), this.name = "TimeoutError", this.request = t;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
1143
|
+
for (const t of e)
|
|
1144
|
+
if ((!J(t) || Array.isArray(t)) && t !== void 0)
|
|
1145
|
+
throw new TypeError("The `options` argument must be an object");
|
|
1146
|
+
return we({}, ...e);
|
|
1147
|
+
}, Be = (e = {}, t = {}) => {
|
|
1148
|
+
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
|
|
1149
|
+
for (const [r, o] of s.entries())
|
|
1150
|
+
a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
|
|
1151
|
+
return n;
|
|
1152
|
+
}, we = (...e) => {
|
|
1153
|
+
let t = {}, n = {};
|
|
1154
|
+
for (const a of e)
|
|
1155
|
+
if (Array.isArray(a))
|
|
1156
|
+
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
1157
|
+
else if (J(a)) {
|
|
1158
|
+
for (let [s, r] of Object.entries(a))
|
|
1159
|
+
J(r) && s in t && (r = we(t[s], r)), t = { ...t, [s]: r };
|
|
1160
|
+
J(a.headers) && (n = Be(n, a.headers), t.headers = n);
|
|
1161
|
+
}
|
|
1162
|
+
return t;
|
|
1163
|
+
}, Ct = (() => {
|
|
1164
|
+
let e = !1, t = !1;
|
|
1165
|
+
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
1166
|
+
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
1167
|
+
body: new globalThis.ReadableStream(),
|
|
1168
|
+
method: "POST",
|
|
1169
|
+
// @ts-expect-error - Types are outdated.
|
|
1170
|
+
get duplex() {
|
|
1171
|
+
return e = !0, "half";
|
|
1172
|
+
}
|
|
1173
|
+
}).headers.has("Content-Type")), e && !t;
|
|
1174
|
+
})(), Mt = typeof globalThis.AbortController == "function", Nt = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", Le = ["get", "post", "put", "patch", "head", "delete"], Dt = {
|
|
1175
|
+
json: "application/json",
|
|
1176
|
+
text: "text/*",
|
|
1177
|
+
formData: "multipart/form-data",
|
|
1178
|
+
arrayBuffer: "*/*",
|
|
1179
|
+
blob: "*/*"
|
|
1180
|
+
}, oe = 2147483647, Ve = Symbol("stop"), Pt = {
|
|
1181
|
+
json: !0,
|
|
1182
|
+
parseJson: !0,
|
|
1183
|
+
searchParams: !0,
|
|
1184
|
+
prefixUrl: !0,
|
|
1185
|
+
retry: !0,
|
|
1186
|
+
timeout: !0,
|
|
1187
|
+
hooks: !0,
|
|
1188
|
+
throwHttpErrors: !0,
|
|
1189
|
+
onDownloadProgress: !0,
|
|
1190
|
+
fetch: !0
|
|
1191
|
+
}, Bt = {
|
|
1192
|
+
method: !0,
|
|
1193
|
+
headers: !0,
|
|
1194
|
+
body: !0,
|
|
1195
|
+
mode: !0,
|
|
1196
|
+
credentials: !0,
|
|
1197
|
+
cache: !0,
|
|
1198
|
+
redirect: !0,
|
|
1199
|
+
referrer: !0,
|
|
1200
|
+
referrerPolicy: !0,
|
|
1201
|
+
integrity: !0,
|
|
1202
|
+
keepalive: !0,
|
|
1203
|
+
signal: !0,
|
|
1204
|
+
window: !0,
|
|
1205
|
+
dispatcher: !0,
|
|
1206
|
+
duplex: !0
|
|
1207
|
+
}, Lt = (e) => Le.includes(e) ? e.toUpperCase() : e, Vt = ["get", "put", "head", "delete", "options", "trace"], Ut = [408, 413, 429, 500, 502, 503, 504], Ue = [413, 429, 503], Re = {
|
|
1208
|
+
limit: 2,
|
|
1209
|
+
methods: Vt,
|
|
1210
|
+
statusCodes: Ut,
|
|
1211
|
+
afterStatusCodes: Ue,
|
|
1212
|
+
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1213
|
+
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1214
|
+
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1215
|
+
}, $t = (e = {}) => {
|
|
1216
|
+
if (typeof e == "number")
|
|
1217
|
+
return {
|
|
1218
|
+
...Re,
|
|
1219
|
+
limit: e
|
|
1220
|
+
};
|
|
1221
|
+
if (e.methods && !Array.isArray(e.methods))
|
|
1222
|
+
throw new Error("retry.methods must be an array");
|
|
1223
|
+
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
1224
|
+
throw new Error("retry.statusCodes must be an array");
|
|
1225
|
+
return {
|
|
1226
|
+
...Re,
|
|
1227
|
+
...e,
|
|
1228
|
+
afterStatusCodes: Ue
|
|
1229
|
+
};
|
|
1230
|
+
};
|
|
1231
|
+
async function Ht(e, t, n, a) {
|
|
1232
|
+
return new Promise((s, r) => {
|
|
1233
|
+
const o = setTimeout(() => {
|
|
1234
|
+
n && n.abort(), r(new Pe(e));
|
|
1235
|
+
}, a.timeout);
|
|
1236
|
+
a.fetch(e, t).then(s).catch(r).then(() => {
|
|
1237
|
+
clearTimeout(o);
|
|
1238
|
+
});
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
async function kt(e, { signal: t }) {
|
|
1242
|
+
return new Promise((n, a) => {
|
|
1243
|
+
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
|
|
1244
|
+
function s() {
|
|
1245
|
+
clearTimeout(r), a(t.reason);
|
|
1246
|
+
}
|
|
1247
|
+
const r = setTimeout(() => {
|
|
1248
|
+
t == null || t.removeEventListener("abort", s), n();
|
|
1249
|
+
}, e);
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
const Ft = (e, t) => {
|
|
1253
|
+
const n = {};
|
|
1254
|
+
for (const a in t)
|
|
1255
|
+
!(a in Bt) && !(a in Pt) && !(a in e) && (n[a] = t[a]);
|
|
1256
|
+
return n;
|
|
1257
|
+
};
|
|
1258
|
+
class Z {
|
|
1259
|
+
static create(t, n) {
|
|
1260
|
+
const a = new Z(t, n), s = async () => {
|
|
1261
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > oe)
|
|
1262
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${oe}`);
|
|
1263
|
+
await Promise.resolve();
|
|
1264
|
+
let o = await a._fetch();
|
|
1265
|
+
for (const p of a._options.hooks.afterResponse) {
|
|
1266
|
+
const d = await p(a.request, a._options, a._decorateResponse(o.clone()));
|
|
1267
|
+
d instanceof globalThis.Response && (o = d);
|
|
1268
|
+
}
|
|
1269
|
+
if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
|
|
1270
|
+
let p = new Ee(o, a.request, a._options);
|
|
1271
|
+
for (const d of a._options.hooks.beforeError)
|
|
1272
|
+
p = await d(p);
|
|
1273
|
+
throw p;
|
|
1274
|
+
}
|
|
1275
|
+
if (a._options.onDownloadProgress) {
|
|
1276
|
+
if (typeof a._options.onDownloadProgress != "function")
|
|
1277
|
+
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
1278
|
+
if (!Nt)
|
|
1279
|
+
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
1280
|
+
return a._stream(o.clone(), a._options.onDownloadProgress);
|
|
1281
|
+
}
|
|
1282
|
+
return o;
|
|
1283
|
+
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
|
|
1284
|
+
for (const [o, p] of Object.entries(Dt))
|
|
1285
|
+
r[o] = async () => {
|
|
1286
|
+
a.request.headers.set("accept", a.request.headers.get("accept") || p);
|
|
1287
|
+
const d = (await r).clone();
|
|
1288
|
+
if (o === "json") {
|
|
1289
|
+
if (d.status === 204 || (await d.clone().arrayBuffer()).byteLength === 0)
|
|
1290
|
+
return "";
|
|
1291
|
+
if (n.parseJson)
|
|
1292
|
+
return n.parseJson(await d.text());
|
|
1293
|
+
}
|
|
1294
|
+
return d[o]();
|
|
1295
|
+
};
|
|
1296
|
+
return r;
|
|
1297
|
+
}
|
|
1298
|
+
// eslint-disable-next-line complexity
|
|
1299
|
+
constructor(t, n = {}) {
|
|
1300
|
+
if (Object.defineProperty(this, "request", {
|
|
1301
|
+
enumerable: !0,
|
|
1302
|
+
configurable: !0,
|
|
1303
|
+
writable: !0,
|
|
1304
|
+
value: void 0
|
|
1305
|
+
}), Object.defineProperty(this, "abortController", {
|
|
1306
|
+
enumerable: !0,
|
|
1307
|
+
configurable: !0,
|
|
1308
|
+
writable: !0,
|
|
1309
|
+
value: void 0
|
|
1310
|
+
}), Object.defineProperty(this, "_retryCount", {
|
|
1311
|
+
enumerable: !0,
|
|
1312
|
+
configurable: !0,
|
|
1313
|
+
writable: !0,
|
|
1314
|
+
value: 0
|
|
1315
|
+
}), Object.defineProperty(this, "_input", {
|
|
1316
|
+
enumerable: !0,
|
|
1317
|
+
configurable: !0,
|
|
1318
|
+
writable: !0,
|
|
1319
|
+
value: void 0
|
|
1320
|
+
}), Object.defineProperty(this, "_options", {
|
|
1321
|
+
enumerable: !0,
|
|
1322
|
+
configurable: !0,
|
|
1323
|
+
writable: !0,
|
|
1324
|
+
value: void 0
|
|
1325
|
+
}), this._input = t, this._options = {
|
|
1326
|
+
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
1327
|
+
credentials: this._input.credentials || "same-origin",
|
|
1328
|
+
...n,
|
|
1329
|
+
headers: Be(this._input.headers, n.headers),
|
|
1330
|
+
hooks: we({
|
|
1331
|
+
beforeRequest: [],
|
|
1332
|
+
beforeRetry: [],
|
|
1333
|
+
beforeError: [],
|
|
1334
|
+
afterResponse: []
|
|
1335
|
+
}, n.hooks),
|
|
1336
|
+
method: Lt(n.method ?? this._input.method),
|
|
1337
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1338
|
+
prefixUrl: String(n.prefixUrl || ""),
|
|
1339
|
+
retry: $t(n.retry),
|
|
1340
|
+
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1341
|
+
timeout: n.timeout ?? 1e4,
|
|
1342
|
+
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
1343
|
+
}, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
|
|
1344
|
+
throw new TypeError("`input` must be a string, URL, or Request");
|
|
1345
|
+
if (this._options.prefixUrl && typeof this._input == "string") {
|
|
1346
|
+
if (this._input.startsWith("/"))
|
|
1347
|
+
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1348
|
+
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1349
|
+
}
|
|
1350
|
+
if (Mt) {
|
|
1351
|
+
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1352
|
+
const a = this._options.signal;
|
|
1353
|
+
this._options.signal.addEventListener("abort", () => {
|
|
1354
|
+
this.abortController.abort(a.reason);
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
this._options.signal = this.abortController.signal;
|
|
1358
|
+
}
|
|
1359
|
+
if (Ct && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1360
|
+
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1361
|
+
(xt && 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);
|
|
1362
|
+
}
|
|
1363
|
+
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 }));
|
|
1364
|
+
}
|
|
1365
|
+
_calculateRetryDelay(t) {
|
|
1366
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof Pe)) {
|
|
1367
|
+
if (t instanceof Ee) {
|
|
1368
|
+
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1369
|
+
return 0;
|
|
1370
|
+
const a = t.response.headers.get("Retry-After");
|
|
1371
|
+
if (a && this._options.retry.afterStatusCodes.includes(t.response.status)) {
|
|
1372
|
+
let s = Number(a);
|
|
1373
|
+
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;
|
|
1374
|
+
}
|
|
1375
|
+
if (t.response.status === 413)
|
|
1376
|
+
return 0;
|
|
1377
|
+
}
|
|
1378
|
+
const n = this._options.retry.delay(this._retryCount);
|
|
1379
|
+
return Math.min(this._options.retry.backoffLimit, n);
|
|
1380
|
+
}
|
|
1381
|
+
return 0;
|
|
1382
|
+
}
|
|
1383
|
+
_decorateResponse(t) {
|
|
1384
|
+
return this._options.parseJson && (t.json = async () => this._options.parseJson(await t.text())), t;
|
|
1385
|
+
}
|
|
1386
|
+
async _retry(t) {
|
|
1387
|
+
try {
|
|
1388
|
+
return await t();
|
|
1389
|
+
} catch (n) {
|
|
1390
|
+
const a = Math.min(this._calculateRetryDelay(n), oe);
|
|
1391
|
+
if (a !== 0 && this._retryCount > 0) {
|
|
1392
|
+
await kt(a, { signal: this._options.signal });
|
|
1393
|
+
for (const s of this._options.hooks.beforeRetry)
|
|
1394
|
+
if (await s({
|
|
1395
|
+
request: this.request,
|
|
1396
|
+
options: this._options,
|
|
1397
|
+
error: n,
|
|
1398
|
+
retryCount: this._retryCount
|
|
1399
|
+
}) === Ve)
|
|
1400
|
+
return;
|
|
1401
|
+
return this._retry(t);
|
|
1402
|
+
}
|
|
1403
|
+
throw n;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
async _fetch() {
|
|
1407
|
+
for (const n of this._options.hooks.beforeRequest) {
|
|
1408
|
+
const a = await n(this.request, this._options);
|
|
1409
|
+
if (a instanceof Request) {
|
|
1410
|
+
this.request = a;
|
|
1411
|
+
break;
|
|
1412
|
+
}
|
|
1413
|
+
if (a instanceof Response)
|
|
1414
|
+
return a;
|
|
1415
|
+
}
|
|
1416
|
+
const t = Ft(this.request, this._options);
|
|
1417
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ht(this.request.clone(), t, this.abortController, this._options);
|
|
1418
|
+
}
|
|
1419
|
+
/* istanbul ignore next */
|
|
1420
|
+
_stream(t, n) {
|
|
1421
|
+
const a = Number(t.headers.get("content-length")) || 0;
|
|
1422
|
+
let s = 0;
|
|
1423
|
+
return t.status === 204 ? (n && n({ percent: 1, totalBytes: a, transferredBytes: s }, new Uint8Array()), new globalThis.Response(null, {
|
|
1424
|
+
status: t.status,
|
|
1425
|
+
statusText: t.statusText,
|
|
1426
|
+
headers: t.headers
|
|
1427
|
+
})) : new globalThis.Response(new globalThis.ReadableStream({
|
|
1428
|
+
async start(r) {
|
|
1429
|
+
const o = t.body.getReader();
|
|
1430
|
+
n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
|
|
1431
|
+
async function p() {
|
|
1432
|
+
const { done: d, value: u } = await o.read();
|
|
1433
|
+
if (d) {
|
|
1434
|
+
r.close();
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
if (n) {
|
|
1438
|
+
s += u.byteLength;
|
|
1439
|
+
const l = a === 0 ? 0 : s / a;
|
|
1440
|
+
n({ percent: l, transferredBytes: s, totalBytes: a }, u);
|
|
1441
|
+
}
|
|
1442
|
+
r.enqueue(u), await p();
|
|
1443
|
+
}
|
|
1444
|
+
await p();
|
|
1445
|
+
}
|
|
1446
|
+
}), {
|
|
1447
|
+
status: t.status,
|
|
1448
|
+
statusText: t.statusText,
|
|
1449
|
+
headers: t.headers
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
/*! MIT License © Sindre Sorhus */
|
|
1454
|
+
const le = (e) => {
|
|
1455
|
+
const t = (n, a) => Z.create(n, X(e, a));
|
|
1456
|
+
for (const n of Le)
|
|
1457
|
+
t[n] = (a, s) => Z.create(a, X(e, s, { method: n }));
|
|
1458
|
+
return t.create = (n) => le(X(n)), t.extend = (n) => le(X(e, n)), t.stop = Ve, t;
|
|
1459
|
+
}, Gt = le(), qt = Gt, Wt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, ge = qt.create({ headers: Wt }), Ae = {
|
|
1460
|
+
get: (e, t) => ge.get(e, t).json(),
|
|
1461
|
+
post: (e, t) => ge.post(e, t).json()
|
|
1462
|
+
}, Oe = Object.values(i), jt = (e = "") => {
|
|
1104
1463
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1105
|
-
if (
|
|
1464
|
+
if (Oe.includes(n))
|
|
1106
1465
|
return !0;
|
|
1107
1466
|
const [a] = t.split("/");
|
|
1108
|
-
if (
|
|
1467
|
+
if (Oe.includes(a))
|
|
1109
1468
|
return !0;
|
|
1110
1469
|
throw new Error(
|
|
1111
1470
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1112
1471
|
);
|
|
1113
|
-
},
|
|
1114
|
-
|
|
1115
|
-
|
|
1472
|
+
}, W = 8, L = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
|
|
1473
|
+
function se({
|
|
1474
|
+
value: e,
|
|
1475
|
+
bigIntDecimal: t = W,
|
|
1476
|
+
decimal: n = W
|
|
1477
|
+
}) {
|
|
1478
|
+
const a = e < 0n;
|
|
1479
|
+
let s = e.toString().substring(a ? 1 : 0);
|
|
1480
|
+
const r = n - (s.length - 1);
|
|
1481
|
+
r > 0 && (s = "0".repeat(r) + s);
|
|
1482
|
+
const o = s.length - n;
|
|
1483
|
+
let p = s.slice(-n);
|
|
1484
|
+
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(
|
|
1485
|
+
/\.?0*$/,
|
|
1486
|
+
""
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1489
|
+
var U, k, B, $, ye, $e, Q, pe, ee, ce;
|
|
1490
|
+
const Kt = class He {
|
|
1116
1491
|
constructor(t) {
|
|
1117
|
-
|
|
1118
|
-
const n =
|
|
1119
|
-
this.decimal =
|
|
1120
|
-
Math.max(R(this, Z, oe).call(this, R(this, H, W).call(this, a)), this.decimal || 0)
|
|
1121
|
-
), R(this, ie, ve).call(this, a);
|
|
1492
|
+
H(this, U), H(this, B), H(this, ye), H(this, Q), H(this, ee), I(this, "decimalMultiplier", 10n ** 8n), I(this, "bigIntValue", 0n), I(this, "decimal");
|
|
1493
|
+
const n = Te(t), a = typeof t == "object";
|
|
1494
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(ke(te(n)), this.decimal || 0)), R(this, ye, $e).call(this, n);
|
|
1122
1495
|
}
|
|
1123
1496
|
static fromBigInt(t, n) {
|
|
1124
|
-
return new
|
|
1497
|
+
return new He({
|
|
1125
1498
|
decimal: n,
|
|
1126
|
-
value:
|
|
1499
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1127
1500
|
});
|
|
1128
1501
|
}
|
|
1129
1502
|
static shiftDecimals({
|
|
@@ -1131,198 +1504,273 @@ const mt = class Q {
|
|
|
1131
1504
|
from: n,
|
|
1132
1505
|
to: a
|
|
1133
1506
|
}) {
|
|
1134
|
-
return
|
|
1135
|
-
|
|
1507
|
+
return this.fromBigInt(
|
|
1508
|
+
t.getBaseValue("bigint") * L(a) / L(n),
|
|
1136
1509
|
a
|
|
1137
1510
|
);
|
|
1138
1511
|
}
|
|
1139
|
-
|
|
1140
|
-
return
|
|
1141
|
-
}
|
|
1142
|
-
get baseValue() {
|
|
1143
|
-
return R(this, k, J).call(this, "string");
|
|
1144
|
-
}
|
|
1145
|
-
get baseValueNumber() {
|
|
1146
|
-
return R(this, k, J).call(this, "number");
|
|
1147
|
-
}
|
|
1148
|
-
get baseValueBigInt() {
|
|
1149
|
-
return R(this, k, J).call(this, "number");
|
|
1150
|
-
}
|
|
1151
|
-
get value() {
|
|
1152
|
-
return this.formatBigIntToSafeValue(
|
|
1153
|
-
this.bigIntValue,
|
|
1154
|
-
this.decimal || G(this.decimalMultiplier)
|
|
1155
|
-
);
|
|
1512
|
+
set(t) {
|
|
1513
|
+
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1156
1514
|
}
|
|
1157
1515
|
add(...t) {
|
|
1158
|
-
return R(this,
|
|
1516
|
+
return R(this, U, k).call(this, "add", ...t);
|
|
1159
1517
|
}
|
|
1160
1518
|
sub(...t) {
|
|
1161
|
-
return R(this,
|
|
1519
|
+
return R(this, U, k).call(this, "sub", ...t);
|
|
1162
1520
|
}
|
|
1163
1521
|
mul(...t) {
|
|
1164
|
-
return R(this,
|
|
1522
|
+
return R(this, U, k).call(this, "mul", ...t);
|
|
1165
1523
|
}
|
|
1166
1524
|
div(...t) {
|
|
1167
|
-
return R(this,
|
|
1525
|
+
return R(this, U, k).call(this, "div", ...t);
|
|
1168
1526
|
}
|
|
1169
1527
|
gt(t) {
|
|
1170
|
-
return this
|
|
1528
|
+
return R(this, B, $).call(this, "gt", t);
|
|
1171
1529
|
}
|
|
1172
1530
|
gte(t) {
|
|
1173
|
-
return this
|
|
1531
|
+
return R(this, B, $).call(this, "gte", t);
|
|
1174
1532
|
}
|
|
1175
1533
|
lt(t) {
|
|
1176
|
-
return this
|
|
1534
|
+
return R(this, B, $).call(this, "lt", t);
|
|
1177
1535
|
}
|
|
1178
1536
|
lte(t) {
|
|
1179
|
-
return this
|
|
1537
|
+
return R(this, B, $).call(this, "lte", t);
|
|
1180
1538
|
}
|
|
1181
1539
|
eqValue(t) {
|
|
1182
|
-
return this
|
|
1540
|
+
return R(this, B, $).call(this, "eqValue", t);
|
|
1541
|
+
}
|
|
1542
|
+
// @ts-expect-error False positive
|
|
1543
|
+
getValue(t) {
|
|
1544
|
+
const n = this.formatBigIntToSafeValue(
|
|
1545
|
+
this.bigIntValue,
|
|
1546
|
+
this.decimal || G(this.decimalMultiplier)
|
|
1547
|
+
);
|
|
1548
|
+
switch (t) {
|
|
1549
|
+
case "number":
|
|
1550
|
+
return Number(n);
|
|
1551
|
+
case "string":
|
|
1552
|
+
return n;
|
|
1553
|
+
case "bigint":
|
|
1554
|
+
return this.bigIntValue * 10n ** BigInt(this.decimal || 8n) / this.decimalMultiplier;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
// @ts-expect-error
|
|
1558
|
+
getBaseValue(t) {
|
|
1559
|
+
const n = this.decimalMultiplier / L(this.decimal || w.THOR), a = this.bigIntValue / n;
|
|
1560
|
+
switch (t) {
|
|
1561
|
+
case "number":
|
|
1562
|
+
return Number(a);
|
|
1563
|
+
case "string":
|
|
1564
|
+
return a.toString();
|
|
1565
|
+
case "bigint":
|
|
1566
|
+
return a;
|
|
1567
|
+
}
|
|
1183
1568
|
}
|
|
1184
1569
|
getBigIntValue(t, n) {
|
|
1185
|
-
|
|
1570
|
+
if (!n && typeof t == "object")
|
|
1571
|
+
return t.bigIntValue;
|
|
1572
|
+
const a = Te(t), s = te(a);
|
|
1573
|
+
return s === "0" || s === "undefined" ? 0n : R(this, ee, ce).call(this, s, n);
|
|
1574
|
+
}
|
|
1575
|
+
toSignificant(t = 6) {
|
|
1576
|
+
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
1577
|
+
if ((parseInt(s) ? s.length + r.length : r.length) <= t)
|
|
1578
|
+
return this.getValue("string");
|
|
1579
|
+
if (s.length >= t)
|
|
1580
|
+
return s.slice(0, t).padEnd(s.length, "0");
|
|
1581
|
+
if (parseInt(s))
|
|
1582
|
+
return `${s}.${r.slice(0, t - s.length)}`.padEnd(
|
|
1583
|
+
t - s.length,
|
|
1584
|
+
"0"
|
|
1585
|
+
);
|
|
1586
|
+
const o = parseInt(r), p = `${o}`.slice(0, t);
|
|
1587
|
+
return `0.${p.padStart(
|
|
1588
|
+
r.length - `${o}`.length + p.length,
|
|
1589
|
+
"0"
|
|
1590
|
+
)}`;
|
|
1591
|
+
}
|
|
1592
|
+
toFixed(t = 6) {
|
|
1593
|
+
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
1594
|
+
if (parseInt(s))
|
|
1595
|
+
return `${s}.${r.slice(0, t)}`.padEnd(t, "0");
|
|
1596
|
+
const o = parseInt(r), p = `${o}`.slice(0, t);
|
|
1597
|
+
return `0.${p.padStart(
|
|
1598
|
+
r.length - `${o}`.length + p.length,
|
|
1599
|
+
"0"
|
|
1600
|
+
)}`;
|
|
1601
|
+
}
|
|
1602
|
+
toAbbreviation(t = 2) {
|
|
1603
|
+
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];
|
|
1604
|
+
if (!r)
|
|
1605
|
+
return this.getValue("string");
|
|
1606
|
+
const o = 10 ** (s * 3);
|
|
1607
|
+
return `${(n / o).toFixed(t)}${r}`;
|
|
1608
|
+
}
|
|
1609
|
+
toCurrency(t = "$", {
|
|
1610
|
+
currencyPosition: n = "start",
|
|
1611
|
+
decimal: a = 2,
|
|
1612
|
+
decimalSeparator: s = ".",
|
|
1613
|
+
thousandSeparator: r = ","
|
|
1614
|
+
} = {}) {
|
|
1615
|
+
const o = this.getValue("number"), [p, d = ""] = o.toFixed(6).split("."), u = p.replace(/\B(?=(\d{3})+(?!\d))/g, r), l = !p && !d ? "0.00" : p === "0" ? `${parseFloat(`0.${d}`)}`.replace(".", s) : `${u}${parseInt(d) ? `${s}${d.slice(0, a)}` : ""}`;
|
|
1616
|
+
return `${n === "start" ? t : ""}${l}${n === "end" ? t : ""}`;
|
|
1186
1617
|
}
|
|
1187
1618
|
formatBigIntToSafeValue(t, n) {
|
|
1188
|
-
const a = n || this.decimal ||
|
|
1619
|
+
const a = n || this.decimal || W, s = Math.max(
|
|
1189
1620
|
a,
|
|
1190
1621
|
G(this.decimalMultiplier)
|
|
1191
|
-
), r = t < 0n;
|
|
1192
|
-
let
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
return parseInt(c[a]) >= 5 ? c = `${c.substring(0, a - 1)}${(parseInt(c[a - 1]) + 1).toString()}` : c = c.substring(0, a), `${r ? "-" : ""}${p.slice(0, l)}.${c}`.replace(
|
|
1198
|
-
/\.?0*$/,
|
|
1199
|
-
""
|
|
1200
|
-
);
|
|
1201
|
-
}
|
|
1202
|
-
toSignificant(t) {
|
|
1203
|
-
const n = this.value.split("."), a = n[0], i = n[1];
|
|
1204
|
-
return i ? `${a}.${i.slice(0, t || this.decimal)}`.replace(
|
|
1205
|
-
/\.?0*$/,
|
|
1206
|
-
""
|
|
1207
|
-
) : a;
|
|
1622
|
+
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o, u = d.length - s;
|
|
1623
|
+
let l = d.slice(-s);
|
|
1624
|
+
return parseInt(l[a]) >= 5 ? l = `${l.substring(0, a - 1)}${(parseInt(l[a - 1]) + 1).toString()}` : l = l.substring(0, a), `${r ? "-" : ""}${d.slice(
|
|
1625
|
+
0,
|
|
1626
|
+
u
|
|
1627
|
+
)}.${l}`.replace(/\.?0*$/, "");
|
|
1208
1628
|
}
|
|
1209
1629
|
};
|
|
1210
|
-
|
|
1211
|
-
const n = R(this,
|
|
1630
|
+
U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
1631
|
+
const n = R(this, Q, pe).call(this, this, ...t), a = Math.max(n, G(this.decimalMultiplier)), s = L(a), r = t.reduce(
|
|
1212
1632
|
(p, d) => {
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1633
|
+
const u = this.getBigIntValue(d, a);
|
|
1634
|
+
switch (e) {
|
|
1635
|
+
case "add":
|
|
1636
|
+
return p + u;
|
|
1637
|
+
case "sub":
|
|
1638
|
+
return p - u;
|
|
1639
|
+
case "mul":
|
|
1640
|
+
return p * u / s;
|
|
1641
|
+
case "div": {
|
|
1642
|
+
if (u === 0n)
|
|
1643
|
+
throw new RangeError("Division by zero");
|
|
1644
|
+
return p * s / u;
|
|
1645
|
+
}
|
|
1646
|
+
default:
|
|
1647
|
+
return p;
|
|
1648
|
+
}
|
|
1217
1649
|
},
|
|
1218
1650
|
//normalize is to precision multiplier base
|
|
1219
|
-
this.bigIntValue *
|
|
1220
|
-
),
|
|
1221
|
-
bigIntDecimal:
|
|
1222
|
-
decimal:
|
|
1223
|
-
value:
|
|
1651
|
+
this.bigIntValue * s / this.decimalMultiplier
|
|
1652
|
+
), o = se({
|
|
1653
|
+
bigIntDecimal: a,
|
|
1654
|
+
decimal: a,
|
|
1655
|
+
value: r
|
|
1224
1656
|
});
|
|
1225
|
-
return new this.constructor({
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
).
|
|
1233
|
-
return Math.max(...t, K);
|
|
1234
|
-
}, z = /* @__PURE__ */ new WeakSet(), pe = function(e, t) {
|
|
1235
|
-
const n = t ? U(t) : this.decimalMultiplier, a = G(n), [i, r = ""] = e.split(".");
|
|
1236
|
-
return BigInt(`${i}${r.padEnd(a, "0")}`);
|
|
1237
|
-
}, H = /* @__PURE__ */ new WeakSet(), W = function(e) {
|
|
1238
|
-
const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
|
|
1239
|
-
useGrouping: !1,
|
|
1240
|
-
maximumFractionDigits: 20
|
|
1241
|
-
}) : e}`.replaceAll(",", ".").split(".");
|
|
1242
|
-
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1243
|
-
}, Z = /* @__PURE__ */ new WeakSet(), oe = function(e) {
|
|
1244
|
-
var t;
|
|
1245
|
-
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1246
|
-
return Math.max(n, K);
|
|
1247
|
-
}, k = /* @__PURE__ */ new WeakSet(), J = function(e) {
|
|
1248
|
-
const t = this.decimalMultiplier / U(this.decimal || 0), n = this.bigIntValue / t;
|
|
1657
|
+
return new this.constructor({
|
|
1658
|
+
decimalMultiplier: L(a),
|
|
1659
|
+
decimal: this.decimal,
|
|
1660
|
+
value: o,
|
|
1661
|
+
identifier: this.toString()
|
|
1662
|
+
});
|
|
1663
|
+
}, B = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1664
|
+
const n = R(this, Q, pe).call(this, this, ...t), a = this.getBigIntValue(t[0], n), s = this.getBigIntValue(this, n);
|
|
1249
1665
|
switch (e) {
|
|
1250
|
-
case "
|
|
1251
|
-
return
|
|
1252
|
-
case "
|
|
1253
|
-
return
|
|
1254
|
-
|
|
1255
|
-
return
|
|
1666
|
+
case "gt":
|
|
1667
|
+
return s > a;
|
|
1668
|
+
case "gte":
|
|
1669
|
+
return s >= a;
|
|
1670
|
+
case "lt":
|
|
1671
|
+
return s < a;
|
|
1672
|
+
case "lte":
|
|
1673
|
+
return s <= a;
|
|
1674
|
+
case "eqValue":
|
|
1675
|
+
return s === a;
|
|
1256
1676
|
}
|
|
1677
|
+
}, ye = /* @__PURE__ */ new WeakSet(), $e = function(e) {
|
|
1678
|
+
const t = te(e) || "0";
|
|
1679
|
+
this.bigIntValue = R(this, ee, ce).call(this, t);
|
|
1680
|
+
}, Q = /* @__PURE__ */ new WeakSet(), pe = function(...e) {
|
|
1681
|
+
const t = e.map((n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) : ke(te(n))).filter(Boolean);
|
|
1682
|
+
return Math.max(...t, W);
|
|
1683
|
+
}, ee = /* @__PURE__ */ new WeakSet(), ce = function(e, t) {
|
|
1684
|
+
const n = t ? L(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
|
|
1685
|
+
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1257
1686
|
};
|
|
1258
|
-
let
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1687
|
+
let me = Kt;
|
|
1688
|
+
const Yt = Intl.NumberFormat("fullwide", {
|
|
1689
|
+
useGrouping: !1,
|
|
1690
|
+
maximumFractionDigits: 20
|
|
1691
|
+
});
|
|
1692
|
+
function te(e) {
|
|
1693
|
+
const t = `${typeof e == "number" ? Yt.format(e) : Te(e)}`.replaceAll(",", ".").split(".");
|
|
1694
|
+
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1695
|
+
}
|
|
1696
|
+
function ke(e) {
|
|
1697
|
+
var t;
|
|
1698
|
+
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1699
|
+
return Math.max(n, W);
|
|
1700
|
+
}
|
|
1701
|
+
function Te(e) {
|
|
1702
|
+
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1703
|
+
}
|
|
1704
|
+
const z = (e, t) => typeof e == "bigint" ? se({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1705
|
+
let he;
|
|
1706
|
+
const Se = (e) => {
|
|
1707
|
+
if (!he)
|
|
1261
1708
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1262
|
-
return
|
|
1263
|
-
},
|
|
1264
|
-
|
|
1265
|
-
const n = await
|
|
1266
|
-
return new
|
|
1709
|
+
return he.get(e.toUpperCase()) || { decimal: w.THOR, identifier: "" };
|
|
1710
|
+
}, de = async (e, t = 0) => {
|
|
1711
|
+
jt(e);
|
|
1712
|
+
const n = await bt(_e(e)), a = z(t, n);
|
|
1713
|
+
return new N({ decimal: n, value: a, identifier: e });
|
|
1267
1714
|
};
|
|
1268
|
-
class
|
|
1715
|
+
class N extends me {
|
|
1269
1716
|
constructor(t) {
|
|
1717
|
+
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`;
|
|
1270
1718
|
super(
|
|
1271
|
-
t.value instanceof
|
|
1272
|
-
),
|
|
1273
|
-
const
|
|
1274
|
-
this.type =
|
|
1719
|
+
t.value instanceof me ? t.value : { decimal: t.decimal, value: t.value }
|
|
1720
|
+
), 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");
|
|
1721
|
+
const a = _e(n);
|
|
1722
|
+
this.type = Et(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, this.tax = t.tax;
|
|
1723
|
+
}
|
|
1724
|
+
toString() {
|
|
1725
|
+
return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
|
|
1726
|
+
}
|
|
1727
|
+
toUrl() {
|
|
1728
|
+
return this.isSynthetic ? `${this.chain}.${this.symbol.replace("/", ".")}` : this.toString();
|
|
1729
|
+
}
|
|
1730
|
+
eq({ chain: t, symbol: n }) {
|
|
1731
|
+
return this.chain === t && this.symbol === n;
|
|
1732
|
+
}
|
|
1733
|
+
// THOR.RUNE
|
|
1734
|
+
// THOR.ETH.ETH
|
|
1735
|
+
// ETH.THOR-0x1234567890
|
|
1736
|
+
static fromUrl(t, n = 0) {
|
|
1737
|
+
const [a, s, r] = t.split(".");
|
|
1738
|
+
if (!a || !s)
|
|
1739
|
+
throw new Error("Invalid asset url");
|
|
1740
|
+
const o = a === i.THORChain && r ? `${a}.${s}/${r}` : t;
|
|
1741
|
+
return de(o, n);
|
|
1275
1742
|
}
|
|
1276
|
-
static
|
|
1277
|
-
return
|
|
1743
|
+
static fromString(t, n = 0) {
|
|
1744
|
+
return de(t, n);
|
|
1278
1745
|
}
|
|
1279
1746
|
static fromStringSync(t, n = 0) {
|
|
1280
|
-
const {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1747
|
+
const { isSynthetic: a } = _e(t), {
|
|
1748
|
+
tax: s,
|
|
1749
|
+
decimal: r,
|
|
1750
|
+
identifier: o
|
|
1751
|
+
} = Se(t), p = z(n, r);
|
|
1752
|
+
return o ? new N({ tax: s, decimal: r, identifier: o, value: p }) : a ? new N({ tax: s, decimal: 8, identifier: t, value: p }) : void 0;
|
|
1284
1753
|
}
|
|
1285
|
-
static
|
|
1286
|
-
return
|
|
1754
|
+
static fromIdentifier(t, n = 0) {
|
|
1755
|
+
return de(t, n);
|
|
1287
1756
|
}
|
|
1288
1757
|
static fromIdentifierSync(t, n = 0) {
|
|
1289
|
-
const { decimal: a, identifier:
|
|
1290
|
-
return new
|
|
1758
|
+
const { decimal: a, identifier: s } = Se(t), r = z(n, a);
|
|
1759
|
+
return new N({ decimal: a, identifier: s, value: r });
|
|
1291
1760
|
}
|
|
1292
1761
|
static fromChainOrSignature(t, n = 0) {
|
|
1293
|
-
const { decimal: a, identifier:
|
|
1294
|
-
return new
|
|
1295
|
-
}
|
|
1296
|
-
static async fromTCQuote(t, n = 0) {
|
|
1297
|
-
const a = await Se(ye(t)), i = this.shiftDecimals({ value: n, from: E.THOR, to: a });
|
|
1298
|
-
return new v({ value: i, identifier: t, decimal: a });
|
|
1299
|
-
}
|
|
1300
|
-
static fromTCQuoteStatic(t, n = 0) {
|
|
1301
|
-
const a = se(t), i = this.shiftDecimals({
|
|
1302
|
-
value: n,
|
|
1303
|
-
from: E.THOR,
|
|
1304
|
-
to: a.decimal
|
|
1305
|
-
});
|
|
1306
|
-
return new v({ ...a, value: i });
|
|
1762
|
+
const { decimal: a, identifier: s } = At(t), r = z(n, a);
|
|
1763
|
+
return new N({ value: r, decimal: a, identifier: s });
|
|
1307
1764
|
}
|
|
1308
|
-
static
|
|
1765
|
+
static loadStaticAssets() {
|
|
1309
1766
|
return new Promise(
|
|
1310
1767
|
async (t, n) => {
|
|
1311
1768
|
try {
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
...r
|
|
1318
|
-
} = await import("@swapkit/tokens");
|
|
1319
|
-
ue = [i, ...Object.values(r)].reduce(
|
|
1320
|
-
(p, { tokens: d }) => (d.forEach(({ identifier: l, chain: c, ...y }) => {
|
|
1321
|
-
const u = "decimals" in y ? y.decimals : E[c];
|
|
1322
|
-
p.set(l, { identifier: l, decimal: u });
|
|
1323
|
-
}), p),
|
|
1324
|
-
/* @__PURE__ */ new Map()
|
|
1325
|
-
), t({ ok: !0 });
|
|
1769
|
+
const a = await import("@swapkit/tokens");
|
|
1770
|
+
he = Object.values(a).reduce((s, { tokens: r }) => (r.forEach(({ identifier: o, chain: p, ...d }) => {
|
|
1771
|
+
const u = "decimals" in d ? d.decimals : w[p];
|
|
1772
|
+
s.set(o, { identifier: o, decimal: u });
|
|
1773
|
+
}), s), /* @__PURE__ */ new Map()), t({ ok: !0 });
|
|
1326
1774
|
} catch (a) {
|
|
1327
1775
|
console.error(a), n({
|
|
1328
1776
|
ok: !1,
|
|
@@ -1333,45 +1781,36 @@ class v extends de {
|
|
|
1333
1781
|
}
|
|
1334
1782
|
);
|
|
1335
1783
|
}
|
|
1336
|
-
get assetValue() {
|
|
1337
|
-
return `${this.value} ${this.ticker}`;
|
|
1338
|
-
}
|
|
1339
|
-
toString() {
|
|
1340
|
-
return `${this.chain}.${this.symbol}`;
|
|
1341
|
-
}
|
|
1342
|
-
eq({ chain: t, symbol: n }) {
|
|
1343
|
-
return this.chain === t && this.symbol === n;
|
|
1344
|
-
}
|
|
1345
1784
|
}
|
|
1346
|
-
const
|
|
1347
|
-
const t =
|
|
1785
|
+
const ue = (e) => {
|
|
1786
|
+
const t = N.fromChainOrSignature(e);
|
|
1348
1787
|
switch (e) {
|
|
1349
|
-
case
|
|
1350
|
-
case
|
|
1351
|
-
case
|
|
1352
|
-
return t.
|
|
1353
|
-
case
|
|
1354
|
-
return t.
|
|
1355
|
-
case
|
|
1356
|
-
case
|
|
1357
|
-
return t.
|
|
1358
|
-
case
|
|
1359
|
-
case
|
|
1360
|
-
return t.
|
|
1788
|
+
case i.Bitcoin:
|
|
1789
|
+
case i.Litecoin:
|
|
1790
|
+
case i.BitcoinCash:
|
|
1791
|
+
return t.set(10001e-8);
|
|
1792
|
+
case i.Dogecoin:
|
|
1793
|
+
return t.set(1.00000001);
|
|
1794
|
+
case i.Avalanche:
|
|
1795
|
+
case i.Ethereum:
|
|
1796
|
+
return t.set(1e-8);
|
|
1797
|
+
case i.THORChain:
|
|
1798
|
+
case i.Maya:
|
|
1799
|
+
return t.set(0);
|
|
1361
1800
|
default:
|
|
1362
|
-
return t.
|
|
1801
|
+
return t.set(1e-8);
|
|
1363
1802
|
}
|
|
1364
|
-
},
|
|
1365
|
-
const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${
|
|
1803
|
+
}, _e = (e) => {
|
|
1804
|
+
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("-");
|
|
1366
1805
|
return {
|
|
1367
|
-
address:
|
|
1368
|
-
chain:
|
|
1369
|
-
isGasAsset:
|
|
1806
|
+
address: d == null ? void 0 : d.toLowerCase(),
|
|
1807
|
+
chain: r,
|
|
1808
|
+
isGasAsset: De({ chain: r, symbol: o }),
|
|
1370
1809
|
isSynthetic: t,
|
|
1371
|
-
symbol:
|
|
1372
|
-
ticker:
|
|
1810
|
+
symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
|
|
1811
|
+
ticker: p
|
|
1373
1812
|
};
|
|
1374
|
-
},
|
|
1813
|
+
}, Xt = {
|
|
1375
1814
|
/**
|
|
1376
1815
|
* Core
|
|
1377
1816
|
*/
|
|
@@ -1418,6 +1857,7 @@ const fe = (e) => {
|
|
|
1418
1857
|
core_transaction_deposit_to_pool_error: 10310,
|
|
1419
1858
|
core_transaction_deposit_insufficient_funds_error: 10311,
|
|
1420
1859
|
core_transaction_deposit_gas_error: 10312,
|
|
1860
|
+
core_transaction_invalid_sender_address: 10313,
|
|
1421
1861
|
core_transaction_deposit_server_error: 10313,
|
|
1422
1862
|
/**
|
|
1423
1863
|
* Wallets
|
|
@@ -1428,20 +1868,23 @@ const fe = (e) => {
|
|
|
1428
1868
|
*/
|
|
1429
1869
|
helpers_number_different_decimals: 99101
|
|
1430
1870
|
};
|
|
1431
|
-
class
|
|
1871
|
+
class c extends Error {
|
|
1432
1872
|
constructor(t, n) {
|
|
1433
|
-
console.error(n), super(t, { cause: { code:
|
|
1873
|
+
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);
|
|
1434
1874
|
}
|
|
1435
1875
|
}
|
|
1436
|
-
class
|
|
1876
|
+
class x extends me {
|
|
1437
1877
|
eq(t) {
|
|
1438
1878
|
return this.eqValue(t);
|
|
1439
1879
|
}
|
|
1440
|
-
|
|
1441
|
-
return
|
|
1880
|
+
static fromBigInt(t, n) {
|
|
1881
|
+
return new x({
|
|
1882
|
+
decimal: n,
|
|
1883
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1884
|
+
});
|
|
1442
1885
|
}
|
|
1443
1886
|
}
|
|
1444
|
-
const
|
|
1887
|
+
const Jt = [
|
|
1445
1888
|
{
|
|
1446
1889
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1447
1890
|
stateMutability: "nonpayable",
|
|
@@ -1532,7 +1975,7 @@ const _t = [
|
|
|
1532
1975
|
type: "function"
|
|
1533
1976
|
},
|
|
1534
1977
|
{ stateMutability: "payable", type: "receive" }
|
|
1535
|
-
],
|
|
1978
|
+
], Qt = [
|
|
1536
1979
|
{
|
|
1537
1980
|
inputs: [
|
|
1538
1981
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -1676,7 +2119,7 @@ const _t = [
|
|
|
1676
2119
|
type: "function"
|
|
1677
2120
|
},
|
|
1678
2121
|
{ stateMutability: "payable", type: "receive" }
|
|
1679
|
-
],
|
|
2122
|
+
], zt = [
|
|
1680
2123
|
{
|
|
1681
2124
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1682
2125
|
stateMutability: "nonpayable",
|
|
@@ -1781,7 +2224,7 @@ const _t = [
|
|
|
1781
2224
|
type: "function"
|
|
1782
2225
|
},
|
|
1783
2226
|
{ stateMutability: "payable", type: "receive" }
|
|
1784
|
-
],
|
|
2227
|
+
], Zt = [
|
|
1785
2228
|
{
|
|
1786
2229
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1787
2230
|
stateMutability: "nonpayable",
|
|
@@ -1872,7 +2315,7 @@ const _t = [
|
|
|
1872
2315
|
type: "function"
|
|
1873
2316
|
},
|
|
1874
2317
|
{ stateMutability: "payable", type: "receive" }
|
|
1875
|
-
],
|
|
2318
|
+
], en = [
|
|
1876
2319
|
{
|
|
1877
2320
|
inputs: [
|
|
1878
2321
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2016,7 +2459,7 @@ const _t = [
|
|
|
2016
2459
|
type: "function"
|
|
2017
2460
|
},
|
|
2018
2461
|
{ stateMutability: "payable", type: "receive" }
|
|
2019
|
-
],
|
|
2462
|
+
], tn = [
|
|
2020
2463
|
{
|
|
2021
2464
|
inputs: [
|
|
2022
2465
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2135,7 +2578,7 @@ const _t = [
|
|
|
2135
2578
|
type: "function"
|
|
2136
2579
|
},
|
|
2137
2580
|
{ stateMutability: "payable", type: "receive" }
|
|
2138
|
-
],
|
|
2581
|
+
], nn = [
|
|
2139
2582
|
{
|
|
2140
2583
|
inputs: [
|
|
2141
2584
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2254,7 +2697,7 @@ const _t = [
|
|
|
2254
2697
|
type: "function"
|
|
2255
2698
|
},
|
|
2256
2699
|
{ stateMutability: "payable", type: "receive" }
|
|
2257
|
-
],
|
|
2700
|
+
], an = [
|
|
2258
2701
|
{
|
|
2259
2702
|
inputs: [
|
|
2260
2703
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2373,7 +2816,7 @@ const _t = [
|
|
|
2373
2816
|
type: "function"
|
|
2374
2817
|
},
|
|
2375
2818
|
{ stateMutability: "payable", type: "receive" }
|
|
2376
|
-
],
|
|
2819
|
+
], sn = [
|
|
2377
2820
|
{
|
|
2378
2821
|
inputs: [
|
|
2379
2822
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2492,7 +2935,7 @@ const _t = [
|
|
|
2492
2935
|
type: "function"
|
|
2493
2936
|
},
|
|
2494
2937
|
{ stateMutability: "payable", type: "receive" }
|
|
2495
|
-
],
|
|
2938
|
+
], rn = [
|
|
2496
2939
|
{
|
|
2497
2940
|
inputs: [
|
|
2498
2941
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2619,7 +3062,7 @@ const _t = [
|
|
|
2619
3062
|
type: "function"
|
|
2620
3063
|
},
|
|
2621
3064
|
{ stateMutability: "payable", type: "receive" }
|
|
2622
|
-
],
|
|
3065
|
+
], on = [
|
|
2623
3066
|
{
|
|
2624
3067
|
inputs: [
|
|
2625
3068
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2746,7 +3189,7 @@ const _t = [
|
|
|
2746
3189
|
type: "function"
|
|
2747
3190
|
},
|
|
2748
3191
|
{ stateMutability: "payable", type: "receive" }
|
|
2749
|
-
],
|
|
3192
|
+
], pn = [
|
|
2750
3193
|
{
|
|
2751
3194
|
inputs: [
|
|
2752
3195
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2873,7 +3316,7 @@ const _t = [
|
|
|
2873
3316
|
type: "function"
|
|
2874
3317
|
},
|
|
2875
3318
|
{ stateMutability: "payable", type: "receive" }
|
|
2876
|
-
],
|
|
3319
|
+
], dn = [
|
|
2877
3320
|
{
|
|
2878
3321
|
inputs: [
|
|
2879
3322
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3000,7 +3443,7 @@ const _t = [
|
|
|
3000
3443
|
type: "function"
|
|
3001
3444
|
},
|
|
3002
3445
|
{ stateMutability: "payable", type: "receive" }
|
|
3003
|
-
],
|
|
3446
|
+
], un = [
|
|
3004
3447
|
{
|
|
3005
3448
|
inputs: [
|
|
3006
3449
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3127,281 +3570,301 @@ const _t = [
|
|
|
3127
3570
|
type: "function"
|
|
3128
3571
|
},
|
|
3129
3572
|
{ stateMutability: "payable", type: "receive" }
|
|
3130
|
-
],
|
|
3131
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3132
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3133
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3134
|
-
},
|
|
3135
|
-
...
|
|
3573
|
+
], Fe = {
|
|
3574
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Jt,
|
|
3575
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: zt,
|
|
3576
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Zt
|
|
3577
|
+
}, ln = {
|
|
3578
|
+
...Fe,
|
|
3136
3579
|
// AVAX
|
|
3137
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3138
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3139
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3580
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: tn,
|
|
3581
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Qt,
|
|
3582
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: an,
|
|
3140
3583
|
// BSC
|
|
3141
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3584
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: en,
|
|
3142
3585
|
// ETH
|
|
3143
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3144
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3145
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3146
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3147
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3148
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3149
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3150
|
-
},
|
|
3586
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: nn,
|
|
3587
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: sn,
|
|
3588
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: rn,
|
|
3589
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: on,
|
|
3590
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: pn,
|
|
3591
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: dn,
|
|
3592
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: un
|
|
3593
|
+
}, yn = ({
|
|
3151
3594
|
streamSwap: e,
|
|
3152
3595
|
contractAddress: t,
|
|
3153
3596
|
recipient: n,
|
|
3154
3597
|
toChecksumAddress: a,
|
|
3155
3598
|
calldata: {
|
|
3156
|
-
amount:
|
|
3599
|
+
amount: s,
|
|
3157
3600
|
amountOutMin: r = "",
|
|
3158
|
-
data:
|
|
3159
|
-
deadline:
|
|
3160
|
-
memo:
|
|
3161
|
-
router:
|
|
3162
|
-
memoStreamingSwap:
|
|
3163
|
-
tcMemo:
|
|
3164
|
-
tcRouter:
|
|
3165
|
-
tcVault:
|
|
3166
|
-
vault:
|
|
3167
|
-
token:
|
|
3601
|
+
data: o = "",
|
|
3602
|
+
deadline: p,
|
|
3603
|
+
memo: d,
|
|
3604
|
+
router: u,
|
|
3605
|
+
memoStreamingSwap: l,
|
|
3606
|
+
tcMemo: m,
|
|
3607
|
+
tcRouter: _,
|
|
3608
|
+
tcVault: b,
|
|
3609
|
+
vault: A,
|
|
3610
|
+
token: E
|
|
3168
3611
|
}
|
|
3169
3612
|
}) => {
|
|
3170
|
-
const
|
|
3171
|
-
if (
|
|
3613
|
+
const O = !!Fe[t.toLowerCase()];
|
|
3614
|
+
if (O && !u)
|
|
3172
3615
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3173
|
-
const S =
|
|
3174
|
-
if (!
|
|
3616
|
+
const S = m || d, D = e && l || S;
|
|
3617
|
+
if (!b && !A)
|
|
3175
3618
|
throw new Error("TC Vault is required on calldata");
|
|
3176
|
-
if (!
|
|
3619
|
+
if (!_ && !u)
|
|
3177
3620
|
throw new Error("TC Router is required on calldata");
|
|
3178
|
-
if (!
|
|
3621
|
+
if (!D)
|
|
3179
3622
|
throw new Error("TC Memo is required on calldata");
|
|
3180
|
-
if (!
|
|
3623
|
+
if (!E)
|
|
3181
3624
|
throw new Error("Token is required on calldata");
|
|
3182
|
-
const
|
|
3625
|
+
const ie = [
|
|
3183
3626
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3184
|
-
a(
|
|
3185
|
-
a(
|
|
3186
|
-
|
|
3187
|
-
a(
|
|
3188
|
-
|
|
3189
|
-
],
|
|
3190
|
-
return [...
|
|
3191
|
-
},
|
|
3192
|
-
const n =
|
|
3627
|
+
a(_ || u),
|
|
3628
|
+
a(b || A),
|
|
3629
|
+
D.replace("{recipientAddress}", n),
|
|
3630
|
+
a(E),
|
|
3631
|
+
s
|
|
3632
|
+
], Ge = O ? [a(u), o, p] : [r, p];
|
|
3633
|
+
return [...ie, ...Ge];
|
|
3634
|
+
}, cn = ({ chain: e, txHash: t }) => {
|
|
3635
|
+
const n = Ne[e];
|
|
3193
3636
|
switch (e) {
|
|
3194
|
-
case
|
|
3195
|
-
case
|
|
3196
|
-
case
|
|
3197
|
-
case
|
|
3198
|
-
case
|
|
3199
|
-
case
|
|
3200
|
-
return `${n}/tx/${t}`;
|
|
3201
|
-
case
|
|
3202
|
-
case
|
|
3203
|
-
case
|
|
3204
|
-
case
|
|
3205
|
-
case
|
|
3206
|
-
case
|
|
3637
|
+
case i.Binance:
|
|
3638
|
+
case i.Bitcoin:
|
|
3639
|
+
case i.BitcoinCash:
|
|
3640
|
+
case i.Maya:
|
|
3641
|
+
case i.Kujira:
|
|
3642
|
+
case i.THORChain:
|
|
3643
|
+
return `${n}/tx/${t.startsWith("0x") ? t.slice(2) : t}`;
|
|
3644
|
+
case i.Arbitrum:
|
|
3645
|
+
case i.Avalanche:
|
|
3646
|
+
case i.BinanceSmartChain:
|
|
3647
|
+
case i.Ethereum:
|
|
3648
|
+
case i.Optimism:
|
|
3649
|
+
case i.Polygon:
|
|
3207
3650
|
return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
|
|
3208
|
-
case
|
|
3651
|
+
case i.Cosmos:
|
|
3209
3652
|
return `${n}/transactions/${t}`;
|
|
3210
|
-
case
|
|
3653
|
+
case i.Dogecoin:
|
|
3211
3654
|
return `${n}/transaction/${t.toLowerCase()}`;
|
|
3212
|
-
case
|
|
3655
|
+
case i.Litecoin:
|
|
3213
3656
|
return `${n}/${t}`;
|
|
3214
3657
|
default:
|
|
3215
3658
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3216
3659
|
}
|
|
3217
|
-
},
|
|
3218
|
-
const n =
|
|
3660
|
+
}, mn = ({ chain: e, address: t }) => {
|
|
3661
|
+
const n = Ne[e];
|
|
3219
3662
|
switch (e) {
|
|
3220
|
-
case
|
|
3221
|
-
case
|
|
3222
|
-
case
|
|
3223
|
-
case
|
|
3224
|
-
case
|
|
3225
|
-
case
|
|
3226
|
-
case
|
|
3227
|
-
case
|
|
3228
|
-
case
|
|
3229
|
-
case
|
|
3230
|
-
case
|
|
3231
|
-
case
|
|
3232
|
-
case
|
|
3663
|
+
case i.Arbitrum:
|
|
3664
|
+
case i.Avalanche:
|
|
3665
|
+
case i.Binance:
|
|
3666
|
+
case i.BinanceSmartChain:
|
|
3667
|
+
case i.Bitcoin:
|
|
3668
|
+
case i.BitcoinCash:
|
|
3669
|
+
case i.Dogecoin:
|
|
3670
|
+
case i.Ethereum:
|
|
3671
|
+
case i.Maya:
|
|
3672
|
+
case i.Optimism:
|
|
3673
|
+
case i.Polygon:
|
|
3674
|
+
case i.Kujira:
|
|
3675
|
+
case i.THORChain:
|
|
3233
3676
|
return `${n}/address/${t}`;
|
|
3234
|
-
case
|
|
3677
|
+
case i.Cosmos:
|
|
3235
3678
|
return `${n}/account/${t}`;
|
|
3236
|
-
case
|
|
3679
|
+
case i.Litecoin:
|
|
3237
3680
|
return `${n}/${t}`;
|
|
3238
3681
|
default:
|
|
3239
3682
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3240
3683
|
}
|
|
3241
|
-
},
|
|
3684
|
+
}, Tn = (e) => {
|
|
3242
3685
|
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3243
|
-
return
|
|
3244
|
-
},
|
|
3686
|
+
return Ae.get(`${t}/thorchain/inbound_addresses`);
|
|
3687
|
+
}, hn = (e) => {
|
|
3245
3688
|
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3246
|
-
return
|
|
3247
|
-
},
|
|
3689
|
+
return Ae.get(`${t}/thorchain/mimir`);
|
|
3690
|
+
}, Ie = () => Object.values(i).reduce(
|
|
3248
3691
|
(e, t) => (e[t] = null, e),
|
|
3249
3692
|
{}
|
|
3250
|
-
)
|
|
3251
|
-
|
|
3252
|
-
|
|
3693
|
+
), _n = async ({
|
|
3694
|
+
chain: e,
|
|
3695
|
+
address: t
|
|
3696
|
+
}) => {
|
|
3697
|
+
if (!t)
|
|
3698
|
+
return !1;
|
|
3699
|
+
switch (e) {
|
|
3700
|
+
case i.Bitcoin:
|
|
3701
|
+
return !t.startsWith("bc1p");
|
|
3702
|
+
default:
|
|
3703
|
+
return !0;
|
|
3704
|
+
}
|
|
3705
|
+
};
|
|
3706
|
+
var V, ne, j, v, K, Y;
|
|
3707
|
+
class Vn {
|
|
3253
3708
|
constructor({ stagenet: t } = {}) {
|
|
3254
|
-
T(this, "connectedChains",
|
|
3255
|
-
T(this, "connectedWallets",
|
|
3709
|
+
T(this, "connectedChains", Ie());
|
|
3710
|
+
T(this, "connectedWallets", Ie());
|
|
3256
3711
|
T(this, "stagenet", !1);
|
|
3257
3712
|
T(this, "getAddress", (t) => {
|
|
3258
3713
|
var n;
|
|
3259
3714
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3260
3715
|
});
|
|
3261
|
-
T(this, "getExplorerTxUrl", (t, n) =>
|
|
3716
|
+
T(this, "getExplorerTxUrl", (t, n) => cn({ chain: t, txHash: n }));
|
|
3262
3717
|
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3263
|
-
T(this, "getExplorerAddressUrl", (t, n) =>
|
|
3718
|
+
T(this, "getExplorerAddressUrl", (t, n) => mn({ chain: t, address: n }));
|
|
3264
3719
|
T(this, "getBalance", async (t, n) => {
|
|
3265
|
-
|
|
3266
|
-
if (!n)
|
|
3267
|
-
return ((i = this.connectedChains[t]) == null ? void 0 : i.balance) || [];
|
|
3268
|
-
const a = await this.getWalletByChain(t);
|
|
3720
|
+
const a = await this.getWalletByChain(t, n);
|
|
3269
3721
|
return (a == null ? void 0 : a.balance) || [];
|
|
3270
3722
|
});
|
|
3271
|
-
T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey:
|
|
3272
|
-
var
|
|
3273
|
-
const { quoteMode: r } = a.meta,
|
|
3723
|
+
T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
|
|
3724
|
+
var p, d;
|
|
3725
|
+
const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
|
|
3274
3726
|
if (!a.complete)
|
|
3275
|
-
throw new
|
|
3727
|
+
throw new c("core_swap_route_not_complete");
|
|
3276
3728
|
try {
|
|
3277
|
-
if (
|
|
3278
|
-
const u = this.connectedWallets[
|
|
3729
|
+
if (Ze.includes(r)) {
|
|
3730
|
+
const u = this.connectedWallets[o];
|
|
3279
3731
|
if (!(u != null && u.sendTransaction))
|
|
3280
|
-
throw new
|
|
3281
|
-
if (!(t ? (
|
|
3282
|
-
throw new
|
|
3283
|
-
const {
|
|
3284
|
-
data:
|
|
3285
|
-
from:
|
|
3286
|
-
to:
|
|
3287
|
-
chainId: BigInt(
|
|
3288
|
-
value:
|
|
3289
|
-
value: _(b) ? b : O(b, "wei").toString(16)
|
|
3290
|
-
}).baseValueBigInt : 0n
|
|
3732
|
+
throw new c("core_wallet_connection_not_found");
|
|
3733
|
+
if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
|
|
3734
|
+
throw new c("core_swap_route_transaction_not_found");
|
|
3735
|
+
const { data: m, from: _, to: b, value: A } = a.transaction, E = {
|
|
3736
|
+
data: m,
|
|
3737
|
+
from: _,
|
|
3738
|
+
to: b.toLowerCase(),
|
|
3739
|
+
chainId: BigInt(pt[o]),
|
|
3740
|
+
value: A ? BigInt(A) : 0n
|
|
3291
3741
|
};
|
|
3292
|
-
return u.sendTransaction(
|
|
3742
|
+
return u.sendTransaction(E, s);
|
|
3293
3743
|
}
|
|
3294
|
-
if (
|
|
3744
|
+
if (tt.includes(r)) {
|
|
3295
3745
|
if (!a.calldata.fromAsset)
|
|
3296
|
-
throw new
|
|
3297
|
-
const u = await
|
|
3746
|
+
throw new c("core_swap_asset_not_recognized");
|
|
3747
|
+
const u = await N.fromString(a.calldata.fromAsset);
|
|
3298
3748
|
if (!u)
|
|
3299
|
-
throw new
|
|
3300
|
-
const { address:
|
|
3301
|
-
contract:
|
|
3302
|
-
calldata: { amountIn:
|
|
3303
|
-
} = a,
|
|
3304
|
-
return this.deposit({
|
|
3749
|
+
throw new c("core_swap_asset_not_recognized");
|
|
3750
|
+
const { address: l } = await f(this, V).call(this, u.chain), {
|
|
3751
|
+
contract: m,
|
|
3752
|
+
calldata: { expiration: _, amountIn: b, memo: A, memoStreamingSwap: E }
|
|
3753
|
+
} = a, O = u.add(x.fromBigInt(BigInt(b), u.decimal)), S = t && E || A;
|
|
3754
|
+
return this.deposit({
|
|
3755
|
+
expiration: _,
|
|
3756
|
+
assetValue: O,
|
|
3757
|
+
memo: S,
|
|
3758
|
+
feeOptionKey: s,
|
|
3759
|
+
router: m,
|
|
3760
|
+
recipient: l
|
|
3761
|
+
});
|
|
3305
3762
|
}
|
|
3306
|
-
if (
|
|
3307
|
-
const { calldata: u, contract:
|
|
3308
|
-
if (!
|
|
3309
|
-
throw new
|
|
3310
|
-
const
|
|
3311
|
-
if (!(
|
|
3312
|
-
throw new
|
|
3313
|
-
const { getProvider:
|
|
3314
|
-
if (!
|
|
3315
|
-
throw new
|
|
3316
|
-
const
|
|
3317
|
-
|
|
3318
|
-
...Nt({
|
|
3763
|
+
if (et.includes(r)) {
|
|
3764
|
+
const { calldata: u, contract: l } = a;
|
|
3765
|
+
if (!l)
|
|
3766
|
+
throw new c("core_swap_contract_not_found");
|
|
3767
|
+
const m = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3768
|
+
if (!(m != null && m.sendTransaction) || !_)
|
|
3769
|
+
throw new c("core_wallet_connection_not_found");
|
|
3770
|
+
const { getProvider: b, toChecksumAddress: A } = await import("@swapkit/toolbox-evm"), E = b(o), O = ln[l.toLowerCase()];
|
|
3771
|
+
if (!O)
|
|
3772
|
+
throw new c("core_swap_contract_not_supported", { contractAddress: l });
|
|
3773
|
+
const D = await (await ((d = m.createContract) == null ? void 0 : d.call(m, l, O, E))).getFunction("swapIn").populateTransaction(
|
|
3774
|
+
...yn({
|
|
3319
3775
|
streamSwap: t,
|
|
3320
|
-
toChecksumAddress:
|
|
3321
|
-
contractAddress:
|
|
3776
|
+
toChecksumAddress: A,
|
|
3777
|
+
contractAddress: l,
|
|
3322
3778
|
recipient: n,
|
|
3323
3779
|
calldata: u
|
|
3324
3780
|
}),
|
|
3325
|
-
{ from:
|
|
3326
|
-
)
|
|
3327
|
-
return
|
|
3781
|
+
{ from: _ }
|
|
3782
|
+
);
|
|
3783
|
+
return m.sendTransaction(D, s);
|
|
3328
3784
|
}
|
|
3329
|
-
throw new
|
|
3785
|
+
throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3330
3786
|
} catch (u) {
|
|
3331
|
-
throw new
|
|
3787
|
+
throw new c("core_swap_transaction_error", u);
|
|
3332
3788
|
}
|
|
3333
3789
|
});
|
|
3334
|
-
T(this, "getWalletByChain", async (t) => {
|
|
3335
|
-
var
|
|
3336
|
-
const
|
|
3337
|
-
if (!
|
|
3790
|
+
T(this, "getWalletByChain", async (t, n) => {
|
|
3791
|
+
var o, p;
|
|
3792
|
+
const a = this.getAddress(t);
|
|
3793
|
+
if (!a)
|
|
3338
3794
|
return null;
|
|
3339
|
-
const
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3795
|
+
const s = [N.fromChainOrSignature(t)], r = (o = this.connectedChains[t]) == null ? void 0 : o.walletType;
|
|
3796
|
+
try {
|
|
3797
|
+
const d = await ((p = this.getWallet(t)) == null ? void 0 : p.getBalance(a, n));
|
|
3798
|
+
return this.connectedChains[t] = {
|
|
3799
|
+
address: a,
|
|
3800
|
+
balance: d != null && d.length ? d : s,
|
|
3801
|
+
walletType: r
|
|
3802
|
+
}, { ...this.connectedChains[t] };
|
|
3803
|
+
} catch (d) {
|
|
3804
|
+
return console.error(d), { address: a, balance: s, walletType: r };
|
|
3805
|
+
}
|
|
3347
3806
|
});
|
|
3348
|
-
T(this, "approveAssetValue", (t, n) =>
|
|
3349
|
-
T(this, "isAssetValueApproved", (t, n) =>
|
|
3807
|
+
T(this, "approveAssetValue", (t, n) => f(this, j).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
3808
|
+
T(this, "isAssetValueApproved", (t, n) => f(this, j).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
3350
3809
|
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3351
|
-
var a,
|
|
3352
|
-
return (
|
|
3810
|
+
var a, s;
|
|
3811
|
+
return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
|
|
3353
3812
|
});
|
|
3354
3813
|
T(this, "transfer", async (t) => {
|
|
3355
3814
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
3356
3815
|
if (!n)
|
|
3357
|
-
throw new
|
|
3816
|
+
throw new c("core_wallet_connection_not_found");
|
|
3358
3817
|
try {
|
|
3359
|
-
return await n.transfer(
|
|
3818
|
+
return await n.transfer(f(this, Y).call(this, t));
|
|
3360
3819
|
} catch (a) {
|
|
3361
|
-
throw new
|
|
3820
|
+
throw new c("core_swap_transaction_error", a);
|
|
3362
3821
|
}
|
|
3363
3822
|
});
|
|
3364
3823
|
T(this, "deposit", async ({
|
|
3365
3824
|
assetValue: t,
|
|
3366
3825
|
recipient: n,
|
|
3367
3826
|
router: a,
|
|
3368
|
-
...
|
|
3827
|
+
...s
|
|
3369
3828
|
}) => {
|
|
3370
|
-
const { chain: r, symbol:
|
|
3371
|
-
if (!
|
|
3372
|
-
throw new
|
|
3373
|
-
|
|
3829
|
+
const { chain: r, symbol: o, ticker: p } = t, d = this.connectedWallets[r];
|
|
3830
|
+
if (!await _n({ address: await (d == null ? void 0 : d.getAddress()), chain: r }))
|
|
3831
|
+
throw new c("core_transaction_invalid_sender_address");
|
|
3832
|
+
if (!d)
|
|
3833
|
+
throw new c("core_wallet_connection_not_found");
|
|
3834
|
+
const u = f(this, Y).call(this, { assetValue: t, recipient: n, router: a, ...s });
|
|
3374
3835
|
try {
|
|
3375
3836
|
switch (r) {
|
|
3376
|
-
case
|
|
3377
|
-
const
|
|
3378
|
-
return await (n === "" ?
|
|
3837
|
+
case i.THORChain: {
|
|
3838
|
+
const l = d;
|
|
3839
|
+
return await (n === "" ? l.deposit(u) : l.transfer(u));
|
|
3379
3840
|
}
|
|
3380
|
-
case
|
|
3381
|
-
case
|
|
3382
|
-
case
|
|
3383
|
-
const { getChecksumAddressFromAsset:
|
|
3384
|
-
return await
|
|
3385
|
-
abi:
|
|
3386
|
-
contractAddress: a || (await
|
|
3841
|
+
case i.Ethereum:
|
|
3842
|
+
case i.BinanceSmartChain:
|
|
3843
|
+
case i.Avalanche: {
|
|
3844
|
+
const { getChecksumAddressFromAsset: l } = await import("@swapkit/toolbox-evm"), m = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Xe;
|
|
3845
|
+
return await d.call({
|
|
3846
|
+
abi: m,
|
|
3847
|
+
contractAddress: a || (await f(this, V).call(this, r)).router,
|
|
3387
3848
|
funcName: "depositWithExpiry",
|
|
3388
3849
|
funcParams: [
|
|
3389
3850
|
n,
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
i.expiration
|
|
3851
|
+
l({ chain: r, symbol: o, ticker: p }, r),
|
|
3852
|
+
t.getBaseValue("string"),
|
|
3853
|
+
u.memo,
|
|
3854
|
+
s.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
3395
3855
|
],
|
|
3396
|
-
txOverrides: {
|
|
3856
|
+
txOverrides: {
|
|
3857
|
+
from: u.from,
|
|
3858
|
+
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
3859
|
+
}
|
|
3397
3860
|
});
|
|
3398
3861
|
}
|
|
3399
3862
|
default:
|
|
3400
|
-
return await
|
|
3863
|
+
return await d.transfer(u);
|
|
3401
3864
|
}
|
|
3402
|
-
} catch (
|
|
3403
|
-
const
|
|
3404
|
-
throw new
|
|
3865
|
+
} catch (l) {
|
|
3866
|
+
const m = ((l == null ? void 0 : l.message) || (l == null ? void 0 : l.toString())).toLowerCase(), _ = m == null ? void 0 : m.includes("insufficient funds"), b = m == null ? void 0 : m.includes("gas"), A = m == null ? void 0 : m.includes("server"), E = _ ? "core_transaction_deposit_insufficient_funds_error" : b ? "core_transaction_deposit_gas_error" : A ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
|
|
3867
|
+
throw new c(E, l);
|
|
3405
3868
|
}
|
|
3406
3869
|
});
|
|
3407
3870
|
/**
|
|
@@ -3412,115 +3875,121 @@ class en {
|
|
|
3412
3875
|
assetValue: n
|
|
3413
3876
|
}) => {
|
|
3414
3877
|
if (t.lte(0) || n.lte(0))
|
|
3415
|
-
throw new
|
|
3416
|
-
let a = "",
|
|
3878
|
+
throw new c("core_transaction_create_liquidity_invalid_params");
|
|
3879
|
+
let a = "", s = "";
|
|
3417
3880
|
try {
|
|
3418
|
-
a = await
|
|
3881
|
+
a = await f(this, v).call(this, {
|
|
3419
3882
|
assetValue: t,
|
|
3420
|
-
memo:
|
|
3883
|
+
memo: M(h.DEPOSIT, {
|
|
3421
3884
|
...n,
|
|
3422
3885
|
address: this.getAddress(n.chain)
|
|
3423
3886
|
})
|
|
3424
3887
|
});
|
|
3425
3888
|
} catch (r) {
|
|
3426
|
-
throw new
|
|
3889
|
+
throw new c("core_transaction_create_liquidity_rune_error", r);
|
|
3427
3890
|
}
|
|
3428
3891
|
try {
|
|
3429
|
-
|
|
3892
|
+
s = await f(this, v).call(this, {
|
|
3430
3893
|
assetValue: n,
|
|
3431
|
-
memo:
|
|
3894
|
+
memo: M(h.DEPOSIT, {
|
|
3432
3895
|
...n,
|
|
3433
|
-
address: this.getAddress(
|
|
3896
|
+
address: this.getAddress(i.THORChain)
|
|
3434
3897
|
})
|
|
3435
3898
|
});
|
|
3436
3899
|
} catch (r) {
|
|
3437
|
-
throw new
|
|
3900
|
+
throw new c("core_transaction_create_liquidity_asset_error", r);
|
|
3438
3901
|
}
|
|
3439
|
-
return { runeTx: a, assetTx:
|
|
3902
|
+
return { runeTx: a, assetTx: s };
|
|
3440
3903
|
});
|
|
3441
3904
|
T(this, "addLiquidity", async ({
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
mode: d = "sym"
|
|
3905
|
+
runeAssetValue: t,
|
|
3906
|
+
assetValue: n,
|
|
3907
|
+
runeAddr: a,
|
|
3908
|
+
assetAddr: s,
|
|
3909
|
+
isPendingSymmAsset: r,
|
|
3910
|
+
mode: o = "sym"
|
|
3449
3911
|
}) => {
|
|
3450
|
-
const
|
|
3451
|
-
if (!
|
|
3452
|
-
throw new
|
|
3453
|
-
if (_ && !
|
|
3454
|
-
throw new
|
|
3455
|
-
let
|
|
3456
|
-
|
|
3457
|
-
if (u && n)
|
|
3912
|
+
const { chain: p, symbol: d } = n, u = o === "sym", l = (t == null ? void 0 : t.gt(0)) && (u || o === "rune"), m = (n == null ? void 0 : n.gt(0)) && (u || o === "asset"), _ = r || l, b = _ ? a || this.getAddress(i.THORChain) : "", A = u || o === "asset" ? s || this.getAddress(p) : "";
|
|
3913
|
+
if (!l && !m)
|
|
3914
|
+
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
3915
|
+
if (_ && !b)
|
|
3916
|
+
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
3917
|
+
let E, O;
|
|
3918
|
+
if (l && t)
|
|
3458
3919
|
try {
|
|
3459
|
-
|
|
3460
|
-
assetValue:
|
|
3461
|
-
memo:
|
|
3920
|
+
E = await f(this, v).call(this, {
|
|
3921
|
+
assetValue: t,
|
|
3922
|
+
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: A })
|
|
3462
3923
|
});
|
|
3463
|
-
} catch (
|
|
3464
|
-
throw new
|
|
3924
|
+
} catch (S) {
|
|
3925
|
+
throw new c("core_transaction_add_liquidity_rune_error", S);
|
|
3465
3926
|
}
|
|
3466
|
-
if (
|
|
3927
|
+
if (m && n)
|
|
3467
3928
|
try {
|
|
3468
|
-
|
|
3469
|
-
assetValue:
|
|
3470
|
-
memo:
|
|
3929
|
+
O = await f(this, v).call(this, {
|
|
3930
|
+
assetValue: n,
|
|
3931
|
+
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: b })
|
|
3471
3932
|
});
|
|
3472
|
-
} catch (
|
|
3473
|
-
throw new
|
|
3933
|
+
} catch (S) {
|
|
3934
|
+
throw new c("core_transaction_add_liquidity_asset_error", S);
|
|
3474
3935
|
}
|
|
3475
|
-
return { runeTx:
|
|
3936
|
+
return { runeTx: E, assetTx: O };
|
|
3937
|
+
});
|
|
3938
|
+
T(this, "addLiquidityPart", ({
|
|
3939
|
+
assetValue: t,
|
|
3940
|
+
poolAddress: n,
|
|
3941
|
+
address: a,
|
|
3942
|
+
symmetric: s
|
|
3943
|
+
}) => {
|
|
3944
|
+
if (s && !a)
|
|
3945
|
+
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
3946
|
+
const r = M(h.DEPOSIT, {
|
|
3947
|
+
chain: n.split(".")[0],
|
|
3948
|
+
symbol: n.split(".")[1],
|
|
3949
|
+
address: s ? a : ""
|
|
3950
|
+
});
|
|
3951
|
+
return f(this, v).call(this, { assetValue: t, memo: r });
|
|
3476
3952
|
});
|
|
3477
3953
|
T(this, "withdraw", async ({
|
|
3478
3954
|
memo: t,
|
|
3479
3955
|
assetValue: n,
|
|
3480
3956
|
percent: a,
|
|
3481
|
-
from:
|
|
3957
|
+
from: s,
|
|
3482
3958
|
to: r
|
|
3483
3959
|
}) => {
|
|
3484
|
-
const
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
targetAssetString: p == null ? void 0 : p.toString(),
|
|
3494
|
-
singleSide: !1
|
|
3495
|
-
})
|
|
3496
|
-
});
|
|
3497
|
-
} catch (d) {
|
|
3498
|
-
throw new m("core_transaction_withdraw_error", d);
|
|
3499
|
-
}
|
|
3960
|
+
const o = r === "rune" ? N.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n, p = ue(s === "asset" ? n.chain : i.THORChain), d = t || M(h.WITHDRAW, {
|
|
3961
|
+
symbol: n.symbol,
|
|
3962
|
+
chain: n.chain,
|
|
3963
|
+
ticker: n.ticker,
|
|
3964
|
+
basisPoints: Math.max(1e4, Math.round(a * 100)),
|
|
3965
|
+
targetAssetString: o == null ? void 0 : o.toString(),
|
|
3966
|
+
singleSide: !1
|
|
3967
|
+
});
|
|
3968
|
+
return f(this, v).call(this, { assetValue: p, memo: d });
|
|
3500
3969
|
});
|
|
3501
3970
|
T(this, "savings", async ({
|
|
3502
3971
|
assetValue: t,
|
|
3503
3972
|
memo: n,
|
|
3504
3973
|
percent: a,
|
|
3505
|
-
type:
|
|
3974
|
+
type: s
|
|
3506
3975
|
}) => {
|
|
3507
|
-
const r =
|
|
3976
|
+
const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || M(r, {
|
|
3508
3977
|
ticker: t.ticker,
|
|
3509
3978
|
symbol: t.symbol,
|
|
3510
3979
|
chain: t.chain,
|
|
3511
3980
|
singleSide: !0,
|
|
3512
|
-
basisPoints: a ? Math.
|
|
3513
|
-
});
|
|
3514
|
-
return
|
|
3981
|
+
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
3982
|
+
}), p = r === h.DEPOSIT ? t : ue(t.chain);
|
|
3983
|
+
return f(this, v).call(this, { memo: o, assetValue: p });
|
|
3515
3984
|
});
|
|
3516
3985
|
T(this, "loan", ({
|
|
3517
3986
|
assetValue: t,
|
|
3518
3987
|
memo: n,
|
|
3519
3988
|
minAmount: a,
|
|
3520
|
-
type:
|
|
3521
|
-
}) =>
|
|
3989
|
+
type: s
|
|
3990
|
+
}) => f(this, v).call(this, {
|
|
3522
3991
|
assetValue: t,
|
|
3523
|
-
memo: n ||
|
|
3992
|
+
memo: n || M(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
|
|
3524
3993
|
asset: t.toString(),
|
|
3525
3994
|
minAmount: a.toString(),
|
|
3526
3995
|
address: this.getAddress(t.chain)
|
|
@@ -3531,31 +4000,31 @@ class en {
|
|
|
3531
4000
|
assetValue: n,
|
|
3532
4001
|
address: a
|
|
3533
4002
|
}) => {
|
|
3534
|
-
const
|
|
4003
|
+
const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = M(s, {
|
|
3535
4004
|
address: a,
|
|
3536
|
-
unbondAmount: t === "unbond" ? n.
|
|
4005
|
+
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
3537
4006
|
});
|
|
3538
|
-
return
|
|
4007
|
+
return f(this, K).call(this, {
|
|
3539
4008
|
memo: r,
|
|
3540
|
-
assetValue: t === "bond" ? n :
|
|
4009
|
+
assetValue: t === "bond" ? n : ue(i.THORChain)
|
|
3541
4010
|
});
|
|
3542
4011
|
});
|
|
3543
4012
|
T(this, "registerThorname", ({
|
|
3544
4013
|
assetValue: t,
|
|
3545
4014
|
...n
|
|
3546
|
-
}) =>
|
|
3547
|
-
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls:
|
|
4015
|
+
}) => f(this, K).call(this, { assetValue: t, memo: M(h.THORNAME_REGISTER, n) }));
|
|
4016
|
+
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
|
|
3548
4017
|
try {
|
|
3549
4018
|
t.forEach((r) => {
|
|
3550
4019
|
this[r.connectMethodName] = r.connect({
|
|
3551
|
-
addChain:
|
|
4020
|
+
addChain: f(this, ne),
|
|
3552
4021
|
config: n || {},
|
|
3553
4022
|
apis: a,
|
|
3554
|
-
rpcUrls:
|
|
4023
|
+
rpcUrls: s
|
|
3555
4024
|
});
|
|
3556
4025
|
});
|
|
3557
4026
|
} catch (r) {
|
|
3558
|
-
throw new
|
|
4027
|
+
throw new c("core_extend_error", r);
|
|
3559
4028
|
}
|
|
3560
4029
|
});
|
|
3561
4030
|
T(this, "estimateMaxSendableAmount", async ({
|
|
@@ -3564,132 +4033,132 @@ class en {
|
|
|
3564
4033
|
}) => {
|
|
3565
4034
|
const a = this.getWallet(t);
|
|
3566
4035
|
switch (t) {
|
|
3567
|
-
case
|
|
3568
|
-
case
|
|
3569
|
-
case
|
|
3570
|
-
case
|
|
3571
|
-
case
|
|
3572
|
-
case
|
|
3573
|
-
const { estimateMaxSendableAmount:
|
|
3574
|
-
return
|
|
4036
|
+
case i.Arbitrum:
|
|
4037
|
+
case i.Avalanche:
|
|
4038
|
+
case i.BinanceSmartChain:
|
|
4039
|
+
case i.Ethereum:
|
|
4040
|
+
case i.Optimism:
|
|
4041
|
+
case i.Polygon: {
|
|
4042
|
+
const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-evm");
|
|
4043
|
+
return s({
|
|
3575
4044
|
...n,
|
|
3576
4045
|
toolbox: a
|
|
3577
4046
|
});
|
|
3578
4047
|
}
|
|
3579
|
-
case
|
|
3580
|
-
case
|
|
3581
|
-
case
|
|
3582
|
-
case
|
|
4048
|
+
case i.Bitcoin:
|
|
4049
|
+
case i.BitcoinCash:
|
|
4050
|
+
case i.Dogecoin:
|
|
4051
|
+
case i.Litecoin:
|
|
3583
4052
|
return a.estimateMaxSendableAmount(n);
|
|
3584
|
-
case
|
|
3585
|
-
case
|
|
3586
|
-
case
|
|
3587
|
-
const { estimateMaxSendableAmount:
|
|
3588
|
-
return
|
|
4053
|
+
case i.Binance:
|
|
4054
|
+
case i.THORChain:
|
|
4055
|
+
case i.Cosmos: {
|
|
4056
|
+
const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-cosmos");
|
|
4057
|
+
return s({
|
|
3589
4058
|
...n,
|
|
3590
4059
|
toolbox: a
|
|
3591
4060
|
});
|
|
3592
4061
|
}
|
|
3593
4062
|
default:
|
|
3594
|
-
throw new
|
|
4063
|
+
throw new c("core_estimated_max_spendable_chain_not_supported");
|
|
3595
4064
|
}
|
|
3596
4065
|
});
|
|
3597
4066
|
/**
|
|
3598
4067
|
* Wallet connection methods
|
|
3599
4068
|
*/
|
|
3600
4069
|
T(this, "connectXDEFI", async (t) => {
|
|
3601
|
-
throw new
|
|
4070
|
+
throw new c("core_wallet_xdefi_not_installed");
|
|
3602
4071
|
});
|
|
3603
4072
|
T(this, "connectEVMWallet", async (t, n) => {
|
|
3604
|
-
throw new
|
|
4073
|
+
throw new c("core_wallet_evmwallet_not_installed");
|
|
3605
4074
|
});
|
|
3606
4075
|
T(this, "connectWalletconnect", async (t, n) => {
|
|
3607
|
-
throw new
|
|
4076
|
+
throw new c("core_wallet_walletconnect_not_installed");
|
|
3608
4077
|
});
|
|
3609
4078
|
T(this, "connectKeystore", async (t, n) => {
|
|
3610
|
-
throw new
|
|
4079
|
+
throw new c("core_wallet_keystore_not_installed");
|
|
3611
4080
|
});
|
|
3612
4081
|
T(this, "connectLedger", async (t, n) => {
|
|
3613
|
-
throw new
|
|
4082
|
+
throw new c("core_wallet_ledger_not_installed");
|
|
3614
4083
|
});
|
|
3615
4084
|
T(this, "connectTrezor", async (t, n) => {
|
|
3616
|
-
throw new
|
|
4085
|
+
throw new c("core_wallet_trezor_not_installed");
|
|
3617
4086
|
});
|
|
3618
4087
|
T(this, "connectKeplr", async (t) => {
|
|
3619
|
-
throw new
|
|
4088
|
+
throw new c("core_wallet_keplr_not_installed");
|
|
3620
4089
|
});
|
|
3621
4090
|
T(this, "connectOkx", async (t) => {
|
|
3622
|
-
throw new
|
|
4091
|
+
throw new c("core_wallet_okx_not_installed");
|
|
3623
4092
|
});
|
|
3624
4093
|
T(this, "disconnectChain", (t) => {
|
|
3625
4094
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
3626
4095
|
});
|
|
3627
4096
|
P(this, V, async (t) => {
|
|
3628
|
-
if (t ===
|
|
4097
|
+
if (t === i.THORChain)
|
|
3629
4098
|
return {
|
|
3630
4099
|
gas_rate: "0",
|
|
3631
4100
|
router: "0",
|
|
3632
4101
|
address: "",
|
|
3633
4102
|
halted: !1,
|
|
3634
|
-
chain:
|
|
4103
|
+
chain: i.THORChain
|
|
3635
4104
|
};
|
|
3636
|
-
const a = (await
|
|
4105
|
+
const a = (await Tn(this.stagenet)).find((s) => s.chain === t);
|
|
3637
4106
|
if (!a)
|
|
3638
|
-
throw new
|
|
4107
|
+
throw new c("core_inbound_data_not_found");
|
|
3639
4108
|
if (a != null && a.halted)
|
|
3640
|
-
throw new
|
|
4109
|
+
throw new c("core_chain_halted");
|
|
3641
4110
|
return a;
|
|
3642
4111
|
});
|
|
3643
|
-
P(this,
|
|
4112
|
+
P(this, ne, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
3644
4113
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
3645
4114
|
});
|
|
3646
|
-
P(this,
|
|
3647
|
-
assetValue:
|
|
3648
|
-
type:
|
|
3649
|
-
contractAddress:
|
|
4115
|
+
P(this, j, async ({
|
|
4116
|
+
assetValue: t,
|
|
4117
|
+
type: n = "checkOnly",
|
|
4118
|
+
contractAddress: a
|
|
3650
4119
|
}) => {
|
|
3651
|
-
const
|
|
3652
|
-
if (
|
|
4120
|
+
const { address: s, chain: r, isGasAsset: o, isSynthetic: p } = t, d = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(r);
|
|
4121
|
+
if (d && o || !d || p)
|
|
3653
4122
|
return !0;
|
|
3654
|
-
const
|
|
3655
|
-
if (!
|
|
3656
|
-
throw new
|
|
3657
|
-
const
|
|
3658
|
-
if (!
|
|
3659
|
-
throw new
|
|
3660
|
-
const
|
|
3661
|
-
return
|
|
3662
|
-
amount: t,
|
|
3663
|
-
assetAddress:
|
|
3664
|
-
from:
|
|
3665
|
-
spenderAddress:
|
|
4123
|
+
const l = this.connectedWallets[r], m = n === "checkOnly" ? l == null ? void 0 : l.isApproved : l == null ? void 0 : l.approve;
|
|
4124
|
+
if (!m)
|
|
4125
|
+
throw new c("core_wallet_connection_not_found");
|
|
4126
|
+
const _ = this.getAddress(r);
|
|
4127
|
+
if (!s || !_)
|
|
4128
|
+
throw new c("core_approve_asset_address_or_from_not_found");
|
|
4129
|
+
const b = a || (await f(this, V).call(this, r)).router;
|
|
4130
|
+
return m({
|
|
4131
|
+
amount: t.getBaseValue("bigint"),
|
|
4132
|
+
assetAddress: s,
|
|
4133
|
+
from: _,
|
|
4134
|
+
spenderAddress: b
|
|
3666
4135
|
});
|
|
3667
4136
|
});
|
|
3668
|
-
P(this,
|
|
4137
|
+
P(this, v, async ({
|
|
3669
4138
|
assetValue: t,
|
|
3670
4139
|
memo: n,
|
|
3671
4140
|
feeOptionKey: a = F.Fast
|
|
3672
4141
|
}) => {
|
|
3673
4142
|
const {
|
|
3674
|
-
gas_rate:
|
|
4143
|
+
gas_rate: s,
|
|
3675
4144
|
router: r,
|
|
3676
|
-
address:
|
|
3677
|
-
} = await
|
|
4145
|
+
address: o
|
|
4146
|
+
} = await f(this, V).call(this, t.chain), p = (parseInt(s) || 0) * wt[a];
|
|
3678
4147
|
return this.deposit({
|
|
3679
4148
|
assetValue: t,
|
|
3680
|
-
recipient:
|
|
4149
|
+
recipient: o,
|
|
3681
4150
|
memo: n,
|
|
3682
4151
|
router: r,
|
|
3683
|
-
feeRate:
|
|
4152
|
+
feeRate: p
|
|
3684
4153
|
});
|
|
3685
4154
|
});
|
|
3686
|
-
P(this,
|
|
3687
|
-
const a = await
|
|
4155
|
+
P(this, K, async ({ memo: t, assetValue: n }) => {
|
|
4156
|
+
const a = await hn(this.stagenet);
|
|
3688
4157
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
3689
|
-
throw new
|
|
4158
|
+
throw new c("core_chain_halted");
|
|
3690
4159
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
3691
4160
|
});
|
|
3692
|
-
P(this,
|
|
4161
|
+
P(this, Y, ({ assetValue: t, ...n }) => ({
|
|
3693
4162
|
...n,
|
|
3694
4163
|
memo: n.memo || "",
|
|
3695
4164
|
from: this.getAddress(t.chain),
|
|
@@ -3698,65 +4167,66 @@ class en {
|
|
|
3698
4167
|
this.stagenet = !!t;
|
|
3699
4168
|
}
|
|
3700
4169
|
}
|
|
3701
|
-
V = new WeakMap(),
|
|
4170
|
+
V = new WeakMap(), ne = new WeakMap(), j = new WeakMap(), v = new WeakMap(), K = new WeakMap(), Y = new WeakMap();
|
|
3702
4171
|
export {
|
|
3703
|
-
|
|
3704
|
-
|
|
4172
|
+
Ze as AGG_SWAP,
|
|
4173
|
+
wn as ApiError,
|
|
3705
4174
|
q as ApiUrl,
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
4175
|
+
N as AssetValue,
|
|
4176
|
+
w as BaseDecimal,
|
|
4177
|
+
me as BigIntArithmetics,
|
|
4178
|
+
i as Chain,
|
|
4179
|
+
fe as ChainId,
|
|
4180
|
+
Sn as ChainIdToChain,
|
|
4181
|
+
pt as ChainToChainId,
|
|
4182
|
+
Ne as ChainToExplorerUrl,
|
|
4183
|
+
On as ChainToHexChainId,
|
|
4184
|
+
dt as ChainToRPC,
|
|
4185
|
+
st as ContractAddress,
|
|
4186
|
+
Rn as CosmosChainList,
|
|
4187
|
+
it as DerivationPath,
|
|
4188
|
+
y as ERROR_CODE,
|
|
4189
|
+
nt as ERROR_MODULE,
|
|
4190
|
+
ve as ERROR_TYPE,
|
|
4191
|
+
rt as EVMChainList,
|
|
4192
|
+
ut as ErrorCode,
|
|
3724
4193
|
F as FeeOption,
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
4194
|
+
h as MemoType,
|
|
4195
|
+
An as NetworkDerivationPath,
|
|
4196
|
+
ze as QuoteMode,
|
|
4197
|
+
Me as RPCUrl,
|
|
4198
|
+
Ae as RequestClient,
|
|
4199
|
+
et as SWAP_IN,
|
|
4200
|
+
tt as SWAP_OUT,
|
|
4201
|
+
Vn as SwapKitCore,
|
|
4202
|
+
c as SwapKitError,
|
|
4203
|
+
x as SwapKitNumber,
|
|
4204
|
+
Je as TCAvalancheDepositABI,
|
|
4205
|
+
Qe as TCBscDepositABI,
|
|
4206
|
+
Xe as TCEthereumVaultAbi,
|
|
4207
|
+
gn as TCSupportedChainList,
|
|
4208
|
+
En as UTXOChainList,
|
|
4209
|
+
lt as WalletOption,
|
|
4210
|
+
In as assetFromString,
|
|
4211
|
+
Ln as derivationPathToString,
|
|
4212
|
+
bn as erc20ABI,
|
|
4213
|
+
vn as filterAssets,
|
|
4214
|
+
se as formatBigIntToSafeValue,
|
|
4215
|
+
wt as gasFeeMultiplier,
|
|
4216
|
+
Et as getAssetType,
|
|
4217
|
+
St as getAsymmetricAssetShare,
|
|
4218
|
+
Mn as getAsymmetricAssetWithdrawAmount,
|
|
4219
|
+
Ot as getAsymmetricRuneShare,
|
|
4220
|
+
Cn as getAsymmetricRuneWithdrawAmount,
|
|
4221
|
+
At as getCommonAssetInfo,
|
|
4222
|
+
bt as getDecimal,
|
|
4223
|
+
xn as getEstimatedPoolShare,
|
|
4224
|
+
Dn as getLiquiditySlippage,
|
|
4225
|
+
M as getMemoFor,
|
|
4226
|
+
ue as getMinAmountByChain,
|
|
4227
|
+
It as getSymmetricPoolShare,
|
|
4228
|
+
Nn as getSymmetricWithdraw,
|
|
4229
|
+
Pn as getTHORNameCost,
|
|
4230
|
+
De as isGasAsset,
|
|
4231
|
+
Bn as validateTHORName
|
|
3762
4232
|
};
|