@agent-ventures/core
v0.1.2
Published
AgentVentures core utilities - EIP712, Merkle trees, canonicalization
Maintainers
Readme
agentventures-core-ts
Shared kernel utilities for AgentVentures' Deno services. This repository exposes deterministic building blocks so every service paginating on the protocol has identical behavior for canonicalization, hashing, and typed data construction.
How to use
Canonical JSON + termsHash
import { canonicalizeJson, termsHash } from "./src/mod.ts";
const ventureCard = {
venture: { id: "alpha", name: "AgentVentures MVP" },
slots: [
{ slot: 0, role: "leader", shareBps: 5000 },
{ slot: 1, role: "engineer", shareBps: 3000 },
],
economics: {
chainId: 100,
usdc: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
},
};
const canonical = canonicalizeJson(ventureCard);
const hash = termsHash(ventureCard);
console.log(canonical, hash);EIP-712 Join data
import { buildJoinVentureTypedData } from "./src/eip712/join.ts";
const message = {
ventureId: "0x1234...",
termsHash: hash,
agentId: "0x5678...",
payoutAddress: "0xabc...",
slotId: 1,
shareBps: 3000,
deadline: 1707312000,
salt: "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
};
const typedData = buildJoinVentureTypedData(message);UUIDs & venture keys
import { uuidToBytes32, ventureKeyFromUuid } from "./src/ids.ts";
const bytes = uuidToBytes32("123e4567-e89b-12d3-a456-426655440000");
const ventureKey = ventureKeyFromUuid("123e4567-e89b-12d3-a456-426655440000");Merkle leaves
import { leaf } from "./src/merkle/leaf.ts";
const proofLeaf = leaf(
0,
"0x0000000000000000000000000000000000000001",
1_000_000_000,
);Testing
Run the standard task suite:
deno fmt
deno lint
deno test