Options
All
  • Public
  • Public/Protected
  • All
Menu

Account type representing an aggregator (data feed).

Hierarchy

  • AggregatorAccount

Index

Constructors

Properties

keypair?: Keypair
program: Program<Idl>
publicKey?: PublicKey

Methods

  • addJob(job: JobAccount, authority?: Keypair, weight?: number): Promise<string>
  • RPC to add a new job to an aggregtor to be performed on feed updates.

    Parameters

    • job: JobAccount

      JobAccount specifying another job for this aggregator to fulfill on update

    • Optional authority: Keypair
    • weight: number = 1

    Returns Promise<string>

    TransactionSignature

  • getConfirmedRoundResults(aggregator?: any): Promise<{ oracleAccount: OracleAccount; value: Big }[]>
  • Get the individual oracle results of the latest confirmed round.

    Parameters

    • Optional aggregator: any

      Optional parameter representing the already loaded aggregator info.

    Returns Promise<{ oracleAccount: OracleAccount; value: Big }[]>

    latest results by oracle pubkey

  • getLatestFeedTimestamp(aggregator?: any): Promise<BN>
  • Get the timestamp latest confirmed round stored in the aggregator account.

    Parameters

    • Optional aggregator: any

      Optional parameter representing the already loaded aggregator info.

    Returns Promise<BN>

    latest feed timestamp

  • getLatestValue(aggregator?: any, decimals?: number): Promise<Big>
  • Get the latest confirmed value stored in the aggregator account.

    Parameters

    • Optional aggregator: any

      Optional parameter representing the already loaded aggregator info.

    • decimals: number = 20

    Returns Promise<Big>

    latest feed value

  • getOracleIndex(oraclePubkey: PublicKey): Promise<number>
  • Parameters

    • oraclePubkey: PublicKey

    Returns Promise<number>

  • loadCurrentRoundOracles(aggregator?: any): Promise<any[]>
  • Parameters

    • Optional aggregator: any

    Returns Promise<any[]>

  • loadData(): Promise<any>
  • Load and parse AggregatorAccount state based on the program IDL.

    Returns Promise<any>

    AggregatorAccount data parsed in accordance with the Switchboard IDL.

  • loadHashes(aggregator?: any): Promise<Buffer[]>
  • Parameters

    • Optional aggregator: any

    Returns Promise<Buffer[]>

  • loadJobAccounts(aggregator?: any): Promise<any[]>
  • Parameters

    • Optional aggregator: any

    Returns Promise<any[]>

  • loadJobs(aggregator?: any): Promise<OracleJob[]>
  • Load and deserialize all jobs stored in this aggregator

    Parameters

    • Optional aggregator: any

    Returns Promise<OracleJob[]>

    Array

  • lock(authority?: Keypair): Promise<string>
  • Prevent new jobs from being added to the feed.

    Parameters

    • Optional authority: Keypair

      The current authroity keypair

    Returns Promise<string>

    TransactionSignature

  • Opens a new round for the aggregator and will provide an incentivize reward to the caller

    Parameters

    Returns Promise<string>

    TransactionSignature

  • Produces a hash of all the jobs currently in the aggregator

    Parameters

    Returns Hash

    hash of all the feed jobs.

  • removeJob(job: JobAccount, authority?: Keypair): Promise<string>
  • RPC to remove a job from an aggregtor.

    Parameters

    • job: JobAccount

      JobAccount to be removed from the aggregator

    • Optional authority: Keypair

    Returns Promise<string>

    TransactionSignature

  • setAuthority(newAuthority: PublicKey, currentAuthority?: Keypair): Promise<string>
  • Change the aggregator authority.

    Parameters

    • newAuthority: PublicKey

      The new authority to set.

    • Optional currentAuthority: Keypair

      The current authroity keypair

    Returns Promise<string>

    TransactionSignature

  • setVarianceThreshold(params: { authority: Keypair; threshold: Big }): Promise<string>
  • Parameters

    • params: { authority: Keypair; threshold: Big }
      • authority: Keypair
      • threshold: Big

    Returns Promise<string>

  • size(): number
  • Get the size of an AggregatorAccount on chain.

    Returns number

    size.

  • Create and initialize the AggregatorAccount.

    Parameters

    • program: Program<Idl>

      Switchboard program representation holding connection and IDL.

    • params: AggregatorInitParams

    Returns Promise<AggregatorAccount>

    newly generated AggregatorAccount.

  • decode(program: Program<Idl>, accountInfo: AccountInfo<Buffer>): any
  • Parameters

    • program: Program<Idl>
    • accountInfo: AccountInfo<Buffer>

    Returns any

  • getName(aggregator: any): string
  • Returns the aggregator's ID buffer in a stringified format.

    Parameters

    • aggregator: any

      A preloaded aggregator object.

    Returns string

    The name of the aggregator.

  • shouldReportValue(value: Big, aggregator: any): Promise<boolean>
  • Speciifies if the aggregator settings recommend reporting a new value

    Parameters

    • value: Big

      The value which we are evaluating

    • aggregator: any

      The loaded aggegator schema

    Returns Promise<boolean>

    boolean

Generated using TypeDoc