contextio-sdk
v0.3.0
Published
Client SDK for Contextio — agentic treasury & payroll on Stellar. Typed API client, Stellar wallet sign-in (SEP-53), and Legal Context Protocol (LCP) hashing/verification.
Downloads
350
Maintainers
Readme
contextio-sdk
Client SDK for Contextio — agentic, non-custodial treasury & payroll on Stellar for LATAM.
- Typed API client for the Contextio API (treasury, payroll, agent, legal).
- Sign In With Stellar (SEP-53) — wallet-agnostic (Freighter, Stellar Wallets Kit, …).
- Legal Context Protocol (LCP) — re-derive and verify a context's SHA-256 independently.
Isomorphic (browser + Node ≥ 18), ESM, zero server dependencies.
Install
npm i contextio-sdkSign in with a Stellar wallet
import { ContextioClient, signInWithStellar } from "contextio-sdk";
import { StellarWalletsKit, Networks, defaultModules } from "@creit.tech/stellar-wallets-kit";
const client = new ContextioClient({ baseUrl: "https://contextio-api.fly.dev" });
StellarWalletsKit.init({ network: Networks.TESTNET, modules: defaultModules() });
const { address } = await StellarWalletsKit.authModal();
const session = await signInWithStellar({
client,
address,
signMessage: async (msg) => (await StellarWalletsKit.signMessage(msg, { address })).signedMessage,
});
// Authenticated, tenant-scoped client:
const api = client.withSession(session);
const treasury = await api.treasury();
const decisions = await api.decisions();signMessage is any function returning the base64 SEP-53 signature, so the SDK
works with Freighter directly or any wallet adapter.
Verify a Legal Context independently
import { hashLegalContext, verifyLegalContext } from "contextio-sdk";
const doc = await client.wellKnownLegalContext("acme.contexta.app");
const hash = hashLegalContext(doc); // canonical SHA-256 (hex)
verifyLegalContext(doc, onChainHashFromEvent); // booleanThe canonicalization is byte-for-byte identical to the Contextio platform, so a hash bound into a Soroban event can be re-derived and checked client-side.
License
Apache-2.0
