Quickstart
Install, configure a wallet adapter, gate your first spend. Testnet, SUI only in v1.
1Install
Add the SDK and the Sui client to your project.
pnpm add @allen-saji/praxis @mysten/sui2Configure
Praxis takes a wallet adapter and never sees a private key. It only receives a signer that signs the transaction it builds.
import { Praxis, GenericAdapter } from "@allen-saji/praxis";
// Bring any wallet. Praxis never sees a private key; it only
// receives a WalletAdapter that signs the transaction it builds.
const wallet = new GenericAdapter({
address: async () => signerAddress,
signTransaction: async (tx) => signer.sign(tx),
});
const praxis = new Praxis({ wallet, network: "testnet" });3Simulate
Dry-run a spend and read the risk-scored report without signing anything.
// Dry-run and risk-score without signing.
const report = await praxis.simulate({
to: recipient,
amount: 5_000_000_000n,
});
console.log(report.riskScore); // 0..100
console.log(report.recommendation); // "proceed" | "review" | "abort"
console.log(report.risks); // [{ level, code, message }]4Spend and gate
Gate the spend on the report. Returning false from onReport aborts the spend before it signs, and the abort is recorded with its reasoning.
// Gate the spend on the report. Returning false aborts before signing.
const result = await praxis.spend({
to: recipient,
amount: 5_000_000_000n,
reasoning: { prompt, decision, model },
privacy: "sealed",
auditors: [auditorAddress],
onReport: (r) => r.recommendation === "proceed",
});
if (result.status === "aborted") {
console.log("blocked:", result.abortReason);
}5Read the audit trail
Read receipts and counters with no wallet. Decrypt sealed reasoning as an allowlisted auditor, server-side.
// Read the audit trail. No wallet required.
const receipts = await praxis.audit.recent(50);
const stats = await praxis.audit.indexStats();
console.log(stats.totalAborts); // drains prevented
// Decrypt sealed reasoning as an allowlisted auditor (server-side).
const reasoning = await praxis.audit.reveal(blobId, viewerAddress);