@agglayer/sdk 1.0.0-beta.14 → 1.0.0-beta.16

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 CHANGED
@@ -19,6 +19,7 @@ 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;
22
23
  }
23
24
  interface ErrorResponse {
24
25
  readonly status: 'error';
@@ -27,6 +28,16 @@ interface ErrorResponse {
27
28
  readonly code: number;
28
29
  readonly details?: Record<string, unknown>;
29
30
  }
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
+ }
30
41
 
31
42
  /**
32
43
  * Arc API Tokens Types
@@ -78,13 +89,27 @@ type ChainsQueryParams = {
78
89
  readonly withSupportedTokens?: boolean;
79
90
  readonly chainIds?: readonly number[];
80
91
  readonly limit?: number;
81
- readonly startAfter?: number;
92
+ readonly offset?: number;
82
93
  };
83
94
  type ChainsResponse = {
84
95
  readonly chains: IChain[];
85
- readonly nextStartAfter?: number;
86
96
  };
87
97
 
98
+ /**
99
+ * Arc API Unsigned Transaction Types
100
+ *
101
+ * Defines the core request and response types for the tokens.
102
+ */
103
+ interface UnsignedTransaction {
104
+ readonly to: string;
105
+ readonly data: string;
106
+ readonly value: string;
107
+ readonly gasLimit: string;
108
+ readonly gasPrice?: string;
109
+ readonly chainId: number;
110
+ readonly from?: string;
111
+ }
112
+
88
113
  /**
89
114
  * Arc API Routes Types
90
115
  *
@@ -166,15 +191,6 @@ interface Step {
166
191
  readonly includedSteps: Step[] | null;
167
192
  readonly relatedSteps: string[] | null;
168
193
  }
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
- }
178
194
  interface ProviderMetadata {
179
195
  readonly lifi?: {
180
196
  readonly integrator: string | null;
@@ -214,7 +230,7 @@ interface Route {
214
230
  readonly feeCosts: FeeCost[];
215
231
  readonly gasCosts: GasCost[];
216
232
  readonly steps: Step[];
217
- readonly transactionRequest?: TransactionRequest;
233
+ readonly transactionRequest?: UnsignedTransaction;
218
234
  readonly providerMetadata: ProviderMetadata;
219
235
  readonly riskFactors: RiskFactors | null;
220
236
  readonly createdAt: number;
@@ -293,7 +309,7 @@ interface Transaction {
293
309
  };
294
310
  }
295
311
  interface TransactionsRequestQueryParams {
296
- readonly fromAddress?: string;
312
+ readonly address?: string;
297
313
  readonly sorceNetworkIds?: string;
298
314
  readonly destinationNetworkIds?: string;
299
315
  readonly limit?: number;
@@ -301,7 +317,6 @@ interface TransactionsRequestQueryParams {
301
317
  }
302
318
  type TransactionsResponse = {
303
319
  transactions: Transaction[];
304
- nextStartAfter?: number;
305
320
  };
306
321
 
307
322
  /**
@@ -311,7 +326,7 @@ type TransactionsResponse = {
311
326
  */
312
327
 
313
328
  type BuildTransactionRequestBody = Step;
314
- type BuildTransactionResponse = Route;
329
+ type BuildTransactionResponse = UnsignedTransaction;
315
330
 
316
331
  /**
317
332
  * Chain Types
@@ -747,19 +762,32 @@ declare class CoreClient {
747
762
  private config;
748
763
  private arcApiService;
749
764
  constructor(config: CoreConfig);
765
+ /**
766
+ * Generic pagination helper for chains API calls (limit and offset based pagination)
767
+ * Handles automatic pagination to fetch all available data
768
+ * @param params - Parameters for the chains API call
769
+ * @param pageSize - Number of items per page (defaults to DEFAULT_CHAINS_PER_PAGE)
770
+ */
771
+ private getAllChainsPaginated;
750
772
  /**
751
773
  * Get all chains metadata from AggLayer API
774
+ * Handles pagination automatically to fetch all available chains
752
775
  */
753
776
  getAllChains(): Promise<ChainsResponse>;
754
777
  /**
755
778
  * Get chain metadata by id from AggLayer API
779
+ * Handles pagination automatically to fetch all available chain metadata
756
780
  * @param ids - the ids of the chains to get metadata for
757
781
  */
