Skip to content

docs: make the SDK example runnable after a default setup - #151

Open
Adekurnia1988 wants to merge 1 commit into
vAPI-Network:mainfrom
Adekurnia1988:docs/fix-sdk-example-account
Open

Adekurnia1988 wants to merge 1 commit into
vAPI-Network:mainfrom
Adekurnia1988:docs/fix-sdk-example-account

Conversation

@Adekurnia1988

Copy link
Copy Markdown

What was wrong

The SDK example in README.md and docs/sdk.md created the client with account: "researcher". A default vapi setup derives an account named main, so running the example verbatim after following the quickstart fails on the first line:

No wallet named researcher. This machine has: main.

The example then 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 (findMarketplaceApiByRef), so the example should pass the first result's ref.

Fix

  • account: "researcher" → account: "main" in both examples (the account vapi setup creates).
  • pay({ id: "base-dex-volume", ... }) → take listings[0].ref from the search result and pay that, so search and pay connect.

Verification

Tested with vapi-network@0.17.5 on Node v24.22.1 (Ubuntu 24.04) against a vault with the default main account:

  • Old example: throws No wallet named researcher. This machine has: main.
  • Fixed example: client is created and call.search("Base DEX volume") returns listings with ref values (the paying call itself was not executed in my test run).

Background: #150

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants