MCPcopy Index your code
hub / github.com/dfinity/candid

github.com/dfinity/candid @didc-v0.6.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release didc-v0.6.2 ↗ · + Follow
1,637 symbols 4,109 edges 142 files 127 documented · 8%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Candid

Candid is an interface description language (IDL) for interacting with canisters (also known as services or actors) running on the Internet Computer. It provides a language-independent description of canister interfaces and the data they exchange, with type safety and extensibility.

Documentation

Implementations

Candid supports several different programming languages. This repository contains some of the implementations developed by DFINITY.

  • Rust: A serialization library based on Serde, and a compiler for generating bindings for other languages.
  • Motoko: Compiler support for importing/export Candid files. Also see the Motoko-Candid type mapping specification.
  • JavaScript: We provide a library for serialization of native JavaScript values, and a visitor class for extending Candid for building generic tools such as UI and random testing.

A list of community maintained Candid libraries:

Tools

  • didc: Candid CLI. Download prebuilt binary.
  • ui: Candid UI canister. See deployed canister on the IC
  • ic-repl: A REPL environment to communicate with canisters using Candid
  • Explain Candid: An online tool that decodes and explains a given Candid message. (Thanks to Ben Lynn)
  • Candid playground: A playground that generates UI dynamically as you type in the Candid definitions. (Thanks to B3Forge)

Tests

We provide a test suite to check Candid implementations for compliance.

Release

This repo ships two kinds of release artifacts, each driven by its own tag.

candid_ui canister wasm

Released on a date-based tag. As the repo contains several targets, it is hard to give a version to the tag, so the tag is always today's date:

  • Update CHANGELOG.md and merge the PR into master.
  • git tag 2020-04-01 -m "2020-04-01"
  • git push origin 2020-04-01

This triggers candid-ui.yml, which builds and uploads candid_ui.wasm to the matching GitHub release.

didc binaries

Released by cargo-dist on a SemVer tag matching the didc crate version in tools/didc/Cargo.toml:

  • Bump the didc version and merge the PR into master.
  • git tag didc-v0.6.1 -m "didc-v0.6.1"
  • git push origin didc-v0.6.1

This triggers didc-release.yml, which builds didc for linux (x86_64, x86_64-musl, arm64) and macOS (x86_64, arm64), and uploads the archives, a shell installer, and checksums to the GitHub release. The build config lives in dist-workspace.toml; regenerate the workflow with dist generate after editing it.

Contribution

See our CONTRIBUTING and CODE OF CONDUCT to get started.

Extension points exported contracts — how you extend this code

DataSize (Interface)
Trait to reasonably estimate the memory usage of a value in bytes. Default implementation returns zero. [7 implementers]
rust/candid/src/types/bounded_vec.rs
Validate (Interface)
A trait for validating structs or enums. Can be implemented for any struct or enum that needs to be validated. [2 implementers]
tools/didc-js/wasm-package/src/validation.rs
ConfigState (Interface)
(no doc) [3 implementers]
rust/candid_parser/src/configs.rs
ExternalConfig (Interface)
(no doc)
tools/ui/src/external.ts
CandidType (Interface)
(no doc) [37 implementers]
rust/candid/src/types/mod.rs
R (Interface)
(no doc)
rust/candid_parser/tests/assets/ok/inline_methods.d.ts
ArgumentDecoder (Interface)
Allow decoding of any sized argument. [1 implementers]
rust/candid/src/utils.rs
RInline (Interface)
(no doc)
rust/candid_parser/tests/assets/ok/inline_methods.d.ts

Core symbols most depended-on inside this repo

str
called by 164
rust/candid/src/pretty/utils.rs
as_ref
called by 151
rust/candid/src/types/internal.rs
call
called by 87
tools/ui/src/candid.ts
insert
called by 66
rust/candid/src/types/subtype.rs
kwd
called by 65
rust/candid/src/pretty/utils.rs
update_stats
called by 48
rust/candid_parser/src/configs.rs
add_cost
called by 48
rust/candid/src/de.rs
text
called by 48
rust/bench/bench.rs

Shape

Function 628
Method 484
Class 371
Enum 97
Interface 57

Languages

Rust93%
TypeScript7%
Python1%

Modules by API surface

rust/bench/nns.rs168 symbols
rust/candid/src/de.rs78 symbols
rust/candid/tests/serde.rs76 symbols
rust/candid_parser/tests/assets/ok/management.rs60 symbols
rust/candid_parser/src/bindings/rust.rs50 symbols
rust/candid/src/types/internal.rs45 symbols
rust/candid/src/pretty/candid.rs43 symbols
rust/candid_parser/src/configs.rs39 symbols
rust/candid/tests/types.rs39 symbols
rust/candid_parser/tests/assets/ok/example.rs36 symbols
rust/candid/src/ser.rs35 symbols
rust/candid/src/types/value.rs34 symbols

For agents

$ claude mcp add candid \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page