@chainlink/ccip-sdk 0.91.1 → 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,247 @@
1
+ import { TonClient4 } from '@ton/ton';
2
+ import { type BytesLike } from 'ethers';
3
+ import type { PickDeep } from 'type-fest';
4
+ import { type LogFilter, Chain } from '../chain.ts';
5
+ import { type EVMExtraArgsV2, type ExtraArgs } from '../extra-args.ts';
6
+ import { type AnyMessage, type CCIPRequest, type ChainTransaction, type CommitReport, type ExecutionReceipt, type ExecutionReport, type Lane, type Log_, type NetworkInfo, type OffchainTokenData, type WithLogger, ChainFamily } from '../types.ts';
7
+ import { type CCIPMessage_V1_6_TON, type UnsignedTONTx } from './types.ts';
8
+ import type { LeafHasher } from '../hasher/common.ts';
9
+ /**
10
+ * TON chain implementation supporting TON networks.
11
+ *
12
+ * TON uses two different ordering concepts:
13
+ * - `seqno` (sequence number): The actual block number in the blockchain
14
+ * - `lt` (logical time): A per-account transaction ordering timestamp
15
+ *
16
+ * This implementation uses `lt` for the `blockNumber` field in logs and transactions
17
+ * because TON's transaction APIs are indexed by `lt`, not `seqno`. The `lt` is
18
+ * monotonically increasing per account and suitable for pagination and ordering.
19
+ */
20
+ export declare class TONChain extends Chain<typeof ChainFamily.TON> {
21
+ static readonly family: "ton";
22
+ static readonly decimals = 9;
23
+ private readonly rateLimitedFetch;
24
+ readonly provider: TonClient4;
25
+ /**
26
+ * Cache mapping logical time (lt) to Unix timestamp.
27
+ * Populated during getLogs iteration for later getBlockTimestamp lookups.
28
+ */
29
+ private readonly ltTimestampCache;
30
+ /**
31
+ * Creates a new TONChain instance.
32
+ * @param client - TonClient instance.
33
+ * @param network - Network information for this chain.
34
+ * @param ctx - Context containing logger.
35
+ */
36
+ constructor(client: TonClient4, network: NetworkInfo, ctx?: WithLogger);
37
+ /**
38
+ * Creates a TONChain instance from an RPC URL.
39
+ * Verifies the connection and detects the network.
40
+ *
41
+ * @param url - RPC endpoint URL for TonClient4.
42
+ * @param ctx - Context containing logger.
43
+ * @returns A new TONChain instance.
44
+ */
45
+ static fromUrl(url: string, ctx?: WithLogger): Promise<TONChain>;
46
+ /**
47
+ * Fetch the timestamp for a given logical time (lt) or finalized block.
48
+ *
49
+ * Note: For TON, the `block` parameter represents logical time (lt), not block seqno.
50
+ * This is because TON transaction APIs are indexed by lt. The lt must have been
51
+ * previously cached via getLogs or getTransaction calls.
52
+ *
53
+ * @param block - Logical time (lt) as number, or 'finalized' for latest block timestamp
54
+ * @returns Unix timestamp in seconds
55
+ */
56
+ getBlockTimestamp(block: number | 'finalized'): Promise<number>;
57
+ /**
58
+ * Fetches a transaction by its hash.
59
+ *
60
+ * Supports two formats:
61
+ * 1. Composite format: "workchain:address:lt:hash" (e.g., "0:abc123...def:12345:abc123...def")
62
+ * 2. Raw hash format: 64-character hex string resolved via TonCenter V3 API
63
+ *
64
+ * Note: TON's V4 API requires (address, lt, hash) for lookups. Raw hash lookups
65
+ * use TonCenter's V3 index API to resolve the hash to a full identifier first.
66
+ *
67
+ * @param hash - Transaction identifier in either format
68
+ * @returns ChainTransaction with transaction details
69
+ * Note: `blockNumber` contains logical time (lt), not block seqno
70
+ */
71
+ getTransaction(hash: string): Promise<ChainTransaction>;
72
+ /**
73
+ * Async generator that yields logs from TON transactions.
74
+ *
75
+ * Note: For TON, `startBlock` and `endBlock` in opts represent logical time (lt),
76
+ * not block sequence numbers. This is because TON transaction APIs are indexed by lt.
77
+ *
78
+ * @param opts - Log filter options (startBlock/endBlock are interpreted as lt values)
79
+ */
80
+ getLogs(opts: LogFilter & {
81
+ versionAsHash?: boolean;
82
+ }): AsyncIterableIterator<Log_>;
83
+ /** {@inheritDoc Chain.fetchRequestsInTx} */
84
+ fetchRequestsInTx(tx: string | ChainTransaction): Promise<CCIPRequest[]>;
85
+ /** {@inheritDoc Chain.fetchAllMessagesInBatch} */
86
+ fetchAllMessagesInBatch<R extends PickDeep<CCIPRequest, 'lane' | `log.${'topics' | 'address' | 'blockNumber'}` | 'message.sequenceNumber'>>(_request: R, _commit: Pick<CommitReport, 'minSeqNr' | 'maxSeqNr'>, _opts?: {
87
+ page?: number;
88
+ }): Promise<R['message'][]>;
89
+ /** {@inheritDoc Chain.typeAndVersion} */
90
+ typeAndVersion(address: string): Promise<[type_: string, version: string, typeAndVersion: string] | [type_: string, version: string, typeAndVersion: string, suffix: string]>;
91
+ /** {@inheritDoc Chain.getRouterForOnRamp} */
92
+ getRouterForOnRamp(onRamp: string, destChainSelector: bigint): Promise<string>;
93
+ /** {@inheritDoc Chain.getRouterForOffRamp} */
94
+ getRouterForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string>;
95
+ /** {@inheritDoc Chain.getNativeTokenForRouter} */
96
+ getNativeTokenForRouter(_router: string): Promise<string>;
97
+ /** {@inheritDoc Chain.getOffRampsForRouter} */
98
+ getOffRampsForRouter(router: string, sourceChainSelector: bigint): Promise<string[]>;
99
+ /** {@inheritDoc Chain.getOnRampForRouter} */
100
+ getOnRampForRouter(router: string, destChainSelector: bigint): Promise<string>;
101
+ /** {@inheritDoc Chain.getOnRampForOffRamp} */
102
+ getOnRampForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string>;
103
+ /** {@inheritDoc Chain.getCommitStoreForOffRamp} */
104
+ getCommitStoreForOffRamp(offRamp: string): Promise<string>;
105
+ /** {@inheritDoc Chain.getTokenForTokenPool} */
106
+ getTokenForTokenPool(_tokenPool: string): Promise<string>;
107
+ /** {@inheritDoc Chain.getTokenInfo} */
108
+ getTokenInfo(token: string): Promise<{
109
+ symbol: string;
110
+ decimals: number;
111
+ }>;
112
+ /** {@inheritDoc Chain.getTokenAdminRegistryFor} */
113
+ getTokenAdminRegistryFor(_address: string): Promise<string>;
114
+ /**
115
+ * Decodes a CCIP message from a TON log event.
116
+ * @param log - Log with data field.
117
+ * @returns Decoded CCIPMessage or undefined if not valid.
118
+ */
119
+ static decodeMessage(log: Pick<Log_, 'data'>): CCIPMessage_V1_6_TON | undefined;
120
+ /**
121
+ * Encodes extra args from TON messages into BOC serialization format.
122
+ *
123
+ * Currently only supports GenericExtraArgsV2 (EVMExtraArgsV2) encoding since TON
124
+ * lanes are only connected to EVM chains. When new lanes are planned to be added,
125
+ * this should be extended to support them (eg. Solana and SVMExtraArgsV1)
126
+ *
127
+ * @param args - Extra arguments containing gas limit and execution flags
128
+ * @returns Hex string of BOC-encoded extra args (0x-prefixed)
129
+ */
130
+ static encodeExtraArgs(args: ExtraArgs): string;
131
+ /**
132
+ * Decodes BOC-encoded extra arguments from TON messages.
133
+ * Parses the BOC format and extracts extra args, validating the magic tag
134
+ * to ensure correct type. Returns undefined if parsing fails or tag doesn't match.
135
+ *
136
+ * Currently only supports EVMExtraArgsV2 (GenericExtraArgsV2) encoding since TON
137
+ * lanes are only connected to EVM chains. When new lanes are planned to be added,
138
+ * this should be extended to support them (eg. Solana and SVMExtraArgsV1)
139
+ *
140
+ * @param extraArgs - BOC-encoded extra args as hex string or bytes
141
+ * @returns Decoded EVMExtraArgsV2 (GenericExtraArgsV2) object or undefined if invalid
142
+ */
143
+ static decodeExtraArgs(extraArgs: BytesLike): (EVMExtraArgsV2 & {
144
+ _tag: 'EVMExtraArgsV2';
145
+ }) | undefined;
146
+ /**
147
+ * Decodes commit reports from a TON log event (CommitReportAccepted).
148
+ *
149
+ * @param log - Log with data field (base64-encoded BOC).
150
+ * @param lane - Optional lane info for filtering.
151
+ * @returns Array of CommitReport or undefined if not a valid commit event.
152
+ */
153
+ static decodeCommits(log: Log_, lane?: Lane): CommitReport[] | undefined;
154
+ /**
155
+ * Decodes an execution receipt from a TON log event.
156
+ * @param _log - Log with data field.
157
+ * @returns ExecutionReceipt or undefined if not valid.
158
+ */
159
+ static decodeReceipt(_log: Log_): ExecutionReceipt | undefined;
160
+ /**
161
+ * Converts bytes to a TON address.
162
+ * Handles:
163
+ * - 36-byte CCIP format: workchain(4 bytes, big-endian) + hash(32 bytes)
164
+ * - 33-byte format: workchain(1 byte) + hash(32 bytes)
165
+ * - 32-byte format: hash only (assumes workchain 0)
166
+ * Also handles user-friendly format strings (e.g., "EQ...", "UQ...", "kQ...", "0Q...")
167
+ * and raw format strings ("workchain:hash").
168
+ * @param bytes - Bytes or string to convert.
169
+ * @returns TON raw address string in format "workchain:hash".
170
+ */
171
+ static getAddress(bytes: BytesLike): string;
172
+ /**
173
+ * Formats a TON address for human-friendly display.
174
+ * Converts raw format (workchain:hash) to user-friendly format (EQ..., UQ..., etc.)
175
+ * @param address - Address in any recognized format
176
+ * @returns User-friendly TON address string
177
+ */
178
+ static formatAddress(address: string): string;
179
+ /**
180
+ * Formats a TON transaction hash for human-friendly display.
181
+ * Extracts the raw 64-char hash from composite format for cleaner display.
182
+ * @param hash - Transaction hash in composite or raw format
183
+ * @returns The raw 64-char hex hash for display
184
+ */
185
+ static formatTxHash(hash: string): string;
186
+ /**
187
+ * Validates a transaction hash format for TON.
188
+ * Supports:
189
+ * - Raw 64-char hex hash (with or without 0x prefix)
190
+ * - Composite format: "workchain:address:lt:hash"
191
+ */
192
+ static isTxHash(v: unknown): v is string;
193
+ /**
194
+ * Gets the leaf hasher for TON destination chains.
195
+ * @param lane - Lane configuration.
196
+ * @param _ctx - Context containing logger.
197
+ * @returns Leaf hasher function.
198
+ */
199
+ static getDestLeafHasher(lane: Lane, _ctx?: WithLogger): LeafHasher;
200
+ /** {@inheritDoc Chain.getFee} */
201
+ getFee(_router: string, _destChainSelector: bigint, _message: AnyMessage): Promise<bigint>;
202
+ /** {@inheritDoc Chain.generateUnsignedSendMessage} */
203
+ generateUnsignedSendMessage(_sender: string, _router: string, _destChainSelector: bigint, _message: AnyMessage & {
204
+ fee?: bigint;
205
+ }, _opts?: {
206
+ approveMax?: boolean;
207
+ }): Promise<never>;
208
+ /** {@inheritDoc Chain.sendMessage} */
209
+ sendMessage(_router: string, _destChainSelector: bigint, _message: AnyMessage & {
210
+ fee: bigint;
211
+ }, _opts?: {
212
+ wallet?: unknown;
213
+ approveMax?: boolean;
214
+ }): Promise<CCIPRequest>;
215
+ /** {@inheritDoc Chain.fetchOffchainTokenData} */
216
+ fetchOffchainTokenData(request: CCIPRequest): Promise<OffchainTokenData[]>;
217
+ /** {@inheritDoc Chain.generateUnsignedExecuteReport} */
218
+ generateUnsignedExecuteReport(_payer: string, offRamp: string, execReport: ExecutionReport, opts?: {
219
+ gasLimit?: number;
220
+ }): Promise<UnsignedTONTx>;
221
+ /** {@inheritDoc Chain.executeReport} */
222
+ executeReport(offRamp: string, execReport: ExecutionReport, opts: {
223
+ wallet: unknown;
224
+ gasLimit?: number;
225
+ }): Promise<ChainTransaction>;
226
+ /**
227
+ * Parses raw TON data into typed structures.
228
+ * @param data - Raw data to parse.
229
+ * @returns Parsed data or undefined.
230
+ */
231
+ static parse(data: unknown): (import("../extra-args.ts").EVMExtraArgsV1 & {
232
+ allowOutOfOrderExecution: boolean;
233
+ } & {
234
+ _tag: "EVMExtraArgsV2";
235
+ }) | undefined;
236
+ /** {@inheritDoc Chain.getSupportedTokens} */
237
+ getSupportedTokens(_address: string): Promise<string[]>;
238
+ /** {@inheritDoc Chain.getRegistryTokenConfig} */
239
+ getRegistryTokenConfig(_address: string, _tokenName: string): Promise<never>;
240
+ /** {@inheritDoc Chain.getTokenPoolConfigs} */
241
+ getTokenPoolConfigs(_tokenPool: string): Promise<never>;
242
+ /** {@inheritDoc Chain.getTokenPoolRemotes} */
243
+ getTokenPoolRemotes(_tokenPool: string): Promise<never>;
244
+ /** {@inheritDoc Chain.getFeeTokens} */
245
+ getFeeTokens(_router: string): Promise<never>;
246
+ }
247
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ton/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAY,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,KAAK,SAAS,EAA8C,MAAM,QAAQ,CAAA;AAEnF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGzC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAUnD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,kBAAkB,CAAA;AAGzF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,WAAW,EACZ,MAAM,aAAa,CAAA;AAcpB,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,aAAa,EAAe,MAAM,YAAY,CAAA;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAUrD;;;;;;;;;;GAUG;AACH,qBAAa,QAAS,SAAQ,KAAK,CAAC,OAAO,WAAW,CAAC,GAAG,CAAC;IAIzD,MAAM,CAAC,QAAQ,CAAC,MAAM,QAAkB;IACxC,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAI;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAc;IAC/C,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;IAC7B;;;OAGG;IACH,OAAO,CAAC,QAAQ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