Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Realmint Baskets — Solana Agent Kit plugin

Turn a plain-English mandate into a diversified basket of tokenized real-world assets: scored by Realmint, executed on Solana via Jupiter, buyable in one tap as a Blink.

"Give me $200 of safe tokenized-treasury exposure on Solana"
        │
        ▼
┌─────────────────────┐   scores    ┌──────────────────────────┐
│ BUILD_RWA_BASKET    │ ──────────▶ │ Realmint scoring engine  │
│ mandate → basket    │ ◀────────── │ api.realmint.io (live)   │
└─────────┬───────────┘  backing /  └──────────────────────────┘
          │              enforceability / control / exit /
          │              liquidity / social → composite 0-100
          ▼
┌─────────────────────┐   quotes    ┌──────────────────────────┐
│ EXECUTE_RWA_BASKET  │ ──────────▶ │ Jupiter (multi-leg swap, │
│ dry-run → confirm   │             │ USDC in, RWAs out)       │
└─────────┬───────────┘             └──────────────────────────┘
          ▼
┌─────────────────────┐             ┌──────────────────────────┐
│ MINT_BASKET_BLINK   │ ──────────▶ │ Blink: one-tap shareable │
│ + x402 paywall      │             │ buy link (dial.to)       │
└─────────────────────┘             └──────────────────────────┘

Why

Tokenized RWAs are arriving on Solana, but discovery is adversarial: a Jupiter search for "OUSG", "TBILL" or "ACRED" returns pump.fun impersonators with $2-4k of liquidity next to — or instead of — the real issuance. An agent that buys by symbol buys the fake. Realmint's Risk & Rights engine (live in production, scoring backing, enforceability, control, exit, liquidity and social into a composite 0-100) is the missing trust layer; this plugin makes it native to the Solana agent economy.

Status (honest)

Realmint runs in production on EVM (Base + Polygon; api.realmint.io + mcp.realmint.io). This plugin is the Solana adapter being built under a Superteam Agentic Engineering grant — a port of a working engine, not a greenfield build.

Piece Status
Plugin definition + 4 actions (Solana Agent Kit v2 .use(...)) ✅ working
NL mandate parser (budget, risk profile, categories) ✅ working + tested
Basket construction (score filters, quadratic tilt, 40% cap, budget conservation) ✅ working + tested
Realmint API client (live with REALMINT_API_KEY, schema-accurate fixtures without) ✅ working
Jupiter multi-leg dry-run (live mainnet quotes per leg) ✅ working
Jupiter signed execution (embedded wallet + human-in-the-loop) 🔜 M2 — scaffold refuses to sign by design
Blink metadata + share URL ✅ working
Hosted Blink POST handler (returns transaction) + Dialect registry 🔜 M2
x402 paywall — 402 challenge shape ✅ working
x402 verify/settle via @x402/svm 🔜 M2 (already live on Base in Realmint prod)

Quickstart

npm install
npm test        # 13 unit tests: mandate parsing + basket invariants
npm run demo    # end-to-end: mandate → basket → LIVE Jupiter quotes → Blink → x402
npm run demo -- '$500 of tokenized assets, balanced risk'

No wallet or API key needed for the demo: scores fall back to bundled schema-accurate fixtures (flagged in the output), while Jupiter quotes are always live — the mint registry holds real Solana RWAs (Ondo USDY, Maple syrupUSDC). Set REALMINT_API_KEY for live scores.

Sample demo output:

Mandate: "$500 of tokenized assets, balanced risk"

[1/4] Basket built — weighted composite=77/100
      USDY        50.0%  $250.00  composite 81/100 (backing 92, liquidity 78, exit 85)
      syrupUSDC   50.0%  $250.00  composite 72/100 (backing 74, liquidity 82, exit 68)
      Rejected: paxg (mint unverified) · realtoken-demo (composite 52 < floor 60)
                · pump-ousg-fake (composite 9 < floor 60)

[2/4] Execution dry-run — live Jupiter quotes (mainnet)
      USDY       $250.00 USDC → 219.4110 USDY       (price impact 0.0017%)
      syrupUSDC  $250.00 USDC → 213.2507 syrupUSDC  (price impact 0.0000%)

Usage with Solana Agent Kit

import { SolanaAgentKit } from "solana-agent-kit";
import TokenPlugin from "@solana-agent-kit/plugin-token";
import RealmintBasketsPlugin from "@realmint/solana-agent-kit-plugin";

const agent = new SolanaAgentKit(wallet, process.env.SOLANA_RPC_URL!, {})
  .use(TokenPlugin)
  .use(RealmintBasketsPlugin);

// The LLM can now call BUILD_RWA_BASKET / GET_BASKET_SCORE /
// EXECUTE_RWA_BASKET / MINT_BASKET_BLINK, or programmatically:
const { basket } = await agent.methods.buildBasket(
  agent,
  "Give me $200 of safe tokenized-treasury exposure on Solana",
);

Actions

Action What it does
BUILD_RWA_BASKET NL mandate → filtered, score-weighted basket. Explains every exclusion.
GET_BASKET_SCORE Realmint Risk & Rights scores for arbitrary allocations + weighted composite.
EXECUTE_RWA_BASKET Multi-leg USDC swap via Jupiter. dryRun=true (default) returns live quotes; live path requires human-in-the-loop confirmation.
MINT_BASKET_BLINK Basket → Blink metadata + dial.to one-tap share URL.

Design decisions

  • Verified mint registry (src/constants.ts): only issuer-verified Solana mints are executable. This is what stops the agent from buying the $4k pump.fun "$ousg". M2 moves this server-side into Realmint's route-support table (per-venue scoring already exists for EVM).
  • Deterministic core: mandate parsing and basket math are pure functions with unit tests — the LLM decides what to ask for, the engine decides what qualifies. Reproducible, auditable baskets.
  • Refuses to sign in M1: executeBasketPlan builds real swap transactions but throws before signing. Funds can't move until the M2 human-in-the-loop path (Turnkey/Privy embedded wallet) is wired and reviewed.
  • x402 port, not invention: Realmint already settles x402 payments in production on Base (Coinbase CDP facilitator). src/x402/paywall.ts is the SVM mirror of that flow.

Layout

src/
├── index.ts            # plugin definition (.use(...) entry point)
├── constants.ts        # USDC mints, Jupiter API, verified RWA registry
├── types.ts            # RealmintScore, Mandate, Basket, ExecutionPlan…
├── basket/construct.ts # filters, weights, budget conservation
├── blinks/action.ts    # Blink metadata, actions.json, share URL
├── execute/jupiter.ts  # quotes, dry-run plan, (M2) signed execution
├── mandate/parse.ts    # NL mandate → structured constraints
├── realmint/client.ts  # api.realmint.io client + fixture fallback
├── tools/              # the four agent actions
└── x402/paywall.ts     # per-query paywall (402 challenge)

Links

MIT

About

Solana Agent Kit plugin: plain-English mandate → Realmint-scored RWA basket → Jupiter execution → Blink distribution + x402 pay-per-query

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages