Agentic Staking API

Stake $SGL, claim rewards, and read positions with only a wallet keypair — no browser, no dashboard.

  • Base URLhttps://staking.x402layer.cc
  • Rolescompute, validator, yield

Ownership model: prepare → sign → submit

Staking is an on-chain Anchor program, so we never custody your stake. Mutating actions return an unsigned transaction you sign locally. The transaction's signature isthe proof of ownership — the program rejects any signer that isn't the staker. Reads are public on-chain data and need no auth.

This is not x402. x402 moves a token to a payee; staking locks your own tokens in a contract only you control, which requires your signature. The prepare→sign→submit flow is the agentic equivalent.

Endpoints

MethodPathDescription
GET/api/agentSelf-describing manifest
GET/api/agent/analyticsTotal staked, stakers, TVL, reward pool
GET/api/agent/positions?wallet=Positions, status, cooldowns, claimable rewards
POST/api/agent/stake{ wallet, role, amount } → unsigned tx
POST/api/agent/unstake{ wallet, role } → begin cooldown
POST/api/agent/claim-unstake{ wallet, role } → withdraw after cooldown
POST/api/agent/claim{ wallet, role? } → claim rewards
POST/api/agent/submit{ transaction } → broadcast, returns signature

Every prepare endpoint returns { action, transactions: [{ transaction, blockhash, lastValidBlockHeight, description }], next }.

Quick start

curlbash
# Global analytics
curl https://staking.x402layer.cc/api/agent/analytics

# Your positions
curl "https://staking.x402layer.cc/api/agent/positions?wallet=<YOUR_WALLET>"

# Prepare a stake (returns an unsigned tx to sign + submit)
curl -X POST https://staking.x402layer.cc/api/agent/stake \
  -H "Content-Type: application/json" \
  -d '{"wallet":"<YOUR_WALLET>","role":"compute","amount":50000}'
Node — full prepare → sign → submitjavascript
import { Keypair, Transaction } from "@solana/web3.js";

const BASE = "https://staking.x402layer.cc";
const kp = Keypair.fromSecretKey(/* your secret key bytes */);
const wallet = kp.publicKey.toBase58();

// 1. prepare
const prep = await (await fetch(`${BASE}/api/agent/stake`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ wallet, role: "compute", amount: 50000 }),
})).json();

for (const { transaction } of prep.transactions) {
  // 2. sign
  const tx = Transaction.from(Buffer.from(transaction, "base64"));
  tx.partialSign(kp);
  // 3. submit
  const res = await (await fetch(`${BASE}/api/agent/submit`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ transaction: tx.serialize().toString("base64") }),
  })).json();
  console.log(res.signature, res.explorer);
}