@chainlink/ccip-sdk 0.95.0 → 0.97.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 (217) 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 +31 -19
  7. package/dist/api/index.d.ts.map +1 -1
  8. package/dist/api/index.js +46 -25
  9. package/dist/api/index.js.map +1 -1
  10. package/dist/api/types.d.ts +24 -30
  11. package/dist/api/types.d.ts.map +1 -1
  12. package/dist/aptos/exec.d.ts +2 -2
  13. package/dist/aptos/exec.d.ts.map +1 -1
  14. package/dist/aptos/exec.js.map +1 -1
  15. package/dist/aptos/hasher.d.ts.map +1 -1
  16. package/dist/aptos/hasher.js +1 -1
  17. package/dist/aptos/hasher.js.map +1 -1
  18. package/dist/aptos/index.d.ts +43 -15
  19. package/dist/aptos/index.d.ts.map +1 -1
  20. package/dist/aptos/index.js +112 -105
  21. package/dist/aptos/index.js.map +1 -1
  22. package/dist/aptos/types.d.ts +2 -19
  23. package/dist/aptos/types.d.ts.map +1 -1
  24. package/dist/aptos/types.js +0 -11
  25. package/dist/aptos/types.js.map +1 -1
  26. package/dist/chain.d.ts +734 -174
  27. package/dist/chain.d.ts.map +1 -1
  28. package/dist/chain.js +216 -31
  29. package/dist/chain.js.map +1 -1
  30. package/dist/commits.d.ts +4 -6
  31. package/dist/commits.d.ts.map +1 -1
  32. package/dist/commits.js +4 -4
  33. package/dist/commits.js.map +1 -1
  34. package/dist/errors/CCIPError.d.ts +33 -4
  35. package/dist/errors/CCIPError.d.ts.map +1 -1
  36. package/dist/errors/CCIPError.js +33 -4
  37. package/dist/errors/CCIPError.js.map +1 -1
  38. package/dist/errors/codes.d.ts +5 -0
  39. package/dist/errors/codes.d.ts.map +1 -1
  40. package/dist/errors/codes.js +5 -1
  41. package/dist/errors/codes.js.map +1 -1
  42. package/dist/errors/index.d.ts +2 -2
  43. package/dist/errors/index.d.ts.map +1 -1
  44. package/dist/errors/index.js +2 -2
  45. package/dist/errors/index.js.map +1 -1
  46. package/dist/errors/recovery.d.ts.map +1 -1
  47. package/dist/errors/recovery.js +6 -1
  48. package/dist/errors/recovery.js.map +1 -1
  49. package/dist/errors/specialized.d.ts +1702 -121
  50. package/dist/errors/specialized.d.ts.map +1 -1
  51. package/dist/errors/specialized.js +1729 -125
  52. package/dist/errors/specialized.js.map +1 -1
  53. package/dist/errors/utils.d.ts.map +1 -1
  54. package/dist/errors/utils.js +0 -1
  55. package/dist/errors/utils.js.map +1 -1
  56. package/dist/evm/abi/OffRamp_2_0.d.ts +764 -0
  57. package/dist/evm/abi/OffRamp_2_0.d.ts.map +1 -0
  58. package/dist/evm/abi/OffRamp_2_0.js +744 -0
  59. package/dist/evm/abi/OffRamp_2_0.js.map +1 -0
  60. package/dist/evm/abi/OnRamp_2_0.d.ts +925 -0
  61. package/dist/evm/abi/OnRamp_2_0.d.ts.map +1 -0
  62. package/dist/evm/abi/OnRamp_2_0.js +992 -0
  63. package/dist/evm/abi/OnRamp_2_0.js.map +1 -0
  64. package/dist/evm/const.d.ts +12 -2
  65. package/dist/evm/const.d.ts.map +1 -1
  66. package/dist/evm/const.js +8 -2
  67. package/dist/evm/const.js.map +1 -1
  68. package/dist/evm/errors.d.ts.map +1 -1
  69. package/dist/evm/errors.js +7 -2
  70. package/dist/evm/errors.js.map +1 -1
  71. package/dist/evm/extra-args.d.ts +25 -0
  72. package/dist/evm/extra-args.d.ts.map +1 -0
  73. package/dist/evm/extra-args.js +309 -0
  74. package/dist/evm/extra-args.js.map +1 -0
  75. package/dist/evm/gas.d.ts.map +1 -1
  76. package/dist/evm/gas.js +7 -12
  77. package/dist/evm/gas.js.map +1 -1
  78. package/dist/evm/hasher.d.ts.map +1 -1
  79. package/dist/evm/hasher.js +23 -13
  80. package/dist/evm/hasher.js.map +1 -1
  81. package/dist/evm/index.d.ts +140 -35
  82. package/dist/evm/index.d.ts.map +1 -1
  83. package/dist/evm/index.js +306 -226
  84. package/dist/evm/index.js.map +1 -1
  85. package/dist/evm/messages.d.ts +59 -5
  86. package/dist/evm/messages.d.ts.map +1 -1
  87. package/dist/evm/messages.js +210 -0
  88. package/dist/evm/messages.js.map +1 -1
  89. package/dist/evm/offchain.js.map +1 -1
  90. package/dist/evm/types.d.ts +7 -2
  91. package/dist/evm/types.d.ts.map +1 -1
  92. package/dist/evm/types.js +22 -1
  93. package/dist/evm/types.js.map +1 -1
  94. package/dist/execution.d.ts +62 -22
  95. package/dist/execution.d.ts.map +1 -1
  96. package/dist/execution.js +102 -51
  97. package/dist/execution.js.map +1 -1
  98. package/dist/extra-args.d.ts +113 -4
  99. package/dist/extra-args.d.ts.map +1 -1
  100. package/dist/extra-args.js +38 -3
  101. package/dist/extra-args.js.map +1 -1
  102. package/dist/gas.d.ts +31 -5
  103. package/dist/gas.d.ts.map +1 -1
  104. package/dist/gas.js +43 -9
  105. package/dist/gas.js.map +1 -1
  106. package/dist/index.d.ts +11 -10
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +8 -8
  109. package/dist/index.js.map +1 -1
  110. package/dist/requests.d.ts +101 -22
  111. package/dist/requests.d.ts.map +1 -1
  112. package/dist/requests.js +115 -24
  113. package/dist/requests.js.map +1 -1
  114. package/dist/selectors.d.ts.map +1 -1
  115. package/dist/selectors.js +24 -0
  116. package/dist/selectors.js.map +1 -1
  117. package/dist/shared/bcs-codecs.d.ts +61 -0
  118. package/dist/shared/bcs-codecs.d.ts.map +1 -0
  119. package/dist/shared/bcs-codecs.js +102 -0
  120. package/dist/shared/bcs-codecs.js.map +1 -0
  121. package/dist/shared/constants.d.ts +3 -0
  122. package/dist/shared/constants.d.ts.map +1 -0
  123. package/dist/shared/constants.js +3 -0
  124. package/dist/shared/constants.js.map +1 -0
  125. package/dist/solana/exec.d.ts +2 -2
  126. package/dist/solana/exec.d.ts.map +1 -1
  127. package/dist/solana/exec.js.map +1 -1
  128. package/dist/solana/index.d.ts +148 -30
  129. package/dist/solana/index.d.ts.map +1 -1
  130. package/dist/solana/index.js +137 -44
  131. package/dist/solana/index.js.map +1 -1
  132. package/dist/sui/hasher.d.ts.map +1 -1
  133. package/dist/sui/hasher.js +1 -1
  134. package/dist/sui/hasher.js.map +1 -1
  135. package/dist/sui/index.d.ts +49 -19
  136. package/dist/sui/index.d.ts.map +1 -1
  137. package/dist/sui/index.js +76 -43
  138. package/dist/sui/index.js.map +1 -1
  139. package/dist/sui/manuallyExec/encoder.d.ts +2 -2
  140. package/dist/sui/manuallyExec/encoder.d.ts.map +1 -1
  141. package/dist/sui/manuallyExec/encoder.js.map +1 -1
  142. package/dist/sui/manuallyExec/index.d.ts +2 -2
  143. package/dist/sui/manuallyExec/index.d.ts.map +1 -1
  144. package/dist/ton/exec.d.ts +2 -2
  145. package/dist/ton/exec.d.ts.map +1 -1
  146. package/dist/ton/exec.js.map +1 -1
  147. package/dist/ton/index.d.ts +66 -27
  148. package/dist/ton/index.d.ts.map +1 -1
  149. package/dist/ton/index.js +172 -47
  150. package/dist/ton/index.js.map +1 -1
  151. package/dist/ton/send.d.ts +52 -0
  152. package/dist/ton/send.d.ts.map +1 -0
  153. package/dist/ton/send.js +166 -0
  154. package/dist/ton/send.js.map +1 -0
  155. package/dist/ton/types.d.ts +2 -2
  156. package/dist/ton/types.d.ts.map +1 -1
  157. package/dist/ton/types.js.map +1 -1
  158. package/dist/types.d.ts +148 -12
  159. package/dist/types.d.ts.map +1 -1
  160. package/dist/types.js +6 -1
  161. package/dist/types.js.map +1 -1
  162. package/dist/utils.d.ts +79 -4
  163. package/dist/utils.d.ts.map +1 -1
  164. package/dist/utils.js +92 -7
  165. package/dist/utils.js.map +1 -1
  166. package/package.json +16 -11
  167. package/src/all-chains.ts +26 -0
  168. package/src/api/index.ts +58 -34
  169. package/src/api/types.ts +24 -31
  170. package/src/aptos/exec.ts +2 -2
  171. package/src/aptos/hasher.ts +1 -1
  172. package/src/aptos/index.ts +127 -129
  173. package/src/aptos/types.ts +2 -15
  174. package/src/chain.ts +837 -191
  175. package/src/commits.ts +9 -9
  176. package/src/errors/CCIPError.ts +33 -4
  177. package/src/errors/codes.ts +5 -1
  178. package/src/errors/index.ts +2 -1
  179. package/src/errors/recovery.ts +9 -1
  180. package/src/errors/specialized.ts +1745 -132
  181. package/src/errors/utils.ts +0 -1
  182. package/src/evm/abi/OffRamp_2_0.ts +743 -0
  183. package/src/evm/abi/OnRamp_2_0.ts +991 -0
  184. package/src/evm/const.ts +10 -3
  185. package/src/evm/errors.ts +6 -2
  186. package/src/evm/extra-args.ts +360 -0
  187. package/src/evm/gas.ts +14 -13
  188. package/src/evm/hasher.ts +30 -18
  189. package/src/evm/index.ts +376 -281
  190. package/src/evm/messages.ts +323 -11
  191. package/src/evm/offchain.ts +2 -2
  192. package/src/evm/types.ts +20 -2
  193. package/src/execution.ts +126 -71
  194. package/src/extra-args.ts +118 -4
  195. package/src/gas.ts +44 -11
  196. package/src/index.ts +14 -11
  197. package/src/requests.ts +128 -24
  198. package/src/selectors.ts +24 -0
  199. package/src/shared/bcs-codecs.ts +132 -0
  200. package/src/shared/constants.ts +2 -0
  201. package/src/solana/exec.ts +4 -4
  202. package/src/solana/index.ts +170 -82
  203. package/src/sui/hasher.ts +1 -1
  204. package/src/sui/index.ts +88 -56
  205. package/src/sui/manuallyExec/encoder.ts +2 -2
  206. package/src/sui/manuallyExec/index.ts +2 -2
  207. package/src/ton/exec.ts +2 -2
  208. package/src/ton/index.ts +220 -58
  209. package/src/ton/send.ts +222 -0
  210. package/src/ton/types.ts +2 -2
  211. package/src/types.ts +173 -30
  212. package/src/utils.ts +91 -7
  213. package/dist/aptos/utils.d.ts +0 -12
  214. package/dist/aptos/utils.d.ts.map +0 -1
  215. package/dist/aptos/utils.js +0 -15
  216. package/dist/aptos/utils.js.map +0 -1
  217. package/src/aptos/utils.ts +0 -24
@@ -1 +1 @@
1
- {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/ton/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,WAAW,CAAA;AAGhD,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,YAAY,CAAA;AAEnB;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAe,EACf,UAAiD,EACjD,IAA4B;IAE5B,iCAAiC;IACjC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAA;IAE7D,0DAA0D;IAC1D,MAAM,WAAW,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAE/D,gDAAgD;IAChD,MAAM,OAAO,GAAG,SAAS,EAAE;SACxB,SAAS,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,qCAAqC;SAC5E,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,sBAAsB;SACvC,YAAY,CAAC,gBAAgB,CAAC,CAAC,cAAc;SAC7C,UAAU,CAAC,WAAW,CAAC,CAAC,0CAA0C;SAClE,OAAO,EAAE,CAAA;IAEZ,OAAO;QACL,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;KACd,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/ton/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,WAAW,CAAA;AAGhD,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,YAAY,CAAA;AAEnB;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAe,EACf,UAAgD,EAChD,IAA4B;IAE5B,iCAAiC;IACjC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAA;IAE7D,0DAA0D;IAC1D,MAAM,WAAW,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAE/D,gDAAgD;IAChD,MAAM,OAAO,GAAG,SAAS,EAAE;SACxB,SAAS,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,qCAAqC;SAC5E,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,sBAAsB;SACvC,YAAY,CAAC,gBAAgB,CAAC,CAAC,cAAc;SAC7C,UAAU,CAAC,WAAW,CAAC,CAAC,0CAA0C;SAClE,OAAO,EAAE,CAAA;IAEZ,OAAO;QACL,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;KACd,CAAA;AACH,CAAC"}
@@ -4,9 +4,9 @@ import { type BytesLike } from 'ethers';
4
4
  import type { PickDeep } from 'type-fest';
5
5
  import { type ChainContext, type GetBalanceOpts, type LogFilter, Chain } from '../chain.ts';
6
6
  import { type EVMExtraArgsV2, type ExtraArgs } from '../extra-args.ts';
7
+ import type { LeafHasher } from '../hasher/common.ts';
7
8
  import { type CCIPExecution, type CCIPRequest, type ChainTransaction, type CommitReport, type ExecutionReceipt, type Lane, type Log_, type NetworkInfo, type OffchainTokenData, type WithLogger, ChainFamily } from '../types.ts';
8
9
  import { type CCIPMessage_V1_6_TON, type UnsignedTONTx } from './types.ts';
9
- import type { LeafHasher } from '../hasher/common.ts';
10
10
  export type { TONWallet, UnsignedTONTx } from './types.ts';
11
11
  /**
12
12
  * TON chain implementation supporting TON networks.
@@ -46,6 +46,7 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
46
46
  * @param url - RPC endpoint URL for TonClient (v2).
47
47
  * @param ctx - Context containing logger.
48
48
  * @returns A new TONChain instance.
49
+ * @throws {@link CCIPHttpError} if connection to the RPC endpoint fails
49
50
  */
50
51
  static fromUrl(url: string, ctx?: ChainContext): Promise<TONChain>;
51
52
  /**
@@ -57,6 +58,7 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
57
58
  *
58
59
  * @param block - Logical time (lt) as number, or 'finalized' for latest block timestamp
59
60
  * @returns Unix timestamp in seconds
61
+ * @throws {@link CCIPNotImplementedError} if lt is not in cache
60
62
  */
61
63
  getBlockTimestamp(block: number | 'finalized'): Promise<number>;
62
64
  /**
@@ -72,6 +74,8 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
72
74
  * @param tx - Transaction identifier in either format
73
75
  * @returns ChainTransaction with transaction details
74
76
  * Note: `blockNumber` contains logical time (lt), not block seqno
77
+ * @throws {@link CCIPArgumentInvalidError} if hash format is invalid
78
+ * @throws {@link CCIPTransactionNotFoundError} if transaction not found
75
79
  */
76
80
  getTransaction(tx: string | Transaction): Promise<ChainTransaction>;
77
81
  /**
@@ -81,38 +85,50 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
81
85
  * not block sequence numbers. This is because TON transaction APIs are indexed by lt.
82
86
  *
83
87
  * @param opts - Log filter options (startBlock/endBlock are interpreted as lt values)
88
+ * @throws {@link CCIPTopicsInvalidError} if topics format is invalid
84
89
  */
85
90
  getLogs(opts: LogFilter): AsyncIterableIterator<Log_>;
86
91
  /** {@inheritDoc Chain.getMessagesInBatch} */
87
- getMessagesInBatch<R extends PickDeep<CCIPRequest, 'lane' | `log.${'topics' | 'address' | 'blockNumber'}` | 'message.sequenceNumber'>>(_request: R, _commit: Pick<CommitReport, 'minSeqNr' | 'maxSeqNr'>, _opts?: {
88
- page?: number;
89
- }): Promise<R['message'][]>;
92
+ getMessagesInBatch<R extends PickDeep<CCIPRequest, 'lane' | `log.${'topics' | 'address' | 'blockNumber'}` | 'message.sequenceNumber'>>(request: R, range: Pick<CommitReport, 'minSeqNr' | 'maxSeqNr'>, opts?: Pick<LogFilter, 'page'>): Promise<R['message'][]>;
90
93
  /** {@inheritDoc Chain.typeAndVersion} */
91
94
  typeAndVersion(address: string): Promise<[type: string, version: string, typeAndVersion: string, suffix?: string | undefined]>;
92
95
  /** {@inheritDoc Chain.getRouterForOnRamp} */
93
96
  getRouterForOnRamp(onRamp: string, destChainSelector: bigint): Promise<string>;
94
97
  /** {@inheritDoc Chain.getRouterForOffRamp} */
95
98
  getRouterForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string>;
96
- /** {@inheritDoc Chain.getNativeTokenForRouter} */
99
+ /**
100
+ * {@inheritDoc Chain.getNativeTokenForRouter}
101
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
102
+ */
97
103
  getNativeTokenForRouter(_router: string): Promise<string>;
98
104
  /** {@inheritDoc Chain.getOffRampsForRouter} */
99
105
  getOffRampsForRouter(router: string, sourceChainSelector: bigint): Promise<string[]>;
100
106
  /** {@inheritDoc Chain.getOnRampForRouter} */
101
107
  getOnRampForRouter(router: string, destChainSelector: bigint): Promise<string>;
102
- /** {@inheritDoc Chain.getOnRampForOffRamp} */
103
- getOnRampForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string>;
104
- /** {@inheritDoc Chain.getCommitStoreForOffRamp} */
105
- getCommitStoreForOffRamp(offRamp: string): Promise<string>;
106
- /** {@inheritDoc Chain.getTokenForTokenPool} */
108
+ /**
109
+ * {@inheritDoc Chain.getOnRampsForOffRamp}
110
+ * @throws {@link CCIPSourceChainUnsupportedError} if source chain is not configured
111
+ */
112
+ getOnRampsForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string[]>;
113
+ /**
114
+ * {@inheritDoc Chain.getTokenForTokenPool}
115
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
116
+ */
107
117
  getTokenForTokenPool(_tokenPool: string): Promise<string>;
108
118
  /** {@inheritDoc Chain.getTokenInfo} */
109
119
  getTokenInfo(token: string): Promise<{
110
120
  symbol: string;
111
121
  decimals: number;
112
122
  }>;
113
- /** {@inheritDoc Chain.getBalance} */
114
- getBalance(_opts: GetBalanceOpts): Promise<bigint>;
115
- /** {@inheritDoc Chain.getTokenAdminRegistryFor} */
123
+ /**
124
+ * {@inheritDoc Chain.getBalance}
125
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
126
+ */
127
+ getBalance(opts: GetBalanceOpts): Promise<bigint>;
128
+ /**
129
+ * {@inheritDoc Chain.getTokenAdminRegistryFor}
130
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
131
+ */
116
132
  getTokenAdminRegistryFor(_address: string): Promise<string>;
117
133
  /**
118
134
  * Decodes a CCIP message from a TON log event.
@@ -167,7 +183,7 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
167
183
  * - sourceChainSelector: uint64 (8 bytes)
168
184
  * - sequenceNumber: uint64 (8 bytes)
169
185
  * - messageId: uint256 (32 bytes)
170
- * - state: uint8 (1 byte) - Untouched=0, InProgress=1, Success=2, Failure=3
186
+ * - state: uint8 (1 byte) - InProgress=1, Success=2, Failed=3
171
187
  *
172
188
  * @param log - Log with data field (base64-encoded BOC).
173
189
  * @returns ExecutionReceipt or undefined if not valid.
@@ -186,6 +202,7 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
186
202
  * and raw format strings ("workchain:hash").
187
203
  * @param bytes - Bytes or string to convert.
188
204
  * @returns TON raw address string in format "workchain:hash".
205
+ * @throws {@link CCIPArgumentInvalidError} if bytes length is invalid
189
206
  */
190
207
  static getAddress(bytes: BytesLike): string;
191
208
  /**
@@ -217,17 +234,24 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
217
234
  */
218
235
  static getDestLeafHasher(lane: Lane, _ctx?: WithLogger): LeafHasher;
219
236
  /** {@inheritDoc Chain.getFee} */
220
- getFee(_opts: Parameters<Chain['getFee']>[0]): Promise<bigint>;
237
+ getFee({ router, destChainSelector, message, }: Parameters<Chain['getFee']>[0]): Promise<bigint>;
221
238
  /** {@inheritDoc Chain.generateUnsignedSendMessage} */
222
- generateUnsignedSendMessage(_opts: Parameters<Chain['generateUnsignedSendMessage']>[0]): Promise<never>;
239
+ generateUnsignedSendMessage({ router, destChainSelector, message, sender, }: Parameters<Chain['generateUnsignedSendMessage']>[0]): Promise<UnsignedTONTx>;
223
240
  /** {@inheritDoc Chain.sendMessage} */
224
- sendMessage(_opts: Parameters<Chain['sendMessage']>[0]): Promise<CCIPRequest>;
241
+ sendMessage({ router, destChainSelector, message, wallet, }: Parameters<Chain['sendMessage']>[0]): Promise<CCIPRequest>;
225
242
  /** {@inheritDoc Chain.getOffchainTokenData} */
226
243
  getOffchainTokenData(request: CCIPRequest): Promise<OffchainTokenData[]>;
227
- /** {@inheritDoc Chain.generateUnsignedExecuteReport} */
228
- generateUnsignedExecuteReport({ offRamp, execReport, ...opts }: Parameters<Chain['generateUnsignedExecuteReport']>[0]): Promise<UnsignedTONTx>;
229
- /** {@inheritDoc Chain.executeReport} */
230
- executeReport(opts: Parameters<Chain['executeReport']>[0]): Promise<CCIPExecution>;
244
+ /**
245
+ * {@inheritDoc Chain.generateUnsignedExecute}
246
+ * @throws {@link CCIPExtraArgsInvalidError} if extra args are not EVMExtraArgsV2 format
247
+ */
248
+ generateUnsignedExecute(opts: Parameters<Chain['generateUnsignedExecute']>[0]): Promise<UnsignedTONTx>;
249
+ /**
250
+ * {@inheritDoc Chain.execute}
251
+ * @throws {@link CCIPWalletInvalidError} if wallet is not a valid TON wallet
252
+ * @throws {@link CCIPReceiptNotFoundError} if execution receipt not found within timeout
253
+ */
254
+ execute(opts: Parameters<Chain['execute']>[0]): Promise<CCIPExecution>;
231
255
  /**
232
256
  * Parses raw TON data into typed structures.
233
257
  * @param data - Raw data to parse.
@@ -238,15 +262,30 @@ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
238
262
  } & {
239
263
  _tag: "EVMExtraArgsV2";
240
264
  }) | undefined;
241
- /** {@inheritDoc Chain.getSupportedTokens} */
265
+ /**
266
+ * {@inheritDoc Chain.getSupportedTokens}
267
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
268
+ */
242
269
  getSupportedTokens(_address: string): Promise<string[]>;
243
- /** {@inheritDoc Chain.getRegistryTokenConfig} */
270
+ /**
271
+ * {@inheritDoc Chain.getRegistryTokenConfig}
272
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
273
+ */
244
274
  getRegistryTokenConfig(_address: string, _tokenName: string): Promise<never>;
245
- /** {@inheritDoc Chain.getTokenPoolConfigs} */
246
- getTokenPoolConfigs(_tokenPool: string): Promise<never>;
247
- /** {@inheritDoc Chain.getTokenPoolRemotes} */
275
+ /**
276
+ * {@inheritDoc Chain.getTokenPoolConfig}
277
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
278
+ */
279
+ getTokenPoolConfig(_tokenPool: string): Promise<never>;
280
+ /**
281
+ * {@inheritDoc Chain.getTokenPoolRemotes}
282
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
283
+ */
248
284
  getTokenPoolRemotes(_tokenPool: string): Promise<never>;
249
- /** {@inheritDoc Chain.getFeeTokens} */
285
+ /**
286
+ * {@inheritDoc Chain.getFeeTokens}
287
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
288
+ */
250
289
  getFeeTokens(_router: string): Promise<never>;
251
290
  }
