@lifi/types 9.0.0-alpha.1 → 9.0.0-alpha.10

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.
Files changed (46) hide show
  1. package/README.md +30 -2
  2. package/dist/api.d.ts +34 -21
  3. package/dist/api.js +2 -5
  4. package/dist/bridges.d.ts +3 -21
  5. package/dist/bridges.js +1 -19
  6. package/dist/chains/Chain.d.ts +2 -1
  7. package/dist/{cjs → chains}/base.d.ts +0 -85
  8. package/dist/{base.js → chains/base.js} +0 -63
  9. package/dist/chains/index.d.ts +1 -0
  10. package/dist/chains/index.js +1 -0
  11. package/dist/cjs/api.d.ts +34 -21
  12. package/dist/cjs/api.js +3 -7
  13. package/dist/cjs/bridges.d.ts +3 -21
  14. package/dist/cjs/bridges.js +0 -20
  15. package/dist/cjs/chains/Chain.d.ts +2 -1
  16. package/dist/cjs/chains/Chain.js +1 -1
  17. package/dist/{base.d.ts → cjs/chains/base.d.ts} +0 -85
  18. package/dist/cjs/{base.js → chains/base.js} +3 -66
  19. package/dist/cjs/chains/index.d.ts +1 -0
  20. package/dist/cjs/chains/index.js +1 -0
  21. package/dist/cjs/exchanges.d.ts +4 -20
  22. package/dist/cjs/exchanges.js +0 -13
  23. package/dist/cjs/index.d.ts +1 -2
  24. package/dist/cjs/index.js +1 -2
  25. package/dist/cjs/step.d.ts +2 -2
  26. package/dist/cjs/tokens/base.d.ts +58 -0
  27. package/dist/cjs/tokens/base.js +66 -0
  28. package/dist/cjs/tokens/index.d.ts +2 -0
  29. package/dist/cjs/tokens/index.js +18 -0
  30. package/dist/cjs/tokens/token.d.ts +29 -0
  31. package/dist/exchanges.d.ts +4 -20
  32. package/dist/exchanges.js +1 -12
  33. package/dist/index.d.ts +1 -2
  34. package/dist/index.js +1 -2
  35. package/dist/step.d.ts +2 -2
  36. package/dist/tokens/base.d.ts +58 -0
  37. package/dist/tokens/base.js +63 -0
  38. package/dist/tokens/index.d.ts +2 -0
  39. package/dist/tokens/index.js +2 -0
  40. package/dist/tokens/token.d.ts +29 -0
  41. package/package.json +18 -31
  42. package/CHANGELOG.md +0 -1284
  43. package/dist/apiErrors.d.ts +0 -9
  44. package/dist/cjs/apiErrors.d.ts +0 -9
  45. /package/dist/cjs/{apiErrors.js → tokens/token.js} +0 -0
  46. /package/dist/{apiErrors.js → tokens/token.js} +0 -0
package/README.md CHANGED
@@ -1,9 +1,37 @@
1
- ### Installation
1
+ <div align="center">
2
2
 
3
+ [![license](https://img.shields.io/badge/license-Apache%202-blue)](/LICENSE.md)
4
+ [![npm latest package](https://img.shields.io/npm/v/@lifi/types/latest.svg)](https://www.npmjs.com/package/@lifi/types)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@lifi/types.svg)](https://www.npmjs.com/package/@lifi/types)
6
+ [![Follow on Twitter](https://img.shields.io/twitter/follow/lifiprotocol.svg?label=follow+LI.FI)](https://twitter.com/lifiprotocol)
7
+
8
+ </div>
9
+
10
+ # LI.FI - Types
11
+
12
+ Types for the LI.FI stack.
13
+
14
+ ## Summary
15
+
16
+ This package contains all common types for the [LI.FI SDK](https://github.com/lifinance/sdk).
17
+ Learn more about LI.FI on (https://li.fi).
18
+
19
+ Check out the [Changelog](./CHANGELOG.md) to see what changed in the last releases.
20
+
21
+ ## Installation
22
+
23
+ Install dependencies with yarn:
24
+
25
+ ```bash
26
+ yarn add @lifi/types
3
27
  ```
28
+
29
+ or
30
+
31
+ ```bash
4
32
  npm install --save @lifi/types
5
33
  ```
6
34
 
7
- ### Summary
35
+ ## Summary
8
36
 
9
37
  This package contains type definitions for LI.FI projects (https://github.com/lifinance).
package/dist/api.d.ts CHANGED
@@ -1,21 +1,29 @@
1
- import { BridgeDefinition, Chain, ChainId, ExchangeDefinition, LifiStep, Token } from '.';
2
- import { ToolError } from './apiErrors';
1
+ import { BridgeDefinition } from './bridges';
2
+ import { Chain } from './chains';
3
+ import { ChainId } from './chains/base';
4
+ import { ExchangeDefinition } from './exchanges';
5
+ import { Action, LifiStep } from './step';
6
+ import { Token } from './tokens';
7
+ /**
8
+ * Used as a bigint replacement for TransactionRequest because bigint is not serializable
9
+ */
10
+ export type BigIntish = string;
3
11
  export type TransactionRequest = {
4
12
  to?: string;
5
13
  from?: string;
6
14
  nonce?: number;
7
- gasLimit?: bigint;
8
- gasPrice?: bigint;
9
- data?: `0x${string}`;
10
- value?: bigint;
15
+ gasLimit?: BigIntish;
16
+ gasPrice?: BigIntish;
17
+ data?: string;
18
+ value?: BigIntish;
11
19
  chainId?: number;
12
20
  type?: number;
13
21
  accessList?: {
14
- address: `0x${string}`;
15
- storageKeys: `0x${string}`[];
22
+ address: string;
23
+ storageKeys: string[];
16
24
  }[];
17
- maxPriorityFeePerGas?: bigint;
18
- maxFeePerGas?: bigint;
25
+ maxPriorityFeePerGas?: BigIntish;
26
+ maxFeePerGas?: BigIntish;
19
27
  customData?: Record<string, any>;
20
28
  ccipReadEnabled?: boolean;
21
29
  };
@@ -33,18 +41,18 @@ export interface RoutesRequest {
33
41
  fromAmountForGas?: string;
34
42
  }
35
43
  export interface RouteOptions {
44
+ integrator?: string;
45
+ fee?: number;
46
+ insurance?: boolean;
47
+ maxPriceImpact?: number;
36
48
  order?: Order;
37
49
  slippage?: number;
50
+ referrer?: string;
38
51
  infiniteApproval?: boolean;
39
52
  allowSwitchChain?: boolean;
40
- integrator?: string;
41
53
  allowDestinationCall?: boolean;
42
- referrer?: string;
43
54
  bridges?: AllowDenyPrefer;
44
55
  exchanges?: AllowDenyPrefer;
45
- fee?: number;
46
- insurance?: boolean;
47
- maxPriceImpact?: number;
48
56
  }
49
57
  export type ToolsResponse = {
50
58
  exchanges: {
@@ -94,6 +102,14 @@ export interface Route {
94
102
  steps: LifiStep[];
95
103
  tags?: Order[];
96
104
  }
105
+ export type ToolErrorType = 'NO_QUOTE';
106
+ export interface ToolError {
107
+ errorType: ToolErrorType;
108
+ code: string;
109
+ action: Action;
110
+ tool: string;
111
+ message: string;
112
+ }
97
113
  export type ErroredPaths = {
98
114
  [subpath: string]: ToolError[];
99
115
  };
@@ -245,16 +261,13 @@ export interface PendingReceivingInfo {
245
261
  }
246
262
  declare const _StatusMessage: readonly ["NOT_FOUND", "INVALID", "PENDING", "DONE", "FAILED"];
247
263
  export type StatusMessage = (typeof _StatusMessage)[number];
248
- declare const _SubstatusPending: readonly ["WAIT_SOURCE_CONFIRMATIONS", "WAIT_DESTINATION_TRANSACTION", "BRIDGE_NOT_AVAILABLE", "CHAIN_NOT_AVAILABLE", "REFUND_IN_PROGRESS", "UNKNOWN_ERROR"];
264
+ declare const _SubstatusPending: readonly ["WAIT_SOURCE_CONFIRMATIONS", "WAIT_DESTINATION_TRANSACTION", "BRIDGE_NOT_AVAILABLE", "CHAIN_NOT_AVAILABLE", "NOT_PROCESSABLE_REFUND_NEEDED", "REFUND_IN_PROGRESS", "UNKNOWN_ERROR"];
249
265
  export type SubstatusPending = (typeof _SubstatusPending)[number];
250
266
  declare const _SubstatusDone: readonly ["COMPLETED", "PARTIAL", "REFUNDED"];
251
267
  export type SubstatusDone = (typeof _SubstatusDone)[number];
252
- declare const _SubstatusFailed: readonly ["NOT_PROCESSABLE_REFUND_NEEDED"];
253
- export type SubstatusFailed = (typeof _SubstatusFailed)[number];
254
- export type Substatus = SubstatusPending | SubstatusDone | SubstatusFailed;
255
- export declare const isSubstatusPending: (substatus: Substatus) => substatus is "WAIT_SOURCE_CONFIRMATIONS" | "WAIT_DESTINATION_TRANSACTION" | "BRIDGE_NOT_AVAILABLE" | "CHAIN_NOT_AVAILABLE" | "REFUND_IN_PROGRESS" | "UNKNOWN_ERROR";
268
+ export type Substatus = SubstatusPending | SubstatusDone;
269
+ export declare const isSubstatusPending: (substatus: Substatus) => substatus is "WAIT_SOURCE_CONFIRMATIONS" | "WAIT_DESTINATION_TRANSACTION" | "BRIDGE_NOT_AVAILABLE" | "CHAIN_NOT_AVAILABLE" | "NOT_PROCESSABLE_REFUND_NEEDED" | "REFUND_IN_PROGRESS" | "UNKNOWN_ERROR";
256
270
  export declare const isSubstatusDone: (substatus: Substatus) => substatus is "COMPLETED" | "PARTIAL" | "REFUNDED";
257
- export declare const isSubstatusFailed: (substatus: Substatus) => substatus is "NOT_PROCESSABLE_REFUND_NEEDED";
258
271
  export interface BaseStatusData {
259
272
  status: StatusMessage;
260
273
  substatus?: Substatus;
package/dist/api.js CHANGED
@@ -25,6 +25,8 @@ const _SubstatusPending = [
25
25
  'BRIDGE_NOT_AVAILABLE',
26
26
  // The RPC for source/destination chain is temporarily unavailable
27
27
  'CHAIN_NOT_AVAILABLE',
28
+ // The transfer cannot be completed, a refund is required
29
+ 'NOT_PROCESSABLE_REFUND_NEEDED',
28
30
  // A refund has been requested and is in progress
29
31
  'REFUND_IN_PROGRESS',
30
32
  // We cannot determine the status of the transfer
@@ -40,11 +42,6 @@ const _SubstatusDone = [
40
42
  // The transfer was not successful but it has been refunded
41
43
  'REFUNDED',
42
44
  ];
43
- const _SubstatusFailed = [
44
- // The transfer cannot be completed, a refund is required
45
- 'NOT_PROCESSABLE_REFUND_NEEDED',
46
- ];
47
45
  export const isSubstatusPending = (substatus) => _SubstatusPending.includes(substatus);
48
46
  export const isSubstatusDone = (substatus) => _SubstatusDone.includes(substatus);
49
- export const isSubstatusFailed = (substatus) => _SubstatusFailed.includes(substatus);
50
47
  const _LIFuelState = ['PENDING', 'DONE', 'NOT_FOUND'];
package/dist/bridges.d.ts CHANGED
@@ -1,24 +1,6 @@
1
- import { BaseToken } from './base';
2
- /**
3
- * @deprecated
4
- * These values are now obtainable from the LI.FI API
5
- */
6
- export declare enum BridgeTool {
7
- connext = "connext",
8
- hop = "hop",
9
- multichain = "multichain",
10
- cbridge = "cbridge",
11
- hyphen = "hyphen",
12
- polygon = "polygon",
13
- arbitrum = "arbitrum",
14
- avalanche = "avalanche",
15
- optimism = "optimism",
16
- across = "across",
17
- portal = "portal",
18
- stargate = "stargate"
19
- }
1
+ import { BaseToken } from './tokens/token';
20
2
  export interface Bridge {
21
- key: BridgeTool;
3
+ key: string;
22
4
  name: string;
23
5
  logoURI: string;
24
6
  bridgeUrl?: string;
@@ -33,7 +15,7 @@ export interface Bridge {
33
15
  * @deprecated
34
16
  */
35
17
  export interface BridgeDefinition {
36
- tool: BridgeTool;
18
+ tool: string;
37
19
  fromChainId: number;
38
20
  fromToken: BaseToken;
39
21
  toChainId: number;
package/dist/bridges.js CHANGED
@@ -1,19 +1 @@
1
- /**
2
- * @deprecated
3
- * These values are now obtainable from the LI.FI API
4
- */
5
- export var BridgeTool;
6
- (function (BridgeTool) {
7
- BridgeTool["connext"] = "connext";
8
- BridgeTool["hop"] = "hop";
9
- BridgeTool["multichain"] = "multichain";
10
- BridgeTool["cbridge"] = "cbridge";
11
- BridgeTool["hyphen"] = "hyphen";
12
- BridgeTool["polygon"] = "polygon";
13
- BridgeTool["arbitrum"] = "arbitrum";
14
- BridgeTool["avalanche"] = "avalanche";
15
- BridgeTool["optimism"] = "optimism";
16
- BridgeTool["across"] = "across";
17
- BridgeTool["portal"] = "portal";
18
- BridgeTool["stargate"] = "stargate";
19
- })(BridgeTool || (BridgeTool = {}));
1
+ export {};
@@ -1,4 +1,5 @@
1
- import { ChainKey, CoinKey } from '../base';
1
+ import { CoinKey } from '../tokens/base';
2
+ import { ChainKey } from './base';
2
3
  export declare enum ChainType {
3
4
  EVM = "EVM",
4
5
  Solana = "SOLANA"
@@ -1,61 +1,3 @@
1
- export declare enum CoinKey {
2
- ETH = "ETH",
3
- MATIC = "MATIC",
4
- BNB = "BNB",
5
- DAI = "DAI",
6
- FTM = "FTM",
7
- OKT = "OKT",
8
- AVAX = "AVAX",
9
- HT = "HT",
10
- ONE = "ONE",
11
- FSN = "FSN",
12
- MOVR = "MOVR",
13
- EXP = "EXP",
14
- TCH = "TCH",
15
- UBQ = "UBQ",
16
- META = "META",
17
- DIODE = "DIODE",
18
- CELO = "CELO",
19
- FUSE = "FUSE",
20
- TLOS = "TLOS",
21
- CRO = "CRO",
22
- SHIB = "SHIB",
23
- L1 = "L1",
24
- RBTC = "RBTC",
25
- TBG = "TBG",
26
- VLX = "VLX",
27
- GLMR = "GLMR",
28
- METIS = "METIS",
29
- SOL = "SOL",
30
- EVM = "EVM",
31
- USDT = "USDT",
32
- USDC = "USDC",
33
- cbtUSDC = "cbtUSDC",
34
- cbtUSDT = "cbtUSDT",
35
- cbtWUSDT = "cbtWUSDT",
36
- cbtWUSDC = "cbtWUSDC",
37
- cbtCELR = "cbtCELR",
38
- BUSD = "BUSD",
39
- USDCe = "USDCe",
40
- TEST = "TEST",
41
- KAL = "KAL",
42
- SDIODE = "SDIODE",
43
- SPARK = "SPARK",
44
- TRBTC = "TRBTC",
45
- CXTT = "CXTT",
46
- sgMETIS = "sgMETIS",
47
- sgWOO = "sgWOO",
48
- sgUSDT = "sgUSDT",
49
- sgBUSD = "sgBUSD",
50
- sgUSDC = "sgUSDC",
51
- WBTC = "WBTC",
52
- WETH = "WETH",
53
- SUSHI = "SUSHI",
54
- DODO = "DODO",
55
- MCB = "MCB",
56
- CELR = "CELR",
57
- IF = "IF"
58
- }
59
1
  export declare enum ChainKey {
60
2
  ETH = "eth",
61
3
  POL = "pol",
@@ -178,30 +120,3 @@ export declare enum ChainId {
178
120
  FTMT = 4002,
179
121
  LNAT = 59140
180
122
  }
181
- export interface BaseToken {
182
- chainId: ChainId;
183
- address: string;
184
- }
185
- export interface StaticToken extends BaseToken {
186
- symbol: string;
187
- decimals: number;
188
- name: string;
189
- coinKey?: CoinKey;
190
- logoURI?: string;
191
- }
192
- export interface Token extends StaticToken {
193
- priceUSD: string;
194
- }
195
- export interface TokenAmount extends Token {
196
- amount?: bigint;
197
- blockNumber?: bigint;
198
- }
199
- export interface Coin {
200
- key: CoinKey;
201
- name: string;
202
- logoURI: string;
203
- verified: boolean;
204
- chains: {
205
- [ChainId: string]: StaticToken;
206
- };
207
- }
@@ -1,66 +1,3 @@
1
- export var CoinKey;
2
- (function (CoinKey) {
3
- CoinKey["ETH"] = "ETH";
4
- CoinKey["MATIC"] = "MATIC";
5
- CoinKey["BNB"] = "BNB";
6
- CoinKey["DAI"] = "DAI";
7
- CoinKey["FTM"] = "FTM";
8
- CoinKey["OKT"] = "OKT";
9
- CoinKey["AVAX"] = "AVAX";
10
- CoinKey["HT"] = "HT";
11
- CoinKey["ONE"] = "ONE";
12
- CoinKey["FSN"] = "FSN";
13
- CoinKey["MOVR"] = "MOVR";
14
- CoinKey["EXP"] = "EXP";
15
- CoinKey["TCH"] = "TCH";
16
- CoinKey["UBQ"] = "UBQ";
17
- CoinKey["META"] = "META";
18
- CoinKey["DIODE"] = "DIODE";
19
- CoinKey["CELO"] = "CELO";
20
- CoinKey["FUSE"] = "FUSE";
21
- CoinKey["TLOS"] = "TLOS";
22
- CoinKey["CRO"] = "CRO";
23
- CoinKey["SHIB"] = "SHIB";
24
- CoinKey["L1"] = "L1";
25
- CoinKey["RBTC"] = "RBTC";
26
- CoinKey["TBG"] = "TBG";
27
- CoinKey["VLX"] = "VLX";
28
- CoinKey["GLMR"] = "GLMR";
29
- CoinKey["METIS"] = "METIS";
30
- CoinKey["SOL"] = "SOL";
31
- CoinKey["EVM"] = "EVM";
32
- // Stable coins
33
- CoinKey["USDT"] = "USDT";
34
- CoinKey["USDC"] = "USDC";
35
- CoinKey["cbtUSDC"] = "cbtUSDC";
36
- CoinKey["cbtUSDT"] = "cbtUSDT";
37
- CoinKey["cbtWUSDT"] = "cbtWUSDT";
38
- CoinKey["cbtWUSDC"] = "cbtWUSDC";
39
- CoinKey["cbtCELR"] = "cbtCELR";
40
- CoinKey["BUSD"] = "BUSD";
41
- CoinKey["USDCe"] = "USDCe";
42
- // Testnet
43
- CoinKey["TEST"] = "TEST";
44
- CoinKey["KAL"] = "KAL";
45
- CoinKey["SDIODE"] = "SDIODE";
46
- CoinKey["SPARK"] = "SPARK";
47
- CoinKey["TRBTC"] = "TRBTC";
48
- CoinKey["CXTT"] = "CXTT";
49
- // stargate testnet tokens
50
- CoinKey["sgMETIS"] = "sgMETIS";
51
- CoinKey["sgWOO"] = "sgWOO";
52
- CoinKey["sgUSDT"] = "sgUSDT";
53
- CoinKey["sgBUSD"] = "sgBUSD";
54
- CoinKey["sgUSDC"] = "sgUSDC";
55
- // Other tokens
56
- CoinKey["WBTC"] = "WBTC";
57
- CoinKey["WETH"] = "WETH";
58
- CoinKey["SUSHI"] = "SUSHI";
59
- CoinKey["DODO"] = "DODO";
60
- CoinKey["MCB"] = "MCB";
61
- CoinKey["CELR"] = "CELR";
62
- CoinKey["IF"] = "IF";
63
- })(CoinKey || (CoinKey = {}));
64
1
  export var ChainKey;
65
2
  (function (ChainKey) {
66
3
  ChainKey["ETH"] = "eth";
@@ -1,3 +1,4 @@
1
1
  export * from './Chain';
2
2
  export * from './EVMChain';
3
3
  export * from './SolanaChain';
4
+ export * from './base';
@@ -1,3 +1,4 @@
1
1
  export * from './Chain';
2
2
  export * from './EVMChain';
3
3
  export * from './SolanaChain';
4
+ export * from './base';
package/dist/cjs/api.d.ts CHANGED
@@ -1,21 +1,29 @@
1
- import { BridgeDefinition, Chain, ChainId, ExchangeDefinition, LifiStep, Token } from '.';
2
- import { ToolError } from './apiErrors';
1
+ import { BridgeDefinition } from './bridges';
2
+ import { Chain } from './chains';
3
+ import { ChainId } from './chains/base';
4
+ import { ExchangeDefinition } from './exchanges';
5
+ import { Action, LifiStep } from './step';
6
+ import { Token } from './tokens';
7
+ /**
8
+ * Used as a bigint replacement for TransactionRequest because bigint is not serializable
9
+ */
10
+ export type BigIntish = string;
3
11
  export type TransactionRequest = {
4
12
  to?: string;
5
13
  from?: string;
6
14
  nonce?: number;
7
- gasLimit?: bigint;
8
- gasPrice?: bigint;
9
- data?: `0x${string}`;
10
- value?: bigint;
15
+ gasLimit?: BigIntish;
16
+ gasPrice?: BigIntish;
17
+ data?: string;
18
+ value?: BigIntish;
11
19
  chainId?: number;
12
20
  type?: number;
13
21
  accessList?: {
14
- address: `0x${string}`;
15
- storageKeys: `0x${string}`[];
22
+ address: string;
23
+ storageKeys: string[];
16
24
  }[];
17
- maxPriorityFeePerGas?: bigint;
18
- maxFeePerGas?: bigint;
25
+ maxPriorityFeePerGas?: BigIntish;
26
+ maxFeePerGas?: BigIntish;
19
27
  customData?: Record<string, any>;
20
28
  ccipReadEnabled?: boolean;
21
29
  };
@@ -33,18 +41,18 @@ export interface RoutesRequest {
33
41
  fromAmountForGas?: string;
34
42
  }
35
43
  export interface RouteOptions {
44
+ integrator?: string;
45
+ fee?: number;
46
+ insurance?: boolean;
47
+ maxPriceImpact?: number;
36
48
  order?: Order;
37
49
  slippage?: number;
50
+ referrer?: string;
38
51
  infiniteApproval?: boolean;
39
52
  allowSwitchChain?: boolean;
40
- integrator?: string;
41
53
  allowDestinationCall?: boolean;
42
- referrer?: string;
43
54
  bridges?: AllowDenyPrefer;
44
55
  exchanges?: AllowDenyPrefer;
45
- fee?: number;
46
- insurance?: boolean;
47
- maxPriceImpact?: number;
48
56
  }
49
57
  export type ToolsResponse = {
50
58
  exchanges: {
@@ -94,6 +102,14 @@ export interface Route {
94
102
  steps: LifiStep[];
95
103
  tags?: Order[];
96
104
  }
105
+ export type ToolErrorType = 'NO_QUOTE';
106
+ export interface ToolError {
107
+ errorType: ToolErrorType;
108
+ code: string;
109
+ action: Action;
110
+ tool: string;
111
+ message: string;
112
+ }
97
113
  export type ErroredPaths = {
98
114
  [subpath: string]: ToolError[];
99
115
  };
@@ -245,16 +261,13 @@ export interface PendingReceivingInfo {
245
261
  }
246
262
  declare const _StatusMessage: readonly ["NOT_FOUND", "INVALID", "PENDING", "DONE", "FAILED"];
247
263
  export type StatusMessage = (typeof _StatusMessage)[number];
248
- declare const _SubstatusPending: readonly ["WAIT_SOURCE_CONFIRMATIONS", "WAIT_DESTINATION_TRANSACTION", "BRIDGE_NOT_AVAILABLE", "CHAIN_NOT_AVAILABLE", "REFUND_IN_PROGRESS", "UNKNOWN_ERROR"];
264
+ declare const _SubstatusPending: readonly ["WAIT_SOURCE_CONFIRMATIONS", "WAIT_DESTINATION_TRANSACTION", "BRIDGE_NOT_AVAILABLE", "CHAIN_NOT_AVAILABLE", "NOT_PROCESSABLE_REFUND_NEEDED", "REFUND_IN_PROGRESS", "UNKNOWN_ERROR"];
249
265
  export type SubstatusPending = (typeof _SubstatusPending)[number];
250
266
  declare const _SubstatusDone: readonly ["COMPLETED", "PARTIAL", "REFUNDED"];
251
267
  export type SubstatusDone = (typeof _SubstatusDone)[number];
252
- declare const _SubstatusFailed: readonly ["NOT_PROCESSABLE_REFUND_NEEDED"];
253
- export type SubstatusFailed = (typeof _SubstatusFailed)[number];
254
- export type Substatus = SubstatusPending | SubstatusDone | SubstatusFailed;
255
- export declare const isSubstatusPending: (substatus: Substatus) => substatus is "WAIT_SOURCE_CONFIRMATIONS" | "WAIT_DESTINATION_TRANSACTION" | "BRIDGE_NOT_AVAILABLE" | "CHAIN_NOT_AVAILABLE" | "REFUND_IN_PROGRESS" | "UNKNOWN_ERROR";
268
+ export type Substatus = SubstatusPending | SubstatusDone;
269
+ export declare const isSubstatusPending: (substatus: Substatus) => substatus is "WAIT_SOURCE_CONFIRMATIONS" | "WAIT_DESTINATION_TRANSACTION" | "BRIDGE_NOT_AVAILABLE" | "CHAIN_NOT_AVAILABLE" | "NOT_PROCESSABLE_REFUND_NEEDED" | "REFUND_IN_PROGRESS" | "UNKNOWN_ERROR";
256
270
  export declare const isSubstatusDone: (substatus: Substatus) => substatus is "COMPLETED" | "PARTIAL" | "REFUNDED";
257
- export declare const isSubstatusFailed: (substatus: Substatus) => substatus is "NOT_PROCESSABLE_REFUND_NEEDED";
258
271
  export interface BaseStatusData {
259
272
  status: StatusMessage;
260
273
  substatus?: Substatus;
package/dist/cjs/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSubstatusFailed = exports.isSubstatusDone = exports.isSubstatusPending = exports._InsuranceState = exports.Orders = void 0;
3
+ exports.isSubstatusDone = exports.isSubstatusPending = exports._InsuranceState = exports.Orders = void 0;
4
4
  exports.Orders = ['RECOMMENDED', 'FASTEST', 'CHEAPEST', 'SAFEST'];
5
5
  exports._InsuranceState = [
6
6
  'INSURED',
@@ -28,6 +28,8 @@ const _SubstatusPending = [
28
28
  'BRIDGE_NOT_AVAILABLE',
29
29
  // The RPC for source/destination chain is temporarily unavailable
30
30
  'CHAIN_NOT_AVAILABLE',
31
+ // The transfer cannot be completed, a refund is required
32
+ 'NOT_PROCESSABLE_REFUND_NEEDED',
31
33
  // A refund has been requested and is in progress
32
34
  'REFUND_IN_PROGRESS',
33
35
  // We cannot determine the status of the transfer
@@ -43,14 +45,8 @@ const _SubstatusDone = [
43
45
  // The transfer was not successful but it has been refunded
44
46
  'REFUNDED',
45
47
  ];
46
- const _SubstatusFailed = [
47
- // The transfer cannot be completed, a refund is required
48
- 'NOT_PROCESSABLE_REFUND_NEEDED',
49
- ];
50
48
  const isSubstatusPending = (substatus) => _SubstatusPending.includes(substatus);
51
49
  exports.isSubstatusPending = isSubstatusPending;
52
50
  const isSubstatusDone = (substatus) => _SubstatusDone.includes(substatus);
53
51
  exports.isSubstatusDone = isSubstatusDone;
54
- const isSubstatusFailed = (substatus) => _SubstatusFailed.includes(substatus);
55
- exports.isSubstatusFailed = isSubstatusFailed;
56
52
  const _LIFuelState = ['PENDING', 'DONE', 'NOT_FOUND'];
@@ -1,24 +1,6 @@
1
- import { BaseToken } from './base';
2
- /**
3
- * @deprecated
4
- * These values are now obtainable from the LI.FI API
5
- */
6
- export declare enum BridgeTool {
7
- connext = "connext",
8
- hop = "hop",
9
- multichain = "multichain",
10
- cbridge = "cbridge",
11
- hyphen = "hyphen",
12
- polygon = "polygon",
13
- arbitrum = "arbitrum",
14
- avalanche = "avalanche",
15
- optimism = "optimism",
16
- across = "across",
17
- portal = "portal",
18
- stargate = "stargate"
19
- }
1
+ import { BaseToken } from './tokens/token';
20
2
  export interface Bridge {
21
- key: BridgeTool;
3
+ key: string;
22
4
  name: string;
23
5
  logoURI: string;
24
6
  bridgeUrl?: string;
@@ -33,7 +15,7 @@ export interface Bridge {
33
15
  * @deprecated
34
16
  */
35
17
  export interface BridgeDefinition {
36
- tool: BridgeTool;
18
+ tool: string;
37
19
  fromChainId: number;
38
20
  fromToken: BaseToken;
39
21
  toChainId: number;
@@ -1,22 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BridgeTool = void 0;
4
- /**
5
- * @deprecated
6
- * These values are now obtainable from the LI.FI API
7
- */
8
- var BridgeTool;
9
- (function (BridgeTool) {
10
- BridgeTool["connext"] = "connext";
11
- BridgeTool["hop"] = "hop";
12
- BridgeTool["multichain"] = "multichain";
13
- BridgeTool["cbridge"] = "cbridge";
14
- BridgeTool["hyphen"] = "hyphen";
15
- BridgeTool["polygon"] = "polygon";
16
- BridgeTool["arbitrum"] = "arbitrum";
17
- BridgeTool["avalanche"] = "avalanche";
18
- BridgeTool["optimism"] = "optimism";
19
- BridgeTool["across"] = "across";
20
- BridgeTool["portal"] = "portal";
21
- BridgeTool["stargate"] = "stargate";
22
- })(BridgeTool = exports.BridgeTool || (exports.BridgeTool = {}));
@@ -1,4 +1,5 @@
1
- import { ChainKey, CoinKey } from '../base';
1
+ import { CoinKey } from '../tokens/base';
2
+ import { ChainKey } from './base';
2
3
  export declare enum ChainType {
3
4
  EVM = "EVM",
4
5
  Solana = "SOLANA"
@@ -5,4 +5,4 @@ var ChainType;
5
5
  (function (ChainType) {
6
6
  ChainType["EVM"] = "EVM";
7
7
  ChainType["Solana"] = "SOLANA";
8
- })(ChainType = exports.ChainType || (exports.ChainType = {}));
8
+ })(ChainType || (exports.ChainType = ChainType = {}));