Abstraction around the Switchboard-On-Demand Queue account

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

Constructors

  • Constructs a OnDemandQueue instance.

    Parameters

    • program: Program<Idl>

      The Anchor program instance.

    • pubkey: PublicKey

      The public key of the queue account.

    Returns Queue

Properties

program: Program<Idl>

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;
      }
      • mrEnclave: Uint8Array

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

    Throws

    if the request fails.

    Throws

    if the MR enclave is already added.

    Throws

    if the MR enclave is invalid.

    Throws

    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.

    Throws

    if the request fails.

  • 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: OracleJob[];
          maxVariance?: bigint;
          minResponses?: number;
          numSignatures?: number;
          recentHash?: string;
      }
      • Optional gateway?: string
      • jobs: OracleJob[]
      • Optional maxVariance?: bigint
      • Optional minResponses?: number
      • Optional numSignatures?: number
      • Optional recentHash?: string

    Returns Promise<FeedEvalResponse[]>

    A promise that resolves to the feed evaluation responses.

    Throws

    if the request fails.

  • Parameters

    • params: {
          lutSlot?: number;
          overrideStakePool?: PublicKey;
      }
      • Optional lutSlot?: number
      • Optional overrideStakePool?: PublicKey

    Returns Promise<TransactionInstruction>

  • Loads the queue data for this Queue account from on chain.

    Returns Promise<any>

    A promise that resolves to the queue data.

    Throws

    if the queue account does not exist.

  • Removes all MR enclaves from the queue.

    Returns Promise<TransactionInstruction[]>

    A promise that resolves to an array of transaction instructions.

    Throws

    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;
      }
      • mrEnclave: Uint8Array

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

    Throws

    if the request fails.

    Throws

    if the MR enclave is not present.

  • Sets the queue configurations.

    Parameters

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

        The new authority for the queue.

      • Optional nodeTimeout?: number

        The new node timeout for the queue.

      • Optional reward?: 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

    • params: {
          enable: boolean;
          oracle: PublicKey;
          permission: SwitchboardPermission;
      }
      • enable: boolean
      • oracle: PublicKey

        The oracle to set the permission for.

      • permission: SwitchboardPermission

        The permission to set.

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction

  • Parameters

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

    Returns Promise<[Queue, Keypair, TransactionInstruction]>

  • Parameters

    • program: Program<Idl>
    • params: {
          gateway?: string;
          jobs: OracleJob[];
          maxVariance?: bigint;
          minResponses?: number;
          numSignatures?: number;
          queue: PublicKey;
          recentHash?: string;
      }
      • Optional gateway?: string
      • jobs: OracleJob[]
      • Optional maxVariance?: bigint
      • Optional minResponses?: number
      • Optional numSignatures?: number
      • queue: PublicKey
      • Optional recentHash?: string

    Returns Promise<Buffer>

    Deprecated

    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<Idl>
    • params: {
          gateway?: string;
          jobs: OracleJob[];
          maxVariance?: bigint;
          minResponses?: number;
          numSignatures?: number;
          queue: PublicKey;
          recentHash?: string;
      }
      • Optional gateway?: string
      • jobs: OracleJob[]
      • Optional maxVariance?: bigint
      • Optional minResponses?: number
      • Optional numSignatures?: number
      • queue: PublicKey
      • Optional recentHash?: string

    Returns Promise<FeedEvalResponse[]>

    A promise that resolves to the feed evaluation responses.

    Throws

    if the request fails.

Generated using TypeDoc