Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.94.0]

- SDK: Browser compatibility - explicit `buffer` dependency and imports for cross-platform support
- CI: Added `publint` and `@arethetypeswrong/cli` validation for package exports
- ESLint: `import/no-nodejs-modules` rule prevents Node.js-only imports in SDK
- Docs: Cross-Platform Portability guidelines in CONTRIBUTING.md
- SDK: Populate default extraArgs for getFee, sendMessage methods, requiring minimal parameters to use these methods

## [0.93.0] - 2025-12-26 - Pre-release
## [0.93.0] - 2025-12-31 - Pre-release

- SDK: `CCIPAPIClient` and `Chain.getLaneLatency()` for querying lane delivery times via CCIP API
- CLI: `lane-latency <source> <dest>` command; `--no-api` flag for decentralized mode
Expand Down
16 changes: 8 additions & 8 deletions ccip-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainlink/ccip-cli",
"version": "0.93.0",
"version": "0.94.0",
"description": "CCIP Command Line Interface, based on @chainlink/ccip-sdk",
"author": "Chainlink devs",
"license": "MIT",
Expand Down Expand Up @@ -32,34 +32,34 @@
],
"devDependencies": {
"@eslint/js": "^9.39.2",
"@types/node": "25.0.3",
"@types/node": "25.0.6",
"@types/yargs": "17.0.35",
"eslint": "^9.39.2",
"eslint-config-prettier": "10.1.8",
"eslint-import-resolver-typescript": "4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsdoc": "^61.5.0",
"eslint-plugin-jsdoc": "^62.0.0",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-tsdoc": "^0.5.0",
"prettier": "^3.7.4",
"tsx": "4.21.0",
"typescript": "5.9.3",
"typescript-eslint": "8.51.0"
"typescript-eslint": "8.52.0"
},
"dependencies": {
"@aptos-labs/ts-sdk": "^5.2.0",
"@chainlink/ccip-sdk": "^0.93.0",
"@aptos-labs/ts-sdk": "^5.2.1",
"@chainlink/ccip-sdk": "^0.94.0",
"@coral-xyz/anchor": "^0.29.0",
"@ethers-ext/signer-ledger": "^6.0.0-beta.1",
"@inquirer/prompts": "8.1.0",
"@inquirer/prompts": "8.2.0",
"@ledgerhq/hw-app-aptos": "^6.34.11",
"@ledgerhq/hw-app-solana": "^7.6.2",
"@ledgerhq/hw-transport-node-hid": "^6.29.16",
"@solana/web3.js": "^1.98.4",
"@ton-community/ton-ledger": "^7.3.0",
"bs58": "^6.0.0",
"ethers": "6.16.0",
"type-fest": "^5.3.1",
"type-fest": "^5.4.0",
"yargs": "18.0.0"
},
"overrides": {
Expand Down
67 changes: 23 additions & 44 deletions ccip-cli/src/commands/send.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
type AnyMessage,
type CCIPVersion,
type ChainStatic,
type EVMChain,
type ExtraArgs,
type RequestMessage,
CCIPArgumentInvalidError,
CCIPChainFamilyUnsupportedError,
CCIPTokenNotFoundError,
Expand All @@ -13,7 +13,7 @@ import {
networkInfo,
sourceToDestTokenAmounts,
} from '@chainlink/ccip-sdk/src/index.ts'
import { type BytesLike, dataLength, formatUnits, toUtf8Bytes } from 'ethers'
import { type BytesLike, formatUnits, toUtf8Bytes } from 'ethers'
import type { Argv } from 'yargs'

import type { GlobalOpts } from '../index.ts'
Expand Down Expand Up @@ -67,7 +67,6 @@ export const builder = (yargs: Argv) =>
type: 'number',
describe:
'Gas limit for receiver callback execution; defaults to default configured on ramps',
default: 0,
},
'estimate-gas-limit': {
type: 'number',
Expand Down Expand Up @@ -105,10 +104,11 @@ export const builder = (yargs: Argv) =>
describe: "Address of the Solana tokenReceiver (if different than program's receiver)",
},
account: {
alias: 'receiver-object-id',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of aliasing instead of having a separate optional argument? receiverObjectIds seem conceptually pretty different to solana accounts so maybe it's a bit cleaner to split it (no strong opinion though).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From CLI's perspective, it's not different: each is an array of address, and they're mutually exclusive (either you're sending to Solana and populating accounts, or you're sending to Sui and populating receiverObjectIds in extraArgs; they also serve semantically the same purpose: a list of dependent addresses needed for the receiver callback in dest;

it's inevitable to expose them a little in order to allow them to pass important specific parameters like these, which we (ccip-tools-ts) can't derive/guess for them, but my idea here is to make it as cross-compatible as possible

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, happy to keep as-is.

type: 'array',
string: true,
describe:
'List of accounts needed by Solana receiver program; append `=rw` to specify account as writable; can be specified multiple times',
'List of accounts needed by Solana receiver program, or receiverObjectIds needed by Sui; On Solana, append `=rw` to specify account as writable; can be specified multiple times',
example: 'requiredPdaAddress=rw',
},
'only-get-fee': {
Expand Down Expand Up @@ -159,54 +159,33 @@ async function sendMessage(
const getChain = fetchChainsFromRpcs(ctx, argv)
const source = await getChain(sourceNetwork.name)

let data: BytesLike
let data: BytesLike | undefined
if (argv.data) {
try {
data = getDataBytes(argv.data)
} catch (_) {
data = toUtf8Bytes(argv.data)
}
} else {
data = '0x'
}

const tokenAmounts: { token: string; amount: bigint }[] = argv.transferTokens?.length
? await parseTokenAmounts(source, argv.transferTokens)
: []

let receiver = argv.receiver
let tokenReceiver
let accounts,
accountIsWritableBitmap = 0n
if (destNetwork.family === ChainFamily.Solana) {
if (argv.tokenReceiver) tokenReceiver = argv.tokenReceiver
else if (!tokenAmounts.length) {
tokenReceiver = '11111111111111111111111111111111'
} else if (!dataLength(data)) {
// sending tokens without data, i.e. not for a receiver contract
tokenReceiver = receiver
receiver = '11111111111111111111111111111111'
} else {
throw new CCIPArgumentInvalidError(
'token-receiver',
'required when sending tokens with data to Solana',
)
}

if (argv.account) {
// parse accounts with or without `=rw` suffix
if (argv.account?.length) {
accounts = argv.account.map((account, i) => {
if (account.endsWith('=rw')) {
accountIsWritableBitmap |= 1n << BigInt(i)
account = account.substring(0, account.length - 3)
}
return account
})
} else accounts = [] as string[]
} else if (argv.tokenReceiver || argv.account?.length) {
throw new CCIPArgumentInvalidError(
'token-receiver/account',
'only valid for Solana destination',
)
}
}

let walletAddress, wallet
Expand Down Expand Up @@ -244,7 +223,7 @@ async function sendMessage(
message: {
sender: walletAddress,
receiver,
data,
data: data || '0x',
tokenAmounts: destTokenAmounts,
},
})
Expand All @@ -253,17 +232,19 @@ async function sendMessage(
if (argv.onlyEstimate) return
}

// `--allow-out-of-order-exec` forces EVMExtraArgsV2, which shouldn't work on v1.2 lanes;
// otherwise, fallsback to EVMExtraArgsV1 (compatible with v1.2 & v1.5)
// builds a catch-all extraArgs object, which can be massaged by
// [[Chain.buildMessageForDest]] to create suitable extraArgs with defaults if needed
const extraArgs = {
...(argv.allowOutOfOrderExec != null || destNetwork.family !== ChainFamily.EVM
? { allowOutOfOrderExecution: !!argv.allowOutOfOrderExec }
: {}),
...(destNetwork.family === ChainFamily.Solana
? { computeUnits: BigInt(argv.gasLimit) }
: { gasLimit: BigInt(argv.gasLimit) }),
...(tokenReceiver ? { tokenReceiver } : {}),
...(accounts ? { accounts, accountIsWritableBitmap } : {}),
...(argv.allowOutOfOrderExec != null && {
allowOutOfOrderExecution: !!argv.allowOutOfOrderExec,
}),
...(argv.gasLimit == null
? {}
: destNetwork.family === ChainFamily.Solana
? { computeUnits: BigInt(argv.gasLimit) }
: { gasLimit: BigInt(argv.gasLimit) }),
...(!!argv.tokenReceiver && { tokenReceiver: argv.tokenReceiver }),
...(!!accounts && { accounts, accountIsWritableBitmap }), // accounts also used as Sui receiverObjectIds
}

let feeToken, feeTokenInfo
Expand All @@ -287,7 +268,7 @@ async function sendMessage(
feeTokenInfo = await source.getTokenInfo(nativeToken)
}

const message: AnyMessage = {
const message: RequestMessage = {
receiver,
data,
extraArgs: extraArgs as ExtraArgs,
Expand Down Expand Up @@ -322,9 +303,7 @@ async function sendMessage(
})
logger.info(
'🚀 Sending message to',
tokenReceiver && tokenReceiver !== '11111111111111111111111111111111'
? tokenReceiver
: receiver,
receiver,
'@',
destNetwork.name,
', tx =>',
Expand Down
2 changes: 1 addition & 1 deletion ccip-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Format } from './commands/index.ts'
util.inspect.defaultOptions.depth = 6 // print down to tokenAmounts in requests
// generate:nofail
// `const VERSION = '${require('./package.json').version}-${require('child_process').execSync('git rev-parse --short HEAD').toString().trim()}'`
const VERSION = '0.93.0-883a2a0'
const VERSION = '0.94.0-a836308'
// generate:end

const globalOpts = {
Expand Down
16 changes: 8 additions & 8 deletions ccip-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainlink/ccip-sdk",
"version": "0.93.0",
"version": "0.94.0",
"description": "SDK/Library to interact with CCIP",
"author": "Chainlink devs",
"license": "MIT",
Expand Down Expand Up @@ -51,38 +51,38 @@
"@depay/web3-mock": "^15.3.0",
"@eslint/js": "^9.39.2",
"@types/bn.js": "^5.2.0",
"@types/node": "25.0.3",
"@types/node": "25.0.6",
"@types/yargs": "17.0.35",
"eslint": "^9.39.2",
"eslint-config-prettier": "10.1.8",
"eslint-import-resolver-typescript": "4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsdoc": "^61.5.0",
"eslint-plugin-jsdoc": "^62.0.0",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-tsdoc": "^0.5.0",
"ethers-abitype": "1.0.3",
"prettier": "^3.7.4",
"typescript": "5.9.3",
"typescript-eslint": "8.51.0",
"viem": "^2.43.3"
"typescript-eslint": "8.52.0",
"viem": "^2.44.1"
},
"dependencies": {
"@aptos-labs/ts-sdk": "^5.2.0",
"@aptos-labs/ts-sdk": "^5.2.1",
"buffer": "^6.0.3",
"@coral-xyz/anchor": "^0.29.0",
"@mysten/bcs": "^1.9.2",
"@mysten/sui": "^1.45.2",
"@solana/spl-token": "0.4.14",
"@solana/web3.js": "^1.98.4",
"@ton/core": "0.62.0",
"@ton/core": "0.62.1",
"@ton/ton": "^16.1.0",
"abitype": "1.2.3",
"bn.js": "^5.2.2",
"borsh": "^2.0.0",
"bs58": "^6.0.0",
"ethers": "6.16.0",
"micro-memoize": "^5.1.1",
"type-fest": "^5.3.1",
"type-fest": "^5.4.0",
"yaml": "2.8.2"
},
"overrides": {
Expand Down
26 changes: 20 additions & 6 deletions ccip-sdk/src/aptos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
zeroPadValue,
} from 'ethers'
import { memoize } from 'micro-memoize'
import type { PickDeep, SetRequired } from 'type-fest'
import type { PickDeep } from 'type-fest'

import {
type ChainContext,
Expand Down Expand Up @@ -88,7 +88,13 @@ import { getAptosLeafHasher } from './hasher.ts'
import { getUserTxByVersion, getVersionTimestamp, streamAptosLogs } from './logs.ts'
import { getTokenInfo } from './token.ts'
import type { CCIPMessage_V1_6_EVM } from '../evm/messages.ts'
import { decodeMessage, getMessageById, getMessagesInBatch, getMessagesInTx } from '../requests.ts'
import {
buildMessageForDest,
decodeMessage,
getMessageById,
getMessagesInBatch,
getMessagesInTx,
} from '../requests.ts'
export type { UnsignedAptosTx }

/**
Expand Down Expand Up @@ -530,21 +536,29 @@ export class AptosChain extends Chain<typeof ChainFamily.Aptos> {
destChainSelector,
message,
}: Parameters<Chain['getFee']>[0]): Promise<bigint> {
return getFee(this.provider, router, destChainSelector, message)
const populatedMessage = buildMessageForDest(message, networkInfo(destChainSelector).family)
return getFee(this.provider, router, destChainSelector, populatedMessage)
}

/** {@inheritDoc Chain.generateUnsignedSendMessage} */
async generateUnsignedSendMessage(
opts: Parameters<Chain['generateUnsignedSendMessage']>[0],
): Promise<UnsignedAptosTx> {
const { sender, router, destChainSelector, message } = opts
if (!message.fee) message.fee = await this.getFee(opts)
const { sender, router, destChainSelector } = opts
const populatedMessage = buildMessageForDest(
opts.message,
networkInfo(destChainSelector).family,
)
const message = {
...populatedMessage,
fee: opts.message.fee ?? (await this.getFee({ ...opts, message: populatedMessage })),
}
const tx = await generateUnsignedCcipSend(
this.provider,
sender,
router,
destChainSelector,
message as SetRequired<typeof message, 'fee'>,
message,
opts,
)
return {
Expand Down
2 changes: 1 addition & 1 deletion ccip-sdk/src/aptos/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function messageArgs(
] {
// Prepare the message structure for the view call
const receiver = getBytes(zeroPadValue(getDataBytes(message.receiver), 32))
const data = getDataBytes(message.data)
const data = getDataBytes(message.data || '0x')

// Get the native token to use as fee token if not specified
const feeToken = message.feeToken || DEFAULT_FEE_TOKEN
Expand Down
Loading
Loading