Program Security and Margin Sync
Syncs the generated client, account layouts, error table, opening margin math, and OMLP withdrawal planning with the latest option program security updates.Breaking
PoolLoanlayout grew from 213 to 229 bytes (version = 3), appendingescrowedPrincipalandescrowedCollateral. Account fetchers (fetchPoolLoan,fetchPoolLoansByMaker,fetchAllActivePoolLoans) decode the 229-byte layout. Resize live onchainPoolLoanaccounts before reopening trading.- Removed the legacy Switchboard volatility quote helpers (
deriveVolatilityQuoteAddress,deriveVolatilityQuoteAddressFromMarketData,isVolOracleEnabled) and removedvolatilityQuoteAccountfrom all SDK builders (buildInitOptionSeriesInstruction,buildBuyFromPool*,buildCloseLongToPool*,buildStopOutWriterInstruction). Pricing reads Historical Volatility directly fromMarketDataAccount.historicalVolatilityPpm, and builders fill the unused legacyvolatility_quote_accountABI slot internally.
Added
computeMinimumOpeningOwnCollateralBaseUnitspluscalculateKinkImpliedVolatilityPpm,fairValuePerContractMicroUsd,contractsValueBaseUnits,stopOutFeeBaseUnits,requiredCashCollateralBaseUnits, andpoolUtilizationBpsto mirror the onchain conservative opening margin check enforced at mint.- Program error code
6171(OpeningMarginNotMet) in generated error constants andOPTION_PROGRAM_ERROR_INFOS.
Changed
withdrawAllFromPositionremoves the retiredinsuranceOwedshortfall withdrawal cap. Uncovered shortfalls beyond the Insurance Fund now socialize directly across vault shares.- Approved cash Collateral Mints are capped at 9 decimals onchain (
InvalidMintabove 9), and oversized premium base-unit conversions fail closed withArithmeticOverflow.
README Corrections
The README was corrected. The package API is unchanged.- Quantities use
QUANTITY_UNITS_PER_CONTRACT(1_000_000n). - A full long close returns the LONG token account rent. Pass
closeLongTokenAccount: falseon a partial close. - On version 1,
sendBuiltTransactionalways writes both resource limits. Compute defaults to 1,400,000. Loaded accounts default to 8 MiB. - On version 0, the send fails when the lookup table does not contain this program.
priceOptionprices one unit of the underlying. One listed contract coversUNDERLYING_UNITS_PER_CONTRACT(100) of those units.calculateRequiredCollateraldefaults to physical settlement. Pass"cash"and the collateral mint decimals for cash-settled series.- Pass
maxAgeSecondsbelow 20 toevaluatePythPriceUpdateso the Pyth price is still fresh when the transaction lands.
First Public Release
TypeScript client for the Solana Option Standard program. Import from the package root. Peer dependency is@solana/kit ^8.3.0.Added
- Account readers and PDAs for option pools, positions, vaults, and pool loans.
- Long flows: market buy, single and multi close, and preflight checks.
- Short flows: series init, mint, leveraged mint, borrow, repay, and unwind of unsold size with loan repayment.
- OMLP deposit and withdraw.
sendBuiltTransactionfor version 1 (4096-byte envelope, no lookup table) and version 0 (lookup table that contains this program).priceOption,calculateRequiredCollateral, and Pyth spot helpers. Trading spot ispythPriceFeedAddressfor the market feed.decodeSdkErrorplus the program error codes.requestTestUsdcandbuildTestUsdcFaucetMessage: sign a short message and ask a deployment faucet (/api/sdk/test-funds) to mint a fixed paper USDC balance. The mint authority stays on the server. Seeexamples/06-test-funds.ts.- Runnable sketches in
examples/.
Notes
- One contract is
1_000_000base units. Settlement is cash. init_strategy_marginis refused on the current program (StrategyMarginDisabled, 6168). Post collateral per leg.- Expired positions are settled on-chain into the user’s token account. A trading client reads the result.
