candid-extractor

Crates.iocandid-extractor
lib.rscandid-extractor
version
sourcesrc
created_at2023-09-18 16:38:25.861576+00
updated_at2025-03-10 14:53:54.509026+00
descriptionA CLI tool to extract the Candid interface from a Canister WASM.
homepage
repositoryhttps://github.com/dfinity/candid-extractor
max_upload_size
id976095
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(dfinity-publish)

documentation

README

candid-extractor

A CLI tool to extract the Candid interface from a Canister WASM.

Installation

cargo install candid-extractor

You can also use cargo-binstall if it's available.

cargo binstall candid-extractor

Usage

candid-extractor path/to/canister.wasm

The Candid interface will be printed to stdout.

Prerequisites for Canisters

candid-extractor can extract the Candid interface if the Canister meets the following requirements:

  • Exports a memory named "memory".
  • Exports a function named "get_candid_pointer", which returns an index within the "memory".
    • If "memory" is 32-bit, the function should return an i32.
    • If "memory" is 64-bit, the function should return an i64.
  • The Candid interface should be encoded in UTF-8 and stored in "memory" starting from the returned index.
  • A "NUL terminator" (byte 0x00) should be added at the end of the data if additional content exists after it in "memory".
Commit count: 11

cargo fmt