Skip to content

TypeScript SDK

The TypeScript SDK is the application-layer check. It parses a BLKL registry payload from a matching registry cell dep and rejects outputs that target blacklisted destinations.

Published on npm as @ckb-firewall/sdk.

Terminal window
npm install @ckb-firewall/sdk
import { TransactionFirewall } from "@ckb-firewall/sdk";
const firewall = new TransactionFirewall({
registryScript: {
codeHash: "0x...",
hashType: "type",
args: "0x...",
},
});
const result = firewall.checkTransaction({
cellDeps: [{ type: registryScript, data: registryData }],
outputs: [{ lockArgs: "0x..." }],
});
if (!result.ok) {
console.error(result.code, result.reason);
}
  • The SDK is synchronous.
  • It does not fetch RPC data for you.
  • You must provide the live registry cell data yourself.
  • The registry dep must match the configured registryScript exactly.

The SDK returns a structured ok: true or ok: false decision.

  • 8 MissingRegistryCellDep
  • 9 InvalidRegistryData
  • 10 RegistryNotSorted
  • 11 BlacklistedLockArgs
  • 12 BlacklistedTypeArgs
  • 17 AmbiguousRegistryCellDep

See Error codes for the contract-side mapping.