Modules Overview
All 14 SDK modules are accessed as properties on the ThetanutsClient instance — no separate instantiation needed.
Module Table
ERC20
client.erc20
Token approvals, balances, transfers
Write ops only
OptionBook
client.optionBook
Fill/cancel orders, fee claiming
Write ops only
API
client.api
Fetch orders, positions, stats
No
OptionFactory
client.optionFactory
RFQ lifecycle management
Write ops only
Option
client.option
Position management and payouts
Write ops only
Ranger
client.ranger
RangerOption (zone-bound, 4-strike) position management
Write ops only
Events
client.events
Query blockchain events
No
WebSocket
client.ws
Real-time subscriptions
No
MM Pricing
client.mmPricing
Market maker pricing and Greeks
No
RFQ Keys
client.rfqKeys
ECDH key management and offer encryption
No
Utils
client.utils
Decimal conversions, payoff calculations
No
Loan
client.loan
Non-liquidatable lending
Write ops only
WheelVault
client.wheelVault
WheelVault (Ethereum mainnet) interactions
Write ops only
StrategyVault
client.strategyVault
StrategyVault (Base) interactions
Write ops only
Module Descriptions
client.erc20 — ERC20Module
client.erc20 — ERC20ModuleHandles all ERC-20 token operations: reading balances and allowances, approving spenders, and transferring tokens. Provides ensureAllowance() to conditionally approve only when the existing allowance is insufficient.
Relevant section: OptionBook overview
client.optionBook — OptionBookModule
client.optionBook — OptionBookModuleFills and cancels orders on the OptionBook contract. Use previewFillOrder() for a dry-run before executing. Also handles referrer fee tracking and claiming across all collateral tokens.
Relevant section: OptionBook overview
client.api — APIModule
client.api — APIModuleFetches data from Thetanuts APIs. Methods are read-only and organized by source: *FromIndexer for the book indexer, *FromRfq for the RFQ/factory indexer. Covers orders, user positions, trade history, protocol stats, and daily time series.
client.optionFactory — OptionFactoryModule
client.optionFactory — OptionFactoryModuleManages the full RFQ (Request for Quotation) lifecycle: building parameters, submitting requests, polling quotation state, revealing offers, and settling. Supports vanilla, spread, butterfly, condor, iron condor, and physically settled structures. Also exposes the RFQ-side referral surface (registerReferral, getReferralOwner, getReferralFees, withdrawFees) — see the RFQ Referrals guide.
Relevant section: RFQ overview
client.option — OptionModule
client.option — OptionModuleQueries and manages individual option positions. Reads option info, checks expiry/settlement state, calculates payouts at a given price, and executes close/transfer/split/payout operations.
client.ranger — RangerModule
client.ranger — RangerModuleManages RangerOption positions — the r12 zone-bound, 4-strike payoff. The buyer earns the maximum payout when the settlement price lands inside the zone (between strikes 2 and 3) and a linearly decaying payout outside. Reads include getInfo(), getZone(), getSpreadWidth(), getStrikes(), getTWAP(), calculatePayout(price), simulatePayout(...), and calculateRequiredCollateral(...). Writes include payout(), close(), split(amount), transfer(isBuyer, target), reclaimCollateral(ownedOption), and returnExcessCollateral().
The module throws NETWORK_UNSUPPORTED on chains where RangerOption is not deployed (e.g., Ethereum mainnet today) — no silent eth_call failures.
client.events — EventsModule
client.events — EventsModuleQueries on-chain events from the Thetanuts contracts: order fills, cancellations, RFQ requests, MM offers, offer reveals, settlements, and position closes. Block ranges are auto-chunked into 10K-block segments.
client.ws — WebSocketModule
client.ws — WebSocketModuleProvides real-time subscriptions over WebSocket for order updates, price feeds, and connection state changes. Includes automatic reconnection.
client.mmPricing — MMPricingModule
client.mmPricing — MMPricingModuleFetches market maker pricing from the pricing API. Returns fee-adjusted bid/ask prices per collateral token with collateral cost included. Includes filter and sort helpers and multi-leg pricing for spreads, butterflies, and condors.
Relevant section: MM Pricing guide
client.rfqKeys — RFQKeyManagerModule
client.rfqKeys — RFQKeyManagerModuleManages ECDH key pairs used in the sealed-bid auction RFQ flow. Generates, stores, loads, and backs up keys. Provides encryptOffer() for market makers and decryptOffer() for requesters.
Relevant section: RFQ overview
client.utils — UtilsModule
client.utils — UtilsModulePure utility functions with no network calls: decimal conversions (toBigInt, fromBigInt, strikeToChain, strikeFromChain, toUsdcDecimals, fromUsdcDecimals), payout calculations, collateral calculations, and payoff diagram data generation.
Relevant section: Utilities
client.loan — LoanModule
client.loan — LoanModuleNon-liquidatable lending. Borrowers deposit ETH/BTC collateral and receive USDC. At expiry, repay to reclaim collateral or walk away. Includes pricing, cost calculation, lending opportunities, and option exercise.
Relevant section: Loan overview
client.wheelVault — WheelVaultModule
client.wheelVault — WheelVaultModuleReads and interacts with the WheelVault contracts on Ethereum mainnet. The module is chain-gated — methods throw NETWORK_UNSUPPORTED when the client is configured for any chain other than chainId 1.
Relevant section: Wheel Vault overview
client.strategyVault — StrategyVaultModule
client.strategyVault — StrategyVaultModuleReads and interacts with the StrategyVault contracts (fixed-strike and CLVEX strategies) on Base. The module is chain-gated — methods throw NETWORK_UNSUPPORTED when the client is configured for any chain other than chainId 8453.
Relevant section: Strategy Vault overview
Quick Reference
See Also
Client — ThetanutsClient constructor and properties
Utilities — UtilsModule method reference
../getting-started/configuration.md — Getting started with configuration
Last updated

