Fetch the current price of a Solana oracle protocol.

Input: None

Returns: The current price of an on-chain oracle.

Example: The Switchboard SOL/USD oracle price.

{ "oracleTask": { "switchboardAddress": "GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR" } }

Example: The Pyth SOL/USD oracle price.

{ "oracleTask": { "pythAddress": "H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG" } }

Example: The Chainlink SOL/USD oracle price.

{ "oracleTask": { "chainlinkAddress": "CcPVS9bqyXbD9cLnTbhhHazLsrua8QMFUHTutPtjyDzq" } }

Implements

Constructors

  • Constructs a new OracleTask.

    Parameters

    Returns OracleTask

Properties

AggregatorAddress?: "switchboardAddress" | "pythAddress" | "chainlinkAddress" | "edgeId" | "redstoneId"

OracleTask AggregatorAddress.

chainlinkAddress?: string

Mainnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana

chainlinkConfigs?: IChainlinkConfigs

OracleTask chainlinkConfigs.

edgeConfigs?: IEdgeConfigs

OracleTask edgeConfigs.

edgeId?: string

OracleTask edgeId.

pythAddress?: string

Mainnet address for a Pyth feed. A full list can be found here: https://pyth.network/price-feeds/

pythAllowedConfidenceInterval: number

Value (as a percentage) that the lower bound confidence interval is of the actual value. Confidence intervals that are larger that this treshold are rejected.

The confidence interval should be provided as a raw percentage value. For example, to represent 10%, enter the value as 10, not 0.1.

pythConfigs?: IPythConfigs

OracleTask pythConfigs.

redstoneConfigs?: IRedstoneConfigs

OracleTask redstoneConfigs.

redstoneId?: string

OracleTask redstoneId.

switchboardAddress?: string

Mainnet address of a Switchboard feed. Switchboard is decentralized and allows anyone to build their own feed.

switchboardConfigs?: ISwitchboardConfigs

OracleTask switchboardConfigs.

Methods

  • Converts this OracleTask to JSON.

    Returns {
        [k: string]: any;
    }

    JSON object

    • [k: string]: any
  • Creates a new OracleTask instance using the specified properties.

    Parameters

    Returns OracleTask

    OracleTask instance

  • Decodes an OracleTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    • Optional length: number

      Message length if known beforehand

    Returns OracleTask

    OracleTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Decodes an OracleTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    Returns OracleTask

    OracleTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Encodes the specified OracleTask message. Does not implicitly verify messages.

    Parameters

    • message: IOracleTask

      OracleTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified OracleTask message, length delimited. Does not implicitly verify messages.

    Parameters

    • message: IOracleTask

      OracleTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates an OracleTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: {
          [k: string]: any;
      }

      Plain object

      • [k: string]: any

    Returns OracleTask

    OracleTask

  • Gets the default type url for OracleTask

    Parameters

    • Optional typeUrlPrefix: string

      your custom typeUrlPrefix(default "type.googleapis.com")

    Returns string

    The default type url

  • Creates a plain object from an OracleTask message. Also converts values to other types if specified.

    Parameters

    • message: OracleTask

      OracleTask

    • Optional options: IConversionOptions

      Conversion options

    Returns {
        [k: string]: any;
    }

    Plain object

    • [k: string]: any
  • Verifies an OracleTask message.

    Parameters

    • message: {
          [k: string]: any;
      }

      Plain object to verify

      • [k: string]: any

    Returns string

    null if valid, otherwise the reason why it is not