@agglayer/sdk 1.0.0-beta.23 → 1.0.0-beta.25
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 +119 -22
- package/dist/index.d.ts +119 -22
- package/dist/index.js +72 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -2
- 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
|
*
|
|
@@ -271,6 +271,7 @@ type RoutesResponse = readonly Route[];
|
|
|
271
271
|
*
|
|
272
272
|
* Defines the core request and response types for the transactions endpoint.
|
|
273
273
|
*/
|
|
274
|
+
|
|
274
275
|
interface Transaction {
|
|
275
276
|
id: string;
|
|
276
277
|
transactionHash: string;
|
|
@@ -316,14 +317,16 @@ interface Transaction {
|
|
|
316
317
|
}
|
|
317
318
|
interface TransactionsRequestQueryParams {
|
|
318
319
|
readonly address?: string;
|
|
319
|
-
readonly
|
|
320
|
+
readonly sourceNetworkIds?: string;
|
|
320
321
|
readonly destinationNetworkIds?: string;
|
|
321
322
|
readonly limit?: number;
|
|
322
323
|
readonly startAfter?: number;
|
|
323
324
|
}
|
|
324
|
-
type TransactionsResponse =
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
type TransactionsResponse = Transaction[];
|
|
326
|
+
interface PaginatedTransactionsResponse {
|
|
327
|
+
readonly transactions: TransactionsResponse;
|
|
328
|
+
readonly pagination?: CursorPagination;
|
|
329
|
+
}
|
|
327
330
|
|
|
328
331
|
/**
|
|
329
332
|
* Arc API Built Transaction Types
|
|
@@ -379,6 +382,88 @@ type TokenMetadataResponse = {
|
|
|
379
382
|
decimals: number;
|
|
380
383
|
};
|
|
381
384
|
|
|
385
|
+
/**
|
|
386
|
+
* LiFi API Status Types
|
|
387
|
+
*
|
|
388
|
+
* Defines the request and response types for the LiFi status endpoint.
|
|
389
|
+
*/
|
|
390
|
+
interface LiFiToken {
|
|
391
|
+
readonly address: string;
|
|
392
|
+
readonly chainId: number;
|
|
393
|
+
readonly symbol: string;
|
|
394
|
+
readonly decimals: number;
|
|
395
|
+
readonly name: string;
|
|
396
|
+
readonly coinKey: string;
|
|
397
|
+
readonly logoURI: string;
|
|
398
|
+
readonly priceUSD: string;
|
|
399
|
+
}
|
|
400
|
+
interface LiFiStep {
|
|
401
|
+
readonly tool: string;
|
|
402
|
+
readonly toolDetails: {
|
|
403
|
+
readonly key: string;
|
|
404
|
+
readonly name: string;
|
|
405
|
+
readonly logoURI: string;
|
|
406
|
+
};
|
|
407
|
+
readonly fromAmount: string;
|
|
408
|
+
readonly fromToken: LiFiToken;
|
|
409
|
+
readonly toToken: LiFiToken;
|
|
410
|
+
readonly toAmount: string;
|
|
411
|
+
readonly bridgedAmount: string;
|
|
412
|
+
}
|
|
413
|
+
interface LiFiTransaction {
|
|
414
|
+
readonly txHash: string;
|
|
415
|
+
readonly txLink: string;
|
|
416
|
+
readonly amount: string;
|
|
417
|
+
readonly token: LiFiToken;
|
|
418
|
+
readonly chainId: number;
|
|
419
|
+
readonly gasPrice: string;
|
|
420
|
+
readonly gasUsed: string;
|
|
421
|
+
readonly gasToken: LiFiToken;
|
|
422
|
+
readonly gasAmount: string;
|
|
423
|
+
readonly gasAmountUSD: string;
|
|
424
|
+
readonly amountUSD: string;
|
|
425
|
+
readonly value: string;
|
|
426
|
+
readonly includedSteps: LiFiStep[];
|
|
427
|
+
readonly timestamp: number;
|
|
428
|
+
}
|
|
429
|
+
interface LiFiFeeCost {
|
|
430
|
+
readonly name: string;
|
|
431
|
+
readonly description: string;
|
|
432
|
+
readonly percentage: string;
|
|
433
|
+
readonly token: LiFiToken;
|
|
434
|
+
readonly amount: string;
|
|
435
|
+
readonly amountUSD: string;
|
|
436
|
+
readonly included: boolean;
|
|
437
|
+
}
|
|
438
|
+
interface LiFiMetadata {
|
|
439
|
+
readonly integrator: string;
|
|
440
|
+
readonly [key: string]: unknown;
|
|
441
|
+
}
|
|
442
|
+
type LiFiTransferStatus = 'NOT_FOUND' | 'INVALID' | 'PENDING' | 'DONE' | 'FAILED';
|
|
443
|
+
type LiFiTransferSubstatus = 'WAIT_SOURCE_CONFIRMATIONS' | 'WAIT_DESTINATION_TRANSACTION' | 'BRIDGE_NOT_AVAILABLE' | 'CHAIN_NOT_AVAILABLE' | 'REFUND_IN_PROGRESS' | 'UNKNOWN_ERROR' | 'COMPLETED' | 'PARTIAL' | 'REFUNDED';
|
|
444
|
+
type LiFiBridge = 'hop' | 'cbridge' | 'celercircle' | 'optimism' | 'polygon' | 'arbitrum' | 'avalanche' | 'across' | 'gnosis' | 'omni' | 'relay' | 'celerim' | 'symbiosis' | 'thorswap' | 'squid' | 'allbridge' | 'mayan' | 'debridge' | 'chainflip';
|
|
445
|
+
interface LiFiStatusRequestParams {
|
|
446
|
+
readonly txHash: string;
|
|
447
|
+
readonly bridge?: LiFiBridge;
|
|
448
|
+
readonly fromChain?: string;
|
|
449
|
+
readonly toChain?: string;
|
|
450
|
+
}
|
|
451
|
+
interface LiFiStatusResponse {
|
|
452
|
+
readonly transactionId: string;
|
|
453
|
+
readonly sending: LiFiTransaction;
|
|
454
|
+
readonly receiving?: LiFiTransaction;
|
|
455
|
+
readonly feeCosts: LiFiFeeCost[];
|
|
456
|
+
readonly lifiExplorerLink: string;
|
|
457
|
+
readonly fromAddress: string;
|
|
458
|
+
readonly toAddress: string;
|
|
459
|
+
readonly tool: string;
|
|
460
|
+
readonly status: LiFiTransferStatus;
|
|
461
|
+
readonly substatus?: LiFiTransferSubstatus;
|
|
462
|
+
readonly substatusMessage?: string;
|
|
463
|
+
readonly metadata: LiFiMetadata;
|
|
464
|
+
readonly bridgeExplorerLink?: string;
|
|
465
|
+
}
|
|
466
|
+
|
|
382
467
|
/**
|
|
383
468
|
* Chain Types
|
|
384
469
|
*
|
|
@@ -812,6 +897,7 @@ declare class NativeClient {
|
|
|
812
897
|
declare class CoreClient {
|
|
813
898
|
private config;
|
|
814
899
|
private arcApiService;
|
|
900
|
+
private lifiApiService;
|
|
815
901
|
constructor(config?: CoreConfig);
|
|
816
902
|
/**
|
|
817
903
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
@@ -870,9 +956,10 @@ declare class CoreClient {
|
|
|
870
956
|
*/
|
|
871
957
|
getClaimUnsignedTransaction(buildClaimTxParams: BuildClaimTransactionRequestParam): Promise<UnsignedTransaction>;
|
|
872
958
|
/**
|
|
873
|
-
* Get all transactions
|
|
959
|
+
* Get all transactions with pagination information
|
|
960
|
+
* @param transactionsRequestQueryParams - Parameters for the transactions API call
|
|
874
961
|
*/
|
|
875
|
-
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<
|
|
962
|
+
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<PaginatedTransactionsResponse>;
|
|
876
963
|
/**
|
|
877
964
|
* Get token mappings by token address
|
|
878
965
|
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
@@ -880,6 +967,16 @@ declare class CoreClient {
|
|
|
880
967
|
* @param tokenAddress
|
|
881
968
|
*/
|
|
882
969
|
getTokenMappings(tokenMappingQueryParams: TokenMappingQueryParams): Promise<TokenMappingResponse>;
|
|
970
|
+
/**
|
|
971
|
+
* Check the status of a LiFi cross-chain transfer
|
|
972
|
+
*
|
|
973
|
+
* @param lifiStatusRequestParams - Status request parameters
|
|
974
|
+
* @param lifiStatusRequestParams.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
975
|
+
* @param lifiStatusRequestParams.bridge - Optional: The bridging tool used for the transfer
|
|
976
|
+
* @param lifiStatusRequestParams.fromChain - Optional: The sending chain (chain id or chain key)
|
|
977
|
+
* @param lifiStatusRequestParams.toChain - Optional: The receiving chain (chain id or chain key)
|
|
978
|
+
*/
|
|
979
|
+
getLiFiTransferStatus(lifiStatusRequestParams: LiFiStatusRequestParams): Promise<LiFiStatusResponse>;
|
|
883
980
|
}
|
|
884
981
|
|
|
885
982
|
/**
|
|
@@ -933,4 +1030,4 @@ declare class AggLayerSDK {
|
|
|
933
1030
|
getNative(): NativeClient;
|
|
934
1031
|
}
|
|
935
1032
|
|
|
936
|
-
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 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 };
|
|
1033
|
+
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, 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
|
*
|
|
@@ -271,6 +271,7 @@ type RoutesResponse = readonly Route[];
|
|
|
271
271
|
*
|
|
272
272
|
* Defines the core request and response types for the transactions endpoint.
|
|
273
273
|
*/
|
|
274
|
+
|
|
274
275
|
interface Transaction {
|
|
275
276
|
id: string;
|
|
276
277
|
transactionHash: string;
|
|
@@ -316,14 +317,16 @@ interface Transaction {
|
|
|
316
317
|
}
|
|
317
318
|
interface TransactionsRequestQueryParams {
|
|
318
319
|
readonly address?: string;
|
|
319
|
-
readonly
|
|
320
|
+
readonly sourceNetworkIds?: string;
|
|
320
321
|
readonly destinationNetworkIds?: string;
|
|
321
322
|
readonly limit?: number;
|
|
322
323
|
readonly startAfter?: number;
|
|
323
324
|
}
|
|
324
|
-
type TransactionsResponse =
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
type TransactionsResponse = Transaction[];
|
|
326
|
+
interface PaginatedTransactionsResponse {
|
|
327
|
+
readonly transactions: TransactionsResponse;
|
|
328
|
+
readonly pagination?: CursorPagination;
|
|
329
|
+
}
|
|
327
330
|
|
|
328
331
|
/**
|
|
329
332
|
* Arc API Built Transaction Types
|
|
@@ -379,6 +382,88 @@ type TokenMetadataResponse = {
|
|
|
379
382
|
decimals: number;
|
|
380
383
|
};
|
|
381
384
|
|
|
385
|
+
/**
|
|
386
|
+
* LiFi API Status Types
|
|
387
|
+
*
|
|
388
|
+
* Defines the request and response types for the LiFi status endpoint.
|
|
389
|
+
*/
|
|
390
|
+
interface LiFiToken {
|
|
391
|
+
readonly address: string;
|
|
392
|
+
readonly chainId: number;
|
|
393
|
+
readonly symbol: string;
|
|
394
|
+
readonly decimals: number;
|
|
395
|
+
readonly name: string;
|
|
396
|
+
readonly coinKey: string;
|
|
397
|
+
readonly logoURI: string;
|
|
398
|
+
readonly priceUSD: string;
|
|
399
|
+
}
|
|
400
|
+
interface LiFiStep {
|
|
401
|
+
readonly tool: string;
|
|
402
|
+
readonly toolDetails: {
|
|
403
|
+
readonly key: string;
|
|
404
|
+
readonly name: string;
|
|
405
|
+
readonly logoURI: string;
|
|
406
|
+
};
|
|
407
|
+
readonly fromAmount: string;
|
|
408
|
+
readonly fromToken: LiFiToken;
|
|
409
|
+
readonly toToken: LiFiToken;
|
|
410
|
+
readonly toAmount: string;
|
|
411
|
+
readonly bridgedAmount: string;
|
|
412
|
+
}
|
|
413
|
+
interface LiFiTransaction {
|
|
414
|
+
readonly txHash: string;
|
|
415
|
+
readonly txLink: string;
|
|
416
|
+
readonly amount: string;
|
|
417
|
+
readonly token: LiFiToken;
|
|
418
|
+
readonly chainId: number;
|
|
419
|
+
readonly gasPrice: string;
|
|
420
|
+
readonly gasUsed: string;
|
|
421
|
+
readonly gasToken: LiFiToken;
|
|
422
|
+
readonly gasAmount: string;
|
|
423
|
+
readonly gasAmountUSD: string;
|
|
424
|
+
readonly amountUSD: string;
|
|
425
|
+
readonly value: string;
|
|
426
|
+
readonly includedSteps: LiFiStep[];
|
|
427
|
+
readonly timestamp: number;
|
|
428
|
+
}
|
|
429
|
+
interface LiFiFeeCost {
|
|
430
|
+
readonly name: string;
|
|
431
|
+
readonly description: string;
|
|
432
|
+
readonly percentage: string;
|
|
433
|
+
readonly token: LiFiToken;
|
|
434
|
+
readonly amount: string;
|
|
435
|
+
readonly amountUSD: string;
|
|
436
|
+
readonly included: boolean;
|
|
437
|
+
}
|
|
438
|
+
interface LiFiMetadata {
|
|
439
|
+
readonly integrator: string;
|
|
440
|
+
readonly [key: string]: unknown;
|
|
441
|
+
}
|
|
442
|
+
type LiFiTransferStatus = 'NOT_FOUND' | 'INVALID' | 'PENDING' | 'DONE' | 'FAILED';
|
|
443
|
+
type LiFiTransferSubstatus = 'WAIT_SOURCE_CONFIRMATIONS' | 'WAIT_DESTINATION_TRANSACTION' | 'BRIDGE_NOT_AVAILABLE' | 'CHAIN_NOT_AVAILABLE' | 'REFUND_IN_PROGRESS' | 'UNKNOWN_ERROR' | 'COMPLETED' | 'PARTIAL' | 'REFUNDED';
|
|
444
|
+
type LiFiBridge = 'hop' | 'cbridge' | 'celercircle' | 'optimism' | 'polygon' | 'arbitrum' | 'avalanche' | 'across' | 'gnosis' | 'omni' | 'relay' | 'celerim' | 'symbiosis' | 'thorswap' | 'squid' | 'allbridge' | 'mayan' | 'debridge' | 'chainflip';
|
|
445
|
+
interface LiFiStatusRequestParams {
|
|
446
|
+
readonly txHash: string;
|
|
447
|
+
readonly bridge?: LiFiBridge;
|
|
448
|
+
readonly fromChain?: string;
|
|
449
|
+
readonly toChain?: string;
|
|
450
|
+
}
|
|
451
|
+
interface LiFiStatusResponse {
|
|
452
|
+
readonly transactionId: string;
|
|
453
|
+
readonly sending: LiFiTransaction;
|
|
454
|
+
readonly receiving?: LiFiTransaction;
|
|
455
|
+
readonly feeCosts: LiFiFeeCost[];
|
|
456
|
+
readonly lifiExplorerLink: string;
|
|
457
|
+
readonly fromAddress: string;
|
|
458
|
+
readonly toAddress: string;
|
|
459
|
+
readonly tool: string;
|
|
460
|
+
readonly status: LiFiTransferStatus;
|
|
461
|
+
readonly substatus?: LiFiTransferSubstatus;
|
|
462
|
+
readonly substatusMessage?: string;
|
|
463
|
+
readonly metadata: LiFiMetadata;
|
|
464
|
+
readonly bridgeExplorerLink?: string;
|
|
465
|
+
}
|
|
466
|
+
|
|
382
467
|
/**
|
|
383
468
|
* Chain Types
|
|
384
469
|
*
|
|
@@ -812,6 +897,7 @@ declare class NativeClient {
|
|
|
812
897
|
declare class CoreClient {
|
|
813
898
|
private config;
|
|
814
899
|
private arcApiService;
|
|
900
|
+
private lifiApiService;
|
|
815
901
|
constructor(config?: CoreConfig);
|
|
816
902
|
/**
|
|
817
903
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
@@ -870,9 +956,10 @@ declare class CoreClient {
|
|
|
870
956
|
*/
|
|
871
957
|
getClaimUnsignedTransaction(buildClaimTxParams: BuildClaimTransactionRequestParam): Promise<UnsignedTransaction>;
|
|
872
958
|
/**
|
|
873
|
-
* Get all transactions
|
|
959
|
+
* Get all transactions with pagination information
|
|
960
|
+
* @param transactionsRequestQueryParams - Parameters for the transactions API call
|
|
874
961
|
*/
|
|
875
|
-
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<
|
|
962
|
+
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<PaginatedTransactionsResponse>;
|
|
876
963
|
/**
|
|
877
964
|
* Get token mappings by token address
|
|
878
965
|
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
@@ -880,6 +967,16 @@ declare class CoreClient {
|
|
|
880
967
|
* @param tokenAddress
|
|
881
968
|
*/
|
|
882
969
|
getTokenMappings(tokenMappingQueryParams: TokenMappingQueryParams): Promise<TokenMappingResponse>;
|
|
970
|
+
/**
|
|
971
|
+
* Check the status of a LiFi cross-chain transfer
|
|
972
|
+
*
|
|
973
|
+
* @param lifiStatusRequestParams - Status request parameters
|
|
974
|
+
* @param lifiStatusRequestParams.txHash - The transaction hash on the sending chain, destination chain or lifi step id
|
|
975
|
+
* @param lifiStatusRequestParams.bridge - Optional: The bridging tool used for the transfer
|
|
976
|
+
* @param lifiStatusRequestParams.fromChain - Optional: The sending chain (chain id or chain key)
|
|
977
|
+
* @param lifiStatusRequestParams.toChain - Optional: The receiving chain (chain id or chain key)
|
|
978
|
+
*/
|
|
979
|
+
getLiFiTransferStatus(lifiStatusRequestParams: LiFiStatusRequestParams): Promise<LiFiStatusResponse>;
|
|
883
980
|
}
|
|
884
981
|
|
|
885
982
|
/**
|
|
@@ -933,4 +1030,4 @@ declare class AggLayerSDK {
|
|
|
933
1030
|
getNative(): NativeClient;
|
|
934
1031
|
}
|
|
935
1032
|
|
|
936
|
-
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 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 };
|
|
1033
|
+
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, 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)
|
|
@@ -2008,7 +2047,8 @@ var CoreClient = class {
|
|
|
2008
2047
|
}
|
|
2009
2048
|
}
|
|
2010
2049
|
/**
|
|
2011
|
-
* Get all transactions
|
|
2050
|
+
* Get all transactions with pagination information
|
|
2051
|
+
* @param transactionsRequestQueryParams - Parameters for the transactions API call
|
|
2012
2052
|
*/
|
|
2013
2053
|
async getTransactions(transactionsRequestQueryParams) {
|
|
2014
2054
|
if (transactionsRequestQueryParams.limit && transactionsRequestQueryParams.limit > MAX_TRANSACTIONS_PER_PAGE) {
|
|
@@ -2022,7 +2062,12 @@ var CoreClient = class {
|
|
|
2022
2062
|
transactionsRequestQueryParams
|
|
2023
2063
|
);
|
|
2024
2064
|
if (response.data.status === "success") {
|
|
2025
|
-
return
|
|
2065
|
+
return {
|
|
2066
|
+
transactions: response.data.data,
|
|
2067
|
+
...response.data.pagination && {
|
|
2068
|
+
pagination: response.data.pagination
|
|
2069
|
+
}
|
|
2070
|
+
};
|
|
2026
2071
|
}
|
|
2027
2072
|
throw ApiError.fromErrorResponse(response.data);
|
|
2028
2073
|
} catch (error) {
|
|
@@ -2057,6 +2102,31 @@ var CoreClient = class {
|
|
|
2057
2102
|
);
|
|
2058
2103
|
}
|
|
2059
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
|
+
}
|
|
2060
2130
|
};
|
|
2061
2131
|
|
|
2062
2132
|
// src/index.ts
|