758
782
  getChainMetadataByChainIds(ids: number[]): Promise<ChainsResponse>;
759
783
  /**
760
784
  * Get all tokens from AggLayer API
785
+ *
786
+ * Developer Note: This method is not recommended to use frequently or from frontend.
787
+ * As it can be very slow and resource intensive.
788
+ * It is recommended to use getChainDataAndTokensByChainIds instead.
761
789
  */
762
- getTokens(): Promise<ChainsResponse>;
790
+ getAllTokens(): Promise<ChainsResponse>;
763
791
  /**
764
792
  * Get chain data and tokens by AggLayer API
765
793
  * @param ids - the ids of the chains to get data and tokens for
@@ -770,9 +798,11 @@ declare class CoreClient {
770
798
  */
771
799
  getRoutes(routesRequestParams: RoutesRequestParams): Promise<RoutesResponse>;
772
800
  /**
773
- * Build transaction from a step object
801
+ * Get calldata from a route
802
+ * If route has transactionRequest field, return it directly as calldata
803
+ * Otherwise, call buildTransaction on route.steps[0] and return that as calldata
774
804
  */
775
- buildTransaction(builtTransactionRequestBody: BuildTransactionRequestBody): Promise<BuildTransactionResponse>;
805
+ getUnsignedTransaction(route: Route): Promise<UnsignedTransaction>;
776
806
  /**
777
807
  * Get all transactions via web sockets
778
808
  */
@@ -800,4 +830,4 @@ declare class AggLayerSDK {
800
830
  getNative(): NativeClient;
801
831
  }
802
832
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ 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;
22
23
  }
23
24
  interface ErrorResponse {
24
25
  readonly status: 'error';
@@ -27,6 +28,16 @@ interface ErrorResponse {
27
28
  readonly code: number;
28
29
  readonly details?: Record<string, unknown>;
29
30
  }
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
+ }
30
41
 
31
42
  /**
32
43
  * Arc API Tokens Types
@@ -78,13 +89,27 @@ type ChainsQueryParams = {
78
89
  readonly withSupportedTokens?: boolean;
79
90
  readonly chainIds?: readonly number[];
80
91
  readonly limit?: number;
81
- readonly startAfter?: number;
92
+ readonly offset?: number;
82
93
  };
83
94
  type ChainsResponse = {
84
95
  readonly chains: IChain[];
85
- readonly nextStartAfter?: number;
86
96
  };
87
97
 
98
+ /**
99
+ * Arc API Unsigned Transaction Types
100
+ *
101
+ * Defines the core request and response types for the tokens.
102
+ */
103
+ interface UnsignedTransaction {
104
+ readonly to: string;
105
+ readonly data: string;
106
+ readonly value: string;
107
+ readonly gasLimit: string;
108
+ readonly gasPrice?: string;
109
+ readonly chainId: number;
110
+ readonly from?: string;
111
+ }
112
+
88
113
  /**
89
114
  * Arc API Routes Types
90
115
  *
@@ -166,15 +191,6 @@ interface Step {
166
191
  readonly includedSteps: Step[] | null;
167
192
  readonly relatedSteps: string[] | null;
168
193
  }
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
- }
178
194
  interface ProviderMetadata {
179
195
  readonly lifi?: {
180
196
  readonly integrator: string | null;
@@ -214,7 +230,7 @@ interface Route {
214
230
  readonly feeCosts: FeeCost[];
215
231
  readonly gasCosts: GasCost[];
216
232
  readonly steps: Step[];
217
- readonly transactionRequest?: TransactionRequest;
233
+ readonly transactionRequest?: UnsignedTransaction;
218
234
  readonly providerMetadata: ProviderMetadata;
219
235
  readonly riskFactors: RiskFactors | null;
220
236
  readonly createdAt: number;
@@ -293,7 +309,7 @@ interface Transaction {
293
309
  };
294
310
  }
295
311
  interface TransactionsRequestQueryParams {
296
- readonly fromAddress?: string;
312
+ readonly address?: string;
297
313
  readonly sorceNetworkIds?: string;
298
314
  readonly destinationNetworkIds?: string;
299
315
  readonly limit?: number;
@@ -301,7 +317,6 @@ interface TransactionsRequestQueryParams {
301
317
  }
302
318
  type TransactionsResponse = {
303
319
  transactions: Transaction[];
304
- nextStartAfter?: number;
305
320
  };
306
321
 
307
322
  /**
@@ -311,7 +326,7 @@ type TransactionsResponse = {
311
326
  */
