@chainlink/ccip-sdk 0.91.0 → 0.92.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 (273) hide show
  1. package/README.md +127 -80
  2. package/dist/aptos/hasher.d.ts.map +1 -1
  3. package/dist/aptos/hasher.js +7 -6
  4. package/dist/aptos/hasher.js.map +1 -1
  5. package/dist/aptos/index.d.ts +7 -2
  6. package/dist/aptos/index.d.ts.map +1 -1
  7. package/dist/aptos/index.js +29 -20
  8. package/dist/aptos/index.js.map +1 -1
  9. package/dist/aptos/logs.d.ts +5 -3
  10. package/dist/aptos/logs.d.ts.map +1 -1
  11. package/dist/aptos/logs.js +64 -27
  12. package/dist/aptos/logs.js.map +1 -1
  13. package/dist/aptos/token.d.ts.map +1 -1
  14. package/dist/aptos/token.js +2 -1
  15. package/dist/aptos/token.js.map +1 -1
  16. package/dist/aptos/types.js +6 -6
  17. package/dist/aptos/types.js.map +1 -1
  18. package/dist/chain.d.ts +36 -11
  19. package/dist/chain.d.ts.map +1 -1
  20. package/dist/chain.js +34 -2
  21. package/dist/chain.js.map +1 -1
  22. package/dist/commits.d.ts +2 -3
  23. package/dist/commits.d.ts.map +1 -1
  24. package/dist/commits.js +19 -8
  25. package/dist/commits.js.map +1 -1
  26. package/dist/errors/CCIPError.d.ts +48 -0
  27. package/dist/errors/CCIPError.d.ts.map +1 -0
  28. package/dist/errors/CCIPError.js +65 -0
  29. package/dist/errors/CCIPError.js.map +1 -0
  30. package/dist/errors/codes.d.ts +120 -0
  31. package/dist/errors/codes.d.ts.map +1 -0
  32. package/dist/errors/codes.js +156 -0
  33. package/dist/errors/codes.js.map +1 -0
  34. package/dist/errors/index.d.ts +26 -0
  35. package/dist/errors/index.d.ts.map +1 -0
  36. package/dist/errors/index.js +51 -0
  37. package/dist/errors/index.js.map +1 -0
  38. package/dist/errors/recovery.d.ts +6 -0
  39. package/dist/errors/recovery.d.ts.map +1 -0
  40. package/dist/errors/recovery.js +118 -0
  41. package/dist/errors/recovery.js.map +1 -0
  42. package/dist/errors/specialized.d.ts +637 -0
  43. package/dist/errors/specialized.d.ts.map +1 -0
  44. package/dist/errors/specialized.js +1298 -0
  45. package/dist/errors/specialized.js.map +1 -0
  46. package/dist/errors/utils.d.ts +11 -0
  47. package/dist/errors/utils.d.ts.map +1 -0
  48. package/dist/errors/utils.js +61 -0
  49. package/dist/errors/utils.js.map +1 -0
  50. package/dist/evm/abi/CommitStore_1_5.js +1 -1
  51. package/dist/evm/abi/LockReleaseTokenPool_1_5.js +1 -1
  52. package/dist/evm/abi/OffRamp_1_5.js +1 -1
  53. package/dist/evm/abi/OnRamp_1_5.js +1 -1
  54. package/dist/evm/abi/PriceRegistry_1_2.d.ts +443 -0
  55. package/dist/evm/abi/PriceRegistry_1_2.d.ts.map +1 -0
  56. package/dist/evm/abi/PriceRegistry_1_2.js +439 -0
  57. package/dist/evm/abi/PriceRegistry_1_2.js.map +1 -0
  58. package/dist/evm/const.d.ts +1 -0
  59. package/dist/evm/const.d.ts.map +1 -1
  60. package/dist/evm/const.js +2 -0
  61. package/dist/evm/const.js.map +1 -1
  62. package/dist/evm/hasher.d.ts.map +1 -1
  63. package/dist/evm/hasher.js +7 -6
  64. package/dist/evm/hasher.js.map +1 -1
  65. package/dist/evm/index.d.ts +9 -13
  66. package/dist/evm/index.d.ts.map +1 -1
  67. package/dist/evm/index.js +85 -68
  68. package/dist/evm/index.js.map +1 -1
  69. package/dist/evm/logs.d.ts.map +1 -1
  70. package/dist/evm/logs.js +47 -16
  71. package/dist/evm/logs.js.map +1 -1
  72. package/dist/evm/messages.d.ts +7 -6
  73. package/dist/evm/messages.d.ts.map +1 -1
  74. package/dist/evm/offchain.js +1 -1
  75. package/dist/evm/offchain.js.map +1 -1
  76. package/dist/evm/types.d.ts +10 -0
  77. package/dist/evm/types.d.ts.map +1 -0
  78. package/dist/evm/types.js +2 -0
  79. package/dist/evm/types.js.map +1 -0
  80. package/dist/execution.d.ts.map +1 -1
  81. package/dist/execution.js +9 -5
  82. package/dist/execution.js.map +1 -1
  83. package/dist/extra-args.d.ts.map +1 -1
  84. package/dist/extra-args.js +4 -3
  85. package/dist/extra-args.js.map +1 -1
  86. package/dist/gas.d.ts.map +1 -1
  87. package/dist/gas.js +3 -2
  88. package/dist/gas.js.map +1 -1
  89. package/dist/hasher/hasher.d.ts.map +1 -1
  90. package/dist/hasher/hasher.js +2 -1
  91. package/dist/hasher/hasher.js.map +1 -1
  92. package/dist/hasher/merklemulti.d.ts.map +1 -1
  93. package/dist/hasher/merklemulti.js +9 -8
  94. package/dist/hasher/merklemulti.js.map +1 -1
  95. package/dist/index.d.ts +5 -2
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +6 -2
  98. package/dist/index.js.map +1 -1
  99. package/dist/offchain.d.ts.map +1 -1
  100. package/dist/offchain.js +5 -8
  101. package/dist/offchain.js.map +1 -1
  102. package/dist/requests.d.ts +1 -1
  103. package/dist/requests.d.ts.map +1 -1
  104. package/dist/requests.js +37 -43
  105. package/dist/requests.js.map +1 -1
  106. package/dist/selectors.d.ts.map +1 -1
  107. package/dist/selectors.js +22 -0
  108. package/dist/selectors.js.map +1 -1
  109. package/dist/solana/cleanup.d.ts +2 -2
  110. package/dist/solana/cleanup.d.ts.map +1 -1
  111. package/dist/solana/cleanup.js +2 -3
  112. package/dist/solana/cleanup.js.map +1 -1
  113. package/dist/solana/exec.d.ts.map +1 -1
  114. package/dist/solana/exec.js +12 -12
  115. package/dist/solana/exec.js.map +1 -1
  116. package/dist/solana/hasher.d.ts.map +1 -1
  117. package/dist/solana/hasher.js +6 -5
  118. package/dist/solana/hasher.js.map +1 -1
  119. package/dist/solana/index.d.ts +30 -13
  120. package/dist/solana/index.d.ts.map +1 -1
  121. package/dist/solana/index.js +96 -143
  122. package/dist/solana/index.js.map +1 -1
  123. package/dist/solana/logs.d.ts +15 -0
  124. package/dist/solana/logs.d.ts.map +1 -0
  125. package/dist/solana/logs.js +106 -0
  126. package/dist/solana/logs.js.map +1 -0
  127. package/dist/solana/offchain.d.ts.map +1 -1
  128. package/dist/solana/offchain.js +6 -5
  129. package/dist/solana/offchain.js.map +1 -1
  130. package/dist/solana/patchBorsh.d.ts.map +1 -1
  131. package/dist/solana/patchBorsh.js +3 -2
  132. package/dist/solana/patchBorsh.js.map +1 -1
  133. package/dist/solana/send.d.ts.map +1 -1
  134. package/dist/solana/send.js +8 -7
  135. package/dist/solana/send.js.map +1 -1
  136. package/dist/solana/utils.d.ts +7 -8
  137. package/dist/solana/utils.d.ts.map +1 -1
  138. package/dist/solana/utils.js +23 -11
  139. package/dist/solana/utils.js.map +1 -1
  140. package/dist/sui/discovery.d.ts +18 -0
  141. package/dist/sui/discovery.d.ts.map +1 -0
  142. package/dist/sui/discovery.js +116 -0
  143. package/dist/sui/discovery.js.map +1 -0
  144. package/dist/sui/events.d.ts +36 -0
  145. package/dist/sui/events.d.ts.map +1 -0
  146. package/dist/sui/events.js +179 -0
  147. package/dist/sui/events.js.map +1 -0
  148. package/dist/sui/hasher.d.ts.map +1 -1
  149. package/dist/sui/hasher.js +6 -5
  150. package/dist/sui/hasher.js.map +1 -1
  151. package/dist/sui/index.d.ts +69 -41
  152. package/dist/sui/index.d.ts.map +1 -1
  153. package/dist/sui/index.js +402 -65
  154. package/dist/sui/index.js.map +1 -1
  155. package/dist/sui/manuallyExec/encoder.d.ts +8 -0
  156. package/dist/sui/manuallyExec/encoder.d.ts.map +1 -0
  157. package/dist/sui/manuallyExec/encoder.js +76 -0
  158. package/dist/sui/manuallyExec/encoder.js.map +1 -0
  159. package/dist/sui/manuallyExec/index.d.ts +37 -0
  160. package/dist/sui/manuallyExec/index.d.ts.map +1 -0
  161. package/dist/sui/manuallyExec/index.js +81 -0
  162. package/dist/sui/manuallyExec/index.js.map +1 -0
  163. package/dist/sui/objects.d.ts +46 -0
  164. package/dist/sui/objects.d.ts.map +1 -0
  165. package/dist/sui/objects.js +259 -0
  166. package/dist/sui/objects.js.map +1 -0
  167. package/dist/ton/bindings/offramp.d.ts +48 -0
  168. package/dist/ton/bindings/offramp.d.ts.map +1 -0
  169. package/dist/ton/bindings/offramp.js +63 -0
  170. package/dist/ton/bindings/offramp.js.map +1 -0
  171. package/dist/ton/bindings/onramp.d.ts +40 -0
  172. package/dist/ton/bindings/onramp.d.ts.map +1 -0
  173. package/dist/ton/bindings/onramp.js +51 -0
  174. package/dist/ton/bindings/onramp.js.map +1 -0
  175. package/dist/ton/bindings/router.d.ts +47 -0
  176. package/dist/ton/bindings/router.d.ts.map +1 -0
  177. package/dist/ton/bindings/router.js +51 -0
  178. package/dist/ton/bindings/router.js.map +1 -0
  179. package/dist/ton/exec.d.ts +18 -0
  180. package/dist/ton/exec.d.ts.map +1 -0
  181. package/dist/ton/exec.js +28 -0
  182. package/dist/ton/exec.js.map +1 -0
  183. package/dist/ton/hasher.d.ts +27 -0
  184. package/dist/ton/hasher.d.ts.map +1 -0
  185. package/dist/ton/hasher.js +134 -0
  186. package/dist/ton/hasher.js.map +1 -0
  187. package/dist/ton/index.d.ts +247 -0
  188. package/dist/ton/index.d.ts.map +1 -0
  189. package/dist/ton/index.js +781 -0
  190. package/dist/ton/index.js.map +1 -0
  191. package/dist/ton/logs.d.ts +26 -0
  192. package/dist/ton/logs.d.ts.map +1 -0
  193. package/dist/ton/logs.js +126 -0
  194. package/dist/ton/logs.js.map +1 -0
  195. package/dist/ton/types.d.ts +37 -0
  196. package/dist/ton/types.d.ts.map +1 -0
  197. package/dist/ton/types.js +92 -0
  198. package/dist/ton/types.js.map +1 -0
  199. package/dist/ton/utils.d.ts +67 -0
  200. package/dist/ton/utils.d.ts.map +1 -0
  201. package/dist/ton/utils.js +425 -0
  202. package/dist/ton/utils.js.map +1 -0
  203. package/dist/types.d.ts +4 -2
  204. package/dist/types.d.ts.map +1 -1
  205. package/dist/types.js +1 -0
  206. package/dist/types.js.map +1 -1
  207. package/dist/utils.d.ts +10 -0
  208. package/dist/utils.d.ts.map +1 -1
  209. package/dist/utils.js +52 -17
  210. package/dist/utils.js.map +1 -1
  211. package/package.json +12 -10
  212. package/src/aptos/hasher.ts +10 -6
  213. package/src/aptos/index.ts +50 -31
  214. package/src/aptos/logs.ts +85 -29
  215. package/src/aptos/token.ts +5 -1
  216. package/src/aptos/types.ts +6 -6
  217. package/src/chain.ts +83 -12
  218. package/src/commits.ts +23 -11
  219. package/src/errors/CCIPError.ts +86 -0
  220. package/src/errors/codes.ts +179 -0
  221. package/src/errors/index.ts +175 -0
  222. package/src/errors/recovery.ts +170 -0
  223. package/src/errors/specialized.ts +1655 -0
  224. package/src/errors/utils.ts +73 -0
  225. package/src/evm/abi/CommitStore_1_5.ts +1 -1
  226. package/src/evm/abi/LockReleaseTokenPool_1_5.ts +1 -1
  227. package/src/evm/abi/OffRamp_1_5.ts +1 -1
  228. package/src/evm/abi/OnRamp_1_5.ts +1 -1
  229. package/src/evm/abi/PriceRegistry_1_2.ts +438 -0
  230. package/src/evm/const.ts +2 -0
  231. package/src/evm/hasher.ts +7 -6
  232. package/src/evm/index.ts +104 -86
  233. package/src/evm/logs.ts +64 -16
  234. package/src/evm/messages.ts +14 -14
  235. package/src/evm/offchain.ts +1 -1
  236. package/src/evm/types.ts +11 -0
  237. package/src/execution.ts +13 -9
  238. package/src/extra-args.ts +4 -3
  239. package/src/gas.ts +10 -3
  240. package/src/hasher/hasher.ts +2 -1
  241. package/src/hasher/merklemulti.ts +18 -8
  242. package/src/index.ts +14 -2
  243. package/src/offchain.ts +10 -14
  244. package/src/requests.ts +51 -53
  245. package/src/selectors.ts +23 -0
  246. package/src/solana/cleanup.ts +2 -4
  247. package/src/solana/exec.ts +13 -13
  248. package/src/solana/hasher.ts +9 -5
  249. package/src/solana/index.ts +126 -200
  250. package/src/solana/logs.ts +155 -0
  251. package/src/solana/offchain.ts +10 -7
  252. package/src/solana/patchBorsh.ts +3 -2
  253. package/src/solana/send.ts +14 -7
  254. package/src/solana/utils.ts +31 -17
  255. package/src/sui/discovery.ts +163 -0
  256. package/src/sui/events.ts +328 -0
  257. package/src/sui/hasher.ts +6 -5
  258. package/src/sui/index.ts +528 -80
  259. package/src/sui/manuallyExec/encoder.ts +88 -0
  260. package/src/sui/manuallyExec/index.ts +137 -0
  261. package/src/sui/objects.ts +358 -0
  262. package/src/ton/bindings/offramp.ts +96 -0
  263. package/src/ton/bindings/onramp.ts +72 -0
  264. package/src/ton/bindings/router.ts +65 -0
  265. package/src/ton/exec.ts +44 -0
  266. package/src/ton/hasher.ts +184 -0
  267. package/src/ton/index.ts +989 -0
  268. package/src/ton/logs.ts +157 -0
  269. package/src/ton/types.ts +143 -0
  270. package/src/ton/utils.ts +514 -0
  271. package/src/types.ts +6 -2
  272. package/src/utils.ts +58 -23
  273. package/tsconfig.json +2 -1
