home / skills / openclaw / skills / solana-payments-wallet-dev

solana-payments-wallet-dev skill

/skills/tilo-14/solana-payments-wallet-dev

This skill helps you build Solana payments and wallet flows using light-token, enabling receive, send, balance, history, and client-side signing.

npx playbooks add skill openclaw/skills --skill solana-payments-wallet-dev

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
5.9 KB
---
name: payments-and-wallets
description: "For stablecoin payment flows and wallet integrations on Solana 200x cheaper token accounts. Receive, send, balance, history, and client-side signing with Privy and Solana wallet adapters. Optional guide to add nullifiers to prevent payments from being executed more than once."
metadata:
  source: https://github.com/Lightprotocol/skills
  documentation: https://www.zkcompression.com
  openclaw:
    requires:
      env: ["HELIUS_RPC_URL"]  # Required for all examples
      # Privy signing flow only (sign-with-privy.md): PRIVY_APP_ID, PRIVY_APP_SECRET, TREASURY_WALLET_ID, TREASURY_AUTHORIZATION_KEY — get these at privy.io
      bins: ["node", "cargo"] # node for TS client, cargo for Rust nullifier example
---

# Payments and wallets

Build payment flows and wallet integrations using light-token on Solana. The light-token API matches SPL-token and extends it to include the light token program.

| Creation cost     | SPL                 | light-token          |
| :---------------- | :------------------ | :------------------- |
| **Token Account** | ~2,000,000 lamports | ~**11,000** lamports |

## Workflow

1. **Clarify intent**
   - Recommend plan mode, if it's not activated
   - Use `AskUserQuestion` to resolve blind spots
   - All questions must be resolved before execution
2. **Identify references and skills**
   - Match task to [domain references](#domain-references) below
   - Locate relevant documentation and examples
3. **Write plan file** (YAML task format)
   - Use `AskUserQuestion` for anything unclear — never guess or assume
   - Identify blockers: permissions, dependencies, unknowns
   - Plan must be complete before execution begins
4. **Execute**
   - Use `Task` tool with subagents for parallel research
   - Subagents load skills via `Skill` tool
   - Track progress with `TodoWrite`
5. **When stuck**: ask to spawn a read-only subagent with `Read`, `Glob`, `Grep`, and DeepWiki MCP access, loading `skills/ask-mcp`. Scope reads to skill references, example repos, and docs.

## API overview

| Operation | SPL | light-token (action / instruction) |
|-----------|-----|-------------------------------------|
| Receive | `getOrCreateAssociatedTokenAccount()` | `loadAta()` / `createLoadAtaInstructions()` |
| Transfer | `createTransferInstruction()` | `transferInterface()` / `createTransferInterfaceInstructions()` |
| Get balance | `getAccount()` | `getAtaInterface()` |
| Tx history | `getSignaturesForAddress()` | `rpc.getSignaturesForOwnerInterface()` |
| Wrap from SPL | N/A | `wrap()` / `createWrapInstruction()` |
| Unwrap to SPL | N/A | `unwrap()` / `createUnwrapInstructions()` |
| Register SPL mint | N/A | `createSplInterface()` / `LightTokenProgram.createSplInterface()` |
| Create mint | `createMint()` | `createMintInterface()` |

Plural functions (`createTransferInterfaceInstructions`, `createUnwrapInstructions`) return `TransactionInstruction[][]` — each inner array is one transaction. They handle loading cold accounts automatically.

## Domain references

| Task | Reference |
|------|-----------|
| Build payment flows (receive, send, balance, history, wrap/unwrap) | [payments.md](references/payments.md) |
| Build wallet UI (display tokens, transfer, wrap/unwrap) | [wallets.md](references/wallets.md) |
| Sign with Wallet Adapter or Mobile Wallet Adapter | [sign-with-adapter.md](references/sign-with-adapter.md) |
| Sign with Privy (embedded wallet provider) | [sign-with-privy.md](references/sign-with-privy.md) |
| Prevent duplicate actions (double-spend prevention) | [nullifiers.md](references/nullifiers.md) |

## Setup

```bash
npm install @lightprotocol/compressed-token@beta @lightprotocol/stateless.js@beta @solana/web3.js @solana/spl-token
```

```typescript
import { createRpc } from "@lightprotocol/stateless.js";
import {
  createLoadAtaInstructions,
  loadAta,
  createTransferInterfaceInstructions,
  transferInterface,
  createUnwrapInstructions,
  unwrap,
  getAssociatedTokenAddressInterface,
  getAtaInterface,
  wrap,
} from "@lightprotocol/compressed-token/unified";

const rpc = createRpc(RPC_ENDPOINT);
```

## Resources

- [Payments docs](https://zkcompression.com/light-token/toolkits/for-payments)
- [Wallets docs](https://zkcompression.com/light-token/toolkits/for-wallets)
- [GitHub examples](https://github.com/Lightprotocol/examples-light-token/tree/main/toolkits/payments-and-wallets)
- [Nullifier program](https://github.com/Lightprotocol/nullifier-program/)

## SDK references

| Package | Link |
|---------|------|
| `@lightprotocol/stateless.js` | [API docs](https://lightprotocol.github.io/light-protocol/stateless.js/index.html) |
| `@lightprotocol/compressed-token` | [API docs](https://lightprotocol.github.io/light-protocol/compressed-token/index.html) |
| `@lightprotocol/nullifier-program` | [npm](https://www.npmjs.com/package/@lightprotocol/nullifier-program) |

## Security

The Privy signing examples transmit secrets to an external API — review [sign-with-privy.md](references/sign-with-privy.md) before running.

- **Declared dependencies.** `HELIUS_RPC_URL` is required for all examples. The Privy signing flow additionally requires `PRIVY_APP_ID`, `PRIVY_APP_SECRET`, `TREASURY_WALLET_ID`, and `TREASURY_AUTHORIZATION_KEY` — get these at [privy.io](https://privy.io). Load secrets from a secrets manager, not agent-global environment.
- **Privy signing flow.** `PRIVY_APP_SECRET` and `TREASURY_AUTHORIZATION_KEY` are sent to Privy's signing API. Verify these only reach Privy's official endpoints. See [sign-with-privy.md](references/sign-with-privy.md).
- **Subagent scope.** When stuck, the skill asks to spawn a read-only subagent with `Read`, `Glob`, `Grep` scoped to skill references, example repos, and docs.
- **Install source.** `npx skills add Lightprotocol/skills` from [Lightprotocol/skills](https://github.com/Lightprotocol/skills).
- **Audited protocol.** Audit reports at [github.com/Lightprotocol/light-protocol/tree/main/audits](https://github.com/Lightprotocol/light-protocol/tree/main/audits).

Overview

This skill provides a compact payments-and-wallets toolkit for building stablecoin payment flows and wallet integrations on Solana using the light-token API. It focuses on dramatically cheaper token accounts, client-side signing with Privy and Solana wallet adapters, and optional nullifier-based duplicate-prevention. The skill bundles examples, API mappings, and setup instructions to accelerate receive, send, balance, history, wrap/unwrap, and mint workflows.

How this skill works

The skill maps common SPL-token operations to light-token equivalents and exposes helper functions that produce transaction instructions or perform RPC calls. It includes utilities to load or create ATA cheaply, transfer via transferInterface, fetch balances and history, and wrap/unwrap between SPL and light-token formats. Client-side signing is supported with standard Solana wallet adapters and Privy; an optional nullifier integration prevents duplicate payment execution.

When to use it

  • Building stablecoin payment rails that need very low-cost token accounts on Solana
  • Integrating token display, transfer, and wrap/unwrap functionality into a web or mobile wallet UI
  • Implementing server-assisted flows where client-side signing is required (Privy or wallet adapters)
  • Adding duplicate-payment protection using nullifiers for high-value or one-time payments
  • Prototyping payment flows that require quick conversion between SPL and light-token formats

Best practices

  • Resolve all user intent and blockers before executing transactions; never guess missing inputs
  • Keep secrets out of agent-global environment; use a secrets manager for PRIVY and RPC keys
  • Use create*Instructions helpers to batch and handle cold accounts automatically
  • Validate Privy endpoints and limit transmitted secrets to official API URLs only
  • Test nullifier flows thoroughly in a sandbox before enabling in production

Example use cases

  • Consumer checkout: receive a stablecoin payment into a light-token ATA, sign with a mobile wallet adapter
  • Merchant payout: create transferInterface instructions server-side and prompt client to sign
  • Wallet UI: list balances via getAtaInterface, show history with rpc.getSignaturesForOwnerInterface, enable wrap/unwrap
  • Subscription flows: create plan-based payments and use nullifiers to guarantee single redemption
  • Onboarding: register an SPL mint with createSplInterface, then mint and distribute compressed tokens

FAQ

How much cheaper are token accounts with light-token?

Light-token token accounts are roughly two orders of magnitude cheaper — about 11,000 lamports versus ~2,000,000 lamports for standard SPL ATAs.

Can I use existing Solana wallet adapters with this skill?

Yes. The skill supports standard Solana wallet adapters and mobile adapters for client-side signing, and includes Privy examples for embedded wallet flows.