312
327
 
313
328
  type BuildTransactionRequestBody = Step;
314
- type BuildTransactionResponse = Route;
329
+ type BuildTransactionResponse = UnsignedTransaction;
315
330
 
316
331
  /**
317
332
  * Chain Types
@@ -747,19 +762,32 @@ declare class CoreClient {
747
762
  private config;
748
763
  private arcApiService;
749
764
  constructor(config: CoreConfig);
765
+ /**
766
+ * Generic pagination helper for chains API calls (limit and offset based pagination)
767
+ * Handles automatic pagination to fetch all available data
768
+ * @param params - Parameters for the chains API call
769
+ * @param pageSize - Number of items per page (defaults to DEFAULT_CHAINS_PER_PAGE)
770
+ */
771
+ private getAllChainsPaginated;
750
772
  /**
751
773
  * Get all chains metadata from AggLayer API
774
+ * Handles pagination automatically to fetch all available chains
752
775
  */
753
776
  getAllChains(): Promise<ChainsResponse>;
754
777
  /**
755
778
  * Get chain metadata by id from AggLayer API
779
+ * Handles pagination automatically to fetch all available chain metadata
756
780
  * @param ids - the ids of the chains to get metadata for
757
781
  */
758
782
  getChainMetadataByChainIds(ids: number[]): Promise<ChainsResponse>;
759
783
  /**
760
784
  * Get all tokens from AggLayer API
785
+ *
786
+ * Developer Note: This method is not recommended to use frequently or from frontend.
787
+ * As it can be very slow and resource intensive.
788
+ * It is recommended to use getChainDataAndTokensByChainIds instead.
761
789
  */
762
- getTokens(): Promise<ChainsResponse>;
790
+ getAllTokens(): Promise<ChainsResponse>;
763
791
  /**
764
792
  * Get chain data and tokens by AggLayer API
765
793
  * @param ids - the ids of the chains to get data and tokens for
@@ -770,9 +798,11 @@ declare class CoreClient {
770
798
  */
771
799
  getRoutes(routesRequestParams: RoutesRequestParams): Promise<RoutesResponse>;
772
800
  /**
773
- * Build transaction from a step object
801
+ * Get calldata from a route
802
+ * If route has transactionRequest field, return it directly as calldata
803
+ * Otherwise, call buildTransaction on route.steps[0] and return that as calldata
774
804
  */
775
- buildTransaction(builtTransactionRequestBody: BuildTransactionRequestBody): Promise<BuildTransactionResponse>;
805
+ getUnsignedTransaction(route: Route): Promise<UnsignedTransaction>;
776
806
  /**
777
807
  * Get all transactions via web sockets
778
808
  */
@@ -800,4 +830,4 @@ declare class AggLayerSDK {
800
830
  getNative(): NativeClient;
801
831
  }
802
832
 
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 };
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 };
package/dist/index.js CHANGED
@@ -1415,6 +1415,9 @@ var NETWORKS = {
1415
1415
  CARDONA: 2442
1416
1416
  };
1417
1417
  var DEFAULT_NETWORK = NETWORKS.SEPOLIA;
1418
+ var DEFAULT_CHAINS_PER_PAGE = 100;
1419
+ var DEFAULT_CHAINS_WITH_TOKENS_PER_PAGE = 1;
1420
+ var MAX_TRANSACTIONS_PER_PAGE = 100;
1418
1421
 
1419
1422
  // src/native/index.ts
