@agglayer/sdk 1.0.0-beta.22 → 1.0.0-beta.24
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 +33 -6
- package/dist/index.d.ts +33 -6
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -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;
|
|
@@ -321,9 +322,11 @@ interface TransactionsRequestQueryParams {
|
|
|
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
|
|
@@ -361,6 +364,24 @@ type TokenMappingResponse = Array<{
|
|
|
361
364
|
wrappedTokenAddress: string;
|
|
362
365
|
}>;
|
|
363
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Arc API Token Metadata Types
|
|
369
|
+
*
|
|
370
|
+
* Defines the core request and response types for the token metadata endpoint.
|
|
371
|
+
*/
|
|
372
|
+
type TokenMetadataRequestParam = {
|
|
373
|
+
tokenAddress: string;
|
|
374
|
+
};
|
|
375
|
+
type TokenMetadataResponse = {
|
|
376
|
+
originTokenNetwork: number;
|
|
377
|
+
originTokenAddress: string;
|
|
378
|
+
wrappedTokenAddressV1: string;
|
|
379
|
+
wrappedTokenAddressV2: string;
|
|
380
|
+
name: string;
|
|
381
|
+
symbol: string;
|
|
382
|
+
decimals: number;
|
|
383
|
+
};
|
|
384
|
+
|
|
364
385
|
/**
|
|
365
386
|
* Chain Types
|
|
366
387
|
*
|
|
@@ -826,6 +847,11 @@ declare class CoreClient {
|
|
|
826
847
|
* @param ids - the ids of the chains to get data and tokens for
|
|
827
848
|
*/
|
|
828
849
|
getChainDataAndTokensByChainIds(ids: number[]): Promise<ChainsResponse>;
|
|
850
|
+
/**
|
|
851
|
+
* Get token metadata by token address from ARC API
|
|
852
|
+
* @param tokenMetadataRequestParam - Object containing the token address
|
|
853
|
+
*/
|
|
854
|
+
getTokenMetadata(tokenMetadataRequestParam: TokenMetadataRequestParam): Promise<TokenMetadataResponse>;
|
|
829
855
|
/**
|
|
830
856
|
* Get all routes from AggLayer API
|
|
831
857
|
*/
|
|
@@ -847,9 +873,10 @@ declare class CoreClient {
|
|
|
847
873
|
*/
|
|
848
874
|
getClaimUnsignedTransaction(buildClaimTxParams: BuildClaimTransactionRequestParam): Promise<UnsignedTransaction>;
|
|
849
875
|
/**
|
|
850
|
-
* Get all transactions
|
|
876
|
+
* Get all transactions with pagination information
|
|
877
|
+
* @param transactionsRequestQueryParams - Parameters for the transactions API call
|
|
851
878
|
*/
|
|
852
|
-
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<
|
|
879
|
+
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<PaginatedTransactionsResponse>;
|
|
853
880
|
/**
|
|
854
881
|
* Get token mappings by token address
|
|
855
882
|
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
@@ -910,4 +937,4 @@ declare class AggLayerSDK {
|
|
|
910
937
|
getNative(): NativeClient;
|
|
911
938
|
}
|
|
912
939
|
|
|
913
|
-
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 TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -321,9 +322,11 @@ interface TransactionsRequestQueryParams {
|
|
|
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
|
|
@@ -361,6 +364,24 @@ type TokenMappingResponse = Array<{
|
|
|
361
364
|
wrappedTokenAddress: string;
|
|
362
365
|
}>;
|
|
363
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Arc API Token Metadata Types
|
|
369
|
+
*
|
|
370
|
+
* Defines the core request and response types for the token metadata endpoint.
|
|
371
|
+
*/
|
|
372
|
+
type TokenMetadataRequestParam = {
|
|
373
|
+
tokenAddress: string;
|
|
374
|
+
};
|
|
375
|
+
type TokenMetadataResponse = {
|
|
376
|
+
originTokenNetwork: number;
|
|
377
|
+
originTokenAddress: string;
|
|
378
|
+
wrappedTokenAddressV1: string;
|
|
379
|
+
wrappedTokenAddressV2: string;
|
|
380
|
+
name: string;
|
|
381
|
+
symbol: string;
|
|
382
|
+
decimals: number;
|
|
383
|
+
};
|
|
384
|
+
|
|
364
385
|
/**
|
|
365
386
|
* Chain Types
|
|
366
387
|
*
|
|
@@ -826,6 +847,11 @@ declare class CoreClient {
|
|
|
826
847
|
* @param ids - the ids of the chains to get data and tokens for
|
|
827
848
|
*/
|
|
828
849
|
getChainDataAndTokensByChainIds(ids: number[]): Promise<ChainsResponse>;
|
|
850
|
+
/**
|
|
851
|
+
* Get token metadata by token address from ARC API
|
|
852
|
+
* @param tokenMetadataRequestParam - Object containing the token address
|
|
853
|
+
*/
|
|
854
|
+
getTokenMetadata(tokenMetadataRequestParam: TokenMetadataRequestParam): Promise<TokenMetadataResponse>;
|
|
829
855
|
/**
|
|
830
856
|
* Get all routes from AggLayer API
|
|
831
857
|
*/
|
|
@@ -847,9 +873,10 @@ declare class CoreClient {
|
|
|
847
873
|
*/
|
|
848
874
|
getClaimUnsignedTransaction(buildClaimTxParams: BuildClaimTransactionRequestParam): Promise<UnsignedTransaction>;
|
|
849
875
|
/**
|
|
850
|
-
* Get all transactions
|
|
876
|
+
* Get all transactions with pagination information
|
|
877
|
+
* @param transactionsRequestQueryParams - Parameters for the transactions API call
|
|
851
878
|
*/
|
|
852
|
-
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<
|
|
879
|
+
getTransactions(transactionsRequestQueryParams: TransactionsRequestQueryParams): Promise<PaginatedTransactionsResponse>;
|
|
853
880
|
/**
|
|
854
881
|
* Get token mappings by token address
|
|
855
882
|
* @developer Note: Do not misinterpret network ID as chain ID.
|
|
@@ -910,4 +937,4 @@ declare class AggLayerSDK {
|
|
|
910
937
|
getNative(): NativeClient;
|
|
911
938
|
}
|
|
912
939
|
|
|
913
|
-
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 TokenReference, type ToolDetails, type Transaction, type TransactionParams, type TransactionsRequestQueryParams, type TransactionsResponse, type WrappedTokenParams };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1713,6 +1713,11 @@ var ArcApiService = class {
|
|
|
1713
1713
|
chainIds
|
|
1714
1714
|
});
|
|
1715
1715
|
}
|
|
1716
|
+
async tokenMetadata(tokenMetadataRequestParam) {
|
|
1717
|
+
return this.httpClient.get(
|
|
1718
|
+
`/metadata/tokens/${tokenMetadataRequestParam.tokenAddress}`
|
|
1719
|
+
);
|
|
1720
|
+
}
|
|
1716
1721
|
async routes(routesRequestParams) {
|
|
1717
1722
|
return this.httpClient.post("/routes", routesRequestParams);
|
|
1718
1723
|
}
|
|
@@ -1731,7 +1736,7 @@ var ArcApiService = class {
|
|
|
1731
1736
|
// supports cursor based pagination only
|
|
1732
1737
|
async transactions(transactionsRequestQueryParams) {
|
|
1733
1738
|
return this.httpClient.get("/transactions", {
|
|
1734
|
-
transactionsRequestQueryParams
|
|
1739
|
+
...transactionsRequestQueryParams
|
|
1735
1740
|
});
|
|
1736
1741
|
}
|
|
1737
1742
|
async tokenMappings(tokenMappingQueryParams) {
|
|
@@ -1903,6 +1908,26 @@ var CoreClient = class {
|
|
|
1903
1908
|
withSupportedTokens: true
|
|
1904
1909
|
});
|
|
1905
1910
|
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Get token metadata by token address from ARC API
|
|
1913
|
+
* @param tokenMetadataRequestParam - Object containing the token address
|
|
1914
|
+
*/
|
|
1915
|
+
async getTokenMetadata(tokenMetadataRequestParam) {
|
|
1916
|
+
try {
|
|
1917
|
+
const response = await this.arcApiService.tokenMetadata(
|
|
1918
|
+
tokenMetadataRequestParam
|
|
1919
|
+
);
|
|
1920
|
+
if (response.data.status === "success") {
|
|
1921
|
+
return response.data.data;
|
|
1922
|
+
}
|
|
1923
|
+
throw ApiError.fromErrorResponse(response.data);
|
|
1924
|
+
} catch (error) {
|
|
1925
|
+
if (error instanceof ApiError) {
|
|
1926
|
+
throw error;
|
|
1927
|
+
}
|
|
1928
|
+
throw ApiError.createFallbackError(error, "Get token metadata");
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1906
1931
|
/**
|
|
1907
1932
|
* Get all routes from AggLayer API
|
|
1908
1933
|
*/
|
|
@@ -1983,7 +2008,8 @@ var CoreClient = class {
|
|
|
1983
2008
|
}
|
|
1984
2009
|
}
|
|
1985
2010
|
/**
|
|
1986
|
-
* Get all transactions
|
|
2011
|
+
* Get all transactions with pagination information
|
|
2012
|
+
* @param transactionsRequestQueryParams - Parameters for the transactions API call
|
|
1987
2013
|
*/
|
|
1988
2014
|
async getTransactions(transactionsRequestQueryParams) {
|
|
1989
2015
|
if (transactionsRequestQueryParams.limit && transactionsRequestQueryParams.limit > MAX_TRANSACTIONS_PER_PAGE) {
|
|
@@ -1997,7 +2023,12 @@ var CoreClient = class {
|
|
|
1997
2023
|
transactionsRequestQueryParams
|
|
1998
2024
|
);
|
|
1999
2025
|
if (response.data.status === "success") {
|
|
2000
|
-
return
|
|
2026
|
+
return {
|
|
2027
|
+
transactions: response.data.data,
|
|
2028
|
+
...response.data.pagination && {
|
|
2029
|
+
pagination: response.data.pagination
|
|
2030
|
+
}
|
|
2031
|
+
};
|
|
2001
2032
|
}
|
|
2002
2033
|
throw ApiError.fromErrorResponse(response.data);
|
|
2003
2034
|
} catch (error) {
|