@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.
- package/README.md +127 -80
- package/dist/aptos/hasher.d.ts.map +1 -1
- package/dist/aptos/hasher.js +7 -6
- package/dist/aptos/hasher.js.map +1 -1
- package/dist/aptos/index.d.ts +7 -2
- package/dist/aptos/index.d.ts.map +1 -1
- package/dist/aptos/index.js +29 -20
- package/dist/aptos/index.js.map +1 -1
- package/dist/aptos/logs.d.ts +5 -3
- package/dist/aptos/logs.d.ts.map +1 -1
- package/dist/aptos/logs.js +64 -27
- package/dist/aptos/logs.js.map +1 -1
- package/dist/aptos/token.d.ts.map +1 -1
- package/dist/aptos/token.js +2 -1
- package/dist/aptos/token.js.map +1 -1
- package/dist/aptos/types.js +6 -6
- package/dist/aptos/types.js.map +1 -1
- package/dist/chain.d.ts +36 -11
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +34 -2
- package/dist/chain.js.map +1 -1
- package/dist/commits.d.ts +2 -3
- package/dist/commits.d.ts.map +1 -1
- package/dist/commits.js +19 -8
- package/dist/commits.js.map +1 -1
- package/dist/errors/CCIPError.d.ts +48 -0
- package/dist/errors/CCIPError.d.ts.map +1 -0
- package/dist/errors/CCIPError.js +65 -0
- package/dist/errors/CCIPError.js.map +1 -0
- package/dist/errors/codes.d.ts +120 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/codes.js +156 -0
- package/dist/errors/codes.js.map +1 -0
- package/dist/errors/index.d.ts +26 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +51 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/recovery.d.ts +6 -0
- package/dist/errors/recovery.d.ts.map +1 -0
- package/dist/errors/recovery.js +118 -0
- package/dist/errors/recovery.js.map +1 -0
- package/dist/errors/specialized.d.ts +637 -0
- package/dist/errors/specialized.d.ts.map +1 -0
- package/dist/errors/specialized.js +1298 -0
- package/dist/errors/specialized.js.map +1 -0
- package/dist/errors/utils.d.ts +11 -0
- package/dist/errors/utils.d.ts.map +1 -0
- package/dist/errors/utils.js +61 -0
- package/dist/errors/utils.js.map +1 -0
- package/dist/evm/abi/CommitStore_1_5.js +1 -1
- package/dist/evm/abi/LockReleaseTokenPool_1_5.js +1 -1
- package/dist/evm/abi/OffRamp_1_5.js +1 -1
- package/dist/evm/abi/OnRamp_1_5.js +1 -1
- package/dist/evm/abi/PriceRegistry_1_2.d.ts +443 -0
- package/dist/evm/abi/PriceRegistry_1_2.d.ts.map +1 -0
- package/dist/evm/abi/PriceRegistry_1_2.js +439 -0
- package/dist/evm/abi/PriceRegistry_1_2.js.map +1 -0
- package/dist/evm/const.d.ts +1 -0
- package/dist/evm/const.d.ts.map +1 -1
- package/dist/evm/const.js +2 -0
- package/dist/evm/const.js.map +1 -1
- package/dist/evm/hasher.d.ts.map +1 -1
- package/dist/evm/hasher.js +7 -6
- package/dist/evm/hasher.js.map +1 -1
- package/dist/evm/index.d.ts +9 -13
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +85 -68
- package/dist/evm/index.js.map +1 -1
- package/dist/evm/logs.d.ts.map +1 -1
- package/dist/evm/logs.js +47 -16
- package/dist/evm/logs.js.map +1 -1
- package/dist/evm/messages.d.ts +7 -6
- package/dist/evm/messages.d.ts.map +1 -1
- package/dist/evm/offchain.js +1 -1
- package/dist/evm/offchain.js.map +1 -1
- package/dist/evm/types.d.ts +10 -0
- package/dist/evm/types.d.ts.map +1 -0
- package/dist/evm/types.js +2 -0
- package/dist/evm/types.js.map +1 -0
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +9 -5
- package/dist/execution.js.map +1 -1
- package/dist/extra-args.d.ts.map +1 -1
- package/dist/extra-args.js +4 -3
- package/dist/extra-args.js.map +1 -1
- package/dist/gas.d.ts.map +1 -1
- package/dist/gas.js +3 -2
- package/dist/gas.js.map +1 -1
- package/dist/hasher/hasher.d.ts.map +1 -1
- package/dist/hasher/hasher.js +2 -1
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/merklemulti.d.ts.map +1 -1
- package/dist/hasher/merklemulti.js +9 -8
- package/dist/hasher/merklemulti.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/offchain.d.ts.map +1 -1
- package/dist/offchain.js +5 -8
- package/dist/offchain.js.map +1 -1
- package/dist/requests.d.ts +1 -1
- package/dist/requests.d.ts.map +1 -1
- package/dist/requests.js +37 -43
- package/dist/requests.js.map +1 -1
- package/dist/selectors.d.ts.map +1 -1
- package/dist/selectors.js +22 -0
- package/dist/selectors.js.map +1 -1
- package/dist/solana/cleanup.d.ts +2 -2
- package/dist/solana/cleanup.d.ts.map +1 -1
- package/dist/solana/cleanup.js +2 -3
- package/dist/solana/cleanup.js.map +1 -1
- package/dist/solana/exec.d.ts.map +1 -1
- package/dist/solana/exec.js +12 -12
- package/dist/solana/exec.js.map +1 -1
- package/dist/solana/hasher.d.ts.map +1 -1
- package/dist/solana/hasher.js +6 -5
- package/dist/solana/hasher.js.map +1 -1
- package/dist/solana/index.d.ts +30 -13
- package/dist/solana/index.d.ts.map +1 -1
- package/dist/solana/index.js +96 -143
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/logs.d.ts +15 -0
- package/dist/solana/logs.d.ts.map +1 -0
- package/dist/solana/logs.js +106 -0
- package/dist/solana/logs.js.map +1 -0
- package/dist/solana/offchain.d.ts.map +1 -1
- package/dist/solana/offchain.js +6 -5
- package/dist/solana/offchain.js.map +1 -1
- package/dist/solana/patchBorsh.d.ts.map +1 -1
- package/dist/solana/patchBorsh.js +3 -2
- package/dist/solana/patchBorsh.js.map +1 -1
- package/dist/solana/send.d.ts.map +1 -1
- package/dist/solana/send.js +8 -7
- package/dist/solana/send.js.map +1 -1
- package/dist/solana/utils.d.ts +7 -8
- package/dist/solana/utils.d.ts.map +1 -1
- package/dist/solana/utils.js +23 -11
- package/dist/solana/utils.js.map +1 -1
- package/dist/sui/discovery.d.ts +18 -0
- package/dist/sui/discovery.d.ts.map +1 -0
- package/dist/sui/discovery.js +116 -0
- package/dist/sui/discovery.js.map +1 -0
- package/dist/sui/events.d.ts +36 -0
- package/dist/sui/events.d.ts.map +1 -0
- package/dist/sui/events.js +179 -0
- package/dist/sui/events.js.map +1 -0
- package/dist/sui/hasher.d.ts.map +1 -1
- package/dist/sui/hasher.js +6 -5
- package/dist/sui/hasher.js.map +1 -1
- package/dist/sui/index.d.ts +69 -41
- package/dist/sui/index.d.ts.map +1 -1
- package/dist/sui/index.js +402 -65
- package/dist/sui/index.js.map +1 -1
- package/dist/sui/manuallyExec/encoder.d.ts +8 -0
- package/dist/sui/manuallyExec/encoder.d.ts.map +1 -0
- package/dist/sui/manuallyExec/encoder.js +76 -0
- package/dist/sui/manuallyExec/encoder.js.map +1 -0
- package/dist/sui/manuallyExec/index.d.ts +37 -0
- package/dist/sui/manuallyExec/index.d.ts.map +1 -0
- package/dist/sui/manuallyExec/index.js +81 -0
- package/dist/sui/manuallyExec/index.js.map +1 -0
- package/dist/sui/objects.d.ts +46 -0
- package/dist/sui/objects.d.ts.map +1 -0
- package/dist/sui/objects.js +259 -0
- package/dist/sui/objects.js.map +1 -0
- package/dist/ton/bindings/offramp.d.ts +48 -0
- package/dist/ton/bindings/offramp.d.ts.map +1 -0
- package/dist/ton/bindings/offramp.js +63 -0
- package/dist/ton/bindings/offramp.js.map +1 -0
- package/dist/ton/bindings/onramp.d.ts +40 -0
- package/dist/ton/bindings/onramp.d.ts.map +1 -0
- package/dist/ton/bindings/onramp.js +51 -0
- package/dist/ton/bindings/onramp.js.map +1 -0
- package/dist/ton/bindings/router.d.ts +47 -0
- package/dist/ton/bindings/router.d.ts.map +1 -0
- package/dist/ton/bindings/router.js +51 -0
- package/dist/ton/bindings/router.js.map +1 -0
- package/dist/ton/exec.d.ts +18 -0
- package/dist/ton/exec.d.ts.map +1 -0
- package/dist/ton/exec.js +28 -0
- package/dist/ton/exec.js.map +1 -0
- package/dist/ton/hasher.d.ts +27 -0
- package/dist/ton/hasher.d.ts.map +1 -0
- package/dist/ton/hasher.js +134 -0
- package/dist/ton/hasher.js.map +1 -0
- package/dist/ton/index.d.ts +247 -0
- package/dist/ton/index.d.ts.map +1 -0
- package/dist/ton/index.js +781 -0
- package/dist/ton/index.js.map +1 -0
- package/dist/ton/logs.d.ts +26 -0
- package/dist/ton/logs.d.ts.map +1 -0
- package/dist/ton/logs.js +126 -0
- package/dist/ton/logs.js.map +1 -0
- package/dist/ton/types.d.ts +37 -0
- package/dist/ton/types.d.ts.map +1 -0
- package/dist/ton/types.js +92 -0
- package/dist/ton/types.js.map +1 -0
- package/dist/ton/utils.d.ts +67 -0
- package/dist/ton/utils.d.ts.map +1 -0
- package/dist/ton/utils.js +425 -0
- package/dist/ton/utils.js.map +1 -0
- package/dist/types.d.ts +4 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +52 -17
- package/dist/utils.js.map +1 -1
- package/package.json +12 -10
- package/src/aptos/hasher.ts +10 -6
- package/src/aptos/index.ts +50 -31
- package/src/aptos/logs.ts +85 -29
- package/src/aptos/token.ts +5 -1
- package/src/aptos/types.ts +6 -6
- package/src/chain.ts +83 -12
- package/src/commits.ts +23 -11
- package/src/errors/CCIPError.ts +86 -0
- package/src/errors/codes.ts +179 -0
- package/src/errors/index.ts +175 -0
- package/src/errors/recovery.ts +170 -0
- package/src/errors/specialized.ts +1655 -0
- package/src/errors/utils.ts +73 -0
- package/src/evm/abi/CommitStore_1_5.ts +1 -1
- package/src/evm/abi/LockReleaseTokenPool_1_5.ts +1 -1
- package/src/evm/abi/OffRamp_1_5.ts +1 -1
- package/src/evm/abi/OnRamp_1_5.ts +1 -1
- package/src/evm/abi/PriceRegistry_1_2.ts +438 -0
- package/src/evm/const.ts +2 -0
- package/src/evm/hasher.ts +7 -6
- package/src/evm/index.ts +104 -86
- package/src/evm/logs.ts +64 -16
- package/src/evm/messages.ts +14 -14
- package/src/evm/offchain.ts +1 -1
- package/src/evm/types.ts +11 -0
- package/src/execution.ts +13 -9
- package/src/extra-args.ts +4 -3
- package/src/gas.ts +10 -3
- package/src/hasher/hasher.ts +2 -1
- package/src/hasher/merklemulti.ts +18 -8
- package/src/index.ts +14 -2
- package/src/offchain.ts +10 -14
- package/src/requests.ts +51 -53
- package/src/selectors.ts +23 -0
- package/src/solana/cleanup.ts +2 -4
- package/src/solana/exec.ts +13 -13
- package/src/solana/hasher.ts +9 -5
- package/src/solana/index.ts +126 -200
- package/src/solana/logs.ts +155 -0
- package/src/solana/offchain.ts +10 -7
- package/src/solana/patchBorsh.ts +3 -2
- package/src/solana/send.ts +14 -7
- package/src/solana/utils.ts +31 -17
- package/src/sui/discovery.ts +163 -0
- package/src/sui/events.ts +328 -0
- package/src/sui/hasher.ts +6 -5
- package/src/sui/index.ts +528 -80
- package/src/sui/manuallyExec/encoder.ts +88 -0
- package/src/sui/manuallyExec/index.ts +137 -0
- package/src/sui/objects.ts +358 -0
- package/src/ton/bindings/offramp.ts +96 -0
- package/src/ton/bindings/onramp.ts +72 -0
- package/src/ton/bindings/router.ts +65 -0
- package/src/ton/exec.ts +44 -0
- package/src/ton/hasher.ts +184 -0
- package/src/ton/index.ts +989 -0
- package/src/ton/logs.ts +157 -0
- package/src/ton/types.ts +143 -0
- package/src/ton/utils.ts +514 -0
- package/src/types.ts +6 -2
- package/src/utils.ts +58 -23
- 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>;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