@chainlink/ccip-sdk 0.94.0 → 0.96.0

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.
Files changed (170) hide show
  1. package/README.md +2 -2
  2. package/dist/all-chains.d.ts +23 -0
  3. package/dist/all-chains.d.ts.map +1 -0
  4. package/dist/all-chains.js +24 -0
  5. package/dist/all-chains.js.map +1 -0
  6. package/dist/api/index.d.ts +86 -7
  7. package/dist/api/index.d.ts.map +1 -1
  8. package/dist/api/index.js +270 -10
  9. package/dist/api/index.js.map +1 -1
  10. package/dist/api/types.d.ts +134 -13
  11. package/dist/api/types.d.ts.map +1 -1
  12. package/dist/aptos/index.d.ts +38 -17
  13. package/dist/aptos/index.d.ts.map +1 -1
  14. package/dist/aptos/index.js +91 -61
  15. package/dist/aptos/index.js.map +1 -1
  16. package/dist/aptos/logs.js +3 -3
  17. package/dist/aptos/logs.js.map +1 -1
  18. package/dist/chain.d.ts +300 -42
  19. package/dist/chain.d.ts.map +1 -1
  20. package/dist/chain.js +160 -9
  21. package/dist/chain.js.map +1 -1
  22. package/dist/errors/codes.d.ts +9 -3
  23. package/dist/errors/codes.d.ts.map +1 -1
  24. package/dist/errors/codes.js +10 -3
  25. package/dist/errors/codes.js.map +1 -1
  26. package/dist/errors/index.d.ts +8 -8
  27. package/dist/errors/index.d.ts.map +1 -1
  28. package/dist/errors/index.js +8 -8
  29. package/dist/errors/index.js.map +1 -1
  30. package/dist/errors/recovery.d.ts.map +1 -1
  31. package/dist/errors/recovery.js +10 -4
  32. package/dist/errors/recovery.js.map +1 -1
  33. package/dist/errors/specialized.d.ts +62 -21
  34. package/dist/errors/specialized.d.ts.map +1 -1
  35. package/dist/errors/specialized.js +128 -41
  36. package/dist/errors/specialized.js.map +1 -1
  37. package/dist/evm/extra-args.d.ts +25 -0
  38. package/dist/evm/extra-args.d.ts.map +1 -0
  39. package/dist/evm/extra-args.js +328 -0
  40. package/dist/evm/extra-args.js.map +1 -0
  41. package/dist/evm/gas.d.ts +14 -0
  42. package/dist/evm/gas.d.ts.map +1 -0
  43. package/dist/evm/gas.js +92 -0
  44. package/dist/evm/gas.js.map +1 -0
  45. package/dist/evm/index.d.ts +76 -32
  46. package/dist/evm/index.d.ts.map +1 -1
  47. package/dist/evm/index.js +94 -104
  48. package/dist/evm/index.js.map +1 -1
  49. package/dist/evm/offchain.d.ts.map +1 -1
  50. package/dist/evm/offchain.js +8 -8
  51. package/dist/evm/offchain.js.map +1 -1
  52. package/dist/execution.d.ts.map +1 -1
  53. package/dist/execution.js +24 -3
  54. package/dist/execution.js.map +1 -1
  55. package/dist/extra-args.d.ts +103 -4
  56. package/dist/extra-args.d.ts.map +1 -1
  57. package/dist/extra-args.js +28 -3
  58. package/dist/extra-args.js.map +1 -1
  59. package/dist/gas.d.ts +46 -19
  60. package/dist/gas.d.ts.map +1 -1
  61. package/dist/gas.js +56 -68
  62. package/dist/gas.js.map +1 -1
  63. package/dist/index.d.ts +18 -15
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +14 -13
  66. package/dist/index.js.map +1 -1
  67. package/dist/offchain.d.ts +5 -4
  68. package/dist/offchain.d.ts.map +1 -1
  69. package/dist/offchain.js +7 -6
  70. package/dist/offchain.js.map +1 -1
  71. package/dist/requests.d.ts +30 -20
  72. package/dist/requests.d.ts.map +1 -1
  73. package/dist/requests.js +86 -56
  74. package/dist/requests.js.map +1 -1
  75. package/dist/selectors.d.ts +2 -1
  76. package/dist/selectors.d.ts.map +1 -1
  77. package/dist/selectors.js +625 -278
  78. package/dist/selectors.js.map +1 -1
  79. package/dist/solana/exec.d.ts.map +1 -1
  80. package/dist/solana/exec.js +2 -1
  81. package/dist/solana/exec.js.map +1 -1
  82. package/dist/solana/index.d.ts +73 -22
  83. package/dist/solana/index.d.ts.map +1 -1
  84. package/dist/solana/index.js +91 -28
  85. package/dist/solana/index.js.map +1 -1
  86. package/dist/solana/offchain.js +2 -2
  87. package/dist/solana/offchain.js.map +1 -1
  88. package/dist/solana/send.d.ts.map +1 -1
  89. package/dist/solana/send.js +6 -9
  90. package/dist/solana/send.js.map +1 -1
  91. package/dist/solana/utils.d.ts +29 -1
  92. package/dist/solana/utils.d.ts.map +1 -1
  93. package/dist/solana/utils.js +39 -1
  94. package/dist/solana/utils.js.map +1 -1
  95. package/dist/sui/discovery.d.ts +7 -4
  96. package/dist/sui/discovery.d.ts.map +1 -1
  97. package/dist/sui/discovery.js +66 -19
  98. package/dist/sui/discovery.js.map +1 -1
  99. package/dist/sui/events.d.ts +23 -12
  100. package/dist/sui/events.d.ts.map +1 -1
  101. package/dist/sui/events.js +267 -128
  102. package/dist/sui/events.js.map +1 -1
  103. package/dist/sui/index.d.ts +57 -41
  104. package/dist/sui/index.d.ts.map +1 -1
  105. package/dist/sui/index.js +286 -159
  106. package/dist/sui/index.js.map +1 -1
  107. package/dist/sui/objects.d.ts +14 -4
  108. package/dist/sui/objects.d.ts.map +1 -1
  109. package/dist/sui/objects.js +61 -68
  110. package/dist/sui/objects.js.map +1 -1
  111. package/dist/sui/types.d.ts +33 -0
  112. package/dist/sui/types.d.ts.map +1 -1
  113. package/dist/sui/types.js.map +1 -1
  114. package/dist/ton/index.d.ts +67 -21
  115. package/dist/ton/index.d.ts.map +1 -1
  116. package/dist/ton/index.js +159 -30
  117. package/dist/ton/index.js.map +1 -1
  118. package/dist/ton/send.d.ts +52 -0
  119. package/dist/ton/send.d.ts.map +1 -0
  120. package/dist/ton/send.js +166 -0
  121. package/dist/ton/send.js.map +1 -0
  122. package/dist/ton/utils.d.ts +3 -3
  123. package/dist/ton/utils.d.ts.map +1 -1
  124. package/dist/ton/utils.js +6 -5
  125. package/dist/ton/utils.js.map +1 -1
  126. package/dist/types.d.ts +126 -9
  127. package/dist/types.d.ts.map +1 -1
  128. package/dist/types.js +19 -5
  129. package/dist/types.js.map +1 -1
  130. package/dist/utils.d.ts +67 -4
  131. package/dist/utils.d.ts.map +1 -1
  132. package/dist/utils.js +126 -17
  133. package/dist/utils.js.map +1 -1
  134. package/package.json +14 -9
  135. package/src/all-chains.ts +26 -0
  136. package/src/api/index.ts +348 -13
  137. package/src/api/types.ts +160 -13
  138. package/src/aptos/index.ts +98 -76
  139. package/src/aptos/logs.ts +3 -3
  140. package/src/chain.ts +408 -51
  141. package/src/errors/codes.ts +10 -3
  142. package/src/errors/index.ts +8 -5
  143. package/src/errors/recovery.ts +18 -5
  144. package/src/errors/specialized.ts +168 -49
  145. package/src/evm/extra-args.ts +377 -0
  146. package/src/evm/gas.ts +150 -0
  147. package/src/evm/index.ts +123 -155
  148. package/src/evm/offchain.ts +15 -9
  149. package/src/execution.ts +26 -3
  150. package/src/extra-args.ts +108 -4
  151. package/src/gas.ts +101 -115
  152. package/src/index.ts +27 -14
  153. package/src/offchain.ts +12 -6
  154. package/src/requests.ts +117 -67
  155. package/src/selectors.ts +632 -280
  156. package/src/solana/exec.ts +3 -1
  157. package/src/solana/index.ts +97 -37
  158. package/src/solana/offchain.ts +2 -2
  159. package/src/solana/send.ts +5 -23
  160. package/src/solana/utils.ts +66 -0
  161. package/src/sui/discovery.ts +92 -31
  162. package/src/sui/events.ts +346 -239
  163. package/src/sui/index.ts +365 -212
  164. package/src/sui/objects.ts +74 -98
  165. package/src/sui/types.ts +35 -0
  166. package/src/ton/index.ts +199 -35
  167. package/src/ton/send.ts +222 -0
  168. package/src/ton/utils.ts +7 -6
  169. package/src/types.ts +128 -9
  170. package/src/utils.ts +169 -21
