TypeScript SDK for agent markets on NEAR

Buyer agents pool demand, sellers bid in sealed rounds, and each buyer pays only its share. One round clears 90 GPU hours for 20 buyers.

20 of 20 payments final on NEAR testnet, each checked against RPC.

Every buyer’s share, from bid to receipt

Each buyer agent posts a quantity and a spend cap. The round clears, then the runner signs, journals and confirms every payment. Read the settlement guide

A round in 3 steps

1

Pool buyer demand

Each agent sends a quantity and a total cap. The round adds them into one order.

2

Seal each seller agent’s bid

Sellers commit a SHA-256 hash, then reveal. A reveal that does not match is dropped.

TSseller.tssealed
const bid = { capacity: "90",
  unitPrice: "4", salt };
const hash = await
  commitBid(id, seller, bid);
round.submitCommitment(
  seller, hash);
// after commitCloses
await round.revealBid(
  seller, bid);
Reveal matches the hash.
3

Pay each buyer agent’s share

Buyers sign a spend cap. The runner pays within it and resumes after a crash.

Payment buyer-7
2 of 5
  • Spend policy signed by buyer
  • Transfer signed and journaled
  • Sent to seller-2
  • Final on testnet
  • Receipt matched by audit

Who owns what

Your agents decide what to buy and what to charge. SwarmKit admits them to a round, keeps every bid sealed until the deadline, clears it by the published rule, records a transcript anyone can replay and pays each share on NEAR.

22 payments on NEAR testnet, with receipts

Two runs on 14 November 2026 from faucet-funded subaccounts. Every transfer links to its finalized transaction.

Settlement audit · NEAR testnet
Payments final
20 of 20
Testnet NEAR moved
0.036

Loading the recorded receipts.

Questions

The full contract of every export is in the reference.

Read the coordination model

Does the GPU co-op spend real NEAR?

Only testnet NEAR. Prices are simulated dollars; pressing Settle pays your share on NEAR testnet at 0.0001 NEAR per dollar.

Does SwarmKit settle through NEAR Intents?

Yes. A SwarmKit round has settled on mainnet through intents.near: a signed NEP-413 transfer, preflighted, executed and reconciled by the SDK. See the transaction

Can I write my own allocation rule?

Yes. Give a mechanism a versioned id and a selectWinner or allocate function. Replay and audit use the same rule.

What if the process dies mid-payment?

The runner journals each signed transfer before sending it. On restart it checks the stored hash instead of signing again.

Do agents need a language model?

No. A strategy is an async function. Scripted ones replay from a seed; a model can sit behind the same function.

Run the SDK in this page

The panel imports the packaged near-swarmkit build. Each press runs one stage of a two-buyer, two-seller round with split fulfillment.

Download the example

market.mjs · simulated credits
import { startSimulation, advanceSimulation,
  replayRound } from "near-swarmkit";

let session = startSimulation(agents);
// one stage per press; persist between them
session = await advanceSimulation(session, agents);
const snapshot = await replayRound(session.transcript);
  1. Demand
  2. Commit
  3. Reveal
  4. Allocate

Loading the SDK.