Switchboard Sui Feeds Skill
Purpose
Integrate Switchboard on-demand feeds into Sui Move contracts using the Quote Verifier pattern:
Fetch oracle quotes off-chain and attach to a Sui transaction
Verify quotes on-chain against the correct oracle queue
Enforce freshness/deviation constraints in Move
Support “cranking” patterns to keep on-chain consumer state warm (push-like behavior)
Dependencies
Use exact pins from the SDK Version Matrix.
@switchboard-xyz/sui-sdk@0.1.16@switchboard-xyz/on-demand@3.10.6@mysten/sui@1.38.0
Preconditions
OperatorPolicyexists (Sui network, RPC allowlist, signer custody).
Inputs to Collect
Always collect:
network: mainnet / testnetrpcUrlcrossbarUrl(default:https://crossbar.switchboard.xyz)Switchboard deployment package ID (resolve from official docs)
consumer package ID + consumer object ID
feedIdlist (32-byte hex)numOracles
Collect safety policy only if relevant (risk-sensitive logic) or requested:
maxAgeMsmaxDeviationBps
Sui Integration Invariants
Verify quotes against the queue from
SwitchboardClient.fetchState().Verify before use; apply explicit staleness/deviation checks.
Minimal Example
Playbook
1) Resolve queue and feeds
Fetch Switchboard state to identify
oracleQueueId.Confirm feed IDs exist for the chosen network.
2) Transaction flow (TypeScript skeleton)
3) Cranking pattern (push-like / heartbeat imitation)
Use this when you want the consumer object to hold a “recently verified” value so other txs can read it cheaply without attaching quotes every time.
Tradeoffs:
Pros: cheaper reads for many consumers; simpler UI.
Cons: consumer must enforce staleness; values can go stale between cranks.
Crank loop concept:
Periodically execute the
update_price(or your equivalent) Move entry function with fresh quotes.
Outputs
Produce a SuiFeedIntegrationPlan including:
network/RPC/Crossbar URL
Switchboard package resolution method + queue ID resolution
consumer object update/read strategy:
atomic quote+use, or
cranked storage + staleness checks
optional safety policy if requested
Troubleshooting Checklist
feed not found in quotes → ensure requested feedId included in
fetchUpdateQuotequote expired → fetch again; adjust max age only for non-critical flows
wrong queue/network → verify package IDs and network match
References
https://docs.switchboard.xyz/docs-by-chain/sui
https://docs.switchboard.xyz/docs-by-chain/sui/price-feeds
https://docs.switchboard.xyz/tooling/crossbar
Last updated