conceptualv0.1 · skeleton docs
Solana caller
Calling a hook from a Solana program or client through the WormHookRouter.
Two ways to call
| From | How | Use when |
|---|---|---|
| A program (CPI) | Your program invokes the router with your app's PDA as signer. | The call is part of on-chain logic (settlement, keepers, governance). |
| A client (SDK) | The SDK builds a transaction to the router signed by your app's authority. | User-initiated actions in a frontend (IMDHOOKS). |
Both produce the same HookCall and the same receipt.
CPI shape
call_hook.rsconceptual
// In your program
wormhook_router::cpi::call_hook(
CpiContext::new_with_signer(router_program, CallHook {
app: app_pda, // registered app, signs via seeds
config: router_config,
pending_call: pending_call_pda, // created: seeds = ["call", call_id]
wormhole_bridge, wormhole_message, wormhole_emitter, wormhole_sequence,
fee_collector, payer, // pays Wormhole + executor fees
system_program,
}, signer_seeds),
HookCallArgs {
hook_id: "imd.research.v1".into(),
action: "START_RESEARCH".into(),
payload, // Vec<u8>, hashed into the call
max_spend: Some(40_000_000), // 40.000000 in 6dp
ttl: 900,
},
)?;What the router checks
- The app account is registered and not paused (
WH-101). - The fee covers Wormhole message fee plus the executor quote (
WH-102). - It assigns the next nonce for the app, derives the call ID, and creates a pending call account.
- It posts the HookCall to Wormhole Core from the router's emitter.
Accounts you'll see
| Account | Seeds (planned) | Holds |
|---|---|---|
| Router config | ["config"] | Admin, pause flag, fee settings, registered gateway emitters |
| App | ["app", app_id] | Owner, status, nonce counter, limits, allowlisted hooks |
| Pending call | ["call", call_id] | HookCall, status, created slot |
| Receipt | ["receipt", call_id] | HookReceipt once recorded |
Finality
Wormhole guardians sign Solana messages at the consistency level the router posts with. WORMHOOK plans to use finalized, which adds about 13 seconds before the VAA exists. The explorer shows this as the "Message / VAA observed" stage.