Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Latest commit

 

History

History
24 lines (18 loc) · 466 Bytes

README.md

File metadata and controls

24 lines (18 loc) · 466 Bytes

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: "..." }
});