@trust-zones/sdk
v0.1.0
Published
TypeScript SDK for the Trust Zones protocol — ABIs, encoders, decoders, Ponder backend, zone execution
Readme
@trust-zones/sdk
TypeScript SDK for the Trust Zones protocol — typed contract ABIs, payload encoders/decoders, Ponder query backend, and zone execution helpers.
Install
npm install @trust-zones/sdkUsage
import {
encodePropose,
encodeAccept,
encodeSetUp,
encodeActivate,
encodeComplete,
decodeProposalData,
createPonderBackend,
AgreementABI,
AgreementRegistryABI,
} from "@trust-zones/sdk";Encode agreement inputs
// Encode a propose input for submitInput()
const { inputId, payload } = encodePropose(compiledProposalData);
// Accept, set up, activate
const accept = encodeAccept();
const setUp = encodeSetUp();
const activate = encodeActivate();Query agreement state via Ponder
const backend = createPonderBackend("https://ponder-production-6e39.up.railway.app/graphql");
const state = await backend.getAgreementState("0xAgreementAddress");
// { currentState, parties, trustZones, ... }Contract ABIs
All contract ABIs are exported as typed constants for use with viem:
AgreementABIAgreementRegistryABITrustZoneABIHatValidatorABIResourceTokenRegistryABI
Zone execution
import { buildZoneExecute } from "@trust-zones/sdk";
// Build calldata for executing a transaction through a zone account
const { to, data, value } = buildZoneExecute(zoneAddress, targetAddress, calldata, ethValue);Links
- Protocol: https://trustzones.xyz
- Contracts: https://github.com/spengrah/synthesis-hackathon/blob/main/packages/contracts/deployments.json
- Ponder GraphQL: https://ponder-production-6e39.up.railway.app/graphql