package/README.md CHANGED
@@ -153,8 +153,8 @@ const signer = await source.provider.getSigner(0)
153
153
  | EVM | `EVMChain` | [ethers.js v6](https://docs.ethers.org/v6/) | Supported |
154
154
  | Solana | `SolanaChain` | [solana-web3.js](https://github.com/solana-foundation/solana-web3.js) | Supported |
155
155
  | Aptos | `AptosChain` | [aptos-ts-sdk](https://github.com/aptos-labs/aptos-ts-sdk) | Supported |
156
- | Sui | `SuiChain` | [@mysten/sui](https://github.com/MystenLabs/sui) | In Development |
157
- | TON | `TONChain` | [@ton/ton](https://github.com/ton-org/ton) | In Development |
156
+ | Sui | `SuiChain` | [@mysten/sui](https://github.com/MystenLabs/sui) | Partial (manual exec) |
157
+ | TON | `TONChain` | [@ton/ton](https://github.com/ton-org/ton) | Partial (manual exec) |
158
158
 
159
159
  ## Related
160
160
 
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Entry point for importing all supported chain implementations.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { AptosChain } from './aptos/index.ts';
7
+ import { EVMChain } from './evm/index.ts';
8
+ import { SolanaChain } from './solana/index.ts';
9
+ import { SuiChain } from './sui/index.ts';
10
+ import { TONChain } from './ton/index.ts';
11
+ /**
12
+ * Map of all supported chain families to their implementations.
13
+ * Importing this includes all chain dependencies in the bundle.
14
+ */
15
+ export declare const allSupportedChains: {
16
+ EVM: typeof EVMChain;
17
+ SVM: typeof SolanaChain;
18
+ APTOS: typeof AptosChain;
19
+ SUI: typeof SuiChain;
20
+ TON: typeof TONChain;
21
+ };
22
+ export { supportedChains } from './supported-chains.ts';
23
+ //# sourceMappingURL=all-chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"all-chains.d.ts","sourceRoot":"","sources":["../src/all-chains.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGzC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAM9B,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Entry point for importing all supported chain implementations.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { AptosChain } from "./aptos/index.js";
7
+ import { EVMChain } from "./evm/index.js";
8
+ import { SolanaChain } from "./solana/index.js";
9
+ import { SuiChain } from "./sui/index.js";
10
+ import { TONChain } from "./ton/index.js";
11
+ import { ChainFamily } from "./types.js";
12
+ /**
13
+ * Map of all supported chain families to their implementations.
14
+ * Importing this includes all chain dependencies in the bundle.
15
+ */
16
+ export const allSupportedChains = {
17
+ [ChainFamily.EVM]: EVMChain,
18
+ [ChainFamily.Solana]: SolanaChain,
19
+ [ChainFamily.Aptos]: AptosChain,
20
+ [ChainFamily.Sui]: SuiChain,
21
+ [ChainFamily.TON]: TONChain,
22
+ };
23
+ export { supportedChains } from "./supported-chains.js";
24
+ //# sourceMappingURL=all-chains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"all-chains.js","sourceRoot":"","sources":["../src/all-chains.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,QAAQ;IAC3B,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW;IACjC,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,UAAU;IAC/B,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,QAAQ;IAC3B,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,QAAQ;CAC5B,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
@@ -1,14 +1,19 @@
1
+ import type { SetRequired } from 'type-fest';
2
+ import { type CCIPRequest, type Logger, type WithLogger } from '../types.ts';
1
3
  import type { LaneLatencyResponse } from './types.ts';
2
- import type { Logger, WithLogger } from '../types.ts';
3
- export type { APIErrorResponse, LaneLatencyResponse } from './types.ts';
4
+ export type { APICCIPRequestMetadata, APIErrorResponse, LaneLatencyResponse } from './types.ts';
4
5
  /** Default CCIP API base URL */
5
- export declare const DEFAULT_API_BASE_URL = "https://api.ccip.chain.link";
6
+ export declare const DEFAULT_API_BASE_URL = "https://api.ccip.cldev.cloud";
7
+ /** Default timeout for API requests in milliseconds */
8
+ export declare const DEFAULT_TIMEOUT_MS = 30000;
6
9
  /**
7
10
  * Context for CCIPAPIClient initialization.
8
11
  */
9
12
  export type CCIPAPIClientContext = WithLogger & {
10
13
  /** Custom fetch function (defaults to globalThis.fetch) */
11
14
  fetch?: typeof fetch;
15
+ /** Request timeout in milliseconds (defaults to 30000ms) */
16
+ timeoutMs?: number;
12
17
  };
13
18
  /**
14
19
  * Client for interacting with the CCIP REST API.
@@ -49,11 +54,13 @@ export declare class CCIPAPIClient {
49
54
  readonly baseUrl: string;
50
55
  /** Logger instance */
51
56
  readonly logger: Logger;
57
+ /** Request timeout in milliseconds */
58
+ readonly timeoutMs: number;
52
59
  /** Fetch function used for HTTP requests */
53
60
  private readonly _fetch;
54
61
  /**
55
62
  * Creates a new CCIPAPIClient instance.
56
- * @param baseUrl - Base URL for the CCIP API (defaults to https://api.ccip.chain.link)
63
+ * @param baseUrl - Base URL for the CCIP API (defaults to {@link DEFAULT_API_BASE_URL})
57
64
  * @param ctx - Optional context with logger and custom fetch
58
65
  */
59
66
  constructor(baseUrl?: string, ctx?: CCIPAPIClientContext);
@@ -65,6 +72,15 @@ export declare class CCIPAPIClient {
65
72
  * @returns New CCIPAPIClient instance
66
73
  */
67
74
  static fromUrl(baseUrl?: string, ctx?: CCIPAPIClientContext): Promise<CCIPAPIClient>;
75
+ /**
76
+ * Performs a fetch request with timeout protection.
77
+ * @param url - URL to fetch
78
+ * @param operation - Operation name for error context
79
+ * @returns Promise resolving to Response
80
+ * @throws CCIPTimeoutError if request times out
81
+ * @internal
82
+ */
83
+ private _fetchWithTimeout;
68
84
  /**
69
85
  * Fetches estimated lane latency between source and destination chains.
70
86
  *
@@ -72,10 +88,12 @@ export declare class CCIPAPIClient {
72
88
  * @param destChainSelector - Destination chain selector (bigint)
73
89
  * @returns Promise resolving to {@link LaneLatencyResponse} with totalMs
74
90
  *
75
- * @throws {@link CCIPHttpError} on HTTP errors with context:
76
- * - `status` - HTTP status code (e.g., 404, 500)
91
+ * @throws {@link CCIPLaneNotFoundError} when lane not found (404)
92
+ * @throws {@link CCIPTimeoutError} if request times out
93
+ * @throws {@link CCIPHttpError} on other HTTP errors with context:
94
+ * - `status` - HTTP status code (e.g., 500)
77
95
  * - `statusText` - HTTP status message
78
- * - `apiErrorCode` - API error code (e.g., "LANE_NOT_FOUND", "INVALID_PARAMETERS")
96
+ * - `apiErrorCode` - API error code (e.g., "INVALID_PARAMETERS")
79
97
  * - `apiErrorMessage` - Human-readable error message from API
80
98
  *
81
99
  * @example Basic usage
@@ -99,5 +117,66 @@ export declare class CCIPAPIClient {
99
117
  * ```
100
118
  */
101
119
  getLaneLatency(sourceChainSelector: bigint, destChainSelector: bigint): Promise<LaneLatencyResponse>;
120
+ /**
121
+ * Fetches a CCIP message by its unique message ID.
122
+ *
123
+ * @param messageId - The message ID (0x prefix + 64 hex characters, e.g., "0x1234...abcd")
124
+ * @returns Promise resolving to {@link APICCIPRequest} with message details
125
+ *
126
+ * @throws {@link CCIPMessageIdNotFoundError} when message not found (404)
127
+ * @throws {@link CCIPTimeoutError} if request times out
128
+ * @throws {@link CCIPHttpError} on HTTP errors with context:
129
+ * - `status` - HTTP status code
130
+ * - `statusText` - HTTP status message
131
+ * - `apiErrorCode` - API error code (e.g., "INVALID_MESSAGE_ID")
132
+ * - `apiErrorMessage` - Human-readable error message
133
+ *
134
+ * @example Basic usage
135
+ * ```typescript
136
+ * const request = await api.getMessageById(
137
+ * '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
138
+ * )
139
+ * console.log(`Status: ${request.status}`)
140
+ * console.log(`From: ${request.message?.sender}`)
141
+ * ```
142
+ *
143
+ * @example Handling not found
144
+ * ```typescript
145
+ * try {
146
+ * const request = await api.getMessageById(messageId)
147
+ * } catch (err) {
148
+ * if (err instanceof CCIPMessageIdNotFoundError) {
149
+ * console.error('Message not found, it may still be in transit')
150
+ * }
151
+ * }
152
+ * ```
153
+ */
154
+ getMessageById(messageId: string): Promise<SetRequired<CCIPRequest, 'metadata'>>;
155
+ /**
156
+ * Fetches message IDs from a source transaction hash.
157
+ *
158
+ * @param txHash - Source transaction hash (EVM hex or Solana Base58)
159
+ * @returns Promise resolving to array of message IDs
160
+ *
161
+ * @throws {@link CCIPMessageNotFoundInTxError} when no messages found (404 or empty)
162
+ * @throws {@link CCIPUnexpectedPaginationError} when hasNextPage is true
163
+ * @throws {@link CCIPTimeoutError} if request times out
164
+ * @throws {@link CCIPHttpError} on HTTP errors
165
+ *
166
+ * @example Basic usage
167
+ * ```typescript
168
+ * const messageIds = await api.getMessageIdsInTx(
169
+ * '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
170
+ * )
171
+ * console.log(`Found ${messageIds.length} messages`)
172
+ * ```
173
+ */
174
+ getMessageIdsInTx(txHash: string): Promise<string[]>;
175
+ /**
176
+ * Transforms raw API response to CCIPRequest with metadata.
177
+ * Populates all derivable CCIPRequest fields from API data.
178
+ * @internal
179
+ */
180
+ _transformMessageResponse(text: string): SetRequired<CCIPRequest, 'metadata'>;
102
181
  }
103
182
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,mBAAmB,EAA0B,MAAM,YAAY,CAAA;A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kBG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA0D1D;;;;OAIG;IACH,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE,UAAU,CAAC;CAqF9E"}
package/dist/api/index.js CHANGED
@@ -1,7 +1,34 @@
1
- import { CCIPHttpError, CCIPLaneNotFoundError } from "../errors/index.js";
1
+ import { CCIPHttpError, CCIPLaneNotFoundError, CCIPMessageIdNotFoundError, CCIPMessageNotFoundInTxError, CCIPTimeoutError, CCIPUnexpectedPaginationError, } from "../errors/index.js";
2
2
  import { HttpStatus } from "../http-status.js";
3
+ import { decodeMessage } from "../requests.js";
4
+ import { CCIPVersion, ChainFamily, MessageStatus, NetworkType, } from "../types.js";
5
+ import { bigIntReviver, parseJson } from "../utils.js";
3
6
  /** Default CCIP API base URL */
4
- export const DEFAULT_API_BASE_URL = 'https://api.ccip.chain.link';
7
+ export const DEFAULT_API_BASE_URL = 'https://api.ccip.cldev.cloud';
8
+ /** Default timeout for API requests in milliseconds */
9
+ export const DEFAULT_TIMEOUT_MS = 30000;
10
+ const validateChainFamily = (value, logger) => {
11
+ const validFamilies = Object.values(ChainFamily);
12
+ if (validFamilies.includes(value)) {
13
+ return value;
14
+ }
15
+ logger.warn(`Unexpected chainFamily value from API: "${value}", using UNKNOWN`);
16
+ return ChainFamily.Unknown;
17
+ };
18
+ const validateMessageStatus = (value, logger) => {
19
+ const validStatuses = Object.values(MessageStatus);
20
+ if (validStatuses.includes(value)) {
21
+ return value;
22
+ }
23
+ logger.warn(`Unexpected message status from API: "${value}", using UNKNOWN`);
24
+ return MessageStatus.Unknown;
25
+ };
26
+ const ensureNetworkInfo = (o, logger) => {
27
+ return Object.assign(o, {
28
+ networkType: o.name.includes('-mainnet') ? NetworkType.Mainnet : NetworkType.Testnet,
29
+ ...(!('family' in o) && { family: validateChainFamily(o.chainFamily, logger) }),
30
+ });
31
+ };
5
32
  /**
6
33
  * Client for interacting with the CCIP REST API.
7
34
  *
@@ -41,16 +68,19 @@ export class CCIPAPIClient {
41
68
  baseUrl;
42
69
  /** Logger instance */
43
70
  logger;
71
+ /** Request timeout in milliseconds */
72
+ timeoutMs;
44
73
  /** Fetch function used for HTTP requests */
45
74
  _fetch;
46
75
  /**
47
76
  * Creates a new CCIPAPIClient instance.
48
- * @param baseUrl - Base URL for the CCIP API (defaults to https://api.ccip.chain.link)
77
+ * @param baseUrl - Base URL for the CCIP API (defaults to {@link DEFAULT_API_BASE_URL})
49
78
  * @param ctx - Optional context with logger and custom fetch
50
79
  */
51
80
  constructor(baseUrl, ctx) {
52
81
  this.baseUrl = baseUrl ?? DEFAULT_API_BASE_URL;
53
82
  this.logger = ctx?.logger ?? console;
83
+ this.timeoutMs = ctx?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
54
84
  this._fetch = ctx?.fetch ?? globalThis.fetch;
55
85
  }
56
86
  /**
@@ -63,6 +93,30 @@ export class CCIPAPIClient {
63
93
  static fromUrl(baseUrl, ctx) {
64
94
  return Promise.resolve(new CCIPAPIClient(baseUrl, ctx));
65
95
  }
96
+ /**
97
+ * Performs a fetch request with timeout protection.
98
+ * @param url - URL to fetch
99
+ * @param operation - Operation name for error context
100
+ * @returns Promise resolving to Response
101
+ * @throws CCIPTimeoutError if request times out
102
+ * @internal
103
+ */
104
+ async _fetchWithTimeout(url, operation) {
105
+ const controller = new AbortController();
106
+ const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
107
+ try {
108
+ return await this._fetch(url, { signal: controller.signal });
109
+ }
110
+ catch (error) {
111
+ if (error instanceof Error && error.name === 'AbortError') {
112
+ throw new CCIPTimeoutError(operation, this.timeoutMs);
113
+ }
114
+ throw error;
115
+ }
116
+ finally {
117
+ clearTimeout(timeoutId);
118
+ }
119
+ }
66
120
  /**
67
121
  * Fetches estimated lane latency between source and destination chains.
68
122
  *
@@ -70,10 +124,12 @@ export class CCIPAPIClient {
70
124
  * @param destChainSelector - Destination chain selector (bigint)
71
125
  * @returns Promise resolving to {@link LaneLatencyResponse} with totalMs
72
126
  *
73
- * @throws {@link CCIPHttpError} on HTTP errors with context:
74
- * - `status` - HTTP status code (e.g., 404, 500)
127
+ * @throws {@link CCIPLaneNotFoundError} when lane not found (404)
128
+ * @throws {@link CCIPTimeoutError} if request times out
129
+ * @throws {@link CCIPHttpError} on other HTTP errors with context:
130
+ * - `status` - HTTP status code (e.g., 500)
75
131
  * - `statusText` - HTTP status message
76
- * - `apiErrorCode` - API error code (e.g., "LANE_NOT_FOUND", "INVALID_PARAMETERS")
132
+ * - `apiErrorCode` - API error code (e.g., "INVALID_PARAMETERS")
77
133
  * - `apiErrorMessage` - Human-readable error message from API
78
134
  *
79
135
  * @example Basic usage
@@ -97,16 +153,16 @@ export class CCIPAPIClient {
97
153
  * ```
98
154
  */
99
155
  async getLaneLatency(sourceChainSelector, destChainSelector) {
100
- const url = new URL(`${this.baseUrl}/v1/lanes/latency`);
156
+ const url = new URL(`${this.baseUrl}/v2/lanes/latency`);
101
157
  url.searchParams.set('sourceChainSelector', sourceChainSelector.toString());
102
158
  url.searchParams.set('destChainSelector', destChainSelector.toString());
103
159
  this.logger.debug(`CCIPAPIClient: GET ${url.toString()}`);
104
- const response = await this._fetch(url.toString());
160
+ const response = await this._fetchWithTimeout(url.toString(), 'getLaneLatency');
105
161
  if (!response.ok) {
106
162
  // Try to parse structured error response from API
107
163
  let apiError;
108
164
  try {
109
- apiError = (await response.json());
165
+ apiError = parseJson(await response.text());
110
166
  }
111
167
  catch {
112
168
  // Response body not JSON, use HTTP status only
@@ -132,10 +188,214 @@ export class CCIPAPIClient {
132
188
  : undefined,
133
189
  });
134
190
  }
135
- const raw = (await response.json());
191
+ const raw = JSON.parse(await response.text(), bigIntReviver);
136
192
  // Log full raw response for debugging
137
193
  this.logger.debug('getLaneLatency raw response:', raw);
138
194
  return { totalMs: raw.totalMs };
139
195
  }
196
+ /**
197
+ * Fetches a CCIP message by its unique message ID.
198
+ *
199
+ * @param messageId - The message ID (0x prefix + 64 hex characters, e.g., "0x1234...abcd")
200
+ * @returns Promise resolving to {@link APICCIPRequest} with message details
201
+ *
202
+ * @throws {@link CCIPMessageIdNotFoundError} when message not found (404)
203
+ * @throws {@link CCIPTimeoutError} if request times out
204
+ * @throws {@link CCIPHttpError} on HTTP errors with context:
205
+ * - `status` - HTTP status code
206
+ * - `statusText` - HTTP status message
207
+ * - `apiErrorCode` - API error code (e.g., "INVALID_MESSAGE_ID")
208
+ * - `apiErrorMessage` - Human-readable error message
209
+ *
210
+ * @example Basic usage
211
+ * ```typescript
212
+ * const request = await api.getMessageById(
213
+ * '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
214
+ * )
215
+ * console.log(`Status: ${request.status}`)
216
+ * console.log(`From: ${request.message?.sender}`)
217
+ * ```
218
+ *
219
+ * @example Handling not found
220
+ * ```typescript
221
+ * try {
222
+ * const request = await api.getMessageById(messageId)
223
+ * } catch (err) {
224
+ * if (err instanceof CCIPMessageIdNotFoundError) {
225
+ * console.error('Message not found, it may still be in transit')
226
+ * }
227
+ * }
228
+ * ```
229
+ */
230
+ async getMessageById(messageId) {
231
+ const url = `${this.baseUrl}/v2/messages/${encodeURIComponent(messageId)}`;
232
+ this.logger.debug(`CCIPAPIClient: GET ${url}`);
233
+ const response = await this._fetchWithTimeout(url, 'getMessageById');
234
+ if (!response.ok) {
235
+ // Try to parse structured error response from API
236
+ let apiError;
237
+ try {
238
+ apiError = parseJson(await response.text());
239
+ }
240
+ catch {
241
+ // Response body not JSON, use HTTP status only
242
+ }
243
+ // 404 - Message not found
244
+ if (response.status === HttpStatus.NOT_FOUND) {
245
+ throw new CCIPMessageIdNotFoundError(messageId, {
246
+ context: apiError
247
+ ? {
248
+ apiErrorCode: apiError.error,
249
+ apiErrorMessage: apiError.message,
250
+ }
251
+ : undefined,
252
+ });
253
+ }
254
+ // Generic HTTP error for other cases
255
+ throw new CCIPHttpError(response.status, response.statusText, {
256
+ context: apiError
257
+ ? {
258
+ apiErrorCode: apiError.error,
259
+ apiErrorMessage: apiError.message,
260
+ }
261
+ : undefined,
262
+ });
263
+ }
264
+ const raw = await response.text();
265
+ this.logger.debug('getMessageById raw response:', raw);
266
+ return this._transformMessageResponse(raw);
267
+ }
268
+ /**
269
+ * Fetches message IDs from a source transaction hash.
270
+ *
271
+ * @param txHash - Source transaction hash (EVM hex or Solana Base58)
272
+ * @returns Promise resolving to array of message IDs
273
+ *
274
+ * @throws {@link CCIPMessageNotFoundInTxError} when no messages found (404 or empty)
275
+ * @throws {@link CCIPUnexpectedPaginationError} when hasNextPage is true
276
+ * @throws {@link CCIPTimeoutError} if request times out
277
+ * @throws {@link CCIPHttpError} on HTTP errors
278
+ *
279
+ * @example Basic usage
280
+ * ```typescript
281
+ * const messageIds = await api.getMessageIdsInTx(
282
+ * '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
283
+ * )
284
+ * console.log(`Found ${messageIds.length} messages`)
285
+ * ```
286
+ */
287
+ async getMessageIdsInTx(txHash) {
288
+ const url = new URL(`${this.baseUrl}/v2/messages`);
289
+ url.searchParams.set('sourceTransactionHash', txHash);
290
+ url.searchParams.set('limit', '100');
291
+ this.logger.debug(`CCIPAPIClient: GET ${url.toString()}`);
292
+ const response = await this._fetchWithTimeout(url.toString(), 'getMessageIdsInTx');
293
+ if (!response.ok) {
294
+ // Try to parse structured error response from API
295
+ let apiError;
296
+ try {
297
+ apiError = parseJson(await response.text());
298
+ }
299
+ catch {
300
+ // Response body not JSON, use HTTP status only
301
+ }
302
+ // 404 - No messages found
303
+ if (response.status === HttpStatus.NOT_FOUND) {
304
+ throw new CCIPMessageNotFoundInTxError(txHash, {
305
+ context: apiError
306
+ ? {
307
+ apiErrorCode: apiError.error,
308
+ apiErrorMessage: apiError.message,
309
+ }
310
+ : undefined,
311
+ });
312
+ }
313
+ // Generic HTTP error for other cases
314
+ throw new CCIPHttpError(response.status, response.statusText, {
315
+ context: apiError
316
+ ? {
317
+ apiErrorCode: apiError.error,
318
+ apiErrorMessage: apiError.message,
319
+ }
320
+ : undefined,
321
+ });
322
+ }
323
+ const raw = parseJson(await response.text());
324
+ this.logger.debug('getMessageIdsInTx raw response:', raw);
325
+ // Handle empty results
326
+ if (raw.data.length === 0) {
327
+ throw new CCIPMessageNotFoundInTxError(txHash);
328
+ }
329
+ // Handle unexpected pagination (more than 100 messages)
330
+ if (raw.pagination.hasNextPage) {
331
+ throw new CCIPUnexpectedPaginationError(txHash, raw.data.length);
332
+ }
333
+ return raw.data.map((msg) => msg.messageId);
334
+ }
335
+ /**
336
+ * Transforms raw API response to CCIPRequest with metadata.
337
+ * Populates all derivable CCIPRequest fields from API data.
338
+ * @internal
339
+ */
340
+ _transformMessageResponse(text) {
341
+ // Build message with extraArgs spread and tokenAmounts included
342
+ const raw = decodeMessage(text);
343
+ const { sourceNetworkInfo, destNetworkInfo, status, origin, onramp, version, readyForManualExecution, finality, sendTransactionHash, receiptTransactionHash, sendTimestamp, receiptTimestamp, deliveryTime, sendBlockNumber, sendLogIndex, ...message } = raw;
344
+ const sendDate = new Date(sendTimestamp);
345
+ const sendTimestamp_ = isNaN(sendDate.getTime()) ? 0 : Math.floor(sendDate.getTime() / 1000);
346
+ const receiptDate = receiptTimestamp && new Date(receiptTimestamp);
347
+ const receiptTimestamp_ = receiptDate && !isNaN(receiptDate.getTime())
348
+ ? Math.floor(receiptDate.getTime() / 1000)
349
+ : undefined;
350
+ // Build lane - all fields available from API
351
+ const source = ensureNetworkInfo(sourceNetworkInfo, this.logger);
352
+ const dest = ensureNetworkInfo(destNetworkInfo, this.logger);
353
+ const lane = {
354
+ source,
355
+ sourceChainSelector: source.chainSelector,
356
+ dest,
357
+ destChainSelector: dest.chainSelector,
358
+ onRamp: onramp,
359
+ version: (version?.replace(/-dev$/, '') ?? CCIPVersion.V1_6),
360
+ };
361
+ // Build log from API data
362
+ const log = {
363
+ transactionHash: sendTransactionHash,
364
+ address: raw.onramp,
365
+ data: { message: parseJson(text) },
366
+ topics: [lane.version < CCIPVersion.V1_6 ? 'CCIPSendRequested' : 'CCIPMessageSent'],
367
+ index: Number(sendLogIndex),
368
+ blockNumber: Number(sendBlockNumber),
369
+ };
370
+ // Build tx from API data
371
+ const tx = {
372
+ hash: log.transactionHash,
373
+ timestamp: sendTimestamp_,
374
+ from: origin,
375
+ logs: [log],
376
+ blockNumber: Number(sendBlockNumber),
377
+ };
378
+ log.tx = tx;
379
+ // Note: We use type assertions for partial nested objects since Partial<CCIPRequest>
380
+ // requires complete types when provided. These are intentionally partial.
381
+ return {
382
+ // CCIPRequest fields (Partial) - cast partial objects
383
+ lane,
384
+ message,
385
+ log,
386
+ tx,
387
+ // API-specific metadata
388
+ metadata: {
389
+ status: validateMessageStatus(status, this.logger),
390
+ readyForManualExecution,
391
+ finality,
392
+ receiptTransactionHash,
393
+ receiptTimestamp: receiptTimestamp_,
394
+ deliveryTime,
395
+ sourceNetworkInfo: ensureNetworkInfo(sourceNetworkInfo, this.logger),
396
+ destNetworkInfo: ensureNetworkInfo(destNetworkInfo, this.logger),
397
+ },
398
+ };
399
+ }
140
400
  }
141
401
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAK9C,gCAAgC;AAChC,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAA6B,CAAA;AAUjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,aAAa;IACxB,gCAAgC;IACvB,OAAO,CAAQ;IACxB,sBAAsB;IACb,MAAM,CAAQ;IACvB,4CAA4C;IAC3B,MAAM,CAAc;IAErC;;;;OAIG;IACH,YAAY,OAAgB,EAAE,GAA0B;QACtD,IAAI,C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