Library
Use the package as a library to generate bindings for a .did
file in your own JS/TS scripts (Node.js, Bun, etc.).
Note: The
@icp-sdk/bindgen
library is NOT meant to be used in browsers.
Installation
Section titled “Installation”npm install -D @icp-sdk/bindgen
import { generate } from '@icp-sdk/bindgen/core';
generate({ didFile: './canisters/hello_world.did', outDir: './src/bindings',});
For an explanation of the generated files, see the Bindings Structure page.