@agglayer/sdk 1.0.0-beta.19 → 1.0.0-beta.8
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 +199 -494
- package/dist/index.d.mts +26 -136
- package/dist/index.d.ts +26 -136
- package/dist/index.js +90 -317
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -316
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -19,7 +19,6 @@ type ApiResponse<T = unknown> = SuccessResponse<T> | ErrorResponse;
|
|
|
19
19
|
interface SuccessResponse<T = unknown> {
|
|
20
20
|
readonly status: 'success';
|
|
21
21
|
readonly data: T;
|
|
22
|
-
readonly pagination?: OffsetPagination | CursorPagination;
|
|
23
22
|
}
|
|
24
23
|
interface ErrorResponse {
|
|
25
24
|
readonly status: 'error';
|
|
@@ -28,16 +27,6 @@ interface ErrorResponse {
|
|
|
28
27
|
readonly code: number;
|
|
29
28
|
readonly details?: Record<string, unknown>;
|
|
30
29
|
}
|
|
31
|
-
interface Pagination {
|
|
32
|
-
readonly total?: number;
|
|
33
|
-
readonly limit?: number;
|
|
34
|
-
}
|
|
35
|
-
interface OffsetPagination extends Pagination {
|
|
36
|
-
readonly offset?: number;
|
|
37
|
-
}
|
|
38
|
-
interface CursorPagination extends Pagination {
|
|
39
|
-
readonly nextStartAfterCursor?: string;
|
|
40
|
-
}
|
|
41
30
|
|
|
42
31
|
/**
|
|
43
32
|
* Arc API Tokens Types
|
|
@@ -78,11 +67,6 @@ interface IChain {
|
|
|
78
67
|
name: string;
|
|
79
68
|
symbol: string;
|
|
80
69
|
decimals: number;
|
|
81
|
-
address: string;
|
|
82
|
-
logoURI: string;
|
|
83
|
-
priceUSD: string;
|
|
84
|
-
originTokenAddress?: string;
|
|
85
|
-
originChainId?: number;
|
|
86
70
|
};
|
|
87
71
|
networkId?: number;
|
|
88
72
|
bridgeAddress?: string;
|
|
@@ -94,27 +78,13 @@ type ChainsQueryParams = {
|
|
|
94
78
|
readonly withSupportedTokens?: boolean;
|
|
95
79
|
readonly chainIds?: readonly number[];
|
|
96
80
|
readonly limit?: number;
|
|
97
|
-
readonly
|
|
81
|
+
readonly startAfter?: number;
|
|
98
82
|
};
|
|
99
83
|
type ChainsResponse = {
|
|
100
84
|
readonly chains: IChain[];
|
|
85
|
+
readonly nextStartAfter?: number;
|
|
101
86
|
};
|
|
102
87
|
|
|
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
88
|
/**
|
|
119
89
|
* Arc API Routes Types
|
|
120
90
|
*
|
|
@@ -196,14 +166,22 @@ interface Step {
|
|
|
196
166
|
readonly includedSteps: Step[] | null;
|
|
197
167
|
readonly relatedSteps: string[] | null;
|
|
198
168
|
}
|
|
169
|
+
interface TransactionRequest {
|
|
170
|
+
readonly to: string;
|
|
171
|
+
readonly data: string;
|
|
172
|
+
readonly value: string;
|
|
173
|
+
readonly gasLimit: string;
|
|
174
|
+
readonly gasPrice?: string;
|
|
175
|
+
readonly chainId: number;
|
|
176
|
+
readonly from?: string;
|
|
177
|
+
}
|
|
199
178
|
interface ProviderMetadata {
|
|
200
179
|
readonly lifi?: {
|
|
201
180
|
readonly integrator: string | null;
|
|
202
181
|
readonly transactionRequest?: unknown;
|
|
203
182
|
};
|
|
204
183
|
readonly agglayer?: {
|
|
205
|
-
readonly bridgeAddress: string |
|
|
206
|
-
readonly claimTransactionRequired: boolean | undefined;
|
|
184
|
+
readonly bridgeAddress: string | null;
|
|
207
185
|
};
|
|
208
186
|
readonly [key: string]: unknown;
|
|
209
187
|
}
|
|
@@ -236,7 +214,7 @@ interface Route {
|
|
|
236
214
|
readonly feeCosts: FeeCost[];
|
|
237
215
|
readonly gasCosts: GasCost[];
|
|
238
216
|
readonly steps: Step[];
|
|
239
|
-
readonly transactionRequest?:
|
|
217
|
+
readonly transactionRequest?: TransactionRequest;
|
|
240
218
|
readonly providerMetadata: ProviderMetadata;
|
|
241
219
|
readonly riskFactors: RiskFactors | null;
|
|
242
220
|
readonly createdAt: number;
|
|
@@ -259,7 +237,7 @@ interface RoutesRequestParams {
|
|
|
259
237
|
readonly fromTokenAddress: string;
|
|
260
238
|
readonly toTokenAddress: string;
|
|
261
239
|
readonly amount: string;
|
|
262
|
-
readonly fromAddress
|
|
240
|
+
readonly fromAddress: string;
|
|
263
241
|
readonly toAddress?: string;
|
|
264
242
|
readonly slippage?: number;
|
|
265
243
|
readonly preferences?: RoutePreferences;
|
|
@@ -315,7 +293,7 @@ interface Transaction {
|
|
|
315
293
|
};
|
|
316
294
|
}
|
|
317
295
|
interface TransactionsRequestQueryParams {
|
|
318
|
-
readonly
|
|
296
|
+
readonly fromAddress?: string;
|
|
319
297
|
readonly sorceNetworkIds?: string;
|
|
320
298
|
readonly destinationNetworkIds?: string;
|
|
321
299
|
readonly limit?: number;
|
|
@@ -323,6 +301,7 @@ interface TransactionsRequestQueryParams {
|
|
|
323
301
|
}
|
|
324
302
|
type TransactionsResponse = {
|
|
325
303
|
transactions: Transaction[];
|
|
304
|
+
nextStartAfter?: number;
|
|
326
305
|
};
|
|
327
306
|
|
|
328
307
|
/**
|
|
@@ -332,34 +311,7 @@ type TransactionsResponse = {
|
|
|
332
311
|
*/
|
|
333
312
|
|
|
334
313
|
type BuildTransactionRequestBody = Step;
|
|
335
|
-
type BuildTransactionResponse =
|
|
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
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Arc API Token Mapping Types
|
|
351
|
-
*
|
|
352
|
-
* Defines the request and response types for the token mapping endpoint.
|
|
353
|
-
*/
|
|
354
|
-
type TokenMappingQueryParams = {
|
|
355
|
-
tokenAddress: string;
|
|
356
|
-
};
|
|
357
|
-
type TokenMappingResponse = Array<{
|
|
358
|
-
originTokenNetwork: number;
|
|
359
|
-
originTokenAddress: string;
|
|
360
|
-
wrappedTokenNetwork: number;
|
|
361
|
-
wrappedTokenAddress: string;
|
|
362
|
-
}>;
|
|
314
|
+
type BuildTransactionResponse = Route;
|
|
363
315
|
|
|
364
316
|
/**
|
|
365
317
|
* Chain Types
|
|
@@ -511,9 +463,9 @@ declare const SDK_MODES: {
|
|
|
511
463
|
type SDKMode = (typeof SDK_MODES)[keyof typeof SDK_MODES];
|
|
512
464
|
|
|
513
465
|
interface SDKConfig {
|
|
514
|
-
mode
|
|
515
|
-
core
|
|
516
|
-
native
|
|
466
|
+
mode: SDKMode[];
|
|
467
|
+
core: CoreConfig;
|
|
468
|
+
native: NativeConfig;
|
|
517
469
|
}
|
|
518
470
|
|
|
519
471
|
/**
|
|
@@ -794,33 +746,20 @@ declare class NativeClient {
|
|
|
794
746
|
declare class CoreClient {
|
|
795
747
|
private config;
|
|
796
748
|
private arcApiService;
|
|
797
|
-
constructor(config
|
|
798
|
-
/**
|
|
799
|
-
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
800
|
-
* Handles automatic pagination to fetch all available data
|
|
801
|
-
* @param params - Parameters for the chains API call
|
|
802
|
-
* @param pageSize - Number of items per page (defaults to DEFAULT_CHAINS_PER_PAGE)
|
|
803
|
-
*/
|
|
804
|
-
private getAllChainsPaginated;
|
|
749
|
+
constructor(config: CoreConfig);
|
|
805
750
|
/**
|
|
806
751
|
* Get all chains metadata from AggLayer API
|
|
807
|
-
* Handles pagination automatically to fetch all available chains
|
|
808
752
|
*/
|
|
809
753
|
getAllChains(): Promise<ChainsResponse>;
|
|
810
754
|
/**
|
|
811
755
|
* Get chain metadata by id from AggLayer API
|
|
812
|
-
* Handles pagination automatically to fetch all available chain metadata
|
|
813
756
|
* @param ids - the ids of the chains to get metadata for
|
|
814
757
|
*/
|
|
815
758
|
getChainMetadataByChainIds(ids: number[]): Promise<ChainsResponse>;
|
|
816
759
|
/**
|
|
817
760
|
* Get all tokens from AggLayer API
|
|
818
|
-
*
|
|
819
|
-
* Developer Note: This method is not recommended to use frequently or from frontend.
|
|
820
|
-
* As it can be very slow and resource intensive.
|
|
821
|
-
* It is recommended to use getChainDataAndTokensByChainIds instead.
|
|
822
761
|
*/
|
|
823
|
-
|
|
762
|
+
getTokens(): Promise<ChainsResponse>;
|
|
824
763
|
/**
|
|
825
764
|
* Get chain data and tokens by AggLayer API
|
|
826
765
|
* @param ids - the ids of the chains to get data and tokens for
|
|
@@ -831,62 +770,13 @@ declare class CoreClient {
|
|
|
831
770
|
*/
|
|
832
771
|
getRoutes(routesRequestParams: RoutesRequestParams): Promise<RoutesResponse>;
|
|
833
772
|
/**
|
|
834
|
-
*
|
|
835
|
-
* If route has transactionRequest field, return it directly as calldata
|
|
836
|
-
* Otherwise, call buildTransaction on route.steps[0] and return that as calldata
|
|
837
|
-
*/
|
|
838
|
-
getUnsignedTransaction(route: Route): Promise<UnsignedTransaction>;
|
|
839
|
-
/**
|
|
840
|
-
* Get calldata for claim step
|
|
841
|
-
* Needs to be called separately as claim step is not part of route.
|
|
842
|
-
*
|
|
843
|
-
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
844
|
-
*
|
|
845
|
-
* @param sourceNetworkId - The source network ID where the transfer was initiated.
|
|
846
|
-
* @param depositCount - The deposit count associated with the transfer.
|
|
773
|
+
* Build transaction from a step object
|
|
847
774
|
*/
|
|
848
|
-
|
|
775
|
+
buildTransaction(builtTransactionRequestBody: BuildTransactionRequestBody): Promise<BuildTransactionResponse>;
|
|
849
776
|
/**
|
|
850
777
|
* Get all transactions via web sockets
|
|
851
778
|
*/
|
|
852
779
|
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<TransactionsResponse>;
|
|
853
|
-
/**
|
|
854
|
-
* Get token mappings by token address
|
|
855
|
-
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
856
|
-
*
|
|
857
|
-
* @param tokenAddress
|
|
858
|
-
*/
|
|
859
|
-
getTokenMappings(tokenMappingQueryParams: TokenMappingQueryParams): Promise<TokenMappingResponse>;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* API Error Class
|
|
864
|
-
*
|
|
865
|
-
* Custom error class to preserve API error details
|
|
866
|
-
*/
|
|
867
|
-
|
|
868
|
-
declare class ApiError extends Error {
|
|
869
|
-
readonly code: number;
|
|
870
|
-
readonly name: string;
|
|
871
|
-
readonly details?: Record<string, unknown> | undefined;
|
|
872
|
-
constructor(errorResponse: ErrorResponse);
|
|
873
|
-
/**
|
|
874
|
-
* Create API error from error response
|
|
875
|
-
*/
|
|
876
|
-
static fromErrorResponse(errorResponse: ErrorResponse): ApiError;
|
|
877
|
-
/**
|
|
878
|
-
* Create fallback error when API completely fails
|
|
879
|
-
*/
|
|
880
|
-
static createFallbackError(originalError: Error, operation: string): ApiError;
|
|
881
|
-
/**
|
|
882
|
-
* Convert to plain object for serialization
|
|
883
|
-
*/
|
|
884
|
-
toJSON(): {
|
|
885
|
-
name: string;
|
|
886
|
-
message: string;
|
|
887
|
-
code: number;
|
|
888
|
-
details: Record<string, unknown> | undefined;
|
|
889
|
-
};
|
|
890
780
|
}
|
|
891
781
|
|
|
892
782
|
/**
|
|
@@ -899,7 +789,7 @@ declare class AggLayerSDK {
|
|
|
899
789
|
private config;
|
|
900
790
|
private core?;
|
|
901
791
|
private native?;
|
|
902
|
-
constructor(config
|
|
792
|
+
constructor(config: SDKConfig);
|
|
903
793
|
/**
|
|
904
794
|
* Get core submodule
|
|
905
795
|
*/
|
|
@@ -910,4 +800,4 @@ declare class AggLayerSDK {
|
|
|
910
800
|
getNative(): NativeClient;
|
|
911
801
|
}
|
|
912
802
|
|
|
913
|
-
export { AggLayerSDK,
|
|
803
|
+
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 CustomChainConfig, type ERC20Config, type ErrorResponse, type FeeCost, type GasCost, type IChain, type IsClaimedParams, type NativeConfig, type OriginTokenInfoParams, 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 TransactionRequest, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ type ApiResponse<T = unknown> = SuccessResponse<T> | ErrorResponse;
|
|
|
19
19
|
interface SuccessResponse<T = unknown> {
|
|
20
20
|
readonly status: 'success';
|
|
21
21
|
readonly data: T;
|
|
22
|
-
readonly pagination?: OffsetPagination | CursorPagination;
|
|
23
22
|
}
|
|
24
23
|
interface ErrorResponse {
|
|
25
24
|
readonly status: 'error';
|
|
@@ -28,16 +27,6 @@ interface ErrorResponse {
|
|
|
28
27
|
readonly code: number;
|
|
29
28
|
readonly details?: Record<string, unknown>;
|
|
30
29
|
}
|
|
31
|
-
interface Pagination {
|
|
32
|
-
readonly total?: number;
|
|
33
|
-
readonly limit?: number;
|
|
34
|
-
}
|
|
35
|
-
interface OffsetPagination extends Pagination {
|
|
36
|
-
readonly offset?: number;
|
|
37
|
-
}
|
|
38
|
-
interface CursorPagination extends Pagination {
|
|
39
|
-
readonly nextStartAfterCursor?: string;
|
|
40
|
-
}
|
|
41
30
|
|
|
42
31
|
/**
|
|
43
32
|
* Arc API Tokens Types
|
|
@@ -78,11 +67,6 @@ interface IChain {
|
|
|
78
67
|
name: string;
|
|
79
68
|
symbol: string;
|
|
80
69
|
decimals: number;
|
|
81
|
-
address: string;
|
|
82
|
-
logoURI: string;
|
|
83
|
-
priceUSD: string;
|
|
84
|
-
originTokenAddress?: string;
|
|
85
|
-
originChainId?: number;
|
|
86
70
|
};
|
|
87
71
|
networkId?: number;
|
|
88
72
|
bridgeAddress?: string;
|
|
@@ -94,27 +78,13 @@ type ChainsQueryParams = {
|
|
|
94
78
|
readonly withSupportedTokens?: boolean;
|
|
95
79
|
readonly chainIds?: readonly number[];
|
|
96
80
|
readonly limit?: number;
|
|
97
|
-
readonly
|
|
81
|
+
readonly startAfter?: number;
|
|
98
82
|
};
|
|
99
83
|
type ChainsResponse = {
|
|
100
84
|
readonly chains: IChain[];
|
|
85
|
+
readonly nextStartAfter?: number;
|
|
101
86
|
};
|
|
102
87
|
|
|
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
88
|
/**
|
|
119
89
|
* Arc API Routes Types
|
|
120
90
|
*
|
|
@@ -196,14 +166,22 @@ interface Step {
|
|
|
196
166
|
readonly includedSteps: Step[] | null;
|
|
197
167
|
readonly relatedSteps: string[] | null;
|
|
198
168
|
}
|
|
169
|
+
interface TransactionRequest {
|
|
170
|
+
readonly to: string;
|
|
171
|
+
readonly data: string;
|
|
172
|
+
readonly value: string;
|
|
173
|
+
readonly gasLimit: string;
|
|
174
|
+
readonly gasPrice?: string;
|
|
175
|
+
readonly chainId: number;
|
|
176
|
+
readonly from?: string;
|
|
177
|
+
}
|
|
199
178
|
interface ProviderMetadata {
|
|
200
179
|
readonly lifi?: {
|
|
201
180
|
readonly integrator: string | null;
|
|
202
181
|
readonly transactionRequest?: unknown;
|
|
203
182
|
};
|
|
204
183
|
readonly agglayer?: {
|
|
205
|
-
readonly bridgeAddress: string |
|
|
206
|
-
readonly claimTransactionRequired: boolean | undefined;
|
|
184
|
+
readonly bridgeAddress: string | null;
|
|
207
185
|
};
|
|
208
186
|
readonly [key: string]: unknown;
|
|
209
187
|
}
|
|
@@ -236,7 +214,7 @@ interface Route {
|
|
|
236
214
|
readonly feeCosts: FeeCost[];
|
|
237
215
|
readonly gasCosts: GasCost[];
|
|
238
216
|
readonly steps: Step[];
|
|
239
|
-
readonly transactionRequest?:
|
|
217
|
+
readonly transactionRequest?: TransactionRequest;
|
|
240
218
|
readonly providerMetadata: ProviderMetadata;
|
|
241
219
|
readonly riskFactors: RiskFactors | null;
|
|
242
220
|
readonly createdAt: number;
|
|
@@ -259,7 +237,7 @@ interface RoutesRequestParams {
|
|
|
259
237
|
readonly fromTokenAddress: string;
|
|
260
238
|
readonly toTokenAddress: string;
|
|
261
239
|
readonly amount: string;
|
|
262
|
-
readonly fromAddress
|
|
240
|
+
readonly fromAddress: string;
|
|
263
241
|
readonly toAddress?: string;
|
|
264
242
|
readonly slippage?: number;
|
|
265
243
|
readonly preferences?: RoutePreferences;
|
|
@@ -315,7 +293,7 @@ interface Transaction {
|
|
|
315
293
|
};
|
|
316
294
|
}
|
|
317
295
|
interface TransactionsRequestQueryParams {
|
|
318
|
-
readonly
|
|
296
|
+
readonly fromAddress?: string;
|
|
319
297
|
readonly sorceNetworkIds?: string;
|
|
320
298
|
readonly destinationNetworkIds?: string;
|
|
321
299
|
readonly limit?: number;
|
|
@@ -323,6 +301,7 @@ interface TransactionsRequestQueryParams {
|
|
|
323
301
|
}
|
|
324
302
|
type TransactionsResponse = {
|
|
325
303
|
transactions: Transaction[];
|
|
304
|
+
nextStartAfter?: number;
|
|
326
305
|
};
|
|
327
306
|
|
|
328
307
|
/**
|
|
@@ -332,34 +311,7 @@ type TransactionsResponse = {
|
|
|
332
311
|
*/
|
|
333
312
|
|
|
334
313
|
type BuildTransactionRequestBody = Step;
|
|
335
|
-
type BuildTransactionResponse =
|
|
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
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Arc API Token Mapping Types
|
|
351
|
-
*
|
|
352
|
-
* Defines the request and response types for the token mapping endpoint.
|
|
353
|
-
*/
|
|
354
|
-
type TokenMappingQueryParams = {
|
|
355
|
-
tokenAddress: string;
|
|
356
|
-
};
|
|
357
|
-
type TokenMappingResponse = Array<{
|
|
358
|
-
originTokenNetwork: number;
|
|
359
|
-
originTokenAddress: string;
|
|
360
|
-
wrappedTokenNetwork: number;
|
|
361
|
-
wrappedTokenAddress: string;
|
|
362
|
-
}>;
|
|
314
|
+
type BuildTransactionResponse = Route;
|
|
363
315
|
|
|
364
316
|
/**
|
|
365
317
|
* Chain Types
|
|
@@ -511,9 +463,9 @@ declare const SDK_MODES: {
|
|
|
511
463
|
type SDKMode = (typeof SDK_MODES)[keyof typeof SDK_MODES];
|
|
512
464
|
|
|
513
465
|
interface SDKConfig {
|
|
514
|
-
mode
|
|
515
|
-
core
|
|
516
|
-
native
|
|
466
|
+
mode: SDKMode[];
|
|
467
|
+
core: CoreConfig;
|
|
468
|
+
native: NativeConfig;
|
|
517
469
|
}
|
|
518
470
|
|
|
519
471
|
/**
|
|
@@ -794,33 +746,20 @@ declare class NativeClient {
|
|
|
794
746
|
declare class CoreClient {
|
|
795
747
|
private config;
|
|
796
748
|
private arcApiService;
|
|
797
|
-
constructor(config
|
|
798
|
-
/**
|
|
799
|
-
* Generic pagination helper for chains API calls (limit and offset based pagination)
|
|
800
|
-
* Handles automatic pagination to fetch all available data
|
|
801
|
-
* @param params - Parameters for the chains API call
|
|
802
|
-
* @param pageSize - Number of items per page (defaults to DEFAULT_CHAINS_PER_PAGE)
|
|
803
|
-
*/
|
|
804
|
-
private getAllChainsPaginated;
|
|
749
|
+
constructor(config: CoreConfig);
|
|
805
750
|
/**
|
|
806
751
|
* Get all chains metadata from AggLayer API
|
|
807
|
-
* Handles pagination automatically to fetch all available chains
|
|
808
752
|
*/
|
|
809
753
|
getAllChains(): Promise<ChainsResponse>;
|
|
810
754
|
/**
|
|
811
755
|
* Get chain metadata by id from AggLayer API
|
|
812
|
-
* Handles pagination automatically to fetch all available chain metadata
|
|
813
756
|
* @param ids - the ids of the chains to get metadata for
|
|
814
757
|
*/
|
|
815
758
|
getChainMetadataByChainIds(ids: number[]): Promise<ChainsResponse>;
|
|
816
759
|
/**
|
|
817
760
|
* Get all tokens from AggLayer API
|
|
818
|
-
*
|
|
819
|
-
* Developer Note: This method is not recommended to use frequently or from frontend.
|
|
820
|
-
* As it can be very slow and resource intensive.
|
|
821
|
-
* It is recommended to use getChainDataAndTokensByChainIds instead.
|
|
822
761
|
*/
|
|
823
|
-
|
|
762
|
+
getTokens(): Promise<ChainsResponse>;
|
|
824
763
|
/**
|
|
825
764
|
* Get chain data and tokens by AggLayer API
|
|
826
765
|
* @param ids - the ids of the chains to get data and tokens for
|
|
@@ -831,62 +770,13 @@ declare class CoreClient {
|
|
|
831
770
|
*/
|
|
832
771
|
getRoutes(routesRequestParams: RoutesRequestParams): Promise<RoutesResponse>;
|
|
833
772
|
/**
|
|
834
|
-
*
|
|
835
|
-
* If route has transactionRequest field, return it directly as calldata
|
|
836
|
-
* Otherwise, call buildTransaction on route.steps[0] and return that as calldata
|
|
837
|
-
*/
|
|
838
|
-
getUnsignedTransaction(route: Route): Promise<UnsignedTransaction>;
|
|
839
|
-
/**
|
|
840
|
-
* Get calldata for claim step
|
|
841
|
-
* Needs to be called separately as claim step is not part of route.
|
|
842
|
-
*
|
|
843
|
-
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
844
|
-
*
|
|
845
|
-
* @param sourceNetworkId - The source network ID where the transfer was initiated.
|
|
846
|
-
* @param depositCount - The deposit count associated with the transfer.
|
|
773
|
+
* Build transaction from a step object
|
|
847
774
|
*/
|
|
848
|
-
|
|
775
|
+
buildTransaction(builtTransactionRequestBody: BuildTransactionRequestBody): Promise<BuildTransactionResponse>;
|
|
849
776
|
/**
|
|
850
777
|
* Get all transactions via web sockets
|
|
851
778
|
*/
|
|
852
779
|
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<TransactionsResponse>;
|
|
853
|
-
/**
|
|
854
|
-
* Get token mappings by token address
|
|
855
|
-
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
856
|
-
*
|
|
857
|
-
* @param tokenAddress
|
|
858
|
-
*/
|
|
859
|
-
getTokenMappings(tokenMappingQueryParams: TokenMappingQueryParams): Promise<TokenMappingResponse>;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* API Error Class
|
|
864
|
-
*
|
|
865
|
-
* Custom error class to preserve API error details
|
|
866
|
-
*/
|
|
867
|
-
|
|
868
|
-
declare class ApiError extends Error {
|
|
869
|
-
readonly code: number;
|
|
870
|
-
readonly name: string;
|
|
871
|
-
readonly details?: Record<string, unknown> | undefined;
|
|
872
|
-
constructor(errorResponse: ErrorResponse);
|
|
873
|
-
/**
|
|
874
|
-
* Create API error from error response
|
|
875
|
-
*/
|
|
876
|
-
static fromErrorResponse(errorResponse: ErrorResponse): ApiError;
|
|
877
|
-
/**
|
|
878
|
-
* Create fallback error when API completely fails
|
|
879
|
-
*/
|
|
880
|
-
static createFallbackError(originalError: Error, operation: string): ApiError;
|
|
881
|
-
/**
|
|
882
|
-
* Convert to plain object for serialization
|
|
883
|
-
*/
|
|
884
|
-
toJSON(): {
|
|
885
|
-
name: string;
|
|
886
|
-
message: string;
|
|
887
|
-
code: number;
|
|
888
|
-
details: Record<string, unknown> | undefined;
|
|
889
|
-
};
|
|
890
780
|
}
|
|
891
781
|
|
|
892
782
|
/**
|
|
@@ -899,7 +789,7 @@ declare class AggLayerSDK {
|
|
|
899
789
|
private config;
|
|
900
790
|
private core?;
|
|
901
791
|
private native?;
|
|
902
|
-
constructor(config
|
|
792
|
+
constructor(config: SDKConfig);
|
|
903
793
|
/**
|
|
904
794
|
* Get core submodule
|
|
905
795
|
*/
|
|
@@ -910,4 +800,4 @@ declare class AggLayerSDK {
|
|
|
910
800
|
getNative(): NativeClient;
|
|
911
801
|
}
|
|
912
802
|
|
|
913
|
-
export { AggLayerSDK,
|
|
803
|
+
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 CustomChainConfig, type ERC20Config, type ErrorResponse, type FeeCost, type GasCost, type IChain, type IsClaimedParams, type NativeConfig, type OriginTokenInfoParams, 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 TransactionRequest, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|