ic-rocks / didc-js

A JS/Wasm package for generating Candid bindings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

didc-js

A JS/Wasm package for generating Candid bindings.

Building

cargo install wasm-pack
wasm-pack build --target bundler
wasm-opt --strip-debug -Oz pkg/didc_bg.wasm -o pkg/didc_bg.wasm

Usage

const didc = import("pkg/didc_js");

didc.then((mod) => {
  const service = `service : {
    add : (int32, int32) -> (int32) query;
  }`;
  const bindings = mod.generate(service); // Bindings { js: "...", ts: "...", motoko: "..." }
});

About

A JS/Wasm package for generating Candid bindings.


Languages

Language:JavaScript 83.9%Language:Rust 16.1%