@lifi/types 0.0.0-preview-97f0520

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 (166) hide show
  1. package/LICENSE.md +201 -0
  2. package/README.md +59 -0
  3. package/package.json +46 -0
  4. package/src/_cjs/api.js +99 -0
  5. package/src/_cjs/api.js.map +1 -0
  6. package/src/_cjs/balance/index.js +18 -0
  7. package/src/_cjs/balance/index.js.map +1 -0
  8. package/src/_cjs/balance/wallet.js +3 -0
  9. package/src/_cjs/balance/wallet.js.map +1 -0
  10. package/src/_cjs/bridges.js +3 -0
  11. package/src/_cjs/bridges.js.map +1 -0
  12. package/src/_cjs/chains/Chain.js +13 -0
  13. package/src/_cjs/chains/Chain.js.map +1 -0
  14. package/src/_cjs/chains/EVMChain.js +3 -0
  15. package/src/_cjs/chains/EVMChain.js.map +1 -0
  16. package/src/_cjs/chains/MVMChain.js +3 -0
  17. package/src/_cjs/chains/MVMChain.js.map +1 -0
  18. package/src/_cjs/chains/STLChain.js +3 -0
  19. package/src/_cjs/chains/STLChain.js.map +1 -0
  20. package/src/_cjs/chains/SVMChain.js +3 -0
  21. package/src/_cjs/chains/SVMChain.js.map +1 -0
  22. package/src/_cjs/chains/TVMChain.js +3 -0
  23. package/src/_cjs/chains/TVMChain.js.map +1 -0
  24. package/src/_cjs/chains/UTXOChain.js +3 -0
  25. package/src/_cjs/chains/UTXOChain.js.map +1 -0
  26. package/src/_cjs/chains/base.js +196 -0
  27. package/src/_cjs/chains/base.js.map +1 -0
  28. package/src/_cjs/chains/index.js +25 -0
  29. package/src/_cjs/chains/index.js.map +1 -0
  30. package/src/_cjs/earn.js +3 -0
  31. package/src/_cjs/earn.js.map +1 -0
  32. package/src/_cjs/errors.js +21 -0
  33. package/src/_cjs/errors.js.map +1 -0
  34. package/src/_cjs/exchanges.js +3 -0
  35. package/src/_cjs/exchanges.js.map +1 -0
  36. package/src/_cjs/index.js +28 -0
  37. package/src/_cjs/index.js.map +1 -0
  38. package/src/_cjs/package.json +1 -0
  39. package/src/_cjs/routeSlippage.js +13 -0
  40. package/src/_cjs/routeSlippage.js.map +1 -0
  41. package/src/_cjs/step.js +28 -0
  42. package/src/_cjs/step.js.map +1 -0
  43. package/src/_cjs/tokens/base.js +137 -0
  44. package/src/_cjs/tokens/base.js.map +1 -0
  45. package/src/_cjs/tokens/index.js +19 -0
  46. package/src/_cjs/tokens/index.js.map +1 -0
  47. package/src/_cjs/tokens/token.js +12 -0
  48. package/src/_cjs/tokens/token.js.map +1 -0
  49. package/src/_cjs/typed-data.js +3 -0
  50. package/src/_cjs/typed-data.js.map +1 -0
  51. package/src/_esm/api.js +126 -0
  52. package/src/_esm/api.js.map +1 -0
  53. package/src/_esm/balance/index.js +2 -0
  54. package/src/_esm/balance/index.js.map +1 -0
  55. package/src/_esm/balance/wallet.js +2 -0
  56. package/src/_esm/balance/wallet.js.map +1 -0
  57. package/src/_esm/bridges.js +2 -0
  58. package/src/_esm/bridges.js.map +1 -0
  59. package/src/_esm/chains/Chain.js +15 -0
  60. package/src/_esm/chains/Chain.js.map +1 -0
  61. package/src/_esm/chains/EVMChain.js +2 -0
  62. package/src/_esm/chains/EVMChain.js.map +1 -0
  63. package/src/_esm/chains/MVMChain.js +2 -0
  64. package/src/_esm/chains/MVMChain.js.map +1 -0
  65. package/src/_esm/chains/STLChain.js +2 -0
  66. package/src/_esm/chains/STLChain.js.map +1 -0
  67. package/src/_esm/chains/SVMChain.js +2 -0
  68. package/src/_esm/chains/SVMChain.js.map +1 -0
  69. package/src/_esm/chains/TVMChain.js +2 -0
  70. package/src/_esm/chains/TVMChain.js.map +1 -0
  71. package/src/_esm/chains/UTXOChain.js +2 -0
  72. package/src/_esm/chains/UTXOChain.js.map +1 -0
  73. package/src/_esm/chains/base.js +209 -0
  74. package/src/_esm/chains/base.js.map +1 -0
  75. package/src/_esm/chains/index.js +9 -0
  76. package/src/_esm/chains/index.js.map +1 -0
  77. package/src/_esm/earn.js +9 -0
  78. package/src/_esm/earn.js.map +1 -0
  79. package/src/_esm/errors.js +19 -0
  80. package/src/_esm/errors.js.map +1 -0
  81. package/src/_esm/exchanges.js +2 -0
  82. package/src/_esm/exchanges.js.map +1 -0
  83. package/src/_esm/index.js +12 -0
  84. package/src/_esm/index.js.map +1 -0
  85. package/src/_esm/package.json +1 -0
  86. package/src/_esm/routeSlippage.js +54 -0
  87. package/src/_esm/routeSlippage.js.map +1 -0
  88. package/src/_esm/step.js +25 -0
  89. package/src/_esm/step.js.map +1 -0
  90. package/src/_esm/tokens/base.js +144 -0
  91. package/src/_esm/tokens/base.js.map +1 -0
  92. package/src/_esm/tokens/index.js +3 -0
  93. package/src/_esm/tokens/index.js.map +1 -0
  94. package/src/_esm/tokens/token.js +10 -0
  95. package/src/_esm/tokens/token.js.map +1 -0
  96. package/src/_esm/typed-data.js +2 -0
  97. package/src/_esm/typed-data.js.map +1 -0
  98. package/src/_types/api.d.ts +891 -0
  99. package/src/_types/api.d.ts.map +1 -0
  100. package/src/_types/balance/index.d.ts +2 -0
  101. package/src/_types/balance/index.d.ts.map +1 -0
  102. package/src/_types/balance/wallet.d.ts +97 -0
  103. package/src/_types/balance/wallet.d.ts.map +1 -0
  104. package/src/_types/bridges.d.ts +29 -0
  105. package/src/_types/bridges.d.ts.map +1 -0
  106. package/src/_types/chains/Chain.d.ts +21 -0
  107. package/src/_types/chains/Chain.d.ts.map +1 -0
  108. package/src/_types/chains/EVMChain.d.ts +23 -0
  109. package/src/_types/chains/EVMChain.d.ts.map +1 -0
  110. package/src/_types/chains/MVMChain.d.ts +6 -0
  111. package/src/_types/chains/MVMChain.d.ts.map +1 -0
  112. package/src/_types/chains/STLChain.d.ts +6 -0
  113. package/src/_types/chains/STLChain.d.ts.map +1 -0
  114. package/src/_types/chains/SVMChain.d.ts +10 -0
  115. package/src/_types/chains/SVMChain.d.ts.map +1 -0
  116. package/src/_types/chains/TVMChain.d.ts +7 -0
  117. package/src/_types/chains/TVMChain.d.ts.map +1 -0
  118. package/src/_types/chains/UTXOChain.d.ts +6 -0
  119. package/src/_types/chains/UTXOChain.d.ts.map +1 -0
  120. package/src/_types/chains/base.d.ts +191 -0
  121. package/src/_types/chains/base.d.ts.map +1 -0
  122. package/src/_types/chains/index.d.ts +9 -0
  123. package/src/_types/chains/index.d.ts.map +1 -0
  124. package/src/_types/earn.d.ts +137 -0
  125. package/src/_types/earn.d.ts.map +1 -0
  126. package/src/_types/errors.d.ts +17 -0
  127. package/src/_types/errors.d.ts.map +1 -0
  128. package/src/_types/exchanges.d.ts +25 -0
  129. package/src/_types/exchanges.d.ts.map +1 -0
  130. package/src/_types/index.d.ts +12 -0
  131. package/src/_types/index.d.ts.map +1 -0
  132. package/src/_types/routeSlippage.d.ts +85 -0
  133. package/src/_types/routeSlippage.d.ts.map +1 -0
  134. package/src/_types/step.d.ts +218 -0
  135. package/src/_types/step.d.ts.map +1 -0
  136. package/src/_types/tokens/base.d.ts +133 -0
  137. package/src/_types/tokens/base.d.ts.map +1 -0
  138. package/src/_types/tokens/index.d.ts +3 -0
  139. package/src/_types/tokens/index.d.ts.map +1 -0
  140. package/src/_types/tokens/token.d.ts +54 -0
  141. package/src/_types/tokens/token.d.ts.map +1 -0
  142. package/src/_types/typed-data.d.ts +31 -0
  143. package/src/_types/typed-data.d.ts.map +1 -0
  144. package/src/api.ts +1185 -0
  145. package/src/balance/index.ts +1 -0
  146. package/src/balance/wallet.ts +102 -0
  147. package/src/bridges.ts +30 -0
  148. package/src/chains/Chain.ts +28 -0
  149. package/src/chains/EVMChain.ts +28 -0
  150. package/src/chains/MVMChain.ts +6 -0
  151. package/src/chains/STLChain.ts +6 -0
  152. package/src/chains/SVMChain.ts +11 -0
  153. package/src/chains/TVMChain.ts +7 -0
  154. package/src/chains/UTXOChain.ts +6 -0
  155. package/src/chains/base.ts +221 -0
  156. package/src/chains/index.ts +8 -0
  157. package/src/earn.ts +158 -0
  158. package/src/errors.ts +17 -0
  159. package/src/exchanges.ts +27 -0
  160. package/src/index.ts +11 -0
  161. package/src/routeSlippage.ts +97 -0
  162. package/src/step.ts +281 -0
  163. package/src/tokens/base.ts +152 -0
  164. package/src/tokens/index.ts +2 -0
  165. package/src/tokens/token.ts +63 -0
  166. package/src/typed-data.ts +34 -0