1420
1423
  var NativeClient = class {
@@ -1643,11 +1646,12 @@ var HttpClient = class {
1643
1646
  continue;
1644
1647
  }
1645
1648
  if (Array.isArray(value)) {
1646
- value.forEach((item, index) => {
1647
- if (item !== void 0 && item !== null) {
1648
- result[`${fullKey}[${index}]`] = String(item);
1649
- }
1650
- });
1649
+ const filteredValues = value.filter(
1650
+ (item) => item !== void 0 && item !== null
1651
+ );
1652
+ if (filteredValues.length > 0) {
1653
+ result[fullKey] = filteredValues.join(",");
1654
+ }
1651
1655
  } else if (typeof value === "object") {
1652
1656
  Object.assign(
1653
1657
  result,
@@ -1677,16 +1681,17 @@ var ArcApiService = class {
1677
1681
  this.httpClient = new HttpClient({ baseUrl, timeout });
1678
1682
  }
1679
1683
  // responsible for both chains metadata and tokens
1684
+ // supports limit/offset based pagination
1680
1685
  async chains({
1681
1686
  withSupportedTokens = false,
1682
- limit = 20,
1683
- startAfter,
1687
+ limit = 10,
1688
+ offset,
1684
1689
  chainIds
1685
1690
  } = {}) {
1686
1691
  return this.httpClient.get("/metadata/chains", {
1687
1692
  withSupportedTokens,
1688
1693
  limit,
1689
- startAfter,
1694
+ offset,
1690
1695
  chainIds
1691
1696
  });
1692
1697
  }
@@ -1695,10 +1700,11 @@ var ArcApiService = class {
1695
1700
  }
1696
1701
  async buildTransaction(builtTransactionRequestBody) {
1697
1702
  return this.httpClient.post(
1698
- "/build-transaction",
1703
+ "/routes/build-transaction",
1699
1704
  builtTransactionRequestBody
1700
1705
  );
1701
1706
  }
1707
+ // supports cursor based pagination only
1702
1708
  async transactions(transactionsRequestQueryParams) {
1703
1709
  return this.httpClient.get("/transactions", {
1704
1710
  transactionsRequestQueryParams
@@ -1722,52 +1728,102 @@ var CoreClient = class {
1722
1728
  timeout: apiTimeout ?? 3e4
1723
1729
  });
1724
1730
  }
1731
+ /**
1732
+ * Generic pagination helper for chains API calls (limit and offset based pagination)
1733
+ * Handles automatic pagination to fetch all available data
1734
+ * @param params - Parameters for the chains API call
1735
+ * @param pageSize - Number of items per page (defaults to DEFAULT_CHAINS_PER_PAGE)
1736
+ */
1737
+ async getAllChainsPaginated(params, pageSize = DEFAULT_CHAINS_PER_PAGE) {
1738
+ const firstResponse = await this.arcApiService.chains({
1739
+ ...params,
1740
+ limit: pageSize
1741
+ });
1742
+ if (firstResponse.data.status !== "success") {
1743
+ throw new Error(firstResponse.data.message);
1744
+ }
1745
+ const firstPageData = firstResponse.data.data;
1746
+ const pagination = firstResponse.data.pagination;
1747
+ const firstPageChains = Array.isArray(firstPageData) ? firstPageData : [];
1748
+ if (!pagination?.total || pagination.total <= pageSize) {
1749
+ return {
1750
+ chains: firstPageChains
1751
+ };
1752
+ }
1753
+ const totalPages = Math.ceil(pagination.total / pageSize);
1754
+ const remainingPages = totalPages - 1;
1755
+ if (remainingPages === 0) {
1756
+ return {
1757
+ chains: firstPageChains
1758
+ };
1759
+ }
1760
+ const remainingPagePromises = Array.from(
1761
+ { length: remainingPages },
1762
+ (_, index) => {
1763
+ const offset = (index + 1) * pageSize;
1764
+ return this.arcApiService.chains({
1765
+ ...params,
1766
+ limit: pageSize,
1767
+ offset
1768
+ });
1769
+ }
1770
+ );
1771
+ const remainingResponses = await Promise.all(remainingPagePromises);
1772
+ for (const response of remainingResponses) {
1773
+ if (response.data.status !== "success") {
1774
+ throw new Error(response.data.message);
1775
+ }
1776
+ }
1777
+ const allChains = [
1778
+ ...firstPageChains,
1779
+ ...remainingResponses.flatMap((response) => {
1780
+ if (response.data.status === "success") {
1781
+ return Array.isArray(response.data.data) ? response.data.data : [];
1782
+ }
1783
+ return [];
1784
+ })
1785
+ ];
1786
+ return {
1787
+ chains: allChains
1788
+ };
1789
+ }
1725
1790
  /**
1726
1791
  * Get all chains metadata from AggLayer API
1792
+ * Handles pagination automatically to fetch all available chains
1727
1793
  */
1728
1794
  async getAllChains() {
1729
- const response = await this.arcApiService.chains();
1730
- if (response.data.status === "success") {
1731
- return response.data.data;
1732
- }
1733
- throw new Error(response.data.message);
1795
+ return this.getAllChainsPaginated({});
1734
1796
  }
1735
1797
  /**
1736
1798
  * Get chain metadata by id from AggLayer API
1799
+ * Handles pagination automatically to fetch all available chain metadata
1737
1800
  * @param ids - the ids of the chains to get metadata for
1738
1801
  */
1739
1802
  async getChainMetadataByChainIds(ids) {
1740
- const response = await this.arcApiService.chains({ chainIds: ids });
1741
- if (response.data.status === "success") {
1742
- return response.data.data;
1743
- }
1744
- throw new Error(response.data.message);
1803
+ return this.getAllChainsPaginated({ chainIds: ids });
1745
1804
  }
1746
1805
  /**
1747
1806
  * Get all tokens from AggLayer API
1748
- */
1749
- async getTokens() {
1750
- const response = await this.arcApiService.chains({
1751
- withSupportedTokens: true
1752
- });
1753
- if (response.data.status === "success") {
1754
- return response.data.data;
1755
- }
1756
- throw new Error(response.data.message);
1807
+ *
1808
+ * Developer Note: This method is not recommended to use frequently or from frontend.
1809
+ * As it can be very slow and resource intensive.
1810
+ * It is recommended to use getChainDataAndTokensByChainIds instead.
1811
+ */
1812
+ async getAllTokens() {
1813
+ return this.getAllChainsPaginated(
1814
+ { withSupportedTokens: true },
1815
+ DEFAULT_CHAINS_WITH_TOKENS_PER_PAGE
1816
+ );
1757
1817
  }
1758
1818
  /**
1759
1819
  * Get chain data and tokens by AggLayer API
1760
1820
  * @param ids - the ids of the chains to get data and tokens for
1761
1821
  */
1762
1822
  async getChainDataAndTokensByChainIds(ids) {
1763
- const response = await this.arcApiService.chains({
1823
+ return this.getAllChainsPaginated({
1764
1824
  chainIds: ids,
1765
1825
  withSupportedTokens: true
1766
1826
  });
1767
- if (response.data.status === "success") {
1768
- return response.data.data;
1769
- }
1770
- throw new Error(response.data.message);
1771
1827
  }
1772
1828
  /**
1773
1829
  * Get all routes from AggLayer API
@@ -1780,12 +1836,18 @@ var CoreClient = class {
1780
1836
  throw new Error(response.data.message);
1781
1837
  }
1782
1838
  /**
1783
- * Build transaction from a step object
1839
+ * Get calldata from a route
1840
+ * If route has transactionRequest field, return it directly as calldata
1841
+ * Otherwise, call buildTransaction on route.steps[0] and return that as calldata
1784
1842
  */
1785
- async buildTransaction(builtTransactionRequestBody) {
1786
- const response = await this.arcApiService.buildTransaction(
1787
- builtTransactionRequestBody
1788
- );
1843
+ async getUnsignedTransaction(route) {
1844
+ if (route.transactionRequest) {
1845
+ return route.transactionRequest;
1846
+ }
1847
+ if (route.steps.length === 0 || !route.steps[0]) {
1848
+ throw new Error("Route has no steps to build transaction from");
1849
+ }
1850
+ const response = await this.arcApiService.buildTransaction(route.steps[0]);
1789
1851
  if (response.data.status === "success") {
1790
1852
  return response.data.data;
1791
1853
  }
@@ -1795,6 +1857,11 @@ var CoreClient = class {
1795
1857
  * Get all transactions via web sockets
1796
1858
  */
1797
1859
  async getTransactions(transactionsRequestQueryParams) {
1860
+ if (transactionsRequestQueryParams.limit && transactionsRequestQueryParams.limit > MAX_TRANSACTIONS_PER_PAGE) {
1861
+ throw new Error(
1862
+ `Limit cannot be greater than ${MAX_TRANSACTIONS_PER_PAGE}`
1863
+ );
1864
+ }
1798
1865
  const response = await this.arcApiService.transactions(
1799
1866
  transactionsRequestQueryParams
1800
1867
  );