Skip to content

Commit 5f1a7cb

Browse files
sui: working show, improve events fetching (#117)
* sui: working `show`, improve events fetching addresses now require ::module suffix * bump dependencies * bump versions to v0.95, adjust changelog * default api url to staging * address comments --------- Co-authored-by: Andre Matos <[email protected]>
1 parent 2c15298 commit 5f1a7cb

File tree

23 files changed

+945
-902
lines changed

23 files changed

+945
-902
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.95.0] - 2026-01-28 - Pre-release
11+
1012
- SDK: `Chain.getBalance()` method for querying native and token balances (EVM, Solana, Aptos)
1113
- SDK: Solana `resolveATA()` utility for ATA derivation with automatic SPL Token vs Token-2022 detection
1214
- CLI: `token` command for balance queries
1315
- SDK: fix EVM estimate gas for token transfers with balance slot!=0 (e.g. USDC)
14-
- SDK: Add `NetworkType` enum (`'MAINNET' | 'TESTNET'`) and `networkType` property to `NetworkInfo`
16+
- SDK: Add `NetworkType` enum (`'MAINNET' | 'TESTNET'`) and `networkType` property to `NetworkInfo`, in place of `isTestnet` boolean
1517
- SDK: Selector generation scripts now validate `network_type` presence from upstream chain-selectors
1618
- CLI: **Breaking**: `send`, `getSupportedTokens`, and `token` commands now use named arguments instead of positional (e.g., `send -s <source> -d <dest> -r <router>`)
1719
- CLI: **Breaking**: `-r` alias removed from global `--rpcs` option (use `--rpc` instead); `-r` now used for `--router` in `send` command

ccip-cli/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainlink/ccip-cli",
3-
"version": "0.94.0",
3+
"version": "0.95.0",
44
"description": "CCIP Command Line Interface, based on @chainlink/ccip-sdk",
55
"author": "Chainlink devs",
66
"license": "MIT",
@@ -32,23 +32,23 @@
3232
],
3333
"devDependencies": {
3434
"@eslint/js": "^9.39.2",
35-
"@types/node": "25.0.9",
35+
"@types/node": "25.0.10",
3636
"@types/yargs": "17.0.35",
3737
"eslint": "^9.39.2",
3838
"eslint-config-prettier": "10.1.8",
3939
"eslint-import-resolver-typescript": "4.4.4",
4040
"eslint-plugin-import": "^2.32.0",
41-
"eslint-plugin-jsdoc": "^62.2.0",
41+
"eslint-plugin-jsdoc": "^62.4.1",
4242
"eslint-plugin-prettier": "^5.5.5",
4343
"eslint-plugin-tsdoc": "^0.5.0",
44-
"prettier": "^3.8.0",
44+
"prettier": "^3.8.1",
4545
"tsx": "4.21.0",
4646
"typescript": "5.9.3",
47-
"typescript-eslint": "8.53.1"
47+
"typescript-eslint": "8.54.0"
4848
},
4949
"dependencies": {
5050
"@aptos-labs/ts-sdk": "^5.2.1",
51-
"@chainlink/ccip-sdk": "^0.94.0",
51+
"@chainlink/ccip-sdk": "^0.95.0",
5252
"@coral-xyz/anchor": "^0.29.0",
5353
"@ethers-ext/signer-ledger": "^6.0.0-beta.1",
5454
"@inquirer/prompts": "8.2.0",
@@ -59,7 +59,7 @@
5959
"@ton-community/ton-ledger": "^7.3.0",
6060
"bs58": "^6.0.0",
6161
"ethers": "6.16.0",
62-
"type-fest": "^5.4.1",
62+
"type-fest": "^5.4.2",
6363
"yargs": "18.0.0"
6464
}
6565
}

ccip-cli/src/commands/utils.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ import {
1212
CCIPErrorCode,
1313
ExecutionState,
1414
getCCIPExplorerUrl,
15+
getDataBytes,
1516
networkInfo,
1617
supportedChains,
1718
} from '@chainlink/ccip-sdk/src/index.ts'
1819
import { select } from '@inquirer/prompts'
1920
import {
2021
dataLength,
2122
formatUnits,
22-
getBytes,
2323
hexlify,
2424
isBytesLike,
2525
isHexString,
2626
parseUnits,
27+
toBigInt,
2728
toUtf8String,
2829
} from 'ethers'
2930
import type { PickDeep } from 'type-fest'
@@ -215,6 +216,26 @@ function omit<T extends Record<string, unknown>, K extends string>(
215216
return result
216217
}
217218

219+
// while formatData just breaks 0x bytes into 32B chunks for readability, this function first
220+
// tests if the data looks like a UTF-8 string (with length prefix) and decode that before
221+
function formatDataString(data: string): Record<string, string> {
222+
const bytes = getDataBytes(data)
223+
const isPrintableChars = (bytes_: Uint8Array) => bytes_.every((b) => 32 <= b && b <= 126)
224+
if (bytes.length > 64 && toBigInt(bytes.subarray(0, 32)) === 32n) {
225+
const len = toBigInt(bytes.subarray(32, 64))
226+
if (
227+
len < 512 &&
228+
bytes.length - 64 === Math.ceil(Number(len) / 32) * 32 &&
229+
isPrintableChars(bytes.subarray(64, 64 + Number(len))) &&
230+
bytes.subarray(64 + Number(len)).every((b) => b === 0)
231+
) {
232+
return { data: toUtf8String(bytes.subarray(64, 64 + Number(len))) }
233+
}
234+
}
235+
if (bytes.length > 0 && isPrintableChars(bytes)) return { data: toUtf8String(bytes) }
236+
return formatData('data', data)
237+
}
238+
218239
/**
219240
* Prints a CCIP request in a human-readable format.
220241
* @param source - Source chain instance.
@@ -289,11 +310,7 @@ export async function prettyRequest(this: Ctx, source: Chain, request: CCIPReque
289310
'tokens',
290311
await Promise.all(request.message.tokenAmounts.map(formatToken.bind(null, source))),
291312
),
292-
...(isBytesLike(request.message.data) &&
293-
dataLength(request.message.data) > 0 &&
294-
getBytes(request.message.data).every((b) => 32 <= b && b <= 126) // printable characters
295-
? { data: toUtf8String(request.message.data) }
296-
: formatData('data', request.message.data)),
313+
...formatDataString(request.message.data),
297314
...('accounts' in request.message ? formatArray('accounts', request.message.accounts) : {}),
298315
...rest,
299316
})

ccip-cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Format } from './commands/index.ts'
1111
util.inspect.defaultOptions.depth = 6 // print down to tokenAmounts in requests
1212
// generate:nofail
1313
// `const VERSION = '${require('./package.json').version}-${require('child_process').execSync('git rev-parse --short HEAD').toString().trim()}'`
14-
const VERSION = '0.94.0-4bfc4ca'
14+
const VERSION = '0.95.0-4d8c14a'
1515
// generate:end
1616

1717
const globalOpts = {

ccip-sdk/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainlink/ccip-sdk",
3-
"version": "0.94.0",
3+
"version": "0.95.0",
44
"description": "SDK/Library to interact with CCIP",
55
"author": "Chainlink devs",
66
"license": "MIT",
@@ -51,20 +51,20 @@
5151
"@depay/web3-mock": "^15.3.0",
5252
"@eslint/js": "^9.39.2",
5353
"@types/bn.js": "^5.2.0",
54-
"@types/node": "25.0.9",
54+
"@types/node": "25.0.10",
5555
"@types/yargs": "17.0.35",
5656
"eslint": "^9.39.2",
5757
"eslint-config-prettier": "10.1.8",
5858
"eslint-import-resolver-typescript": "4.4.4",
5959
"eslint-plugin-import": "^2.32.0",
60-
"eslint-plugin-jsdoc": "^62.2.0",
60+
"eslint-plugin-jsdoc": "^62.4.1",
6161
"eslint-plugin-prettier": "^5.5.5",
6262
"eslint-plugin-tsdoc": "^0.5.0",
6363
"ethers-abitype": "1.0.3",
64-
"prettier": "^3.8.0",
64+
"prettier": "^3.8.1",
6565
"typescript": "5.9.3",
66-
"typescript-eslint": "8.53.1",
67-
"viem": "^2.44.4"
66+
"typescript-eslint": "8.54.0",
67+
"viem": "^2.45.0"
6868
},
6969
"dependencies": {
7070
"@aptos-labs/ts-sdk": "^5.2.1",
@@ -74,7 +74,7 @@
7474
"@mysten/sui": "^1.45.2",
7575
"@solana/spl-token": "0.4.14",
7676
"@solana/web3.js": "^1.98.4",
77-
"@ton/core": "0.62.1",
77+
"@ton/core": "0.63.0",
7878
"@ton/crypto": "^3.3.0",
7979
"@ton/ton": "^16.1.0",
8080
"abitype": "1.2.3",
@@ -84,7 +84,7 @@
8484
"ethers": "6.16.0",
8585
"got": "^11.8.6",
8686
"micro-memoize": "^5.1.1",
87-
"type-fest": "^5.4.1",
87+
"type-fest": "^5.4.2",
8888
"yaml": "2.8.2"
8989
},
9090
"overrides": {

ccip-sdk/src/api/api.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ describe('CCIPAPIClient', () => {
291291
sendTimestamp: '2023-12-01T10:30:00Z',
292292
tokenAmounts: [
293293
{
294-
sourceTokenAddress: '0xA0b86a8B5b6E8e0A09C4c3Dc7dE6e69e1e2d3f4a',
295-
destTokenAddress: '0xB1c97a9C6c7F9f1B10D5e4Ec8eF7f70f2f3e4d5c',
296-
sourcePoolAddress: '0xC2d08b0D7d8a0a2C21E6f5Fd9fa8a81a3a4f5e6d',
294+
sourceTokenAddress: '0xa0b86a8b5b6e8e0a09c4c3dc7de6e69e1e2d3f4a',
295+
destTokenAddress: '0xb1c97a9c6c7f9f1b10d5e4ec8ef7f70f2f3e4d5c',
296+
sourcePoolAddress: '0xc2d08b0d7d8a0a2c21e6f5fd9fa8a81a3a4f5e6d',
297297
amount: '1000000',
298298
},
299299
],
@@ -302,7 +302,7 @@ describe('CCIPAPIClient', () => {
302302
finality: 0,
303303
fees: {
304304
fixedFeesDetails: {
305-
tokenAddress: '0x4Cb3c1a50616725Bd1793D0eE0C7Fc4dC4E05c79',
305+
tokenAddress: '0x4cb3c1a50616725bd1793d0ee0c7fc4dc4e05c79',
306306
totalAmount: '5000000',
307307
},
308308
},
@@ -720,7 +720,7 @@ describe('CCIPAPIClient', () => {
720720
)
721721

722722
// tokenAmounts is on message
723-
const msg = result.message as unknown as { tokenAmounts: { token: string; amount: bigint }[] }
723+
const msg = result.message as { tokenAmounts: readonly { token: string; amount: bigint }[] }
724724
assert.equal(msg.tokenAmounts.length, 0)
725725
})
726726

ccip-sdk/src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type {
3939
} from './types.ts'
4040

4141
/** Default CCIP API base URL */
42-
export const DEFAULT_API_BASE_URL = 'https://api.ccip.chain.link'
42+
export const DEFAULT_API_BASE_URL = 'https://api.ccip.cldev.cloud'
4343

4444
/** Default timeout for API requests in milliseconds */
4545
export const DEFAULT_TIMEOUT_MS = 30000

ccip-sdk/src/aptos/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import {
99
import {
1010
type BytesLike,
1111
concat,
12-
dataLength,
1312
dataSlice,
14-
decodeBase64,
1513
getBytes,
1614
hexlify,
1715
isBytesLike,
@@ -487,18 +485,18 @@ export class AptosChain extends Chain<typeof ChainFamily.Aptos> {
487485
* @param bytes - Bytes to convert.
488486
* @returns Aptos address (0x-prefixed hex, 32 bytes padded).
489487
*/
490-
static getAddress(bytes: BytesLike): string {
488+
static getAddress(bytes: BytesLike | readonly number[]): string {
491489
let suffix = ''
492-
if (typeof bytes === 'string' && !bytes.startsWith('0x')) {
493-
bytes = decodeBase64(bytes)
494-
} else if (typeof bytes === 'string') {
490+
if (Array.isArray(bytes)) bytes = new Uint8Array(bytes)
491+
if (typeof bytes === 'string' && bytes.startsWith('0x')) {
495492
const idx = bytes.indexOf('::')
496493
if (idx > 0) {
497494
suffix = bytes.slice(idx)
498495
bytes = bytes.slice(0, idx)
499496
}
500497
}
501-
if (dataLength(bytes) > 32) throw new CCIPAptosAddressInvalidError(hexlify(bytes))
498+
bytes = getDataBytes(bytes)
499+
if (bytes.length > 32) throw new CCIPAptosAddressInvalidError(hexlify(bytes))
502500
return zeroPadValue(bytes, 32) + suffix
503501
}
504502

ccip-sdk/src/aptos/logs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { memoize } from 'micro-memoize'
1010
import type { LogFilter } from '../chain.ts'
1111
import {
1212
CCIPAptosAddressModuleRequiredError,
13-
CCIPAptosTopicInvalidError,
1413
CCIPAptosTransactionTypeUnexpectedError,
1514
CCIPLogsWatchRequiresFinalityError,
1615
CCIPLogsWatchRequiresStartError,
16+
CCIPTopicsInvalidError,
1717
} from '../errors/index.ts'
1818
import type { Log_ } from '../types.ts'
1919
import { sleep } from '../utils.ts'
@@ -245,11 +245,11 @@ export async function* streamAptosLogs(
245245
const limit = 100
246246
if (!opts.address || !opts.address.includes('::')) throw new CCIPAptosAddressModuleRequiredError()
247247
if (opts.topics?.length !== 1 || typeof opts.topics[0] !== 'string')
248-
throw new CCIPAptosTopicInvalidError()
248+
throw new CCIPTopicsInvalidError(opts.topics!)
249249
let eventHandlerField = opts.topics[0]
250250
if (!eventHandlerField.includes('/')) {
251251
eventHandlerField = (eventToHandler as Record<string, string>)[eventHandlerField]!
252-
if (!eventHandlerField) throw new CCIPAptosTopicInvalidError(opts.topics[0])
252+
if (!eventHandlerField) throw new CCIPTopicsInvalidError(opts.topics)
253253
}
254254
const [stateAddr] = await ctx.provider.view<[string]>({
255255
payload: {

ccip-sdk/src/errors/codes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export const CCIPErrorCode = {
134134
APTOS_TX_TYPE_INVALID: 'APTOS_TX_TYPE_INVALID',
135135
APTOS_TX_TYPE_UNEXPECTED: 'APTOS_TX_TYPE_UNEXPECTED',
136136
APTOS_ADDRESS_MODULE_REQUIRED: 'APTOS_ADDRESS_MODULE_REQUIRED',
137-
APTOS_TOPIC_INVALID: 'APTOS_TOPIC_INVALID',
138137
APTOS_HASHER_VERSION_UNSUPPORTED: 'APTOS_HASHER_VERSION_UNSUPPORTED',
139138

140139
// HTTP & RPC

0 commit comments

Comments
 (0)