@chainlink/ccip-sdk 0.90.2 → 0.91.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 +35 -26
- package/dist/aptos/exec.d.ts +4 -5
- package/dist/aptos/exec.d.ts.map +1 -1
- package/dist/aptos/exec.js +5 -14
- package/dist/aptos/exec.js.map +1 -1
- package/dist/aptos/hasher.d.ts +18 -0
- package/dist/aptos/hasher.d.ts.map +1 -1
- package/dist/aptos/hasher.js +18 -0
- package/dist/aptos/hasher.js.map +1 -1
- package/dist/aptos/index.d.ts +127 -28
- package/dist/aptos/index.d.ts.map +1 -1
- package/dist/aptos/index.js +199 -70
- package/dist/aptos/index.js.map +1 -1
- package/dist/aptos/logs.d.ts +18 -0
- package/dist/aptos/logs.d.ts.map +1 -1
- package/dist/aptos/logs.js +21 -3
- package/dist/aptos/logs.js.map +1 -1
- package/dist/aptos/send.d.ts +22 -5
- package/dist/aptos/send.d.ts.map +1 -1
- package/dist/aptos/send.js +23 -15
- package/dist/aptos/send.js.map +1 -1
- package/dist/aptos/token.d.ts +6 -0
- package/dist/aptos/token.d.ts.map +1 -1
- package/dist/aptos/token.js +6 -0
- package/dist/aptos/token.js.map +1 -1
- package/dist/aptos/types.d.ts +16 -1
- package/dist/aptos/types.d.ts.map +1 -1
- package/dist/aptos/types.js +13 -0
- package/dist/aptos/types.js.map +1 -1
- package/dist/aptos/utils.d.ts +1 -1
- package/dist/aptos/utils.js +1 -1
- package/dist/chain.d.ts +185 -99
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +38 -15
- package/dist/chain.js.map +1 -1
- package/dist/commits.d.ts +4 -10
- package/dist/commits.d.ts.map +1 -1
- package/dist/commits.js +2 -1
- package/dist/commits.js.map +1 -1
- package/dist/evm/const.d.ts +5 -0
- package/dist/evm/const.d.ts.map +1 -1
- package/dist/evm/const.js +5 -0
- package/dist/evm/const.js.map +1 -1
- package/dist/evm/errors.d.ts +5 -0
- package/dist/evm/errors.d.ts.map +1 -1
- package/dist/evm/errors.js +6 -1
- package/dist/evm/errors.js.map +1 -1
- package/dist/evm/hasher.d.ts +16 -2
- package/dist/evm/hasher.d.ts.map +1 -1
- package/dist/evm/hasher.js +17 -3
- package/dist/evm/hasher.js.map +1 -1
- package/dist/evm/index.d.ts +176 -31
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +312 -154
- package/dist/evm/index.js.map +1 -1
- package/dist/evm/logs.d.ts +20 -0
- package/dist/evm/logs.d.ts.map +1 -0
- package/dist/evm/logs.js +194 -0
- package/dist/evm/logs.js.map +1 -0
- package/dist/evm/messages.d.ts +11 -2
- package/dist/evm/messages.d.ts.map +1 -1
- package/dist/evm/messages.js +4 -2
- package/dist/evm/messages.js.map +1 -1
- package/dist/evm/offchain.d.ts +7 -2
- package/dist/evm/offchain.d.ts.map +1 -1
- package/dist/evm/offchain.js +12 -7
- package/dist/evm/offchain.js.map +1 -1
- package/dist/execution.d.ts +19 -62
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +28 -31
- package/dist/execution.js.map +1 -1
- package/dist/extra-args.d.ts +35 -5
- package/dist/extra-args.d.ts.map +1 -1
- package/dist/extra-args.js +10 -5
- package/dist/extra-args.js.map +1 -1
- package/dist/gas.d.ts +6 -8
- package/dist/gas.d.ts.map +1 -1
- package/dist/gas.js +7 -9
- package/dist/gas.js.map +1 -1
- package/dist/hasher/common.d.ts +3 -2
- package/dist/hasher/common.d.ts.map +1 -1
- package/dist/hasher/common.js +2 -2
- package/dist/hasher/common.js.map +1 -1
- package/dist/hasher/hasher.d.ts +8 -2
- package/dist/hasher/hasher.d.ts.map +1 -1
- package/dist/hasher/hasher.js +8 -3
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/merklemulti.d.ts +11 -9
- package/dist/hasher/merklemulti.d.ts.map +1 -1
- package/dist/hasher/merklemulti.js +17 -16
- package/dist/hasher/merklemulti.js.map +1 -1
- package/dist/index.d.ts +16 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/requests.d.ts +39 -25
- package/dist/requests.d.ts.map +1 -1
- package/dist/requests.js +42 -35
- package/dist/requests.js.map +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/solana/cleanup.d.ts +14 -10
- package/dist/solana/cleanup.d.ts.map +1 -1
- package/dist/solana/cleanup.js +35 -33
- package/dist/solana/cleanup.js.map +1 -1
- package/dist/solana/exec.d.ts +19 -11
- package/dist/solana/exec.d.ts.map +1 -1
- package/dist/solana/exec.js +86 -163
- package/dist/solana/exec.js.map +1 -1
- package/dist/solana/hasher.d.ts +7 -2
- package/dist/solana/hasher.d.ts.map +1 -1
- package/dist/solana/hasher.js +7 -2
- package/dist/solana/hasher.js.map +1 -1
- package/dist/solana/index.d.ts +202 -84
- package/dist/solana/index.d.ts.map +1 -1
- package/dist/solana/index.js +367 -252
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/offchain.d.ts +8 -18
- package/dist/solana/offchain.d.ts.map +1 -1
- package/dist/solana/offchain.js +29 -83
- package/dist/solana/offchain.js.map +1 -1
- package/dist/solana/patchBorsh.d.ts +5 -1
- package/dist/solana/patchBorsh.d.ts.map +1 -1
- package/dist/solana/patchBorsh.js +57 -46
- package/dist/solana/patchBorsh.js.map +1 -1
- package/dist/solana/send.d.ts +28 -10
- package/dist/solana/send.d.ts.map +1 -1
- package/dist/solana/send.js +44 -77
- package/dist/solana/send.js.map +1 -1
- package/dist/solana/types.d.ts +22 -1
- package/dist/solana/types.d.ts.map +1 -1
- package/dist/solana/types.js +12 -1
- package/dist/solana/types.js.map +1 -1
- package/dist/solana/utils.d.ts +58 -4
- package/dist/solana/utils.d.ts.map +1 -1
- package/dist/solana/utils.js +110 -7
- package/dist/solana/utils.js.map +1 -1
- package/dist/sui/hasher.d.ts +18 -0
- package/dist/sui/hasher.d.ts.map +1 -1
- package/dist/sui/hasher.js +18 -0
- package/dist/sui/hasher.js.map +1 -1
- package/dist/sui/index.d.ts +99 -12
- package/dist/sui/index.d.ts.map +1 -1
- package/dist/sui/index.js +108 -19
- package/dist/sui/index.js.map +1 -1
- package/dist/sui/types.d.ts +6 -0
- package/dist/sui/types.d.ts.map +1 -1
- package/dist/sui/types.js +5 -0
- package/dist/sui/types.js.map +1 -1
- package/dist/supported-chains.d.ts +2 -1
- package/dist/supported-chains.d.ts.map +1 -1
- package/dist/supported-chains.js.map +1 -1
- package/dist/types.d.ts +127 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +67 -46
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +143 -21
- package/dist/utils.js.map +1 -1
- package/package.json +13 -9
- package/src/aptos/exec.ts +7 -18
- package/src/aptos/hasher.ts +18 -0
- package/src/aptos/index.ts +288 -110
- package/src/aptos/logs.ts +21 -3
- package/src/aptos/send.ts +25 -22
- package/src/aptos/token.ts +6 -0
- package/src/aptos/types.ts +26 -2
- package/src/aptos/utils.ts +1 -1
- package/src/chain.ts +243 -108
- package/src/commits.ts +6 -7
- package/src/evm/const.ts +5 -0
- package/src/evm/errors.ts +6 -1
- package/src/evm/hasher.ts +20 -4
- package/src/evm/index.ts +416 -214
- package/src/evm/logs.ts +255 -0
- package/src/evm/messages.ts +11 -5
- package/src/evm/offchain.ts +13 -4
- package/src/execution.ts +40 -32
- package/src/extra-args.ts +38 -6
- package/src/gas.ts +7 -9
- package/src/hasher/common.ts +3 -2
- package/src/hasher/hasher.ts +12 -4
- package/src/hasher/merklemulti.ts +17 -16
- package/src/index.ts +29 -23
- package/src/requests.ts +64 -46
- package/src/selectors.ts +1 -1
- package/src/solana/cleanup.ts +49 -34
- package/src/solana/exec.ts +128 -272
- package/src/solana/hasher.ts +13 -4
- package/src/solana/index.ts +483 -356
- package/src/solana/offchain.ts +32 -102
- package/src/solana/patchBorsh.ts +65 -50
- package/src/solana/send.ts +52 -111
- package/src/solana/types.ts +44 -3
- package/src/solana/utils.ts +143 -19
- package/src/sui/hasher.ts +18 -0
- package/src/sui/index.ts +143 -31
- package/src/sui/types.ts +6 -0
- package/src/supported-chains.ts +2 -1
- package/src/types.ts +130 -18
- package/src/utils.ts +168 -26
- package/tsconfig.json +2 -1
package/dist/execution.d.ts
CHANGED
|
@@ -1,80 +1,37 @@
|
|
|
1
|
-
import moize from 'moize';
|
|
2
1
|
import type { Chain } from './chain.ts';
|
|
3
|
-
import { type CCIPExecution, type CCIPMessage, type
|
|
2
|
+
import { type CCIPCommit, type CCIPExecution, type CCIPMessage, type CCIPRequest, type CCIPVersion, type ExecutionReport, type Lane, type WithLogger } from './types.ts';
|
|
4
3
|
/**
|
|
5
4
|
* Pure/sync function to calculate/generate OffRamp.executeManually report for messageIds
|
|
6
5
|
*
|
|
7
6
|
* @param messagesInBatch - Array containing all messages in batch, ordered
|
|
8
|
-
* @param lane - Arguments for
|
|
9
|
-
* @param
|
|
7
|
+
* @param lane - Arguments for leafHasher (lane info)
|
|
8
|
+
* @param messageId - Message ID to prove for manual execution
|
|
10
9
|
* @param merkleRoot - Optional merkleRoot of the CommitReport, for validation
|
|
10
|
+
* @param ctx - Context for logging
|
|
11
11
|
* @returns ManualExec report arguments
|
|
12
12
|
**/
|
|
13
|
-
export declare function calculateManualExecProof<V extends CCIPVersion = CCIPVersion>(messagesInBatch: readonly CCIPMessage<V>[], lane: Lane<V>, messageId: string, merkleRoot?: string): Omit<ExecutionReport, 'offchainTokenData' | 'message'>;
|
|
14
|
-
export declare const discoverOffRamp:
|
|
15
|
-
|
|
16
|
-
isPromise: boolean;
|
|
17
|
-
isReact: boolean;
|
|
18
|
-
isSerialized: boolean;
|
|
19
|
-
isShallowEqual: boolean;
|
|
20
|
-
matchesArg: moize.IsEqual;
|
|
21
|
-
matchesKey: moize.IsMatchingKey;
|
|
22
|
-
maxAge: number;
|
|
23
|
-
maxArgs: number;
|
|
24
|
-
maxSize: number;
|
|
25
|
-
onCacheAdd: moize.OnCacheOperation<(source: Chain, dest: Chain, onRamp: string) => Promise<string>>;
|
|
26
|
-
onCacheChange: moize.OnCacheOperation<(source: Chain, dest: Chain, onRamp: string) => Promise<string>>;
|
|
27
|
-
onCacheHit: moize.OnCacheOperation<(source: Chain, dest: Chain, onRamp: string) => Promise<string>>;
|
|
28
|
-
onExpire: moize.OnExpire;
|
|
29
|
-
profileName: string;
|
|
30
|
-
serializer: moize.Serialize;
|
|
31
|
-
transformArgs: moize.TransformKey;
|
|
32
|
-
updateCacheForKey: moize.UpdateCacheForKey;
|
|
33
|
-
updateExpire: boolean;
|
|
34
|
-
}> & Partial<{
|
|
35
|
-
isDeepEqual: boolean;
|
|
36
|
-
isPromise: boolean;
|
|
37
|
-
isReact: boolean;
|
|
38
|
-
isSerialized: boolean;
|
|
39
|
-
isShallowEqual: boolean;
|
|
40
|
-
matchesArg: moize.IsEqual;
|
|
41
|
-
matchesKey: moize.IsMatchingKey;
|
|
42
|
-
maxAge: number;
|
|
43
|
-
maxArgs: number;
|
|
44
|
-
maxSize: number;
|
|
45
|
-
onCacheAdd: moize.OnCacheOperation<moize.Moizeable>;
|
|
46
|
-
onCacheChange: moize.OnCacheOperation<moize.Moizeable>;
|
|
47
|
-
onCacheHit: moize.OnCacheOperation<moize.Moizeable>;
|
|
48
|
-
onExpire: moize.OnExpire;
|
|
49
|
-
profileName: string;
|
|
50
|
-
serializer: moize.Serialize;
|
|
51
|
-
transformArgs: moize.TransformKey;
|
|
52
|
-
updateCacheForKey: moize.UpdateCacheForKey;
|
|
53
|
-
updateExpire: boolean;
|
|
54
|
-
}> & {
|
|
55
|
-
transformArgs: ([source, dest, onRamp]: moize.Key<any>) => (string | bigint)[];
|
|
13
|
+
export declare function calculateManualExecProof<V extends CCIPVersion = CCIPVersion>(messagesInBatch: readonly CCIPMessage<V>[], lane: Lane<V>, messageId: string, merkleRoot?: string, ctx?: WithLogger): Omit<ExecutionReport, 'offchainTokenData' | 'message'>;
|
|
14
|
+
export declare const discoverOffRamp: import("micro-memoize").Memoized<(source: Chain, dest: Chain, onRamp: string, { logger }?: WithLogger) => Promise<string>, {
|
|
15
|
+
transformKey: ([source, dest, onRamp]: [source: Chain<import("./types.ts").ChainFamily>, dest: Chain<import("./types.ts").ChainFamily>, onRamp: string, (WithLogger | undefined)?]) => [bigint, bigint, string];
|
|
56
16
|
}>;
|
|
57
17
|
/**
|
|
58
|
-
* Generic implementation for fetching ExecutionReceipts for given requests
|
|
59
|
-
* If more than one request is given, may yield them interleaved
|
|
60
|
-
* Completes as soon as there's no more work to be done
|
|
61
|
-
*
|
|
18
|
+
* Generic implementation for fetching ExecutionReceipts for given requests.
|
|
19
|
+
* If more than one request is given, may yield them interleaved.
|
|
20
|
+
* Completes as soon as there's no more work to be done.
|
|
21
|
+
*
|
|
22
|
+
* Two possible behaviors:
|
|
62
23
|
* - if `startBlock|startTime` is given, pages forward from that block up;
|
|
63
24
|
* completes when success (final) receipt is found for all requests (or reach latest block)
|
|
64
25
|
* - otherwise, pages backwards and returns only the most recent receipt per request;
|
|
65
26
|
* completes when receipts for all requests were seen
|
|
66
27
|
*
|
|
67
|
-
* @param dest -
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
*
|
|
71
|
-
* @param hints.page
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export declare function fetchExecutionReceipts(dest: Chain, offRamp: string, messageIds: Set<string>, hints?: {
|
|
75
|
-
startBlock?: number;
|
|
76
|
-
startTime?: number;
|
|
28
|
+
* @param dest - Provider to page through.
|
|
29
|
+
* @param offRamp - OffRamp contract address.
|
|
30
|
+
* @param request - CCIP request to search executions for.
|
|
31
|
+
* @param commit - Optional commit info to narrow down search.
|
|
32
|
+
* @param hints - Optional hints (e.g., `page` for getLogs pagination range).
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchExecutionReceipts(dest: Chain, offRamp: string, request: CCIPRequest, commit?: CCIPCommit, hints?: {
|
|
77
35
|
page?: number;
|
|
78
|
-
commit?: CommitReport;
|
|
79
36
|
}): AsyncGenerator<CCIPExecution>;
|
|
80
37
|
//# sourceMappingURL=execution.d.ts.map
|
package/dist/execution.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,YAAY,CAAA;AAEpD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,UAAU,EAEhB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;IASI;AACJ,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC1E,eAAe,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EAC1C,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,GAAG,CAAC,EAAE,UAAU,GACf,IAAI,CAAC,eAAe,EAAE,mBAAmB,GAAG,SAAS,CAAC,CA4BxD;AAED,eAAO,MAAM,eAAe,4CAEhB,KAAK,QACP,KAAK,UACH,MAAM,eACQ,UAAU,KAC/B,OAAO,CAAC,MAAM,CAAC;;EA6BnB,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAuB,sBAAsB,CAC3C,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,UAAU,EACnB,KAAK,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACxB,cAAc,CAAC,aAAa,CAAC,CAgB/B"}
|
package/dist/execution.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { memoize } from 'micro-memoize';
|
|
2
2
|
import { Tree, getLeafHasher, proofFlagsToBits } from "./hasher/index.js";
|
|
3
3
|
import { ExecutionState, } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Pure/sync function to calculate/generate OffRamp.executeManually report for messageIds
|
|
6
6
|
*
|
|
7
7
|
* @param messagesInBatch - Array containing all messages in batch, ordered
|
|
8
|
-
* @param lane - Arguments for
|
|
9
|
-
* @param
|
|
8
|
+
* @param lane - Arguments for leafHasher (lane info)
|
|
9
|
+
* @param messageId - Message ID to prove for manual execution
|
|
10
10
|
* @param merkleRoot - Optional merkleRoot of the CommitReport, for validation
|
|
11
|
+
* @param ctx - Context for logging
|
|
11
12
|
* @returns ManualExec report arguments
|
|
12
13
|
**/
|
|
13
|
-
export function calculateManualExecProof(messagesInBatch, lane, messageId, merkleRoot) {
|
|
14
|
-
const hasher = getLeafHasher(lane);
|
|
14
|
+
export function calculateManualExecProof(messagesInBatch, lane, messageId, merkleRoot, ctx) {
|
|
15
|
+
const hasher = getLeafHasher(lane, ctx);
|
|
15
16
|
const msgIdx = messagesInBatch.findIndex((message) => message.header.messageId === messageId);
|
|
16
17
|
if (msgIdx < 0) {
|
|
17
18
|
throw new Error(`Could not find ${messageId} in batch seqNums=[${Number(messagesInBatch[0].header.sequenceNumber)}..${Number(messagesInBatch[messagesInBatch.length - 1].header.sequenceNumber)}]`);
|
|
@@ -30,7 +31,7 @@ export function calculateManualExecProof(messagesInBatch, lane, messageId, merkl
|
|
|
30
31
|
merkleRoot: tree.root(),
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
|
-
export const discoverOffRamp =
|
|
34
|
+
export const discoverOffRamp = memoize(async function discoverOffRamp_(source, dest, onRamp, { logger = console } = {}) {
|
|
34
35
|
const sourceRouter = await source.getRouterForOnRamp(onRamp, dest.network.chainSelector);
|
|
35
36
|
const sourceOffRamps = await source.getOffRampsForRouter(sourceRouter, dest.network.chainSelector);
|
|
36
37
|
for (const offRamp of sourceOffRamps) {
|
|
@@ -40,51 +41,47 @@ export const discoverOffRamp = moize.default(async function discoverOffRamp_(sou
|
|
|
40
41
|
for (const offRamp of destOffRamps) {
|
|
41
42
|
const offRampsOnRamp = await dest.getOnRampForOffRamp(offRamp, source.network.chainSelector);
|
|
42
43
|
if (offRampsOnRamp === onRamp) {
|
|
43
|
-
|
|
44
|
+
logger.debug('discoverOffRamp: found, from', { sourceRouter, sourceOffRamps, destOnRamp, destOffRamps, offRampsOnRamp }, '=', offRamp);
|
|
44
45
|
return offRamp;
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
throw new Error(`No matching offRamp found for "${onRamp}" on "${dest.network.name}"`);
|
|
49
50
|
}, {
|
|
50
|
-
|
|
51
|
-
source.network.chainSelector,
|
|
52
|
-
dest.network.chainSelector,
|
|
53
|
-
onRamp,
|
|
54
|
-
],
|
|
51
|
+
transformKey: ([source, dest, onRamp]) => [source.network.chainSelector, dest.network.chainSelector, onRamp],
|
|
55
52
|
});
|
|
56
53
|
/**
|
|
57
|
-
* Generic implementation for fetching ExecutionReceipts for given requests
|
|
58
|
-
* If more than one request is given, may yield them interleaved
|
|
59
|
-
* Completes as soon as there's no more work to be done
|
|
60
|
-
*
|
|
54
|
+
* Generic implementation for fetching ExecutionReceipts for given requests.
|
|
55
|
+
* If more than one request is given, may yield them interleaved.
|
|
56
|
+
* Completes as soon as there's no more work to be done.
|
|
57
|
+
*
|
|
58
|
+
* Two possible behaviors:
|
|
61
59
|
* - if `startBlock|startTime` is given, pages forward from that block up;
|
|
62
60
|
* completes when success (final) receipt is found for all requests (or reach latest block)
|
|
63
61
|
* - otherwise, pages backwards and returns only the most recent receipt per request;
|
|
64
62
|
* completes when receipts for all requests were seen
|
|
65
63
|
*
|
|
66
|
-
* @param dest -
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
*
|
|
70
|
-
* @param hints.page
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const onlyLast = !hints?.startBlock && !hints?.startTime; // backwards
|
|
64
|
+
* @param dest - Provider to page through.
|
|
65
|
+
* @param offRamp - OffRamp contract address.
|
|
66
|
+
* @param request - CCIP request to search executions for.
|
|
67
|
+
* @param commit - Optional commit info to narrow down search.
|
|
68
|
+
* @param hints - Optional hints (e.g., `page` for getLogs pagination range).
|
|
69
|
+
*/
|
|
70
|
+
export async function* fetchExecutionReceipts(dest, offRamp, request, commit, hints) {
|
|
71
|
+
const onlyLast = !commit?.log.blockNumber && !request.tx.timestamp; // backwards
|
|
75
72
|
for await (const log of dest.getLogs({
|
|
76
|
-
|
|
73
|
+
startBlock: commit?.log.blockNumber,
|
|
74
|
+
startTime: request.tx.timestamp,
|
|
77
75
|
address: offRamp,
|
|
78
76
|
topics: ['ExecutionStateChanged'],
|
|
77
|
+
...hints,
|
|
79
78
|
})) {
|
|
80
79
|
const receipt = dest.constructor.decodeReceipt(log);
|
|
81
|
-
if (!receipt ||
|
|
80
|
+
if (!receipt || receipt.messageId !== request.message.header.messageId)
|
|
82
81
|
continue;
|
|
83
|
-
|
|
84
|
-
messageIds.delete(receipt.messageId);
|
|
85
|
-
const timestamp = await dest.getBlockTimestamp(log.blockNumber);
|
|
82
|
+
const timestamp = log.tx?.timestamp ?? (await dest.getBlockTimestamp(log.blockNumber));
|
|
86
83
|
yield { receipt, log, timestamp };
|
|
87
|
-
if (
|
|
84
|
+
if (onlyLast || receipt.state === ExecutionState.Success)
|
|
88
85
|
break;
|
|
89
86
|
}
|
|
90
87
|
}
|
package/dist/execution.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,E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F,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,CAAA;QACjC,IAAI,QAAQ,IAAI,OAAO,CAAC,KAAK,KAAK,cAAc,CAAC,OAAO;YAAE,MAAK;IACjE,CAAC;AACH,CAAC"}
|
package/dist/extra-args.d.ts
CHANGED
|
@@ -1,26 +1,55 @@
|
|
|
1
1
|
import { type BytesLike } from 'ethers';
|
|
2
|
-
import { ChainFamily } from './
|
|
2
|
+
import { ChainFamily } from './types.ts';
|
|
3
|
+
/** Tag identifier for EVMExtraArgsV1 encoding. */
|
|
3
4
|
export declare const EVMExtraArgsV1Tag: "0x97a657c9";
|
|
5
|
+
/** Tag identifier for EVMExtraArgsV2 encoding. */
|
|
4
6
|
export declare const EVMExtraArgsV2Tag: "0x181dcf10";
|
|
7
|
+
/** Tag identifier for SVMExtraArgsV1 encoding. */
|
|
5
8
|
export declare const SVMExtraArgsV1Tag: "0x1f3b3aba";
|
|
9
|
+
/** Tag identifier for SuiExtraArgsV1 encoding. */
|
|
6
10
|
export declare const SuiExtraArgsV1Tag: "0x21ea4ca9";
|
|
11
|
+
/**
|
|
12
|
+
* EVM extra arguments version 1 with gas limit only.
|
|
13
|
+
*/
|
|
7
14
|
export type EVMExtraArgsV1 = {
|
|
15
|
+
/** Gas limit for execution on the destination chain. */
|
|
8
16
|
gasLimit: bigint;
|
|
9
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* EVM extra arguments version 2 with out-of-order execution support.
|
|
20
|
+
* Also known as GenericExtraArgsV2.
|
|
21
|
+
*/
|
|
10
22
|
export type EVMExtraArgsV2 = EVMExtraArgsV1 & {
|
|
23
|
+
/** Whether to allow out-of-order message execution. */
|
|
11
24
|
allowOutOfOrderExecution: boolean;
|
|
12
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Solana (SVM) extra arguments version 1.
|
|
28
|
+
*/
|
|
13
29
|
export type SVMExtraArgsV1 = {
|
|
30
|
+
/** Compute units for Solana execution. */
|
|
14
31
|
computeUnits: bigint;
|
|
32
|
+
/** Bitmap indicating which accounts are writable. */
|
|
15
33
|
accountIsWritableBitmap: bigint;
|
|
34
|
+
/** Whether to allow out-of-order message execution. */
|
|
16
35
|
allowOutOfOrderExecution: boolean;
|
|
36
|
+
/** Token receiver address on Solana. */
|
|
17
37
|
tokenReceiver: string;
|
|
38
|
+
/** Additional account addresses required for execution. */
|
|
18
39
|
accounts: string[];
|
|
19
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Sui extra arguments version 1.
|
|
43
|
+
*/
|
|
20
44
|
export type SuiExtraArgsV1 = EVMExtraArgsV2 & {
|
|
45
|
+
/** Token receiver address on Sui. */
|
|
21
46
|
tokenReceiver: string;
|
|
47
|
+
/** Object IDs required for the receiver. */
|
|
22
48
|
receiverObjectIds: string[];
|
|
23
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Union type of all supported extra arguments formats.
|
|
52
|
+
*/
|
|
24
53
|
export type ExtraArgs = EVMExtraArgsV1 | EVMExtraArgsV2 | SVMExtraArgsV1 | SuiExtraArgsV1;
|
|
25
54
|
/**
|
|
26
55
|
* Encodes extra arguments for CCIP messages.
|
|
@@ -29,10 +58,11 @@ export type ExtraArgs = EVMExtraArgsV1 | EVMExtraArgsV2 | SVMExtraArgsV1 | SuiEx
|
|
|
29
58
|
**/
|
|
30
59
|
export declare function encodeExtraArgs(args: ExtraArgs, from?: ChainFamily): string;
|
|
31
60
|
/**
|
|
32
|
-
* Parses extra arguments from CCIP messages
|
|
33
|
-
* @param data -
|
|
34
|
-
* @
|
|
35
|
-
|
|
61
|
+
* Parses extra arguments from CCIP messages.
|
|
62
|
+
* @param data - Extra arguments bytearray data.
|
|
63
|
+
* @param from - Optional chain family to narrow decoding attempts.
|
|
64
|
+
* @returns Extra arguments object if found, undefined otherwise.
|
|
65
|
+
*/
|
|
36
66
|
export declare function decodeExtraArgs(data: BytesLike, from?: ChainFamily): (EVMExtraArgsV1 & {
|
|
37
67
|
_tag: 'EVMExtraArgsV1';
|
|
38
68
|
}) | (EVMExtraArgsV2 & {
|
package/dist/extra-args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra-args.d.ts","sourceRoot":"","sources":["../src/extra-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAM,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"extra-args.d.ts","sourceRoot":"","sources":["../src/extra-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAM,MAAM,QAAQ,CAAA;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,kDAAkD;AAClD,eAAO,MAAM,iBAAiB,EAAiD,YAAY,CAAA;AAC3F,kDAAkD;AAClD,eAAO,MAAM,iBAAiB,EAAiD,YAAY,CAAA;AAC3F,kDAAkD;AAClD,eAAO,MAAM,iBAAiB,EAAiD,YAAY,CAAA;AAC3F,kDAAkD;AAClD,eAAO,MAAM,iBAAiB,EAAiD,YAAY,CAAA;AAE3F;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,uDAAuD;IACvD,wBAAwB,EAAE,OAAO,CAAA;CAClC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAA;IACpB,qDAAqD;IACrD,uBAAuB,EAAE,MAAM,CAAA;IAC/B,uDAAuD;IACvD,wBAAwB,EAAE,OAAO,CAAA;IACjC,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAA;IACrB,4CAA4C;IAC5C,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC5B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,CAAA;AAEzF;;;;IAII;AACJ,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,GAAE,WAA6B,GAAG,MAAM,CAI5F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,IAAI,CAAC,EAAE,WAAW,GAEhB,CAAC,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,GAC7C,CAAC,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,GAC7C,CAAC,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,GAC7C,CAAC,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,GAC7C,SAAS,CAeZ"}
|
package/dist/extra-args.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { id } from 'ethers';
|
|
2
|
-
import { ChainFamily } from "./chain.js";
|
|
3
2
|
import { supportedChains } from "./supported-chains.js";
|
|
3
|
+
import { ChainFamily } from "./types.js";
|
|
4
|
+
/** Tag identifier for EVMExtraArgsV1 encoding. */
|
|
4
5
|
export const EVMExtraArgsV1Tag = id('CCIP EVMExtraArgsV1').substring(0, 10);
|
|
6
|
+
/** Tag identifier for EVMExtraArgsV2 encoding. */
|
|
5
7
|
export const EVMExtraArgsV2Tag = id('CCIP EVMExtraArgsV2').substring(0, 10);
|
|
8
|
+
/** Tag identifier for SVMExtraArgsV1 encoding. */
|
|
6
9
|
export const SVMExtraArgsV1Tag = id('CCIP SVMExtraArgsV1').substring(0, 10);
|
|
10
|
+
/** Tag identifier for SuiExtraArgsV1 encoding. */
|
|
7
11
|
export const SuiExtraArgsV1Tag = id('CCIP SuiExtraArgsV1').substring(0, 10);
|
|
8
12
|
/**
|
|
9
13
|
* Encodes extra arguments for CCIP messages.
|
|
@@ -17,10 +21,11 @@ export function encodeExtraArgs(args, from = ChainFamily.EVM) {
|
|
|
17
21
|
return chain.encodeExtraArgs(args);
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
|
-
* Parses extra arguments from CCIP messages
|
|
21
|
-
* @param data -
|
|
22
|
-
* @
|
|
23
|
-
|
|
24
|
+
* Parses extra arguments from CCIP messages.
|
|
25
|
+
* @param data - Extra arguments bytearray data.
|
|
26
|
+
* @param from - Optional chain family to narrow decoding attempts.
|
|
27
|
+
* @returns Extra arguments object if found, undefined otherwise.
|
|
28
|
+
*/
|
|
24
29
|
export function decodeExtraArgs(data, from) {
|
|
25
30
|
if (!data || data === '')
|
|
26
31
|
return;
|
package/dist/extra-args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra-args.js","sourceRoot":"","sources":["../src/extra-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"extra-args.js","sourceRoot":"","sources":["../src/extra-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,kDAAkD;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAiB,CAAA;AAC3F,kDAAkD;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAiB,CAAA;AAC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A;AAC7D,CAAC"}
|
package/dist/gas.d.ts
CHANGED
|
@@ -3,14 +3,12 @@ import type { Chain } from './chain.ts';
|
|
|
3
3
|
import type { EVMChain } from './evm/index.ts';
|
|
4
4
|
import type { Lane } from './types.ts';
|
|
5
5
|
/**
|
|
6
|
-
* Estimate CCIP gasLimit needed to execute a request on a contract receiver
|
|
7
|
-
*
|
|
8
|
-
* @param dest - Provider for the destination chain
|
|
9
|
-
* @param request - CCIP request info
|
|
10
|
-
* @
|
|
11
|
-
|
|
12
|
-
* @returns estimated gasLimit as bigint
|
|
13
|
-
**/
|
|
6
|
+
* Estimate CCIP gasLimit needed to execute a request on a contract receiver.
|
|
7
|
+
* @param source - Provider for the source chain.
|
|
8
|
+
* @param dest - Provider for the destination chain.
|
|
9
|
+
* @param request - CCIP request info containing `lane` and `message` details.
|
|
10
|
+
* @returns Estimated gasLimit as bigint.
|
|
11
|
+
*/
|
|
14
12
|
export declare function estimateExecGasForRequest(source: Chain, dest: EVMChain, request: {
|
|
15
13
|
lane: Lane;
|
|
16
14
|
message: {
|
package/dist/gas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas.d.ts","sourceRoot":"","sources":["../src/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAWf,MAAM,QAAQ,CAAA;AAGf,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAetC
|
|
1
|
+
{"version":3,"file":"gas.d.ts","sourceRoot":"","sources":["../src/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAWf,MAAM,QAAQ,CAAA;AAGf,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAetC;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,KAAK,EACb,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE;IACP,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,SAAS,CAAA;QACf,YAAY,EAAE,SAAS;YACrB,iBAAiB,EAAE,MAAM,CAAA;YACzB,gBAAgB,EAAE,MAAM,CAAA;YACxB,MAAM,EAAE,MAAM,CAAA;SACf,EAAE,CAAA;KACJ,CAAA;CACF,mBA0EF"}
|
package/dist/gas.js
CHANGED
|
@@ -12,16 +12,14 @@ const ccipReceive = FunctionFragment.from({
|
|
|
12
12
|
outputs: [],
|
|
13
13
|
});
|
|
14
14
|
/**
|
|
15
|
-
* Estimate CCIP gasLimit needed to execute a request on a contract receiver
|
|
16
|
-
*
|
|
17
|
-
* @param dest - Provider for the destination chain
|
|
18
|
-
* @param request - CCIP request info
|
|
19
|
-
* @
|
|
20
|
-
|
|
21
|
-
* @returns estimated gasLimit as bigint
|
|
22
|
-
**/
|
|
15
|
+
* Estimate CCIP gasLimit needed to execute a request on a contract receiver.
|
|
16
|
+
* @param source - Provider for the source chain.
|
|
17
|
+
* @param dest - Provider for the destination chain.
|
|
18
|
+
* @param request - CCIP request info containing `lane` and `message` details.
|
|
19
|
+
* @returns Estimated gasLimit as bigint.
|
|
20
|
+
*/
|
|
23
21
|
export async function estimateExecGasForRequest(source, dest, request) {
|
|
24
|
-
const offRamp = await discoverOffRamp(source, dest, request.lane.onRamp);
|
|
22
|
+
const offRamp = await discoverOffRamp(source, dest, request.lane.onRamp, source);
|
|
25
23
|
const destRouter = await dest.getRouterForOffRamp(offRamp, request.lane.sourceChainSelector);
|
|
26
24
|
const destTokenAmounts = await Promise.all(request.message.tokenAmounts.map(async (ta) => {
|
|
27
25
|
if (!('destTokenAddress' in ta))
|
package/dist/gas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas.js","sourceRoot":"","sources":["../src/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,uBAAuB,EACvB,OAAO,EACP,YAAY,GACb,MAAM,QAAQ,CAAA;AAIf,OAAO,QAAQ,MAAM,kCAAkC,CAAA;AACvD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGhD,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC;IACxC,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,aAAa;IACnB,eAAe,EAAE,YAAY;IAC7B,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,CAAE,CAAC,MAAM,CAAC,KAAK,CAC7F,CAAC,EACD,CAAC,CACF;IACD,OAAO,EAAE,EAAE;CACZ,CAAC,CAAA;AAGF
|
|
1
|
+
{"version":3,"file":"gas.js","sourceRoot":"","sources":["../src/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,uBAAuB,EACvB,OAAO,EACP,YAAY,GACb,MAAM,QAAQ,CAAA;AAIf,OAAO,QAAQ,MAAM,kCAAkC,CAAA;AACvD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EA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
|
2
|
+
/** Function type for computing the leaf hash of a CCIP message. */
|
|
2
3
|
export type LeafHasher<V extends CCIPVersion = CCIPVersion> = (message: CCIPMessage<V>) => string;
|
|
3
4
|
export declare const LEAF_DOMAIN_SEPARATOR = "0x00";
|
|
4
5
|
export declare const ZERO_HASH: string;
|
|
5
6
|
/**
|
|
6
7
|
* Computes the Keccak-256 hash of the concatenation of two hash values.
|
|
7
|
-
* @param a The first hash as a Hash type.
|
|
8
|
-
* @param b The second hash as a Hash type.
|
|
8
|
+
* @param a - The first hash as a Hash type.
|
|
9
|
+
* @param b - The second hash as a Hash type.
|
|
9
10
|
* @returns The Keccak-256 hash result as a Hash type.
|
|
10
11
|
*/
|
|
11
12
|
export declare function hashInternal(a: string, b: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/hasher/common.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE3D,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,CAAA;AAGjG,eAAO,MAAM,qBAAqB,SAAS,CAAA;AAC3C,eAAO,MAAM,SAAS,QAAyC,CAAA;AAE/D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzD"}
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/hasher/common.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE3D,mEAAmE;AACnE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,CAAA;AAGjG,eAAO,MAAM,qBAAqB,SAAS,CAAA;AAC3C,eAAO,MAAM,SAAS,QAAyC,CAAA;AAE/D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzD"}
|
package/dist/hasher/common.js
CHANGED
|
@@ -4,8 +4,8 @@ export const LEAF_DOMAIN_SEPARATOR = '0x00';
|
|
|
4
4
|
export const ZERO_HASH = hexlify(new Uint8Array(32).fill(0xff));
|
|
5
5
|
/**
|
|
6
6
|
* Computes the Keccak-256 hash of the concatenation of two hash values.
|
|
7
|
-
* @param a The first hash as a Hash type.
|
|
8
|
-
* @param b The second hash as a Hash type.
|
|
7
|
+
* @param a - The first hash as a Hash type.
|
|
8
|
+
* @param b - The second hash as a Hash type.
|
|
9
9
|
* @returns The Keccak-256 hash result as a Hash type.
|
|
10
10
|
*/
|
|
11
11
|
export function hashInternal(a, b) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/hasher/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/hasher/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAO5D,MAAM,yBAAyB,GAAG,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAA;AAC3C,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,CAAS;IAC/C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,CAAC;QAAA,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAClB,CAAC;IACD,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,yBAAyB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9D,OAAO,SAAS,CAAC,YAAY,CAAC,CAAA;AAChC,CAAC"}
|
package/dist/hasher/hasher.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { CCIPVersion, Lane } from '../types.ts';
|
|
1
|
+
import type { CCIPVersion, Lane, WithLogger } from '../types.ts';
|
|
2
2
|
import type { LeafHasher } from './common.ts';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Factory function that returns the right encoder based on the version of the lane.
|
|
5
|
+
* @param lane - Lane configuration.
|
|
6
|
+
* @param ctx - Context object containing logger.
|
|
7
|
+
* @returns Leaf hasher function for the destination chain.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getLeafHasher<V extends CCIPVersion = CCIPVersion>(lane: Lane<V>, ctx?: WithLogger): LeafHasher<V>;
|
|
4
10
|
//# sourceMappingURL=hasher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../src/hasher/hasher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../src/hasher/hasher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC/D,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,GAAG,CAAC,EAAE,UAAU,GACf,UAAU,CAAC,CAAC,CAAC,CAKf"}
|
package/dist/hasher/hasher.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { supportedChains } from "../supported-chains.js";
|
|
2
2
|
import { networkInfo } from "../utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Factory function that returns the right encoder based on the version of the lane.
|
|
5
|
+
* @param lane - Lane configuration.
|
|
6
|
+
* @param ctx - Context object containing logger.
|
|
7
|
+
* @returns Leaf hasher function for the destination chain.
|
|
8
|
+
*/
|
|
9
|
+
export function getLeafHasher(lane, ctx) {
|
|
5
10
|
const destFamily = networkInfo(lane.destChainSelector).family;
|
|
6
11
|
const chain = supportedChains[destFamily];
|
|
7
12
|
if (!chain)
|
|
8
13
|
throw new Error(`Unsupported chain family: ${destFamily}`);
|
|
9
|
-
return chain.getDestLeafHasher(lane);
|
|
14
|
+
return chain.getDestLeafHasher(lane, ctx);
|
|
10
15
|
}
|
|
11
16
|
//# sourceMappingURL=hasher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasher.js","sourceRoot":"","sources":["../../src/hasher/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC
|
|
1
|
+
{"version":3,"file":"hasher.js","sourceRoot":"","sources":["../../src/hasher/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAa,EACb,GAAgB;IAEhB,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAA;IAC7D,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;IACzC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,UAAU,EAAE,CAAC,CAAA;IACtE,OAAO,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAkB,CAAA;AAC5D,CAAC"}
|
|
@@ -2,28 +2,31 @@ export declare const MAX_NUMBER_TREE_LEAVES = 256;
|
|
|
2
2
|
type Hash = string;
|
|
3
3
|
/**
|
|
4
4
|
* Proof represents a proof data structure with hashes and source flags.
|
|
5
|
-
* @template Hash The hash type.
|
|
6
5
|
*/
|
|
7
6
|
export declare class Proof {
|
|
8
7
|
hashes: Hash[];
|
|
9
8
|
sourceFlags: boolean[];
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new Proof instance.
|
|
11
|
+
* @param hashes - Proof hashes.
|
|
12
|
+
* @param sourceFlags - Source flags indicating leaf vs internal nodes.
|
|
13
|
+
*/
|
|
10
14
|
constructor(hashes?: Hash[], sourceFlags?: boolean[]);
|
|
11
15
|
/**
|
|
12
16
|
* Counts the number of source flags that match the given boolean value.
|
|
13
|
-
* @param b The boolean value to count.
|
|
17
|
+
* @param b - The boolean value to count.
|
|
14
18
|
* @returns The count of source flags matching the provided boolean value.
|
|
15
19
|
*/
|
|
16
20
|
countSourceFlags(b: boolean): number;
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
23
|
* Represents a Merkle Tree data structure.
|
|
20
|
-
* @typeparam Hash The type of hash used in the tree.
|
|
21
24
|
*/
|
|
22
25
|
export declare class Tree {
|
|
23
26
|
layers: Hash[][];
|
|
24
27
|
/**
|
|
25
28
|
* Creates a new Merkle Tree using the provided context and leaf hashes.
|
|
26
|
-
* @param leafHashes An array of leaf hashes to construct the tree.
|
|
29
|
+
* @param leafHashes - An array of leaf hashes to construct the tree.
|
|
27
30
|
* @returns A new Merkle Tree instance.
|
|
28
31
|
* @throws Error if there are no leaf hashes provided.
|
|
29
32
|
*/
|
|
@@ -35,22 +38,21 @@ export declare class Tree {
|
|
|
35
38
|
root(): Hash;
|
|
36
39
|
/**
|
|
37
40
|
* Generates a Merkle proof for a set of indices in the tree.
|
|
38
|
-
* @param indices The indices for which to generate the proof.
|
|
41
|
+
* @param indices - The indices for which to generate the proof.
|
|
39
42
|
* @returns A proof object containing hashes and source flags.
|
|
40
43
|
*/
|
|
41
44
|
prove(indices: number[]): Proof;
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Converts an array of boolean proof flags to a BigNumber where each flag represents a bit.
|
|
45
|
-
* @param proofFlags An array of boolean proof flags.
|
|
48
|
+
* @param proofFlags - An array of boolean proof flags.
|
|
46
49
|
* @returns A BigNumber representing the encoded flags.
|
|
47
50
|
*/
|
|
48
51
|
export declare function proofFlagsToBits(proofFlags: boolean[]): bigint;
|
|
49
52
|
/**
|
|
50
53
|
* Verifies and computes the Merkle root hash based on provided leaf hashes and a Merkle proof.
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @param proof The Merkle proof containing hashes and source flags.
|
|
54
|
+
* @param leafHashes - An array of leaf hashes.
|
|
55
|
+
* @param proof - The Merkle proof containing hashes and source flags.
|
|
54
56
|
* @returns The computed Merkle root hash.
|
|
55
57
|
*/
|
|
56
58
|
export declare function verifyComputeRoot(leafHashes: Hash[], proof: Proof): Hash;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merklemulti.d.ts","sourceRoot":"","sources":["../../src/hasher/merklemulti.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,MAAM,CAAA;AAEzC,KAAK,IAAI,GAAG,MAAM,CAAA;AAQlB
|
|
1
|
+
{"version":3,"file":"merklemulti.d.ts","sourceRoot":"","sources":["../../src/hasher/merklemulti.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,MAAM,CAAA;AAEzC,KAAK,IAAI,GAAG,MAAM,CAAA;AAQlB;;GAEG;AACH,qBAAa,KAAK;IAChB,MAAM,EAAE,IAAI,EAAE,CAAK;IACnB,WAAW,EAAE,OAAO,EAAE,CAAK;IAE3B;;;;OAIG;gBACS,MAAM,GAAE,IAAI,EAAO,EAAE,WAAW,GAAE,OAAO,EAAO;IAK5D;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM;CAGrC;AAgGD;;GAEG;AACH,qBAAa,IAAI;IACf,MAAM,EAAE,IAAI,EAAE,EAAE,CAAA;IAEhB;;;;;OAKG;gBACS,UAAU,EAAE,IAAI,EAAE;IAyB9B;;;OAGG;IACH,IAAI,IAAI,IAAI;IAIZ;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK;CAahC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,CAY9D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAqFxE"}
|