Skip to content
Mainnet Live. All executions, addresses and hashes are live.
WORMHOOK
skeletonv0.1 · skeleton docs

SDK quickstart

From install to a receipt in three calls. Simulation-only in the skeleton.

Install

terminal
npm i @wormhook/sdk

In this repository the SDK lives at packages/wormhook-sdk and is imported as @wormhook/sdk.

Create a client

client.ts
import { WormHookClient } from "@wormhook/sdk";

const client = new WormHookClient({
  network: "devnet",           // "devnet" | "mainnet-beta"
  appId: "<your app program ID>",
  speed: 1,                    // simulation only: 10 = ten times faster
});

Get an app ID from the developer console.

Prepare, simulate, receive

research.ts
const call = await client.prepareCall({
  hookId: "imd.research.v1",
  action: "START_RESEARCH",
  payload: {
    query: "Summarise validator client diversity on Solana mainnet, Q3 2026",
    depth: "standard",
    budget: "40",
  },
  maxSpend: "40",
  ttl: 900,
});

console.log(call.callId);      // deterministic: same inputs → same ID

const execution = await client.simulate(call);

execution.onStage((e) => {
  console.log(e.index + 1, e.stage, e.status, e.evidence);
});

const receipt = await execution.waitForReceipt();
// { callId, status: "success", destinationTx, outputHash, amountSpent, timestamp, receiptHash, returnSequence }

Simulate failures

await client.simulate(call, { scenario: "reverted" });       // failed receipt, WH-401
await client.simulate(call, { scenario: "partial" });        // partial receipt, WH-403
await client.simulate(call, { scenario: "expired" });        // failed receipt, WH-201
await client.simulate(call, { scenario: "replay" });         // throws WormHookError WH-302
await client.simulate(call, { scenario: "relay_pending" });  // throws WH-202 after stallTimeoutMs

API surface

MethodReturnsSkeleton
new WormHookClient(config)client✓
prepareCall(input)PreparedCall with callId, call, payload, encoded✓ (mock hash/encoding)
simulate(prepared, opts?)SimulatedExecution✓
execution.onStage(fn)unsubscribe function✓
execution.waitForReceipt()HookReceipt✓
send(prepared)—throws until phase 2