@@ -0,0 +1,891 @@
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, DestinationAction, DestinationActionKind, FeeCost, LiFiStep, SignedLiFiStep, StepToolDetails } from './step.js';
5
+ import type { BaseToken, Token, TokenExtended, TokenTag } from './tokens/index.js';
6
+ import type { RouteSlippageCommitment, SlippageScope } from './routeSlippage.js';
7
+ import type { Address, Hash, Hex, TypedDataDomain, TypedDataParameter } from './typed-data.js';
8
+ export declare enum SVMPriorityFeeLevel {
9
+ NORMAL = "NORMAL",
10
+ FAST = "FAST",
11
+ ULTRA = "ULTRA"
12
+ }
13
+ /**
14
+ * Used as a bigint replacement for TransactionRequest because bigint is not serializable
15
+ */
16
+ export type BigIntish = string;
17
+ /**
18
+ * Pagination options for the API
19
+ */
20
+ export interface PaginationQuery {
21
+ limit?: number;
22
+ next?: string;
23
+ previous?: string;
24
+ }
25
+ /**
26
+ * API response for paginated requests
27
+ */
28
+ export interface PaginatedResponse<T> {
29
+ hasNext?: boolean;
30
+ hasPrevious?: boolean;
31
+ next?: string;
32
+ previous?: string;
33
+ total?: number;
34
+ data: T[];
35
+ }
36
+ export type TransactionRequest = {
37
+ to?: string;
38
+ from?: string;
39
+ nonce?: number;
40
+ gasLimit?: BigIntish;
41
+ gasPrice?: BigIntish;
42
+ data?: string;
43
+ value?: BigIntish;
44
+ chainId?: number;
45
+ type?: number;
46
+ accessList?: {
47
+ address: string;
48
+ storageKeys: string[];
49
+ }[];
50
+ maxPriorityFeePerGas?: BigIntish;
51
+ maxFeePerGas?: BigIntish;
52
+ customData?: Record<string, any>;
53
+ ccipReadEnabled?: boolean;
54
+ };
55
+ /**
56
+ * Timing options
57
+ */
58
+ export interface TimingStrategyMinWaitTime {
59
+ strategy: 'minWaitTime';
60
+ minWaitTimeMs: number;
61
+ startingExpectedResults: number;
62
+ reduceEveryMs: number;
63
+ }
64
+ export type TimingStrategyMinWaitTimeString = `minWaitTime-${number}-${number}-${number}`;
65
+ export type TimingStrategy = TimingStrategyMinWaitTime;
66
+ export type TimingStrategyString = TimingStrategyMinWaitTimeString;
67
+ export interface Timing {
68
+ swapStepTimingStrategies?: TimingStrategy[];
69
+ routeTimingStrategies?: TimingStrategy[];
70
+ }
71
+ export interface TimingStrings {
72
+ swapStepTimingStrategies?: TimingStrategyString[];
73
+ routeTimingStrategies?: TimingStrategyString[];
74
+ }
75
+ /**
76
+ * RECOMMENDED and SAFEST are deprecated as of 28.06.24
77
+ * https://lifi.atlassian.net/browse/LF-8826
78
+ */
79
+ export declare const Orders: readonly ['RECOMMENDED', 'FASTEST', 'CHEAPEST', 'SAFEST'];
80
+ export type Order = (typeof Orders)[number];
81
+ export interface RoutesRequest {
82
+ fromChainId: number;
83
+ fromAmount: string;
84
+ fromTokenAddress: string;
85
+ fromAddress?: string;
86
+ toChainId: number;
87
+ toTokenAddress: string;
88
+ toAddress?: string;
89
+ options?: RouteOptions;
90
+ fromAmountForGas?: string;
91
+ }
92
+ export interface RouteOptionsBase {
93
+ /** 0.03 = take 3% integrator fee (requires verified integrator to be set) */
94
+ fee?: number;
95
+ /** Hide routes with price impact greater than or equal to this value */
96
+ maxPriceImpact?: number;
97
+ /** (default: CHEAPEST) 'FASTEST' | 'CHEAPEST' */
98
+ order?: Order;
99
+ /** (default: 0.03) Expressed as decimal proportion, 0.03 represents 3%.
100
+ * With `slippageScope: 'route'` this is the total budget `S` for the whole
101
+ * route instead (explicit value in `[0, 1)` required; no default applies). */
102
+ slippage?: number;
103
+ /** Scope of `slippage`. Omitted and `'step'` are identical (per-step
104
+ * slippage, today's behaviour). `'route'` opts into route-wide protection:
105
+ * the response carries a {@link RouteSlippageCommitment} and unsupported
106
+ * paths are rejected instead of downgraded. @default 'step' */
107
+ slippageScope?: SlippageScope;
108
+ /** (default: false) Whether chain switches should be allowed in the routes */
109
+ allowSwitchChain?: boolean;
110
+ /** (default: true) destination calls are enabled by default */
111
+ allowDestinationCall?: boolean;
112
+ /** Bridges that should or should not be taken into consideration for the possibilities */
113
+ bridges?: AllowDenyPrefer;
114
+ /** Exchanges that should or should not be taken into consideration for the possibilities */
115
+ exchanges?: AllowDenyPrefer;
116
+ /** Protocols that should or should not be taken into consideration for the possibilities */
117
+ protocols?: AllowDenyPrefer;
118
+ /** Pools that should not be taken into consideration for the possibilities.
119
+ * Only supported by the `fly` exchange — see {@link PoolDeny}. */
120
+ pools?: PoolDeny;
121
+ /** Liquidity venues each swap leg may execute against, per side.
122
+ * Only supported by the `fly` exchange — see {@link LiquiditySources}. */
123
+ liquiditySources?: LiquiditySources;
124
+ /** Timing strategies for the routes */
125
+ timing?: Timing;
126
+ /** Whether to include routes that require a transaction or a message, or both
127
+ * @default 'transaction' */
128
+ executionType?: ExecutionType;
129
+ /** Opt the request into gasless execution. The returned steps carry signable
130
+ * typed data instead of a `transactionRequest`, and a relay fee is deducted
131
+ * from the input amount as a `feeCosts` entry named `LIFI Gasless Relay Fee`.
132
+ * @default false */
133
+ gasless?: boolean;
134
+ }
135
+ /**
136
+ * A single entry in the `distributionFees` request parameter.
137
+ *
138
+ * `distributionFees` lets a verified integrator carve additional on-chain
139
+ * recipients out of their integrator-fee pool, in parallel with the
140
+ * optional `intermediary` carve. Each entry produces an extra fee transfer
141
+ * to `receiver` proportional to `percentage` of the source amount, executed
142
+ * via the LI.FI FeeForwarder contract. Partner-provided receivers are
143
+ * sanction-screened at quote time (warn-log on failure, see backend logs).
144
+ *
145
+ * Constraints (enforced server-side, subject to change without a types
146
+ * major bump — read the current values from the API error responses if
147
+ * you need them programmatically):
148
+ * - `percentage` is a decimal proportion ( `0.001` = 0.1% ), exclusive of 0
149
+ * and bounded by a per-request cap. The aggregate fee (integrator `fee`
150
+ * plus all `distributionFees[].percentage`) is also capped by the
151
+ * backend; exceeding either limit yields a `ValidationError`.
152
+ * - At most ~10 entries per request.
153
+ * - `receiver` must be a non-zero EVM address (`0x` followed by 40 hex
154
+ * characters). Non-EVM receivers are not yet supported.
155
+ *
156
+ * Only meaningful when `integrator` is set and has an active fee agreement.
157
+ */
158
+ export interface DistributionFee {
159
+ /** Fraction of the swap input taken as a distribution fee (e.g. `0.001` = 0.1%). */
160
+ percentage: number;
161
+ /** On-chain EVM recipient address; must be a non-zero `0x`-prefixed hex address. */
162
+ receiver: string;
163
+ }
164
+ export interface RouteOptions extends RouteOptionsBase {
165
+ /** Should contain the identifier of the integrator. Usually, it's dApp/company name. */
166
+ integrator?: string;
167
+ /** Optional intermediary identifier for multi-party fee splitting.
168
+ * Requires a registered integrator with a `fee` and a configured intermediary share on the backend. */
169
+ intermediary?: string;
170
+ /**
171
+ * Partner-provided fee distribution recipients. Each entry adds an
172
+ * independent on-chain transfer to `receiver` in proportion to
173
+ * `percentage` of the swap input, in parallel with the integrator and
174
+ * (optional) intermediary carves. Requires a verified `integrator` with
175
+ * an active fee agreement.
176
+ * @see {@link DistributionFee} for per-entry constraints.
177
+ */
178
+ distributionFees?: DistributionFee[];
179
+ /**
180
+ * Disable the backend integrator fee for this request.
181
+ *
182
+ * Permissioned: honoured only for allowlisted integrations (authenticated via
183
+ * their API key). Non-allowlisted callers that set it are ignored and charged
184
+ * normally. Attribution and integrator-specific config still resolve from
185
+ * `integrator` — only the fee is suppressed.
186
+ */
187
+ disableFees?: boolean;
188
+ /** Integrators can set a wallet address as a referrer to track them */
189
+ referrer?: string;
190
+ /**
191
+ * Recipient of source-chain bridge principal refunds, independent of the
192
+ * funding sender and successful recipient. Must be valid on the source chain.
193
+ * When supplied, bridges and quote variants that cannot honor it are excluded
194
+ * or rejected rather than falling back to the sender. Does not redirect
195
+ * destination swap/call recovery. Omission preserves the bridge's default.
196
+ */
197
+ refundAddress?: string;
198
+ /** SVM specific option, without it implicit source swaps routes are discarded */
199
+ jitoBundle?: boolean;
200
+ /** SVM specific option, wallet to sponsor tx costs */
201
+ svmSponsor?: string;
202
+ /** SVM specific option, priority fee level */
203
+ svmPriorityFeeLevel?: SVMPriorityFeeLevel;
204
+ /** Mayan specific option to bridge from non-EVM chain to Hyperliquid */
205
+ mayanNonEvmPermitSignature?: boolean;
206
+ /** Preset configuration for stablecoin routing optimization.
207
+ * When provided, this preset will override other route options with optimized settings */
208
+ preset?: string;
209
+ /** Opt into amount-flexible routing where the underlying tool supports it.
210
+ * Instead of a fixed minimum output, an amount-flexible route carries a signed
211
+ * rate floor, a minimum deposit and a rate expiry alongside a deposit address:
212
+ * any amount at or above the minimum, funded within the window, executes at
213
+ * the live price no worse than the floor. Currently honored only by
214
+ * cross-chain Smart Deposit Address routes; ignored by tools that do not
215
+ * support it.
216
+ * @default false */
217
+ amountFlexible?: boolean;
218
+ /** Requests a destination-side action executed after the bridge leg
219
+ * (cross-chain EVM Smart Deposits routes only). The returned route's Smart
220
+ * Deposits step carries the action — post that step unchanged to
221
+ * `/v1/advanced/stepTransaction`. Routes that cannot execute the action are
222
+ * rejected or excluded rather than silently served without it. */
223
+ destinationAction?: DestinationAction;
224
+ /** Whether the user wants to insure their tx
225
+ * @deprecated This property is deprecated and will be removed in future versions. */
226
+ insurance?: boolean;
227
+ }
228
+ export declare const ExecutionTypes: readonly ['transaction', 'message', 'all'];
229
+ export type ExecutionType = (typeof ExecutionTypes)[number];
230
+ export type ToolsResponse = {
231
+ exchanges: {
232
+ key: string;
233
+ name: string;
234
+ logoURI: string;
235
+ supportedChains: ChainId[];
236
+ }[];
237
+ bridges: {
238
+ key: string;
239
+ name: string;
240
+ logoURI: string;
241
+ supportedChains: {
242
+ fromChainId: ChainId;
243
+ toChainId: ChainId;
244
+ }[];
245
+ }[];
246
+ };
247
+ export interface AllowDenyPrefer {
248
+ allow?: string[];
249
+ deny?: string[];
250
+ prefer?: string[];
251
+ }
252
+ export interface PoolDeny {
253
+ /**
254
+ * AMM pool identifiers to exclude from swap quoting. Accepts either:
255
+ * - Uniswap V2 / V3: a plain EVM pool address (`0x` + 40 hex, non-zero).
256
+ * - Uniswap V4: `${poolManagerAddress}-${poolId}` where `poolId` is a
257
+ * 32-byte hex string.
258
+ * Pool-level exclusion is only supported by the `fly` exchange aggregator, so
259
+ * setting this restricts every swap in the route to `fly`.
260
+ */
261
+ deny?: string[];
262
+ }
263
+ /**
264
+ * Liquidity venues a swap leg is allowed to execute against, scoped per side of
265
+ * the route. Names come from Fly's liquidity-source list and are chain-specific
266
+ * (e.g. `aerodrome-stable` on Base); a name valid on another chain simply yields
267
+ * no route. Venue-level filtering is only supported by the `fly` exchange
268
+ * aggregator, so a side with a list set is restricted to `fly`.
269
+ *
270
+ * On a same-chain route the single swap counts as the source leg, so `source`
271
+ * applies and `destination` is ignored.
272
+ */
273
+ export interface LiquiditySources {
274
+ /** Venues allowed for the swap on the source chain. */
275
+ source?: string[];
276
+ /** Venues allowed for the swap on the destination chain. */
277
+ destination?: string[];
278
+ }
279
+ /**
280
+ * @deprecated _InsuranceState is deprecated and will be removed in future versions.
281
+ */
282
+ export declare const _InsuranceState: readonly ['INSURED', 'INSURABLE', 'NOT_INSURABLE'];
283
+ /**
284
+ * @deprecated InsuranceState is deprecated and will be removed in future versions.
285
+ */
286
+ export type InsuranceState = (typeof _InsuranceState)[number];
287
+ /**
288
+ * @deprecated InsuranceState is deprecated and will be removed in future versions.
289
+ */
290
+ export interface Insurance {
291
+ state: InsuranceState;
292
+ feeAmountUsd: string;
293
+ }
294
+ export interface Route {
295
+ id: string;
296
+ insurance: Insurance;
297
+ fromChainId: number;
298
+ fromAmountUSD: string;
299
+ fromAmount: string;
300
+ fromToken: Token;
301
+ fromAddress?: string;
302
+ toChainId: number;
303
+ toAmountUSD: string;
304
+ toAmount: string;
305
+ toAmountMin: string;
306
+ toToken: Token;
307
+ toAddress?: string;
308
+ /** Present iff the route was admitted with `slippageScope: 'route'`; also
309
+ * mirrored onto every participating root step. Absent on step-scope routes. */
310
+ routeSlippage?: RouteSlippageCommitment;
311
+ gasCostUSD?: string;
312
+ containsSwitchChain?: boolean;
313
+ steps: LiFiStep[];
314
+ tags?: Order[];
315
+ }
316
+ export type ToolErrorType = 'NO_QUOTE';
317
+ export interface ToolError {
318
+ errorType: ToolErrorType;
319
+ code: string;
320
+ action: Action;
321
+ tool: string;
322
+ message: string;
323
+ }
324
+ export type ErroredPaths = {
325
+ [subpath: string]: ToolError[];
326
+ };
327
+ export type ErroredRoute = {
328
+ overallPath: string;
329
+ subpaths: ErroredPaths;
330
+ };
331
+ export type FilteredResult = {
332
+ overallPath: string;
333
+ reason: string;
334
+ };
335
+ export type UnavailableRoutes = {
336
+ filteredOut: FilteredResult[];
337
+ failed: ErroredRoute[];
338
+ };
339
+ export interface RoutesResponse {
340
+ routes: Route[];
341
+ unavailableRoutes: UnavailableRoutes;
342
+ }
343
+ export type PossibilityTopic = 'chains' | 'tokens' | 'bridges' | 'exchanges';
344
+ /**
345
+ * We don't want to support this endpoint anymore in the future. /chains, /tools, /connections, and /tokens should be used instead
346
+ * @deprecated
347
+ */
348
+ export interface PossibilitiesRequest {
349
+ chains?: number[];
350
+ bridges?: AllowDenyPrefer;
351
+ exchanges?: AllowDenyPrefer;
352
+ include?: PossibilityTopic[];
353
+ }
354
+ /**
355
+ * Should not be accessed via the types package anymore
356
+ * @deprecated
357
+ */
358
+ export interface PossibilitiesResponse {
359
+ chains?: Chain[];
360
+ tokens?: Token[];
361
+ bridges?: BridgeDefinition[];
362
+ exchanges?: ExchangeDefinition[];
363
+ }
364
+ export interface GetTokenRequest {
365
+ chain: number | string;
366
+ token: string;
367
+ }
368
+ export declare enum TokenHistoricGranularity {
369
+ THIRTY_MIN = "30min",
370
+ HOUR = "hour",
371
+ DAY = "day",
372
+ OVER_DAY = ">day"
373
+ }
374
+ export interface GetTokenHistoricRequest {
375
+ chain: number | string;
376
+ token: string;
377
+ timestamp: number;
378
+ granularity?: TokenHistoricGranularity;
379
+ }
380
+ export interface TokenPriceHistoricResponse {
381
+ chainId: number;
382
+ tokenAddress: string;
383
+ isNativeToken: boolean;
384
+ priceUSD: string;
385
+ timestamp: number;
386
+ granularity: TokenHistoricGranularity;
387
+ }
388
+ export interface ToolConfiguration {
389
+ allowBridges?: string[];
390
+ denyBridges?: string[];
391
+ preferBridges?: string[];
392
+ allowExchanges?: string[];
393
+ denyExchanges?: string[];
394
+ preferExchanges?: string[];
395
+ allowProtocols?: string[];
396
+ denyProtocols?: string[];
397
+ denyPools?: string[];
398
+ liquiditySourcesSource?: string[];
399
+ liquiditySourcesDestination?: string[];
400
+ }
401
+ export interface QuoteRequest extends ToolConfiguration, TimingStrings {
402
+ fromChain: number | string;
403
+ fromToken: string;
404
+ fromAddress: string;
405
+ fromAmount: string;
406
+ toChain: number | string;
407
+ toToken: string;
408
+ toAddress?: string;
409
+ /** @see {@link RouteOptions.refundAddress} */
410
+ refundAddress?: string;
411
+ order?: Order;
412
+ slippage?: number | string;
413
+ /** Scope of `slippage` — see {@link RouteOptionsBase.slippageScope}.
414
+ * Exact-input quotes only; other surfaces reject `'route'`. @default 'step' */
415
+ slippageScope?: SlippageScope;
416
+ integrator?: string;
417
+ /** Optional intermediary identifier for multi-party fee splitting.
418
+ * Requires a registered integrator with a `fee` and a configured intermediary share on the backend. */
419
+ intermediary?: string;
420
+ /** @see {@link RouteOptions.distributionFees} and {@link DistributionFee} */
421
+ distributionFees?: DistributionFee[];
422
+ referrer?: string;
423
+ fee?: number | string;
424
+ /** @see {@link RouteOptions.disableFees} */
425
+ disableFees?: boolean;
426
+ /** Whether destination calls are enabled by default
427
+ * @default true */
428
+ allowDestinationCall?: boolean;
429
+ /** Requests a destination-side action executed after the bridge leg (Smart Deposits routes only).
430
+ * Must be sent together with `destinationActionVault`; cross-chain EVM routes only. */
431
+ destinationActionKind?: DestinationActionKind;
432
+ /** The ERC-4626 vault the bridged funds are deposited into. Must be on the curated allowlist
433
+ * and its underlying asset must equal `toToken`. Must be sent together with `destinationActionKind`. */
434
+ destinationActionVault?: string;
435
+ /** The amount of token to convert to gas */
436
+ fromAmountForGas?: string;
437
+ /** Hide routes with price impact greater than or equal to this value */
438
+ maxPriceImpact?: number;
439
+ /** Whether to skip simulation of the quote */
440
+ skipSimulation?: boolean;
441
+ /** The execution type of the quote
442
+ * @default 'transaction' */
443
+ executionType?: ExecutionType;
444
+ /** Opt the request into gasless execution. The response returns signable
445
+ * typed data instead of a `transactionRequest`, and a relay fee is deducted
446
+ * from the input amount as a `feeCosts` entry named `LIFI Gasless Relay Fee`.
447
+ * @default false */
448
+ gasless?: boolean;
449
+ /** SVM specific option, without it implicit source swaps routes are discarded */
450
+ jitoBundle?: boolean;
451
+ /** SVM specific option, wallet to sponsor tx costs */
452
+ svmSponsor?: string;
453
+ /** SVM specific option, priority fee level */
454
+ svmPriorityFeeLevel?: SVMPriorityFeeLevel;
455
+ /** Preset configuration for stablecoin routing optimization
456
+ * When provided, this preset will override other route options with optimized settings */
457
+ preset?: string;
458
+ /** Indicates whether the user wants a quote with bridge insurance
459
+ * @deprecated This property is deprecated and will be removed in future versions. */
460
+ insurance?: boolean;
461
+ }
462
+ export interface QuoteToAmountRequest extends Omit<QuoteRequest, 'fromAmount' | 'fromAmountForGas' | 'insurance' | 'destinationActionKind' | 'destinationActionVault' | 'slippageScope'> {
463
+ toAmount: string;
464
+ slippageScope?: 'step';
465
+ }
466
+ export interface ContractCall {
467
+ fromAmount: string;
468
+ fromTokenAddress: string;
469
+ toContractAddress: string;
470
+ toContractCallData: string;
471
+ toContractGasLimit: string;
472
+ toApprovalAddress?: string;
473
+ toTokenAddress?: string;
474
+ }
475
+ type PartialContractCallsQuoteRequest = ToolConfiguration & {
476
+ fromChain: number | string;
477
+ fromToken: string;
478
+ fromAddress: string;
479
+ /** @see {@link RouteOptions.refundAddress} */
480
+ refundAddress?: string;
481
+ toChain: number | string;
482
+ toToken: string;
483
+ toFallbackAddress?: string;
484
+ contractOutputsToken?: string;
485
+ contractCalls: ContractCall[];
486
+ slippage?: number | string;
487
+ /** Contract-call quotes stay on step scope; `'route'` is rejected. */
488
+ slippageScope?: 'step';
489
+ integrator?: string;
490
+ referrer?: string;
491
+ fee?: number | string;
492
+ /** @see {@link RouteOptions.disableFees} */
493
+ disableFees?: boolean;
494
+ allowDestinationCall?: boolean;
495
+ };
496
+ export type ContractCallsQuoteRequestToAmount = PartialContractCallsQuoteRequest & {
497
+ toAmount: string;
498
+ };
499
+ export type ContractCallsQuoteRequestFromAmount = PartialContractCallsQuoteRequest & {
500
+ fromAmount: string;
501
+ };
502
+ export type ContractCallsQuoteRequest = ContractCallsQuoteRequestFromAmount | ContractCallsQuoteRequestToAmount;
503
+ export declare const isContractCallsRequestWithFromAmount: (r: ContractCallsQuoteRequestFromAmount | ContractCallsQuoteRequestToAmount) => r is ContractCallsQuoteRequestFromAmount;
504
+ export declare const isContractCallsRequestWithToAmount: (r: ContractCallsQuoteRequestFromAmount | ContractCallsQuoteRequestToAmount) => r is ContractCallsQuoteRequestToAmount;
505
+ export interface ContractCallQuoteRequest extends ToolConfiguration {
506
+ fromChain: number | string;
507
+ fromToken: string;
508
+ fromAddress: string;
509
+ /** @see {@link RouteOptions.refundAddress} */
510
+ refundAddress?: string;
511
+ toChain: number | string;
512
+ toToken: string;
513
+ toAmount: string;
514
+ toContractAddress: string;
515
+ toContractCallData: string;
516
+ toContractGasLimit: string;
517
+ toApprovalAddress?: string;
518
+ toFallbackAddress?: string;
519
+ contractOutputsToken?: string;
520
+ slippage?: number | string;
521
+ integrator?: string;
522
+ referrer?: string;
523
+ fee?: number | string;
524
+ allowDestinationCall?: boolean;
525
+ }
526
+ export interface ConnectionsRequest extends ToolConfiguration {
527
+ fromChain: number | string;
528
+ fromToken?: string;
529
+ toChain: number | string;
530
+ toToken?: string;
531
+ allowSwitchChain?: boolean;
532
+ allowDestinationCall?: boolean;
533
+ chainTypes?: ChainType[];
534
+ }
535
+ export interface Connection {
536
+ fromChainId: number;
537
+ toChainId: number;
538
+ fromTokens: Token[];
539
+ toTokens: Token[];
540
+ }
541
+ export type BasicConnection = Omit<Connection, 'fromTokens' | 'toTokens'> & {
542
+ fromTokens: BaseToken[];
543
+ toTokens: BaseToken[];
544
+ };
545
+ export interface ConnectionsResponse {
546
+ connections: BasicConnection[];
547
+ }
548
+ export type GetStatusRequest = {
549
+ bridge?: string;
550
+ fromChain?: number | string;
551
+ toChain?: number | string;
552
+ transactionId?: string;
553
+ depositAddress?: string;
554
+ } & ({
555
+ txHash: string;
556
+ } | {
557
+ taskId: string;
558
+ });
559
+ export interface BaseTransactionInfo {
560
+ txHash: string;
561
+ chainId: ChainId;
562
+ txLink: string;
563
+ }
564
+ export interface ExtendedTransactionInfo extends BaseTransactionInfo {
565
+ amount?: string;
566
+ amountUSD?: string;
567
+ token?: Token;
568
+ gasPrice: string;
569
+ gasUsed: string;
570
+ gasToken: Token;
571
+ gasAmount: string;
572
+ gasAmountUSD: string;
573
+ timestamp?: number;
574
+ value?: string;
575
+ includedSteps?: IncludedStep[];
576
+ }
577
+ export interface PendingReceivingInfo {
578
+ chainId: ChainId;
579
+ }
580
+ declare const _StatusMessage: readonly ['NOT_FOUND', 'INVALID', 'PENDING', 'DONE', 'FAILED'];
581
+ export type StatusMessage = (typeof _StatusMessage)[number];
582
+ declare const _SubstatusPending: readonly ['WAIT_SOURCE_CONFIRMATIONS', 'WAIT_DESTINATION_TRANSACTION', 'BRIDGE_NOT_AVAILABLE', 'CHAIN_NOT_AVAILABLE', 'REFUND_IN_PROGRESS', 'UNKNOWN_ERROR', 'INTENT_AWAITING_FUNDS', 'INTENT_READY', 'INTENT_EXECUTING', 'INTENT_FAILED_RETRYABLE', 'INTENT_SIMULATION_FAILURE'];
583
+ export type SubstatusPending = (typeof _SubstatusPending)[number];
584
+ declare const _SubstatusDone: readonly ['COMPLETED', 'PARTIAL', 'REFUNDED'];
585
+ export type SubstatusDone = (typeof _SubstatusDone)[number];
586
+ declare const _SubstatusFailed: readonly ['INSUFFICIENT_ALLOWANCE', 'INSUFFICIENT_BALANCE', 'OUT_OF_GAS', 'EXPIRED', 'SLIPPAGE_EXCEEDED', 'UNKNOWN_FAILED_ERROR', 'INTENT_REFUND_FAILED'];
587
+ export type SubstatusFailed = (typeof _SubstatusFailed)[number];
588
+ export type Substatus = SubstatusPending | SubstatusDone | SubstatusFailed;
589
+ export declare const isSubstatusPending: (substatus: Substatus) => substatus is SubstatusPending;
590
+ export declare const isSubstatusDone: (substatus: Substatus) => substatus is SubstatusDone;
591
+ export declare const isSubstatusFailed: (substatus: Substatus) => substatus is SubstatusFailed;
592
+ export interface BaseStatusData {
593
+ status: StatusMessage;
594
+ substatus?: Substatus;
595
+ substatusMessage?: string;
596
+ }
597
+ export interface StatusData extends BaseStatusData {
598
+ tool: string;
599
+ sending: BaseTransactionInfo;
600
+ receiving: PendingReceivingInfo;
601
+ }
602
+ export interface FailedStatusData extends BaseStatusData {
603
+ status: 'FAILED';
604
+ sending: BaseTransactionInfo;
605
+ }
606
+ export type StatusResponse = FullStatusData | StatusData | FailedStatusData;
607
+ interface TransferMetadata {
608
+ integrator: string;
609
+ referrer?: string;
610
+ }
611
+ export type IncludedStep = {
612
+ fromAmount: string;
613
+ fromToken: Token;
614
+ toAmount: string;
615
+ toToken: Token;
616
+ bridgedAmount?: string;
617
+ tool: string;
618
+ toolDetails: StepToolDetails;
619
+ };
620
+ export interface FullStatusData extends StatusData {
621
+ transactionId: string;
622
+ sending: ExtendedTransactionInfo;
623
+ receiving: PendingReceivingInfo | ExtendedTransactionInfo;
624
+ feeCosts: FeeCost[];
625
+ lifiExplorerLink: string;
626
+ fromAddress: string;
627
+ toAddress: string;
628
+ metadata: TransferMetadata;
629
+ bridgeExplorerLink?: string;
630
+ }
631
+ export interface ExtendedChain extends Chain {
632
+ nativeToken: Token;
633
+ diamondAddress?: string;
634
+ permit2?: string;
635
+ permit2Proxy?: string;
636
+ /**
637
+ * Whether the chain has a non-standard native decimals handling like Tempo or Stable
638
+ * @default false
639
+ */
640
+ nonStandardNativeDecimals?: boolean;
641
+ }
642
+ export interface ChainsResponse {
643
+ chains: ExtendedChain[];
644
+ }
645
+ export interface ChainsRequest {
646
+ chainTypes?: ChainType[];
647
+ }
648
+ export interface ToolsRequest {
649
+ chains?: (ChainKey | ChainId)[];
650
+ }
651
+ export declare const TokensSortOrders: readonly ['marketCapUSD', 'priceUSD', 'volumeUSD24H', 'fdvUSD'];
652
+ export type TokensSortOrder = (typeof TokensSortOrders)[number];
653
+ export type TokensRequest = {
654
+ chains?: (ChainId | ChainKey)[];
655
+ chainTypes?: ChainType[];
656
+ minPriceUSD?: number;
657
+ orderBy?: TokensSortOrder;
658
+ limit?: number;
659
+ extended?: boolean;
660
+ search?: string;
661
+ tags?: TokenTag[];
662
+ };
663
+ export type TokensResponse = {
664
+ tokens: {
665
+ [chainId: number]: Token[];
666
+ };
667
+ };
668
+ export type TokensExtendedResponse = {
669
+ tokens: {
670
+ [chainId: number]: TokenExtended[];
671
+ };
672
+ };
673
+ export type RequestOptions = {
674
+ signal?: AbortSignal;
675
+ };
676
+ export interface Integrator {
677
+ integratorId: string;
678
+ feeBalances: FeeBalance[];
679
+ }
680
+ export type FeeBalance = {
681
+ chainId: ChainId;
682
+ tokenBalances: TokenBalance[];
683
+ };
684
+ export type TokenBalance = {
685
+ token: Token;
686
+ amount: string;
687
+ amountUsd: string;
688
+ };
689
+ export interface IntegratorWithdrawalRequest {
690
+ integratorId: string;
691
+ chainId: ChainId;
692
+ tokens?: string[];
693
+ }
694
+ export interface IntegratorWithdrawalTransactionResponse {
695
+ transactionRequest: TransactionRequest;
696
+ }
697
+ declare const _LIFuelState: readonly ['PENDING', 'DONE', 'NOT_FOUND'];
698
+ type LIFuelState = (typeof _LIFuelState)[number];
699
+ export type LIFuelStatusResponse = {
700
+ status: LIFuelState;
701
+ sending?: ExtendedTransactionInfo;
702
+ receiving?: PendingReceivingInfo | ExtendedTransactionInfo;
703
+ };
704
+ export type GasRecommendationRequest = {
705
+ chainId: ChainId;
706
+ fromChain?: ChainId;
707
+ fromToken?: string;
708
+ };
709
+ export type RefetchSourceLIFuelRequest = {
710
+ txHash: string;
711
+ chainId: ChainId;
712
+ };
713
+ export type LIFuelStatusRequest = {
714
+ txHash: string;
715
+ };
716
+ export type RefetchLIFuelRequest = {
717
+ txHash: string;
718
+ chainId: ChainId;
719
+ };
720
+ export type GasRecommendationResponse = {
721
+ available: boolean;
722
+ message?: string;
723
+ recommended?: TokenBalance;
724
+ limit?: TokenBalance;
725
+ serviceFee?: TokenBalance;
726
+ fromToken?: Token;
727
+ fromAmount?: string;
728
+ };
729
+ export interface TransactionAnalyticsResponse {
730
+ transfers: StatusResponse[];
731
+ }
732
+ export type TransactionAnalyticsStatus = Exclude<StatusMessage, 'NOT_FOUND' | 'INVALID'> | 'ALL';
733
+ export interface TransactionAnalyticsRequest {
734
+ wallet: string;
735
+ fromTimestamp?: number;
736
+ toTimestamp?: number;
737
+ status?: TransactionAnalyticsStatus;
738
+ }
739
+ export interface CreateIntegratorRequest {
740
+ name: string;
741
+ integratorId: string;
742
+ fee?: number;
743
+ feeType?: IntegratorFeeType;
744
+ defaultWallet?: string;
745
+ chainWallets?: ChainWalletConfiguration;
746
+ }
747
+ export interface UpdateIntegratorRequest {
748
+ name?: string;
749
+ fee?: number;
750
+ feeType?: IntegratorFeeType;
751
+ defaultWallet?: string;
752
+ chainWallets?: ChainWalletConfiguration;
753
+ }
754
+ export type IntegratorResult = {
755
+ name: string;
756
+ integratorId: string;
757
+ fee: number;
758
+ feeType: IntegratorFeeType;
759
+ defaultWallet?: string;
760
+ chainWallets?: ChainWalletConfiguration;
761
+ };
762
+ export type ChainWalletConfiguration = {
763
+ [key in ChainId]?: string;
764
+ };
765
+ export declare enum IntegratorFeeType {
766
+ FIXED = "FIXED",
767
+ SHARED = "SHARED",
768
+ DYNAMIC = "DYNAMIC",
769
+ INTERMEDIARY = "INTERMEDIARY"
770
+ }
771
+ export type TransferSummary = {
772
+ id: {
773
+ toAddress: string;
774
+ sendingChainId?: number;
775
+ };
776
+ totalReceivedAmount: number;
777
+ };
778
+ export type TransferSummariesResponse = PaginatedResponse<TransferSummary>;
779
+ export interface GetStepRequest {
780
+ stepId: string;
781
+ }
782
+ export interface GetTokenApprovalRequest {
783
+ tokenContractAddress: string;
784
+ chainId: string;
785
+ userWalletAddress: string;
786
+ requiredAmount: string;
787
+ }
788
+ export interface GetTokenApprovalResponse {
789
+ isApproved: boolean;
790
+ approvedAmount: string;
791
+ approvalTransaction: {
792
+ to?: string;
793
+ from?: string;
794
+ nonce?: string;
795
+ gasLimit?: string;
796
+ gasPrice?: string;
797
+ data?: string;
798
+ value?: string;
799
+ chainId?: number;
800
+ type?: number;
801
+ accessList?: {
802
+ address: string;
803
+ storageKeys: string[];
804
+ }[];
805
+ maxPriorityFeePerGas?: string;
806
+ maxFeePerGas?: string;
807
+ customData?: string;
808
+ ccipReadEnabled?: boolean;
809
+ };
810
+ }
811
+ export type PermitBase<T extends bigint | string> = {
812
+ spender: Address;
813
+ nonce: T;
814
+ deadline: T;
815
+ };
816
+ export type PermitMessage<T extends bigint | string> = PermitBase<T> & {
817
+ owner: Address;
818
+ value: T;
819
+ };
820
+ export type TokenPermissions<T extends bigint | string> = {
821
+ token: Address;
822
+ amount: T;
823
+ };
824
+ export type PermitWitnessTransferFromMessage<T extends bigint | string> = PermitBase<T> & {
825
+ permitted: TokenPermissions<T>;
826
+ };
827
+ export declare const TypedDataPrimaryTypes: readonly ['Permit', 'PermitTransferFrom', 'PermitBatchTransferFrom', 'PermitWitnessTransferFrom', 'PermitBatchWitnessTransferFrom', 'Order', 'HyperliquidTransaction:UsdSend', 'HyperliquidTransaction:SpotSend', 'HyperliquidTransaction:SendAsset', 'HyperliquidTransaction:Withdraw', 'HyperliquidTransaction:ApproveAgent', 'Agent', 'NonceMapping', 'HyperliquidTransaction:ApproveBuilderFee', 'PermitSingle'];
828
+ export type TypedDataPrimaryType = (typeof TypedDataPrimaryTypes)[number];
829
+ /**
830
+ * EIP-712 Typed Data
831
+ * @link https://eips.ethereum.org/EIPS/eip-712
832
+ */
833
+ export type TypedData = {
834
+ primaryType: TypedDataPrimaryType;
835
+ domain: TypedDataDomain;
836
+ types: Record<string, readonly TypedDataParameter[]>;
837
+ message: Record<string, any>;
838
+ };
839
+ /**
840
+ * EIP-712 Typed Data with signature
841
+ */
842
+ export interface SignedTypedData extends TypedData {
843
+ signature: Hex;
844
+ }
845
+ export type RelayerErrorResponse = {
846
+ status: 'error';
847
+ data: {
848
+ code: number;
849
+ message: string;
850
+ };
851
+ };
852
+ export type RelayerResponse<T> = {
853
+ status: 'ok';
854
+ data: T;
855
+ } | RelayerErrorResponse;
856
+ export type RelayerQuoteResponse = RelayerResponse<LiFiStep>;
857
+ export type RelayRequest = SignedLiFiStep;
858
+ export type RelayResponseData = {
859
+ taskId: string;
860
+ txLink?: string;
861
+ };
862
+ export type RelayResponse = RelayerResponse<RelayResponseData>;
863
+ export type RelayStatusRequest = {
864
+ taskId: Hash;
865
+ bridge?: string;
866
+ fromChain?: number;
867
+ toChain?: number;
868
+ };
869
+ export type RelayStatusResponseData = {
870
+ status: 'DONE' | 'PENDING' | 'FAILED';
871
+ message?: string;
872
+ metadata: {
873
+ chainId: number;
874
+ txHash?: Hash;
875
+ };
876
+ transactionStatus?: StatusResponse;
877
+ };
878
+ export type RelayStatusResponse = RelayerResponse<RelayStatusResponseData>;
879
+ export type PatchCallDataRequest = {
880
+ chainId: ChainId;
881
+ fromTokenAddress: string;
882
+ targetContractAddress: string;
883
+ callDataToPatch: string;
884
+ patches: {
885
+ amountToReplace: string;
886
+ }[];
887
+ value?: string;
888
+ delegateCall?: boolean;
889
+ }[];
890
+ export {};
891
+ //# sourceMappingURL=api.d.ts.map