Constructs a OnDemandQueue
instance.
The Anchor program instance.
The public key of the queue account.
Readonly
programThe Anchor program instance.
Readonly
pubkeyThe public key of the queue account.
Static
Readonly
DEFAULT_Static
Readonly
DEFAULT_Adds a new MR enclave to the queue. This will allow the queue to accept signatures from the given MR enclave.
A promise that resolves to the transaction instruction.
Loads the queue data from on chain and returns the listed gateways.
A promise that resolves to an array of gateway URIs.
Fetches a gateway interface for interacting with oracle nodes.
Optional
gatewayUrl: stringOptional URL of a specific gateway to use. If not provided, a random gateway will be selected from the queue's available gateways.
Gateway - A Gateway instance for making oracle requests
Fetches a gateway URL from the Crossbar network
The gateway is the interface to oracle operators. This method automatically detects your network and returns an appropriate gateway for fetching oracle data.
Crossbar client instance
Gateway instance for oracle communication
Loads the queue data from on chain and returns the listed oracle keys.
A promise that resolves to an array of oracle public keys.
Fetches signatures from a random gateway on the queue.
REST API endpoint: /api/v1/fetch_signatures
A promise that resolves to the feed evaluation responses.
Fetches oracle bundle and creates verification instruction
This is the primary method for fetching oracle data in the bundle approach. It retrieves signed price data from oracle operators and creates the instruction to verify signatures on-chain.
Gateway instance for oracle communication
Crossbar client for data routing
Array of feed hashes to fetch (hex strings)
Number of oracle signatures required (default: 1)
Tuple of [signature verification instruction, bundle data]
// Fetch prices for BTC and ETH
const [sigVerifyIx, bundle] = await queue.fetchUpdateBundleIx(
gateway,
crossbar,
['0x1234...', '0x5678...'], // Feed hashes
3 // Require 3 oracle signatures
);
// Use in your transaction
const tx = await asV0Tx({
connection,
ixs: [sigVerifyIx, yourProgramIx],
signers: [payer],
});
Loads the queue data for this Queue
account from on chain.
A promise that resolves to the queue data.
Add an Oracle to a queue and set permissions
Get the PDA for the queue (SVM chains that are not solana)
Queue PDA Pubkey
Removes an MR enclave from the queue. This will prevent the queue from accepting signatures from the given MR enclave.
A promise that resolves to the transaction instruction.
Sets the queue configurations.
Optional
authority?: PublicKeyThe new authority for the queue.
Optional
nodeTimeout?: numberThe new node timeout for the queue.
Optional
reward?: numberThe new reward for the queue.
A promise that resolves to the transaction instruction.
Sets the oracle permission on the queue.
The oracle to set the permission for.
The permission to set.
A promise that resolves to the transaction instruction
Static
createCreates a new queue account
Anchor program instance
Queue configuration parameters
Tuple of [Queue instance, keypair, creation instruction]
Static
createCreates a new instance of the Queue
account with a PDA for SVM (non-solana) chains.
The anchor program instance.
The initialization parameters for the queue.
Static
fetchStatic
fetchFetches signatures from a random gateway on the queue.
REST API endpoint: /api/v1/fetch_signatures
A promise that resolves to the feed evaluation responses.
Static
fetchStatic
fetchStatic
fetchStatic
loadLoads the queue data for this Queue
account from on chain.
A promise that resolves to the queue data.
Static
loadLoads the default queue for the current network
Automatically detects whether you're on mainnet or devnet and loads the appropriate default queue. This is the recommended way to get started with Switchboard On-Demand.
Anchor program instance
The default queue for your network
Static
queuePDAGet the PDA for the queue (SVM chains that are not solana)
Anchor program
Queue pubkey
Queue PDA Pubkey
Queue account management for Switchboard On-Demand
The Queue class is the primary interface for interacting with oracle operators in the Switchboard network. It manages:
Key Features
Example
Queue