@swapkit/core 1.0.0-rc.6 → 1.0.0-rc.8
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.es.js +606 -569
- package/package.json +13 -13
package/dist/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var Ce = (e, t, n) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var m = (e, t, n) => (Ce(e, typeof t != "symbol" ? t + "" : t, n), n), Ne = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var A = (e, t, n) => (
|
|
7
|
+
var A = (e, t, n) => (Ne(e, t, "read from private field"), n ? n.call(e) : t.get(e)), B = (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 xe = Object.defineProperty,
|
|
13
|
-
const
|
|
12
|
+
var xe = Object.defineProperty, De = (e, t, n) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (De(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
+
const Vt = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -283,7 +283,7 @@ const Lt = [
|
|
|
283
283
|
stateMutability: "view",
|
|
284
284
|
type: "function"
|
|
285
285
|
}
|
|
286
|
-
],
|
|
286
|
+
], Pe = [
|
|
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
|
+
], Ve = [
|
|
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 Le = /* @__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))(Le || {});
|
|
604
|
+
const Ue = [
|
|
605
605
|
"ERC20-ERC20",
|
|
606
606
|
"ARC20-ARC20",
|
|
607
607
|
"BEP20-BEP20"
|
|
608
608
|
/* BSC_TO_BSC */
|
|
609
|
-
],
|
|
609
|
+
], He = [
|
|
610
610
|
"ERC20-TC",
|
|
611
611
|
"ERC20-ARC20",
|
|
612
612
|
"ERC20-BEP20",
|
|
@@ -617,72 +617,72 @@ const He = [
|
|
|
617
617
|
"BEP20-ERC20",
|
|
618
618
|
"BEP20-ARC20"
|
|
619
619
|
/* BSC_TO_AVAX */
|
|
620
|
-
],
|
|
620
|
+
], $e = [
|
|
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 be = /* @__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))(be || {}), ke = /* @__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))(ke || {}), d = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_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))(d || {});
|
|
628
|
+
const Fe = {
|
|
629
|
+
[d.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
|
+
[d.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
|
+
[d.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
632
|
+
[d.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
|
|
633
|
+
[d.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
|
|
634
|
+
[d.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
|
|
635
|
+
[d.INVALID_TYPE_GENERIC]: "Invalid type",
|
|
636
|
+
[d.INVALID_NUMBER_STRING]: "Invalid number string.",
|
|
637
|
+
[d.INVALID_NUMBER]: "Invalid number.",
|
|
638
|
+
[d.INVALID_BOOLEAN]: "Invalid boolean.",
|
|
639
|
+
[d.INVALID_OBJECT]: "Invalid object.",
|
|
640
|
+
[d.INVALID_ARRAY]: "Invalid array.",
|
|
641
|
+
[d.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
|
|
642
|
+
[d.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
|
|
643
|
+
[d.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
|
|
644
|
+
[d.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
|
|
645
|
+
[d.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
|
|
646
|
+
[d.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
|
|
647
|
+
[d.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
|
|
648
|
+
[d.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
|
|
649
|
+
[d.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
|
|
650
|
+
[d.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
651
|
+
[d.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
652
|
+
[d.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
653
|
+
[d.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
|
|
654
|
+
[d.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
|
|
655
|
+
[d.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
|
|
656
|
+
[d.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
|
|
657
|
+
[d.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
|
|
658
|
+
[d.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
|
|
659
|
+
[d.INVALID_CHAIN]: "Invalid chain {0}.",
|
|
660
|
+
[d.INVALID_ASSET]: "Invalid asset {0}.",
|
|
661
|
+
[d.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
|
|
662
|
+
[d.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
|
|
663
|
+
[d.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
|
|
664
|
+
[d.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
|
|
665
|
+
[d.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
|
|
666
|
+
[d.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
|
|
667
|
+
[d.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
|
|
668
|
+
[d.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
|
|
669
|
+
[d.INVALID_QUOTE_MODE]: "Invalid quote mode.",
|
|
670
|
+
[d.NO_QUOTES]: "No quotes to service this request.",
|
|
671
|
+
[d.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
|
|
672
|
+
[d.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
|
|
673
|
+
[d.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
|
|
674
|
+
[d.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
|
|
675
|
+
[d.NO_PRICE]: "No price for asset {0}.",
|
|
676
|
+
[d.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
677
|
+
[d.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
678
|
+
[d.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
679
|
+
}, te = (e, t) => {
|
|
680
|
+
let n = Fe[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
|
-
|
|
685
|
+
class Ae extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -690,22 +690,22 @@ let Ut = class we extends Error {
|
|
|
690
690
|
code: i,
|
|
691
691
|
message: r,
|
|
692
692
|
type: p,
|
|
693
|
-
options: { shouldLog:
|
|
693
|
+
options: { shouldLog: o, shouldThrow: y, shouldTrace: T } = {
|
|
694
694
|
shouldLog: !0,
|
|
695
695
|
shouldThrow: !0,
|
|
696
696
|
shouldTrace: !0
|
|
697
697
|
},
|
|
698
|
-
displayMessageParams:
|
|
698
|
+
displayMessageParams: u
|
|
699
699
|
}) {
|
|
700
|
-
const
|
|
701
|
-
super(
|
|
702
|
-
shouldLog:
|
|
703
|
-
shouldTrace:
|
|
704
|
-
shouldThrow:
|
|
705
|
-
}, this.displayMessageParams =
|
|
700
|
+
const l = r || te(i, u || []) || "";
|
|
701
|
+
super(l), 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 = l, this.display = te(i, u || []), this.code = i, this.type = p || be.UNHANDLED_ERROR, this.options = {
|
|
702
|
+
shouldLog: o || !0,
|
|
703
|
+
shouldTrace: T || !0,
|
|
704
|
+
shouldThrow: y || !1
|
|
705
|
+
}, this.displayMessageParams = u || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new Ae(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 te(this.code, this.displayMessageParams || []);
|
|
718
718
|
}
|
|
719
719
|
handle() {
|
|
720
720
|
const t = `[${this.identifier}]: ${this.message}`;
|
|
@@ -723,9 +723,9 @@ let Ut = class we extends Error {
|
|
|
723
723
|
throw Error(t, { cause: this.stack });
|
|
724
724
|
return this.toErrorInfo();
|
|
725
725
|
}
|
|
726
|
-
}
|
|
727
|
-
var s = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}),
|
|
728
|
-
const
|
|
726
|
+
}
|
|
727
|
+
var s = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}), Ge = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(Ge || {}), We = /* @__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))(We || {});
|
|
728
|
+
const Lt = {
|
|
729
729
|
ARB: [44, 60, 0, 0, 0],
|
|
730
730
|
AVAX: [44, 60, 0, 0, 0],
|
|
731
731
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -743,7 +743,7 @@ const Ht = {
|
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
745
|
var E = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(E || {});
|
|
746
|
-
const
|
|
746
|
+
const Ut = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,38 +751,38 @@ const $t = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], Ht = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], $t = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
765
|
];
|
|
766
|
-
var
|
|
767
|
-
const
|
|
766
|
+
var le = /* @__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))(le || {}), we = /* @__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))(we || {}), W = /* @__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.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
|
|
767
|
+
const Z = Object.values(s), qe = Object.keys(s), ce = Z.reduce(
|
|
768
768
|
(e, t) => {
|
|
769
|
-
const n =
|
|
769
|
+
const n = qe.find((a) => s[a] === t);
|
|
770
770
|
return n && (e[t] = n), e;
|
|
771
771
|
},
|
|
772
772
|
{}
|
|
773
|
-
),
|
|
774
|
-
(e, t) => (e[t] = ce[
|
|
773
|
+
), Ke = Z.reduce(
|
|
774
|
+
(e, t) => (e[t] = le[ce[t]], e),
|
|
775
775
|
{}
|
|
776
|
-
),
|
|
777
|
-
(e, t) => (e[t] =
|
|
776
|
+
), Ye = Z.reduce(
|
|
777
|
+
(e, t) => (e[t] = we[ce[t]], e),
|
|
778
778
|
{}
|
|
779
|
-
),
|
|
779
|
+
), kt = Z.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n = `${
|
|
782
|
-
return e[t] =
|
|
781
|
+
const n = `${ce[t]}Hex`;
|
|
782
|
+
return e[t] = le[n], e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
|
-
),
|
|
785
|
+
), Ft = {
|
|
786
786
|
"0xa4b1": "ARB",
|
|
787
787
|
42161: "ARB",
|
|
788
788
|
"0xa86a": "AVAX",
|
|
@@ -807,7 +807,7 @@ const te = Object.values(s), Ke = Object.keys(s), me = te.reduce(
|
|
|
807
807
|
"thorchain-stagenet-v2": "THOR",
|
|
808
808
|
"thorchain-mainnet-v1": "THOR"
|
|
809
809
|
/* THORChain */
|
|
810
|
-
},
|
|
810
|
+
}, Ee = {
|
|
811
811
|
ARB: "https://arbiscan.io",
|
|
812
812
|
AVAX: "https://snowtrace.io",
|
|
813
813
|
BSC: "https://bscscan.com",
|
|
@@ -824,47 +824,55 @@ const te = Object.values(s), Ke = Object.keys(s), me = te.reduce(
|
|
|
824
824
|
MATIC: "https://polygonscan.com",
|
|
825
825
|
THOR: "https://viewblock.io/thorchain"
|
|
826
826
|
};
|
|
827
|
-
var
|
|
827
|
+
var Xe = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(Xe || {}), f = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(f || {}), k = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(k || {}), je = /* @__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))(je || {}), Qe = Object.defineProperty, Je = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, N = (e, t, n) => (Je(e, typeof t != "symbol" ? t + "" : t, n), n), ze = (e, t, n) => {
|
|
828
828
|
if (!t.has(e))
|
|
829
829
|
throw TypeError("Cannot " + n);
|
|
830
|
-
},
|
|
830
|
+
}, V = (e, t, n) => {
|
|
831
831
|
if (t.has(e))
|
|
832
832
|
throw TypeError("Cannot add the same private member more than once");
|
|
833
833
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
834
|
-
},
|
|
835
|
-
const
|
|
834
|
+
}, g = (e, t, n) => (ze(e, t, "access private method"), n);
|
|
835
|
+
const Gt = (e) => {
|
|
836
836
|
if (e < 0)
|
|
837
837
|
throw new Error("Invalid number of year");
|
|
838
838
|
return 10 + e;
|
|
839
|
-
},
|
|
839
|
+
}, Wt = (e) => {
|
|
840
840
|
if (e.length > 30)
|
|
841
841
|
return !1;
|
|
842
842
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
843
843
|
return !!e.match(t);
|
|
844
|
-
},
|
|
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 }) => {
|
|
844
|
+
}, qt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`, Re = async (e, t) => {
|
|
862
845
|
try {
|
|
863
|
-
const n =
|
|
864
|
-
|
|
846
|
+
const n = Object.entries(t || {}).reduce(
|
|
847
|
+
(a, [i, r]) => (r && (a[i] = r), a),
|
|
848
|
+
{}
|
|
849
|
+
);
|
|
850
|
+
return (await fetch(
|
|
851
|
+
`${e}${t ? `?${new URLSearchParams(n).toString()}` : ""}`,
|
|
852
|
+
{ method: "GET", mode: "cors", credentials: "omit", referrer: "https://sk.thorswap.net" }
|
|
853
|
+
)).json();
|
|
854
|
+
} catch (n) {
|
|
855
|
+
return console.error(n), {};
|
|
856
|
+
}
|
|
857
|
+
}, Ze = async (e, t, n, a = !1) => {
|
|
858
|
+
try {
|
|
859
|
+
const i = await fetch(`${e}`, {
|
|
860
|
+
body: t,
|
|
861
|
+
headers: n,
|
|
862
|
+
method: "POST",
|
|
863
|
+
referrer: "https://sk.thorswap.net"
|
|
864
|
+
});
|
|
865
|
+
return a ? i.text() : i.json();
|
|
866
|
+
} catch {
|
|
867
|
+
return {};
|
|
868
|
+
}
|
|
869
|
+
}, et = "0x313ce567", Oe = async ({ chain: e, to: t }) => {
|
|
870
|
+
try {
|
|
871
|
+
const n = await Ze(
|
|
872
|
+
Ye[e],
|
|
865
873
|
JSON.stringify({
|
|
866
874
|
method: "eth_call",
|
|
867
|
-
params: [{ to: t.toLowerCase(), data:
|
|
875
|
+
params: [{ to: t.toLowerCase(), data: et }, "latest"],
|
|
868
876
|
id: 44,
|
|
869
877
|
jsonrpc: "2.0"
|
|
870
878
|
}),
|
|
@@ -875,30 +883,30 @@ const qt = (e) => {
|
|
|
875
883
|
} catch (n) {
|
|
876
884
|
return console.error(n), E[e];
|
|
877
885
|
}
|
|
878
|
-
},
|
|
886
|
+
}, tt = async (e) => {
|
|
879
887
|
if (e === s.Ethereum)
|
|
880
888
|
return E.ETH;
|
|
881
889
|
const [, t] = e.split("-");
|
|
882
|
-
return t != null && t.startsWith("0x") ?
|
|
883
|
-
},
|
|
890
|
+
return t != null && t.startsWith("0x") ? Oe({ chain: s.Ethereum, to: t }) : E.ETH;
|
|
891
|
+
}, nt = async (e) => {
|
|
884
892
|
const [, t] = e.split("-");
|
|
885
|
-
return t != null && t.startsWith("0x") ?
|
|
886
|
-
},
|
|
893
|
+
return t != null && t.startsWith("0x") ? Oe({ chain: s.Avalanche, to: t.toLowerCase() }) : E.AVAX;
|
|
894
|
+
}, at = async (e) => (e === s.BinanceSmartChain, E.BSC), Ie = async ({ chain: e, symbol: t }) => {
|
|
887
895
|
switch (e) {
|
|
888
896
|
case s.Ethereum:
|
|
889
|
-
return
|
|
897
|
+
return tt(t);
|
|
890
898
|
case s.Avalanche:
|
|
891
|
-
return
|
|
899
|
+
return nt(t);
|
|
892
900
|
case s.BinanceSmartChain:
|
|
893
|
-
return
|
|
901
|
+
return at(t);
|
|
894
902
|
default:
|
|
895
903
|
return E[e];
|
|
896
904
|
}
|
|
897
|
-
},
|
|
898
|
-
[
|
|
899
|
-
[
|
|
900
|
-
[
|
|
901
|
-
},
|
|
905
|
+
}, st = {
|
|
906
|
+
[k.Average]: 1.2,
|
|
907
|
+
[k.Fast]: 1.5,
|
|
908
|
+
[k.Fastest]: 2
|
|
909
|
+
}, it = ({ chain: e, symbol: t }) => {
|
|
902
910
|
switch (e) {
|
|
903
911
|
case s.Bitcoin:
|
|
904
912
|
case s.BitcoinCash:
|
|
@@ -924,7 +932,7 @@ const qt = (e) => {
|
|
|
924
932
|
case s.THORChain:
|
|
925
933
|
return t === "RUNE";
|
|
926
934
|
}
|
|
927
|
-
},
|
|
935
|
+
}, rt = (e) => {
|
|
928
936
|
switch (e) {
|
|
929
937
|
case "ETH.THOR":
|
|
930
938
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
@@ -953,7 +961,7 @@ const qt = (e) => {
|
|
|
953
961
|
case s.Ethereum:
|
|
954
962
|
return { identifier: `${e}.${e}`, decimal: E[e] };
|
|
955
963
|
}
|
|
956
|
-
},
|
|
964
|
+
}, pt = ({ chain: e, symbol: t }) => {
|
|
957
965
|
if (t.includes("/"))
|
|
958
966
|
return "Synth";
|
|
959
967
|
switch (e) {
|
|
@@ -983,35 +991,35 @@ const qt = (e) => {
|
|
|
983
991
|
case s.Optimism:
|
|
984
992
|
return [s.Ethereum, s.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
985
993
|
}
|
|
986
|
-
},
|
|
994
|
+
}, Kt = (e) => {
|
|
987
995
|
var t;
|
|
988
996
|
const [n, ...a] = e.split("."), i = e.includes("/"), r = a.join("."), p = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
989
997
|
return { chain: n, symbol: r, ticker: p, synth: i };
|
|
990
|
-
},
|
|
998
|
+
}, ot = ({
|
|
991
999
|
liquidityUnits: e,
|
|
992
1000
|
poolUnits: t,
|
|
993
1001
|
runeDepth: n
|
|
994
1002
|
}) => {
|
|
995
|
-
const a = w(e), i = w(t), r = w(n), p = a.mul(r),
|
|
996
|
-
return p.mul(
|
|
997
|
-
},
|
|
1003
|
+
const a = w(e), i = w(t), r = w(n), p = a.mul(r), o = i.mul(i).mul(2), y = i.mul(a).mul(2), T = a.mul(a), u = i.mul(i).mul(i);
|
|
1004
|
+
return p.mul(o.sub(y).add(T)).div(u);
|
|
1005
|
+
}, dt = ({
|
|
998
1006
|
liquidityUnits: e,
|
|
999
1007
|
poolUnits: t,
|
|
1000
1008
|
assetDepth: n
|
|
1001
1009
|
}) => {
|
|
1002
|
-
const a = w(e), i = w(t), r = w(n), p = a.mul(r),
|
|
1003
|
-
return
|
|
1004
|
-
},
|
|
1010
|
+
const a = w(e), i = w(t), r = w(n), p = a.mul(r), o = i.mul(i).mul(2), y = i.mul(a).mul(2), T = a.mul(a), u = p.mul(o.sub(y).add(T)), l = i.mul(i).mul(i);
|
|
1011
|
+
return u.div(l);
|
|
1012
|
+
}, Yt = ({
|
|
1005
1013
|
percent: e,
|
|
1006
1014
|
runeDepth: t,
|
|
1007
1015
|
liquidityUnits: n,
|
|
1008
1016
|
poolUnits: a
|
|
1009
|
-
}) =>
|
|
1017
|
+
}) => ot({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), Xt = ({
|
|
1010
1018
|
percent: e,
|
|
1011
1019
|
assetDepth: t,
|
|
1012
1020
|
liquidityUnits: n,
|
|
1013
1021
|
poolUnits: a
|
|
1014
|
-
}) =>
|
|
1022
|
+
}) => dt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), w = (e) => new ye({ value: e, decimal: E.THOR }), ut = ({
|
|
1015
1023
|
liquidityUnits: e,
|
|
1016
1024
|
poolUnits: t,
|
|
1017
1025
|
runeDepth: n,
|
|
@@ -1019,17 +1027,17 @@ const qt = (e) => {
|
|
|
1019
1027
|
}) => ({
|
|
1020
1028
|
assetAmount: w(a).mul(e).div(t),
|
|
1021
1029
|
runeAmount: w(n).mul(e).div(t)
|
|
1022
|
-
}),
|
|
1030
|
+
}), jt = ({
|
|
1023
1031
|
liquidityUnits: e,
|
|
1024
1032
|
poolUnits: t,
|
|
1025
1033
|
runeDepth: n,
|
|
1026
1034
|
assetDepth: a,
|
|
1027
1035
|
percent: i
|
|
1028
1036
|
}) => Object.fromEntries(
|
|
1029
|
-
Object.entries(
|
|
1037
|
+
Object.entries(ut({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1030
1038
|
([r, p]) => [r, p.mul(i)]
|
|
1031
1039
|
)
|
|
1032
|
-
),
|
|
1040
|
+
), Qt = ({
|
|
1033
1041
|
runeDepth: e,
|
|
1034
1042
|
poolUnits: t,
|
|
1035
1043
|
assetDepth: n,
|
|
@@ -1037,24 +1045,24 @@ const qt = (e) => {
|
|
|
1037
1045
|
runeAmount: i,
|
|
1038
1046
|
assetAmount: r
|
|
1039
1047
|
}) => {
|
|
1040
|
-
const p = w(e),
|
|
1041
|
-
if (
|
|
1042
|
-
return b.div(
|
|
1043
|
-
const M =
|
|
1048
|
+
const p = w(e), o = w(n), y = w(t), T = w(i), u = w(r), l = T.mul(o), h = u.mul(p), _ = T.mul(u), R = p.mul(o), O = y.mul(l.add(h.add(_.mul(2)))), S = l.add(h.add(R.mul(2))), I = O.div(S), b = w(a).add(I);
|
|
1049
|
+
if (I.baseValueNumber === 0)
|
|
1050
|
+
return b.div(y).baseValueNumber;
|
|
1051
|
+
const M = y.add(b);
|
|
1044
1052
|
return b.div(M).baseValueNumber;
|
|
1045
|
-
},
|
|
1053
|
+
}, Jt = ({
|
|
1046
1054
|
runeAmount: e,
|
|
1047
1055
|
assetAmount: t,
|
|
1048
1056
|
runeDepth: n,
|
|
1049
1057
|
assetDepth: a
|
|
1050
1058
|
}) => {
|
|
1051
|
-
const i = w(n), r = w(a), p = w(t),
|
|
1052
|
-
return Math.abs(
|
|
1053
|
-
},
|
|
1059
|
+
const i = w(n), r = w(a), p = w(t), o = w(e), y = p.mul(i).sub(r.mul(o)), T = r.mul(o).add(i.mul(r));
|
|
1060
|
+
return Math.abs(y.div(T).baseValueNumber);
|
|
1061
|
+
}, yt = ({
|
|
1054
1062
|
symbol: e,
|
|
1055
1063
|
ticker: t,
|
|
1056
1064
|
chain: n
|
|
1057
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e,
|
|
1065
|
+
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, D = (e, t) => {
|
|
1058
1066
|
switch (e) {
|
|
1059
1067
|
case f.LEAVE:
|
|
1060
1068
|
case f.BOND: {
|
|
@@ -1074,8 +1082,8 @@ const qt = (e) => {
|
|
|
1074
1082
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${i || ""}:t:0`;
|
|
1075
1083
|
}
|
|
1076
1084
|
case f.WITHDRAW: {
|
|
1077
|
-
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide:
|
|
1078
|
-
return `${e}:${n}${
|
|
1085
|
+
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: o } = t, y = !o && p ? `:${p}` : "", T = yt({ chain: n, symbol: i, ticker: a });
|
|
1086
|
+
return `${e}:${n}${o ? "/" : "."}${T}:${r}${y}`;
|
|
1079
1087
|
}
|
|
1080
1088
|
case f.OPEN_LOAN:
|
|
1081
1089
|
case f.CLOSE_LOAN: {
|
|
@@ -1085,43 +1093,44 @@ const qt = (e) => {
|
|
|
1085
1093
|
default:
|
|
1086
1094
|
return "";
|
|
1087
1095
|
}
|
|
1088
|
-
},
|
|
1096
|
+
}, me = Object.values(s), lt = (e = "") => {
|
|
1097
|
+
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1098
|
+
if (me.includes(n))
|
|
1099
|
+
return !0;
|
|
1100
|
+
const [a] = t.split("/");
|
|
1101
|
+
if (me.includes(a))
|
|
1102
|
+
return !0;
|
|
1103
|
+
throw new Error(
|
|
1104
|
+
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1105
|
+
);
|
|
1106
|
+
}, q = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
|
|
1107
|
+
function ge({
|
|
1089
1108
|
value: e,
|
|
1090
|
-
bigIntDecimal: t =
|
|
1091
|
-
decimal: n =
|
|
1092
|
-
})
|
|
1109
|
+
bigIntDecimal: t = q,
|
|
1110
|
+
decimal: n = q
|
|
1111
|
+
}) {
|
|
1093
1112
|
const a = e < 0n;
|
|
1094
1113
|
let i = e.toString().substring(a ? 1 : 0);
|
|
1095
1114
|
const r = n - (i.length - 1);
|
|
1096
1115
|
r > 0 && (i = "0".repeat(r) + i);
|
|
1097
1116
|
const p = i.length - n;
|
|
1098
|
-
let
|
|
1099
|
-
return parseInt(
|
|
1117
|
+
let o = i.slice(-n);
|
|
1118
|
+
return parseInt(o[t]) >= 5 ? o = `${o.substring(0, t - 1)}${(parseInt(o[t - 1]) + 1).toString()}` : o = o.substring(0, t), `${a ? "-" : ""}${i.slice(0, p)}.${o}`.replace(
|
|
1100
1119
|
/\.?0*$/,
|
|
1101
1120
|
""
|
|
1102
1121
|
);
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
return !0;
|
|
1107
|
-
const [a] = t.split("/");
|
|
1108
|
-
if (Te.includes(a))
|
|
1109
|
-
return !0;
|
|
1110
|
-
throw new Error(
|
|
1111
|
-
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1112
|
-
);
|
|
1113
|
-
}, U = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
|
|
1114
|
-
var L, $, ie, ve, re, _e, z, pe, H, W, Z, oe, k, J;
|
|
1115
|
-
const mt = class Q {
|
|
1122
|
+
}
|
|
1123
|
+
var L, $, ae, Se, se, Te, Q, ie, H, G, J, re;
|
|
1124
|
+
const ct = class j {
|
|
1116
1125
|
constructor(t) {
|
|
1117
|
-
|
|
1118
|
-
const n =
|
|
1119
|
-
this.decimal =
|
|
1120
|
-
Math.max(
|
|
1121
|
-
),
|
|
1126
|
+
V(this, L), V(this, ae), V(this, se), V(this, Q), V(this, H), V(this, J), N(this, "decimalMultiplier", 10n ** 8n), N(this, "bigIntValue", 0n), N(this, "decimal");
|
|
1127
|
+
const n = oe(t);
|
|
1128
|
+
this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
|
|
1129
|
+
Math.max(g(this, J, re).call(this, g(this, H, G).call(this, n)), this.decimal || 0)
|
|
1130
|
+
), g(this, ae, Se).call(this, n);
|
|
1122
1131
|
}
|
|
1123
1132
|
static fromBigInt(t, n) {
|
|
1124
|
-
return new
|
|
1133
|
+
return new j({
|
|
1125
1134
|
decimal: n,
|
|
1126
1135
|
value: ge({ value: t, bigIntDecimal: n, decimal: n })
|
|
1127
1136
|
});
|
|
@@ -1131,40 +1140,34 @@ const mt = class Q {
|
|
|
1131
1140
|
from: n,
|
|
1132
1141
|
to: a
|
|
1133
1142
|
}) {
|
|
1134
|
-
return
|
|
1135
|
-
new
|
|
1143
|
+
return j.fromBigInt(
|
|
1144
|
+
new j(t).bigIntValue * U(a) / U(n),
|
|
1136
1145
|
a
|
|
1137
1146
|
);
|
|
1138
1147
|
}
|
|
1139
|
-
get unsafeNumber() {
|
|
1140
|
-
return parseFloat((this.bigIntValue / this.decimalMultiplier).toString());
|
|
1141
|
-
}
|
|
1142
1148
|
get baseValue() {
|
|
1143
|
-
return
|
|
1149
|
+
return this.getBaseValue("string");
|
|
1144
1150
|
}
|
|
1145
1151
|
get baseValueNumber() {
|
|
1146
|
-
return
|
|
1152
|
+
return this.getBaseValue("number");
|
|
1147
1153
|
}
|
|
1148
1154
|
get baseValueBigInt() {
|
|
1149
|
-
return
|
|
1155
|
+
return this.getBaseValue("bigint");
|
|
1150
1156
|
}
|
|
1151
|
-
|
|
1152
|
-
return this.
|
|
1153
|
-
this.bigIntValue,
|
|
1154
|
-
this.decimal || G(this.decimalMultiplier)
|
|
1155
|
-
);
|
|
1157
|
+
set(t) {
|
|
1158
|
+
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1156
1159
|
}
|
|
1157
1160
|
add(...t) {
|
|
1158
|
-
return
|
|
1161
|
+
return g(this, L, $).call(this, "add", ...t);
|
|
1159
1162
|
}
|
|
1160
1163
|
sub(...t) {
|
|
1161
|
-
return
|
|
1164
|
+
return g(this, L, $).call(this, "sub", ...t);
|
|
1162
1165
|
}
|
|
1163
1166
|
mul(...t) {
|
|
1164
|
-
return
|
|
1167
|
+
return g(this, L, $).call(this, "mul", ...t);
|
|
1165
1168
|
}
|
|
1166
1169
|
div(...t) {
|
|
1167
|
-
return
|
|
1170
|
+
return g(this, L, $).call(this, "div", ...t);
|
|
1168
1171
|
}
|
|
1169
1172
|
gt(t) {
|
|
1170
1173
|
return this.bigIntValue > this.getBigIntValue(t);
|
|
@@ -1181,124 +1184,170 @@ const mt = class Q {
|
|
|
1181
1184
|
eqValue(t) {
|
|
1182
1185
|
return this.bigIntValue === this.getBigIntValue(t);
|
|
1183
1186
|
}
|
|
1187
|
+
getValue(t) {
|
|
1188
|
+
const n = this.formatBigIntToSafeValue(
|
|
1189
|
+
this.bigIntValue,
|
|
1190
|
+
this.decimal || F(this.decimalMultiplier)
|
|
1191
|
+
);
|
|
1192
|
+
switch (t) {
|
|
1193
|
+
case "number":
|
|
1194
|
+
return Number(n);
|
|
1195
|
+
case "string":
|
|
1196
|
+
return n;
|
|
1197
|
+
default:
|
|
1198
|
+
return this.bigIntValue;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
getBaseValue(t) {
|
|
1202
|
+
const n = this.decimalMultiplier / U(this.decimal || 0), a = this.bigIntValue / n;
|
|
1203
|
+
switch (t) {
|
|
1204
|
+
case "number":
|
|
1205
|
+
return Number(a);
|
|
1206
|
+
case "string":
|
|
1207
|
+
return a.toString();
|
|
1208
|
+
default:
|
|
1209
|
+
return this.bigIntValue;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1184
1212
|
getBigIntValue(t, n) {
|
|
1185
|
-
return !n && typeof t == "object" ? t.bigIntValue : (
|
|
1213
|
+
return !n && typeof t == "object" ? t.bigIntValue : g(this, Q, ie).call(this, g(this, H, G).call(this, oe(t)), n);
|
|
1186
1214
|
}
|
|
1187
1215
|
formatBigIntToSafeValue(t, n) {
|
|
1188
|
-
const a = n || this.decimal ||
|
|
1216
|
+
const a = n || this.decimal || q, i = Math.max(
|
|
1189
1217
|
a,
|
|
1190
|
-
|
|
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
|
-
);
|
|
1218
|
+
F(this.decimalMultiplier)
|
|
1219
|
+
), r = t < 0n, p = t.toString().substring(r ? 1 : 0), o = i - (p.length - 1), y = o > 0 ? "0".repeat(o) + p : p, T = y.length - i;
|
|
1220
|
+
let u = y.slice(-i);
|
|
1221
|
+
return parseInt(u[a]) >= 5 ? u = `${u.substring(0, a - 1)}${(parseInt(u[a - 1]) + 1).toString()}` : u = u.substring(0, a), `${r ? "-" : ""}${y.slice(
|
|
1222
|
+
0,
|
|
1223
|
+
T
|
|
1224
|
+
)}.${u}`.replace(/\.?0*$/, "");
|
|
1201
1225
|
}
|
|
1202
|
-
toSignificant(t) {
|
|
1203
|
-
const n = this.
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1226
|
+
toSignificant(t = 6) {
|
|
1227
|
+
const [n, a] = this.getValue("string").split("."), i = n || "", r = a || "", p = parseInt(i) ? i.length + r.length : r.length;
|
|
1228
|
+
if (p <= t)
|
|
1229
|
+
return this.getValue("string");
|
|
1230
|
+
if (i.length >= t)
|
|
1231
|
+
return i.slice(0, t).padEnd(i.length, "0");
|
|
1232
|
+
if (parseInt(i))
|
|
1233
|
+
return `${i}.${r.slice(0, t - i.length)}`.padEnd(
|
|
1234
|
+
p - t,
|
|
1235
|
+
"0"
|
|
1236
|
+
);
|
|
1237
|
+
const o = parseInt(r), y = `${o}`.slice(0, t);
|
|
1238
|
+
return `0.${y.padStart(
|
|
1239
|
+
r.length - `${o}`.length + y.length,
|
|
1240
|
+
"0"
|
|
1241
|
+
)}`;
|
|
1208
1242
|
}
|
|
1209
1243
|
};
|
|
1210
1244
|
L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1211
|
-
const n =
|
|
1212
|
-
(p,
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1245
|
+
const n = g(this, se, Te).call(this, this, ...t), a = U(n), i = t.reduce(
|
|
1246
|
+
(p, o) => {
|
|
1247
|
+
const y = this.getBigIntValue(o, n);
|
|
1248
|
+
switch (e) {
|
|
1249
|
+
case "add":
|
|
1250
|
+
return p + y;
|
|
1251
|
+
case "sub":
|
|
1252
|
+
return p - y;
|
|
1253
|
+
case "mul":
|
|
1254
|
+
return p * y / a;
|
|
1255
|
+
case "div": {
|
|
1256
|
+
if (y === 0n)
|
|
1257
|
+
throw new RangeError("Division by zero");
|
|
1258
|
+
return p * a / y;
|
|
1259
|
+
}
|
|
1260
|
+
default:
|
|
1261
|
+
return p;
|
|
1262
|
+
}
|
|
1217
1263
|
},
|
|
1218
1264
|
//normalize is to precision multiplier base
|
|
1219
1265
|
this.bigIntValue * a / this.decimalMultiplier
|
|
1220
1266
|
), r = ge({
|
|
1221
1267
|
bigIntDecimal: n,
|
|
1222
|
-
decimal: Math.max(n,
|
|
1268
|
+
decimal: Math.max(n, F(this.decimalMultiplier)),
|
|
1223
1269
|
value: i
|
|
1224
1270
|
});
|
|
1225
1271
|
return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
|
|
1226
|
-
},
|
|
1227
|
-
const
|
|
1228
|
-
this.bigIntValue =
|
|
1229
|
-
},
|
|
1272
|
+
}, ae = /* @__PURE__ */ new WeakSet(), Se = function(e) {
|
|
1273
|
+
const t = g(this, H, G).call(this, e) || "0";
|
|
1274
|
+
this.bigIntValue = g(this, Q, ie).call(this, t);
|
|
1275
|
+
}, se = /* @__PURE__ */ new WeakSet(), Te = function(...e) {
|
|
1230
1276
|
const t = e.map(
|
|
1231
|
-
(n) => typeof n == "object" ? n.decimal ||
|
|
1277
|
+
(n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : g(this, J, re).call(this, g(this, H, G).call(this, n))
|
|
1232
1278
|
).filter(Boolean);
|
|
1233
|
-
return Math.max(...t,
|
|
1234
|
-
},
|
|
1235
|
-
const n = t ? U(t) : this.decimalMultiplier, a =
|
|
1279
|
+
return Math.max(...t, q);
|
|
1280
|
+
}, Q = /* @__PURE__ */ new WeakSet(), ie = function(e, t) {
|
|
1281
|
+
const n = t ? U(t) : this.decimalMultiplier, a = F(n), [i, r = ""] = e.split(".");
|
|
1236
1282
|
return BigInt(`${i}${r.padEnd(a, "0")}`);
|
|
1237
|
-
}, H = /* @__PURE__ */ new WeakSet(),
|
|
1283
|
+
}, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
|
|
1238
1284
|
const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
|
|
1239
1285
|
useGrouping: !1,
|
|
1240
1286
|
maximumFractionDigits: 20
|
|
1241
|
-
}) : e}`.replaceAll(",", ".").split(".");
|
|
1287
|
+
}) : oe(e)}`.replaceAll(",", ".").split(".");
|
|
1242
1288
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1243
|
-
},
|
|
1289
|
+
}, J = /* @__PURE__ */ new WeakSet(), re = function(e) {
|
|
1244
1290
|
var t;
|
|
1245
1291
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1246
|
-
return Math.max(n,
|
|
1247
|
-
}, k = /* @__PURE__ */ new WeakSet(), J = function(e) {
|
|
1248
|
-
const t = this.decimalMultiplier / U(this.decimal || 0), n = this.bigIntValue / t;
|
|
1249
|
-
switch (e) {
|
|
1250
|
-
case "number":
|
|
1251
|
-
return Number(n);
|
|
1252
|
-
case "string":
|
|
1253
|
-
return n.toString();
|
|
1254
|
-
default:
|
|
1255
|
-
return n;
|
|
1256
|
-
}
|
|
1292
|
+
return Math.max(n, q);
|
|
1257
1293
|
};
|
|
1258
|
-
let
|
|
1259
|
-
|
|
1260
|
-
|
|
1294
|
+
let pe = ct;
|
|
1295
|
+
function oe(e) {
|
|
1296
|
+
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1297
|
+
}
|
|
1298
|
+
let de;
|
|
1299
|
+
const ne = (e) => {
|
|
1300
|
+
if (!de)
|
|
1261
1301
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1262
|
-
return
|
|
1263
|
-
},
|
|
1264
|
-
|
|
1265
|
-
const n = await
|
|
1302
|
+
return de.get(e.toUpperCase()) || { decimal: E.THOR, identifier: "" };
|
|
1303
|
+
}, _e = async (e, t = 0) => {
|
|
1304
|
+
lt(e);
|
|
1305
|
+
const n = await Ie(ue(e));
|
|
1266
1306
|
return new v({ decimal: n, value: t, identifier: e });
|
|
1267
1307
|
};
|
|
1268
|
-
class v extends
|
|
1308
|
+
class v extends pe {
|
|
1269
1309
|
constructor(t) {
|
|
1270
1310
|
super(
|
|
1271
|
-
t.value instanceof
|
|
1311
|
+
t.value instanceof pe ? t.value : { decimal: t.decimal, value: t.value }
|
|
1272
1312
|
), N(this, "address"), N(this, "chain"), N(this, "isSynthetic", !1), N(this, "isGasAsset", !1), N(this, "symbol"), N(this, "ticker"), N(this, "type");
|
|
1273
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a =
|
|
1274
|
-
this.type =
|
|
1313
|
+
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = ue(n);
|
|
1314
|
+
this.type = pt(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
|
|
1315
|
+
}
|
|
1316
|
+
get assetValue() {
|
|
1317
|
+
return `${this.getValue("string")} ${this.ticker}`;
|
|
1318
|
+
}
|
|
1319
|
+
toString() {
|
|
1320
|
+
return `${this.chain}.${this.symbol}`;
|
|
1321
|
+
}
|
|
1322
|
+
eq({ chain: t, symbol: n }) {
|
|
1323
|
+
return this.chain === t && this.symbol === n;
|
|
1275
1324
|
}
|
|
1276
1325
|
static async fromString(t, n = 0) {
|
|
1277
|
-
return
|
|
1326
|
+
return _e(t, n);
|
|
1278
1327
|
}
|
|
1279
1328
|
static fromStringSync(t, n = 0) {
|
|
1280
|
-
const { decimal: a, identifier: i } =
|
|
1329
|
+
const { decimal: a, identifier: i } = ne(
|
|
1281
1330
|
t
|
|
1282
1331
|
);
|
|
1283
1332
|
return i ? new v({ decimal: a, identifier: i, value: n }) : void 0;
|
|
1284
1333
|
}
|
|
1285
1334
|
static async fromIdentifier(t, n = 0) {
|
|
1286
|
-
return
|
|
1335
|
+
return _e(t, n);
|
|
1287
1336
|
}
|
|
1288
1337
|
static fromIdentifierSync(t, n = 0) {
|
|
1289
|
-
const { decimal: a, identifier: i } =
|
|
1338
|
+
const { decimal: a, identifier: i } = ne(t);
|
|
1290
1339
|
return new v({ decimal: a, identifier: i, value: n });
|
|
1291
1340
|
}
|
|
1292
1341
|
static fromChainOrSignature(t, n = 0) {
|
|
1293
|
-
const { decimal: a, identifier: i } =
|
|
1342
|
+
const { decimal: a, identifier: i } = rt(t);
|
|
1294
1343
|
return new v({ value: n, decimal: a, identifier: i });
|
|
1295
1344
|
}
|
|
1296
1345
|
static async fromTCQuote(t, n = 0) {
|
|
1297
|
-
const a = await
|
|
1346
|
+
const a = await Ie(ue(t)), i = this.shiftDecimals({ value: n, from: E.THOR, to: a });
|
|
1298
1347
|
return new v({ value: i, identifier: t, decimal: a });
|
|
1299
1348
|
}
|
|
1300
1349
|
static fromTCQuoteStatic(t, n = 0) {
|
|
1301
|
-
const a =
|
|
1350
|
+
const a = ne(t), i = this.shiftDecimals({
|
|
1302
1351
|
value: n,
|
|
1303
1352
|
from: E.THOR,
|
|
1304
1353
|
to: a.decimal
|
|
@@ -1316,10 +1365,10 @@ class v extends de {
|
|
|
1316
1365
|
NativeList: i,
|
|
1317
1366
|
...r
|
|
1318
1367
|
} = await import("@swapkit/tokens");
|
|
1319
|
-
|
|
1320
|
-
(p, { tokens:
|
|
1321
|
-
const
|
|
1322
|
-
p.set(
|
|
1368
|
+
de = [i, ...Object.values(r)].reduce(
|
|
1369
|
+
(p, { tokens: o }) => (o.forEach(({ identifier: y, chain: T, ...u }) => {
|
|
1370
|
+
const l = "decimals" in u ? u.decimals : E[T];
|
|
1371
|
+
p.set(y, { identifier: y, decimal: l });
|
|
1323
1372
|
}), p),
|
|
1324
1373
|
/* @__PURE__ */ new Map()
|
|
1325
1374
|
), t({ ok: !0 });
|
|
@@ -1333,17 +1382,8 @@ class v extends de {
|
|
|
1333
1382
|
}
|
|
1334
1383
|
);
|
|
1335
1384
|
}
|
|
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
1385
|
}
|
|
1346
|
-
const
|
|
1386
|
+
const he = (e) => {
|
|
1347
1387
|
const t = v.fromChainOrSignature(e);
|
|
1348
1388
|
switch (e) {
|
|
1349
1389
|
case s.Bitcoin:
|
|
@@ -1361,17 +1401,17 @@ const fe = (e) => {
|
|
|
1361
1401
|
default:
|
|
1362
1402
|
return t.add(1);
|
|
1363
1403
|
}
|
|
1364
|
-
},
|
|
1404
|
+
}, ue = (e) => {
|
|
1365
1405
|
const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${s.THORChain}.${e}`, [a, i] = n.split("."), [r, p] = i.split("-");
|
|
1366
1406
|
return {
|
|
1367
1407
|
address: p == null ? void 0 : p.toLowerCase(),
|
|
1368
1408
|
chain: a,
|
|
1369
|
-
isGasAsset:
|
|
1409
|
+
isGasAsset: it({ chain: a, symbol: i }),
|
|
1370
1410
|
isSynthetic: t,
|
|
1371
1411
|
symbol: p ? `${r}-${(p == null ? void 0 : p.toLowerCase()) ?? ""}` : i,
|
|
1372
1412
|
ticker: t ? i : r
|
|
1373
1413
|
};
|
|
1374
|
-
},
|
|
1414
|
+
}, mt = {
|
|
1375
1415
|
/**
|
|
1376
1416
|
* Core
|
|
1377
1417
|
*/
|
|
@@ -1428,20 +1468,17 @@ const fe = (e) => {
|
|
|
1428
1468
|
*/
|
|
1429
1469
|
helpers_number_different_decimals: 99101
|
|
1430
1470
|
};
|
|
1431
|
-
class
|
|
1471
|
+
class c extends Error {
|
|
1432
1472
|
constructor(t, n) {
|
|
1433
|
-
console.error(n), super(t, { cause: { code:
|
|
1473
|
+
console.error(n), super(t, { cause: { code: mt[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
|
|
1434
1474
|
}
|
|
1435
1475
|
}
|
|
1436
|
-
class
|
|
1476
|
+
class ye extends pe {
|
|
1437
1477
|
eq(t) {
|
|
1438
1478
|
return this.eqValue(t);
|
|
1439
1479
|
}
|
|
1440
|
-
toString() {
|
|
1441
|
-
return this.value;
|
|
1442
|
-
}
|
|
1443
1480
|
}
|
|
1444
|
-
const
|
|
1481
|
+
const Tt = [
|
|
1445
1482
|
{
|
|
1446
1483
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1447
1484
|
stateMutability: "nonpayable",
|
|
@@ -1532,7 +1569,7 @@ const _t = [
|
|
|
1532
1569
|
type: "function"
|
|
1533
1570
|
},
|
|
1534
1571
|
{ stateMutability: "payable", type: "receive" }
|
|
1535
|
-
],
|
|
1572
|
+
], _t = [
|
|
1536
1573
|
{
|
|
1537
1574
|
inputs: [
|
|
1538
1575
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -1676,7 +1713,7 @@ const _t = [
|
|
|
1676
1713
|
type: "function"
|
|
1677
1714
|
},
|
|
1678
1715
|
{ stateMutability: "payable", type: "receive" }
|
|
1679
|
-
],
|
|
1716
|
+
], ht = [
|
|
1680
1717
|
{
|
|
1681
1718
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1682
1719
|
stateMutability: "nonpayable",
|
|
@@ -1781,7 +1818,7 @@ const _t = [
|
|
|
1781
1818
|
type: "function"
|
|
1782
1819
|
},
|
|
1783
1820
|
{ stateMutability: "payable", type: "receive" }
|
|
1784
|
-
],
|
|
1821
|
+
], ft = [
|
|
1785
1822
|
{
|
|
1786
1823
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1787
1824
|
stateMutability: "nonpayable",
|
|
@@ -1872,7 +1909,7 @@ const _t = [
|
|
|
1872
1909
|
type: "function"
|
|
1873
1910
|
},
|
|
1874
1911
|
{ stateMutability: "payable", type: "receive" }
|
|
1875
|
-
],
|
|
1912
|
+
], bt = [
|
|
1876
1913
|
{
|
|
1877
1914
|
inputs: [
|
|
1878
1915
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2016,7 +2053,7 @@ const _t = [
|
|
|
2016
2053
|
type: "function"
|
|
2017
2054
|
},
|
|
2018
2055
|
{ stateMutability: "payable", type: "receive" }
|
|
2019
|
-
],
|
|
2056
|
+
], At = [
|
|
2020
2057
|
{
|
|
2021
2058
|
inputs: [
|
|
2022
2059
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2135,7 +2172,7 @@ const _t = [
|
|
|
2135
2172
|
type: "function"
|
|
2136
2173
|
},
|
|
2137
2174
|
{ stateMutability: "payable", type: "receive" }
|
|
2138
|
-
],
|
|
2175
|
+
], wt = [
|
|
2139
2176
|
{
|
|
2140
2177
|
inputs: [
|
|
2141
2178
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2254,7 +2291,7 @@ const _t = [
|
|
|
2254
2291
|
type: "function"
|
|
2255
2292
|
},
|
|
2256
2293
|
{ stateMutability: "payable", type: "receive" }
|
|
2257
|
-
],
|
|
2294
|
+
], Et = [
|
|
2258
2295
|
{
|
|
2259
2296
|
inputs: [
|
|
2260
2297
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2373,7 +2410,7 @@ const _t = [
|
|
|
2373
2410
|
type: "function"
|
|
2374
2411
|
},
|
|
2375
2412
|
{ stateMutability: "payable", type: "receive" }
|
|
2376
|
-
],
|
|
2413
|
+
], Rt = [
|
|
2377
2414
|
{
|
|
2378
2415
|
inputs: [
|
|
2379
2416
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2492,7 +2529,7 @@ const _t = [
|
|
|
2492
2529
|
type: "function"
|
|
2493
2530
|
},
|
|
2494
2531
|
{ stateMutability: "payable", type: "receive" }
|
|
2495
|
-
],
|
|
2532
|
+
], Ot = [
|
|
2496
2533
|
{
|
|
2497
2534
|
inputs: [
|
|
2498
2535
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2619,7 +2656,7 @@ const _t = [
|
|
|
2619
2656
|
type: "function"
|
|
2620
2657
|
},
|
|
2621
2658
|
{ stateMutability: "payable", type: "receive" }
|
|
2622
|
-
],
|
|
2659
|
+
], It = [
|
|
2623
2660
|
{
|
|
2624
2661
|
inputs: [
|
|
2625
2662
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2873,7 +2910,7 @@ const _t = [
|
|
|
2873
2910
|
type: "function"
|
|
2874
2911
|
},
|
|
2875
2912
|
{ stateMutability: "payable", type: "receive" }
|
|
2876
|
-
],
|
|
2913
|
+
], St = [
|
|
2877
2914
|
{
|
|
2878
2915
|
inputs: [
|
|
2879
2916
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3000,7 +3037,7 @@ const _t = [
|
|
|
3000
3037
|
type: "function"
|
|
3001
3038
|
},
|
|
3002
3039
|
{ stateMutability: "payable", type: "receive" }
|
|
3003
|
-
],
|
|
3040
|
+
], vt = [
|
|
3004
3041
|
{
|
|
3005
3042
|
inputs: [
|
|
3006
3043
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3127,27 +3164,27 @@ const _t = [
|
|
|
3127
3164
|
type: "function"
|
|
3128
3165
|
},
|
|
3129
3166
|
{ stateMutability: "payable", type: "receive" }
|
|
3130
|
-
],
|
|
3131
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3132
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3133
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3134
|
-
},
|
|
3135
|
-
...
|
|
3167
|
+
], ve = {
|
|
3168
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Tt,
|
|
3169
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ht,
|
|
3170
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: ft
|
|
3171
|
+
}, Mt = {
|
|
3172
|
+
...ve,
|
|
3136
3173
|
// AVAX
|
|
3137
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3138
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3139
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3174
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: At,
|
|
3175
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: _t,
|
|
3176
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Et,
|
|
3140
3177
|
// BSC
|
|
3141
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3178
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: bt,
|
|
3142
3179
|
// ETH
|
|
3143
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3144
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3145
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3146
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3180
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: wt,
|
|
3181
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Rt,
|
|
3182
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: Ot,
|
|
3183
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: It,
|
|
3147
3184
|
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: gt,
|
|
3148
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3149
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3150
|
-
},
|
|
3185
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: St,
|
|
3186
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: vt
|
|
3187
|
+
}, Ct = ({
|
|
3151
3188
|
streamSwap: e,
|
|
3152
3189
|
contractAddress: t,
|
|
3153
3190
|
recipient: n,
|
|
@@ -3156,40 +3193,40 @@ const _t = [
|
|
|
3156
3193
|
amount: i,
|
|
3157
3194
|
amountOutMin: r = "",
|
|
3158
3195
|
data: p = "",
|
|
3159
|
-
deadline:
|
|
3160
|
-
memo:
|
|
3161
|
-
router:
|
|
3162
|
-
memoStreamingSwap:
|
|
3163
|
-
tcMemo:
|
|
3196
|
+
deadline: o,
|
|
3197
|
+
memo: y,
|
|
3198
|
+
router: T,
|
|
3199
|
+
memoStreamingSwap: u,
|
|
3200
|
+
tcMemo: l,
|
|
3164
3201
|
tcRouter: h,
|
|
3165
3202
|
tcVault: _,
|
|
3166
|
-
vault:
|
|
3167
|
-
token:
|
|
3203
|
+
vault: R,
|
|
3204
|
+
token: O
|
|
3168
3205
|
}
|
|
3169
3206
|
}) => {
|
|
3170
|
-
const
|
|
3171
|
-
if (
|
|
3207
|
+
const S = !!ve[t.toLowerCase()];
|
|
3208
|
+
if (S && !T)
|
|
3172
3209
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3173
|
-
const
|
|
3174
|
-
if (!_ && !
|
|
3210
|
+
const I = l || y, b = e && u || I;
|
|
3211
|
+
if (!_ && !R)
|
|
3175
3212
|
throw new Error("TC Vault is required on calldata");
|
|
3176
|
-
if (!h && !
|
|
3213
|
+
if (!h && !T)
|
|
3177
3214
|
throw new Error("TC Router is required on calldata");
|
|
3178
3215
|
if (!b)
|
|
3179
3216
|
throw new Error("TC Memo is required on calldata");
|
|
3180
|
-
if (!
|
|
3217
|
+
if (!O)
|
|
3181
3218
|
throw new Error("Token is required on calldata");
|
|
3182
3219
|
const M = [
|
|
3183
3220
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3184
|
-
a(h ||
|
|
3185
|
-
a(_ ||
|
|
3221
|
+
a(h || T),
|
|
3222
|
+
a(_ || R),
|
|
3186
3223
|
b.replace("{recipientAddress}", n),
|
|
3187
|
-
a(
|
|
3224
|
+
a(O),
|
|
3188
3225
|
i
|
|
3189
|
-
],
|
|
3190
|
-
return [...M, ...
|
|
3191
|
-
},
|
|
3192
|
-
const n =
|
|
3226
|
+
], ee = S ? [a(T), p, o] : [r, o];
|
|
3227
|
+
return [...M, ...ee];
|
|
3228
|
+
}, Nt = ({ chain: e, txHash: t }) => {
|
|
3229
|
+
const n = Ee[e];
|
|
3193
3230
|
switch (e) {
|
|
3194
3231
|
case s.Binance:
|
|
3195
3232
|
case s.Bitcoin:
|
|
@@ -3215,7 +3252,7 @@ const _t = [
|
|
|
3215
3252
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3216
3253
|
}
|
|
3217
3254
|
}, xt = ({ chain: e, address: t }) => {
|
|
3218
|
-
const n =
|
|
3255
|
+
const n = Ee[e];
|
|
3219
3256
|
switch (e) {
|
|
3220
3257
|
case s.Arbitrum:
|
|
3221
3258
|
case s.Avalanche:
|
|
@@ -3238,100 +3275,100 @@ const _t = [
|
|
|
3238
3275
|
default:
|
|
3239
3276
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3240
3277
|
}
|
|
3241
|
-
},
|
|
3242
|
-
const t = e ?
|
|
3243
|
-
return
|
|
3278
|
+
}, Dt = (e) => {
|
|
3279
|
+
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3280
|
+
return Re(`${t}/thorchain/inbound_addresses`);
|
|
3244
3281
|
}, Bt = (e) => {
|
|
3245
|
-
const t = e ?
|
|
3246
|
-
return
|
|
3247
|
-
},
|
|
3282
|
+
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3283
|
+
return Re(`${t}/thorchain/mimir`);
|
|
3284
|
+
}, fe = () => Object.values(s).reduce(
|
|
3248
3285
|
(e, t) => (e[t] = null, e),
|
|
3249
3286
|
{}
|
|
3250
3287
|
);
|
|
3251
|
-
var
|
|
3252
|
-
class
|
|
3288
|
+
var P, z, K, x, Y, X;
|
|
3289
|
+
class zt {
|
|
3253
3290
|
constructor({ stagenet: t } = {}) {
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3291
|
+
m(this, "connectedChains", fe());
|
|
3292
|
+
m(this, "connectedWallets", fe());
|
|
3293
|
+
m(this, "stagenet", !1);
|
|
3294
|
+
m(this, "getAddress", (t) => {
|
|
3258
3295
|
var n;
|
|
3259
3296
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3260
3297
|
});
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3298
|
+
m(this, "getExplorerTxUrl", (t, n) => Nt({ chain: t, txHash: n }));
|
|
3299
|
+
m(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3300
|
+
m(this, "getExplorerAddressUrl", (t, n) => xt({ chain: t, address: n }));
|
|
3301
|
+
m(this, "getBalance", async (t, n) => {
|
|
3265
3302
|
var i;
|
|
3266
3303
|
if (!n)
|
|
3267
3304
|
return ((i = this.connectedChains[t]) == null ? void 0 : i.balance) || [];
|
|
3268
3305
|
const a = await this.getWalletByChain(t);
|
|
3269
3306
|
return (a == null ? void 0 : a.balance) || [];
|
|
3270
3307
|
});
|
|
3271
|
-
|
|
3272
|
-
var
|
|
3308
|
+
m(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: i }) => {
|
|
3309
|
+
var o, y, T, u;
|
|
3273
3310
|
const { quoteMode: r } = a.meta, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : s.BinanceSmartChain;
|
|
3274
3311
|
if (!a.complete)
|
|
3275
|
-
throw new
|
|
3312
|
+
throw new c("core_swap_route_not_complete");
|
|
3276
3313
|
try {
|
|
3277
|
-
if (
|
|
3278
|
-
const
|
|
3279
|
-
if (!(
|
|
3280
|
-
throw new
|
|
3281
|
-
if (!(t ? (
|
|
3282
|
-
throw new
|
|
3283
|
-
const { isHexString: _, parseUnits:
|
|
3284
|
-
data:
|
|
3285
|
-
from:
|
|
3286
|
-
to:
|
|
3287
|
-
chainId: BigInt(
|
|
3288
|
-
value: b ? new
|
|
3289
|
-
value: _(b) ? b :
|
|
3314
|
+
if (Ue.includes(r)) {
|
|
3315
|
+
const l = this.connectedWallets[p];
|
|
3316
|
+
if (!(l != null && l.sendTransaction))
|
|
3317
|
+
throw new c("core_wallet_connection_not_found");
|
|
3318
|
+
if (!(t ? (o = a == null ? void 0 : a.streamingSwap) == null ? void 0 : o.transaction : a == null ? void 0 : a.transaction))
|
|
3319
|
+
throw new c("core_swap_route_transaction_not_found");
|
|
3320
|
+
const { isHexString: _, parseUnits: R } = await import("./index-cf1865cd.js"), { data: O, from: S, to: I, value: b } = a.transaction, M = {
|
|
3321
|
+
data: O,
|
|
3322
|
+
from: S,
|
|
3323
|
+
to: I.toLowerCase(),
|
|
3324
|
+
chainId: BigInt(Ke[p]),
|
|
3325
|
+
value: b ? new ye({
|
|
3326
|
+
value: _(b) ? b : R(b, "wei").toString(16)
|
|
3290
3327
|
}).baseValueBigInt : 0n
|
|
3291
3328
|
};
|
|
3292
|
-
return
|
|
3329
|
+
return l.sendTransaction(M, i);
|
|
3293
3330
|
}
|
|
3294
|
-
if (
|
|
3331
|
+
if ($e.includes(r)) {
|
|
3295
3332
|
if (!a.calldata.fromAsset)
|
|
3296
|
-
throw new
|
|
3297
|
-
const
|
|
3298
|
-
if (!
|
|
3299
|
-
throw new
|
|
3300
|
-
const { address: h } = await A(this,
|
|
3333
|
+
throw new c("core_swap_asset_not_recognized");
|
|
3334
|
+
const l = await v.fromString(a.calldata.fromAsset);
|
|
3335
|
+
if (!l)
|
|
3336
|
+
throw new c("core_swap_asset_not_recognized");
|
|
3337
|
+
const { address: h } = await A(this, P).call(this, l.chain), {
|
|
3301
3338
|
contract: _,
|
|
3302
|
-
calldata: { amountIn:
|
|
3303
|
-
} = a,
|
|
3304
|
-
return this.deposit({ assetValue:
|
|
3339
|
+
calldata: { amountIn: R, memo: O, memoStreamingSwap: S }
|
|
3340
|
+
} = a, I = l.add(ye.fromBigInt(BigInt(R), l.decimal)), b = t && S || O;
|
|
3341
|
+
return this.deposit({ assetValue: I, memo: b, feeOptionKey: i, router: _, recipient: h });
|
|
3305
3342
|
}
|
|
3306
|
-
if (
|
|
3307
|
-
const { calldata:
|
|
3343
|
+
if (He.includes(r)) {
|
|
3344
|
+
const { calldata: l, contract: h } = a;
|
|
3308
3345
|
if (!h)
|
|
3309
|
-
throw new
|
|
3310
|
-
const _ = this.connectedWallets[p],
|
|
3311
|
-
if (!(_ != null && _.sendTransaction) || !
|
|
3312
|
-
throw new
|
|
3313
|
-
const { getProvider:
|
|
3346
|
+
throw new c("core_swap_contract_not_found");
|
|
3347
|
+
const _ = this.connectedWallets[p], R = this.getAddress(p);
|
|
3348
|
+
if (!(_ != null && _.sendTransaction) || !R)
|
|
3349
|
+
throw new c("core_wallet_connection_not_found");
|
|
3350
|
+
const { getProvider: O, toChecksumAddress: S } = await import("@swapkit/toolbox-evm"), I = O(p), b = Mt[h.toLowerCase()];
|
|
3314
3351
|
if (!b)
|
|
3315
|
-
throw new
|
|
3316
|
-
const
|
|
3317
|
-
|
|
3318
|
-
...
|
|
3352
|
+
throw new c("core_swap_contract_not_supported", { contractAddress: h });
|
|
3353
|
+
const ee = await ((u = (T = (await ((y = _.createContract) == null ? void 0 : y.call(_, h, b, I))).populateTransaction).swapIn) == null ? void 0 : u.call(
|
|
3354
|
+
T,
|
|
3355
|
+
...Ct({
|
|
3319
3356
|
streamSwap: t,
|
|
3320
|
-
toChecksumAddress:
|
|
3357
|
+
toChecksumAddress: S,
|
|
3321
3358
|
contractAddress: h,
|
|
3322
3359
|
recipient: n,
|
|
3323
|
-
calldata:
|
|
3360
|
+
calldata: l
|
|
3324
3361
|
}),
|
|
3325
|
-
{ from:
|
|
3362
|
+
{ from: R }
|
|
3326
3363
|
));
|
|
3327
|
-
return _.sendTransaction(
|
|
3364
|
+
return _.sendTransaction(ee, i);
|
|
3328
3365
|
}
|
|
3329
|
-
throw new
|
|
3330
|
-
} catch (
|
|
3331
|
-
throw new
|
|
3366
|
+
throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3367
|
+
} catch (l) {
|
|
3368
|
+
throw new c("core_swap_transaction_error", l);
|
|
3332
3369
|
}
|
|
3333
3370
|
});
|
|
3334
|
-
|
|
3371
|
+
m(this, "getWalletByChain", async (t) => {
|
|
3335
3372
|
var i, r;
|
|
3336
3373
|
const n = this.getAddress(t);
|
|
3337
3374
|
if (!n)
|
|
@@ -3345,136 +3382,136 @@ class en {
|
|
|
3345
3382
|
walletType: (r = this.connectedChains[t]) == null ? void 0 : r.walletType
|
|
3346
3383
|
}, { ...this.connectedChains[t] };
|
|
3347
3384
|
});
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3385
|
+
m(this, "approveAssetValue", (t, n) => A(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
3386
|
+
m(this, "isAssetValueApproved", (t, n) => A(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
3387
|
+
m(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3351
3388
|
var a, i;
|
|
3352
3389
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
3353
3390
|
});
|
|
3354
|
-
|
|
3391
|
+
m(this, "transfer", async (t) => {
|
|
3355
3392
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
3356
3393
|
if (!n)
|
|
3357
|
-
throw new
|
|
3394
|
+
throw new c("core_wallet_connection_not_found");
|
|
3358
3395
|
try {
|
|
3359
|
-
return await n.transfer(A(this,
|
|
3396
|
+
return await n.transfer(A(this, X).call(this, t));
|
|
3360
3397
|
} catch (a) {
|
|
3361
|
-
throw new
|
|
3398
|
+
throw new c("core_swap_transaction_error", a);
|
|
3362
3399
|
}
|
|
3363
3400
|
});
|
|
3364
|
-
|
|
3401
|
+
m(this, "deposit", async ({
|
|
3365
3402
|
assetValue: t,
|
|
3366
3403
|
recipient: n,
|
|
3367
3404
|
router: a,
|
|
3368
3405
|
...i
|
|
3369
3406
|
}) => {
|
|
3370
|
-
const { chain: r, symbol: p, ticker:
|
|
3371
|
-
if (!
|
|
3372
|
-
throw new
|
|
3373
|
-
const
|
|
3407
|
+
const { chain: r, symbol: p, ticker: o } = t, y = this.connectedWallets[r];
|
|
3408
|
+
if (!y)
|
|
3409
|
+
throw new c("core_wallet_connection_not_found");
|
|
3410
|
+
const T = A(this, X).call(this, { assetValue: t, recipient: n, router: a, ...i });
|
|
3374
3411
|
try {
|
|
3375
3412
|
switch (r) {
|
|
3376
3413
|
case s.THORChain: {
|
|
3377
|
-
const
|
|
3378
|
-
return await (n === "" ?
|
|
3414
|
+
const u = y;
|
|
3415
|
+
return await (n === "" ? u.deposit(T) : u.transfer(T));
|
|
3379
3416
|
}
|
|
3380
3417
|
case s.Ethereum:
|
|
3381
3418
|
case s.BinanceSmartChain:
|
|
3382
3419
|
case s.Avalanche: {
|
|
3383
|
-
const { getChecksumAddressFromAsset:
|
|
3384
|
-
return await
|
|
3385
|
-
abi:
|
|
3386
|
-
contractAddress: a || (await A(this,
|
|
3420
|
+
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), l = r === s.Avalanche ? Pe : r === s.BinanceSmartChain ? Ve : Be;
|
|
3421
|
+
return await y.call({
|
|
3422
|
+
abi: l,
|
|
3423
|
+
contractAddress: a || (await A(this, P).call(this, r)).router,
|
|
3387
3424
|
funcName: "depositWithExpiry",
|
|
3388
3425
|
funcParams: [
|
|
3389
3426
|
n,
|
|
3390
|
-
|
|
3427
|
+
u({ chain: r, symbol: p, ticker: o }, r),
|
|
3391
3428
|
// TODO: (@Towan) Re-Check on that conversion 🙏
|
|
3392
3429
|
t.baseValueBigInt.toString(),
|
|
3393
|
-
|
|
3430
|
+
T.memo,
|
|
3394
3431
|
i.expiration
|
|
3395
3432
|
],
|
|
3396
|
-
txOverrides: { from:
|
|
3433
|
+
txOverrides: { from: T.from, value: t.baseValueBigInt }
|
|
3397
3434
|
});
|
|
3398
3435
|
}
|
|
3399
3436
|
default:
|
|
3400
|
-
return await
|
|
3437
|
+
return await y.transfer(T);
|
|
3401
3438
|
}
|
|
3402
|
-
} catch (
|
|
3403
|
-
const
|
|
3404
|
-
throw new
|
|
3439
|
+
} catch (u) {
|
|
3440
|
+
const l = ((u == null ? void 0 : u.message) || (u == null ? void 0 : u.toString())).toLowerCase(), h = l == null ? void 0 : l.includes("insufficient funds"), _ = l == null ? void 0 : l.includes("gas"), R = l == null ? void 0 : l.includes("server"), O = h ? "core_transaction_deposit_insufficient_funds_error" : _ ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
|
|
3441
|
+
throw new c(O, u);
|
|
3405
3442
|
}
|
|
3406
3443
|
});
|
|
3407
3444
|
/**
|
|
3408
3445
|
* TC related Methods
|
|
3409
3446
|
*/
|
|
3410
|
-
|
|
3447
|
+
m(this, "createLiquidity", async ({
|
|
3411
3448
|
runeAssetValue: t,
|
|
3412
3449
|
assetValue: n
|
|
3413
3450
|
}) => {
|
|
3414
3451
|
if (t.lte(0) || n.lte(0))
|
|
3415
|
-
throw new
|
|
3452
|
+
throw new c("core_transaction_create_liquidity_invalid_params");
|
|
3416
3453
|
let a = "", i = "";
|
|
3417
3454
|
try {
|
|
3418
|
-
a = await A(this,
|
|
3455
|
+
a = await A(this, x).call(this, {
|
|
3419
3456
|
assetValue: t,
|
|
3420
|
-
memo:
|
|
3457
|
+
memo: D(f.DEPOSIT, {
|
|
3421
3458
|
...n,
|
|
3422
3459
|
address: this.getAddress(n.chain)
|
|
3423
3460
|
})
|
|
3424
3461
|
});
|
|
3425
3462
|
} catch (r) {
|
|
3426
|
-
throw new
|
|
3463
|
+
throw new c("core_transaction_create_liquidity_rune_error", r);
|
|
3427
3464
|
}
|
|
3428
3465
|
try {
|
|
3429
|
-
i = await A(this,
|
|
3466
|
+
i = await A(this, x).call(this, {
|
|
3430
3467
|
assetValue: n,
|
|
3431
|
-
memo:
|
|
3468
|
+
memo: D(f.DEPOSIT, {
|
|
3432
3469
|
...n,
|
|
3433
3470
|
address: this.getAddress(s.THORChain)
|
|
3434
3471
|
})
|
|
3435
3472
|
});
|
|
3436
3473
|
} catch (r) {
|
|
3437
|
-
throw new
|
|
3474
|
+
throw new c("core_transaction_create_liquidity_asset_error", r);
|
|
3438
3475
|
}
|
|
3439
3476
|
return { runeTx: a, assetTx: i };
|
|
3440
3477
|
});
|
|
3441
|
-
|
|
3478
|
+
m(this, "addLiquidity", async ({
|
|
3442
3479
|
poolIdentifier: t,
|
|
3443
3480
|
runeAssetValue: n,
|
|
3444
3481
|
assetValue: a,
|
|
3445
3482
|
runeAddr: i,
|
|
3446
3483
|
assetAddr: r,
|
|
3447
3484
|
isPendingSymmAsset: p,
|
|
3448
|
-
mode:
|
|
3485
|
+
mode: o = "sym"
|
|
3449
3486
|
}) => {
|
|
3450
|
-
const [
|
|
3451
|
-
if (!
|
|
3452
|
-
throw new
|
|
3453
|
-
if (_ && !
|
|
3454
|
-
throw new
|
|
3455
|
-
let
|
|
3456
|
-
const b = { chain:
|
|
3457
|
-
if (
|
|
3487
|
+
const [y, ...T] = t.split("."), u = o === "sym", l = (n == null ? void 0 : n.gt(0)) && (u || o === "rune"), h = (a == null ? void 0 : a.gt(0)) && (u || o === "asset"), _ = p || l, R = _ ? i || this.getAddress(s.THORChain) : "", O = u || o === "asset" ? r || this.getAddress(y) : "";
|
|
3488
|
+
if (!l && !h)
|
|
3489
|
+
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
3490
|
+
if (_ && !R)
|
|
3491
|
+
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
3492
|
+
let S, I;
|
|
3493
|
+
const b = { chain: y, symbol: T.join(".") };
|
|
3494
|
+
if (l && n)
|
|
3458
3495
|
try {
|
|
3459
|
-
|
|
3496
|
+
S = await A(this, x).call(this, {
|
|
3460
3497
|
assetValue: n,
|
|
3461
|
-
memo:
|
|
3498
|
+
memo: D(f.DEPOSIT, { ...b, address: O })
|
|
3462
3499
|
});
|
|
3463
3500
|
} catch (M) {
|
|
3464
|
-
throw new
|
|
3501
|
+
throw new c("core_transaction_add_liquidity_rune_error", M);
|
|
3465
3502
|
}
|
|
3466
3503
|
if (h && a)
|
|
3467
3504
|
try {
|
|
3468
|
-
|
|
3505
|
+
I = await A(this, x).call(this, {
|
|
3469
3506
|
assetValue: a,
|
|
3470
|
-
memo:
|
|
3507
|
+
memo: D(f.DEPOSIT, { ...b, address: R })
|
|
3471
3508
|
});
|
|
3472
3509
|
} catch (M) {
|
|
3473
|
-
throw new
|
|
3510
|
+
throw new c("core_transaction_add_liquidity_asset_error", M);
|
|
3474
3511
|
}
|
|
3475
|
-
return { runeTx:
|
|
3512
|
+
return { runeTx: S, assetTx: I };
|
|
3476
3513
|
});
|
|
3477
|
-
|
|
3514
|
+
m(this, "withdraw", async ({
|
|
3478
3515
|
memo: t,
|
|
3479
3516
|
assetValue: n,
|
|
3480
3517
|
percent: a,
|
|
@@ -3483,9 +3520,9 @@ class en {
|
|
|
3483
3520
|
}) => {
|
|
3484
3521
|
const p = r === "rune" ? v.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n;
|
|
3485
3522
|
try {
|
|
3486
|
-
return await A(this,
|
|
3487
|
-
assetValue:
|
|
3488
|
-
memo: t ||
|
|
3523
|
+
return await A(this, x).call(this, {
|
|
3524
|
+
assetValue: he(i === "asset" ? n.chain : s.THORChain),
|
|
3525
|
+
memo: t || D(f.WITHDRAW, {
|
|
3489
3526
|
symbol: n.symbol,
|
|
3490
3527
|
chain: n.chain,
|
|
3491
3528
|
ticker: n.ticker,
|
|
@@ -3494,71 +3531,71 @@ class en {
|
|
|
3494
3531
|
singleSide: !1
|
|
3495
3532
|
})
|
|
3496
3533
|
});
|
|
3497
|
-
} catch (
|
|
3498
|
-
throw new
|
|
3534
|
+
} catch (o) {
|
|
3535
|
+
throw new c("core_transaction_withdraw_error", o);
|
|
3499
3536
|
}
|
|
3500
3537
|
});
|
|
3501
|
-
|
|
3538
|
+
m(this, "savings", async ({
|
|
3502
3539
|
assetValue: t,
|
|
3503
3540
|
memo: n,
|
|
3504
3541
|
percent: a,
|
|
3505
3542
|
type: i
|
|
3506
3543
|
}) => {
|
|
3507
|
-
const r = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n ||
|
|
3544
|
+
const r = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n || D(r, {
|
|
3508
3545
|
ticker: t.ticker,
|
|
3509
3546
|
symbol: t.symbol,
|
|
3510
3547
|
chain: t.chain,
|
|
3511
3548
|
singleSide: !0,
|
|
3512
3549
|
basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
|
|
3513
3550
|
});
|
|
3514
|
-
return A(this,
|
|
3551
|
+
return A(this, x).call(this, { assetValue: t, memo: p });
|
|
3515
3552
|
});
|
|
3516
|
-
|
|
3553
|
+
m(this, "loan", ({
|
|
3517
3554
|
assetValue: t,
|
|
3518
3555
|
memo: n,
|
|
3519
3556
|
minAmount: a,
|
|
3520
3557
|
type: i
|
|
3521
|
-
}) => A(this,
|
|
3558
|
+
}) => A(this, x).call(this, {
|
|
3522
3559
|
assetValue: t,
|
|
3523
|
-
memo: n ||
|
|
3560
|
+
memo: n || D(i === "open" ? f.OPEN_LOAN : f.CLOSE_LOAN, {
|
|
3524
3561
|
asset: t.toString(),
|
|
3525
3562
|
minAmount: a.toString(),
|
|
3526
3563
|
address: this.getAddress(t.chain)
|
|
3527
3564
|
})
|
|
3528
3565
|
}));
|
|
3529
|
-
|
|
3566
|
+
m(this, "nodeAction", ({
|
|
3530
3567
|
type: t,
|
|
3531
3568
|
assetValue: n,
|
|
3532
3569
|
address: a
|
|
3533
3570
|
}) => {
|
|
3534
|
-
const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, r =
|
|
3571
|
+
const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, r = D(i, {
|
|
3535
3572
|
address: a,
|
|
3536
3573
|
unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
|
|
3537
3574
|
});
|
|
3538
|
-
return A(this,
|
|
3575
|
+
return A(this, Y).call(this, {
|
|
3539
3576
|
memo: r,
|
|
3540
|
-
assetValue: t === "bond" ? n :
|
|
3577
|
+
assetValue: t === "bond" ? n : he(s.THORChain)
|
|
3541
3578
|
});
|
|
3542
3579
|
});
|
|
3543
|
-
|
|
3580
|
+
m(this, "registerThorname", ({
|
|
3544
3581
|
assetValue: t,
|
|
3545
3582
|
...n
|
|
3546
|
-
}) => A(this,
|
|
3547
|
-
|
|
3583
|
+
}) => A(this, Y).call(this, { assetValue: t, memo: D(f.THORNAME_REGISTER, n) }));
|
|
3584
|
+
m(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
3548
3585
|
try {
|
|
3549
3586
|
t.forEach((r) => {
|
|
3550
3587
|
this[r.connectMethodName] = r.connect({
|
|
3551
|
-
addChain: A(this,
|
|
3588
|
+
addChain: A(this, z),
|
|
3552
3589
|
config: n || {},
|
|
3553
3590
|
apis: a,
|
|
3554
3591
|
rpcUrls: i
|
|
3555
3592
|
});
|
|
3556
3593
|
});
|
|
3557
3594
|
} catch (r) {
|
|
3558
|
-
throw new
|
|
3595
|
+
throw new c("core_extend_error", r);
|
|
3559
3596
|
}
|
|
3560
3597
|
});
|
|
3561
|
-
|
|
3598
|
+
m(this, "estimateMaxSendableAmount", async ({
|
|
3562
3599
|
chain: t,
|
|
3563
3600
|
params: n
|
|
3564
3601
|
}) => {
|
|
@@ -3591,40 +3628,40 @@ class en {
|
|
|
3591
3628
|
});
|
|
3592
3629
|
}
|
|
3593
3630
|
default:
|
|
3594
|
-
throw new
|
|
3631
|
+
throw new c("core_estimated_max_spendable_chain_not_supported");
|
|
3595
3632
|
}
|
|
3596
3633
|
});
|
|
3597
3634
|
/**
|
|
3598
3635
|
* Wallet connection methods
|
|
3599
3636
|
*/
|
|
3600
|
-
|
|
3601
|
-
throw new
|
|
3637
|
+
m(this, "connectXDEFI", async (t) => {
|
|
3638
|
+
throw new c("core_wallet_xdefi_not_installed");
|
|
3602
3639
|
});
|
|
3603
|
-
|
|
3604
|
-
throw new
|
|
3640
|
+
m(this, "connectEVMWallet", async (t, n) => {
|
|
3641
|
+
throw new c("core_wallet_evmwallet_not_installed");
|
|
3605
3642
|
});
|
|
3606
|
-
|
|
3607
|
-
throw new
|
|
3643
|
+
m(this, "connectWalletconnect", async (t, n) => {
|
|
3644
|
+
throw new c("core_wallet_walletconnect_not_installed");
|
|
3608
3645
|
});
|
|
3609
|
-
|
|
3610
|
-
throw new
|
|
3646
|
+
m(this, "connectKeystore", async (t, n) => {
|
|
3647
|
+
throw new c("core_wallet_keystore_not_installed");
|
|
3611
3648
|
});
|
|
3612
|
-
|
|
3613
|
-
throw new
|
|
3649
|
+
m(this, "connectLedger", async (t, n) => {
|
|
3650
|
+
throw new c("core_wallet_ledger_not_installed");
|
|
3614
3651
|
});
|
|
3615
|
-
|
|
3616
|
-
throw new
|
|
3652
|
+
m(this, "connectTrezor", async (t, n) => {
|
|
3653
|
+
throw new c("core_wallet_trezor_not_installed");
|
|
3617
3654
|
});
|
|
3618
|
-
|
|
3619
|
-
throw new
|
|
3655
|
+
m(this, "connectKeplr", async (t) => {
|
|
3656
|
+
throw new c("core_wallet_keplr_not_installed");
|
|
3620
3657
|
});
|
|
3621
|
-
|
|
3622
|
-
throw new
|
|
3658
|
+
m(this, "connectOkx", async (t) => {
|
|
3659
|
+
throw new c("core_wallet_okx_not_installed");
|
|
3623
3660
|
});
|
|
3624
|
-
|
|
3661
|
+
m(this, "disconnectChain", (t) => {
|
|
3625
3662
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
3626
3663
|
});
|
|
3627
|
-
|
|
3664
|
+
B(this, P, async (t) => {
|
|
3628
3665
|
if (t === s.THORChain)
|
|
3629
3666
|
return {
|
|
3630
3667
|
gas_rate: "0",
|
|
@@ -3633,63 +3670,63 @@ class en {
|
|
|
3633
3670
|
halted: !1,
|
|
3634
3671
|
chain: s.THORChain
|
|
3635
3672
|
};
|
|
3636
|
-
const a = (await
|
|
3673
|
+
const a = (await Dt(this.stagenet)).find((i) => i.chain === t);
|
|
3637
3674
|
if (!a)
|
|
3638
|
-
throw new
|
|
3675
|
+
throw new c("core_inbound_data_not_found");
|
|
3639
3676
|
if (a != null && a.halted)
|
|
3640
|
-
throw new
|
|
3677
|
+
throw new c("core_chain_halted");
|
|
3641
3678
|
return a;
|
|
3642
3679
|
});
|
|
3643
|
-
|
|
3680
|
+
B(this, z, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
3644
3681
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
3645
3682
|
});
|
|
3646
|
-
|
|
3683
|
+
B(this, K, async ({
|
|
3647
3684
|
assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: i, isSynthetic: r },
|
|
3648
3685
|
type: p = "checkOnly",
|
|
3649
|
-
contractAddress:
|
|
3686
|
+
contractAddress: o
|
|
3650
3687
|
}) => {
|
|
3651
|
-
const
|
|
3652
|
-
if (
|
|
3688
|
+
const y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(a);
|
|
3689
|
+
if (y && i || !y || r)
|
|
3653
3690
|
return !0;
|
|
3654
|
-
const
|
|
3655
|
-
if (!
|
|
3656
|
-
throw new
|
|
3691
|
+
const u = this.connectedWallets[a], l = p === "checkOnly" ? u == null ? void 0 : u.isApproved : u == null ? void 0 : u.approve;
|
|
3692
|
+
if (!l)
|
|
3693
|
+
throw new c("core_wallet_connection_not_found");
|
|
3657
3694
|
const h = this.getAddress(a);
|
|
3658
3695
|
if (!n || !h)
|
|
3659
|
-
throw new
|
|
3660
|
-
const _ =
|
|
3661
|
-
return
|
|
3696
|
+
throw new c("core_approve_asset_address_or_from_not_found");
|
|
3697
|
+
const _ = o || (await A(this, P).call(this, a)).router;
|
|
3698
|
+
return l({
|
|
3662
3699
|
amount: t,
|
|
3663
3700
|
assetAddress: n,
|
|
3664
3701
|
from: h,
|
|
3665
3702
|
spenderAddress: _
|
|
3666
3703
|
});
|
|
3667
3704
|
});
|
|
3668
|
-
|
|
3705
|
+
B(this, x, async ({
|
|
3669
3706
|
assetValue: t,
|
|
3670
3707
|
memo: n,
|
|
3671
|
-
feeOptionKey: a =
|
|
3708
|
+
feeOptionKey: a = k.Fast
|
|
3672
3709
|
}) => {
|
|
3673
3710
|
const {
|
|
3674
3711
|
gas_rate: i,
|
|
3675
3712
|
router: r,
|
|
3676
3713
|
address: p
|
|
3677
|
-
} = await A(this,
|
|
3714
|
+
} = await A(this, P).call(this, t.chain), o = (parseInt(i) || 0) * st[a];
|
|
3678
3715
|
return this.deposit({
|
|
3679
3716
|
assetValue: t,
|
|
3680
3717
|
recipient: p,
|
|
3681
3718
|
memo: n,
|
|
3682
3719
|
router: r,
|
|
3683
|
-
feeRate:
|
|
3720
|
+
feeRate: o
|
|
3684
3721
|
});
|
|
3685
3722
|
});
|
|
3686
|
-
|
|
3723
|
+
B(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
3687
3724
|
const a = await Bt(this.stagenet);
|
|
3688
3725
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
3689
|
-
throw new
|
|
3726
|
+
throw new c("core_chain_halted");
|
|
3690
3727
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
3691
3728
|
});
|
|
3692
|
-
|
|
3729
|
+
B(this, X, ({ assetValue: t, ...n }) => ({
|
|
3693
3730
|
...n,
|
|
3694
3731
|
memo: n.memo || "",
|
|
3695
3732
|
from: this.getAddress(t.chain),
|
|
@@ -3698,65 +3735,65 @@ class en {
|
|
|
3698
3735
|
this.stagenet = !!t;
|
|
3699
3736
|
}
|
|
3700
3737
|
}
|
|
3701
|
-
|
|
3738
|
+
P = new WeakMap(), z = new WeakMap(), K = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
3702
3739
|
export {
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3740
|
+
Ue as AGG_SWAP,
|
|
3741
|
+
Ae as ApiError,
|
|
3742
|
+
W as ApiUrl,
|
|
3706
3743
|
v as AssetValue,
|
|
3707
3744
|
E as BaseDecimal,
|
|
3745
|
+
pe as BigIntArithmetics,
|
|
3708
3746
|
s as Chain,
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
F as FeeOption,
|
|
3747
|
+
le as ChainId,
|
|
3748
|
+
Ft as ChainIdToChain,
|
|
3749
|
+
Ke as ChainToChainId,
|
|
3750
|
+
Ee as ChainToExplorerUrl,
|
|
3751
|
+
kt as ChainToHexChainId,
|
|
3752
|
+
Ye as ChainToRPC,
|
|
3753
|
+
Ge as ContractAddress,
|
|
3754
|
+
$t as CosmosChainList,
|
|
3755
|
+
We as DerivationPath,
|
|
3756
|
+
d as ERROR_CODE,
|
|
3757
|
+
ke as ERROR_MODULE,
|
|
3758
|
+
be as ERROR_TYPE,
|
|
3759
|
+
Ut as EVMChainList,
|
|
3760
|
+
Xe as ErrorCode,
|
|
3761
|
+
k as FeeOption,
|
|
3725
3762
|
f as MemoType,
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3763
|
+
Lt as NetworkDerivationPath,
|
|
3764
|
+
Le as QuoteMode,
|
|
3765
|
+
we as RPCUrl,
|
|
3766
|
+
He as SWAP_IN,
|
|
3767
|
+
$e as SWAP_OUT,
|
|
3768
|
+
zt as SwapKitCore,
|
|
3769
|
+
c as SwapKitError,
|
|
3770
|
+
ye as SwapKitNumber,
|
|
3771
|
+
Pe as TCAvalancheDepositABI,
|
|
3772
|
+
Ve as TCBscDepositABI,
|
|
3736
3773
|
Be as TCEthereumVaultAbi,
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3774
|
+
Ht as UTXOChainList,
|
|
3775
|
+
je as WalletOption,
|
|
3776
|
+
Kt as assetFromString,
|
|
3777
|
+
qt as derivationPathToString,
|
|
3778
|
+
Vt as erc20ABI,
|
|
3742
3779
|
ge as formatBigIntToSafeValue,
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3780
|
+
st as gasFeeMultiplier,
|
|
3781
|
+
pt as getAssetType,
|
|
3782
|
+
dt as getAsymmetricAssetShare,
|
|
3783
|
+
Xt as getAsymmetricAssetWithdrawAmount,
|
|
3784
|
+
ot as getAsymmetricRuneShare,
|
|
3785
|
+
Yt as getAsymmetricRuneWithdrawAmount,
|
|
3786
|
+
rt as getCommonAssetInfo,
|
|
3787
|
+
Ie as getDecimal,
|
|
3788
|
+
Qt as getEstimatedPoolShare,
|
|
3789
|
+
Jt as getLiquiditySlippage,
|
|
3790
|
+
D as getMemoFor,
|
|
3791
|
+
he as getMinAmountByChain,
|
|
3792
|
+
Re as getRequest,
|
|
3793
|
+
ut as getSymmetricPoolShare,
|
|
3794
|
+
jt as getSymmetricWithdraw,
|
|
3795
|
+
Gt as getTHORNameCost,
|
|
3796
|
+
it as isGasAsset,
|
|
3797
|
+
Ze as postRequest,
|
|
3798
|
+
Wt as validateTHORName
|
|
3762
3799
|
};
|