@swapkit/types 1.0.0-rc.37 → 1.0.0-rc.38
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 +1 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +22 -171
- package/dist/index.es.js +67 -189
- package/dist/index.es.js.map +1 -1
- package/package.json +5 -10
- package/src/abis/erc20.ts +57 -57
- package/src/abis/tcEthVault.ts +284 -284
- package/src/chainflip.ts +8 -8
- package/src/commonTypes.ts +40 -44
- package/src/index.ts +7 -8
- package/src/network.ts +98 -98
- package/src/thorchain.ts +8 -8
- package/src/transactions.ts +3 -3
- package/src/wallet.ts +13 -13
- package/src/errors/apiError.ts +0 -75
- package/src/errors/displayMessages.ts +0 -72
- package/src/errors/index.ts +0 -2
- package/src/errors/types.ts +0 -145
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
|
-
export declare type AddChainWalletParams = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare type AddChainWalletParams<T extends Chain> = {
|
|
4
|
+
address: string;
|
|
5
|
+
balance: any[];
|
|
6
|
+
walletType: WalletOption;
|
|
7
|
+
chain: T;
|
|
8
|
+
[key: string]: any;
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
export declare const AGG_SWAP: QuoteMode[];
|
|
10
12
|
|
|
11
|
-
export declare class ApiError extends Error {
|
|
12
|
-
readonly status: number;
|
|
13
|
-
readonly revision: string;
|
|
14
|
-
readonly type?: ERROR_TYPE;
|
|
15
|
-
readonly module: ERROR_MODULE;
|
|
16
|
-
readonly code: ERROR_CODE;
|
|
17
|
-
readonly message: string;
|
|
18
|
-
readonly display: string;
|
|
19
|
-
readonly stack?: string;
|
|
20
|
-
readonly options: ApiErrorOptions;
|
|
21
|
-
readonly displayMessageParams?: string[];
|
|
22
|
-
constructor({ status, revision, module, code, message, type, options: { shouldLog, shouldThrow, shouldTrace }, displayMessageParams, }: ErrorInfo);
|
|
23
|
-
static fromErrorInfo(errorInfo: ErrorInfo): ApiError;
|
|
24
|
-
toErrorInfo(): ErrorInfo;
|
|
25
|
-
get identifier(): string;
|
|
26
|
-
get displayMessage(): string;
|
|
27
|
-
handle(): ErrorInfo;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export declare type ApiErrorOptions = {
|
|
31
|
-
shouldLog?: boolean;
|
|
32
|
-
shouldTrace?: boolean;
|
|
33
|
-
shouldThrow?: boolean;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
13
|
declare type ApisType = {
|
|
37
14
|
[key in UTXOChain]?: string | any;
|
|
38
15
|
} & {
|
|
@@ -198,12 +175,6 @@ export declare const ChainToRPC: {
|
|
|
198
175
|
THOR: RPCUrl;
|
|
199
176
|
};
|
|
200
177
|
|
|
201
|
-
declare type ChainWallet = {
|
|
202
|
-
address: string;
|
|
203
|
-
balance: any[];
|
|
204
|
-
walletType: WalletOption;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
178
|
export declare type ConnectConfig = {
|
|
208
179
|
stagenet?: boolean;
|
|
209
180
|
/**
|
|
@@ -251,10 +222,10 @@ export declare type ConnectConfig = {
|
|
|
251
222
|
};
|
|
252
223
|
};
|
|
253
224
|
|
|
254
|
-
declare type ConnectMethodNames =
|
|
225
|
+
declare type ConnectMethodNames = "connectEVMWallet" | "connectKeplr" | "connectKeystore" | "connectKeepkey" | "connectLedger" | "connectOkx" | "connectTrezor" | "connectWalletconnect" | "connectXDEFI";
|
|
255
226
|
|
|
256
227
|
export declare type ConnectWalletParams = {
|
|
257
|
-
addChain: (params: AddChainWalletParams) => void;
|
|
228
|
+
addChain: <T extends Chain>(params: AddChainWalletParams<T>) => void;
|
|
258
229
|
config: ConnectConfig;
|
|
259
230
|
rpcUrls: {
|
|
260
231
|
[chain in Chain]?: string;
|
|
@@ -340,126 +311,6 @@ export declare const erc20ABI: ({
|
|
|
340
311
|
anonymous?: undefined;
|
|
341
312
|
})[];
|
|
342
313
|
|
|
343
|
-
export declare enum ERROR_CODE {
|
|
344
|
-
INVALID_INPUT_PARAMETERS = "1000",
|
|
345
|
-
UNKNOWN_PROVIDERS = "1001",
|
|
346
|
-
CANNOT_FIND_INBOUND_ADDRESS = "1002",
|
|
347
|
-
NO_INBOUND_ADDRESSES = "1003",
|
|
348
|
-
CHAIN_HALTED_OR_UNSUPPORTED = "1004",
|
|
349
|
-
MISSING_INPUT_PARAMETER = "1005",
|
|
350
|
-
INVALID_TYPE_GENERIC = "1100",
|
|
351
|
-
INVALID_NUMBER_STRING = "1101",
|
|
352
|
-
INVALID_NUMBER = "1102",
|
|
353
|
-
INVALID_BOOLEAN = "1103",
|
|
354
|
-
INVALID_OBJECT = "1104",
|
|
355
|
-
INVALID_ARRAY = "1105",
|
|
356
|
-
SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000",
|
|
357
|
-
SELL_BUY_ASSETS_ARE_THE_SAME = "2001",
|
|
358
|
-
MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002",
|
|
359
|
-
AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003",
|
|
360
|
-
AFF_ADDRESS_TOO_LONG = "2004",
|
|
361
|
-
AFF_BPS_INTEGER_MAX_500 = "2005",
|
|
362
|
-
SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006",
|
|
363
|
-
DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007",
|
|
364
|
-
PREFERRED_PROVIDER_NOT_SUPPORTED = "2008",
|
|
365
|
-
DESTINATION_ADDRESS_SMART_CONTRACT = "2009",
|
|
366
|
-
BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010",
|
|
367
|
-
SOURCE_ADDRESS_SMART_CONTRACT = "2011",
|
|
368
|
-
SWAP_AMOUNT_TOO_LOW = "2012",
|
|
369
|
-
INVALID_PROVIDER = "2100",
|
|
370
|
-
MISSING_CROSS_CHAIN_PROVIDER = "2101",
|
|
371
|
-
MISSING_AVAX_PROVIDER = "2102",
|
|
372
|
-
MISSING_BSC_PROVIDER = "2103",
|
|
373
|
-
MISSING_ETH_PROVIDER = "2104",
|
|
374
|
-
INVALID_PROVIDER_FOR_SWAP_OUT = "2105",
|
|
375
|
-
MISSING_ARB_PROVIDER = "2106",
|
|
376
|
-
INVALID_CHAIN = "2200",
|
|
377
|
-
INVALID_ASSET = "2201",
|
|
378
|
-
INVALID_ASSET_IDENTIFIER = "2202",
|
|
379
|
-
UNSUPPORTED_CHAIN = "2204",
|
|
380
|
-
UNSUPPORTED_ASSET = "2203",
|
|
381
|
-
UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205",
|
|
382
|
-
INVALID_SOURCE_ADDRESS = "2300",
|
|
383
|
-
INVALID_DESTINATION_ADDRESS = "2301",
|
|
384
|
-
THORNODE_QUOTE_GENERIC_ERROR = "3000",
|
|
385
|
-
NOT_ENOUGH_SYNTH_BALANCE = "3001",
|
|
386
|
-
SYNTH_MINTING_CAP_REACHED = "3002",
|
|
387
|
-
INVALID_QUOTE_MODE = "4000",
|
|
388
|
-
NO_QUOTES = "4001",
|
|
389
|
-
SERVICE_UNAVAILABLE_GENERIC = "5000",
|
|
390
|
-
MISSING_GAS_DATA_GENERIC = "5100",
|
|
391
|
-
MISSING_TOKEN_INFO_GENERIC = "5200",
|
|
392
|
-
CANT_FIND_TOKEN_LIST = "5201",
|
|
393
|
-
NO_PRICE = "5202",
|
|
394
|
-
PRICE_IS_STALE = "5203",
|
|
395
|
-
ADDRESS_NOT_WHITELISTED = "6000",
|
|
396
|
-
ADDRESS_ALREADY_CLAIMED = "6001",
|
|
397
|
-
TEMPORARY_ERROR = "9999"
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export declare enum ERROR_MODULE {
|
|
401
|
-
HEALTH_CONTROLLER = "1000",
|
|
402
|
-
LIQUIDITY_CONTROLLER = "1001",
|
|
403
|
-
PROVIDER_CONTROLLER = "1002",
|
|
404
|
-
QUOTE_CONTROLLER = "1003",
|
|
405
|
-
SWAP_CONTROLLER = "1004",
|
|
406
|
-
UTIL_CONTROLLER = "1005",
|
|
407
|
-
AIRDROP_CONTROLLER = "1006",
|
|
408
|
-
PROVIDER = "2000",
|
|
409
|
-
ASSET = "2001",
|
|
410
|
-
TOKEN_LIST = "2002",
|
|
411
|
-
QUOTE = "2100",
|
|
412
|
-
QUOTE_TXN_DETAILS = "2101",
|
|
413
|
-
THORCHAIN_PROVIDER = "3000",
|
|
414
|
-
UNISWAPV2_ETH_PROVIDER = "3001",
|
|
415
|
-
UNISWAPV3_ETH_PROVIDER = "3002",
|
|
416
|
-
SUSHISWAP_ETH_PROVIDER = "3003",
|
|
417
|
-
PANCAKESWAP_BSC_PROVIDER = "3004",
|
|
418
|
-
PANCAKESWAP_ETH_PROVIDER = "3005",
|
|
419
|
-
ONEINCH_ETH_PROVIDER = "3006",
|
|
420
|
-
ONEINCH_BSC_PROVIDER = "3007",
|
|
421
|
-
ONEINCH_AVAX_PROVIDER = "3008",
|
|
422
|
-
ZEROX_ETH_PROVIDER = "3009",
|
|
423
|
-
WOOFI_AVAX_PROVIDER = "3010",
|
|
424
|
-
PANGOLIN_AVAX_PROVIDER = "3011",
|
|
425
|
-
TRADERJOE_AVAX_PROVIDER = "3012",
|
|
426
|
-
KYBER_ETH_PROVIDER = "3013",
|
|
427
|
-
KYBER_AVAX_PROVIDER = "3014",
|
|
428
|
-
WOOFI_BSC_PROVIDER = "3015",
|
|
429
|
-
STARGATE_PROVIDER = "3016",
|
|
430
|
-
PROVIDER_UTIL = "4000",
|
|
431
|
-
TXN_DETAILS = "5000",
|
|
432
|
-
AIRDROP_UTIL = "6000"
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
export declare enum ERROR_TYPE {
|
|
436
|
-
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
437
|
-
REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR",
|
|
438
|
-
RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR",
|
|
439
|
-
UNSUPPORTED = "UNSUPPORTED",
|
|
440
|
-
NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
|
|
441
|
-
INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS",
|
|
442
|
-
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
443
|
-
DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE",
|
|
444
|
-
MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO",
|
|
445
|
-
QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR",
|
|
446
|
-
AIRDROP_ERROR = "AIRDROP_ERROR",
|
|
447
|
-
UNHANDLED_ERROR = "UNHANDLED_ERROR"
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
export declare type ErrorInfo = {
|
|
451
|
-
status: number;
|
|
452
|
-
revision: string;
|
|
453
|
-
type?: ERROR_TYPE;
|
|
454
|
-
module: ERROR_MODULE;
|
|
455
|
-
code: ERROR_CODE;
|
|
456
|
-
message?: string | undefined;
|
|
457
|
-
stack?: string;
|
|
458
|
-
identifier?: string;
|
|
459
|
-
options?: ApiErrorOptions;
|
|
460
|
-
displayMessageParams?: string[];
|
|
461
|
-
};
|
|
462
|
-
|
|
463
314
|
export declare type EVMChain = Chain.Ethereum | Chain.Avalanche | Chain.BinanceSmartChain | Chain.Arbitrum | Chain.Optimism | Chain.Polygon;
|
|
464
315
|
|
|
465
316
|
/**
|
|
@@ -482,7 +333,7 @@ export declare type EVMTxBaseParams<T = bigint> = {
|
|
|
482
333
|
|
|
483
334
|
export declare type EVMWalletOptions = WalletOption.BRAVE | WalletOption.OKX_MOBILE | WalletOption.METAMASK | WalletOption.TRUSTWALLET_WEB | WalletOption.COINBASE_WEB;
|
|
484
335
|
|
|
485
|
-
export declare type ExtendParams<WalletConnectMethodNames =
|
|
336
|
+
export declare type ExtendParams<WalletConnectMethodNames = ""> = {
|
|
486
337
|
excludedChains?: Chain[];
|
|
487
338
|
config?: ConnectConfig;
|
|
488
339
|
rpcUrls?: {
|
|
@@ -813,19 +664,19 @@ export declare const UTXOChainList: readonly [Chain.Bitcoin, Chain.BitcoinCash,
|
|
|
813
664
|
export declare const UTXOChains: readonly [Chain.Bitcoin, Chain.BitcoinCash, Chain.Dash, Chain.Dogecoin, Chain.Litecoin];
|
|
814
665
|
|
|
815
666
|
export declare enum WalletOption {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
667
|
+
KEYSTORE = "KEYSTORE",
|
|
668
|
+
KEEPKEY = "KEEPKEY",
|
|
669
|
+
XDEFI = "XDEFI",
|
|
670
|
+
METAMASK = "METAMASK",
|
|
671
|
+
COINBASE_WEB = "COINBASE_WEB",
|
|
672
|
+
TREZOR = "TREZOR",
|
|
673
|
+
TRUSTWALLET_WEB = "TRUSTWALLET_WEB",
|
|
674
|
+
LEDGER = "LEDGER",
|
|
675
|
+
KEPLR = "KEPLR",
|
|
676
|
+
OKX = "OKX",
|
|
677
|
+
OKX_MOBILE = "OKX_MOBILE",
|
|
678
|
+
BRAVE = "BRAVE",
|
|
679
|
+
WALLETCONNECT = "WALLETCONNECT"
|
|
829
680
|
}
|
|
830
681
|
|
|
831
682
|
export declare type WalletTxParams = {
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var O = (e, a, n) => a in e ? h(e, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[a] = n;
|
|
3
|
-
var s = (e, a, n) => (O(e, typeof a != "symbol" ? a + "" : a, n), n);
|
|
4
|
-
const X = [
|
|
1
|
+
const O = [
|
|
5
2
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
6
3
|
{
|
|
7
4
|
anonymous: !1,
|
|
@@ -99,7 +96,7 @@ const X = [
|
|
|
99
96
|
stateMutability: "nonpayable",
|
|
100
97
|
type: "function"
|
|
101
98
|
}
|
|
102
|
-
],
|
|
99
|
+
], h = [
|
|
103
100
|
{
|
|
104
101
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
105
102
|
stateMutability: "nonpayable",
|
|
@@ -274,7 +271,7 @@ const X = [
|
|
|
274
271
|
stateMutability: "view",
|
|
275
272
|
type: "function"
|
|
276
273
|
}
|
|
277
|
-
],
|
|
274
|
+
], B = [
|
|
278
275
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
279
276
|
{
|
|
280
277
|
anonymous: !1,
|
|
@@ -438,7 +435,7 @@ const X = [
|
|
|
438
435
|
stateMutability: "view",
|
|
439
436
|
type: "function"
|
|
440
437
|
}
|
|
441
|
-
],
|
|
438
|
+
], R = [
|
|
442
439
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
443
440
|
{
|
|
444
441
|
anonymous: !1,
|
|
@@ -591,13 +588,13 @@ const X = [
|
|
|
591
588
|
type: "function"
|
|
592
589
|
}
|
|
593
590
|
];
|
|
594
|
-
var
|
|
595
|
-
const
|
|
591
|
+
var y = /* @__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))(y || {});
|
|
592
|
+
const v = [
|
|
596
593
|
"ERC20-ERC20",
|
|
597
594
|
"ARC20-ARC20",
|
|
598
595
|
"BEP20-BEP20"
|
|
599
596
|
/* BSC_TO_BSC */
|
|
600
|
-
],
|
|
597
|
+
], H = [
|
|
601
598
|
"ERC20-TC",
|
|
602
599
|
"ERC20-ARC20",
|
|
603
600
|
"ERC20-BEP20",
|
|
@@ -608,130 +605,15 @@ const Y = [
|
|
|
608
605
|
"BEP20-ERC20",
|
|
609
606
|
"BEP20-ARC20"
|
|
610
607
|
/* BSC_TO_AVAX */
|
|
611
|
-
],
|
|
608
|
+
], S = [
|
|
612
609
|
"TC-TC",
|
|
613
610
|
"TC-ERC20",
|
|
614
611
|
"TC-ARC20",
|
|
615
612
|
"TC-BEP20"
|
|
616
613
|
/* TC_SUPPORTED_TO_BSC */
|
|
617
614
|
];
|
|
618
|
-
var
|
|
619
|
-
const
|
|
620
|
-
[t.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
621
|
-
[t.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
622
|
-
[t.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
623
|
-
[t.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
|
|
624
|
-
[t.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
|
|
625
|
-
[t.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
|
|
626
|
-
[t.INVALID_TYPE_GENERIC]: "Invalid type",
|
|
627
|
-
[t.INVALID_NUMBER_STRING]: "Invalid number string.",
|
|
628
|
-
[t.INVALID_NUMBER]: "Invalid number.",
|
|
629
|
-
[t.INVALID_BOOLEAN]: "Invalid boolean.",
|
|
630
|
-
[t.INVALID_OBJECT]: "Invalid object.",
|
|
631
|
-
[t.INVALID_ARRAY]: "Invalid array.",
|
|
632
|
-
[t.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
|
|
633
|
-
[t.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
|
|
634
|
-
[t.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
|
|
635
|
-
[t.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
|
|
636
|
-
[t.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 4 characters max.",
|
|
637
|
-
[t.AFF_BPS_INTEGER_MAX_500]: "affiliateBasisPoints must be an integer between 0 and 100.",
|
|
638
|
-
[t.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
|
|
639
|
-
[t.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
|
|
640
|
-
[t.PREFERRED_PROVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
|
|
641
|
-
[t.SOURCE_ADDRESS_SMART_CONTRACT]: "Source address is a smart contract.",
|
|
642
|
-
[t.SWAP_AMOUNT_TOO_LOW]: "Swap amount too low for this pair.",
|
|
643
|
-
[t.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
644
|
-
[t.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
645
|
-
[t.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
646
|
-
[t.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
|
|
647
|
-
[t.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
|
|
648
|
-
[t.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
|
|
649
|
-
[t.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
|
|
650
|
-
[t.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
|
|
651
|
-
[t.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
|
|
652
|
-
[t.INVALID_CHAIN]: "Invalid chain {0}.",
|
|
653
|
-
[t.INVALID_ASSET]: "Invalid asset {0}.",
|
|
654
|
-
[t.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
|
|
655
|
-
[t.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
|
|
656
|
-
[t.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
|
|
657
|
-
[t.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
|
|
658
|
-
[t.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
|
|
659
|
-
[t.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
|
|
660
|
-
[t.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
|
|
661
|
-
[t.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
|
|
662
|
-
[t.INVALID_QUOTE_MODE]: "Invalid quote mode.",
|
|
663
|
-
[t.NO_QUOTES]: "No quotes to service this request.",
|
|
664
|
-
[t.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
|
|
665
|
-
[t.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
|
|
666
|
-
[t.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
|
|
667
|
-
[t.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
|
|
668
|
-
[t.NO_PRICE]: "No price for asset {0}.",
|
|
669
|
-
[t.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
670
|
-
[t.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
671
|
-
[t.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
672
|
-
}, o = (e, a) => {
|
|
673
|
-
let n = V[e];
|
|
674
|
-
if (!n)
|
|
675
|
-
return "";
|
|
676
|
-
for (let r = 0; r < a.length; r++)
|
|
677
|
-
n = (n == null ? void 0 : n.replace(`{${r}}`, a[r])) ?? "";
|
|
678
|
-
return n;
|
|
679
|
-
};
|
|
680
|
-
class A extends Error {
|
|
681
|
-
constructor({
|
|
682
|
-
status: n,
|
|
683
|
-
revision: r,
|
|
684
|
-
module: S,
|
|
685
|
-
code: d,
|
|
686
|
-
message: _,
|
|
687
|
-
type: N,
|
|
688
|
-
options: { shouldLog: E, shouldThrow: c, shouldTrace: f } = {
|
|
689
|
-
shouldLog: !0,
|
|
690
|
-
shouldThrow: !0,
|
|
691
|
-
shouldTrace: !0
|
|
692
|
-
},
|
|
693
|
-
displayMessageParams: y
|
|
694
|
-
}) {
|
|
695
|
-
const l = _ || o(d, y || []) || "";
|
|
696
|
-
super(l);
|
|
697
|
-
s(this, "status");
|
|
698
|
-
s(this, "revision");
|
|
699
|
-
s(this, "type");
|
|
700
|
-
s(this, "module");
|
|
701
|
-
s(this, "code");
|
|
702
|
-
s(this, "message");
|
|
703
|
-
s(this, "display");
|
|
704
|
-
s(this, "stack");
|
|
705
|
-
s(this, "options");
|
|
706
|
-
s(this, "displayMessageParams");
|
|
707
|
-
this.status = n, this.revision = r || "NO_REVISION", this.module = S, this.message = l, this.display = o(d, y || []), this.code = d, this.type = N || m.UNHANDLED_ERROR, this.options = {
|
|
708
|
-
shouldLog: E || !0,
|
|
709
|
-
shouldTrace: f || !0,
|
|
710
|
-
shouldThrow: c || !1
|
|
711
|
-
}, this.displayMessageParams = y || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
712
|
-
}
|
|
713
|
-
static fromErrorInfo(n) {
|
|
714
|
-
return new A(n);
|
|
715
|
-
}
|
|
716
|
-
toErrorInfo() {
|
|
717
|
-
return { ...this, identifier: this.identifier };
|
|
718
|
-
}
|
|
719
|
-
get identifier() {
|
|
720
|
-
return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
|
|
721
|
-
}
|
|
722
|
-
get displayMessage() {
|
|
723
|
-
return o(this.code, this.displayMessageParams || []);
|
|
724
|
-
}
|
|
725
|
-
handle() {
|
|
726
|
-
const n = `[${this.identifier}]: ${this.message}`;
|
|
727
|
-
if (this.options.shouldLog && console.error(n, `
|
|
728
|
-
`, this.stack || ""), this.options.shouldThrow)
|
|
729
|
-
throw Error(n, { cause: this.stack });
|
|
730
|
-
return this.toErrorInfo();
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
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.Dash = "DASH", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(i || {}), g = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(g || {}), b = /* @__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.DASH = "m/44'/5'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.DOT = "////", e.ETH = "m/44'/60'/0'/0", e.FLIP = "////", e.GAIA = "m/44'/118'/0'/0", e.KUJI = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.MATIC = "m/44'/60'/0'/0", e.MAYA = "m/44'/931'/0'/0", e.OP = "m/44'/60'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(b || {});
|
|
734
|
-
const $ = {
|
|
615
|
+
var a = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dash = "DASH", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(a || {}), u = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(u || {}), o = /* @__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.DASH = "m/44'/5'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.DOT = "////", e.ETH = "m/44'/60'/0'/0", e.FLIP = "////", e.GAIA = "m/44'/118'/0'/0", e.KUJI = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.MATIC = "m/44'/60'/0'/0", e.MAYA = "m/44'/931'/0'/0", e.OP = "m/44'/60'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(o || {});
|
|
616
|
+
const _ = {
|
|
735
617
|
ARB: [44, 60, 0, 0, 0],
|
|
736
618
|
AVAX: [44, 60, 0, 0, 0],
|
|
737
619
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -752,12 +634,12 @@ const $ = {
|
|
|
752
634
|
DOT: [0, 0, 0, 0, 0],
|
|
753
635
|
FLIP: [0, 0, 0, 0, 0]
|
|
754
636
|
};
|
|
755
|
-
var
|
|
756
|
-
const
|
|
637
|
+
var m = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.DOT = 10] = "DOT", e[e.ETH = 18] = "ETH", e[e.FLIP = 18] = "FLIP", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e[e.ZEC = 8] = "ZEC", e))(m || {});
|
|
638
|
+
const w = [
|
|
757
639
|
"DOT",
|
|
758
640
|
"FLIP"
|
|
759
641
|
/* Chainflip */
|
|
760
|
-
],
|
|
642
|
+
], l = [
|
|
761
643
|
"ETH",
|
|
762
644
|
"AVAX",
|
|
763
645
|
"BSC",
|
|
@@ -765,19 +647,19 @@ const q = [
|
|
|
765
647
|
"OP",
|
|
766
648
|
"MATIC"
|
|
767
649
|
/* Polygon */
|
|
768
|
-
],
|
|
650
|
+
], M = l, T = [
|
|
769
651
|
"BTC",
|
|
770
652
|
"BCH",
|
|
771
653
|
"DASH",
|
|
772
654
|
"DOGE",
|
|
773
655
|
"LTC"
|
|
774
656
|
/* Litecoin */
|
|
775
|
-
],
|
|
657
|
+
], V = T, c = [
|
|
776
658
|
"GAIA",
|
|
777
659
|
"THOR",
|
|
778
660
|
"BNB"
|
|
779
661
|
/* Binance */
|
|
780
|
-
],
|
|
662
|
+
], L = c, A = [
|
|
781
663
|
"AVAX",
|
|
782
664
|
"BNB",
|
|
783
665
|
"BSC",
|
|
@@ -789,27 +671,27 @@ const q = [
|
|
|
789
671
|
"LTC",
|
|
790
672
|
"THOR"
|
|
791
673
|
/* THORChain */
|
|
792
|
-
],
|
|
793
|
-
var
|
|
794
|
-
const
|
|
795
|
-
(e,
|
|
796
|
-
const
|
|
797
|
-
return
|
|
674
|
+
], N = A;
|
|
675
|
+
var i = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Chainflip = "chainflip", e.Cosmos = "cosmoshub-4", e.Dash = "dash", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polkadot = "polkadot", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(i || {}), p = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Chainflip = "wss://mainnet-archive.chainflip.io", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Dash = "https://node-router.thorswap.net/dash", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polkadot = "wss://rpc.polkadot.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(p || {}), f = /* @__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))(f || {});
|
|
676
|
+
const s = Object.values(a), E = Object.keys(a), r = s.reduce(
|
|
677
|
+
(e, n) => {
|
|
678
|
+
const t = E.find((d) => a[d] === n);
|
|
679
|
+
return t && (e[n] = t), e;
|
|
798
680
|
},
|
|
799
681
|
{}
|
|
800
|
-
),
|
|
801
|
-
(e,
|
|
682
|
+
), k = s.reduce(
|
|
683
|
+
(e, n) => (e[n] = i[r[n]], e),
|
|
802
684
|
{}
|
|
803
|
-
),
|
|
804
|
-
(e,
|
|
685
|
+
), P = s.reduce(
|
|
686
|
+
(e, n) => (e[n] = p[r[n]], e),
|
|
805
687
|
{}
|
|
806
|
-
),
|
|
807
|
-
(e,
|
|
808
|
-
const
|
|
809
|
-
return e[
|
|
688
|
+
), X = s.reduce(
|
|
689
|
+
(e, n) => {
|
|
690
|
+
const t = `${r[n]}Hex`;
|
|
691
|
+
return e[n] = i[t], e;
|
|
810
692
|
},
|
|
811
693
|
{}
|
|
812
|
-
),
|
|
694
|
+
), I = {
|
|
813
695
|
"0xa4b1": "ARB",
|
|
814
696
|
42161: "ARB",
|
|
815
697
|
"0xa86a": "AVAX",
|
|
@@ -837,7 +719,7 @@ const p = Object.values(i), M = Object.keys(i), T = p.reduce(
|
|
|
837
719
|
"thorchain-stagenet-v2": "THOR",
|
|
838
720
|
"thorchain-mainnet-v1": "THOR"
|
|
839
721
|
/* THORChain */
|
|
840
|
-
},
|
|
722
|
+
}, K = {
|
|
841
723
|
ARB: "https://arbiscan.io",
|
|
842
724
|
AVAX: "https://snowtrace.io",
|
|
843
725
|
BSC: "https://bscscan.com",
|
|
@@ -857,45 +739,41 @@ const p = Object.values(i), M = Object.keys(i), T = p.reduce(
|
|
|
857
739
|
MATIC: "https://polygonscan.com",
|
|
858
740
|
THOR: "https://runescan.io"
|
|
859
741
|
};
|
|
860
|
-
var
|
|
742
|
+
var x = /* @__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))(x || {}), C = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(C || {}), b = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.KEEPKEY = "KEEPKEY", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.OKX_MOBILE = "OKX_MOBILE", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(b || {}), g = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(g || {});
|
|
861
743
|
export {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
i as
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
z as UTXOChainList,
|
|
897
|
-
H as UTXOChains,
|
|
898
|
-
w as WalletOption,
|
|
899
|
-
X as erc20ABI
|
|
744
|
+
v as AGG_SWAP,
|
|
745
|
+
f as ApiUrl,
|
|
746
|
+
m as BaseDecimal,
|
|
747
|
+
a as Chain,
|
|
748
|
+
i as ChainId,
|
|
749
|
+
I as ChainIdToChain,
|
|
750
|
+
k as ChainToChainId,
|
|
751
|
+
K as ChainToExplorerUrl,
|
|
752
|
+
X as ChainToHexChainId,
|
|
753
|
+
P as ChainToRPC,
|
|
754
|
+
u as ContractAddress,
|
|
755
|
+
L as CosmosChainList,
|
|
756
|
+
c as CosmosChains,
|
|
757
|
+
o as DerivationPath,
|
|
758
|
+
M as EVMChainList,
|
|
759
|
+
l as EVMChains,
|
|
760
|
+
C as FeeOption,
|
|
761
|
+
g as LedgerErrorCode,
|
|
762
|
+
x as MemoType,
|
|
763
|
+
_ as NetworkDerivationPath,
|
|
764
|
+
y as QuoteMode,
|
|
765
|
+
p as RPCUrl,
|
|
766
|
+
H as SWAP_IN,
|
|
767
|
+
S as SWAP_OUT,
|
|
768
|
+
w as SubstrateChainList,
|
|
769
|
+
B as TCAvalancheDepositABI,
|
|
770
|
+
R as TCBscDepositABI,
|
|
771
|
+
h as TCEthereumVaultAbi,
|
|
772
|
+
N as TCSupportedChainList,
|
|
773
|
+
A as TCSupportedChains,
|
|
774
|
+
V as UTXOChainList,
|
|
775
|
+
T as UTXOChains,
|
|
776
|
+
b as WalletOption,
|
|
777
|
+
O as erc20ABI
|
|
900
778
|
};
|
|
901
779
|
//# sourceMappingURL=index.es.js.map
|