From 3443c20ca1eda3c5b925ce8b048bfd2b6d93daf7 Mon Sep 17 00:00:00 2001 From: Ade404 Date: Fri, 4 Dec 2026 03:32:34 +0000 Subject: [PATCH] docs: make the SDK example runnable after a default setup The README and docs/sdk.md examples created the client with account "researcher", but a default `vapi setup` derives an account named "main", so the example failed immediately with "No wallet named researcher. This machine has: main." The examples also paid a hardcoded id ("base-dex-volume") that does not come from the search result printed just above it; search items carry a `ref`, and pay resolves ids through the marketplace ref lookup. Pass the first result's ref so search and pay connect. Verified against vapi-network 0.17.5 on Node 24: the old example throws on line 1; with account "main" the client is created and search returns listings with refs. --- README.md | 5 +++-- docs/sdk.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index df56464..147a045 100644 --- a/README.md +++ b/README.md @@ -124,9 +124,10 @@ Call the same client from TypeScript: ```ts import { createVapiClient } from "vapi-network"; -const vapi = await createVapiClient({ account: "researcher" }); +const vapi = await createVapiClient({ account: "main" }); const listings = await vapi.call.search("Base DEX volume"); -const result = await vapi.call.pay({ id: "base-dex-volume", maxPriceUsd: 0.05 }); +const [listing] = listings as Array<{ ref: string }>; +const result = await vapi.call.pay({ id: listing.ref, maxPriceUsd: 0.05 }); console.log(result.body); ``` diff --git a/docs/sdk.md b/docs/sdk.md index 345c46a..e2f0823 100644 --- a/docs/sdk.md +++ b/docs/sdk.md @@ -16,7 +16,7 @@ npm i vapi-network ```ts import { createVapiClient } from "vapi-network"; -const vapi = await createVapiClient({ account: "researcher" }); +const vapi = await createVapiClient({ account: "main" }); const reply = await vapi.router.chat({ model: "venice/claude-sonnet-5", messages: [{ role: "user", content: "Summarise Base DEX activity." }], @@ -25,7 +25,8 @@ console.log(reply.content); const listings = await vapi.call.search("Base DEX volume"); console.log(listings); -const result = await vapi.call.pay({ id: "base-dex-volume", maxPriceUsd: 0.05 }); +const [listing] = listings as Array<{ ref: string }>; +const result = await vapi.call.pay({ id: listing.ref, maxPriceUsd: 0.05 }); console.log(result.body); const purchase = await vapi.router.buy(5);