252
291
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ton/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAoC,MAAM,WAAW,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,OAAO,EAAE,KAAK,SAAS,EAAyD,MAAM,QAAQ,CAAA;AAE9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGzC,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAY3F,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,kBAAkB,CAAA;AAEzF,OAAO,EACL,KAAK,aAAa,EAClB,KAA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U,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAkC5E;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO;;;cAvcG,gBAAgB;;IA8c7C;;;OAGG;IACG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI7D;;;OAGG;IACG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAIlF;;;OAGG;IACG,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAI5D;;;OAGG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAI7D;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CAGpD"}
package/dist/ton/index.js CHANGED
@@ -5,13 +5,15 @@ import { getAdapter } from 'axios';
5
5
  import { hexlify, isBytesLike, isHexString, toBeArray, toBeHex } from 'ethers';
6
6
  import { memoize } from 'micro-memoize';
7
7
  import { streamTransactionsForAddress } from "./logs.js";
8
+ import { generateUnsignedCcipSend, getFee as getFeeImpl } from "./send.js";
8
9
  import { Chain } from "../chain.js";
9
- import { CCIPArgumentInvalidError, CCIPExtraArgsInvalidError, CCIPHttpError, CCIPNotImplementedError, CCIPReceiptNotFoundError, CCIPSourceChainUnsupportedError, CCIPTopicsInvalidError, CCIPTransactionNotFoundError, CCIPWalletInvalidError, } from "../errors/specialized.js";
10
+ import { CCIPArgumentInvalidError, CCIPExecutionReportChainMismatchError, CCIPExtraArgsInvalidError, CCIPHttpError, CCIPNotImplementedError, CCIPReceiptNotFoundError, CCIPSourceChainUnsupportedError, CCIPTopicsInvalidError, CCIPTransactionNotFoundError, CCIPWalletInvalidError, } from "../errors/index.js";
10
11
  import { EVMExtraArgsV2Tag } from "../extra-args.js";
12
+ import { buildMessageForDest, getMessagesInBatch } from "../requests.js";
11
13
  import { supportedChains } from "../supported-chains.js";
12
- import { ChainFamily, ExecutionState, } from "../types.js";
14
+ import { CCIPVersion, ChainFamily, ExecutionState, } from "../types.js";
13
15
  import { bytesToBuffer, createRateLimitedFetch, decodeAddress, networkInfo, parseTypeAndVersion, sleep, } from "../utils.js";
14
- import { generateUnsignedExecuteReport as generateUnsignedExecuteReportImpl } from "./exec.js";
16
+ import { generateUnsignedExecuteReport } from "./exec.js";
15
17
  import { getTONLeafHasher } from "./hasher.js";
16
18
  import { isTONWallet } from "./types.js";
17
19
  import { crc32, lookupTxByRawHash, parseJettonContent } from "./utils.js";
@@ -122,6 +124,7 @@ export class TONChain extends Chain {
122
124
  * @param url - RPC endpoint URL for TonClient (v2).
123
125
  * @param ctx - Context containing logger.
124
126
  * @returns A new TONChain instance.
127
+ * @throws {@link CCIPHttpError} if connection to the RPC endpoint fails
125
128
  */
126
129
  static async fromUrl(url, ctx) {
127
130
  const { logger = console } = ctx ?? {};
@@ -159,6 +162,7 @@ export class TONChain extends Chain {
159
162
  *
160
163
  * @param block - Logical time (lt) as number, or 'finalized' for latest block timestamp
161
164
  * @returns Unix timestamp in seconds
165
+ * @throws {@link CCIPNotImplementedError} if lt is not in cache
162
166
  */
163
167
  async getBlockTimestamp(block) {
164
168
  if (typeof block != 'number') {
@@ -182,6 +186,8 @@ export class TONChain extends Chain {
182
186
  * @param tx - Transaction identifier in either format
183
187
  * @returns ChainTransaction with transaction details
184
188
  * Note: `blockNumber` contains logical time (lt), not block seqno
189
+ * @throws {@link CCIPArgumentInvalidError} if hash format is invalid
190
+ * @throws {@link CCIPTransactionNotFoundError} if transaction not found
185
191
  */
186
192
  async getTransaction(tx) {
187
193
  let address;
@@ -258,6 +264,7 @@ export class TONChain extends Chain {
258
264
  * not block sequence numbers. This is because TON transaction APIs are indexed by lt.
259
265
  *
260
266
  * @param opts - Log filter options (startBlock/endBlock are interpreted as lt values)
267
+ * @throws {@link CCIPTopicsInvalidError} if topics format is invalid
261
268
  */
262
269
  async *getLogs(opts) {
263
270
  let topics;
@@ -280,8 +287,8 @@ export class TONChain extends Chain {
280
287
  }
281
288
  }
282
289
  /** {@inheritDoc Chain.getMessagesInBatch} */
283
- async getMessagesInBatch(_request, _commit, _opts) {
284
- return Promise.reject(new CCIPNotImplementedError('getMessagesInBatch'));
290
+ async getMessagesInBatch(request, range, opts) {
291
+ return getMessagesInBatch(this, request, range, opts);
285
292
  }
286
293
  /** {@inheritDoc Chain.typeAndVersion} */
287
294
  async typeAndVersion(address) {
@@ -314,9 +321,14 @@ export class TONChain extends Chain {
314
321
  ]);
315
322
  return stack.readAddress().toRawString();
316
323
  }
317
- /** {@inheritDoc Chain.getNativeTokenForRouter} */
324
+ /**
325
+ * {@inheritDoc Chain.getNativeTokenForRouter}
326
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
327
+ */
318
328
  getNativeTokenForRouter(_router) {
319
- return Promise.reject(new CCIPNotImplementedError('getNativeTokenForRouter'));
329
+ // TON native token is represented as address 0:0...01 (workchain 0, hash = 1)
330
+ // This is a convention for representing native TON in CCIP
331
+ return Promise.resolve('0:0000000000000000000000000000000000000000000000000000000000000001');
320
332
  }
321
333
  /** {@inheritDoc Chain.getOffRampsForRouter} */
322
334
  async getOffRampsForRouter(router, sourceChainSelector) {
@@ -336,8 +348,11 @@ export class TONChain extends Chain {
336
348
  ]);
337
349
  return stack.readAddress().toRawString();
338
350
  }
339
- /** {@inheritDoc Chain.getOnRampForOffRamp} */
340
- async getOnRampForOffRamp(offRamp, sourceChainSelector) {
351
+ /**
352
+ * {@inheritDoc Chain.getOnRampsForOffRamp}
353
+ * @throws {@link CCIPSourceChainUnsupportedError} if source chain is not configured
354
+ */
355
+ async getOnRampsForOffRamp(offRamp, sourceChainSelector) {
341
356
  try {
342
357
  const offRampContract = this.provider.provider(Address.parse(offRamp));
343
358
  const { stack } = await offRampContract.get('sourceChainConfig', [
@@ -362,7 +377,7 @@ export class TONChain extends Chain {
362
377
  const onRampLength = onRampSlice.loadUint(8);
363
378
  onRamp = onRampSlice.loadBuffer(onRampLength);
364
379
  }
365
- return decodeAddress(onRamp, networkInfo(sourceChainSelector).family);
380
+ return [decodeAddress(onRamp, networkInfo(sourceChainSelector).family)];
366
381
  }
367
382
  catch (error) {
368
383
  if (isTvmError(error) && error.exitCode === 266) {
@@ -373,12 +388,10 @@ export class TONChain extends Chain {
373
388
  throw error;
374
389
  }
375
390
  }
376
- /** {@inheritDoc Chain.getCommitStoreForOffRamp} */
377
- async getCommitStoreForOffRamp(offRamp) {
378
- // TODO: FIXME: check assumption
379
- return Promise.resolve(offRamp);
380
- }
381
- /** {@inheritDoc Chain.getTokenForTokenPool} */
391
+ /**
392
+ * {@inheritDoc Chain.getTokenForTokenPool}
393
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
394
+ */
382
395
  async getTokenForTokenPool(_tokenPool) {
383
396
  return Promise.reject(new CCIPNotImplementedError('getTokenForTokenPool'));
384
397
  }
@@ -402,11 +415,39 @@ export class TONChain extends Chain {
402
415
  return { symbol: '', decimals: this.constructor.decimals };
403
416
  }
404
417
  }
405
- /** {@inheritDoc Chain.getBalance} */
406
- async getBalance(_opts) {
407
- return Promise.reject(new CCIPNotImplementedError('TONChain.getBalance'));
418
+ /**
419
+ * {@inheritDoc Chain.getBalance}
420
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
421
+ */
422
+ async getBalance(opts) {
423
+ const { holder, token } = opts;
424
+ const holderAddress = Address.parse(holder);
425
+ if (!token) {
426
+ // Get native TON balance
427
+ const state = await this.provider.getContractState(holderAddress);
428
+ return state.balance;
429
+ }
430
+ // For jetton balance, we need to:
431
+ // 1. Derive the jetton wallet address for this holder
432
+ // 2. Query the balance from that wallet contract
433
+ const jettonMaster = Address.parse(token);
434
+ const { stack } = await this.provider.runMethod(jettonMaster, 'get_wallet_address', [
435
+ { type: 'slice', cell: beginCell().storeAddress(holderAddress).endCell() },
436
+ ]);
437
+ const jettonWalletAddress = stack.readAddress();
438
+ try {
439
+ const { stack: balanceStack } = await this.provider.runMethod(jettonWalletAddress, 'get_wallet_data');
440
+ return balanceStack.readBigNumber(); // First value is balance
441
+ }
442
+ catch {
443
+ // Wallet doesn't exist yet = 0 balance
444
+ return 0n;
445
+ }
408
446
  }
409
- /** {@inheritDoc Chain.getTokenAdminRegistryFor} */
447
+ /**
448
+ * {@inheritDoc Chain.getTokenAdminRegistryFor}
449
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
450
+ */
410
451
  getTokenAdminRegistryFor(_address) {
411
452
  return Promise.reject(new CCIPNotImplementedError('getTokenAdminRegistryFor'));
412
453
  }
@@ -436,7 +477,7 @@ export class TONChain extends Chain {
436
477
  nonce: slice.loadUintBig(64),
437
478
  };
438
479
  // Load sender address
439
- const sender = slice.loadAddress().toString();
480
+ const sender = slice.loadAddress().toRawString();
440
481
  // Load body cell ref
441
482
  const bodyCell = slice.loadRef();
442
483
  // Load feeValueJuels (96 bits) at message level, after body ref
@@ -474,10 +515,7 @@ export class TONChain extends Chain {
474
515
  // Read allowOutOfOrderExecution (1 bit)
475
516
  const allowOutOfOrderExecution = extraArgsSlice.loadBit();
476
517
  // Build extraArgs as raw hex matching reference format
477
- const tagHex = extraArgsTag.toString(16).padStart(8, '0');
478
- const gasLimitHex = (hasGasLimit ? '8' : '0') + gasLimit.toString(16).padStart(63, '0');
479
- const oooByte = allowOutOfOrderExecution ? '40' : '00';
480
- const extraArgs = '0x' + tagHex + gasLimitHex + oooByte;
518
+ const extraArgs = '0x' + extraArgsCell.toBoc().toString('hex');
481
519
  // Load tokenAmounts from ref 3
482
520
  const _tokenAmountsCell = bodySlice.loadRef();
483
521
  const tokenAmounts = []; // TODO: FIXME: parse when implemented
@@ -623,7 +661,7 @@ export class TONChain extends Chain {
623
661
  * - sourceChainSelector: uint64 (8 bytes)
624
662
  * - sequenceNumber: uint64 (8 bytes)
625
663
  * - messageId: uint256 (32 bytes)
626
- * - state: uint8 (1 byte) - Untouched=0, InProgress=1, Success=2, Failure=3
664
+ * - state: uint8 (1 byte) - InProgress=1, Success=2, Failed=3
627
665
  *
628
666
  * @param log - Log with data field (base64-encoded BOC).
629
667
  * @returns ExecutionReceipt or undefined if not valid.
@@ -671,6 +709,7 @@ export class TONChain extends Chain {
671
709
  * and raw format strings ("workchain:hash").
672
710
  * @param bytes - Bytes or string to convert.
673
711
  * @returns TON raw address string in format "workchain:hash".
712
+ * @throws {@link CCIPArgumentInvalidError} if bytes length is invalid
674
713
  */
675
714
  static getAddress(bytes) {
676
715
  // If it's already a string address, try to parse and return raw format
@@ -785,40 +824,111 @@ export class TONChain extends Chain {
785
824
  return getTONLeafHasher(lane);
786
825
  }
787
826
  /** {@inheritDoc Chain.getFee} */
788
- async getFee(_opts) {
789
- return Promise.reject(new CCIPNotImplementedError('getFee'));
827
+ async getFee({ router, destChainSelector, message, }) {
828
+ return getFeeImpl(this, router, destChainSelector, buildMessageForDest(message, networkInfo(destChainSelector).family));
790
829
  }
791
830
  /** {@inheritDoc Chain.generateUnsignedSendMessage} */
792
- generateUnsignedSendMessage(_opts) {
793
- return Promise.reject(new CCIPNotImplementedError('generateUnsignedSendMessage'));
831
+ async generateUnsignedSendMessage({ router, destChainSelector, message, sender, }) {
832
+ // Convert MessageInput to AnyMessage with defaults
833
+ const populatedMessage = buildMessageForDest(message, networkInfo(destChainSelector).family);
834
+ // Calculate fee if not provided
835
+ const fee = message.fee ??
836
+ (await this.getFee({
837
+ router,
838
+ destChainSelector,
839
+ message: populatedMessage,
840
+ }));
841
+ const unsigned = generateUnsignedCcipSend(this, sender, router, destChainSelector, {
842
+ ...populatedMessage,
843
+ fee,
844
+ });
845
+ return {
846
+ family: ChainFamily.TON,
847
+ ...unsigned,
848
+ };
794
849
  }
795
850
  /** {@inheritDoc Chain.sendMessage} */
796
- async sendMessage(_opts) {
797
- return Promise.reject(new CCIPNotImplementedError('sendMessage'));
851
+ async sendMessage({ router, destChainSelector, message, wallet, }) {
852
+ if (!isTONWallet(wallet)) {
853
+ throw new CCIPWalletInvalidError(wallet);
854
+ }
855
+ const sender = await wallet.getAddress();
856
+ // Generate unsigned transaction with fee calculation if needed
857
+ const { family: _, ...unsigned } = await this.generateUnsignedSendMessage({
858
+ router,
859
+ destChainSelector,
860
+ message,
861
+ sender,
862
+ });
863
+ // Send transaction
864
+ const startTime = Math.floor(Date.now() / 1000);
865
+ const seqno = await wallet.sendTransaction(unsigned);
866
+ this.logger.info('CCIP send transaction submitted, seqno:', seqno);
867
+ // Wait for CCIPMessageSent event and extract the request
868
+ // Query the OnRamp for the CCIPMessageSent event
869
+ const onRamp = await this.getOnRampForRouter(router, destChainSelector);
870
+ // Poll for the message in recent logs
871
+ for await (const log of this.getLogs({
872
+ address: onRamp,
873
+ topics: [crc32('CCIPMessageSent')],
874
+ startTime,
875
+ watch: sleep(5 * 60e3 /* 5m timeout */),
876
+ })) {
877
+ const msg = TONChain.decodeMessage(log);
878
+ if (!msg)
879
+ continue;
880
+ // Found our message: construct and return the CCIPRequest
881
+ const tx = log.tx ?? (await this.getTransaction(log.transactionHash));
882
+ return {
883
+ lane: {
884
+ sourceChainSelector: this.network.chainSelector,
885
+ destChainSelector,
886
+ onRamp,
887
+ version: CCIPVersion.V1_6,
888
+ },
889
+ message: msg,
890
+ log,
891
+ tx,
892
+ };
893
+ }
894
+ throw new CCIPTransactionNotFoundError(seqno.toString());
798
895
  }
799
896
  /** {@inheritDoc Chain.getOffchainTokenData} */
800
897
  getOffchainTokenData(request) {
801
898
  return Promise.resolve(request.message.tokenAmounts.map(() => undefined));
802
899
  }
803
- /** {@inheritDoc Chain.generateUnsignedExecuteReport} */
804
- generateUnsignedExecuteReport({ offRamp, execReport, ...opts }) {
805
- if (!('allowOutOfOrderExecution' in execReport.message && 'gasLimit' in execReport.message)) {
900
+ /**
901
+ * {@inheritDoc Chain.generateUnsignedExecute}
902
+ * @throws {@link CCIPExtraArgsInvalidError} if extra args are not EVMExtraArgsV2 format
903
+ */
904
+ generateUnsignedExecute(opts) {
905
+ if (!('input' in opts &&
906
+ 'message' in opts.input &&
907
+ 'allowOutOfOrderExecution' in opts.input.message &&
908
+ 'gasLimit' in opts.input.message)) {
806
909
  throw new CCIPExtraArgsInvalidError('TON');
807
910
  }
808
- const unsigned = generateUnsignedExecuteReportImpl(offRamp, execReport, opts);
911
+ const { offRamp, input } = opts;
912
+ const unsigned = generateUnsignedExecuteReport(offRamp, input, opts);
809
913
  return Promise.resolve({
810
914
  family: ChainFamily.TON,
811
915
  ...unsigned,
812
916
  });
813
917
  }
814
- /** {@inheritDoc Chain.executeReport} */
815
- async executeReport(opts) {
918
+ /**
919
+ * {@inheritDoc Chain.execute}
920
+ * @throws {@link CCIPWalletInvalidError} if wallet is not a valid TON wallet
921
+ * @throws {@link CCIPReceiptNotFoundError} if execution receipt not found within timeout
922
+ */
923
+ async execute(opts) {
924
+ if (!('input' in opts && 'message' in opts.input))
925
+ throw new CCIPExecutionReportChainMismatchError('TON');
816
926
  const { offRamp, wallet } = opts;
817
927
  if (!isTONWallet(wallet)) {
818
928
  throw new CCIPWalletInvalidError(wallet);
819
929
  }
820
930
  const payer = await wallet.getAddress();
821
- const { family: _, ...unsigned } = await this.generateUnsignedExecuteReport({
931
+ const { family: _, ...unsigned } = await this.generateUnsignedExecute({
822
932
  ...opts,
823
933
  payer,
824
934
  });
@@ -828,7 +938,7 @@ export class TONChain extends Chain {
828
938
  value: toNano('0.3'),
829
939
  ...unsigned,
830
940
  });
831
- const message = opts.execReport.message;
941
+ const message = opts.input.message;
832
942
  for await (const exec of this.getExecutionReceipts({
833
943
  offRamp,
834
944
  messageId: message.messageId,
@@ -852,23 +962,38 @@ export class TONChain extends Chain {
852
962
  return parsedExtraArgs;
853
963
  }
854
964
  }
855
- /** {@inheritDoc Chain.getSupportedTokens} */
965
+ /**
966
+ * {@inheritDoc Chain.getSupportedTokens}
967
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
968
+ */
856
969
  async getSupportedTokens(_address) {
857
970
  return Promise.reject(new CCIPNotImplementedError('getSupportedTokens'));
858
971
  }
859
- /** {@inheritDoc Chain.getRegistryTokenConfig} */
972
+ /**
973
+ * {@inheritDoc Chain.getRegistryTokenConfig}
974
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
975
+ */
860
976
  async getRegistryTokenConfig(_address, _tokenName) {
861
977
  return Promise.reject(new CCIPNotImplementedError('getRegistryTokenConfig'));
862
978
  }
863
- /** {@inheritDoc Chain.getTokenPoolConfigs} */
864
- async getTokenPoolConfigs(_tokenPool) {
865
- return Promise.reject(new CCIPNotImplementedError('getTokenPoolConfigs'));
979
+ /**
980
+ * {@inheritDoc Chain.getTokenPoolConfig}
981
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
982
+ */
983
+ async getTokenPoolConfig(_tokenPool) {
984
+ return Promise.reject(new CCIPNotImplementedError('getTokenPoolConfig'));
866
985
  }
867
- /** {@inheritDoc Chain.getTokenPoolRemotes} */
986
+ /**
987
+ * {@inheritDoc Chain.getTokenPoolRemotes}
988
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
989
+ */
868
990
  async getTokenPoolRemotes(_tokenPool) {
869
991
  return Promise.reject(new CCIPNotImplementedError('getTokenPoolRemotes'));
870
992
  }
871
- /** {@inheritDoc Chain.getFeeTokens} */
993
+ /**
994
+ * {@inheritDoc Chain.getFeeTokens}
995
+ * @throws {@link CCIPNotImplementedError} always (not implemented for TON)
996
+ */
872
997
  async getFeeTokens(_router) {
873
998
  return Promise.reject(new CCIPNotImplementedError('getFeeTokens'));
874
999
  }