@lifi/types 11.0.0-beta.1 → 11.0.0-beta.2

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 (153) hide show
  1. package/README.md +27 -5
  2. package/package.json +22 -74
  3. package/{dist/cjs → src/_cjs}/api.js +1 -17
  4. package/src/_cjs/api.js.map +1 -0
  5. package/src/_cjs/bridges.js +3 -0
  6. package/src/_cjs/bridges.js.map +1 -0
  7. package/{dist/cjs → src/_cjs}/chains/Chain.js +2 -2
  8. package/src/_cjs/chains/Chain.js.map +1 -0
  9. package/src/_cjs/chains/EVMChain.js +3 -0
  10. package/src/_cjs/chains/EVMChain.js.map +1 -0
  11. package/src/_cjs/chains/SolanaChain.js +3 -0
  12. package/src/_cjs/chains/SolanaChain.js.map +1 -0
  13. package/{dist/cjs → src/_cjs/chains}/base.js +4 -68
  14. package/src/_cjs/chains/base.js.map +1 -0
  15. package/src/_cjs/chains/index.js +8 -0
  16. package/src/_cjs/chains/index.js.map +1 -0
  17. package/{dist/cjs/apiErrors.js → src/_cjs/errors.js} +2 -2
  18. package/src/_cjs/errors.js.map +1 -0
  19. package/src/_cjs/exchanges.js +3 -0
  20. package/src/_cjs/exchanges.js.map +1 -0
  21. package/src/_cjs/index.js +12 -0
  22. package/src/_cjs/index.js.map +1 -0
  23. package/src/_cjs/package.json +1 -0
  24. package/{dist/cjs → src/_cjs}/quests.js +1 -0
  25. package/src/_cjs/quests.js.map +1 -0
  26. package/{dist/cjs → src/_cjs}/step.js +1 -1
  27. package/src/_cjs/step.js.map +1 -0
  28. package/src/_cjs/tokens/base.js +63 -0
  29. package/src/_cjs/tokens/base.js.map +1 -0
  30. package/src/_cjs/tokens/index.js +6 -0
  31. package/src/_cjs/tokens/index.js.map +1 -0
  32. package/{dist/cjs/chains/SolanaChain.js → src/_cjs/tokens/token.js} +1 -0
  33. package/src/_cjs/tokens/token.js.map +1 -0
  34. package/{dist → src/_esm}/api.js +1 -0
  35. package/src/_esm/api.js.map +1 -0
  36. package/src/_esm/bridges.js +2 -0
  37. package/src/_esm/bridges.js.map +1 -0
  38. package/{dist → src/_esm}/chains/Chain.js +3 -0
  39. package/src/_esm/chains/Chain.js.map +1 -0
  40. package/src/_esm/chains/EVMChain.js +2 -0
  41. package/src/_esm/chains/EVMChain.js.map +1 -0
  42. package/src/_esm/chains/SolanaChain.js +2 -0
  43. package/src/_esm/chains/SolanaChain.js.map +1 -0
  44. package/{dist → src/_esm/chains}/base.js +1 -63
  45. package/src/_esm/chains/base.js.map +1 -0
  46. package/src/_esm/chains/index.js +5 -0
  47. package/src/_esm/chains/index.js.map +1 -0
  48. package/{dist/apiErrors.js → src/_esm/errors.js} +1 -0
  49. package/src/_esm/errors.js.map +1 -0
  50. package/src/_esm/exchanges.js +2 -0
  51. package/src/_esm/exchanges.js.map +1 -0
  52. package/src/_esm/index.js +9 -0
  53. package/src/_esm/index.js.map +1 -0
  54. package/src/_esm/package.json +1 -0
  55. package/src/_esm/quests.js +2 -0
  56. package/src/_esm/quests.js.map +1 -0
  57. package/{dist → src/_esm}/step.js +1 -0
  58. package/src/_esm/step.js.map +1 -0
  59. package/src/_esm/tokens/base.js +64 -0
  60. package/src/_esm/tokens/base.js.map +1 -0
  61. package/src/_esm/tokens/index.js +3 -0
  62. package/src/_esm/tokens/index.js.map +1 -0
  63. package/src/_esm/tokens/token.js +3 -0
  64. package/src/_esm/tokens/token.js.map +1 -0
  65. package/{dist → src/_types}/api.d.ts +32 -18
  66. package/src/_types/api.d.ts.map +1 -0
  67. package/src/_types/bridges.d.ts +29 -0
  68. package/src/_types/bridges.d.ts.map +1 -0
  69. package/{dist → src/_types}/chains/Chain.d.ts +3 -1
  70. package/src/_types/chains/Chain.d.ts.map +1 -0
  71. package/{dist/cjs → src/_types}/chains/EVMChain.d.ts +2 -2
  72. package/src/_types/chains/EVMChain.d.ts.map +1 -0
  73. package/{dist/cjs → src/_types}/chains/SolanaChain.d.ts +3 -2
  74. package/src/_types/chains/SolanaChain.d.ts.map +1 -0
  75. package/src/_types/chains/base.d.ts +125 -0
  76. package/src/_types/chains/base.d.ts.map +1 -0
  77. package/src/_types/chains/index.d.ts +5 -0
  78. package/src/_types/chains/index.d.ts.map +1 -0
  79. package/{dist/apiErrors.d.ts → src/_types/errors.d.ts} +1 -9
  80. package/src/_types/errors.d.ts.map +1 -0
  81. package/src/_types/exchanges.d.ts +25 -0
  82. package/src/_types/exchanges.d.ts.map +1 -0
  83. package/src/_types/index.d.ts +9 -0
  84. package/src/_types/index.d.ts.map +1 -0
  85. package/{dist/cjs → src/_types}/quests.d.ts +1 -0
  86. package/src/_types/quests.d.ts.map +1 -0
  87. package/{dist → src/_types}/step.d.ts +12 -12
  88. package/src/_types/step.d.ts.map +1 -0
  89. package/src/_types/tokens/base.d.ts +59 -0
  90. package/src/_types/tokens/base.d.ts.map +1 -0
  91. package/src/_types/tokens/index.d.ts +3 -0
  92. package/src/_types/tokens/index.d.ts.map +1 -0
  93. package/src/_types/tokens/token.d.ts +30 -0
  94. package/src/_types/tokens/token.d.ts.map +1 -0
  95. package/src/api.ts +515 -0
  96. package/src/bridges.ts +30 -0
  97. package/src/chains/Chain.ts +20 -0
  98. package/src/chains/EVMChain.ts +25 -0
  99. package/src/chains/SolanaChain.ts +8 -0
  100. package/src/chains/base.ts +129 -0
  101. package/src/chains/index.ts +4 -0
  102. package/src/errors.ts +15 -0
  103. package/src/exchanges.ts +27 -0
  104. package/src/index.ts +8 -0
  105. package/{dist/quests.d.ts → src/quests.ts} +21 -15
  106. package/src/step.ts +192 -0
  107. package/src/tokens/base.ts +66 -0
  108. package/src/tokens/index.ts +2 -0
  109. package/src/tokens/token.ts +34 -0
  110. package/dist/base.d.ts +0 -231
  111. package/dist/bridges.d.ts +0 -34
  112. package/dist/bridges.js +0 -167
  113. package/dist/chains/EVMChain.d.ts +0 -19
  114. package/dist/chains/EVMChain.js +0 -4
  115. package/dist/chains/SolanaChain.d.ts +0 -7
  116. package/dist/chains/SolanaChain.js +0 -1
  117. package/dist/chains/chain.utils.d.ts +0 -4
  118. package/dist/chains/chain.utils.js +0 -21
  119. package/dist/chains/index.d.ts +0 -5
  120. package/dist/chains/index.js +0 -5
  121. package/dist/chains/supported.chains.d.ts +0 -5
  122. package/dist/chains/supported.chains.js +0 -1208
  123. package/dist/cjs/api.d.ts +0 -375
  124. package/dist/cjs/apiErrors.d.ts +0 -23
  125. package/dist/cjs/base.d.ts +0 -231
  126. package/dist/cjs/bridges.d.ts +0 -34
  127. package/dist/cjs/bridges.js +0 -170
  128. package/dist/cjs/chains/Chain.d.ts +0 -15
  129. package/dist/cjs/chains/EVMChain.js +0 -8
  130. package/dist/cjs/chains/chain.utils.d.ts +0 -4
  131. package/dist/cjs/chains/chain.utils.js +0 -26
  132. package/dist/cjs/chains/index.d.ts +0 -5
  133. package/dist/cjs/chains/index.js +0 -21
  134. package/dist/cjs/chains/supported.chains.d.ts +0 -5
  135. package/dist/cjs/chains/supported.chains.js +0 -1211
  136. package/dist/cjs/coins.d.ts +0 -9
  137. package/dist/cjs/coins.js +0 -1898
  138. package/dist/cjs/exchanges.d.ts +0 -50
  139. package/dist/cjs/exchanges.js +0 -1104
  140. package/dist/cjs/index.d.ts +0 -10
  141. package/dist/cjs/index.js +0 -26
  142. package/dist/cjs/multicall.d.ts +0 -3
  143. package/dist/cjs/multicall.js +0 -80
  144. package/dist/cjs/step.d.ts +0 -128
  145. package/dist/coins.d.ts +0 -9
  146. package/dist/coins.js +0 -1891
  147. package/dist/exchanges.d.ts +0 -50
  148. package/dist/exchanges.js +0 -1100
  149. package/dist/index.d.ts +0 -10
  150. package/dist/index.js +0 -10
  151. package/dist/multicall.d.ts +0 -3
  152. package/dist/multicall.js +0 -77
  153. package/dist/quests.js +0 -1
