Skip to main content

@overcast-xyz/solana-client

Classes

ClassDescription
SolanaChainSignerSolana implementation of OvercastChainSigner. From a SolanaConfig it resolves the signing keypair and builds the shared connection / provider / Anchor program, then signs and confirms the transactions an SolanaWriter builder produces.
SolanaFactoryThe Solana ProtocolFactory: a single SolanaConfig is all the SDK needs to build every per-layer piece — the SolanaChainSigner, the transaction-building SolanaWriter, the SolanaReader and the SolanaIndexerClient. Hand it to OvercastApp.create and the rest of the SDK stays chain-agnostic. (Protocol-payload signing is chain-agnostic and lives in core — see createProtocolSigner.)
SolanaIndexerClient-
SolanaOracleLayerSolana'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.
SolanaPhysicalLayerSolana's physical settlement layer: settlement happens in the underlying asset, so it carries no metadata and commits to the Full-exercise-mode physical config by default. read() decodes a config account through the physical layer's own SETTLEMENT_PHYSICAL_IDL account coder.
SolanaReaderSolana implementation of OvercastReader: the read-only side of the protocol. It needs only an RPC Connection (no wallet), so it serves read-only clients too. PDAs are derived locally via the get*Pda helpers, mirroring the program's seeds = [..].
SolanaUtilsSolana's OvercastUtils: the whole boundary between base58 addresses and the canonical 32-byte slots core works in.
SolanaWriterSolana implementation of OvercastWriter.

Interfaces

InterfaceDescription
SolanaConfigSolana-specific OvercastConfig. Adds the RPC endpoint (and an optional commitment) the SolanaChainSigner connects with; privateKey (inherited) is the wallet's signing key and is required for a signing wallet.
SolanaLayerThe Solana OvercastLayer: a built Solana transaction (SolanaTx) is submitted to yield a TxInfo receipt, configured by a SolanaConfig. Passed as the single generic argument to the core abstractions instead of spelling out <SolanaTx, TxInfo, SolanaConfig>.
SolanaSettlementContextSolana's OvercastLayer.settlementContext: the extra accounts a settlement layer reads to resolve a call. They become the instruction's remaining_accounts, which the core program forwards verbatim to the layer's can_exercise / can_redeem CPI.

Type Aliases

Type AliasDescription
OracleSettlementConfigDecoded SolanaOracleLayer config account. Mirrors the on-chain OracleSettlementConfig struct: the two mints, each mint's oracle binding (kind + 32-byte feed id), and the settlement policy. Every field is baked into the config PDA's seeds, so the address alone fully identifies it.
PhysicalSettlementConfigDecoded SolanaPhysicalLayer config account. Physical settlement is fully described by its exercise mode — everything else about the trade lives on the option itself.
SolanaTxA built-but-unsigned Solana transaction. Methods on SolanaWriter return one of these so the caller owns signing / sending (and can attach a recent blockhash, fee payer, additional signers, etc.).

Variables

VariableDescription
DEFAULT_COMMITMENTCommitment used for the connection and confirmations when unspecified.
DEFAULT_PARAMETER-
DEFAULT_RPC_URLLocal validator RPC — the default endpoint when none is supplied.
DEFAULT_SANDBOX_ORACLE_IDSDefault sandbox oracle feed ids, keyed by asset (mint) Bytes32. Each value is the oracle feed id as a number the on-chain config binds that mint to (for the default ORACLE_KIND.Pyth kind, a Pyth price-feed id). Callers settling a pair whose mints aren't listed here pass their own map to SolanaOracleLayer.
DEFAULT_SOLANA_CONFIGThe defaults a SolanaConfig falls back to. privateKey is omitted on purpose: a signing wallet must supply its own key — there is no safe default.
SOLANA_CONFIG_SCHEMAHow a Solana deployment is configured from strings. See EVM_CONFIG_SCHEMA for the shape and the reasoning; this is the same contract for the svm layer.
solanaSandbox-
solanaUtilsShared, stateless SolanaUtils — address validation needs no config.
toId-

Functions

FunctionDescription
loadKeypairParse a Solana keypair from inlined key material (no filesystem access, so the package stays browser-bundlable). Accepts a raw secret-key byte array, the contents of a Solana CLI id.json (a JSON byte-array string), or a base58-encoded secret key. Resolving a file path is the caller's job.
marketOptionInputMap the core MarketOption onto the IDL's camelCase, pubkey/BN layout, for passing a whole option back into a program call (the fee hook's on_create_option quote). The Anchor coder encodes u64/i64 fields through BN, so the core shape's Id strings and bigints have to be converted first — handing it the raw domain object fails with src.toTwos is not a function.
optionDetailsInputMap the core OptionDetails onto the IDL's camelCase, pubkey/BN layout — the inverse of toOptionDetails, for passing details back into a program call.
solanaConfigBuild a complete SolanaConfig from a partial one, filling unset fields from DEFAULT_SOLANA_CONFIG — including the core / layer / hook program ids, which default to the canonical deployment when a caller targeting it omits them. The deployment's domain is read from chain (see getDomain), not configured.
toBigNative-unit u64 amounts decode to BN; the core shapes want exact bigint.
toNumTimestamps are small i64s; the core shapes want plain numbers.
toOptionDetailsMap a decoded Anchor OptionDetails onto the core OptionDetails.
toProtocolStateMap the decoded Anchor ProtocolState account onto the core ProtocolState.
toPubkeyA canonical slot back to the PublicKey the Anchor client wants.
toSideAnchor decodes the OptionSide enum as a single-key object ({ maker: {} } / { taker: {} }); map it onto the core OptionSide.
toSlotA Solana PublicKey as the canonical slot core hashes and stores.