Example: blacklisted-transfer-safety
Location: examples/typescript/src/blacklisted-transfer-safety.ts
Run:
cd examples/typescriptnpm run blacklisted-transferEnvironment variables:
| Variable | Default | Notes |
|---|---|---|
CKB_RPC_URL | https://testnet.ckb.dev | CKB node RPC |
BLACKLISTED_LOCK_ARGS | first active registry entry | Force a specific destination |
What it demonstrates
Section titled “What it demonstrates”The example:
- Fetches the live registry from testnet
- Finds the first active (non-expired) blacklist entry
- Builds a transaction with that entry as an output
- Runs
preflightCheckand asserts the result isBlacklistedLockArgs - Exits with code
1if 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.