@agglayer/sdk 1.0.0-beta.24 → 1.0.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +158 -52
- package/dist/index.d.ts +158 -52
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -61,6 +61,21 @@ interface TokenReference {
|
|
|
61
61
|
readonly chainId: number;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Arc API Unsigned Transaction Types
|
|
66
|
+
*
|
|
67
|
+
* Defines the core request and response types for the tokens.
|
|
68
|
+
*/
|
|
69
|
+
interface UnsignedTransaction {
|
|
70
|
+
readonly to: string;
|
|
71
|
+
readonly data: string;
|
|
72
|
+
readonly value: string;
|
|
73
|
+
readonly gasLimit: string;
|
|
74
|
+
readonly gasPrice?: string;
|
|
75
|
+
readonly chainId: number;
|
|
76
|
+
readonly from?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
64
79
|
/**
|
|
65
80
|
* Arc API Chains Types
|
|
66
81
|
*
|
|
@@ -100,21 +115,6 @@ type ChainsResponse = {
|
|
|
100
115
|
readonly chains: IChain[];
|
|
101
116
|
};
|
|
102
117
|
|
|
103
|
-
/**
|
|
104
|
-
* Arc API Unsigned Transaction Types
|
|
105
|
-
*
|
|
106
|
-
* Defines the core request and response types for the tokens.
|
|
107
|
-
*/
|
|
108
|
-
interface UnsignedTransaction {
|
|
109
|
-
readonly to: string;
|
|
110
|
-
readonly data: string;
|
|
111
|
-
readonly value: string;
|
|
112
|
-
readonly gasLimit: string;
|
|
113
|
-
readonly gasPrice?: string;
|
|
114
|
-
readonly chainId: number;
|
|
115
|
-
readonly from?: string;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
118
|
/**
|
|
119
119
|
* Arc API Routes Types
|
|
120
120
|
*
|
|
@@ -186,14 +186,14 @@ interface StepEstimate {
|
|
|
186
186
|
readonly fromAmountUSD?: string | null;
|
|
187
187
|
readonly toAmountUSD?: string | null;
|
|
188
188
|
}
|
|
189
|
-
interface Step {
|
|
189
|
+
interface Step$1 {
|
|
190
190
|
readonly id: string;
|
|
191
191
|
readonly type: StepType;
|
|
192
192
|
readonly tool: string;
|
|
193
193
|
readonly toolDetails: ToolDetails;
|
|
194
194
|
readonly action: StepAction;
|
|
195
195
|
readonly estimate: StepEstimate;
|
|
196
|
-
readonly includedSteps: Step[] | null;
|
|
196
|
+
readonly includedSteps: Step$1[] | null;
|
|
197
197
|
readonly relatedSteps: string[] | null;
|
|
198
198
|
}
|
|
199
199
|
interface ProviderMetadata {
|
|
@@ -235,7 +235,7 @@ interface Route {
|
|
|
235
235
|
readonly tags: string[];
|
|
236
236
|
readonly feeCosts: FeeCost[];
|
|
237
237
|
readonly gasCosts: GasCost[];
|
|
238
|
-
readonly steps: Step[];
|
|
238
|
+
readonly steps: Step$1[];
|
|
239
239
|
readonly transactionRequest?: UnsignedTransaction | undefined;
|
|
240
240
|
readonly providerMetadata: ProviderMetadata;
|
|
241
241
|
readonly riskFactors: RiskFactors | null;
|
|
@@ -272,52 +272,65 @@ type RoutesResponse = readonly Route[];
|
|
|
272
272
|
* Defines the core request and response types for the transactions endpoint.
|
|
273
273
|
*/
|
|
274
274
|
|
|
275
|
+
interface Token {
|
|
276
|
+
name: string;
|
|
277
|
+
symbol: string;
|
|
278
|
+
decimals: number;
|
|
279
|
+
logoURI: string;
|
|
280
|
+
}
|
|
281
|
+
interface SendingToken extends Token {
|
|
282
|
+
originTokenAddress: string;
|
|
283
|
+
originTokenNetwork: number | null;
|
|
284
|
+
}
|
|
285
|
+
interface ReceivingToken extends Token {
|
|
286
|
+
tokenAddress: string;
|
|
287
|
+
}
|
|
288
|
+
interface IntermediateToken extends Token {
|
|
289
|
+
tokenAddress: string;
|
|
290
|
+
}
|
|
291
|
+
interface Network {
|
|
292
|
+
chainId: number;
|
|
293
|
+
networkId: number | null;
|
|
294
|
+
}
|
|
295
|
+
interface Step {
|
|
296
|
+
txHash: string;
|
|
297
|
+
network: Network;
|
|
298
|
+
timestamp: number;
|
|
299
|
+
amount: string;
|
|
300
|
+
amountUSD: string;
|
|
301
|
+
includedSteps: unknown[];
|
|
302
|
+
}
|
|
303
|
+
interface SendingStep extends Step {
|
|
304
|
+
token: SendingToken;
|
|
305
|
+
}
|
|
306
|
+
interface ReceivingStep extends Step {
|
|
307
|
+
token: ReceivingToken;
|
|
308
|
+
}
|
|
309
|
+
interface IntermediateStep extends Step {
|
|
310
|
+
token: IntermediateToken;
|
|
311
|
+
}
|
|
275
312
|
interface Transaction {
|
|
276
313
|
id: string;
|
|
277
314
|
transactionHash: string;
|
|
278
|
-
bridgeHash: string | null;
|
|
279
315
|
protocols: string[];
|
|
280
316
|
status: string;
|
|
281
|
-
timestamp: number;
|
|
282
317
|
fromAddress: string;
|
|
283
318
|
toAddress: string;
|
|
284
|
-
sending:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
networkId: number | null;
|
|
289
|
-
};
|
|
290
|
-
timestamp: number;
|
|
291
|
-
token: {
|
|
292
|
-
originTokenAddress: string;
|
|
293
|
-
originTokenNetwork: number | null;
|
|
294
|
-
};
|
|
295
|
-
amount: string;
|
|
296
|
-
includedSteps: unknown[] | null;
|
|
297
|
-
};
|
|
298
|
-
receiving: {
|
|
299
|
-
txHash: string | null;
|
|
300
|
-
network: {
|
|
301
|
-
chainId: number;
|
|
302
|
-
networkId: number | null;
|
|
303
|
-
};
|
|
304
|
-
timestamp: number | null;
|
|
305
|
-
amount: string;
|
|
306
|
-
tokenAddress: string;
|
|
307
|
-
} | null;
|
|
308
|
-
leafType: string | null;
|
|
309
|
-
depositCount: number | null;
|
|
310
|
-
transactionIndex: number | null;
|
|
311
|
-
blockNumber: number | null;
|
|
312
|
-
leafIndex: number | null;
|
|
319
|
+
sending: SendingStep;
|
|
320
|
+
receiving: ReceivingStep | null;
|
|
321
|
+
intermediateSteps: IntermediateStep[];
|
|
322
|
+
transactionHashes: string[];
|
|
313
323
|
metadata: {
|
|
314
324
|
integrator: string | null;
|
|
315
325
|
feeCosts: unknown[] | null;
|
|
326
|
+
leafType: string | null;
|
|
327
|
+
depositCount: number | null;
|
|
316
328
|
};
|
|
329
|
+
lastUpdatedAt: number;
|
|
317
330
|
}
|
|
318
331
|
interface TransactionsRequestQueryParams {
|
|
319
332
|
readonly address?: string;
|
|
320
|
-
readonly
|
|
333
|
+
readonly sourceNetworkIds?: string;
|
|
321
334
|
readonly destinationNetworkIds?: string;
|
|
322
335
|
readonly limit?: number;
|
|
323
336
|
readonly startAfter?: number;
|
|
@@ -334,7 +347,7 @@ interface PaginatedTransactionsResponse {
|
|
|
334
347
|
* Defines the core request and response types for the built transaction endpoint.
|
|
335
348
|
*/
|
|
336
349
|
|
|
337
|
-
type BuildTransactionRequestBody = Step;
|
|
350
|
+
type BuildTransactionRequestBody = Step$1;
|
|
338
351
|
type BuildTransactionResponse = UnsignedTransaction;
|
|
339
352
|
|
|
340
353
|
/**
|
|
@@ -382,6 +395,88 @@ type TokenMetadataResponse = {
|
|
|
382
395
|
decimals: number;
|
|
383
396
|
};
|
|
384
397
|
|
|
398
|
+
/**
|
|
399
|
+
* LiFi API Status Types
|
|
400
|
+
*
|
|
401
|
+
* Defines the request and response types for the LiFi status endpoint.
|
|
402
|
+
*/
|
|
403
|
+
interface LiFiToken {
|
|
404
|
+
readonly address: string;
|
|
405
|
+
readonly chainId: number;
|
|
406
|
+
readonly symbol: string;
|
|
407
|
+
readonly decimals: number;
|
|
408
|
+
readonly name: string;
|
|
409
|
+
readonly coinKey: string;
|
|
410
|
+
readonly logoURI: string;
|
|
411
|
+
readonly priceUSD: string;
|
|
412
|
+
}
|
|
413
|
+
interface LiFiStep {
|
|
414
|
+
readonly tool: string;
|
|
415
|
+
readonly toolDetails: {
|
|
416
|
+
readonly key: string;
|
|
417
|
+
readonly name: string;
|
|
418
|
+
readonly logoURI: string;
|
|
419
|
+
};
|
|
420
|
+
readonly fromAmount: string;
|
|
421
|
+
readonly fromToken: LiFiToken;
|
|
422
|
+
readonly toToken: LiFiToken;
|
|
423
|
+
readonly toAmount: string;
|
|
424
|
+
readonly bridgedAmount: string;
|
|
425
|
+
}
|
|
426
|
+
interface LiFiTransaction {
|
|
427
|
+
readonly txHash: string;
|
|
428
|
+
readonly txLink: string;
|
|
429
|
+
readonly amount: string;
|
|
430
|
+
readonly token: LiFiToken;
|
|
431
|
+
readonly chainId: number;
|
|
432
|
+
readonly gasPrice: string;
|
|
433
|
+
readonly gasUsed: string;
|
|
434
|
+
readonly gasToken: LiFiToken;
|
|
435
|
+
readonly gasAmount: string;
|
|
436
|
+
readonly gasAmountUSD: string;
|
|
437
|
+
readonly amountUSD: string;
|
|
438
|
+
readonly value: string;
|
|
439
|
+
readonly includedSteps: LiFiStep[];
|
|
440
|
+
readonly timestamp: number;
|
|
441
|
+
}
|
|
442
|
+
interface LiFiFeeCost {
|
|
443
|
+
readonly name: string;
|
|
444
|
+
readonly description: string;
|
|
445
|
+
readonly percentage: string;
|
|
446
|
+
readonly token: LiFiToken;
|
|
447
|
+
readonly amount: string;
|
|
448
|
+
readonly amountUSD: string;
|
|
449
|
+
readonly included: boolean;
|
|
450
|
+
}
|
|
451
|
+
interface LiFiMetadata {
|
|
452
|
+
readonly integrator: string;
|
|
453
|
+
readonly [key: string]: unknown;
|
|
454
|
+
}
|
|
455
|
+
type LiFiTransferStatus = 'NOT_FOUND' | 'INVALID' | 'PENDING' | 'DONE' | 'FAILED';
|
|
456
|
+
type LiFiTransferSubstatus = 'WAIT_SOURCE_CONFIRMATIONS' | 'WAIT_DESTINATION_TRANSACTION' | 'BRIDGE_NOT_AVAILABLE' | 'CHAIN_NOT_AVAILABLE' | 'REFUND_IN_PROGRESS' | 'UNKNOWN_ERROR' | 'COMPLETED' | 'PARTIAL' | 'REFUNDED';
|
|
457
|
+
type LiFiBridge = 'hop' | 'cbridge' | 'celercircle' | 'optimism' | 'polygon' | 'arbitrum' | 'avalanche' | 'across' | 'gnosis' | 'omni' | 'relay' | 'celerim' | 'symbiosis' | 'thorswap' | 'squid' | 'allbridge' | 'mayan' | 'debridge' | 'chainflip';
|
|
458
|
+
interface LiFiStatusRequestParams {
|
|
459
|
+
readonly txHash: string;
|
|
460
|
+
readonly bridge?: LiFiBridge;
|
|
461
|
+
readonly fromChain?: string;
|
|
462
|
+
readonly toChain?: string;
|
|
463
|
+
}
|
|
464
|
+
interface LiFiStatusResponse {
|
|
465
|
+
readonly transactionId: string;
|
|
466
|
+
readonly sending: LiFiTransaction;
|
|
467
|
+
readonly receiving?: LiFiTransaction;
|
|
468
|
+
readonly feeCosts: LiFiFeeCost[];
|
|
469
|
+
readonly lifiExplorerLink: string;
|
|
470
|
+
readonly fromAddress: string;
|
|
471
|
+
readonly toAddress: string;
|
|
472
|
+
readonly tool: string;
|
|
473
|
+
readonly status: LiFiTransferStatus;
|
|
474
|
+
readonly substatus?: LiFiTransferSubstatus;
|
|
475
|
+
readonly substatusMessage?: string;
|
|
476
|
+
readonly metadata: LiFiMetadata;
|
|
477
|
+
readonly bridgeExplorerLink?: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
385
480
|
/**
|
|
386
481
|
* Chain Types
|
|
387
482
|
*
|
|
@@ -815,6 +910,7 @@ declare class NativeClient {
|
|
|
815
910
|
declare class CoreClient {
|
|
816
911
|
private config;
|
|
817
912
|
private arcApiService;
|
|
913
|
+
private lifiApiService;
|
|
818
914
|
constructor(config?: CoreConfig);
|
|
819
915
|
/**
|
|
820
916
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
@@ -884,6 +980,16 @@ declare class CoreClient {
|
|
|
884
980
|
* @param tokenAddress
|
|
885
981
|
*/
|
|
886
982
|
getTokenMappings(tokenMappingQueryParams: TokenMappingQueryParams): Promise<TokenMappingResponse>;
|
|
983
|
+
/**
|
|
984
|
+
* Check the status of a LiFi cross-chain transfer
|
|
985
|
+
*
|
|
986
|
+
* @param lifiStatusRequestParams - Status request parameters
|
|
987
|
+
* @param lifiStatusRequestParams.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
988
|
+
* @param lifiStatusRequestParams.bridge - Optional: The bridging tool used for the transfer
|
|
989
|
+
* @param lifiStatusRequestParams.fromChain - Optional: The sending chain (chain id or chain key)
|
|
990
|
+
* @param lifiStatusRequestParams.toChain - Optional: The receiving chain (chain id or chain key)
|
|
991
|
+
*/
|
|
992
|
+
getLiFiTransferStatus(lifiStatusRequestParams: LiFiStatusRequestParams): Promise<LiFiStatusResponse>;
|
|
887
993
|
}
|
|
888
994
|
|
|
889
995
|
/**
|
|
@@ -937,4 +1043,4 @@ declare class AggLayerSDK {
|
|
|
937
1043
|
getNative(): NativeClient;
|
|
938
1044
|
}
|
|
939
1045
|
|
|
940
|
-
export { AggLayerSDK, ApiError, type ApiResponse, type BaseContractConfig, type BridgeAssetParams, type BridgeConfig, type BridgeMessageParams, type BridgeOptions, type BuildClaimTransactionRequestParam, type BuildClaimTransactionResponse, type BuildTransactionRequestBody, type BuildTransactionResponse, type ChainConfig, type ChainsQueryParams, type ChainsResponse, type ClaimAssetParams, type ClaimMessageParams, type CoreConfig, type CursorPagination, type CustomChainConfig, type ERC20Config, type ErrorResponse, type FeeCost, type GasCost, type IChain, type IsClaimedParams, type NativeConfig, type OffsetPagination, type OriginTokenInfoParams, type PaginatedTransactionsResponse, type Pagination, type PrecalculatedWrapperParams, type ProviderMetadata, type RiskFactors, type RiskLevel, type Route, type RoutePreferences, type RouteStep, type RoutesRequestParams, type RoutesResponse, type SDKConfig, type SDKMode, SDK_MODES, type Step, type StepAction, type StepEstimate, type StepType, type SuccessResponse, type TokenInfo, type TokenMappingQueryParams, type TokenMappingResponse, type TokenMetadataRequestParam, type TokenMetadataResponse, type TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
|
1046
|
+
export { AggLayerSDK, ApiError, type ApiResponse, type BaseContractConfig, type BridgeAssetParams, type BridgeConfig, type BridgeMessageParams, type BridgeOptions, type BuildClaimTransactionRequestParam, type BuildClaimTransactionResponse, type BuildTransactionRequestBody, type BuildTransactionResponse, type ChainConfig, type ChainsQueryParams, type ChainsResponse, type ClaimAssetParams, type ClaimMessageParams, type CoreConfig, type CursorPagination, type CustomChainConfig, type ERC20Config, type ErrorResponse, type FeeCost, type GasCost, type IChain, type IsClaimedParams, type LiFiBridge, type LiFiFeeCost, type LiFiMetadata, type LiFiStatusRequestParams, type LiFiStatusResponse, type LiFiStep, type LiFiToken, type LiFiTransaction, type LiFiTransferStatus, type LiFiTransferSubstatus, type NativeConfig, type OffsetPagination, type OriginTokenInfoParams, type PaginatedTransactionsResponse, type Pagination, type PrecalculatedWrapperParams, type ProviderMetadata, type RiskFactors, type RiskLevel, type Route, type RoutePreferences, type RouteStep, type RoutesRequestParams, type RoutesResponse, type SDKConfig, type SDKMode, SDK_MODES, type Step$1 as Step, type StepAction, type StepEstimate, type StepType, type SuccessResponse, type TokenInfo, type TokenMappingQueryParams, type TokenMappingResponse, type TokenMetadataRequestParam, type TokenMetadataResponse, type TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type UnsignedTransaction, type WrappedTokenParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,21 @@ interface TokenReference {
|
|
|
61
61
|
readonly chainId: number;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Arc API Unsigned Transaction Types
|
|
66
|
+
*
|
|
67
|
+
* Defines the core request and response types for the tokens.
|
|
68
|
+
*/
|
|
69
|
+
interface UnsignedTransaction {
|
|
70
|
+
readonly to: string;
|
|
71
|
+
readonly data: string;
|
|
72
|
+
readonly value: string;
|
|
73
|
+
readonly gasLimit: string;
|
|
74
|
+
readonly gasPrice?: string;
|
|
75
|
+
readonly chainId: number;
|
|
76
|
+
readonly from?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
64
79
|
/**
|
|
65
80
|
* Arc API Chains Types
|
|
66
81
|
*
|
|
@@ -100,21 +115,6 @@ type ChainsResponse = {
|
|
|
100
115
|
readonly chains: IChain[];
|
|
101
116
|
};
|
|
102
117
|
|
|
103
|
-
/**
|
|
104
|
-
* Arc API Unsigned Transaction Types
|
|
105
|
-
*
|
|
106
|
-
* Defines the core request and response types for the tokens.
|
|
107
|
-
*/
|
|
108
|
-
interface UnsignedTransaction {
|
|
109
|
-
readonly to: string;
|
|
110
|
-
readonly data: string;
|
|
111
|
-
readonly value: string;
|
|
112
|
-
readonly gasLimit: string;
|
|
113
|
-
readonly gasPrice?: string;
|
|
114
|
-
readonly chainId: number;
|
|
115
|
-
readonly from?: string;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
118
|
/**
|
|
119
119
|
* Arc API Routes Types
|
|
120
120
|
*
|
|
@@ -186,14 +186,14 @@ interface StepEstimate {
|
|
|
186
186
|
readonly fromAmountUSD?: string | null;
|
|
187
187
|
readonly toAmountUSD?: string | null;
|
|
188
188
|
}
|
|
189
|
-
interface Step {
|
|
189
|
+
interface Step$1 {
|
|
190
190
|
readonly id: string;
|
|
191
191
|
readonly type: StepType;
|
|
192
192
|
readonly tool: string;
|
|
193
193
|
readonly toolDetails: ToolDetails;
|
|
194
194
|
readonly action: StepAction;
|
|
195
195
|
readonly estimate: StepEstimate;
|
|
196
|
-
readonly includedSteps: Step[] | null;
|
|
196
|
+
readonly includedSteps: Step$1[] | null;
|
|
197
197
|
readonly relatedSteps: string[] | null;
|
|
198
198
|
}
|
|
199
199
|
interface ProviderMetadata {
|
|
@@ -235,7 +235,7 @@ interface Route {
|
|
|
235
235
|
readonly tags: string[];
|
|
236
236
|
readonly feeCosts: FeeCost[];
|
|
237
237
|
readonly gasCosts: GasCost[];
|
|
238
|
-
readonly steps: Step[];
|
|
238
|
+
readonly steps: Step$1[];
|
|
239
239
|
readonly transactionRequest?: UnsignedTransaction | undefined;
|
|
240
240
|
readonly providerMetadata: ProviderMetadata;
|
|
241
241
|
readonly riskFactors: RiskFactors | null;
|
|
@@ -272,52 +272,65 @@ type RoutesResponse = readonly Route[];
|
|
|
272
272
|
* Defines the core request and response types for the transactions endpoint.
|
|
273
273
|
*/
|
|
274
274
|
|
|
275
|
+
interface Token {
|
|
276
|
+
name: string;
|
|
277
|
+
symbol: string;
|
|
278
|
+
decimals: number;
|
|
279
|
+
logoURI: string;
|
|
280
|
+
}
|
|
281
|
+
interface SendingToken extends Token {
|
|
282
|
+
originTokenAddress: string;
|
|
283
|
+
originTokenNetwork: number | null;
|
|
284
|
+
}
|
|
285
|
+
interface ReceivingToken extends Token {
|
|
286
|
+
tokenAddress: string;
|
|
287
|
+
}
|
|
288
|
+
interface IntermediateToken extends Token {
|
|
289
|
+
tokenAddress: string;
|
|
290
|
+
}
|
|
291
|
+
interface Network {
|
|
292
|
+
chainId: number;
|
|
293
|
+
networkId: number | null;
|
|
294
|
+
}
|
|
295
|
+
interface Step {
|
|
296
|
+
txHash: string;
|
|
297
|
+
network: Network;
|
|
298
|
+
timestamp: number;
|
|
299
|
+
amount: string;
|
|
300
|
+
amountUSD: string;
|
|
301
|
+
includedSteps: unknown[];
|
|
302
|
+
}
|
|
303
|
+
interface SendingStep extends Step {
|
|
304
|
+
token: SendingToken;
|
|
305
|
+
}
|
|
306
|
+
interface ReceivingStep extends Step {
|
|
307
|
+
token: ReceivingToken;
|
|
308
|
+
}
|
|
309
|
+
interface IntermediateStep extends Step {
|
|
310
|
+
token: IntermediateToken;
|
|
311
|
+
}
|
|
275
312
|
interface Transaction {
|
|
276
313
|
id: string;
|
|
277
314
|
transactionHash: string;
|
|
278
|
-
bridgeHash: string | null;
|
|
279
315
|
protocols: string[];
|
|
280
316
|
status: string;
|
|
281
|
-
timestamp: number;
|
|
282
317
|
fromAddress: string;
|
|
283
318
|
toAddress: string;
|
|
284
|
-
sending:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
networkId: number | null;
|
|
289
|
-
};
|
|
290
|
-
timestamp: number;
|
|
291
|
-
token: {
|
|
292
|
-
originTokenAddress: string;
|
|
293
|
-
originTokenNetwork: number | null;
|
|
294
|
-
};
|
|
295
|
-
amount: string;
|
|
296
|
-
includedSteps: unknown[] | null;
|
|
297
|
-
};
|
|
298
|
-
receiving: {
|
|
299
|
-
txHash: string | null;
|
|
300
|
-
network: {
|
|
301
|
-
chainId: number;
|
|
302
|
-
networkId: number | null;
|
|
303
|
-
};
|
|
304
|
-
timestamp: number | null;
|
|
305
|
-
amount: string;
|
|
306
|
-
tokenAddress: string;
|
|
307
|
-
} | null;
|
|
308
|
-
leafType: string | null;
|
|
309
|
-
depositCount: number | null;
|
|
310
|
-
transactionIndex: number | null;
|
|
311
|
-
blockNumber: number | null;
|
|
312
|
-
leafIndex: number | null;
|
|
319
|
+
sending: SendingStep;
|
|
320
|
+
receiving: ReceivingStep | null;
|
|
321
|
+
intermediateSteps: IntermediateStep[];
|
|
322
|
+
transactionHashes: string[];
|
|
313
323
|
metadata: {
|
|
314
324
|
integrator: string | null;
|
|
315
325
|
feeCosts: unknown[] | null;
|
|
326
|
+
leafType: string | null;
|
|
327
|
+
depositCount: number | null;
|
|
316
328
|
};
|
|
329
|
+
lastUpdatedAt: number;
|
|
317
330
|
}
|
|
318
331
|
interface TransactionsRequestQueryParams {
|
|
319
332
|
readonly address?: string;
|
|
320
|
-
readonly
|
|
333
|
+
readonly sourceNetworkIds?: string;
|
|
321
334
|
readonly destinationNetworkIds?: string;
|
|
322
335
|
readonly limit?: number;
|
|
323
336
|
readonly startAfter?: number;
|
|
@@ -334,7 +347,7 @@ interface PaginatedTransactionsResponse {
|
|
|
334
347
|
* Defines the core request and response types for the built transaction endpoint.
|
|
335
348
|
*/
|
|
336
349
|
|
|
337
|
-
type BuildTransactionRequestBody = Step;
|
|
350
|
+
type BuildTransactionRequestBody = Step$1;
|
|
338
351
|
type BuildTransactionResponse = UnsignedTransaction;
|
|
339
352
|
|
|
340
353
|
/**
|
|
@@ -382,6 +395,88 @@ type TokenMetadataResponse = {
|
|
|
382
395
|
decimals: number;
|
|
383
396
|
};
|
|
384
397
|
|
|
398
|
+
/**
|
|
399
|
+
* LiFi API Status Types
|
|
400
|
+
*
|
|
401
|
+
* Defines the request and response types for the LiFi status endpoint.
|
|
402
|
+
*/
|
|
403
|
+
interface LiFiToken {
|
|
404
|
+
readonly address: string;
|
|
405
|
+
readonly chainId: number;
|
|
406
|
+
readonly symbol: string;
|
|
407
|
+
readonly decimals: number;
|
|
408
|
+
readonly name: string;
|
|
409
|
+
readonly coinKey: string;
|
|
410
|
+
readonly logoURI: string;
|
|
411
|
+
readonly priceUSD: string;
|
|
412
|
+
}
|
|
413
|
+
interface LiFiStep {
|
|
414
|
+
readonly tool: string;
|
|
415
|
+
readonly toolDetails: {
|
|
416
|
+
readonly key: string;
|
|
417
|
+
readonly name: string;
|
|
418
|
+
readonly logoURI: string;
|
|
419
|
+
};
|
|
420
|
+
readonly fromAmount: string;
|
|
421
|
+
readonly fromToken: LiFiToken;
|
|
422
|
+
readonly toToken: LiFiToken;
|
|
423
|
+
readonly toAmount: string;
|
|
424
|
+
readonly bridgedAmount: string;
|
|
425
|
+
}
|
|
426
|
+
interface LiFiTransaction {
|
|
427
|
+
readonly txHash: string;
|
|
428
|
+
readonly txLink: string;
|
|
429
|
+
readonly amount: string;
|
|
430
|
+
readonly token: LiFiToken;
|
|
431
|
+
readonly chainId: number;
|
|
432
|
+
readonly gasPrice: string;
|
|
433
|
+
readonly gasUsed: string;
|
|
434
|
+
readonly gasToken: LiFiToken;
|
|
435
|
+
readonly gasAmount: string;
|
|
436
|
+
readonly gasAmountUSD: string;
|
|
437
|
+
readonly amountUSD: string;
|
|
438
|
+
readonly value: string;
|
|
439
|
+
readonly includedSteps: LiFiStep[];
|
|
440
|
+
readonly timestamp: number;
|
|
441
|
+
}
|
|
442
|
+
interface LiFiFeeCost {
|
|
443
|
+
readonly name: string;
|
|
444
|
+
readonly description: string;
|
|
445
|
+
readonly percentage: string;
|
|
446
|
+
readonly token: LiFiToken;
|
|
447
|
+
readonly amount: string;
|
|
448
|
+
readonly amountUSD: string;
|
|
449
|
+
readonly included: boolean;
|
|
450
|
+
}
|
|
451
|
+
interface LiFiMetadata {
|
|
452
|
+
readonly integrator: string;
|
|
453
|
+
readonly [key: string]: unknown;
|
|
454
|
+
}
|
|
455
|
+
type LiFiTransferStatus = 'NOT_FOUND' | 'INVALID' | 'PENDING' | 'DONE' | 'FAILED';
|
|
456
|
+
type LiFiTransferSubstatus = 'WAIT_SOURCE_CONFIRMATIONS' | 'WAIT_DESTINATION_TRANSACTION' | 'BRIDGE_NOT_AVAILABLE' | 'CHAIN_NOT_AVAILABLE' | 'REFUND_IN_PROGRESS' | 'UNKNOWN_ERROR' | 'COMPLETED' | 'PARTIAL' | 'REFUNDED';
|
|
457
|
+
type LiFiBridge = 'hop' | 'cbridge' | 'celercircle' | 'optimism' | 'polygon' | 'arbitrum' | 'avalanche' | 'across' | 'gnosis' | 'omni' | 'relay' | 'celerim' | 'symbiosis' | 'thorswap' | 'squid' | 'allbridge' | 'mayan' | 'debridge' | 'chainflip';
|
|
458
|
+
interface LiFiStatusRequestParams {
|
|
459
|
+
readonly txHash: string;
|
|
460
|
+
readonly bridge?: LiFiBridge;
|
|
461
|
+
readonly fromChain?: string;
|
|
462
|
+
readonly toChain?: string;
|
|
463
|
+
}
|
|
464
|
+
interface LiFiStatusResponse {
|
|
465
|
+
readonly transactionId: string;
|
|
466
|
+
readonly sending: LiFiTransaction;
|
|
467
|
+
readonly receiving?: LiFiTransaction;
|
|
468
|
+
readonly feeCosts: LiFiFeeCost[];
|
|
469
|
+
readonly lifiExplorerLink: string;
|
|
470
|
+
readonly fromAddress: string;
|
|
471
|
+
readonly toAddress: string;
|
|
472
|
+
readonly tool: string;
|
|
473
|
+
readonly status: LiFiTransferStatus;
|
|
474
|
+
readonly substatus?: LiFiTransferSubstatus;
|
|
475
|
+
readonly substatusMessage?: string;
|
|
476
|
+
readonly metadata: LiFiMetadata;
|
|
477
|
+
readonly bridgeExplorerLink?: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
385
480
|
/**
|
|
386
481
|
* Chain Types
|
|
387
482
|
*
|
|
@@ -815,6 +910,7 @@ declare class NativeClient {
|
|
|
815
910
|
declare class CoreClient {
|
|
816
911
|
private config;
|
|
817
912
|
private arcApiService;
|
|
913
|
+
private lifiApiService;
|
|
818
914
|
constructor(config?: CoreConfig);
|
|
819
915
|
/**
|
|
820
916
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
@@ -884,6 +980,16 @@ declare class CoreClient {
|
|
|
884
980
|
* @param tokenAddress
|
|
885
981
|
*/
|
|
886
982
|
getTokenMappings(tokenMappingQueryParams: TokenMappingQueryParams): Promise<TokenMappingResponse>;
|
|
983
|
+
/**
|
|
984
|
+
* Check the status of a LiFi cross-chain transfer
|
|
985
|
+
*
|
|
986
|
+
* @param lifiStatusRequestParams - Status request parameters
|
|
987
|
+
* @param lifiStatusRequestParams.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
988
|
+
* @param lifiStatusRequestParams.bridge - Optional: The bridging tool used for the transfer
|
|
989
|
+
* @param lifiStatusRequestParams.fromChain - Optional: The sending chain (chain id or chain key)
|
|
990
|
+
* @param lifiStatusRequestParams.toChain - Optional: The receiving chain (chain id or chain key)
|
|
991
|
+
*/
|
|
992
|
+
getLiFiTransferStatus(lifiStatusRequestParams: LiFiStatusRequestParams): Promise<LiFiStatusResponse>;
|
|
887
993
|
}
|
|
888
994
|
|
|
889
995
|
/**
|
|
@@ -937,4 +1043,4 @@ declare class AggLayerSDK {
|
|
|
937
1043
|
getNative(): NativeClient;
|
|
938
1044
|
}
|
|
939
1045
|
|
|
940
|
-
export { AggLayerSDK, ApiError, type ApiResponse, type BaseContractConfig, type BridgeAssetParams, type BridgeConfig, type BridgeMessageParams, type BridgeOptions, type BuildClaimTransactionRequestParam, type BuildClaimTransactionResponse, type BuildTransactionRequestBody, type BuildTransactionResponse, type ChainConfig, type ChainsQueryParams, type ChainsResponse, type ClaimAssetParams, type ClaimMessageParams, type CoreConfig, type CursorPagination, type CustomChainConfig, type ERC20Config, type ErrorResponse, type FeeCost, type GasCost, type IChain, type IsClaimedParams, type NativeConfig, type OffsetPagination, type OriginTokenInfoParams, type PaginatedTransactionsResponse, type Pagination, type PrecalculatedWrapperParams, type ProviderMetadata, type RiskFactors, type RiskLevel, type Route, type RoutePreferences, type RouteStep, type RoutesRequestParams, type RoutesResponse, type SDKConfig, type SDKMode, SDK_MODES, type Step, type StepAction, type StepEstimate, type StepType, type SuccessResponse, type TokenInfo, type TokenMappingQueryParams, type TokenMappingResponse, type TokenMetadataRequestParam, type TokenMetadataResponse, type TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
|
1046
|
+
export { AggLayerSDK, ApiError, type ApiResponse, type BaseContractConfig, type BridgeAssetParams, type BridgeConfig, type BridgeMessageParams, type BridgeOptions, type BuildClaimTransactionRequestParam, type BuildClaimTransactionResponse, type BuildTransactionRequestBody, type BuildTransactionResponse, type ChainConfig, type ChainsQueryParams, type ChainsResponse, type ClaimAssetParams, type ClaimMessageParams, type CoreConfig, type CursorPagination, type CustomChainConfig, type ERC20Config, type ErrorResponse, type FeeCost, type GasCost, type IChain, type IsClaimedParams, type LiFiBridge, type LiFiFeeCost, type LiFiMetadata, type LiFiStatusRequestParams, type LiFiStatusResponse, type LiFiStep, type LiFiToken, type LiFiTransaction, type LiFiTransferStatus, type LiFiTransferSubstatus, type NativeConfig, type OffsetPagination, type OriginTokenInfoParams, type PaginatedTransactionsResponse, type Pagination, type PrecalculatedWrapperParams, type ProviderMetadata, type RiskFactors, type RiskLevel, type Route, type RoutePreferences, type RouteStep, type RoutesRequestParams, type RoutesResponse, type SDKConfig, type SDKMode, SDK_MODES, type Step$1 as Step, type StepAction, type StepEstimate, type StepType, type SuccessResponse, type TokenInfo, type TokenMappingQueryParams, type TokenMappingResponse, type TokenMetadataRequestParam, type TokenMetadataResponse, type TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type UnsignedTransaction, type WrappedTokenParams };
|
package/dist/index.js
CHANGED
|
@@ -1425,6 +1425,8 @@ var import_viem6 = require("viem");
|
|
|
1425
1425
|
// src/constants.ts
|
|
1426
1426
|
var ARC_API_BASE_URL = "https://arc-api.polygon.technology";
|
|
1427
1427
|
var ARC_API_DEFAULT_TIMEOUT = 3e4;
|
|
1428
|
+
var LIFI_API_BASE_URL = "https://li.quest";
|
|
1429
|
+
var LIFI_API_DEFAULT_TIMEOUT = 5e3;
|
|
1428
1430
|
var DEFAULT_CHAINS_PER_PAGE = 100;
|
|
1429
1431
|
var DEFAULT_CHAINS_WITH_TOKENS_PER_PAGE = 1;
|
|
1430
1432
|
var MAX_TRANSACTIONS_PER_PAGE = 100;
|
|
@@ -1745,6 +1747,39 @@ var ArcApiService = class {
|
|
|
1745
1747
|
}
|
|
1746
1748
|
};
|
|
1747
1749
|
|
|
1750
|
+
// src/core/services/lifiApi.ts
|
|
1751
|
+
var LiFiApiService = class {
|
|
1752
|
+
constructor({ baseUrl, timeout }) {
|
|
1753
|
+
this.httpClient = new HttpClient({ baseUrl, timeout });
|
|
1754
|
+
}
|
|
1755
|
+
/**
|
|
1756
|
+
* Check the status of a cross-chain transfer
|
|
1757
|
+
*
|
|
1758
|
+
* @param params - Status request parameters
|
|
1759
|
+
* @param params.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
1760
|
+
* @param params.bridge - Optional: The bridging tool used for the transfer
|
|
1761
|
+
* @param params.fromChain - Optional: The sending chain (chain id or chain key)
|
|
1762
|
+
* @param params.toChain - Optional: The receiving chain (chain id or chain key)
|
|
1763
|
+
* @returns Promise containing the transfer status response
|
|
1764
|
+
*/
|
|
1765
|
+
async getStatus(params) {
|
|
1766
|
+
const { txHash, bridge, fromChain, toChain } = params;
|
|
1767
|
+
const queryParams = {
|
|
1768
|
+
txHash
|
|
1769
|
+
};
|
|
1770
|
+
if (bridge) {
|
|
1771
|
+
queryParams["bridge"] = bridge;
|
|
1772
|
+
}
|
|
1773
|
+
if (fromChain) {
|
|
1774
|
+
queryParams["fromChain"] = fromChain;
|
|
1775
|
+
}
|
|
1776
|
+
if (toChain) {
|
|
1777
|
+
queryParams["toChain"] = toChain;
|
|
1778
|
+
}
|
|
1779
|
+
return this.httpClient.get("/v1/status", queryParams);
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1748
1783
|
// src/core/utils/apiError.ts
|
|
1749
1784
|
var ApiError = class _ApiError extends Error {
|
|
1750
1785
|
constructor(errorResponse) {
|
|
@@ -1803,6 +1838,10 @@ var CoreClient = class {
|
|
|
1803
1838
|
baseUrl: apiBaseUrl || ARC_API_BASE_URL,
|
|
1804
1839
|
timeout: apiTimeout || ARC_API_DEFAULT_TIMEOUT
|
|
1805
1840
|
});
|
|
1841
|
+
this.lifiApiService = new LiFiApiService({
|
|
1842
|
+
baseUrl: LIFI_API_BASE_URL,
|
|
1843
|
+
timeout: LIFI_API_DEFAULT_TIMEOUT
|
|
1844
|
+
});
|
|
1806
1845
|
}
|
|
1807
1846
|
/**
|
|
1808
1847
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
@@ -2063,6 +2102,31 @@ var CoreClient = class {
|
|
|
2063
2102
|
);
|
|
2064
2103
|
}
|
|
2065
2104
|
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Check the status of a LiFi cross-chain transfer
|
|
2107
|
+
*
|
|
2108
|
+
* @param lifiStatusRequestParams - Status request parameters
|
|
2109
|
+
* @param lifiStatusRequestParams.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
2110
|
+
* @param lifiStatusRequestParams.bridge - Optional: The bridging tool used for the transfer
|
|
2111
|
+
* @param lifiStatusRequestParams.fromChain - Optional: The sending chain (chain id or chain key)
|
|
2112
|
+
* @param lifiStatusRequestParams.toChain - Optional: The receiving chain (chain id or chain key)
|
|
2113
|
+
*/
|
|
2114
|
+
async getLiFiTransferStatus(lifiStatusRequestParams) {
|
|
2115
|
+
try {
|
|
2116
|
+
const response = await this.lifiApiService.getStatus(
|
|
2117
|
+
lifiStatusRequestParams
|
|
2118
|
+
);
|
|
2119
|
+
return response.data;
|
|
2120
|
+
} catch (error) {
|
|
2121
|
+
if (error instanceof ApiError) {
|
|
2122
|
+
throw error;
|
|
2123
|
+
}
|
|
2124
|
+
throw ApiError.createFallbackError(
|
|
2125
|
+
error,
|
|
2126
|
+
"Get LiFi transfer status"
|
|
2127
|
+
);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2066
2130
|
};
|
|
2067
2131
|
|
|
2068
2132
|
// src/index.ts
|