Documentation
Quick start
Add the change-donation question to your Stellar app. This walkthrough covers installing the SDK, the wallets kit, and a first pass through the confirmation flow.
pnpm add spare-wallets-kit spare-sdk @creit.tech/stellar-wallets-kit @stellar/stellar-sdk1. Install the packages
Add spare-sdk and spare-wallets-kit to your app. The kit opens confirmation in wallets such as Freighter, LOBSTR, or Ledger.
2. Ask at the moment of signing
Before they sign, show the option to add a little or round up for a foundation in the registry.
Classic transactions
import { StellarWalletsKit } from "@creit.tech/stellar-wallets-kit";
import { Networks } from "@stellar/stellar-sdk";
import { HorizonAccountPort } from "spare-sdk";
import { withSpare } from "spare-wallets-kit";
const spare = withSpare(StellarWalletsKit, {
foundation: { account: "G...", domain: "foundation.org" }, // listed in its stellar.toml
foundationName: "Tellus Cooperative",
mode: { amount: "0.50" }, // or { roundUp: true } for USDC purchases
appId: "my-app", // <= 22 ASCII bytes
maxAmount: "5",
accounts: new HorizonAccountPort("https://horizon.stellar.org"),
networkPassphrase: Networks.PUBLIC,
locale: "en",
});
// Same signature as the kit: use it wherever you called kit.signTransaction.
const { signedTxXdr } = await spare.signTransaction(xdr, { address });Soroban calls
// A Soroban tx holds one operation: the donation is a separate payment after success.
const follow = await spare.offerFollowUp({ successful: true, sourceAccount: address, hash });
if (follow.status === "signed") await submit(follow.signedTxXdr); // submitting is your jobBuilding your own interface? Use addDonation (classic) or donateAfter (Soroban) from spare-sdk directly.
3. Keep the registry in view
The gift goes straight to the foundation. The indexer and dashboard publish the movement.