@@ -0,0 +1,73 @@
1
+ import { CCIPError } from './CCIPError.ts'
2
+ import type { CCIPErrorCode } from './codes.ts'
3
+
4
+ /** Returns retry delay in ms, or null if permanent. */
5
+ export function getRetryDelay(error: CCIPError): number | null {
6
+ if (!error.isTransient) return null
7
+ return error.retryAfterMs ?? getDefaultRetryDelay(error.code)
8
+ }
9
+
10
+ function getDefaultRetryDelay(code: CCIPErrorCode): number {
11
+ switch (code) {
12
+ case 'BLOCK_NOT_FOUND':
13
+ return 12000
14
+ case 'MESSAGE_ID_NOT_FOUND':
15
+ case 'MESSAGE_NOT_FOUND_IN_TX':
16
+ return 30000
17
+ case 'COMMIT_NOT_FOUND':
18
+ return 60000
19
+ case 'HTTP_ERROR':
20
+ return 5000
21
+ case 'USDC_ATTESTATION_FAILED':
22
+ case 'LBTC_ATTESTATION_ERROR':
23
+ return 30000
24
+ default:
25
+ return 5000
26
+ }
27
+ }
28
+
29
+ /** Returns true if error is transient and should be retried. */
30
+ export function shouldRetry(error: unknown): boolean {
31
+ if (error instanceof CCIPError) {
32
+ return error.isTransient
33
+ }
34
+ if (error instanceof Error) {
35
+ const msg = error.message.toLowerCase()
36
+ return (
37
+ msg.includes('timeout') ||
38
+ msg.includes('econnrefused') ||
39
+ msg.includes('network') ||
40
+ msg.includes('rate limit')
41
+ )
42
+ }
43
+ return false
44
+ }
45
+
46
+ /** Format error for structured logging. */
47
+ export function formatErrorForLogging(error: CCIPError): Record<string, unknown> {
48
+ return {
49
+ name: error.name,
50
+ code: error.code,
51
+ message: error.message,
52
+ isTransient: error.isTransient,
53
+ context: error.context,
54
+ recovery: error.recovery,
55
+ stack: error.stack,
56
+ cause:
57
+ error.cause instanceof Error
58
+ ? { name: error.cause.name, message: error.cause.message }
59
+ : error.cause,
60
+ }
61
+ }
62
+
63
+ /** Assert condition or throw CCIPError. */
64
+ export function assert(
65
+ condition: unknown,
66
+ code: CCIPErrorCode,
67
+ message: string,
68
+ context?: Record<string, unknown>,
69
+ ): asserts condition {
70
+ if (!condition) {
71
+ throw new CCIPError(code, message, { context, isTransient: false })
72
+ }
73
+ }
@@ -1,6 +1,6 @@
1
1
  export default [
2
2
  // generate:
3
- // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.14.0-ccip1.5/core/gethwrappers/ccip/generated/commit_store/commit_store.go')
3
+ // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.17.0-ccip1.5/core/gethwrappers/ccip/generated/commit_store/commit_store.go')
4
4
  // .then((res) => res.text())
5
5
  // .then((body) => body.match(/^\s*ABI: "(.*?)",$/m)?.[1])
6
6
  // .then((abi) => JSON.parse(abi.replace(/\\"/g, '"')))
@@ -1,6 +1,6 @@
1
1
  export default [
2
2
  // generate:
3
- // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.14.0-ccip1.5/core/gethwrappers/ccip/generated/lock_release_token_pool/lock_release_token_pool.go')
3
+ // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.17.0-ccip1.5/core/gethwrappers/ccip/generated/lock_release_token_pool/lock_release_token_pool.go')
4
4
  // .then((res) => res.text())
5
5
  // .then((body) => body.match(/^\s*ABI: "(.*?)",$/m)?.[1])
6
6
  // .then((abi) => JSON.parse(abi.replace(/\\"/g, '"')))
@@ -1,6 +1,6 @@
1
1
  export default [
2
2
  // generate:
3
- // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.14.0-ccip1.5/core/gethwrappers/ccip/generated/evm_2_evm_offramp/evm_2_evm_offramp.go')
3
+ // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.17.0-ccip1.5/core/gethwrappers/ccip/generated/evm_2_evm_offramp/evm_2_evm_offramp.go')
4
4
  // .then((res) => res.text())
5
5
  // .then((body) => body.match(/^\s*ABI: "(.*?)",$/m)?.[1])
6
6
  // .then((abi) => JSON.parse(abi.replace(/\\"/g, '"')))
@@ -1,6 +1,6 @@
1
1
  export default [
2
2
  // generate:
3
- // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.14.0-ccip1.5/core/gethwrappers/ccip/generated/evm_2_evm_onramp/evm_2_evm_onramp.go')
3
+ // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.17.0-ccip1.5/core/gethwrappers/ccip/generated/evm_2_evm_onramp/evm_2_evm_onramp.go')
4
4
  // .then((res) => res.text())
5
5
  // .then((body) => body.match(/^\s*ABI: "(.*?)",$/m)?.[1])
6
6
  // .then((abi) => JSON.parse(abi.replace(/\\"/g, '"')))
@@ -0,0 +1,438 @@
1
+ export default [
2
+ // generate:
3
+ // fetch('https://github.com/smartcontractkit/ccip/raw/release/2.17.0-ccip1.5/core/gethwrappers/ccip/generated/price_registry_1_2_0/price_registry.go')
4
+ // .then((res) => res.text())
5
+ // .then((body) => body.match(/^\s*ABI: "(.*?)",$/m)?.[1])
6
+ // .then((abi) => JSON.parse(abi.replace(/\\"/g, '"')))
7
+ // .then((obj) => require('util').inspect(obj, {depth:99}).split('\n').slice(1, -1))
8
+ {
9
+ inputs: [
10
+ {
11
+ internalType: 'address[]',
12
+ name: 'priceUpdaters',
13
+ type: 'address[]',
14
+ },
15
+ {
16
+ internalType: 'address[]',
17
+ name: 'feeTokens',
18
+ type: 'address[]',
19
+ },
20
+ {
21
+ internalType: 'uint32',
22
+ name: 'stalenessThreshold',
23
+ type: 'uint32',
24
+ },
25
+ ],
26
+ stateMutability: 'nonpayable',
27
+ type: 'constructor',
28
+ },
29
+ {
30
+ inputs: [{ internalType: 'uint64', name: 'chain', type: 'uint64' }],
31
+ name: 'ChainNotSupported',
32
+ type: 'error',
33
+ },
34
+ { inputs: [], name: 'InvalidStalenessThreshold', type: 'error' },
35
+ { inputs: [], name: 'OnlyCallableByUpdaterOrOwner', type: 'error' },
36
+ {
37
+ inputs: [
38
+ {
39
+ internalType: 'uint64',
40
+ name: 'destChainSelector',
41
+ type: 'uint64',
42
+ },
43
+ { internalType: 'uint256', name: 'threshold', type: 'uint256' },
44
+ { internalType: 'uint256', name: 'timePassed', type: 'uint256' },
45
+ ],
46
+ name: 'StaleGasPrice',
47
+ type: 'error',
48
+ },
49
+ {
50
+ inputs: [
51
+ { internalType: 'address', name: 'token', type: 'address' },
52
+ { internalType: 'uint256', name: 'threshold', type: 'uint256' },
53
+ { internalType: 'uint256', name: 'timePassed', type: 'uint256' },
54
+ ],
55
+ name: 'StaleTokenPrice',
56
+ type: 'error',
57
+ },
58
+ {
59
+ inputs: [{ internalType: 'address', name: 'token', type: 'address' }],
60
+ name: 'TokenNotSupported',
61
+ type: 'error',
62
+ },
63
+ {
64
+ anonymous: false,
65
+ inputs: [
66
+ {
67
+ indexed: true,
68
+ internalType: 'address',
69
+ name: 'feeToken',
70
+ type: 'address',
71
+ },
72
+ ],
73
+ name: 'FeeTokenAdded',
74
+ type: 'event',
75
+ },
76
+ {
77
+ anonymous: false,
78
+ inputs: [
79
+ {
80
+ indexed: true,
81
+ internalType: 'address',
82
+ name: 'feeToken',
83
+ type: 'address',
84
+ },
85
+ ],
86
+ name: 'FeeTokenRemoved',
87
+ type: 'event',
88
+ },
89
+ {
90
+ anonymous: false,
91
+ inputs: [
92
+ {
93
+ indexed: true,
94
+ internalType: 'address',
95
+ name: 'from',
96
+ type: 'address',
97
+ },
98
+ {
99
+ indexed: true,
100
+ internalType: 'address',
101
+ name: 'to',
102
+ type: 'address',
103
+ },
104
+ ],
105
+ name: 'OwnershipTransferRequested',
106
+ type: 'event',
107
+ },
108
+ {
109
+ anonymous: false,
110
+ inputs: [
111
+ {
112
+ indexed: true,
113
+ internalType: 'address',
114
+ name: 'from',
115
+ type: 'address',
116
+ },
117
+ {
118
+ indexed: true,
119
+ internalType: 'address',
120
+ name: 'to',
121
+ type: 'address',
122
+ },
123
+ ],
124
+ name: 'OwnershipTransferred',
125
+ type: 'event',
126
+ },
127
+ {
128
+ anonymous: false,
129
+ inputs: [
130
+ {
131
+ indexed: true,
132
+ internalType: 'address',
133
+ name: 'priceUpdater',
134
+ type: 'address',
135
+ },
136
+ ],
137
+ name: 'PriceUpdaterRemoved',
138
+ type: 'event',
139
+ },
140
+ {
141
+ anonymous: false,
142
+ inputs: [
143
+ {
144
+ indexed: true,
145
+ internalType: 'address',
146
+ name: 'priceUpdater',
147
+ type: 'address',
148
+ },
149
+ ],
150
+ name: 'PriceUpdaterSet',
151
+ type: 'event',
152
+ },
153
+ {
154
+ anonymous: false,
155
+ inputs: [
156
+ {
157
+ indexed: true,
158
+ internalType: 'address',
159
+ name: 'token',
160
+ type: 'address',
161
+ },
162
+ {
163
+ indexed: false,
164
+ internalType: 'uint256',
165
+ name: 'value',
166
+ type: 'uint256',
167
+ },
168
+ {
169
+ indexed: false,
170
+ internalType: 'uint256',
171
+ name: 'timestamp',
172
+ type: 'uint256',
173
+ },
174
+ ],
175
+ name: 'UsdPerTokenUpdated',
176
+ type: 'event',
177
+ },
178
+ {
179
+ anonymous: false,
180
+ inputs: [
181
+ {
182
+ indexed: true,
183
+ internalType: 'uint64',
184
+ name: 'destChain',
185
+ type: 'uint64',
186
+ },
187
+ {
188
+ indexed: false,
189
+ internalType: 'uint256',
190
+ name: 'value',
191
+ type: 'uint256',
192
+ },
193
+ {
194
+ indexed: false,
195
+ internalType: 'uint256',
196
+ name: 'timestamp',
197
+ type: 'uint256',
198
+ },
199
+ ],
200
+ name: 'UsdPerUnitGasUpdated',
201
+ type: 'event',
202
+ },
203
+ {
204
+ inputs: [],
205
+ name: 'acceptOwnership',
206
+ outputs: [],
207
+ stateMutability: 'nonpayable',
208
+ type: 'function',
209
+ },
210
+ {
211
+ inputs: [
212
+ {
213
+ internalType: 'address[]',
214
+ name: 'feeTokensToAdd',
215
+ type: 'address[]',
216
+ },
217
+ {
218
+ internalType: 'address[]',
219
+ name: 'feeTokensToRemove',
220
+ type: 'address[]',
221
+ },
222
+ ],
223
+ name: 'applyFeeTokensUpdates',
224
+ outputs: [],
225
+ stateMutability: 'nonpayable',
226
+ type: 'function',
227
+ },
228
+ {
229
+ inputs: [
230
+ {
231
+ internalType: 'address[]',
232
+ name: 'priceUpdatersToAdd',
233
+ type: 'address[]',
234
+ },
235
+ {
236
+ internalType: 'address[]',
237
+ name: 'priceUpdatersToRemove',
238
+ type: 'address[]',
239
+ },
240
+ ],
241
+ name: 'applyPriceUpdatersUpdates',
242
+ outputs: [],
243
+ stateMutability: 'nonpayable',
244
+ type: 'function',
245
+ },
246
+ {
247
+ inputs: [
248
+ { internalType: 'address', name: 'fromToken', type: 'address' },
249
+ {
250
+ internalType: 'uint256',
251
+ name: 'fromTokenAmount',
252
+ type: 'uint256',
253
+ },
254
+ { internalType: 'address', name: 'toToken', type: 'address' },
255
+ ],
256
+ name: 'convertTokenAmount',
257
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
258
+ stateMutability: 'view',
259
+ type: 'function',
260
+ },
261
+ {
262
+ inputs: [
263
+ {
264
+ internalType: 'uint64',
265
+ name: 'destChainSelector',
266
+ type: 'uint64',
267
+ },
268
+ ],
269
+ name: 'getDestinationChainGasPrice',
270
+ outputs: [
271
+ {
272
+ components: [
273
+ { internalType: 'uint224', name: 'value', type: 'uint224' },
274
+ { internalType: 'uint32', name: 'timestamp', type: 'uint32' },
275
+ ],
276
+ internalType: 'structInternal.TimestampedPackedUint224',
277
+ name: '',
278
+ type: 'tuple',
279
+ },
280
+ ],
281
+ stateMutability: 'view',
282
+ type: 'function',
283
+ },
284
+ {
285
+ inputs: [],
286
+ name: 'getFeeTokens',
287
+ outputs: [{ internalType: 'address[]', name: '', type: 'address[]' }],
288
+ stateMutability: 'view',
289
+ type: 'function',
290
+ },
291
+ {
292
+ inputs: [],
293
+ name: 'getPriceUpdaters',
294
+ outputs: [{ internalType: 'address[]', name: '', type: 'address[]' }],
295
+ stateMutability: 'view',
296
+ type: 'function',
297
+ },
298
+ {
299
+ inputs: [],
300
+ name: 'getStalenessThreshold',
301
+ outputs: [{ internalType: 'uint128', name: '', type: 'uint128' }],
302
+ stateMutability: 'view',
303
+ type: 'function',
304
+ },
305
+ {
306
+ inputs: [
307
+ { internalType: 'address', name: 'token', type: 'address' },
308
+ {
309
+ internalType: 'uint64',
310
+ name: 'destChainSelector',
311
+ type: 'uint64',
312
+ },
313
+ ],
314
+ name: 'getTokenAndGasPrices',
315
+ outputs: [
316
+ { internalType: 'uint224', name: 'tokenPrice', type: 'uint224' },
317
+ {
318
+ internalType: 'uint224',
319
+ name: 'gasPriceValue',
320
+ type: 'uint224',
321
+ },
322
+ ],
323
+ stateMutability: 'view',
324
+ type: 'function',
325
+ },
326
+ {
327
+ inputs: [{ internalType: 'address', name: 'token', type: 'address' }],
328
+ name: 'getTokenPrice',
329
+ outputs: [
330
+ {
331
+ components: [
332
+ { internalType: 'uint224', name: 'value', type: 'uint224' },
333
+ { internalType: 'uint32', name: 'timestamp', type: 'uint32' },
334
+ ],
335
+ internalType: 'structInternal.TimestampedPackedUint224',
336
+ name: '',
337
+ type: 'tuple',
338
+ },
339
+ ],
340
+ stateMutability: 'view',
341
+ type: 'function',
342
+ },
343
+ {
344
+ inputs: [{ internalType: 'address[]', name: 'tokens', type: 'address[]' }],
345
+ name: 'getTokenPrices',
346
+ outputs: [
347
+ {
348
+ components: [
349
+ { internalType: 'uint224', name: 'value', type: 'uint224' },
350
+ { internalType: 'uint32', name: 'timestamp', type: 'uint32' },
351
+ ],
352
+ internalType: 'structInternal.TimestampedPackedUint224[]',
353
+ name: '',
354
+ type: 'tuple[]',
355
+ },
356
+ ],
357
+ stateMutability: 'view',
358
+ type: 'function',
359
+ },
360
+ {
361
+ inputs: [{ internalType: 'address', name: 'token', type: 'address' }],
362
+ name: 'getValidatedTokenPrice',
363
+ outputs: [{ internalType: 'uint224', name: '', type: 'uint224' }],
364
+ stateMutability: 'view',
365
+ type: 'function',
366
+ },
367
+ {
368
+ inputs: [],
369
+ name: 'owner',
370
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
371
+ stateMutability: 'view',
372
+ type: 'function',
373
+ },
374
+ {
375
+ inputs: [{ internalType: 'address', name: 'to', type: 'address' }],
376
+ name: 'transferOwnership',
377
+ outputs: [],
378
+ stateMutability: 'nonpayable',
379
+ type: 'function',
380
+ },
381
+ {
382
+ inputs: [],
383
+ name: 'typeAndVersion',
384
+ outputs: [{ internalType: 'string', name: '', type: 'string' }],
385
+ stateMutability: 'view',
386
+ type: 'function',
387
+ },
388
+ {
389
+ inputs: [
390
+ {
391
+ components: [
392
+ {
393
+ components: [
394
+ {
395
+ internalType: 'address',
396
+ name: 'sourceToken',
397
+ type: 'address',
398
+ },
399
+ {
400
+ internalType: 'uint224',
401
+ name: 'usdPerToken',
402
+ type: 'uint224',
403
+ },
404
+ ],
405
+ internalType: 'structInternal.TokenPriceUpdate[]',
406
+ name: 'tokenPriceUpdates',
407
+ type: 'tuple[]',
408
+ },
409
+ {
410
+ components: [
411
+ {
412
+ internalType: 'uint64',
413
+ name: 'destChainSelector',
414
+ type: 'uint64',
415
+ },
416
+ {
417
+ internalType: 'uint224',
418
+ name: 'usdPerUnitGas',
419
+ type: 'uint224',
420
+ },
421
+ ],
422
+ internalType: 'structInternal.GasPriceUpdate[]',
423
+ name: 'gasPriceUpdates',
424
+ type: 'tuple[]',
425
+ },
426
+ ],
427
+ internalType: 'structInternal.PriceUpdates',
428
+ name: 'priceUpdates',
429
+ type: 'tuple',
430
+ },
431
+ ],
432
+ name: 'updatePrices',
433
+ outputs: [],
434
+ stateMutability: 'nonpayable',
435
+ type: 'function',
436
+ },
437
+ // generate:end
438
+ ] as const
package/src/evm/const.ts CHANGED
@@ -13,6 +13,7 @@ import OffRamp_1_6_ABI from './abi/OffRamp_1_6.ts'
13
13
  import EVM2EVMOnRamp_1_2_ABI from './abi/OnRamp_1_2.ts'
14
14
  import EVM2EVMOnRamp_1_5_ABI from './abi/OnRamp_1_5.ts'
15
15
  import OnRamp_1_6_ABI from './abi/OnRamp_1_6.ts'
16
+ import PriceRegistry_1_2_ABI from './abi/PriceRegistry_1_2.ts'
16
17
  import Router_ABI from './abi/Router.ts'
17
18
  import TokenAdminRegistry_ABI from './abi/TokenAdminRegistry_1_5.ts'
18
19
 
@@ -43,6 +44,7 @@ export const interfaces = {
43
44
  OnRamp_v1_6: new Interface(OnRamp_1_6_ABI),
44
45
  EVM2EVMOnRamp_v1_5: new Interface(EVM2EVMOnRamp_1_5_ABI),
45
46
  EVM2EVMOnRamp_v1_2: new Interface(EVM2EVMOnRamp_1_2_ABI),
47
+ PriceRegistry_v1_2: new Interface(PriceRegistry_1_2_ABI),
46
48
  Custom: new Interface(customErrors),
47
49
  } as const
48
50
 
package/src/evm/hasher.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { concat, id, keccak256, toBeHex, zeroPadValue } from 'ethers'
2
2
  import type { ReadonlyDeep } from 'type-fest'
3
3
 
4
+ import { CCIPExtraArgsInvalidError } from '../errors/index.ts'
4
5
  import { decodeExtraArgs } from '../extra-args.ts'
5
6
  import { type LeafHasher, LEAF_DOMAIN_SEPARATOR } from '../hasher/common.ts'
6
7
  import type { CCIPMessage, CCIPVersion, WithLogger } from '../types.ts'
@@ -112,13 +113,13 @@ export function getV16LeafHasher(
112
113
  logger.debug('Message', message)
113
114
  const parsedArgs = decodeExtraArgs(
114
115
  message.extraArgs,
115
- networkInfo(message.header.sourceChainSelector).family,
116
+ networkInfo(message.sourceChainSelector).family,
116
117
  )
117
118
  if (
118
119
  !parsedArgs ||
119
120
  (parsedArgs._tag !== 'EVMExtraArgsV1' && parsedArgs._tag !== 'EVMExtraArgsV2')
120
121
  )
121
- throw new Error('Invalid extraArgs, not EVMExtraArgsV1|2')
122
+ throw new CCIPExtraArgsInvalidError('EVM', message.extraArgs)
122
123
  const tokenAmounts = message.tokenAmounts.map((ta) => ({
123
124
  ...ta,
124
125
  sourcePoolAddress: zeroPadValue(getAddressBytes(ta.sourcePoolAddress), 32),
@@ -140,11 +141,11 @@ export function getV16LeafHasher(
140
141
  'uint64 nonce',
141
142
  ],
142
143
  [
143
- message.header.messageId,
144
+ message.messageId,
144
145
  message.receiver,
145
- message.header.sequenceNumber,
146
+ message.sequenceNumber,
146
147
  parsedArgs.gasLimit,
147
- message.header.nonce,
148
+ message.nonce,
148
149
  ],
149
150
  )
150
151
 
@@ -170,7 +171,7 @@ export function getV16LeafHasher(
170
171
  )
171
172
 
172
173
  logger.debug('v1.6 leafHasher:', {
173
- messageId: message.header.messageId,
174
+ messageId: message.messageId,
174
175
  encodedTokens,
175
176
  fixedSizeValues,
176
177
  packedValues,