@reapp-sdk/core · DOCS

Agent payments in 5 lines.

A user signs a budget-capped mandate; an AI agent pays under it; a Soroban contract enforces every limit on-chain. The SDK is untrusted — a buggy or malicious SDK can't exceed the mandate.

Install

npm install @reapp-sdk/core @stellar/stellar-sdk

Quick start (testnet)

import { reapp } from "@reapp-sdk/core";
import { Keypair } from "@stellar/stellar-sdk";

const user = Keypair.fromSecret(USER_SECRET);   // owns funds, signs the mandate
const agent = Keypair.fromSecret(AGENT_SECRET);  // the autonomous spender

const m = reapp.createIntentMandate({
  user: user.publicKey(),
  agent: agent.publicKey(),
  merchant: MERCHANT,
  asset: reapp.testnet.nativeSac,
  maxAmount: "5.00",
  expiry: Math.floor(Date.now() / 1000) + 3600,
});

await reapp.registerMandate(m, { signer: user }); // authorize on-chain
await reapp.approveBudget(m,  { signer: user });   // SEP-41 allowance -> contract
await reapp.agent({ mandate: m, signer: agent }).pay("1.00"); // agent-signed

That's the whole flow. pay() routes through MandateRegistry.execute_payment, which re-validates everything and moves funds atomically. Overspend, wrong merchant, replay, or pay-after-revoke → the contract rejects and pay() throws.

API

reapp.createIntentMandate(input)Build a mandate + its on-chain id (no chain call)
reapp.registerMandate(m, { signer })Store it on-chain — user-signed
reapp.approveBudget(m, { signer })Grant the contract a SEP-41 allowance — user-signed
reapp.agent({ mandate, signer }).pay(amt)Execute a mandate-validated payment — agent-signed
reapp.revokeMandate(m, { signer })Withdraw consent — user-signed
ErrorsTyped contract errors for branching (Errors[6] = BudgetExceeded)

Why it's safe

View on npm ↗Contract + protocol ↗Try the live demo →