Abstraction around the Switchboard-On-Demand State account

This account is used to store the state data for a given program.

Constructors

Properties

program: Program

The Anchor program instance.

pubkey: PublicKey

Methods

  • Register a guardian with the global guardian queue.

    Parameters

    • params: { guardian: PublicKey }

      The parameters object.

      • guardian: PublicKey

        The guardian account.

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

  • Set program-wide configurations.

    Parameters

    • params: {
          addCostWl?: PublicKey;
          denyAdvisory?: number;
          guardianQueue?: PublicKey;
          minQuoteVerifyVotes?: BN;
          newAuthority?: PublicKey;
          permitAdvisory?: number;
          rmCostWl?: PublicKey;
          subsidyAmount?: BN;
          switchMint?: PublicKey;
          testOnlyDisableMrEnclaveCheck?: boolean;
      }

      The configuration parameters.

      • OptionaladdCostWl?: PublicKey
      • OptionaldenyAdvisory?: number

        The deny advisory value.

      • OptionalguardianQueue?: PublicKey

        The guardian queue account.

      • OptionalminQuoteVerifyVotes?: BN

        The minimum number of votes required to verify a quote.

      • OptionalnewAuthority?: PublicKey

        The new authority account.

      • OptionalpermitAdvisory?: number

        The permit advisory value.

      • OptionalrmCostWl?: PublicKey
      • OptionalsubsidyAmount?: BN
      • OptionalswitchMint?: PublicKey

        The switch mint account.

      • OptionaltestOnlyDisableMrEnclaveCheck?: boolean

        A flag to disable MrEnclave check for testing purposes.

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

  • Unregister a guardian from the global guardian queue.

    Parameters

    • params: { guardian: PublicKey }

      The parameters object.

      • guardian: PublicKey

        The guardian account.

    Returns Promise<TransactionInstruction>

    A promise that resolves to the transaction instruction.

  • Initializes the state account.

    Parameters

    • program: Program

      The Anchor program instance.

    Returns Promise<[State, string]>

    A promise that resolves to the state account and the transaction signature.

  • Derives a state PDA (Program Derived Address) from the program.

    Parameters

    • program: Program

      The Anchor program instance.

    Returns PublicKey

    The derived state account's public key.