Skip to content

Example: blacklisted-transfer-safety

Location: examples/typescript/src/blacklisted-transfer-safety.ts

Run:

Terminal window
cd examples/typescript
npm run blacklisted-transfer

Environment variables:

VariableDefaultNotes
CKB_RPC_URLhttps://testnet.ckb.devCKB node RPC
BLACKLISTED_LOCK_ARGSfirst active registry entryForce a specific destination

The example:

  1. Fetches the live registry from testnet
  2. Finds the first active (non-expired) blacklist entry
  3. Builds a transaction with that entry as an output
  4. Runs preflightCheck and asserts the result is BlacklistedLockArgs
  5. Exits with code 1 if no active entry exists (so CI stays honest)

No private key, no testnet account, no signing. The entire test is read-only.

This is useful as a CI check: it proves that the SDK correctly identifies an actively blacklisted address from the live registry. If the registry is empty or all entries are expired, the test exits 1 rather than pass silently.

Set BLACKLISTED_LOCK_ARGS to force a specific address if you want to test a particular entry regardless of what is currently in the live registry.