Skip to content
B3PayPublic

About

Candid interfaces as a canonical, validated Contract graph: the Rust crate meant, and the @meantjs TypeScript schema runtime and generator.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Meant

What you meant is what runs.
The meaning layer for contract calls: what each value means, what each call does,
and what each result tells the caller to do next.

Docs · Quickstart · Packages · Status · Changelog


A Candid interface says amount : nat. It does not say that 1 ICP is 108 base units, that created_at_time makes a retry safe, or that Err.Duplicate means the payment already went through. Agents, wallets and UIs each guess.

Meant compiles the interface into a canonical graph with an identity. A profile bound to that identity writes the meaning down once, and from it come:

  • Agent tools. Amounts in human units, converted exactly (too many decimals is an error, never a rounding), a preview the person confirms before every send, retries that cannot pay twice, and a class for every result.
  • A guard in front of an EVM signer (experimental). It signs only a typed message whose grant fits the terms the person confirmed for the task.
  • Consent messages. ICRC-21 for any method, not only icrc1_transfer; for EVM contracts, consent text for calls and signatures and ERC-7730 clear-signing files (experimental).
  • Display and input formatting for amounts, times, durations, accounts, subaccounts and bytes, by one rule that refuses excess precision rather than rounding it.

How it works

Step What happens
1. Compile The .did becomes a validated Contract graph with an interface_id.
2. Describe A profile bound to that id says what each value means and what each call does.
3. Generate Agent tools, consent messages and formatters come from the resolved profile.
4. Confirm The owner approves the exact call. Retries cannot pay twice.

Quick start

Profiles. Read and show values exactly:

npm install --save-exact @meantjs/format
import { parseAmount } from "@meantjs/format";

parseAmount("1.5 ICP", { decimals: 8, symbol: "ICP" }); // "150000000"
parseAmount("1.123456789", { decimals: 8 }); // throws E_EXCESS_PRECISION: never rounded

Candid in TypeScript, with no Rust toolchain:

npm install --save-exact @meantjs/schema
npm install --save-dev --save-exact @meantjs/cli   # .did to TypeScript

Candid in Rust:

[dependencies]
meant = "=0.1.0"

From a clone of this repository, the meant binary compiles a .did file and validates a Contract:

cargo run --bin meant -- compile ./service.did
cargo run --bin meant -- validate ./contract.json

Each has a quickstart on the site: profiles, TypeScript and Rust.

Packages

Package Version What it is
meant crates.io The Rust compiler and model: a .did file to a canonical, validated Contract graph with content-addressed identities, and the meant binary
@meantjs/schema npm Typed schemas, validation and a Candid binary codec from the same graph, with no runtime dependencies
@meantjs/cli npm The compiler and generator as WebAssembly: a .did file to a TypeScript module, with no Rust toolchain
The profile packages npm The Meant Profile spec, its standard packs, and five packages released together, @meantjs/profile, format, consent, tools and reconcile, which resolve profiles and generate tools, consent and formatting from them
meant-format crates.io The profile's amount tag in Rust, with no dependencies and no_std

The crates and the two npm families version independently.

Status

Everything here is pre-1.0. Any release before 1.0 may change the public API, the serialized shapes, the canonical bytes and every identity computed over them, so pin exact versions: meant = "=0.1.0", npm install --save-exact. The profile spec is Draft 0.2.

  • Internet Computer: supported. Candid interfaces, the ICRC-1 and ICRC-2 packs, ICRC-21 consent and PocketIC.
  • EVM contracts: experimental. Profiles for Solidity ABIs and EIP-712 messages, x402 payments included, consent text for calls and signatures, and ERC-7730 files.
  • Solana: planned, not supported yet.

Renamed. The crate candid-core is now meant (use meant::…, binary meant), and the npm pair @candid-core/schema and @candid-core/cli is now @meantjs/schema and @meantjs/cli, whose command is meant. The Contract format and its candid-core: identity prefixes are unchanged. Details.

Documentation

Repository layout

src/                  the meant crate: model, validation, canonicalization, compiler, CLI
examples/             runnable Rust examples
crates/meant-ts/      the TypeScript generator; @meantjs/schema is in ts/
crates/meant-wasm/    @meantjs/cli, the compiler and generator as WebAssembly
crates/meant-format/  meant-format, the amount tag in Rust
profile/              the profile spec, packs and packages (a synced copy, see below)
website/              the source of b3pay.net/docs/meant
docs/                 design documents, ADRs, verification and release procedures
tests/, benches/      the test suites and the benchmarks
fuzz/                 the fuzz targets, a workspace of their own

Contributing

Issues and pull requests are welcome. profile/ and its two workflows are a synced copy of the profile's working repository, so a maintainer applies an accepted change there and the next sync brings it back (how that folder is made). The checks to run before a pull request are in CLAUDE.md.

License

Apache-2.0 (LICENSE). Meant is a B3Pay project.

About

Candid interfaces as a canonical, validated Contract graph: the Rust crate meant, and the @meantjs TypeScript schema runtime and generator.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages