@overcast-xyz/solana-client
Classes
| Class | Description |
|---|---|
| SolanaChainSigner | Solana 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. |
| SolanaFactory | The 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 | - |
| SolanaOracleLayer | 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. |
| SolanaPhysicalLayer | Solana'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. |
| SolanaReader | Solana 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 = [..]. |
| SolanaUtils | Solana's OvercastUtils: the whole boundary between base58 addresses and the canonical 32-byte slots core works in. |
| SolanaWriter | Solana implementation of OvercastWriter. |
Interfaces
| Interface | Description |
|---|---|
| SolanaConfig | Solana-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. |
| SolanaLayer | The 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>. |
| SolanaSettlementContext | Solana'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 Alias | Description |
|---|---|
| OracleSettlementConfig | Decoded 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. |
| PhysicalSettlementConfig | Decoded SolanaPhysicalLayer config account. Physical settlement is fully described by its exercise mode — everything else about the trade lives on the option itself. |
| SolanaTx | A 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
| Variable | Description |
|---|---|
| DEFAULT_COMMITMENT | Commitment used for the connection and confirmations when unspecified. |
| DEFAULT_PARAMETER | - |
| DEFAULT_RPC_URL | Local validator RPC — the default endpoint when none is supplied. |
| DEFAULT_SANDBOX_ORACLE_IDS | Default 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_CONFIG | The 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_SCHEMA | How 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 | - |
| solanaUtils | Shared, stateless SolanaUtils — address validation needs no config. |
| - |
Functions
| Function | Description |
|---|---|
| loadKeypair | Parse 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. |
| marketOptionInput | Map 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. |
| optionDetailsInput | Map the core OptionDetails onto the IDL's camelCase, pubkey/BN layout — the inverse of toOptionDetails, for passing details back into a program call. |
| solanaConfig | Build 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. |
| toBig | Native-unit u64 amounts decode to BN; the core shapes want exact bigint. |
| toNum | Timestamps are small i64s; the core shapes want plain numbers. |
| toOptionDetails | Map a decoded Anchor OptionDetails onto the core OptionDetails. |
| toProtocolState | Map the decoded Anchor ProtocolState account onto the core ProtocolState. |
| toPubkey | A canonical slot back to the PublicKey the Anchor client wants. |
| toSide | Anchor decodes the OptionSide enum as a single-key object ({ maker: {} } / { taker: {} }); map it onto the core OptionSide. |
| toSlot | A Solana PublicKey as the canonical slot core hashes and stores. |