Stellar Wallet + DeFindex yield. A minimal web app that creates a non-custodial Crossmint wallet on Stellar, lets you send tokens, and earns yield by depositing USDC into a DeFindex vault. Built with Next.js (App Router) and the Crossmint React SDK, themed in the DeFindex brand palette.
Based on the Crossmint Wallets docs.
- User signs in with email/Google (Crossmint Auth).
- A Stellar smart wallet is created automatically on login (
createOnLogin), with email-based recovery — no seed phrase. - The send form calls
wallet.send(recipient, token, amount)and links to the transaction on the explorer. - The DeFindex panels show the vault APY and the wallet's position, and
let you deposit and withdraw USDC. Because Crossmint wallets are
smart wallets (
C…), deposits/withdrawals are reconstructed as contract calls and submitted viaStellarWallet.sendTransaction— see the guide below.
- Install dependencies:
npm install
- Create a client-side API key in the
Crossmint Console (key starts with
ck_). Enable the wallet scopes. Use a staging key for Stellar testnet or a production key for mainnet. - (Optional, for the DeFindex panels) Create a DeFindex API key (
sk_…) — see thedefindex-apiskill'sauth.md. It's a server-side secret; keep it out ofNEXT_PUBLIC_*. - Copy the env file and fill in your keys:
cp .env.example .env.local
NEXT_PUBLIC_CROSSMINT_API_KEY=ck_staging_xxx NEXT_PUBLIC_CROSSMINT_CHAIN=stellar NEXT_PUBLIC_STELLAR_NETWORK=mainnet # or testnet DEFINDEX_API_KEY=sk_... # server-only; enables the vault panels - Run it:
Open http://localhost:3000.
npm run dev
- On Stellar, Crossmint focuses on USDC; XLM is the native asset. The send
form offers both — adjust
TOKENSincomponents/SendForm.tsxas needed. - Recipients can be a Stellar address (
G…) or a Crossmint locator likeemail:user@example.com. - The vault panels target one fixed mainnet USDC vault (
lib/vault.ts). Withdraw is denominated in USDC and converted to shares by DeFindex's simulation. - Without a
DEFINDEX_API_KEY, the send flow still works; the vault panels will error on load.
app/
providers.tsx # Crossmint providers (auth + wallet, Stellar)
layout.tsx # wraps the app in providers
page.tsx # login → wallet → send + vault panels
globals.css # DeFindex brand theme
api/defindex/ # server Route Handlers (hold the sk_ key)
apy/ balance/ deposit/ withdraw/
components/
SendForm.tsx # send UI + wallet.send()
Balance.tsx # wallet token balance
VaultApy.tsx # vault APY
VaultPosition.tsx # wallet's vault position (shares + underlying value)
VaultDeposit.tsx # deposit USDC into the vault
VaultWithdraw.tsx # withdraw USDC from the vault
lib/
defindex.ts # server-only DeFindex fetch helper
vault.ts # client-safe vault address constant
- DeFindex vault integration — read APY /
balance and deposit into / withdraw from a DeFindex yield vault using the
Crossmint Stellar smart wallet. (A plain-Markdown copy lives alongside as
.md.)