@agglayer/sdk 1.0.0-beta.16 → 1.0.0-beta.18
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/README.md +494 -199
- package/dist/index.d.mts +67 -9
- package/dist/index.d.ts +67 -9
- package/dist/index.js +236 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -105
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -78,6 +78,11 @@ interface IChain {
|
|
|
78
78
|
name: string;
|
|
79
79
|
symbol: string;
|
|
80
80
|
decimals: number;
|
|
81
|
+
address: string;
|
|
82
|
+
logoURI: string;
|
|
83
|
+
priceUSD: string;
|
|
84
|
+
originTokenAddress?: string;
|
|
85
|
+
originChainId?: number;
|
|
81
86
|
};
|
|
82
87
|
networkId?: number;
|
|
83
88
|
bridgeAddress?: string;
|
|
@@ -197,7 +202,8 @@ interface ProviderMetadata {
|
|
|
197
202
|
readonly transactionRequest?: unknown;
|
|
198
203
|
};
|
|
199
204
|
readonly agglayer?: {
|
|
200
|
-
readonly bridgeAddress: string |
|
|
205
|
+
readonly bridgeAddress: string | undefined;
|
|
206
|
+
readonly claimTransactionRequired: boolean | undefined;
|
|
201
207
|
};
|
|
202
208
|
readonly [key: string]: unknown;
|
|
203
209
|
}
|
|
@@ -230,7 +236,7 @@ interface Route {
|
|
|
230
236
|
readonly feeCosts: FeeCost[];
|
|
231
237
|
readonly gasCosts: GasCost[];
|
|
232
238
|
readonly steps: Step[];
|
|
233
|
-
readonly transactionRequest?: UnsignedTransaction;
|
|
239
|
+
readonly transactionRequest?: UnsignedTransaction | undefined;
|
|
234
240
|
readonly providerMetadata: ProviderMetadata;
|
|
235
241
|
readonly riskFactors: RiskFactors | null;
|
|
236
242
|
readonly createdAt: number;
|
|
@@ -253,7 +259,7 @@ interface RoutesRequestParams {
|
|
|
253
259
|
readonly fromTokenAddress: string;
|
|
254
260
|
readonly toTokenAddress: string;
|
|
255
261
|
readonly amount: string;
|
|
256
|
-
readonly fromAddress
|
|
262
|
+
readonly fromAddress?: string;
|
|
257
263
|
readonly toAddress?: string;
|
|
258
264
|
readonly slippage?: number;
|
|
259
265
|
readonly preferences?: RoutePreferences;
|
|
@@ -328,6 +334,18 @@ type TransactionsResponse = {
|
|
|
328
334
|
type BuildTransactionRequestBody = Step;
|
|
329
335
|
type BuildTransactionResponse = UnsignedTransaction;
|
|
330
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Arc API Build Claim Transaction Types
|
|
339
|
+
*
|
|
340
|
+
* Defines the core request and response types for the build claim transaction endpoint.
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
type BuildClaimTransactionRequestParam = {
|
|
344
|
+
sourceNetworkId: number;
|
|
345
|
+
depositCount: number;
|
|
346
|
+
};
|
|
347
|
+
type BuildClaimTransactionResponse = UnsignedTransaction;
|
|
348
|
+
|
|
331
349
|
/**
|
|
332
350
|
* Chain Types
|
|
333
351
|
*
|
|
@@ -478,9 +496,9 @@ declare const SDK_MODES: {
|
|
|
478
496
|
type SDKMode = (typeof SDK_MODES)[keyof typeof SDK_MODES];
|
|
479
497
|
|
|
480
498
|
interface SDKConfig {
|
|
481
|
-
mode
|
|
482
|
-
core
|
|
483
|
-
native
|
|
499
|
+
mode?: SDKMode[];
|
|
500
|
+
core?: CoreConfig;
|
|
501
|
+
native?: NativeConfig;
|
|
484
502
|
}
|
|
485
503
|
|
|
486
504
|
/**
|
|
@@ -761,7 +779,7 @@ declare class NativeClient {
|
|
|
761
779
|
declare class CoreClient {
|
|
762
780
|
private config;
|
|
763
781
|
private arcApiService;
|
|
764
|
-
constructor(config
|
|
782
|
+
constructor(config?: CoreConfig);
|
|
765
783
|
/**
|
|
766
784
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
767
785
|
* Handles automatic pagination to fetch all available data
|
|
@@ -803,12 +821,52 @@ declare class CoreClient {
|
|
|
803
821
|
* Otherwise, call buildTransaction on route.steps[0] and return that as calldata
|
|
804
822
|
*/
|
|
805
823
|
getUnsignedTransaction(route: Route): Promise<UnsignedTransaction>;
|
|
824
|
+
/**
|
|
825
|
+
* Get calldata for claim step
|
|
826
|
+
* Needs to be called separately as claim step is not part of route.
|
|
827
|
+
*
|
|
828
|
+
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
829
|
+
*
|
|
830
|
+
* @param sourceNetworkId - The source network ID where the transfer was initiated.
|
|
831
|
+
* @param depositCount - The deposit count associated with the transfer.
|
|
832
|
+
*/
|
|
833
|
+
getClaimUnsignedTransaction(buildClaimTxParams: BuildClaimTransactionRequestParam): Promise<UnsignedTransaction>;
|
|
806
834
|
/**
|
|
807
835
|
* Get all transactions via web sockets
|
|
808
836
|
*/
|
|
809
837
|
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<TransactionsResponse>;
|
|
810
838
|
}
|
|
811
839
|
|
|
840
|
+
/**
|
|
841
|
+
* API Error Class
|
|
842
|
+
*
|
|
843
|
+
* Custom error class to preserve API error details
|
|
844
|
+
*/
|
|
845
|
+
|
|
846
|
+
declare class ApiError extends Error {
|
|
847
|
+
readonly code: number;
|
|
848
|
+
readonly name: string;
|
|
849
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
850
|
+
constructor(errorResponse: ErrorResponse);
|
|
851
|
+
/**
|
|
852
|
+
* Create API error from error response
|
|
853
|
+
*/
|
|
854
|
+
static fromErrorResponse(errorResponse: ErrorResponse): ApiError;
|
|
855
|
+
/**
|
|
856
|
+
* Create fallback error when API completely fails
|
|
857
|
+
*/
|
|
858
|
+
static createFallbackError(originalError: Error, operation: string): ApiError;
|
|
859
|
+
/**
|
|
860
|
+
* Convert to plain object for serialization
|
|
861
|
+
*/
|
|
862
|
+
toJSON(): {
|
|
863
|
+
name: string;
|
|
864
|
+
message: string;
|
|
865
|
+
code: number;
|
|
866
|
+
details: Record<string, unknown> | undefined;
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
|
|
812
870
|
/**
|
|
813
871
|
* AggLayer SDK - Main SDK
|
|
814
872
|
*
|
|
@@ -819,7 +877,7 @@ declare class AggLayerSDK {
|
|
|
819
877
|
private config;
|
|
820
878
|
private core?;
|
|
821
879
|
private native?;
|
|
822
|
-
constructor(config
|
|
880
|
+
constructor(config?: SDKConfig);
|
|
823
881
|
/**
|
|
824
882
|
* Get core submodule
|
|
825
883
|
*/
|
|
@@ -830,4 +888,4 @@ declare class AggLayerSDK {
|
|
|
830
888
|
getNative(): NativeClient;
|
|
831
889
|
}
|
|
832
890
|
|
|
833
|
-
export { AggLayerSDK, type ApiResponse, type BaseContractConfig, type BridgeAssetParams, type BridgeConfig, type BridgeMessageParams, type BridgeOptions, 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 TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
|
891
|
+
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 TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,11 @@ interface IChain {
|
|
|
78
78
|
name: string;
|
|
79
79
|
symbol: string;
|
|
80
80
|
decimals: number;
|
|
81
|
+
address: string;
|
|
82
|
+
logoURI: string;
|
|
83
|
+
priceUSD: string;
|
|
84
|
+
originTokenAddress?: string;
|
|
85
|
+
originChainId?: number;
|
|
81
86
|
};
|
|
82
87
|
networkId?: number;
|
|
83
88
|
bridgeAddress?: string;
|
|
@@ -197,7 +202,8 @@ interface ProviderMetadata {
|
|
|
197
202
|
readonly transactionRequest?: unknown;
|
|
198
203
|
};
|
|
199
204
|
readonly agglayer?: {
|
|
200
|
-
readonly bridgeAddress: string |
|
|
205
|
+
readonly bridgeAddress: string | undefined;
|
|
206
|
+
readonly claimTransactionRequired: boolean | undefined;
|
|
201
207
|
};
|
|
202
208
|
readonly [key: string]: unknown;
|
|
203
209
|
}
|
|
@@ -230,7 +236,7 @@ interface Route {
|
|
|
230
236
|
readonly feeCosts: FeeCost[];
|
|
231
237
|
readonly gasCosts: GasCost[];
|
|
232
238
|
readonly steps: Step[];
|
|
233
|
-
readonly transactionRequest?: UnsignedTransaction;
|
|
239
|
+
readonly transactionRequest?: UnsignedTransaction | undefined;
|
|
234
240
|
readonly providerMetadata: ProviderMetadata;
|
|
235
241
|
readonly riskFactors: RiskFactors | null;
|
|
236
242
|
readonly createdAt: number;
|
|
@@ -253,7 +259,7 @@ interface RoutesRequestParams {
|
|
|
253
259
|
readonly fromTokenAddress: string;
|
|
254
260
|
readonly toTokenAddress: string;
|
|
255
261
|
readonly amount: string;
|
|
256
|
-
readonly fromAddress
|
|
262
|
+
readonly fromAddress?: string;
|
|
257
263
|
readonly toAddress?: string;
|
|
258
264
|
readonly slippage?: number;
|
|
259
265
|
readonly preferences?: RoutePreferences;
|
|
@@ -328,6 +334,18 @@ type TransactionsResponse = {
|
|
|
328
334
|
type BuildTransactionRequestBody = Step;
|
|
329
335
|
type BuildTransactionResponse = UnsignedTransaction;
|
|
330
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Arc API Build Claim Transaction Types
|
|
339
|
+
*
|
|
340
|
+
* Defines the core request and response types for the build claim transaction endpoint.
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
type BuildClaimTransactionRequestParam = {
|
|
344
|
+
sourceNetworkId: number;
|
|
345
|
+
depositCount: number;
|
|
346
|
+
};
|
|
347
|
+
type BuildClaimTransactionResponse = UnsignedTransaction;
|
|
348
|
+
|
|
331
349
|
/**
|
|
332
350
|
* Chain Types
|
|
333
351
|
*
|
|
@@ -478,9 +496,9 @@ declare const SDK_MODES: {
|
|
|
478
496
|
type SDKMode = (typeof SDK_MODES)[keyof typeof SDK_MODES];
|
|
479
497
|
|
|
480
498
|
interface SDKConfig {
|
|
481
|
-
mode
|
|
482
|
-
core
|
|
483
|
-
native
|
|
499
|
+
mode?: SDKMode[];
|
|
500
|
+
core?: CoreConfig;
|
|
501
|
+
native?: NativeConfig;
|
|
484
502
|
}
|
|
485
503
|
|
|
486
504
|
/**
|
|
@@ -761,7 +779,7 @@ declare class NativeClient {
|
|
|
761
779
|
declare class CoreClient {
|
|
762
780
|
private config;
|
|
763
781
|
private arcApiService;
|
|
764
|
-
constructor(config
|
|
782
|
+
constructor(config?: CoreConfig);
|
|
765
783
|
/**
|
|
766
784
|
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
767
785
|
* Handles automatic pagination to fetch all available data
|
|
@@ -803,12 +821,52 @@ declare class CoreClient {
|
|
|
803
821
|
* Otherwise, call buildTransaction on route.steps[0] and return that as calldata
|
|
804
822
|
*/
|
|
805
823
|
getUnsignedTransaction(route: Route): Promise<UnsignedTransaction>;
|
|
824
|
+
/**
|
|
825
|
+
* Get calldata for claim step
|
|
826
|
+
* Needs to be called separately as claim step is not part of route.
|
|
827
|
+
*
|
|
828
|
+
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
829
|
+
*
|
|
830
|
+
* @param sourceNetworkId - The source network ID where the transfer was initiated.
|
|
831
|
+
* @param depositCount - The deposit count associated with the transfer.
|
|
832
|
+
*/
|
|
833
|
+
getClaimUnsignedTransaction(buildClaimTxParams: BuildClaimTransactionRequestParam): Promise<UnsignedTransaction>;
|
|
806
834
|
/**
|
|
807
835
|
* Get all transactions via web sockets
|
|
808
836
|
*/
|
|
809
837
|
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<TransactionsResponse>;
|
|
810
838
|
}
|
|
811
839
|
|
|
840
|
+
/**
|
|
841
|
+
* API Error Class
|
|
842
|
+
*
|
|
843
|
+
* Custom error class to preserve API error details
|
|
844
|
+
*/
|
|
845
|
+
|
|
846
|
+
declare class ApiError extends Error {
|
|
847
|
+
readonly code: number;
|
|
848
|
+
readonly name: string;
|
|
849
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
850
|
+
constructor(errorResponse: ErrorResponse);
|
|
851
|
+
/**
|
|
852
|
+
* Create API error from error response
|
|
853
|
+
*/
|
|
854
|
+
static fromErrorResponse(errorResponse: ErrorResponse): ApiError;
|
|
855
|
+
/**
|
|
856
|
+
* Create fallback error when API completely fails
|
|
857
|
+
*/
|
|
858
|
+
static createFallbackError(originalError: Error, operation: string): ApiError;
|
|
859
|
+
/**
|
|
860
|
+
* Convert to plain object for serialization
|
|
861
|
+
*/
|
|
862
|
+
toJSON(): {
|
|
863
|
+
name: string;
|
|
864
|
+
message: string;
|
|
865
|
+
code: number;
|
|
866
|
+
details: Record<string, unknown> | undefined;
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
|
|
812
870
|
/**
|
|
813
871
|
* AggLayer SDK - Main SDK
|
|
814
872
|
*
|
|
@@ -819,7 +877,7 @@ declare class AggLayerSDK {
|
|
|
819
877
|
private config;
|
|
820
878
|
private core?;
|
|
821
879
|
private native?;
|
|
822
|
-
constructor(config
|
|
880
|
+
constructor(config?: SDKConfig);
|
|
823
881
|
/**
|
|
824
882
|
* Get core submodule
|
|
825
883
|
*/
|
|
@@ -830,4 +888,4 @@ declare class AggLayerSDK {
|
|
|
830
888
|
getNative(): NativeClient;
|
|
831
889
|
}
|
|
832
890
|
|
|
833
|
-
export { AggLayerSDK, type ApiResponse, type BaseContractConfig, type BridgeAssetParams, type BridgeConfig, type BridgeMessageParams, type BridgeOptions, 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 TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
|
891
|
+
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 TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|