Documentación
Guía rápida
Añade la pregunta del vuelto a tu app en Stellar. Este recorrido cubre la instalación del SDK, el kit de wallets y la primera prueba del flujo de confirmación.
pnpm add spare-wallets-kit spare-sdk @creit.tech/stellar-wallets-kit @stellar/stellar-sdk1. Instala los paquetes
Agrega spare-sdk y spare-wallets-kit a tu app. El kit abre la confirmación en wallets como Freighter, LOBSTR o Ledger.
2. Haz la pregunta al firmar
Antes de la firma, muestra la opción de sumar un poco o redondear para una fundación del registro.
Transacciones clásicas
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: "es",
});
// Same signature as the kit: use it wherever you called kit.signTransaction.
const { signedTxXdr } = await spare.signTransaction(xdr, { address });Llamadas Soroban
// 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 job¿Construyes tu propia interfaz? Usa addDonation (clásicas) o donateAfter (Soroban) de spare-sdk directamente.
3. Deja el registro a la vista
El aporte va directo a la fundación. El indexador y el tablero publican el movimiento.