Skip to content

Step 1: Install the SDK

Create a new directory for the tutorial and initialise a project:

Terminal window
mkdir firewall-tutorial && cd firewall-tutorial
npm init -y

Install the SDK:

Terminal window
npm install @ckb-firewall/sdk

Set up TypeScript and ESM. Add the following to package.json:

{
"type": "module",
"scripts": {
"start": "node --experimental-vm-modules check.ts"
}
}

Create a file called check.ts and add this line:

import { fetchRegistryPayload } from "@ckb-firewall/sdk";
console.log("SDK loaded:", typeof fetchRegistryPayload);

Run it:

Terminal window
npx tsx check.ts

You should see:

SDK loaded: function

If you see that output, the SDK is installed and the import works. Continue to Step 2.