Options
All
  • Public
  • Public/Protected
  • All
Menu

The Cache account stores and tracks oracle prices, mark prices, funding and borrow lending multipliers.

Hierarchy

  • default<Schema>
    • Cache

Index

Constructors

  • new Cache(program: Program<Zo>, k: PublicKey, data: Schema, _st: Schema, commitment?: Commitment): Cache
  • Parameters

    • program: Program<Zo>
    • k: PublicKey
    • data: Schema
    • _st: Schema
    • Optional commitment: Commitment

    Returns Cache

Properties

backupSubscriberChannel: undefined | number
commitment: Commitment = "processed"
data: Readonly<Schema>
eventEmitter: null | EventEmitter<UpdateEvents, ChangeEvent<any>> = null
lastAccountSnapshotTime: number = ...
mainSubscriberChannel: undefined | number
pubkey: PublicKey
slot: number = -1
subLock: AsyncLock = ...
subscribeLastUpdate: number = ...
subscribeTimeLimit: number = 0

Accessors

  • get connection(): Connection
  • get program(): Program<Zo>
  • get provider(): default
  • get publicKey(): PublicKey

Methods

  • _subscribe(accountName: string, withBackup?: boolean, programPassed?: Program<any>): Promise<EventEmitter<string | symbol, any>>
  • Parameters

    • accountName: string
    • withBackup: boolean = false
    • Optional programPassed: Program<any>

    Returns Promise<EventEmitter<string | symbol, any>>

  • _unsubscribe(): Promise<void>
  • getDexProgram(): PublicKey
  • getOracleBySymbol(sym: string): OracleCache
  • Parameters

    • sym: string

      The collateral symbol. Ex: ("BTC")

    Returns OracleCache

    The oracle cache for the given collateral.

  • refresh(): Promise<void>
  • subscribe(withBackup?: boolean, subscribeLimit?: number): Promise<void>
  • Parameters

    • withBackup: boolean = false

      use a backup confirmed listener

    • subscribeLimit: number = 5000

      minimum time difference between cache updates, to prevent constant reloads

    Returns Promise<void>

  • unsubscribe(): Promise<void>
  • updateAccountOnChange(processUpdate: any, that: default<T>): (account: any, snapshotTime?: any) => void
  • Parameters

    • processUpdate: any
    • that: default<T>

    Returns (account: any, snapshotTime?: any) => void

      • (account: any, snapshotTime?: any): void
      • Parameters

        • account: any
        • Optional snapshotTime: any

        Returns void

  • updateState(st: Schema): Promise<void>
  • fetch(program: Program<Zo>, k: PublicKey, st: Schema, commitment: Commitment): Promise<Schema>
  • Parameters

    • program: Program<Zo>
    • k: PublicKey
    • st: Schema
    • commitment: Commitment

    Returns Promise<Schema>

  • load(program: Program<Zo>, k: PublicKey, st: Schema, commitment?: Commitment): Promise<Cache>
  • Loads a new Cache object from its public key.

    Parameters

    • program: Program<Zo>
    • k: PublicKey

      The cache account's public key.

    • st: Schema
    • commitment: Commitment = ...

    Returns Promise<Cache>

  • processRawCacheData(data: CacheSchema, st: Schema): Schema

Generated using TypeDoc