@chainlink/ccip-sdk 0.97.0 → 1.0.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 +12 -9
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +16 -4
- package/dist/api/index.js.map +1 -1
- package/dist/aptos/index.d.ts +4 -6
- package/dist/aptos/index.d.ts.map +1 -1
- package/dist/aptos/index.js +0 -5
- package/dist/aptos/index.js.map +1 -1
- package/dist/aptos/logs.d.ts +2 -2
- package/dist/aptos/logs.d.ts.map +1 -1
- package/dist/chain.d.ts +11 -12
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +19 -1
- package/dist/chain.js.map +1 -1
- package/dist/errors/index.d.ts +3 -3
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +3 -3
- package/dist/errors/index.js.map +1 -1
- package/dist/evm/abi/OnRamp_2_0.d.ts +1 -1
- package/dist/evm/abi/OnRamp_2_0.js +1 -1
- package/dist/evm/abi/OnRamp_2_0.js.map +1 -1
- package/dist/evm/index.d.ts +1 -3
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +1 -5
- package/dist/evm/index.js.map +1 -1
- package/dist/evm/logs.d.ts +1 -1
- package/dist/evm/logs.js +1 -1
- package/dist/evm/offchain.d.ts +1 -14
- package/dist/evm/offchain.d.ts.map +1 -1
- package/dist/evm/offchain.js +1 -133
- package/dist/evm/offchain.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/offchain.d.ts +23 -6
- package/dist/offchain.d.ts.map +1 -1
- package/dist/offchain.js +92 -17
- package/dist/offchain.js.map +1 -1
- package/dist/requests.d.ts.map +1 -1
- package/dist/requests.js +0 -1
- package/dist/requests.js.map +1 -1
- package/dist/solana/idl/1.6.0/BASE_TOKEN_POOL.d.ts +1 -1
- package/dist/solana/idl/1.6.0/BASE_TOKEN_POOL.js +1 -1
- package/dist/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.d.ts +1 -1
- package/dist/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.js +1 -1
- package/dist/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.d.ts +1 -1
- package/dist/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.js +1 -1
- package/dist/solana/idl/1.6.0/CCIP_COMMON.d.ts +16 -1
- package/dist/solana/idl/1.6.0/CCIP_COMMON.d.ts.map +1 -1
- package/dist/solana/idl/1.6.0/CCIP_COMMON.js +16 -1
- package/dist/solana/idl/1.6.0/CCIP_COMMON.js.map +1 -1
- package/dist/solana/idl/1.6.0/CCIP_OFFRAMP.d.ts +1 -1
- package/dist/solana/idl/1.6.0/CCIP_OFFRAMP.js +1 -1
- package/dist/solana/idl/1.6.0/CCIP_ROUTER.d.ts +1 -1
- package/dist/solana/idl/1.6.0/CCIP_ROUTER.js +1 -1
- package/dist/solana/index.d.ts +6 -8
- package/dist/solana/index.d.ts.map +1 -1
- package/dist/solana/index.js +2 -7
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/offchain.d.ts +1 -13
- package/dist/solana/offchain.d.ts.map +1 -1
- package/dist/solana/offchain.js +1 -66
- package/dist/solana/offchain.js.map +1 -1
- package/dist/solana/utils.d.ts +4 -4
- package/dist/solana/utils.d.ts.map +1 -1
- package/dist/solana/utils.js +1 -1
- package/dist/solana/utils.js.map +1 -1
- package/dist/sui/index.d.ts +4 -6
- package/dist/sui/index.d.ts.map +1 -1
- package/dist/sui/index.js +0 -5
- package/dist/sui/index.js.map +1 -1
- package/dist/ton/exec.d.ts +2 -2
- package/dist/ton/exec.d.ts.map +1 -1
- package/dist/ton/exec.js +1 -1
- package/dist/ton/exec.js.map +1 -1
- package/dist/ton/index.d.ts +5 -6
- package/dist/ton/index.d.ts.map +1 -1
- package/dist/ton/index.js +0 -4
- package/dist/ton/index.js.map +1 -1
- package/dist/ton/types.d.ts +3 -5
- package/dist/ton/types.d.ts.map +1 -1
- package/dist/ton/types.js.map +1 -1
- package/dist/types.d.ts +10 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -5
- package/src/api/index.ts +21 -8
- package/src/aptos/index.ts +4 -11
- package/src/aptos/logs.ts +2 -2
- package/src/chain.ts +17 -12
- package/src/errors/index.ts +3 -0
- package/src/evm/abi/OnRamp_2_0.ts +1 -1
- package/src/evm/index.ts +4 -10
- package/src/evm/logs.ts +1 -1
- package/src/evm/offchain.ts +2 -191
- package/src/index.ts +8 -1
- package/src/offchain.ts +125 -28
- package/src/requests.ts +2 -3
- package/src/solana/idl/1.6.0/BASE_TOKEN_POOL.ts +2 -2
- package/src/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.ts +2 -2
- package/src/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.ts +2 -2
- package/src/solana/idl/1.6.0/CCIP_COMMON.ts +32 -2
- package/src/solana/idl/1.6.0/CCIP_OFFRAMP.ts +2 -2
- package/src/solana/idl/1.6.0/CCIP_ROUTER.ts +2 -2
- package/src/solana/index.ts +10 -17
- package/src/solana/offchain.ts +3 -100
- package/src/solana/utils.ts +8 -5
- package/src/sui/index.ts +5 -12
- package/src/ton/exec.ts +3 -6
- package/src/ton/index.ts +10 -15
- package/src/ton/types.ts +3 -6
- package/src/types.ts +13 -10
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,KAAK,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EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3D,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG;IAC/C,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2DA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;CACV,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;CACL,CAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2DA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;CACV,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;CACL,CAAA;AA8LV;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,gCAAgC;IAChC,UAAU,EAAE,CAAC;IACb,wCAAwC;IACxC,OAAO,EAAE,CAAC;IACV,wBAAwB;IACxB,MAAM,EAAE,CAAC;CACD,CAAA;AAIV;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,0DAA0D;IAC1D,IAAI,EAAE,MAAM;IACZ,0CAA0C;IAC1C,eAAe,EAAE,kBAAkB;IACnC,mDAAmD;IACnD,SAAS,EAAE,WAAW;IACtB,iDAAiD;IACjD,OAAO,EAAE,SAAS;IAClB,oDAAoD;IACpD,OAAO,EAAE,SAAS;IAClB,+CAA+C;IAC/C,MAAM,EAAE,QAAQ;IAChB,oDAAoD;IACpD,SAAS,EAAE,WAAW;IACtB,oDAAoD;IACpD,QAAQ,EAAE,UAAU;IACpB;;;;OAIG;IACH,OAAO,EAAE,SAAS;CACV,CAAA;AAIV;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,4CAA4C;IAC5C,OAAO,EAAE,SAAS;IAClB,qCAAqC;IACrC,SAAS,EAAE,WAAW;IACtB,qBAAqB;IACrB,MAAM,EAAE,QAAQ;CACR,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlink/ccip-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "SDK/Library to interact with CCIP",
|
|
5
5
|
"author": "Chainlink devs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/smartcontractkit/ccip-tools-ts.git"
|
|
10
10
|
},
|
|
11
|
+
"homepage": "https://docs.chain.link/ccip/tools/sdk/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/smartcontractkit/ccip-tools-ts/issues"
|
|
14
|
+
},
|
|
11
15
|
"type": "module",
|
|
12
16
|
"sideEffects": false,
|
|
13
17
|
"exports": {
|
|
@@ -61,15 +65,15 @@
|
|
|
61
65
|
"eslint-config-prettier": "10.1.8",
|
|
62
66
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
63
67
|
"eslint-plugin-import": "^2.32.0",
|
|
64
|
-
"eslint-plugin-jsdoc": "^62.7.
|
|
68
|
+
"eslint-plugin-jsdoc": "^62.7.1",
|
|
65
69
|
"eslint-plugin-prettier": "^5.5.5",
|
|
66
|
-
"eslint-plugin-tsdoc": "^0.5.
|
|
70
|
+
"eslint-plugin-tsdoc": "^0.5.1",
|
|
67
71
|
"ethers-abitype": "1.0.3",
|
|
68
72
|
"prettier": "^3.8.1",
|
|
69
73
|
"prool": "^0.0.17",
|
|
70
74
|
"typescript": "5.9.3",
|
|
71
|
-
"typescript-eslint": "8.56.
|
|
72
|
-
"viem": "^2.46.
|
|
75
|
+
"typescript-eslint": "8.56.1",
|
|
76
|
+
"viem": "^2.46.3"
|
|
73
77
|
},
|
|
74
78
|
"dependencies": {
|
|
75
79
|
"@aptos-labs/ts-sdk": "^5.2.1",
|
package/src/api/index.ts
CHANGED
|
@@ -15,9 +15,8 @@ import { decodeMessage } from '../requests.ts'
|
|
|
15
15
|
import {
|
|
16
16
|
type CCIPMessage,
|
|
17
17
|
type CCIPRequest,
|
|
18
|
-
type
|
|
18
|
+
type ChainLog,
|
|
19
19
|
type ExecutionInput,
|
|
20
|
-
type Log_,
|
|
21
20
|
type Logger,
|
|
22
21
|
type NetworkInfo,
|
|
23
22
|
type WithLogger,
|
|
@@ -44,6 +43,15 @@ export const DEFAULT_API_BASE_URL = 'https://api.ccip.chain.link'
|
|
|
44
43
|
/** Default timeout for API requests in milliseconds */
|
|
45
44
|
export const DEFAULT_TIMEOUT_MS = 30000
|
|
46
45
|
|
|
46
|
+
/** SDK version string for telemetry header */
|
|
47
|
+
// generate:nofail
|
|
48
|
+
// `export const SDK_VERSION = '${require('./package.json').version}-${require('child_process').execSync('git rev-parse --short HEAD').toString().trim()}'`
|
|
49
|
+
export const SDK_VERSION = '1.0.0-4cc6ccc'
|
|
50
|
+
// generate:end
|
|
51
|
+
|
|
52
|
+
/** SDK telemetry header name */
|
|
53
|
+
export const SDK_VERSION_HEADER = 'X-SDK-Version'
|
|
54
|
+
|
|
47
55
|
/**
|
|
48
56
|
* Context for CCIPAPIClient initialization.
|
|
49
57
|
*/
|
|
@@ -139,7 +147,7 @@ export class CCIPAPIClient {
|
|
|
139
147
|
this.baseUrl = baseUrl ?? DEFAULT_API_BASE_URL
|
|
140
148
|
this.logger = ctx?.logger ?? console
|
|
141
149
|
this.timeoutMs = ctx?.timeoutMs ?? DEFAULT_TIMEOUT_MS
|
|
142
|
-
this._fetch = ctx?.fetch ?? globalThis.fetch
|
|
150
|
+
this._fetch = ctx?.fetch ?? globalThis.fetch.bind(globalThis)
|
|
143
151
|
}
|
|
144
152
|
|
|
145
153
|
/**
|
|
@@ -167,7 +175,13 @@ export class CCIPAPIClient {
|
|
|
167
175
|
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs)
|
|
168
176
|
|
|
169
177
|
try {
|
|
170
|
-
return await this._fetch(url, {
|
|
178
|
+
return await this._fetch(url, {
|
|
179
|
+
signal: controller.signal,
|
|
180
|
+
headers: {
|
|
181
|
+
'Content-Type': 'application/json',
|
|
182
|
+
[SDK_VERSION_HEADER]: `CCIP SDK v${SDK_VERSION}`,
|
|
183
|
+
},
|
|
184
|
+
})
|
|
171
185
|
} catch (error) {
|
|
172
186
|
if (error instanceof Error && error.name === 'AbortError') {
|
|
173
187
|
throw new CCIPTimeoutError(operation, this.timeoutMs)
|
|
@@ -429,7 +443,7 @@ export class CCIPAPIClient {
|
|
|
429
443
|
getExecutionInput(messageId: string): Promise<ExecutionInput & { offRamp: string }> {
|
|
430
444
|
throw new CCIPNotImplementedError(`CCIPAPIClient.getExecutionInput`)
|
|
431
445
|
// TODO: fetch (memoized) request with metadata from `getMessageById`
|
|
432
|
-
// TODO: if request doesn't contain
|
|
446
|
+
// TODO: if request doesn't contain everything needed (e.g. <v2.0), fetch `batch` and
|
|
433
447
|
// `offchainTokenData` from `/execution-input`
|
|
434
448
|
// TODO: if <v2.0, `calculateManualExecProof` and return `offRamp` and `input`
|
|
435
449
|
}
|
|
@@ -483,7 +497,7 @@ export class CCIPAPIClient {
|
|
|
483
497
|
}
|
|
484
498
|
|
|
485
499
|
// Build log from API data
|
|
486
|
-
const log:
|
|
500
|
+
const log: ChainLog = {
|
|
487
501
|
transactionHash: sendTransactionHash,
|
|
488
502
|
address: raw.onramp,
|
|
489
503
|
data: { message: parseJson(text) },
|
|
@@ -493,11 +507,10 @@ export class CCIPAPIClient {
|
|
|
493
507
|
}
|
|
494
508
|
|
|
495
509
|
// Build tx from API data
|
|
496
|
-
const tx
|
|
510
|
+
const tx = {
|
|
497
511
|
hash: log.transactionHash,
|
|
498
512
|
timestamp: sendTimestamp_,
|
|
499
513
|
from: origin,
|
|
500
|
-
logs: [log],
|
|
501
514
|
blockNumber: Number(sendBlockNumber),
|
|
502
515
|
}
|
|
503
516
|
log.tx = tx
|
package/src/aptos/index.ts
CHANGED
|
@@ -56,14 +56,13 @@ import {
|
|
|
56
56
|
type CCIPExecution,
|
|
57
57
|
type CCIPMessage,
|
|
58
58
|
type CCIPRequest,
|
|
59
|
+
type ChainLog,
|
|
59
60
|
type ChainTransaction,
|
|
60
61
|
type CommitReport,
|
|
61
62
|
type ExecutionInput,
|
|
62
63
|
type ExecutionReceipt,
|
|
63
64
|
type Lane,
|
|
64
|
-
type Log_,
|
|
65
65
|
type NetworkInfo,
|
|
66
|
-
type OffchainTokenData,
|
|
67
66
|
type WithLogger,
|
|
68
67
|
ChainFamily,
|
|
69
68
|
} from '../types.ts'
|
|
@@ -236,7 +235,7 @@ export class AptosChain extends Chain<typeof ChainFamily.Aptos> {
|
|
|
236
235
|
}
|
|
237
236
|
|
|
238
237
|
/** {@inheritDoc Chain.getLogs} */
|
|
239
|
-
async *getLogs(opts: LogFilter & { versionAsHash?: boolean }): AsyncIterableIterator<
|
|
238
|
+
async *getLogs(opts: LogFilter & { versionAsHash?: boolean }): AsyncIterableIterator<ChainLog> {
|
|
240
239
|
yield* streamAptosLogs(this, opts)
|
|
241
240
|
}
|
|
242
241
|
|
|
@@ -415,7 +414,7 @@ export class AptosChain extends Chain<typeof ChainFamily.Aptos> {
|
|
|
415
414
|
* @returns Array of CommitReport or undefined if not valid.
|
|
416
415
|
* @throws {@link CCIPAptosLogInvalidError} if log data format is invalid
|
|
417
416
|
*/
|
|
418
|
-
static decodeCommits({ data }: Pick<
|
|
417
|
+
static decodeCommits({ data }: Pick<ChainLog, 'data'>, lane?: Lane): CommitReport[] | undefined {
|
|
419
418
|
if (!data || typeof data != 'object') throw new CCIPAptosLogInvalidError(data)
|
|
420
419
|
const data_ = data as {
|
|
421
420
|
blessed_merkle_roots: unknown[] | undefined
|
|
@@ -449,7 +448,7 @@ export class AptosChain extends Chain<typeof ChainFamily.Aptos> {
|
|
|
449
448
|
* @returns ExecutionReceipt or undefined if not valid.
|
|
450
449
|
* @throws {@link CCIPAptosLogInvalidError} if log data format is invalid
|
|
451
450
|
*/
|
|
452
|
-
static decodeReceipt({ data }: Pick<
|
|
451
|
+
static decodeReceipt({ data }: Pick<ChainLog, 'data'>): ExecutionReceipt | undefined {
|
|
453
452
|
if (!data || typeof data != 'object') throw new CCIPAptosLogInvalidError(data)
|
|
454
453
|
const data_ = data as { message_id: string; state: number }
|
|
455
454
|
if (!data_.message_id || !data_.state) return
|
|
@@ -553,12 +552,6 @@ export class AptosChain extends Chain<typeof ChainFamily.Aptos> {
|
|
|
553
552
|
return (await this.getMessagesInTx(await this.getTransaction(hash)))[0]!
|
|
554
553
|
}
|
|
555
554
|
|
|
556
|
-
/** {@inheritDoc Chain.getOffchainTokenData} */
|
|
557
|
-
getOffchainTokenData(request: CCIPRequest): Promise<OffchainTokenData[]> {
|
|
558
|
-
// default offchain token data
|
|
559
|
-
return Promise.resolve(request.message.tokenAmounts.map(() => undefined))
|
|
560
|
-
}
|
|
561
|
-
|
|
562
555
|
/**
|
|
563
556
|
* {@inheritDoc Chain.generateUnsignedExecute}
|
|
564
557
|
* @throws {@link CCIPAptosExtraArgsV2RequiredError} if message missing EVMExtraArgsV2 fields
|
package/src/aptos/logs.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
CCIPLogsWatchRequiresStartError,
|
|
16
16
|
CCIPTopicsInvalidError,
|
|
17
17
|
} from '../errors/index.ts'
|
|
18
|
-
import type {
|
|
18
|
+
import type { ChainLog } from '../types.ts'
|
|
19
19
|
import { sleep } from '../utils.ts'
|
|
20
20
|
|
|
21
21
|
const DEFAULT_POLL_INTERVAL = 5e3
|
|
@@ -241,7 +241,7 @@ async function* fetchEventsBackward(
|
|
|
241
241
|
export async function* streamAptosLogs(
|
|
242
242
|
ctx: { provider: Aptos },
|
|
243
243
|
opts: LogFilter & { versionAsHash?: boolean },
|
|
244
|
-
): AsyncGenerator<
|
|
244
|
+
): AsyncGenerator<ChainLog> {
|
|
245
245
|
const limit = 100
|
|
246
246
|
if (!opts.address || !opts.address.includes('::')) throw new CCIPAptosAddressModuleRequiredError()
|
|
247
247
|
if (opts.topics?.length !== 1 || typeof opts.topics[0] !== 'string')
|
package/src/chain.ts
CHANGED
|
@@ -22,6 +22,7 @@ import type {
|
|
|
22
22
|
SuiExtraArgsV1,
|
|
23
23
|
} from './extra-args.ts'
|
|
24
24
|
import type { LeafHasher } from './hasher/common.ts'
|
|
25
|
+
import { getOffchainTokenData } from './offchain.ts'
|
|
25
26
|
import { getMessagesInTx } from './requests.ts'
|
|
26
27
|
import { DEFAULT_GAS_LIMIT } from './shared/constants.ts'
|
|
27
28
|
import type { UnsignedSolanaTx } from './solana/types.ts'
|
|
@@ -34,12 +35,12 @@ import {
|
|
|
34
35
|
type CCIPVerifications,
|
|
35
36
|
type CCIPVersion,
|
|
36
37
|
type ChainFamily,
|
|
38
|
+
type ChainLog,
|
|
37
39
|
type ChainTransaction,
|
|
38
40
|
type CommitReport,
|
|
39
41
|
type ExecutionInput,
|
|
40
42
|
type ExecutionReceipt,
|
|
41
43
|
type Lane,
|
|
42
|
-
type Log_,
|
|
43
44
|
type Logger,
|
|
44
45
|
type MessageInput,
|
|
45
46
|
type NetworkInfo,
|
|
@@ -501,7 +502,7 @@ export abstract class Chain<F extends ChainFamily = ChainFamily> {
|
|
|
501
502
|
* @throws {@link CCIPLogsWatchRequiresStartError} if watch mode is used without startBlock or startTime
|
|
502
503
|
* @throws {@link CCIPLogsAddressRequiredError} if address is required but not provided (chain-specific)
|
|
503
504
|
*/
|
|
504
|
-
abstract getLogs(opts: LogFilter): AsyncIterableIterator<
|
|
505
|
+
abstract getLogs(opts: LogFilter): AsyncIterableIterator<ChainLog>
|
|
505
506
|
|
|
506
507
|
/**
|
|
507
508
|
* Fetch all CCIP requests in a transaction.
|
|
@@ -910,20 +911,24 @@ export abstract class Chain<F extends ChainFamily = ChainFamily> {
|
|
|
910
911
|
): Promise<CCIPRequest>
|
|
911
912
|
/**
|
|
912
913
|
* Fetch supported offchain token data for a request from this network.
|
|
914
|
+
* It logs but doesn't throw in case it can't fetch attestation, as the transfers may not be
|
|
915
|
+
* from the expected attestation providers. It returns default offchainData=undefined for those.
|
|
913
916
|
*
|
|
914
|
-
* @param request - CCIP request, with tx
|
|
917
|
+
* @param request - CCIP request, with tx.hash and message
|
|
915
918
|
* @returns Promise resolving to array with one offchain token data for each token transfer
|
|
916
919
|
*
|
|
917
|
-
* @throws {@link CCIPUsdcAttestationError} if USDC attestation fetch fails (transient)
|
|
918
|
-
* @throws {@link CCIPLbtcAttestationError} if LBTC attestation fetch fails (transient)
|
|
919
|
-
*
|
|
920
920
|
* @example Get offchain token data for USDC transfer
|
|
921
921
|
* ```typescript
|
|
922
922
|
* const offchainData = await source.getOffchainTokenData(request)
|
|
923
923
|
* // Use in execution report
|
|
924
924
|
* ```
|
|
925
925
|
*/
|
|
926
|
-
|
|
926
|
+
async getOffchainTokenData(
|
|
927
|
+
request: PickDeep<CCIPRequest, 'tx.hash' | `message`>,
|
|
928
|
+
): Promise<OffchainTokenData[]> {
|
|
929
|
+
return getOffchainTokenData(request, this)
|
|
930
|
+
}
|
|
931
|
+
|
|
927
932
|
/**
|
|
928
933
|
* Generate unsigned tx to manuallyExecute a message.
|
|
929
934
|
*
|
|
@@ -934,7 +939,7 @@ export abstract class Chain<F extends ChainFamily = ChainFamily> {
|
|
|
934
939
|
* ```typescript
|
|
935
940
|
* const unsignedTx = await dest.generateUnsignedExecute({
|
|
936
941
|
* offRamp: offRampAddress,
|
|
937
|
-
*
|
|
942
|
+
* input,
|
|
938
943
|
* payer: walletAddress,
|
|
939
944
|
* })
|
|
940
945
|
* // Sign and send with external wallet
|
|
@@ -977,7 +982,7 @@ export abstract class Chain<F extends ChainFamily = ChainFamily> {
|
|
|
977
982
|
* May be specialized by some subclasses.
|
|
978
983
|
*
|
|
979
984
|
* @param opts - getVerifications options
|
|
980
|
-
* @returns
|
|
985
|
+
* @returns CCIPVerifications
|
|
981
986
|
*
|
|
982
987
|
* @throws {@link CCIPCommitNotFoundError} if no commit found for the request (transient)
|
|
983
988
|
*
|
|
@@ -1405,7 +1410,7 @@ export type ChainStatic<F extends ChainFamily = ChainFamily> = Function & {
|
|
|
1405
1410
|
* }
|
|
1406
1411
|
* ```
|
|
1407
1412
|
*/
|
|
1408
|
-
decodeMessage(log: Pick<
|
|
1413
|
+
decodeMessage(log: Pick<ChainLog, 'data'>): CCIPMessage | undefined
|
|
1409
1414
|
/**
|
|
1410
1415
|
* Try to decode an extraArgs array serialized for this chain family.
|
|
1411
1416
|
*
|
|
@@ -1461,7 +1466,7 @@ export type ChainStatic<F extends ChainFamily = ChainFamily> = Function & {
|
|
|
1461
1466
|
* }
|
|
1462
1467
|
* ```
|
|
1463
1468
|
*/
|
|
1464
|
-
decodeCommits(log: Pick<
|
|
1469
|
+
decodeCommits(log: Pick<ChainLog, 'data'>, lane?: Lane): CommitReport[] | undefined
|
|
1465
1470
|
/**
|
|
1466
1471
|
* Decode a receipt (ExecutionStateChanged) event.
|
|
1467
1472
|
*
|
|
@@ -1476,7 +1481,7 @@ export type ChainStatic<F extends ChainFamily = ChainFamily> = Function & {
|
|
|
1476
1481
|
* }
|
|
1477
1482
|
* ```
|
|
1478
1483
|
*/
|
|
1479
|
-
decodeReceipt(log: Pick<
|
|
1484
|
+
decodeReceipt(log: Pick<ChainLog, 'data'>): ExecutionReceipt | undefined
|
|
1480
1485
|
/**
|
|
1481
1486
|
* Receive a bytes array and try to decode and normalize it as an address of this chain family.
|
|
1482
1487
|
*
|
package/src/errors/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export {
|
|
|
10
10
|
CCIPChainFamilyUnsupportedError,
|
|
11
11
|
CCIPChainNotFoundError,
|
|
12
12
|
CCIPMethodUnsupportedError,
|
|
13
|
+
CCIPNetworkFamilyUnsupportedError,
|
|
13
14
|
} from './specialized.ts'
|
|
14
15
|
|
|
15
16
|
// Specialized errors - Block & Transaction
|
|
@@ -67,6 +68,7 @@ export { CCIPExtraArgsInvalidError, CCIPExtraArgsParseError } from './specialize
|
|
|
67
68
|
|
|
68
69
|
// Specialized errors - Token & Registry
|
|
69
70
|
export {
|
|
71
|
+
CCIPLegacyTokenPoolsUnsupportedError,
|
|
70
72
|
CCIPTokenDecimalsInsufficientError,
|
|
71
73
|
CCIPTokenNotConfiguredError,
|
|
72
74
|
CCIPTokenNotFoundError,
|
|
@@ -135,6 +137,7 @@ export {
|
|
|
135
137
|
CCIPAptosNetworkUnknownError,
|
|
136
138
|
CCIPAptosRegistryTypeInvalidError,
|
|
137
139
|
CCIPAptosTokenNotRegisteredError,
|
|
140
|
+
CCIPAptosTopicInvalidError,
|
|
138
141
|
CCIPAptosTransactionInvalidError,
|
|
139
142
|
CCIPAptosTransactionTypeInvalidError,
|
|
140
143
|
CCIPAptosTransactionTypeUnexpectedError,
|
package/src/evm/index.ts
CHANGED
|
@@ -60,15 +60,14 @@ import {
|
|
|
60
60
|
type CCIPMessage,
|
|
61
61
|
type CCIPRequest,
|
|
62
62
|
type CCIPVerifications,
|
|
63
|
+
type ChainLog,
|
|
63
64
|
type ChainTransaction,
|
|
64
65
|
type CommitReport,
|
|
65
66
|
type ExecutionInput,
|
|
66
67
|
type ExecutionReceipt,
|
|
67
68
|
type ExecutionState,
|
|
68
69
|
type Lane,
|
|
69
|
-
type Log_,
|
|
70
70
|
type NetworkInfo,
|
|
71
|
-
type OffchainTokenData,
|
|
72
71
|
type WithLogger,
|
|
73
72
|
CCIPVersion,
|
|
74
73
|
ChainFamily,
|
|
@@ -122,7 +121,7 @@ import {
|
|
|
122
121
|
} from './messages.ts'
|
|
123
122
|
export { decodeMessageV1 }
|
|
124
123
|
export type { MessageV1, TokenTransferV1 }
|
|
125
|
-
import { encodeEVMOffchainTokenData
|
|
124
|
+
import { encodeEVMOffchainTokenData } from './offchain.ts'
|
|
126
125
|
import { buildMessageForDest, decodeMessage, getMessagesInBatch } from '../requests.ts'
|
|
127
126
|
import { type UnsignedEVMTx, resultToObject } from './types.ts'
|
|
128
127
|
export type { UnsignedEVMTx }
|
|
@@ -339,9 +338,9 @@ export class EVMChain extends Chain<typeof ChainFamily.EVM> {
|
|
|
339
338
|
const chainTx = {
|
|
340
339
|
...tx,
|
|
341
340
|
timestamp,
|
|
342
|
-
logs: [] as
|
|
341
|
+
logs: [] as ChainLog[],
|
|
343
342
|
}
|
|
344
|
-
const logs:
|
|
343
|
+
const logs: ChainLog[] = tx.logs.map((l) => Object.assign(l, { tx: chainTx }))
|
|
345
344
|
chainTx.logs = logs
|
|
346
345
|
return chainTx
|
|
347
346
|
}
|
|
@@ -1073,11 +1072,6 @@ export class EVMChain extends Chain<typeof ChainFamily.EVM> {
|
|
|
1073
1072
|
return (await this.getMessagesInTx(await this.getTransaction(tx)))[0]!
|
|
1074
1073
|
}
|
|
1075
1074
|
|
|
1076
|
-
/** {@inheritDoc Chain.getOffchainTokenData} */
|
|
1077
|
-
getOffchainTokenData(request: CCIPRequest): Promise<OffchainTokenData[]> {
|
|
1078
|
-
return fetchEVMOffchainTokenData(request, this)
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
1075
|
/**
|
|
1082
1076
|
* {@inheritDoc Chain.generateUnsignedExecute}
|
|
1083
1077
|
* @returns array containing one unsigned `manuallyExecute` TransactionRequest object
|
package/src/evm/logs.ts
CHANGED
|
@@ -183,7 +183,7 @@ async function getFallbackArchiveLogs(
|
|
|
183
183
|
* - If undefined (default): paginate main provider only by filter.page
|
|
184
184
|
* - If false: first try whole range with main provider, then fallback to archive provider
|
|
185
185
|
* - If true: don't paginate (throw if can't fetch wide range from either provider)
|
|
186
|
-
* @param ctx - Context object containing provider, logger and
|
|
186
|
+
* @param ctx - Context object containing provider, logger and destroy$ notify promise
|
|
187
187
|
* @returns Async iterator of logs.
|
|
188
188
|
*/
|
|
189
189
|
export async function* getEvmLogs(
|
package/src/evm/offchain.ts
CHANGED
|
@@ -1,90 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { getLbtcAttestation, getUsdcAttestation } from '../offchain.ts'
|
|
4
|
-
import type {
|
|
5
|
-
CCIPMessage,
|
|
6
|
-
CCIPRequest,
|
|
7
|
-
NetworkType,
|
|
8
|
-
OffchainTokenData,
|
|
9
|
-
WithLogger,
|
|
10
|
-
} from '../types.ts'
|
|
11
|
-
import { networkInfo } from '../utils.ts'
|
|
12
|
-
import { defaultAbiCoder, interfaces, requestsFragments } from './const.ts'
|
|
13
|
-
import { type SourceTokenData, parseSourceTokenData } from './messages.ts'
|
|
14
|
-
|
|
15
|
-
const BURNED_EVENT_1_5 = interfaces.TokenPool_v1_5.getEvent('Burned')!
|
|
16
|
-
const BURNED_EVENT_1_6 = interfaces.TokenPool_v1_6.getEvent('LockedOrBurned')!
|
|
17
|
-
const BURNED_EVENT_TOPIC_HASHES = new Set([BURNED_EVENT_1_5.topicHash, BURNED_EVENT_1_6.topicHash])
|
|
18
|
-
|
|
19
|
-
const USDC_EVENT = EventFragment.from('MessageSent(bytes message)')
|
|
20
|
-
const TRANSFER_EVENT = EventFragment.from('Transfer(address from, address to, uint256 value)')
|
|
21
|
-
|
|
22
|
-
export const LBTC_EVENT = EventFragment.from(
|
|
23
|
-
'DepositToBridge(address fromAddress, bytes32 toAddress, bytes32 payloadHash, bytes payload)',
|
|
24
|
-
)
|
|
25
|
-
export const LBTC_EVENT_V2 = EventFragment.from(
|
|
26
|
-
'DepositToBridge(address fromAddress, bytes32 toAddress, bytes32 payloadHash)',
|
|
27
|
-
)
|
|
28
|
-
const LBTC_EVENTS_HASHES = new Set([LBTC_EVENT.topicHash, LBTC_EVENT_V2.topicHash])
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Fetch offchain token data for all transfers in request
|
|
32
|
-
*
|
|
33
|
-
* @param request - Request (or subset of) to fetch offchainTokenData for
|
|
34
|
-
* @returns Array of byte arrays, one per transfer in request
|
|
35
|
-
*/
|
|
36
|
-
export async function fetchEVMOffchainTokenData(
|
|
37
|
-
request: Pick<CCIPRequest, 'tx'> & {
|
|
38
|
-
message: CCIPMessage
|
|
39
|
-
log: Pick<CCIPRequest['log'], 'index'>
|
|
40
|
-
},
|
|
41
|
-
ctx: WithLogger,
|
|
42
|
-
): Promise<OffchainTokenData[]> {
|
|
43
|
-
const { networkType } = networkInfo(request.message.sourceChainSelector)
|
|
44
|
-
// there's a chance there are other CCIPSendRequested in same tx,
|
|
45
|
-
// and they may contain USDC transfers as well, so we select
|
|
46
|
-
// any USDC logs after that and before our CCIPSendRequested
|
|
47
|
-
const prevCcipRequestIdx =
|
|
48
|
-
request.tx.logs.find(
|
|
49
|
-
({ topics, index }) => topics[0]! in requestsFragments && index < request.log.index,
|
|
50
|
-
)?.index ?? -1
|
|
51
|
-
const usdcRequestLogs = request.tx.logs.filter(
|
|
52
|
-
({ index }) => prevCcipRequestIdx < index && index < request.log.index,
|
|
53
|
-
) as Log[]
|
|
54
|
-
|
|
55
|
-
const offchainTokenData: OffchainTokenData[] = request.message.tokenAmounts.map(
|
|
56
|
-
() => undefined, // default tokenData
|
|
57
|
-
)
|
|
58
|
-
const usdcTokenData = await getUsdcTokenData(
|
|
59
|
-
request.message.tokenAmounts,
|
|
60
|
-
usdcRequestLogs,
|
|
61
|
-
networkType,
|
|
62
|
-
ctx,
|
|
63
|
-
)
|
|
64
|
-
let lbtcTokenData: OffchainTokenData[] = []
|
|
65
|
-
try {
|
|
66
|
-
let tokenAmounts
|
|
67
|
-
if ('sourceTokenData' in request.message) {
|
|
68
|
-
tokenAmounts = request.message.sourceTokenData.map(parseSourceTokenData)
|
|
69
|
-
} else {
|
|
70
|
-
tokenAmounts = request.message.tokenAmounts
|
|
71
|
-
}
|
|
72
|
-
//for lbtc we distinguish logs by hash in event, so we can pass all of them
|
|
73
|
-
lbtcTokenData = await getLbtcTokenData(tokenAmounts, request.tx.logs as Log[], networkType, ctx)
|
|
74
|
-
} catch (_) {
|
|
75
|
-
// pass
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
for (let i = 0; i < offchainTokenData.length; i++) {
|
|
79
|
-
if (usdcTokenData[i]) {
|
|
80
|
-
offchainTokenData[i] = usdcTokenData[i]
|
|
81
|
-
} else if (lbtcTokenData[i]) {
|
|
82
|
-
offchainTokenData[i] = lbtcTokenData[i]
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return offchainTokenData
|
|
87
|
-
}
|
|
1
|
+
import type { OffchainTokenData } from '../types.ts'
|
|
2
|
+
import { defaultAbiCoder } from './const.ts'
|
|
88
3
|
|
|
89
4
|
/**
|
|
90
5
|
* Encodes offchain token data for EVM execution.
|
|
@@ -99,107 +14,3 @@ export function encodeEVMOffchainTokenData(data: OffchainTokenData): string {
|
|
|
99
14
|
}
|
|
100
15
|
return '0x'
|
|
101
16
|
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Try to fetch USDC attestations for transfers, return undefined in position if can't
|
|
105
|
-
*
|
|
106
|
-
* @param tokenAmounts - all tokenAmounts to try
|
|
107
|
-
* @param allLogsInRequest - all other logs in same tx as CCIPSendRequested
|
|
108
|
-
* @param networkType - network type (mainnet or testnet)
|
|
109
|
-
* @returns array where each position is either the attestation for that transfer or undefined
|
|
110
|
-
**/
|
|
111
|
-
async function getUsdcTokenData(
|
|
112
|
-
tokenAmounts: CCIPMessage['tokenAmounts'],
|
|
113
|
-
allLogsInRequest: Pick<Log, 'topics' | 'address' | 'data'>[],
|
|
114
|
-
networkType: NetworkType,
|
|
115
|
-
{ logger = console }: WithLogger = {},
|
|
116
|
-
): Promise<OffchainTokenData[]> {
|
|
117
|
-
const attestations: OffchainTokenData[] = []
|
|
118
|
-
|
|
119
|
-
const messageSentPerTokenAndPool = allLogsInRequest.reduce((acc, log, i, arr) => {
|
|
120
|
-
// for our MessageSent of interest (USDC-like), the token is the contract
|
|
121
|
-
// which emitted a (burn) Transfer immediately before this event, and the pool emitted a Burned
|
|
122
|
-
// event 2 events after
|
|
123
|
-
const transferLog = arr[i - 1]
|
|
124
|
-
const poolLog = arr[i + 2]
|
|
125
|
-
if (
|
|
126
|
-
log.topics[0] !== USDC_EVENT.topicHash ||
|
|
127
|
-
transferLog?.topics[0] !== TRANSFER_EVENT.topicHash ||
|
|
128
|
-
!poolLog?.topics.length ||
|
|
129
|
-
!BURNED_EVENT_TOPIC_HASHES.has(poolLog.topics[0]!)
|
|
130
|
-
) {
|
|
131
|
-
return acc
|
|
132
|
-
}
|
|
133
|
-
const token = transferLog.address
|
|
134
|
-
const pool = poolLog.address
|
|
135
|
-
acc.set(token, [...(acc.get(token) ?? []), log])
|
|
136
|
-
acc.set(pool, [...(acc.get(pool) ?? []), log])
|
|
137
|
-
return acc
|
|
138
|
-
}, new Map<string | Addressable, (typeof allLogsInRequest)[number][]>())
|
|
139
|
-
|
|
140
|
-
for (const [i, tokenAmount] of tokenAmounts.entries()) {
|
|
141
|
-
const tokenOrPool = 'token' in tokenAmount ? tokenAmount.token : tokenAmount.sourcePoolAddress
|
|
142
|
-
|
|
143
|
-
// what if there are more USDC transfers of this same token after this one?
|
|
144
|
-
const tokenTransfersCountAfter = tokenAmounts.filter(
|
|
145
|
-
(ta, j) => ('token' in ta ? ta.token : ta.sourcePoolAddress) === tokenOrPool && j > i,
|
|
146
|
-
).length
|
|
147
|
-
|
|
148
|
-
let messageSentLog: (typeof allLogsInRequest)[number] | undefined
|
|
149
|
-
const messageSents = messageSentPerTokenAndPool.get(tokenOrPool)
|
|
150
|
-
if (messageSents) {
|
|
151
|
-
// look from the end (near our request), but skip MessageSents for further transfers
|
|
152
|
-
messageSentLog = messageSents[messageSents.length - 1 - tokenTransfersCountAfter]
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
let tokenData: OffchainTokenData
|
|
156
|
-
if (messageSentLog) {
|
|
157
|
-
let message
|
|
158
|
-
try {
|
|
159
|
-
message = defaultAbiCoder.decode(USDC_EVENT.inputs, messageSentLog.data)[0] as string
|
|
160
|
-
const attestation = await getUsdcAttestation(message, networkType)
|
|
161
|
-
tokenData = {
|
|
162
|
-
_tag: 'usdc',
|
|
163
|
-
message,
|
|
164
|
-
attestation,
|
|
165
|
-
}
|
|
166
|
-
// encoding of OffchainTokenData to be done as part of Chain.executeReceipt
|
|
167
|
-
} catch (err) {
|
|
168
|
-
// maybe not a USDC transfer, or not ready
|
|
169
|
-
logger.warn(`❌ EVM CCTP: Failed to fetch attestation for message:`, message, err)
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
attestations.push(tokenData)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return attestations
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Try to fetch LBTC attestations for transfers, return undefined in position if can't or not required
|
|
180
|
-
**/
|
|
181
|
-
async function getLbtcTokenData(
|
|
182
|
-
tokenAmounts: readonly Pick<SourceTokenData, 'extraData'>[],
|
|
183
|
-
allLogsInRequest: readonly Pick<Log, 'topics' | 'address' | 'data'>[],
|
|
184
|
-
networkType: NetworkType,
|
|
185
|
-
{ logger = console }: WithLogger = {},
|
|
186
|
-
): Promise<OffchainTokenData[]> {
|
|
187
|
-
const lbtcDepositHashes = new Set(
|
|
188
|
-
allLogsInRequest
|
|
189
|
-
.filter(({ topics }) => LBTC_EVENTS_HASHES.has(topics[0]!))
|
|
190
|
-
.map(({ topics }) => topics[3]),
|
|
191
|
-
)
|
|
192
|
-
return Promise.all(
|
|
193
|
-
tokenAmounts.map(async ({ extraData }) => {
|
|
194
|
-
// Attestation is required when SourceTokenData.extraData is 32 bytes long ('0x' + 64 hex chars)
|
|
195
|
-
// otherwise attestation is not required
|
|
196
|
-
if (lbtcDepositHashes.has(extraData)) {
|
|
197
|
-
try {
|
|
198
|
-
return { _tag: 'lbtc', extraData, ...(await getLbtcAttestation(extraData, networkType)) }
|
|
199
|
-
} catch (err) {
|
|
200
|
-
logger.warn(`❌ EVM LBTC: Failed to fetch attestation for message:`, extraData, err)
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}),
|
|
204
|
-
)
|
|
205
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,12 @@ export type {
|
|
|
13
13
|
CCIPAPIClientContext,
|
|
14
14
|
LaneLatencyResponse,
|
|
15
15
|
} from './api/index.ts'
|
|
16
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
CCIPAPIClient,
|
|
18
|
+
DEFAULT_API_BASE_URL,
|
|
19
|
+
SDK_VERSION,
|
|
20
|
+
SDK_VERSION_HEADER,
|
|
21
|
+
} from './api/index.ts'
|
|
17
22
|
|
|
18
23
|
export type {
|
|
19
24
|
ApiRetryConfig,
|
|
@@ -41,12 +46,14 @@ export {
|
|
|
41
46
|
encodeExtraArgs,
|
|
42
47
|
} from './extra-args.ts'
|
|
43
48
|
export { estimateReceiveExecution } from './gas.ts'
|
|
49
|
+
export { getOffchainTokenData } from './offchain.ts'
|
|
44
50
|
export { decodeMessage, getMessagesForSender, sourceToDestTokenAddresses } from './requests.ts'
|
|
45
51
|
export {
|
|
46
52
|
type CCIPExecution,
|
|
47
53
|
type CCIPMessage,
|
|
48
54
|
type CCIPRequest,
|
|
49
55
|
type CCIPVerifications,
|
|
56
|
+
type ChainLog,
|
|
50
57
|
type ChainTransaction,
|
|
51
58
|
type CommitReport,
|
|
52
59
|
type ExecutionInput,
|