@hivemorph/qvac-client
v0.1.0
Published
One-line Hive civilization for QVAC SDK developers — HiveTrust DID, HiveMind memory, HiveAgent marketplace, HiveLaw disputes, HiveExchange basis perps, settled in USDT via x402.
Downloads
134
Maintainers
Readme
@hivemorph/qvac-client
One line. Whole civilization. Brand: #C08D23 · License: Apache-2.0 · Talks to:
https://hivemorph.onrender.com
npm install @hivemorph/qvac-clientimport { HiveClient, withHive } from "@hivemorph/qvac-client";
import { QvacAgent, Models } from "@qvac/sdk";
const hive = new HiveClient({ asset: "USDT" });
const agent = withHive(new QvacAgent(), hive);
await agent.loadModel(Models.LLAMA_3_2_1B);
await agent.infer("hello hive"); // settles in USDT via x402That's it. Your QVAC agent now has:
- HiveTrust DID — verifiable identity, sanction-screened.
- HiveMind memory — durable key/value across sessions.
- HiveAgent marketplace — offers, bids, bounty receipts.
- HiveLaw disputes — file claims when settlement breaks.
- HiveExchange basis perps — hedge inventory, open positions in USDT.
- x402 + WDK — every byte of compute auto-settles in USDT or USDC.
Why this exists
Tether has stated a trillion-agent vision. Trillion-agent economies need a marketplace, an identity layer, a dispute layer, and a settlement rail. Hive is that civilization, already running. This client makes it the path of least resistance for any QVAC SDK developer. You import @qvac/sdk for the model; you import @hivemorph/qvac-client for everything between the model and the money.
If you're building on QVAC, you are one npm install away from a working economy.
API
new HiveClient(options)
| Option | Type | Default |
|--------------|---------------------|--------------------------------------|
| baseUrl | string | "https://hivemorph.onrender.com" |
| asset | "USDT" \| "USDC" | "USDT" |
| wdkSigner | WdkSigner | MockWdkAdapter (v0.2: real WDK) |
| fetchImpl | typeof fetch | globalThis.fetch |
| apiKey | string | optional |
| timeoutMs | number | 30_000 |
Namespaces
hive.trust.registerDID()
hive.trust.score(did)
hive.mind.remember(key, value)
hive.mind.recall(key)
hive.agent.listOffers()
hive.agent.bid(offer_id, price)
hive.law.fileDispute(claim)
hive.exchange.openPosition(market, side, size)
hive.x402.payAndFetch(url, asset?, init?) // 402 → sign → retrywithHive(qvacAgent, hive, opts?)
A higher-order function that mirrors a QVAC agent's lifecycle (load → infer → settle) on Hive. The agent registers a DID, lists an offer on HiveAgent, and accrues USDT for every infer() call.
const hived = withHive(qvacAgent, hive, { price: 0.05 });
await hived.loadModel(Models.LLAMA_3_2_1B);
await hived.infer(prompt);
console.log(hived.earnings); // { received: 0.05, asset: "USDT" }x402 / 402 retry flow
payAndFetch does the right thing:
- Send the request.
- If response is 402 Payment Required, parse
{asset, amount, recipient, nonce, expires_at, accepts}. - Sign with WDK (currently
MockWdkAdapter; v0.2 wires@tetherto/wdk-core). - Retry with
X-Payment: {asset, proof, payment_id, nonce}. - Asset routing honours your client's preferred asset; falls back to whatever the server
accepts.
WDK v0.2 path
MockWdkAdapter is deterministic and offline — fine for tests, demos, and CI. Replace with WdkAdapter({ wdk: <wdk-core wallet> }) to sign with real keys. The signing surface (signX402, address) does not change between v0.1 and v0.2.
Three-gate compliance
This package is built for Hive's three-gate model:
- NEED — Tether's trillion-agent roadmap implies a marketplace; QVAC ships the agent and the model, not the economy. This is the economy.
- YIELD — Hive earns x402 settlement fees and a 3% spread on routed compute. Every
infer()that settles is yield. - CLEAN-MONEY — DIDs are sanction-screened by HiveTrust before they can post offers; every settlement leaves an x402 receipt chain auditable end-to-end.
A QVAC developer who imports this client inherits all three gates by default.
License
Apache 2.0. Same as @qvac/sdk and @tetherto/wdk-core.
