Agent API: your own wallet

SDK: your own RPC

The agent API's plans built in your own code, on your own RPC, checked by verify.mjs.

For an app or an agent with its own wallet that calls a lot: build the same plans as the Agent API in your own code, reading the chain through your own RPC. No rate limits of ours and no API key: every plan is checked by verify.mjs before you get it.

Install

npm install github:alitiknazoglu/giftedstock-skill viem
import { createPublicClient, http } from "viem";
import { base } from "viem/chains";
import { createGiftedStock } from "giftedstock-skill/sdk";

const gs = createGiftedStock({
  base: createPublicClient({ chain: base, transport: http(process.env.MY_BASE_RPC) }),
  // robinhood: a client for Robinhood Chain (chain id 4663), if you use it
  // mainnet: an Ethereum client, so verify.mjs resolves a .eth name in a send or a gift itself
  // api: another Gifted Stock base, such as "http://localhost:3000" for testing (the checks stay the same)
});

const plan = await gs.buy({ wallet: "0xYou", chain: "base", box: "normal", quantity: 1, payWith: "USDC" });
// plan.steps: the unsigned transactions to send in order from your wallet, as the API gives them

The source is in the skill repo ↗, next to verify.mjs. Plain JavaScript, viem only. It loads with import or require(). The repo's examples/giftedstock.mjs asks another site the same way with GIFTEDSTOCK_API=http://localhost:3000.

What it does

FunctionsYour RPCGifted Stock
buy, send, settle, boxStatuseverythingnothing
openeverythingwithout ids, the wallet's sealed boxes (GET /wallet)
swap (and bridge), quoteeverythingnothing (a bridge asks Relay for its route)
gift, giftOpen, giftTakeBack, giftFactsevery chain read and stepa note's text (POST /gift/note, GET /gift/note), a link's wallet list (POST /gift/list) and whether a link key is used (GET /gift/link-key/{address}): only Gifted Stock keeps them
giftTopUpeverythingwhether the link was taken back, when your RPC can't read its logs (GET /gift/{batchId})
giftClaimlinks anyone may claima verified-only or list link's approval (signed by us)
basket, basketCreatea basket buy's chain parta basket's record (GET /basket/{code}); making one reserves it with us
signIn, partner, campaign, partnerRequestevery quote, balance, approval and step, rebuilt and re-checkedthe partner and campaign records, a first-come claim's approval
  • Requests and answers are the agent API's: the same fields, the same plan shape and the same refusal codes (a GiftedStockError with code and message). boxStatus answers in the shape of GET /box.
  • Its own codes: not_a_plan (an answer with no steps), verify_failed (verify.mjs stopped the plan), server_differs (Gifted Stock's part does not match the chain), unavailable (a network error), no_client (a chain you gave no client for), bad_path (partnerRequest takes /api/partner/... and /api/campaign/... only), bad_answer (a sign-in answer not for your wallet) and over_max (a basket box over maxBoxUsd, as the API answers it).
  • A swap or quote with a stock carries the US market note, as the API's does.
  • Where a part comes from Gifted Stock, the SDK checks it against the chain on your RPC and refuses an answer that differs.
  • Each plan is held by verify.mjs on your clients before it is returned; verify: false skips that.
  • It never holds or asks for a key: you sign the steps with your own wallet.
Without a wallet of your own, use Prefilled links or the MCP server instead. Calling only now and then? The Agent API needs no install.