@@ -22,3 +22,4 @@ export type GetQuestsStatusResponse = {
22
22
  export type GetAllQuestsResponse = {
23
23
  quests: BaseQuest[];
24
24
  };
25
+ //# sourceMappingURL=quests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quests.d.ts","sourceRoot":"","sources":["../quests.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,WAAW,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,EAAE,CAAA;CACpB,CAAA"}
@@ -1,7 +1,5 @@
1
- import { Substatus, TransactionRequest } from '.';
2
- import { Token } from './base';
3
- import { Bridge } from './bridges';
4
- import { Exchange, ExchangeAggregator } from './exchanges';
1
+ import type { Substatus, TransactionRequest } from './api.js';
2
+ import type { Token } from './tokens/index.js';
5
3
  export interface FeeCost {
6
4
  name: string;
7
5
  description: string;
@@ -68,26 +66,27 @@ export interface Execution {
68
66
  fromAmount?: string;
69
67
  toAmount?: string;
70
68
  toToken?: Token;
71
- gasPrice?: string;
72
- gasUsed?: string;
73
- gasToken?: Token;
74
- gasAmount?: string;
75
- gasAmountUSD?: string;
69
+ feeCosts?: FeeCost[];
70
+ gasCosts?: GasCost[];
76
71
  }
77
72
  export declare const emptyExecution: Execution;
78
73
  export declare const _StepType: readonly ["lifi", "swap", "cross", "protocol", "custom"];
79
74
  export type StepType = (typeof _StepType)[number];
80
75
  export type StepTool = string;
76
+ export type StepToolDetails = {
77
+ key: string;
78
+ name: string;
79
+ logoURI: string;
80
+ };
81
81
  export interface StepBase {
82
82
  id: string;
83
83
  type: StepType;
84
84
  tool: StepTool;
85
- toolDetails: Pick<ExchangeAggregator | Exchange | Bridge, 'key' | 'name' | 'logoURI'>;
85
+ toolDetails: StepToolDetails;
86
86
  integrator?: string;
87
87
  referrer?: string;
88
88
  action: Action;
89
89
  estimate?: Estimate;
90
- execution?: Execution;
91
90
  transactionRequest?: TransactionRequest;
92
91
  }
93
92
  export interface DestinationCallInfo {
@@ -118,7 +117,7 @@ export interface CustomStep extends StepBase {
118
117
  estimate: Estimate;
119
118
  }
120
119
  export type Step = SwapStep | CrossStep | CustomStep | ProtocolStep;
121
- export interface LifiStep extends Omit<Step, 'type'> {
120
+ export interface LiFiStep extends Omit<Step, 'type'> {
122
121
  type: 'lifi';
123
122
  includedSteps: Step[];
124
123
  }
@@ -126,3 +125,4 @@ export declare function isSwapStep(step: Step): step is SwapStep;
126
125
  export declare function isCrossStep(step: Step): step is CrossStep;
127
126
  export declare function isProtocolStep(step: Step): step is ProtocolStep;
128
127
  export declare function isCustomStep(step: Step): step is CustomStep;
128
+ //# sourceMappingURL=step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAA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AI,IAAI,QAAQ,CAEvD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,SAAS,CAEzD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,YAAY,CAE/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,UAAU,CAE3D"}
@@ -0,0 +1,59 @@
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",// cBridge testnet USDC
34
+ cbtUSDT = "cbtUSDT",// cBridge testnet USDT
35
+ cbtWUSDT = "cbtWUSDT",// cBridge testnet wrapped USDT
36
+ cbtWUSDC = "cbtWUSDC",// cBridge testnet wrapped USDC
37
+ cbtCELR = "cbtCELR",// cBridge testnet CELR
38
+ BUSD = "BUSD",
39
+ USDCe = "USDCe",
40
+ TEST = "TEST",
41
+ KAL = "KAL",
42
+ SDIODE = "SDIODE",
43
+ SPARK = "SPARK",
44
+ TRBTC = "TRBTC",
45
+ CXTT = "CXTT",// Connext Test token
46
+ sgMETIS = "sgMETIS",// sgMETIS test token
47
+ sgWOO = "sgWOO",// sgWOO test token
48
+ sgUSDT = "sgUSDT",// sgUSDT test token
49
+ sgBUSD = "sgBUSD",// sgBUSD test token
50
+ sgUSDC = "sgUSDC",// sgUSDC test token
51
+ WBTC = "WBTC",
52
+ WETH = "WETH",
53
+ SUSHI = "SUSHI",
54
+ DODO = "DODO",
55
+ MCB = "MCB",
56
+ CELR = "CELR",
57
+ IF = "IF"
58
+ }
59
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../tokens/base.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,EAAE,OAAO;IACT,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,GAAG,QAAQ;IAGX,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY,CAAE,uBAAuB;IAC5C,OAAO,YAAY,CAAE,uBAAuB;IAC5C,QAAQ,aAAa,CAAE,+BAA+B;IACtD,QAAQ,aAAa,CAAE,+BAA+B;IACtD,OAAO,YAAY,CAAE,uBAAuB;IAC5C,IAAI,SAAS;IACb,KAAK,UAAU;IAGf,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,IAAI,SAAS,CAAE,qBAAqB;IAGpC,OAAO,YAAY,CAAE,qBAAqB;IAC1C,KAAK,UAAU,CAAE,mBAAmB;IACpC,MAAM,WAAW,CAAE,oBAAoB;IACvC,MAAM,WAAW,CAAE,oBAAoB;IACvC,MAAM,WAAW,CAAE,oBAAoB;IAGvC,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,EAAE,OAAO;CACV"}
@@ -0,0 +1,3 @@
1
+ export * from './base.js';
2
+ export * from './token.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tokens/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { ChainId } from '../chains/base.js';
2
+ import { CoinKey } from './base.js';
3
+ export interface BaseToken {
4
+ chainId: ChainId;
5
+ address: string;
6
+ }
7
+ export interface StaticToken extends BaseToken {
8
+ symbol: string;
9
+ decimals: number;
10
+ name: string;
11
+ coinKey?: CoinKey;
12
+ logoURI?: string;
13
+ }
14
+ export interface Token extends StaticToken {
15
+ priceUSD: string;
16
+ }
17
+ export interface TokenAmount extends Token {
18
+ amount?: bigint;
19
+ blockNumber?: bigint;
20
+ }
21
+ export interface Coin {
22
+ key: CoinKey;
23
+ name: string;
24
+ logoURI: string;
25
+ verified: boolean;
26
+ chains: {
27
+ [ChainId: string]: StaticToken;
28
+ };
29
+ }
30
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../tokens/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,KAAM,SAAQ,WAAW;IACxC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE;QACN,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAA;KAC/B,CAAA;CACF"}
package/src/api.ts ADDED
@@ -0,0 +1,515 @@
1
+ import type { BridgeDefinition } from './bridges.js'
2
+ import type { Chain, ChainId, ChainKey, ChainType } from './chains/index.js'
3
+ import type { ExchangeDefinition } from './exchanges.js'
4
+ import type { Action, LiFiStep } from './step.js'
5
+ import type { Token } from './tokens/index.js'
6
+
7
+ /**
8
+ * Used as a bigint replacement for TransactionRequest because bigint is not serializable
9
+ */
10
+ export type BigIntish = string
11
+
12
+ export type TransactionRequest = {
13
+ to?: string
14
+ from?: string
15
+ nonce?: number
16
+
17
+ gasLimit?: BigIntish
18
+ gasPrice?: BigIntish
19
+
20
+ data?: string
21
+ value?: BigIntish
22
+ chainId?: number
23
+
24
+ type?: number
25
+ accessList?: { address: string; storageKeys: string[] }[]
26
+
27
+ maxPriorityFeePerGas?: BigIntish
28
+ maxFeePerGas?: BigIntish
29
+
30
+ customData?: Record<string, any>
31
+ ccipReadEnabled?: boolean
32
+ }
33
+
34
+ export const Orders = ['RECOMMENDED', 'FASTEST', 'CHEAPEST', 'SAFEST'] as const
35
+ export type Order = (typeof Orders)[number]
36
+
37
+ export interface RoutesRequest {
38
+ fromChainId: number
39
+ fromAmount: string
40
+
41
+ fromTokenAddress: string
42
+ fromAddress?: string
43
+
44
+ toChainId: number
45
+ toTokenAddress: string
46
+ toAddress?: string
47
+
48
+ options?: RouteOptions
49
+ fromAmountForGas?: string
50
+ }
51
+
52
+ export interface RouteOptions {
53
+ integrator?: string // Should contain the identifier of the integrator. Usually, it's dApp/company name.
54
+ fee?: number // 0.03 = take 3% integrator fee (requires verified integrator to be set)
55
+ insurance?: boolean // Whether the user wants to insure their tx
56
+ maxPriceImpact?: number // Hide routes with price impact greater than or equal to this value
57
+ order?: Order // (default: RECOMMENDED) 'RECOMMENDED' | 'FASTEST' | 'CHEAPEST' | 'SAFEST'
58
+ slippage?: number // (default: 0.03) Expressed as decimal proportion, 0.03 represents 3%
59
+ referrer?: string // Integrators can set a wallet address as a referrer to track them
60
+ allowSwitchChain?: boolean // (default: false) Whether chain switches should be allowed in the routes
61
+ allowDestinationCall?: boolean // (default: true) destination calls are enabled by default
62
+ bridges?: AllowDenyPrefer
63
+ exchanges?: AllowDenyPrefer
64
+ }
65
+
66
+ export type ToolsResponse = {
67
+ exchanges: {
68
+ key: string
69
+ name: string
70
+ logoURI: string
71
+ supportedChains: ChainId[]
72
+ }[]
73
+ bridges: {
74
+ key: string
75
+ name: string
76
+ logoURI: string
77
+ supportedChains: {
78
+ fromChainId: ChainId
79
+ toChainId: ChainId
80
+ }[]
81
+ }[]
82
+ }
83
+
84
+ export interface AllowDenyPrefer {
85
+ allow?: string[] // (default: [all])
86
+ deny?: string[] // (default: [])
87
+ prefer?: string[] // (default: []) // eg. ['1inch'] to use 1inch if available and fall back to others if not
88
+ }
89
+
90
+ export const _InsuranceState = [
91
+ 'INSURED',
92
+ 'INSURABLE',
93
+ 'NOT_INSURABLE',
94
+ ] as const
95
+ export type InsuranceState = (typeof _InsuranceState)[number]
96
+
97
+ export interface Insurance {
98
+ state: InsuranceState
99
+ feeAmountUsd: string
100
+ }
101
+ export interface Route {
102
+ id: string
103
+ insurance: Insurance
104
+ fromChainId: number
105
+ fromAmountUSD: string
106
+ fromAmount: string
107
+ fromToken: Token
108
+ fromAddress?: string
109
+
110
+ toChainId: number
111
+ toAmountUSD: string
112
+ toAmount: string
113
+ toAmountMin: string
114
+ toToken: Token
115
+ toAddress?: string
116
+
117
+ gasCostUSD?: string // Aggregation of underlying gas costs in usd
118
+
119
+ containsSwitchChain?: boolean // Features required for route execution
120
+
121
+ steps: LiFiStep[]
122
+
123
+ tags?: Order[]
124
+ }
125
+
126
+ export type ToolErrorType = 'NO_QUOTE'
127
+
128
+ export interface ToolError {
129
+ errorType: ToolErrorType
130
+ code: string
131
+ action: Action
132
+ tool: string
133
+ message: string
134
+ }
135
+
136
+ export type ErroredPaths = { [subpath: string]: ToolError[] }
137
+
138
+ export type ErroredRoute = {
139
+ overallPath: string
140
+ subpaths: ErroredPaths
141
+ }
142
+
143
+ export type FilteredResult = {
144
+ overallPath: string
145
+ reason: string
146
+ }
147
+
148
+ export type UnavailableRoutes = {
149
+ filteredOut: FilteredResult[]
150
+ failed: ErroredRoute[]
151
+ }
152
+
153
+ export interface RoutesResponse {
154
+ routes: Route[]
155
+ unavailableRoutes: UnavailableRoutes
156
+ }
157
+
158
+ export type PossibilityTopic = 'chains' | 'tokens' | 'bridges' | 'exchanges'
159
+
160
+ /**
161
+ * We don't want to support this endpoint anymore in the future. /chains, /tools, /connections, and /tokens should be used instead
162
+ * @deprecated
163
+ */
164
+ export interface PossibilitiesRequest {
165
+ chains?: number[] // (default: [all]) // eg. [1, 56, 100]
166
+ bridges?: AllowDenyPrefer
167
+ exchanges?: AllowDenyPrefer
168
+ include?: PossibilityTopic[]
169
+ }
170
+
171
+ /**
172
+ * Should not be accessed via the types package anymore
173
+ * @deprecated
174
+ */
175
+ export interface PossibilitiesResponse {
176
+ chains?: Chain[]
177
+ tokens?: Token[]
178
+ bridges?: BridgeDefinition[]
179
+ exchanges?: ExchangeDefinition[]
180
+ }
181
+
182
+ export interface GetTokenRequest {
183
+ chain: number | string
184
+ token: string
185
+ }
186
+
187
+ export interface ToolConfiguration {
188
+ allowBridges?: string[]
189
+ denyBridges?: string[]
190
+ preferBridges?: string[]
191
+ allowExchanges?: string[]
192
+ denyExchanges?: string[]
193
+ preferExchanges?: string[]
194
+ }
195
+
196
+ export interface QuoteRequest extends ToolConfiguration {
197
+ fromChain: number | string
198
+ fromToken: string
199
+ fromAddress: string
200
+ fromAmount: string
201
+
202
+ toChain: number | string
203
+ toToken: string
204
+ toAddress?: string
205
+
206
+ order?: Order
207
+ slippage?: number | string
208
+ integrator?: string
209
+ referrer?: string
210
+ fee?: number | string
211
+ insurance?: boolean // indicates whether the user wants a quote with bridge insurance
212
+ allowDestinationCall?: boolean // (default : true) // destination calls are enabled by default
213
+ fromAmountForGas?: string // the amount of token to convert to gas
214
+ maxPriceImpact?: number // hide routes with price impact greater than or equal to this value
215
+ }
216
+
217
+ export interface ContractCall {
218
+ fromAmount: string
219
+ fromTokenAddress: string
220
+ toContractAddress: string
221
+ toContractCallData: string
222
+ toContractGasLimit: string
223
+ toApprovalAddress?: string
224
+ toTokenAddress?: string
225
+ }
226
+
227
+ export interface ContractCallsQuoteRequest extends ToolConfiguration {
228
+ fromChain: number | string
229
+ fromToken: string
230
+ fromAddress: string
231
+
232
+ toChain: number | string
233
+ toToken: string
234
+ toAmount: string
235
+
236
+ toFallbackAddress?: string
237
+ contractOutputsToken?: string
238
+ contractCalls: ContractCall[]
239
+
240
+ slippage?: number | string
241
+ integrator?: string
242
+ referrer?: string
243
+ fee?: number | string
244
+ allowDestinationCall?: boolean // (default : true) // destination calls are enabled by default
245
+ }
246
+
247
+ /* @deprecated */
248
+ export interface ContractCallQuoteRequest extends ToolConfiguration {
249
+ fromChain: number | string
250
+ fromToken: string
251
+ fromAddress: string
252
+ toChain: number | string
253
+ toToken: string
254
+ toAmount: string
255
+ toContractAddress: string
256
+ toContractCallData: string
257
+ toContractGasLimit: string
258
+ toApprovalAddress?: string
259
+ toFallbackAddress?: string
260
+ contractOutputsToken?: string
261
+ slippage?: number | string
262
+ integrator?: string
263
+ referrer?: string
264
+ fee?: number | string
265
+ allowDestinationCall?: boolean
266
+ }
267
+
268
+ export interface ConnectionsRequest extends ToolConfiguration {
269
+ fromChain?: number | string
270
+ fromToken?: string
271
+ toChain?: number | string
272
+ toToken?: string
273
+ chainTypes?: ChainType[]
274
+ }
275
+
276
+ export interface Connection {
277
+ fromChainId: number
278
+ toChainId: number
279
+ fromTokens: Token[]
280
+ toTokens: Token[]
281
+ }
282
+
283
+ export interface ConnectionsResponse {
284
+ connections: Connection[]
285
+ }
286
+
287
+ export interface GetStatusRequest {
288
+ txHash: string
289
+ bridge?: string
290
+ fromChain?: number | string
291
+ toChain?: number | string
292
+ }
293
+
294
+ export interface BaseTransactionInfo {
295
+ txHash: string
296
+ chainId: ChainId
297
+ txLink: string
298
+ }
299
+
300
+ export interface ExtendedTransactionInfo extends BaseTransactionInfo {
301
+ amount?: string
302
+ amountUSD?: string
303
+ token?: Token
304
+ gasPrice: string
305
+ gasUsed: string
306
+ gasToken: Token
307
+ gasAmount: string
308
+ gasAmountUSD: string
309
+ timestamp?: number
310
+ value?: string
311
+ }
312
+
313
+ export interface PendingReceivingInfo {
314
+ chainId: ChainId
315
+ }
316
+
317
+ const _StatusMessage = [
318
+ // The transaction was not found -- likely not mined yet
319
+ 'NOT_FOUND',
320
+ // A third party service is not available
321
+ 'INVALID',
322
+ // The transfer is pending
323
+ 'PENDING',
324
+ // The transfer is done
325
+ 'DONE',
326
+ // The transfer failed
327
+ 'FAILED',
328
+ ] as const
329
+ export type StatusMessage = (typeof _StatusMessage)[number]
330
+
331
+ const _SubstatusPending = [
332
+ // The bridge is waiting for additional confirmations
333
+ 'WAIT_SOURCE_CONFIRMATIONS',
334
+ // The off-chain logic is in progress, waiting for the destination tx to be mined
335
+ 'WAIT_DESTINATION_TRANSACTION',
336
+ // The bridge API / subgraph is temporarily unavailable
337
+ 'BRIDGE_NOT_AVAILABLE',
338
+ // The RPC for source/destination chain is temporarily unavailable
339
+ 'CHAIN_NOT_AVAILABLE',
340
+ // The transfer cannot be completed, a refund is required
341
+ 'NOT_PROCESSABLE_REFUND_NEEDED',
342
+ // A refund has been requested and is in progress
343
+ 'REFUND_IN_PROGRESS',
344
+ // We cannot determine the status of the transfer
345
+ 'UNKNOWN_ERROR',
346
+ ] as const
347
+ export type SubstatusPending = (typeof _SubstatusPending)[number]
348
+
349
+ const _SubstatusDone = [
350
+ // The transfer was successful
351
+ 'COMPLETED',
352
+ // The transfer was partially successful
353
+ // This can happen for specific bridges like Across
354
+ // which may provide alternative tokens in case of low liquidity
355
+ 'PARTIAL',
356
+ // The transfer was not successful but it has been refunded
357
+ 'REFUNDED',
358
+ ] as const
359
+ export type SubstatusDone = (typeof _SubstatusDone)[number]
360
+
361
+ export type Substatus = SubstatusPending | SubstatusDone
362
+
363
+ export const isSubstatusPending = (
364
+ substatus: Substatus
365
+ ): substatus is SubstatusPending =>
366
+ _SubstatusPending.includes(substatus as SubstatusPending)
367
+ export const isSubstatusDone = (
368
+ substatus: Substatus
369
+ ): substatus is SubstatusDone =>
370
+ _SubstatusDone.includes(substatus as SubstatusDone)
371
+
372
+ export interface BaseStatusData {
373
+ status: StatusMessage
374
+ substatus?: Substatus
375
+ substatusMessage?: string
376
+ }
377
+
378
+ export interface StatusData extends BaseStatusData {
379
+ tool: string
380
+ sending: BaseTransactionInfo
381
+ receiving: PendingReceivingInfo
382
+ }
383
+
384
+ export type StatusResponse = FullStatusData | StatusData
385
+ interface TransferMetadata {
386
+ integrator: string
387
+ }
388
+
389
+ export interface FullStatusData extends StatusData {
390
+ transactionId: string
391
+ sending: ExtendedTransactionInfo
392
+ receiving: PendingReceivingInfo | ExtendedTransactionInfo
393
+ lifiExplorerLink: string
394
+ fromAddress: string
395
+ toAddress: string
396
+ metadata: TransferMetadata
397
+ bridgeExplorerLink?: string
398
+ }
399
+
400
+ export interface ExtendedChain extends Chain {
401
+ nativeToken: Token
402
+ }
403
+
404
+ export interface ChainsResponse {
405
+ chains: ExtendedChain[]
406
+ }
407
+
408
+ export interface ChainsRequest {
409
+ chainTypes?: ChainType[]
410
+ }
411
+
412
+ export interface ToolsRequest {
413
+ chains?: (ChainKey | ChainId)[]
414
+ }
415
+
416
+ export type TokensRequest = {
417
+ chains?: (ChainId | ChainKey)[]
418
+ chainTypes?: ChainType[]
419
+ }
420
+
421
+ export type TokensResponse = {
422
+ tokens: { [chainId: number]: Token[] }
423
+ }
424
+
425
+ export type RequestOptions = {
426
+ signal?: AbortSignal
427
+ }
428
+
429
+ export interface Integrator {
430
+ integratorId: string
431
+ feeBalances: FeeBalance[]
432
+ }
433
+
434
+ export type FeeBalance = {
435
+ chainId: ChainId
436
+ tokenBalances: TokenBalance[]
437
+ }
438
+
439
+ export type TokenBalance = {
440
+ token: Token
441
+ amount: string
442
+ amountUsd: string
443
+ }
444
+
445
+ export interface IntegratorWithdrawalRequest {
446
+ integratorId: string
447
+ chainId: ChainId
448
+ tokens?: string[]
449
+ }
450
+
451
+ export interface IntegratorWithdrawalTransactionResponse {
452
+ transactionRequest: TransactionRequest
453
+ }
454
+
455
+ const _LIFuelState = ['PENDING', 'DONE', 'NOT_FOUND'] as const
456
+ type LIFuelState = (typeof _LIFuelState)[number]
457
+ // Response to the status API for trusted gas
458
+ export type LIFuelStatusResponse = {
459
+ status: LIFuelState
460
+ sending?: ExtendedTransactionInfo
461
+ receiving?: PendingReceivingInfo | ExtendedTransactionInfo
462
+ }
463
+
464
+ export type GasRecommendationRequest = {
465
+ chainId: ChainId
466
+ fromChain?: ChainId
467
+ fromToken?: string
468
+ }
469
+
470
+ export type RefetchSourceLIFuelRequest = {
471
+ txHash: string
472
+ chainId: ChainId
473
+ }
474
+
475
+ export type LIFuelStatusRequest = {
476
+ txHash: string
477
+ }
478
+
479
+ export type RefetchLIFuelRequest = {
480
+ txHash: string
481
+ chainId: ChainId
482
+ }
483
+
484
+ export type GasRecommendationResponse =
485
+ | {
486
+ // whether we can support that
487
+ available: false
488
+ // reason why the gas feature is not available (e.g. missing liquidity)
489
+ message: string
490
+ }
491
+ | {
492
+ available: true
493
+ recommended: TokenBalance
494
+ limit: TokenBalance // Maximum of gas the user can transfer
495
+ serviceFee: TokenBalance // LI.FI fee for providing the service
496
+
497
+ // information about what the user has to pay to get the recommended gas amount
498
+ fromToken?: Token
499
+ fromAmount?: string
500
+ }
501
+
502
+ export interface TransactionAnalyticsResponse {
503
+ transfers: StatusResponse[]
504
+ }
505
+
506
+ export type TransactionAnalyticsStatus =
507
+ | Exclude<StatusMessage, 'NOT_FOUND' | 'INVALID'>
508
+ | 'ALL'
509
+
510
+ export interface TransactionAnalyticsRequest {
511
+ wallet: string
512
+ fromTimestamp?: number
513
+ toTimestamp?: number
514
+ status?: TransactionAnalyticsStatus
515
+ }