Class: SolanaOracleLayer
Defined in: solana-client/src/settlement-layer.ts:275
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
OvercastSettlementLayer<SolanaLayer,OracleSettlementConfig>
Constructors
Constructor
new SolanaOracleLayer(
provider,
programId?,
feedIds?,
oracleKind?): SolanaOracleLayer;
Defined in: solana-client/src/settlement-layer.ts:281
Parameters
| Parameter | Type | Default value |
|---|---|---|
provider | Provider | undefined |
programId | string | SETTLEMENT_ORACLE_PROGRAM_ID |
feedIds | Map<Bytes32, number> | DEFAULT_SANDBOX_ORACLE_IDS |
oracleKind | 0 | ORACLE_KIND.Pyth |
Returns
SolanaOracleLayer
Properties
type
type: SettlementKey<SolanaLayer> = "oracle";
Defined in: solana-client/src/settlement-layer.ts:279
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:334
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
| Parameter | Type |
|---|---|
_option | MarketOption |
Returns
Promise<Metadata>
Implementation of
OvercastSettlementLayer.buildMetadata
configId()
configId(config): Promise<Bytes32>;
Defined in: solana-client/src/settlement-layer.ts:343
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
| Parameter | Type |
|---|---|
config | OracleSettlementConfig |
Returns
Promise<Bytes32>
Implementation of
OvercastSettlementLayer.configId
createConfig()
createConfig(config): Promise<Transaction>;
Defined in: solana-client/src/settlement-layer.ts:312
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.
context.accounts are one existing price account per leg, in
[collateral, settlement] order — for ORACLE_KIND.Pyth, the
PriceUpdateV2 accounts for the two feed ids. The program only reads them
to prove each (kind, feedId) pair resolves to a real feed (a mismatch is
FeedIdMismatch); they aren't stored, and settlement later takes whatever
accounts the exercising caller passes.
Parameters
| Parameter | Type |
|---|---|
config | OracleSettlementConfig |
Returns
Promise<Transaction>
Implementation of
OvercastSettlementLayer.createConfig
defaultConfig()
defaultConfig(details): Promise<OracleSettlementConfig>;
Defined in: solana-client/src/settlement-layer.ts:369
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
| Parameter | Type |
|---|---|
details | Partial<OptionDetails> |
Returns
Promise<OracleSettlementConfig>
Implementation of
OvercastSettlementLayer.defaultConfig
feedIdFor()
feedIdFor(asset, role): number;
Defined in: solana-client/src/settlement-layer.ts:419
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
| Parameter | Type |
|---|---|
asset | Bytes32 |
role | "collateral" | "settlement" |
Returns
number
read()
read(id): Promise<OracleSettlementConfig>;
Defined in: solana-client/src/settlement-layer.ts:394
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
| Parameter | Type |
|---|---|
id | Bytes32 |
Returns
Promise<OracleSettlementConfig>
Implementation of
OvercastSettlementLayer.read