Skip to main content

Class: SolanaOracleLayer

Defined in: solana-client/src/settlement-layer.ts:298

Solana's oracle-gated settlement layer: settlement is priced off an oracle feed per asset, so its config PDA binds the collateral and settlement mints together with each mint's oracle OracleKindByte kind and 32-byte feed id. That full binding is baked into the config address (see getOracleSettlementConfigPda), so the derived pubkey alone identifies exactly which (mints, oracles) the option settles against.

The feedIds map resolves each asset Bytes32 (mint) to its oracle feed id; oracleKind applies to both sides (all mainnet feeds are ORACLE_KIND.Pyth today).

Implements​

Constructors​

Constructor​

new SolanaOracleLayer(
provider,
programId?,
feedIds?,
oracleKind?): SolanaOracleLayer;

Defined in: solana-client/src/settlement-layer.ts:304

Parameters​

ParameterTypeDefault value
providerProviderundefined
programIdstringSETTLEMENT_ORACLE_PROGRAM_ID
feedIdsMap<Bytes32, number>DEFAULT_SANDBOX_ORACLE_IDS
oracleKind0ORACLE_KIND.Pyth

Returns​

SolanaOracleLayer

Properties​

type​

type: SettlementKey<SolanaLayer> = "oracle";

Defined in: solana-client/src/settlement-layer.ts:302

This layer's type key — matches the on-chain discriminator and the registry key.

Implementation of​

OvercastSettlementLayer.type

Methods​

buildMetadata()?​

optional buildMetadata(_option): Promise<Metadata>;

Defined in: solana-client/src/settlement-layer.ts:350

Optional helper producing this layer's conventional exercise/redeem metadata. Purely a convenience: the writer forwards whatever bytes the caller passes verbatim, so a caller with an intent the SDK has no model for can ignore this and supply its own bytes.

Parameters​

ParameterType
_optionMarketOption

Returns​

Promise<Metadata>

Implementation of​

OvercastSettlementLayer.buildMetadata

configId()​

configId(config): Promise<Bytes32>;

Defined in: solana-client/src/settlement-layer.ts:359

The config id createConfig would deploy for config — derived locally, so it can be pinned into an offer's details.settlementLayer before (or without) the account existing.

Parameters​

ParameterType
configOracleSettlementConfig

Returns​

Promise<Bytes32>

Implementation of​

OvercastSettlementLayer.configId

createConfig()​

createConfig(config): Promise<Transaction>;

Defined in: solana-client/src/settlement-layer.ts:328

Deploy the config config describes and return the unsigned transaction. Every field is seed-encoded, so the address this initializes is exactly the one getOracleSettlementConfigPda derives from the same values — a config read off another cluster can be replayed here verbatim, and a config that already exists fails on chain rather than being mutated (all fields are immutable post-init). The cached decimals are optional because initialize_config reads them off the two mint accounts itself.

Parameters​

ParameterType
configOracleSettlementConfig

Returns​

Promise<Transaction>

Implementation of​

OvercastSettlementLayer.createConfig

defaultConfig()​

defaultConfig(details): Promise<OracleSettlementConfig>;

Defined in: solana-client/src/settlement-layer.ts:385

Derive the oracle-gated configuration the option settles under from the pair's collateral and settlement mints and their registered oracle feed ids — configId turns it into the config PDA an offer commits to, and createConfig into the transaction that initializes that PDA.

Both mints must be present and both must have a feed id in feedIds; anything missing is a caller error (the option can't be priced without it).

Parameters​

ParameterType
detailsPartial<OptionDetails>

Returns​

Promise<OracleSettlementConfig>

Implementation of​

OvercastSettlementLayer.defaultConfig

feedIdFor()​

feedIdFor(asset, role): number;

Defined in: solana-client/src/settlement-layer.ts:435

The registered oracle feed id for an asset as hex, or a caller error if none. This is the id Pyth's off-chain services (Hermes) are queried with.

Parameters​

ParameterType
assetBytes32
role"collateral" | "settlement"

Returns​

number


read()​

read(id): Promise<OracleSettlementConfig>;

Defined in: solana-client/src/settlement-layer.ts:410

Read the on-chain config account this layer owns at id and decode it into this layer's typed config C. Because SettlementLayerRegistry.resolve is generic over the layer key, a caller who selects a concrete layer (resolve("oracle")) gets a precisely-typed result here with no casts. Throws if the account doesn't exist or isn't a config this layer owns.

Parameters​

ParameterType
idBytes32

Returns​

Promise<OracleSettlementConfig>

Implementation of​

OvercastSettlementLayer.read