New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@xstocker/agent-sdk

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xstocker/agent-sdk

SDK for AI agents to trade tokenized U.S. stocks (xStocks) on Solana via the xStocker Agent API.

npmnpm
Version
1.0.0
Version published
Weekly downloads
15
-70%
Maintainers
1
Weekly downloads
 
Created
Source

@xstocker/agent-sdk

SDK for AI agents to trade tokenized U.S. stocks (xStocks) on Solana.

No account. No API key. No OAuth. This SDK only reads public data and builds unsigned transactions — it never touches a private key. You (or your agent framework's wallet adapter) are responsible for signing and broadcasting the returned transaction.

Install

npm install @xstocker/agent-sdk

Usage

import { xstocker } from "@xstocker/agent-sdk";

// 1. Discover tradable assets
const { assets, payTokens } = await xstocker.getAssets();

// 2. Build an unsigned buy transaction
const order = await xstocker.buildOrder({
  wallet: "USER_SOLANA_ADDRESS",
  asset: "NVDAx",
  amount: 100,
  payToken: "USDC", // or "SOL"
  side: "buy",       // or "sell"
});

console.log(order.details);
// { side: 'buy', asset: 'NVDAx', amountIn: '100 USDC',
//   expectedOut: '0.470123 NVDAx', fee: '0.002350 NVDAx', ... }

// 3. Sign order.transaction (base64) with the user's own wallet,
//    then broadcast it to Solana yourself.

// 4. Verify it landed
const status = await xstocker.getOrderStatus(signature);
console.log(status.status); // "confirmed" | "finalized" | "processed" | "failed" | "not_found"

Selling

await xstocker.buildOrder({
  wallet: "USER_SOLANA_ADDRESS",
  asset: "NVDAx",
  amount: 0.5,        // amount of NVDAx to sell
  payToken: "USDC",   // token you receive
  side: "sell",
});

Custom client

import { XStockerAgentClient } from "@xstocker/agent-sdk";

const client = new XStockerAgentClient({ baseUrl: "https://api.xstocker.com" });

Error handling

import { XStockerAgentError } from "@xstocker/agent-sdk";

try {
  await xstocker.buildOrder({ wallet, asset: "NVDAx", amount: 100 });
} catch (err) {
  if (err instanceof XStockerAgentError) {
    console.error(err.code, err.message); // e.g. "no_route", "invalid_wallet"
  }
}

License

MIT

Keywords

solana

FAQs

Package last updated on 23 Jul 2026

Related posts