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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- SDK: export `encodeAddressToAny` and `isCantonPartyId` from the package root. `encodeAddressToAny` encodes an address of any chain family the way CCIP messages carry it, e.g. a Canton party as `keccak256(partyId)`; `isCantonPartyId` checks the `hint::1220<64 hex>` party form it hashes
- CCT SDK (EVM): `registerAdmin` and `generateUnsignedRegisterAdmin` wrap token permission getter `CALL_EXCEPTION`s in `CCTParamsInvalidError` for `tokenAddress`, preserving the cause.
- Solana: add `getTotalFeesEstimate`, which threw `CCIPNotImplementedError` from Solana. It returns `getFee`'s `ccipFee`, plus as `tokenTransferFee` the basis-point fee the source pool takes from the transferred amount: the `finalityTransferFeeBps` of the pool's `ChainConfigV2` for the lane with `finality: 'finalized'` (or 0), its `fastFinalityTransferFeeBps` with a block depth or `'safe'`, when its fee config is enabled. It only applies when the message goes over the Router's 2.0 entrypoint, chosen as `getFee` and `sendMessage` choose it (so not on a 2.0 lane with its sender allowlist enabled, which falls back to 1.6), and to a token whose TokenAdminRegistry entry has pool interface version 2: data-only messages, 1.6 sends and interface-1 pools get `ccipFee` alone. CCTP pools take no pool fee; a fast CCTP transfer, where the pool and its verifier allow one, quotes Circle's fast transfer fee at the `fast_finality_bps` of the pool's CCTP verifier
- Canton SDK: `sendMessage` (`extraArgs.commandId`), `createCCIPSender`, `createCCIPReceiver` and the CCT operations (`setRateLimitConfig`, `setObservers`, the pool receive-context operations) take an optional caller-supplied `commandId`, used unchanged, so a retry after an unknown outcome is rejected as `DUPLICATE_COMMAND` instead of running twice. Without one, a transient failure of these calls is no longer reported as retryable (`isTransient: false`, with the `commandId` in the error context), since a rebuilt retry gets a new ID. A failure to read the committed transaction back after `submitCommands` is reported as `CCIPTxOutcomeUnavailableError` with the `updateId`, not as a retryable error
Expand Down
2 changes: 2 additions & 0 deletions ccip-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ export {
UI_MULTIPLIER_ONE,
bytesToBuffer,
decodeAddress,
encodeAddressToAny,
fromUIAmount,
getDataBytes,
getSourceTokenFromExtraData,
isCantonPartyId,
isSupportedTxHash,
jsonParse,
jsonStringify,
Expand Down
22 changes: 21 additions & 1 deletion ccip-sdk/src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
toUIAmount,
withRetry,
} from './utils.ts'
import { type Logger, ChainFamily } from './index.ts'
import { type Logger, ChainFamily, encodeAddressToAny, isCantonPartyId } from './index.ts'

describe('getBlockNumberAtOrAfter', () => {
/** Regular chain: ts(n) = base + n*blockTime. */
Expand Down Expand Up @@ -983,6 +983,26 @@ describe('getAddressBytes', () => {
})
})

describe('encodeAddressToAny', () => {
it('should left-pad a 20-byte EVM address to 32 bytes', () => {
const result = encodeAddressToAny('0x1234567890123456789012345678901234567890')
assert.equal(
result.toString('hex'),
'0000000000000000000000001234567890123456789012345678901234567890',
)
})

it('should encode a Canton party as keccak256 of its ID', () => {
const party = 'ccipOwner::1220e382f4e57b0815e6be737006e381e6b7de448e06bd033ece6df498017879f551'
assert.equal(isCantonPartyId(party), true)
const result = encodeAddressToAny(party)
assert.equal(
result.toString('hex'),
'952fd8afa071fc6bc441ebb7165af56f9c527d143754dbd086a971933fff74a5',
)
})
})

describe('sleep', () => {
it('should delay execution for specified milliseconds', async () => {
const start = Date.now()
Expand Down
Loading