npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@optionsfi/sdk

v0.2.0

Published

OptionsFi SDK - On-chain options settlement infrastructure for Solana

Downloads

7

Readme

@optionsfi/sdk

TypeScript SDK for OptionsFi, a decentralized options settlement protocol built on Solana. Enables developers to build applications with covered call vaults, RFQ-based options trading, and support for multiple asset types.

Features

  • 🌐 Multi-Asset Support - Trade options on crypto, tokenized stocks, and tokenized treasuries
  • 🔌 RFQ System - Request quotes from multiple market makers with competitive pricing
  • 📊 Options Pricing - Black-Scholes calculations with Greeks and volatility tools
  • 🏦 Vault Operations - Interact with on-chain covered call vaults
  • 🔒 Anonymous RFQs - Privacy-preserving quote requests for large institutional flows
  • Type-Safe - Comprehensive TypeScript types with runtime validation

Installation

npm install @optionsfi/sdk
# or
yarn add @optionsfi/sdk
# or
pnpm add @optionsfi/sdk

Peer Dependencies:

npm install @coral-xyz/anchor @solana/web3.js

These allow you to use your preferred versions of Anchor and Solana web3.js.

Quick Start

Creating an RFQ

import { RFQClient, DEVNET_CONFIG } from '@optionsfi/sdk';

// Initialize client
const client = new RFQClient(DEVNET_CONFIG);
await client.connect();

// Create an RFQ for selling covered calls
const rfqId = await client.createRFQ({
  asset: 'NVDAX',
  side: 'sell',
  optionType: 'call',
  strike: 150, // $150 strike
  expiry: Math.floor(Date.now() / 1000) + 7 * 24 * 60 * 60, // 1 week
  quantity: BigInt(1000 * 1e6), // 1000 tokens
  vaultAddress: 'your-vault-address',
});

// Subscribe to quotes
client.subscribeToQuotes(rfqId, (quote) => {
  console.log(`Quote from ${quote.marketMaker}: ${quote.premium} USDC`);
});

Option Pricing

import { OptionPricing } from '@optionsfi/sdk';

// Calculate Black-Scholes fair value
const prices = OptionPricing.blackScholes({
  spot: 145.50,
  strike: 150,
  timeToExpiry: 7 / 365, // 1 week
  riskFreeRate: 0.05,
  volatility: 0.45,
});

console.log('Call price:', prices.call);
console.log('Put price:', prices.put);
console.log('Call delta:', prices.delta.call);

// Validate a quote against fair value
const validation = OptionPricing.validateQuote(premiumFromQuote, prices.call);
if (!validation.isValid) {
  console.log('Quote rejected:', validation.reason);
}

Working with Vaults

import { VaultInstructions, deriveVaultPda } from '@optionsfi/sdk';
import { Connection } from '@solana/web3.js';

const connection = new Connection('https://api.devnet.solana.com');

// SDK includes bundled vault IDL - no need to provide it
const instructions = new VaultInstructions(connection);
await instructions.initialize();

// Fetch vault data
const vault = await instructions.fetchVault('NVDAX');
console.log('Total assets:', vault.totalAssets);
console.log('Current epoch:', vault.epoch);

// Check remaining capacity
const capacity = VaultInstructions.getRemainingCapacity(vault);
console.log('Remaining capacity:', capacity);

// Build transaction instruction
const [vaultPda] = deriveVaultPda('NVDAX');
const ix = await instructions.recordNotionalExposure({
  vault: vaultPda,
  authority: walletPublicKey,
  notionalTokens: BigInt(1000 * 1e6),
  premium: BigInt(50 * 1e6),
});

API Reference

RFQClient

Main client for interacting with the RFQ infrastructure.

| Method | Description | |--------|-------------| | connect() | Connect to the RFQ router WebSocket | | disconnect() | Disconnect from the router | | createRFQ(params) | Create a new RFQ | | subscribeToQuotes(rfqId, callback) | Subscribe to quotes | | executeOption(rfqId, quoteId, wallet) | Execute an option trade | | cancelRFQ(rfqId) | Cancel an open RFQ | | onEvent(callback) | Subscribe to all events |

OptionPricing

Static utilities for option pricing.

| Method | Description | |--------|-------------| | blackScholes(params) | Calculate option prices | | calculateCoveredCallPremium(params) | Premium for covered calls | | premiumToBps(premium, spot) | Convert premium to bps | | validateQuote(premium, fairValue) | Validate quote against fair | | suggestStrike(spot, deltaBps) | Suggest strike price | | calculateHistoricalVolatility(prices) | Calculate vol from prices | | calculateImpliedVolatility(...) | Derive IV from price |

VaultInstructions

Build transactions for the vault program.

| Method | Description | |--------|-------------| | fetchVault(assetId) | Fetch vault account data | | recordNotionalExposure(params) | Record option exposure | | collectPremium(params) | Collect premium from MM | | paySettlement(params) | Pay ITM settlement | | advanceEpoch(params) | Advance to next epoch |

Utilities

import {
  // Formatting
  formatTokenAmount,
  parseTokenAmount,
  formatUSDC,
  parseUSDC,
  formatTimeToExpiry,
  shortenAddress,
  
  // Validation
  validateRFQParams,
  validateBlackScholesParams,
  
  // Constants
  VAULT_PROGRAM_ID,
  deriveVaultPda,
  PYTH_PRICE_FEEDS,
} from '@optionsfi/sdk';

Configuration

Networks

import { DEVNET_CONFIG, MAINNET_CONFIG } from '@optionsfi/sdk';

// Use devnet for testing
const client = new RFQClient(DEVNET_CONFIG);

// Use mainnet for production
const client = new RFQClient(MAINNET_CONFIG);

// Custom configuration
const client = new RFQClient({
  rpcUrl: 'https://my-rpc.com',
  rfqRouterUrl: 'wss://rfq.optionsfi.xyz',
  programId: 'A4jgqct3bwTwRmHECHdPpbH3a8ksaVb7rny9pMUGFo94',
  network: 'mainnet-beta',
});

Documentation

For comprehensive guides and API documentation, visit docs.optionsfi.xyz.

Support

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting pull requests.

Security

For security concerns, please email [email protected]. Do not open public issues for security vulnerabilities.

License

MIT License - see LICENSE file for details.


Built with ❤️ by the OptionsFi team