Abstraction around the Switchboard-On-Demand Queue account

This account is used to store the queue data for a given feed.

Constructors

Properties

program: Program

The Anchor program instance.

pubkey: PublicKey

The public key of the queue account.

Methods

  • Adds a new MR enclave to the queue. This will allow the queue to accept signatures from the given MR enclave.

    Parameters

    • params: { mrEnclave: Uint8Array }

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

    if the request fails.

    if the MR enclave is already added.

    if the MR enclave is invalid.

    if the MR enclave is not a valid length.

  • Fetches most recently added and verified Oracle Key.

    Returns Promise<PublicKey>

    A promise that resolves to an oracle public key.

    if the request fails.

  • Fetches a gateway interface for interacting with oracle nodes.

    Parameters

    • OptionalgatewayUrl: string

      Optional URL of a specific gateway to use. If not provided, a random gateway will be selected from the queue's available gateways.

    Returns Promise<Gateway>

    Gateway - A Gateway instance for making oracle requests

    If no gateways are available on the queue when selecting randomly

  • Loads the queue data from on chain and returns the listed oracle keys.

    Returns Promise<PublicKey[]>

    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

    Parameters

    • params: {
          gateway?: string;
          jobs: IOracleJob[];
          maxVariance?: number;
          minResponses?: number;
          numSignatures?: number;
          recentHash?: string;
          useTimestamp?: boolean;
      }

    Returns Promise<{ failures: string[]; responses: FeedEvalResponse[] }>

    A promise that resolves to the feed evaluation responses.

    if the request fails.

  • Add an Oracle to a queue and set permissions

    Parameters

    • params: {
          maxQuoteVerificationAge: number;
          mrEnclave: Buffer;
          oracle: PublicKey;
          secp256k1Signer: Buffer;
          slot: number;
      }

    Returns Promise<TransactionInstruction>

  • Removes all MR enclaves from the queue.

    Returns Promise<TransactionInstruction[]>

    A promise that resolves to an array of transaction instructions.

    if the request fails.

  • Removes an MR enclave from the queue. This will prevent the queue from accepting signatures from the given MR enclave.

    Parameters

    • params: { mrEnclave: Uint8Array }

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

    if the request fails.

    if the MR enclave is not present.

  • Sets the queue configurations.

    Parameters

    • params: { authority?: PublicKey; nodeTimeout?: number; reward?: number }
      • Optionalauthority?: PublicKey

        The new authority for the queue.

      • OptionalnodeTimeout?: number

        The new node timeout for the queue.

      • Optionalreward?: number

        The new reward for the queue.

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

  • Sets the oracle permission on the queue.

    Parameters

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction

  • Parameters

    • params: { enable: boolean; vault: PublicKey }

    Returns Promise<TransactionInstruction>

  • Parameters

    • program: Program
    • params: {
          allowAuthorityOverrideAfter?: number;
          lutSlot?: number;
          maxQuoteVerificationAge?: number;
          nodeTimeout?: number;
          requireAuthorityHeartbeatPermission?: boolean;
          requireUsagePermission?: boolean;
          reward?: number;
      }

    Returns Promise<[Queue, Keypair, TransactionInstruction]>

  • Creates a new instance of the Queue account with a PDA for SVM (non-solana) chains.

    Parameters

    • program: Program

      The anchor program instance.

    • params: {
          allowAuthorityOverrideAfter?: number;
          lutSlot?: number;
          maxQuoteVerificationAge?: number;
          nodeTimeout?: number;
          requireAuthorityHeartbeatPermission?: boolean;
          requireUsagePermission?: boolean;
          reward?: number;
          sourceQueueKey: PublicKey;
      }

      The initialization parameters for the queue.

    Returns Promise<[Queue, TransactionInstruction]>

  • Parameters

    • program: Program
    • params: {
          gateway?: string;
          jobs: IOracleJob[];
          maxVariance?: number;
          minResponses?: number;
          numSignatures?: number;
          queue: PublicKey;
          recentHash?: string;
      }

    Returns Promise<Buffer<ArrayBufferLike>>

    Deprecated. Use @switchboard-xyz/common#FeedHash.compute instead.

  • Fetches signatures from a random gateway on the queue.

    REST API endpoint: /api/v1/fetch_signatures

    Parameters

    • program: Program
    • params: {
          gateway?: string;
          jobs: IOracleJob[];
          maxVariance?: number;
          minResponses?: number;
          numSignatures?: number;
          queue: PublicKey;
          recentHash?: string;
      }

    Returns Promise<{ failures: string[]; responses: FeedEvalResponse[] }>

    A promise that resolves to the feed evaluation responses.

    if the request fails.

  • Parameters

    • program: Program
    • params: {
          feedConfigs: FeedRequest[];
          gateway?: string;
          numSignatures?: number;
          queue: PublicKey;
          recentHash?: string;
          useTimestamp?: boolean;
      }

    Returns Promise<FetchSignaturesConsensusResponse>

  • Get the PDA for the queue (SVM chains that are not solana)

    Parameters

    • program: Program

      Anchor program

    • pubkey: PublicKey

      Queue pubkey

    Returns PublicKey

    Queue PDA Pubkey