@swapkit/types 0.0.0-nightly-20240208140027
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/LICENSE +201 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +877 -0
- package/dist/index.es.js +887 -0
- package/dist/index.es.js.map +1 -0
- package/package.json +42 -0
- package/src/abis/erc20.ts +99 -0
- package/src/abis/tcEthVault.ts +496 -0
- package/src/chainflip.ts +30 -0
- package/src/commonTypes.ts +148 -0
- package/src/errors/apiError.ts +75 -0
- package/src/errors/displayMessages.ts +71 -0
- package/src/errors/index.ts +2 -0
- package/src/errors/types.ts +144 -0
- package/src/index.ts +8 -0
- package/src/network.ts +290 -0
- package/src/thorchain.ts +26 -0
- package/src/transactions.ts +22 -0
- package/src/wallet.ts +28 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,877 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
export declare type AddChainWalletParams = {
|
|
4
|
+
chain: Chain;
|
|
5
|
+
wallet: ChainWallet;
|
|
6
|
+
walletMethods: any;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export declare const AGG_SWAP: QuoteMode[];
|
|
10
|
+
|
|
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({
|
|
23
|
+
status,
|
|
24
|
+
revision,
|
|
25
|
+
module,
|
|
26
|
+
code,
|
|
27
|
+
message,
|
|
28
|
+
type,
|
|
29
|
+
options: { shouldLog, shouldThrow, shouldTrace },
|
|
30
|
+
displayMessageParams,
|
|
31
|
+
}: ErrorInfo);
|
|
32
|
+
static fromErrorInfo(errorInfo: ErrorInfo): ApiError;
|
|
33
|
+
toErrorInfo(): ErrorInfo;
|
|
34
|
+
get identifier(): string;
|
|
35
|
+
get displayMessage(): string;
|
|
36
|
+
handle(): ErrorInfo;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export declare type ApiErrorOptions = {
|
|
40
|
+
shouldLog?: boolean;
|
|
41
|
+
shouldTrace?: boolean;
|
|
42
|
+
shouldThrow?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
declare type ApisType = {
|
|
46
|
+
[key in UTXOChain]?: string | any;
|
|
47
|
+
} & {
|
|
48
|
+
[key in EVMChain]?: string | any;
|
|
49
|
+
} & {
|
|
50
|
+
[key in CosmosChain]?: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export declare enum ApiUrl {
|
|
54
|
+
Cosmos = 'https://node-router.thorswap.net/cosmos/rest',
|
|
55
|
+
Kujira = 'https://lcd-kujira.synergynodes.com/',
|
|
56
|
+
MayanodeMainnet = 'https://mayanode.mayachain.info',
|
|
57
|
+
MayanodeStagenet = 'https://stagenet.mayanode.mayachain.info',
|
|
58
|
+
ThornodeMainnet = 'https://thornode.thorswap.net',
|
|
59
|
+
ThornodeStagenet = 'https://stagenet-thornode.ninerealms.com',
|
|
60
|
+
ThorswapApi = 'https://api.thorswap.net',
|
|
61
|
+
ThorswapStatic = 'https://static.thorswap.net',
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare type Asset = {
|
|
65
|
+
chain: Chain;
|
|
66
|
+
symbol: string;
|
|
67
|
+
ticker: string;
|
|
68
|
+
synth?: boolean;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export declare enum BaseDecimal {
|
|
72
|
+
ARB = 18,
|
|
73
|
+
AVAX = 18,
|
|
74
|
+
BCH = 8,
|
|
75
|
+
BNB = 8,
|
|
76
|
+
BSC = 18,
|
|
77
|
+
BTC = 8,
|
|
78
|
+
DASH = 8,
|
|
79
|
+
DOGE = 8,
|
|
80
|
+
DOT = 10,
|
|
81
|
+
ETH = 18,
|
|
82
|
+
FLIP = 18,
|
|
83
|
+
GAIA = 6,
|
|
84
|
+
KUJI = 6,
|
|
85
|
+
LTC = 8,
|
|
86
|
+
MATIC = 18,
|
|
87
|
+
MAYA = 10,
|
|
88
|
+
OP = 18,
|
|
89
|
+
THOR = 8,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare enum Chain {
|
|
93
|
+
Arbitrum = 'ARB',
|
|
94
|
+
Avalanche = 'AVAX',
|
|
95
|
+
Binance = 'BNB',
|
|
96
|
+
BinanceSmartChain = 'BSC',
|
|
97
|
+
Bitcoin = 'BTC',
|
|
98
|
+
BitcoinCash = 'BCH',
|
|
99
|
+
Cosmos = 'GAIA',
|
|
100
|
+
Dogecoin = 'DOGE',
|
|
101
|
+
Ethereum = 'ETH',
|
|
102
|
+
Kujira = 'KUJI',
|
|
103
|
+
Litecoin = 'LTC',
|
|
104
|
+
Maya = 'MAYA',
|
|
105
|
+
Optimism = 'OP',
|
|
106
|
+
Polkadot = 'DOT',
|
|
107
|
+
Chainflip = 'FLIP',
|
|
108
|
+
Polygon = 'MATIC',
|
|
109
|
+
THORChain = 'THOR',
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare enum ChainId {
|
|
113
|
+
Arbitrum = '42161',
|
|
114
|
+
ArbitrumHex = '0xa4b1',
|
|
115
|
+
Avalanche = '43114',
|
|
116
|
+
AvalancheHex = '0xa86a',
|
|
117
|
+
Binance = 'Binance-Chain-Tigris',
|
|
118
|
+
BinanceSmartChain = '56',
|
|
119
|
+
BinanceSmartChainHex = '0x38',
|
|
120
|
+
Bitcoin = 'bitcoin',
|
|
121
|
+
BitcoinCash = 'bitcoincash',
|
|
122
|
+
Chainflip = 'chainflip',
|
|
123
|
+
Cosmos = 'cosmoshub-4',
|
|
124
|
+
Dogecoin = 'dogecoin',
|
|
125
|
+
Kujira = 'kaiyo-1',
|
|
126
|
+
Ethereum = '1',
|
|
127
|
+
EthereumHex = '0x1',
|
|
128
|
+
Litecoin = 'litecoin',
|
|
129
|
+
Maya = 'mayachain-mainnet-v1',
|
|
130
|
+
MayaStagenet = 'mayachain-stagenet-v1',
|
|
131
|
+
Optimism = '10',
|
|
132
|
+
OptimismHex = '0xa',
|
|
133
|
+
Polkadot = 'polkadot',
|
|
134
|
+
Polygon = '137',
|
|
135
|
+
PolygonHex = '0x89',
|
|
136
|
+
THORChain = 'thorchain-mainnet-v1',
|
|
137
|
+
THORChainStagenet = 'thorchain-stagenet-v2',
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export declare const ChainIdToChain: Record<ChainId, Chain>;
|
|
141
|
+
|
|
142
|
+
export declare const ChainToChainId: {
|
|
143
|
+
ARB: ChainId;
|
|
144
|
+
AVAX: ChainId;
|
|
145
|
+
BNB: ChainId;
|
|
146
|
+
BSC: ChainId;
|
|
147
|
+
BTC: ChainId;
|
|
148
|
+
BCH: ChainId;
|
|
149
|
+
GAIA: ChainId;
|
|
150
|
+
DOGE: ChainId;
|
|
151
|
+
ETH: ChainId;
|
|
152
|
+
KUJI: ChainId;
|
|
153
|
+
LTC: ChainId;
|
|
154
|
+
MAYA: ChainId;
|
|
155
|
+
OP: ChainId;
|
|
156
|
+
DOT: ChainId;
|
|
157
|
+
FLIP: ChainId;
|
|
158
|
+
MATIC: ChainId;
|
|
159
|
+
THOR: ChainId;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export declare const ChainToExplorerUrl: Record<Chain, string>;
|
|
163
|
+
|
|
164
|
+
export declare const ChainToHexChainId: {
|
|
165
|
+
ARB: ChainId;
|
|
166
|
+
AVAX: ChainId;
|
|
167
|
+
BNB: ChainId;
|
|
168
|
+
BSC: ChainId;
|
|
169
|
+
BTC: ChainId;
|
|
170
|
+
BCH: ChainId;
|
|
171
|
+
GAIA: ChainId;
|
|
172
|
+
DOGE: ChainId;
|
|
173
|
+
ETH: ChainId;
|
|
174
|
+
KUJI: ChainId;
|
|
175
|
+
LTC: ChainId;
|
|
176
|
+
MAYA: ChainId;
|
|
177
|
+
OP: ChainId;
|
|
178
|
+
DOT: ChainId;
|
|
179
|
+
FLIP: ChainId;
|
|
180
|
+
MATIC: ChainId;
|
|
181
|
+
THOR: ChainId;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export declare const ChainToRPC: {
|
|
185
|
+
ARB: RPCUrl;
|
|
186
|
+
AVAX: RPCUrl;
|
|
187
|
+
BNB: RPCUrl;
|
|
188
|
+
BSC: RPCUrl;
|
|
189
|
+
BTC: RPCUrl;
|
|
190
|
+
BCH: RPCUrl;
|
|
191
|
+
GAIA: RPCUrl;
|
|
192
|
+
DOGE: RPCUrl;
|
|
193
|
+
ETH: RPCUrl;
|
|
194
|
+
KUJI: RPCUrl;
|
|
195
|
+
LTC: RPCUrl;
|
|
196
|
+
MAYA: RPCUrl;
|
|
197
|
+
OP: RPCUrl;
|
|
198
|
+
DOT: RPCUrl;
|
|
199
|
+
FLIP: RPCUrl;
|
|
200
|
+
MATIC: RPCUrl;
|
|
201
|
+
THOR: RPCUrl;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
declare type ChainWallet = {
|
|
205
|
+
address: string;
|
|
206
|
+
balance: any[];
|
|
207
|
+
walletType: WalletOption;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export declare type ConnectConfig = {
|
|
211
|
+
stagenet?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* @required
|
|
214
|
+
*/
|
|
215
|
+
thorswapApiKey?: string;
|
|
216
|
+
/**
|
|
217
|
+
* @required for AVAX & BSC
|
|
218
|
+
*/
|
|
219
|
+
covalentApiKey?: string;
|
|
220
|
+
/**
|
|
221
|
+
* @required for ETH
|
|
222
|
+
*/
|
|
223
|
+
ethplorerApiKey?: string;
|
|
224
|
+
/**
|
|
225
|
+
* @required for BTC, BCH, LTC, DOGE
|
|
226
|
+
*/
|
|
227
|
+
blockchairApiKey?: string;
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated - use blockchairApiKey instead
|
|
230
|
+
*/
|
|
231
|
+
utxoApiKey?: string;
|
|
232
|
+
/**
|
|
233
|
+
* @required for Walletconnect
|
|
234
|
+
*/
|
|
235
|
+
walletConnectProjectId?: string;
|
|
236
|
+
/**
|
|
237
|
+
* @optional for Trezor config
|
|
238
|
+
*/
|
|
239
|
+
trezorManifest?: {
|
|
240
|
+
email: string;
|
|
241
|
+
appUrl: string;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* @optional for KeepKey config
|
|
245
|
+
*/
|
|
246
|
+
keepkeyConfig?: {
|
|
247
|
+
apiKey: string;
|
|
248
|
+
pairingInfo: {
|
|
249
|
+
name: string;
|
|
250
|
+
imageUrl: string;
|
|
251
|
+
basePath: string;
|
|
252
|
+
url: string;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
declare type ConnectMethodNames =
|
|
258
|
+
| 'connectEVMWallet'
|
|
259
|
+
| 'connectKeplr'
|
|
260
|
+
| 'connectKeystore'
|
|
261
|
+
| 'connectKeepkey'
|
|
262
|
+
| 'connectLedger'
|
|
263
|
+
| 'connectOkx'
|
|
264
|
+
| 'connectTrezor'
|
|
265
|
+
| 'connectWalletconnect'
|
|
266
|
+
| 'connectXDEFI';
|
|
267
|
+
|
|
268
|
+
export declare type ConnectWalletParams = {
|
|
269
|
+
addChain: (params: AddChainWalletParams) => void;
|
|
270
|
+
config: ConnectConfig;
|
|
271
|
+
rpcUrls: {
|
|
272
|
+
[chain in Chain]?: string;
|
|
273
|
+
};
|
|
274
|
+
apis: ApisType;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export declare enum ContractAddress {
|
|
278
|
+
ARB = '0x0000000000000000000000000000000000000000',
|
|
279
|
+
AVAX = '0x0000000000000000000000000000000000000000',
|
|
280
|
+
ETH = '0x0000000000000000000000000000000000000000',
|
|
281
|
+
BSC = '0x0000000000000000000000000000000000000000',
|
|
282
|
+
MATIC = '0x0000000000000000000000000000000000001010',
|
|
283
|
+
OP = '0x4200000000000000000000000000000000000042',
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export declare type CosmosChain =
|
|
287
|
+
| Chain.Cosmos
|
|
288
|
+
| Chain.THORChain
|
|
289
|
+
| Chain.Binance
|
|
290
|
+
| Chain.Maya
|
|
291
|
+
| Chain.Kujira;
|
|
292
|
+
|
|
293
|
+
export declare const CosmosChainList: CosmosChain[];
|
|
294
|
+
|
|
295
|
+
export declare enum DerivationPath {
|
|
296
|
+
ARB = "m/44'/60'/0'/0",
|
|
297
|
+
AVAX = "m/44'/60'/0'/0",
|
|
298
|
+
BCH = "m/44'/145'/0'/0",
|
|
299
|
+
BNB = "m/44'/714'/0'/0",
|
|
300
|
+
BSC = "m/44'/60'/0'/0",
|
|
301
|
+
BTC = "m/84'/0'/0'/0",
|
|
302
|
+
DOGE = "m/44'/3'/0'/0",
|
|
303
|
+
DOT = '////',
|
|
304
|
+
ETH = "m/44'/60'/0'/0",
|
|
305
|
+
FLIP = '////',
|
|
306
|
+
GAIA = "m/44'/118'/0'/0",
|
|
307
|
+
KUJI = "m/44'/118'/0'/0",
|
|
308
|
+
LTC = "m/84'/2'/0'/0",
|
|
309
|
+
MATIC = "m/44'/60'/0'/0",
|
|
310
|
+
MAYA = "m/44'/931'/0'/0",
|
|
311
|
+
OP = "m/44'/60'/0'/0",
|
|
312
|
+
THOR = "m/44'/931'/0'/0",
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export declare type DerivationPathArray = [number, number, number, number, number];
|
|
316
|
+
|
|
317
|
+
export declare const erc20ABI: (
|
|
318
|
+
| {
|
|
319
|
+
inputs: never[];
|
|
320
|
+
stateMutability: string;
|
|
321
|
+
type: string;
|
|
322
|
+
anonymous?: undefined;
|
|
323
|
+
name?: undefined;
|
|
324
|
+
outputs?: undefined;
|
|
325
|
+
}
|
|
326
|
+
| {
|
|
327
|
+
anonymous: boolean;
|
|
328
|
+
inputs: {
|
|
329
|
+
indexed: boolean;
|
|
330
|
+
internalType: string;
|
|
331
|
+
name: string;
|
|
332
|
+
type: string;
|
|
333
|
+
}[];
|
|
334
|
+
name: string;
|
|
335
|
+
type: string;
|
|
336
|
+
stateMutability?: undefined;
|
|
337
|
+
outputs?: undefined;
|
|
338
|
+
}
|
|
339
|
+
| {
|
|
340
|
+
inputs: {
|
|
341
|
+
internalType: string;
|
|
342
|
+
name: string;
|
|
343
|
+
type: string;
|
|
344
|
+
}[];
|
|
345
|
+
name: string;
|
|
346
|
+
outputs: {
|
|
347
|
+
internalType: string;
|
|
348
|
+
name: string;
|
|
349
|
+
type: string;
|
|
350
|
+
}[];
|
|
351
|
+
stateMutability: string;
|
|
352
|
+
type: string;
|
|
353
|
+
anonymous?: undefined;
|
|
354
|
+
}
|
|
355
|
+
)[];
|
|
356
|
+
|
|
357
|
+
export declare enum ERROR_CODE {
|
|
358
|
+
INVALID_INPUT_PARAMETERS = '1000',
|
|
359
|
+
UNKNOWN_PROVIDERS = '1001',
|
|
360
|
+
CANNOT_FIND_INBOUND_ADDRESS = '1002',
|
|
361
|
+
NO_INBOUND_ADDRESSES = '1003',
|
|
362
|
+
CHAIN_HALTED_OR_UNSUPPORTED = '1004',
|
|
363
|
+
MISSING_INPUT_PARAMETER = '1005',
|
|
364
|
+
INVALID_TYPE_GENERIC = '1100',
|
|
365
|
+
INVALID_NUMBER_STRING = '1101',
|
|
366
|
+
INVALID_NUMBER = '1102',
|
|
367
|
+
INVALID_BOOLEAN = '1103',
|
|
368
|
+
INVALID_OBJECT = '1104',
|
|
369
|
+
INVALID_ARRAY = '1105',
|
|
370
|
+
SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = '2000',
|
|
371
|
+
SELL_BUY_ASSETS_ARE_THE_SAME = '2001',
|
|
372
|
+
MISSING_SOURCE_ADDRESS_FOR_SYNTH = '2002',
|
|
373
|
+
AFF_ADDRESS_AND_BPS_OR_NEITHER = '2003',
|
|
374
|
+
AFF_ADDRESS_TOO_LONG = '2004',
|
|
375
|
+
AFF_BPS_INTEGER_MAX_500 = '2005',
|
|
376
|
+
SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = '2006',
|
|
377
|
+
DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = '2007',
|
|
378
|
+
PREFERRED_PROVIDER_NOT_SUPPORTED = '2008',
|
|
379
|
+
DESTINATION_ADDRESS_SMART_CONTRACT = '2009',
|
|
380
|
+
BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = '2010',
|
|
381
|
+
SOURCE_ADDRESS_SMART_CONTRACT = '2011',
|
|
382
|
+
INVALID_PROVIDER = '2100',
|
|
383
|
+
MISSING_CROSS_CHAIN_PROVIDER = '2101',
|
|
384
|
+
MISSING_AVAX_PROVIDER = '2102',
|
|
385
|
+
MISSING_BSC_PROVIDER = '2103',
|
|
386
|
+
MISSING_ETH_PROVIDER = '2104',
|
|
387
|
+
INVALID_PROVIDER_FOR_SWAP_OUT = '2105',
|
|
388
|
+
MISSING_ARB_PROVIDER = '2106',
|
|
389
|
+
INVALID_CHAIN = '2200',
|
|
390
|
+
INVALID_ASSET = '2201',
|
|
391
|
+
INVALID_ASSET_IDENTIFIER = '2202',
|
|
392
|
+
UNSUPPORTED_CHAIN = '2204',
|
|
393
|
+
UNSUPPORTED_ASSET = '2203',
|
|
394
|
+
UNSUPPORTED_ASSET_FOR_SWAPOUT = '2205',
|
|
395
|
+
INVALID_SOURCE_ADDRESS = '2300',
|
|
396
|
+
INVALID_DESTINATION_ADDRESS = '2301',
|
|
397
|
+
THORNODE_QUOTE_GENERIC_ERROR = '3000',
|
|
398
|
+
NOT_ENOUGH_SYNTH_BALANCE = '3001',
|
|
399
|
+
SYNTH_MINTING_CAP_REACHED = '3002',
|
|
400
|
+
INVALID_QUOTE_MODE = '4000',
|
|
401
|
+
NO_QUOTES = '4001',
|
|
402
|
+
SERVICE_UNAVAILABLE_GENERIC = '5000',
|
|
403
|
+
MISSING_GAS_DATA_GENERIC = '5100',
|
|
404
|
+
MISSING_TOKEN_INFO_GENERIC = '5200',
|
|
405
|
+
CANT_FIND_TOKEN_LIST = '5201',
|
|
406
|
+
NO_PRICE = '5202',
|
|
407
|
+
PRICE_IS_STALE = '5203',
|
|
408
|
+
ADDRESS_NOT_WHITELISTED = '6000',
|
|
409
|
+
ADDRESS_ALREADY_CLAIMED = '6001',
|
|
410
|
+
TEMPORARY_ERROR = '9999',
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export declare enum ERROR_MODULE {
|
|
414
|
+
HEALTH_CONTROLLER = '1000',
|
|
415
|
+
LIQUIDITY_CONTROLLER = '1001',
|
|
416
|
+
PROVIDER_CONTROLLER = '1002',
|
|
417
|
+
QUOTE_CONTROLLER = '1003',
|
|
418
|
+
SWAP_CONTROLLER = '1004',
|
|
419
|
+
UTIL_CONTROLLER = '1005',
|
|
420
|
+
AIRDROP_CONTROLLER = '1006',
|
|
421
|
+
PROVIDER = '2000',
|
|
422
|
+
ASSET = '2001',
|
|
423
|
+
TOKEN_LIST = '2002',
|
|
424
|
+
QUOTE = '2100',
|
|
425
|
+
QUOTE_TXN_DETAILS = '2101',
|
|
426
|
+
THORCHAIN_PROVIDER = '3000',
|
|
427
|
+
UNISWAPV2_ETH_PROVIDER = '3001',
|
|
428
|
+
UNISWAPV3_ETH_PROVIDER = '3002',
|
|
429
|
+
SUSHISWAP_ETH_PROVIDER = '3003',
|
|
430
|
+
PANCAKESWAP_BSC_PROVIDER = '3004',
|
|
431
|
+
PANCAKESWAP_ETH_PROVIDER = '3005',
|
|
432
|
+
ONEINCH_ETH_PROVIDER = '3006',
|
|
433
|
+
ONEINCH_BSC_PROVIDER = '3007',
|
|
434
|
+
ONEINCH_AVAX_PROVIDER = '3008',
|
|
435
|
+
ZEROX_ETH_PROVIDER = '3009',
|
|
436
|
+
WOOFI_AVAX_PROVIDER = '3010',
|
|
437
|
+
PANGOLIN_AVAX_PROVIDER = '3011',
|
|
438
|
+
TRADERJOE_AVAX_PROVIDER = '3012',
|
|
439
|
+
KYBER_ETH_PROVIDER = '3013',
|
|
440
|
+
KYBER_AVAX_PROVIDER = '3014',
|
|
441
|
+
WOOFI_BSC_PROVIDER = '3015',
|
|
442
|
+
STARGATE_PROVIDER = '3016',
|
|
443
|
+
PROVIDER_UTIL = '4000',
|
|
444
|
+
TXN_DETAILS = '5000',
|
|
445
|
+
AIRDROP_UTIL = '6000',
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export declare enum ERROR_TYPE {
|
|
449
|
+
VALIDATION_ERROR = 'VALIDATION_ERROR',
|
|
450
|
+
REQUEST_PARAMETER_ERROR = 'REQUEST_PARAMETER_ERROR',
|
|
451
|
+
RESPONSE_PARSING_ERROR = 'RESPONSE_PARSING_ERROR',
|
|
452
|
+
UNSUPPORTED = 'UNSUPPORTED',
|
|
453
|
+
NOT_IMPLEMENTED = 'NOT_IMPLEMENTED',
|
|
454
|
+
INCOMPATIBLE_ASSETS_OPERATIONS = 'INCOMPATIBLE_ASSETS_OPERATIONS',
|
|
455
|
+
SERVICE_UNAVAILABLE = 'SERVICE_UNAVAILABLE',
|
|
456
|
+
DOWN_FOR_MAINTENANCE = 'DOWN_FOR_MAINTENANCE',
|
|
457
|
+
MISSING_INBOUND_INFO = 'MISSING_INBOUND_INFO',
|
|
458
|
+
QUOTE_FETCHING_ERROR = 'QUOTE_FETCHING_ERROR',
|
|
459
|
+
AIRDROP_ERROR = 'AIRDROP_ERROR',
|
|
460
|
+
UNHANDLED_ERROR = 'UNHANDLED_ERROR',
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export declare type ErrorInfo = {
|
|
464
|
+
status: number;
|
|
465
|
+
revision: string;
|
|
466
|
+
type?: ERROR_TYPE;
|
|
467
|
+
module: ERROR_MODULE;
|
|
468
|
+
code: ERROR_CODE;
|
|
469
|
+
message?: string | undefined;
|
|
470
|
+
stack?: string;
|
|
471
|
+
identifier?: string;
|
|
472
|
+
options?: ApiErrorOptions;
|
|
473
|
+
displayMessageParams?: string[];
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
export declare type EVMChain =
|
|
477
|
+
| Chain.Ethereum
|
|
478
|
+
| Chain.Avalanche
|
|
479
|
+
| Chain.BinanceSmartChain
|
|
480
|
+
| Chain.Arbitrum
|
|
481
|
+
| Chain.Optimism
|
|
482
|
+
| Chain.Polygon;
|
|
483
|
+
|
|
484
|
+
export declare const EVMChainList: EVMChain[];
|
|
485
|
+
|
|
486
|
+
export declare type EVMTxBaseParams<T = bigint> = {
|
|
487
|
+
to?: string;
|
|
488
|
+
from?: string;
|
|
489
|
+
nonce?: number;
|
|
490
|
+
gasLimit?: T;
|
|
491
|
+
data?: string;
|
|
492
|
+
value?: T;
|
|
493
|
+
chainId?: T;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
export declare type EVMWalletOptions =
|
|
497
|
+
| WalletOption.BRAVE
|
|
498
|
+
| WalletOption.OKX_MOBILE
|
|
499
|
+
| WalletOption.METAMASK
|
|
500
|
+
| WalletOption.TRUSTWALLET_WEB
|
|
501
|
+
| WalletOption.COINBASE_WEB;
|
|
502
|
+
|
|
503
|
+
export declare type ExtendParams<WalletConnectMethodNames = ''> = {
|
|
504
|
+
excludedChains?: Chain[];
|
|
505
|
+
config?: ConnectConfig;
|
|
506
|
+
rpcUrls?: {
|
|
507
|
+
[chain in Chain]?: string;
|
|
508
|
+
};
|
|
509
|
+
apis?: ApisType;
|
|
510
|
+
wallets: {
|
|
511
|
+
connectMethodName: ConnectMethodNames | WalletConnectMethodNames;
|
|
512
|
+
connect: (params: ConnectWalletParams) => (...params: any) => Promise<any>;
|
|
513
|
+
}[];
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
export declare enum FeeOption {
|
|
517
|
+
Average = 'average',
|
|
518
|
+
Fast = 'fast',
|
|
519
|
+
Fastest = 'fastest',
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export declare type GetAddressAndPubKeyResponse = {
|
|
523
|
+
bech32_address: string;
|
|
524
|
+
compressed_pk: any;
|
|
525
|
+
error_message: string;
|
|
526
|
+
return_code: number;
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
export declare enum LedgerErrorCode {
|
|
530
|
+
NoError = 36864,
|
|
531
|
+
LockedDevice = 21781,
|
|
532
|
+
TC_NotFound = 65535,
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export declare enum MemoType {
|
|
536
|
+
BOND = 'BOND',
|
|
537
|
+
DEPOSIT = '+',
|
|
538
|
+
LEAVE = 'LEAVE',
|
|
539
|
+
THORNAME_REGISTER = '~',
|
|
540
|
+
UNBOND = 'UNBOND',
|
|
541
|
+
WITHDRAW = '-',
|
|
542
|
+
OPEN_LOAN = '$+',
|
|
543
|
+
CLOSE_LOAN = '$-',
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export declare const NetworkDerivationPath: Record<Chain, DerivationPathArray>;
|
|
547
|
+
|
|
548
|
+
export declare enum QuoteMode {
|
|
549
|
+
TC_SUPPORTED_TO_TC_SUPPORTED = 'TC-TC',
|
|
550
|
+
TC_SUPPORTED_TO_ETH = 'TC-ERC20',
|
|
551
|
+
TC_SUPPORTED_TO_AVAX = 'TC-ARC20',
|
|
552
|
+
TC_SUPPORTED_TO_BSC = 'TC-BEP20',
|
|
553
|
+
ETH_TO_TC_SUPPORTED = 'ERC20-TC',
|
|
554
|
+
ETH_TO_ETH = 'ERC20-ERC20',
|
|
555
|
+
ETH_TO_AVAX = 'ERC20-ARC20',
|
|
556
|
+
ETH_TO_BSC = 'ERC20-BEP20',
|
|
557
|
+
AVAX_TO_TC_SUPPORTED = 'ARC20-TC',
|
|
558
|
+
AVAX_TO_ETH = 'ARC20-ERC20',
|
|
559
|
+
AVAX_TO_AVAX = 'ARC20-ARC20',
|
|
560
|
+
AVAX_TO_BSC = 'ARC20-BEP20',
|
|
561
|
+
BSC_TO_TC_SUPPORTED = 'BEP20-TC',
|
|
562
|
+
BSC_TO_ETH = 'BEP20-ERC20',
|
|
563
|
+
BSC_TO_AVAX = 'BEP20-ARC20',
|
|
564
|
+
BSC_TO_BSC = 'BEP20-BEP20',
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export declare enum RPCUrl {
|
|
568
|
+
Arbitrum = 'https://arb1.arbitrum.io/rpc',
|
|
569
|
+
Avalanche = 'https://node-router.thorswap.net/avalanche-c',
|
|
570
|
+
Binance = '',
|
|
571
|
+
BinanceSmartChain = 'https://bsc-dataseed.binance.org',
|
|
572
|
+
Bitcoin = 'https://node-router.thorswap.net/bitcoin',
|
|
573
|
+
BitcoinCash = 'https://node-router.thorswap.net/bitcoin-cash',
|
|
574
|
+
Chainflip = 'wss://mainnet-archive.chainflip.io',
|
|
575
|
+
Cosmos = 'https://node-router.thorswap.net/cosmos/rpc',
|
|
576
|
+
Kujira = 'https://rpc-kujira.synergynodes.com/',
|
|
577
|
+
Dogecoin = 'https://node-router.thorswap.net/dogecoin',
|
|
578
|
+
Ethereum = 'https://node-router.thorswap.net/ethereum',
|
|
579
|
+
Litecoin = 'https://node-router.thorswap.net/litecoin',
|
|
580
|
+
Maya = 'https://tendermint.mayachain.info',
|
|
581
|
+
MayaStagenet = 'https://stagenet.tendermint.mayachain.info',
|
|
582
|
+
Optimism = 'https://mainnet.optimism.io',
|
|
583
|
+
Polkadot = 'wss://rpc.polkadot.io',
|
|
584
|
+
Polygon = 'https://polygon-rpc.com',
|
|
585
|
+
THORChain = 'https://rpc.thorswap.net',
|
|
586
|
+
THORChainStagenet = 'https://stagenet-rpc.ninerealms.com',
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export declare type Signature = {
|
|
590
|
+
pub_key: {
|
|
591
|
+
type: string;
|
|
592
|
+
value: string;
|
|
593
|
+
};
|
|
594
|
+
sequence: string;
|
|
595
|
+
signature: string;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
export declare const SWAP_IN: QuoteMode[];
|
|
599
|
+
|
|
600
|
+
export declare const SWAP_OUT: QuoteMode[];
|
|
601
|
+
|
|
602
|
+
export declare const TCAvalancheDepositABI: (
|
|
603
|
+
| {
|
|
604
|
+
inputs: never[];
|
|
605
|
+
stateMutability: string;
|
|
606
|
+
type: string;
|
|
607
|
+
anonymous?: undefined;
|
|
608
|
+
name?: undefined;
|
|
609
|
+
outputs?: undefined;
|
|
610
|
+
}
|
|
611
|
+
| {
|
|
612
|
+
anonymous: boolean;
|
|
613
|
+
inputs: (
|
|
614
|
+
| {
|
|
615
|
+
indexed: boolean;
|
|
616
|
+
internalType: string;
|
|
617
|
+
name: string;
|
|
618
|
+
type: string;
|
|
619
|
+
components?: undefined;
|
|
620
|
+
}
|
|
621
|
+
| {
|
|
622
|
+
components: {
|
|
623
|
+
internalType: string;
|
|
624
|
+
name: string;
|
|
625
|
+
type: string;
|
|
626
|
+
}[];
|
|
627
|
+
indexed: boolean;
|
|
628
|
+
internalType: string;
|
|
629
|
+
name: string;
|
|
630
|
+
type: string;
|
|
631
|
+
}
|
|
632
|
+
)[];
|
|
633
|
+
name: string;
|
|
634
|
+
type: string;
|
|
635
|
+
stateMutability?: undefined;
|
|
636
|
+
outputs?: undefined;
|
|
637
|
+
}
|
|
638
|
+
| {
|
|
639
|
+
inputs: (
|
|
640
|
+
| {
|
|
641
|
+
internalType: string;
|
|
642
|
+
name: string;
|
|
643
|
+
type: string;
|
|
644
|
+
components?: undefined;
|
|
645
|
+
}
|
|
646
|
+
| {
|
|
647
|
+
components: {
|
|
648
|
+
internalType: string;
|
|
649
|
+
name: string;
|
|
650
|
+
type: string;
|
|
651
|
+
}[];
|
|
652
|
+
internalType: string;
|
|
653
|
+
name: string;
|
|
654
|
+
type: string;
|
|
655
|
+
}
|
|
656
|
+
)[];
|
|
657
|
+
name: string;
|
|
658
|
+
outputs: never[];
|
|
659
|
+
stateMutability: string;
|
|
660
|
+
type: string;
|
|
661
|
+
anonymous?: undefined;
|
|
662
|
+
}
|
|
663
|
+
| {
|
|
664
|
+
inputs: {
|
|
665
|
+
internalType: string;
|
|
666
|
+
name: string;
|
|
667
|
+
type: string;
|
|
668
|
+
}[];
|
|
669
|
+
name: string;
|
|
670
|
+
outputs: {
|
|
671
|
+
internalType: string;
|
|
672
|
+
name: string;
|
|
673
|
+
type: string;
|
|
674
|
+
}[];
|
|
675
|
+
stateMutability: string;
|
|
676
|
+
type: string;
|
|
677
|
+
anonymous?: undefined;
|
|
678
|
+
}
|
|
679
|
+
)[];
|
|
680
|
+
|
|
681
|
+
export declare const TCBscDepositABI: (
|
|
682
|
+
| {
|
|
683
|
+
inputs: never[];
|
|
684
|
+
stateMutability: string;
|
|
685
|
+
type: string;
|
|
686
|
+
anonymous?: undefined;
|
|
687
|
+
name?: undefined;
|
|
688
|
+
outputs?: undefined;
|
|
689
|
+
}
|
|
690
|
+
| {
|
|
691
|
+
anonymous: boolean;
|
|
692
|
+
inputs: (
|
|
693
|
+
| {
|
|
694
|
+
indexed: boolean;
|
|
695
|
+
internalType: string;
|
|
696
|
+
name: string;
|
|
697
|
+
type: string;
|
|
698
|
+
components?: undefined;
|
|
699
|
+
}
|
|
700
|
+
| {
|
|
701
|
+
components: {
|
|
702
|
+
internalType: string;
|
|
703
|
+
name: string;
|
|
704
|
+
type: string;
|
|
705
|
+
}[];
|
|
706
|
+
indexed: boolean;
|
|
707
|
+
internalType: string;
|
|
708
|
+
name: string;
|
|
709
|
+
type: string;
|
|
710
|
+
}
|
|
711
|
+
)[];
|
|
712
|
+
name: string;
|
|
713
|
+
type: string;
|
|
714
|
+
stateMutability?: undefined;
|
|
715
|
+
outputs?: undefined;
|
|
716
|
+
}
|
|
717
|
+
| {
|
|
718
|
+
inputs: (
|
|
719
|
+
| {
|
|
720
|
+
internalType: string;
|
|
721
|
+
name: string;
|
|
722
|
+
type: string;
|
|
723
|
+
components?: undefined;
|
|
724
|
+
}
|
|
725
|
+
| {
|
|
726
|
+
components: {
|
|
727
|
+
internalType: string;
|
|
728
|
+
name: string;
|
|
729
|
+
type: string;
|
|
730
|
+
}[];
|
|
731
|
+
internalType: string;
|
|
732
|
+
name: string;
|
|
733
|
+
type: string;
|
|
734
|
+
}
|
|
735
|
+
)[];
|
|
736
|
+
name: string;
|
|
737
|
+
outputs: never[];
|
|
738
|
+
stateMutability: string;
|
|
739
|
+
type: string;
|
|
740
|
+
anonymous?: undefined;
|
|
741
|
+
}
|
|
742
|
+
| {
|
|
743
|
+
inputs: {
|
|
744
|
+
internalType: string;
|
|
745
|
+
name: string;
|
|
746
|
+
type: string;
|
|
747
|
+
}[];
|
|
748
|
+
name: string;
|
|
749
|
+
outputs: {
|
|
750
|
+
internalType: string;
|
|
751
|
+
name: string;
|
|
752
|
+
type: string;
|
|
753
|
+
}[];
|
|
754
|
+
stateMutability: string;
|
|
755
|
+
type: string;
|
|
756
|
+
anonymous?: undefined;
|
|
757
|
+
}
|
|
758
|
+
)[];
|
|
759
|
+
|
|
760
|
+
export declare const TCEthereumVaultAbi: (
|
|
761
|
+
| {
|
|
762
|
+
inputs: {
|
|
763
|
+
internalType: string;
|
|
764
|
+
name: string;
|
|
765
|
+
type: string;
|
|
766
|
+
}[];
|
|
767
|
+
stateMutability: string;
|
|
768
|
+
type: string;
|
|
769
|
+
anonymous?: undefined;
|
|
770
|
+
name?: undefined;
|
|
771
|
+
outputs?: undefined;
|
|
772
|
+
}
|
|
773
|
+
| {
|
|
774
|
+
anonymous: boolean;
|
|
775
|
+
inputs: (
|
|
776
|
+
| {
|
|
777
|
+
indexed: boolean;
|
|
778
|
+
internalType: string;
|
|
779
|
+
name: string;
|
|
780
|
+
type: string;
|
|
781
|
+
components?: undefined;
|
|
782
|
+
}
|
|
783
|
+
| {
|
|
784
|
+
components: {
|
|
785
|
+
internalType: string;
|
|
786
|
+
name: string;
|
|
787
|
+
type: string;
|
|
788
|
+
}[];
|
|
789
|
+
indexed: boolean;
|
|
790
|
+
internalType: string;
|
|
791
|
+
name: string;
|
|
792
|
+
type: string;
|
|
793
|
+
}
|
|
794
|
+
)[];
|
|
795
|
+
name: string;
|
|
796
|
+
type: string;
|
|
797
|
+
stateMutability?: undefined;
|
|
798
|
+
outputs?: undefined;
|
|
799
|
+
}
|
|
800
|
+
| {
|
|
801
|
+
inputs: (
|
|
802
|
+
| {
|
|
803
|
+
internalType: string;
|
|
804
|
+
name: string;
|
|
805
|
+
type: string;
|
|
806
|
+
components?: undefined;
|
|
807
|
+
}
|
|
808
|
+
| {
|
|
809
|
+
components: {
|
|
810
|
+
internalType: string;
|
|
811
|
+
name: string;
|
|
812
|
+
type: string;
|
|
813
|
+
}[];
|
|
814
|
+
internalType: string;
|
|
815
|
+
name: string;
|
|
816
|
+
type: string;
|
|
817
|
+
}
|
|
818
|
+
)[];
|
|
819
|
+
name: string;
|
|
820
|
+
outputs: never[];
|
|
821
|
+
stateMutability: string;
|
|
822
|
+
type: string;
|
|
823
|
+
anonymous?: undefined;
|
|
824
|
+
}
|
|
825
|
+
| {
|
|
826
|
+
inputs: {
|
|
827
|
+
internalType: string;
|
|
828
|
+
name: string;
|
|
829
|
+
type: string;
|
|
830
|
+
}[];
|
|
831
|
+
name: string;
|
|
832
|
+
outputs: {
|
|
833
|
+
internalType: string;
|
|
834
|
+
name: string;
|
|
835
|
+
type: string;
|
|
836
|
+
}[];
|
|
837
|
+
stateMutability: string;
|
|
838
|
+
type: string;
|
|
839
|
+
anonymous?: undefined;
|
|
840
|
+
}
|
|
841
|
+
)[];
|
|
842
|
+
|
|
843
|
+
export declare const TCSupportedChainList: Chain[];
|
|
844
|
+
|
|
845
|
+
export declare type UTXOChain = Chain.Bitcoin | Chain.BitcoinCash | Chain.Dogecoin | Chain.Litecoin;
|
|
846
|
+
|
|
847
|
+
export declare const UTXOChainList: UTXOChain[];
|
|
848
|
+
|
|
849
|
+
export declare enum WalletOption {
|
|
850
|
+
'KEYSTORE' = 'KEYSTORE',
|
|
851
|
+
'KEEPKEY' = 'KEEPKEY',
|
|
852
|
+
'XDEFI' = 'XDEFI',
|
|
853
|
+
'METAMASK' = 'METAMASK',
|
|
854
|
+
'COINBASE_WEB' = 'COINBASE_WEB',
|
|
855
|
+
'TREZOR' = 'TREZOR',
|
|
856
|
+
'TRUSTWALLET_WEB' = 'TRUSTWALLET_WEB',
|
|
857
|
+
'LEDGER' = 'LEDGER',
|
|
858
|
+
'KEPLR' = 'KEPLR',
|
|
859
|
+
'OKX' = 'OKX',
|
|
860
|
+
'OKX_MOBILE' = 'OKX_MOBILE',
|
|
861
|
+
'BRAVE' = 'BRAVE',
|
|
862
|
+
'WALLETCONNECT' = 'WALLETCONNECT',
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
export declare type WalletTxParams = {
|
|
866
|
+
feeOptionKey?: FeeOption;
|
|
867
|
+
from?: string;
|
|
868
|
+
memo?: string;
|
|
869
|
+
recipient: string;
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
export declare type Witness = {
|
|
873
|
+
value: number;
|
|
874
|
+
script: Buffer;
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
export {};
|