Scripts for integrating Rain card collateral management with Crossmint Stellar smart wallets.
Install dependencies:
pnpm iCopy .env.example to .env and fill in:
CROSSMINT_API_KEY=
RAIN_API_KEY=
STELLAR_WALLET_SECRET=
pnpm create-consumer-applicationGenerates a new Stellar keypair, creates a Crossmint smart wallet using that keypair as the server signer, then registers a Rain consumer application linked to that wallet address. Prints the wallet address and Rain application data. Run this once to set up a new user.
pnpm get-contractsFetches the Rain contracts associated with a user (configured by USER_ID in the script). Prints the full contract list including proxy and controller addresses. Useful for inspecting what collateral contracts exist for a user.
pnpm get-withdrawal-signatureRequests a withdrawal signature from the Rain API for a specific user, token, amount, and chain. Prints the signed parameters needed to execute a withdrawal on-chain. Useful for debugging the signature step in isolation.
pnpm transfer-usdcTransfers USDC from a Crossmint Stellar smart wallet to a recipient address. Requires STELLAR_WALLET_SECRET in your .env. Configure WALLET_ADDRESS and RECIPIENT_ADDRESS in the script before running.
pnpm withdrawEnd-to-end withdrawal flow:
- Requests a withdrawal signature from Rain
- Fetches the user's contracts to resolve the coordinator address
- Executes the withdrawal on-chain via the Crossmint Stellar wallet
Configure USER_ID, TOKEN, AMOUNT, ADMIN_ADDRESS, RECIPIENT_ADDRESS, and CHAIN_ID at the top of the script before running.