Production Checklist

Items to verify before deploying an application that uses the Thetanuts SDK.


RPC Provider

Do not use the public https://mainnet.base.org endpoint in production. Public endpoints have strict rate limits and may be unreliable under sustained load.

// Not recommended for production
const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');

// Recommended: use a dedicated RPC provider
const provider = new ethers.JsonRpcProvider(
  'https://base-mainnet.g.alchemy.com/v2/YOUR_API_KEY'
);
// Alternatives:
// https://base-mainnet.infura.io/v3/YOUR_PROJECT_ID
// https://base.quiknode.pro/YOUR_ENDPOINT

Referrer Configuration

Set the referrer address in the client config to earn fee-sharing revenue on every order fill. If not set, fees go to the zero address.

import { ThetanutsClient } from '@thetanuts-finance/thetanuts-client';

const client = new ThetanutsClient({
  chainId: 8453,
  provider,
  signer,
  referrer: '0xYourReferrerAddress',
});

The referrer can be overridden per call if needed:


Error Logging

Pass a custom logger to capture SDK errors in your monitoring system (Sentry, Datadog, etc.):

During development, use the built-in consoleLogger:


Gas Buffer

The SDK adds a 20% gas buffer automatically for Account Abstraction wallets (Coinbase Smart Wallet, Safe). This buffer also applies for standard EOA wallets as a safety margin. No action required, but factor this into gas cost estimates.


Collateral Approval Flow

The SDK does not auto-approve token spending. Always call ensureAllowance() before fillOrder(). Failure to do so results in an INSUFFICIENT_ALLOWANCE error.

For SELL (short) positions in the RFQ flow, approve the OptionFactory contract before creating the RFQ:


WebSocket Reconnection

The WebSocket module auto-reconnects by default (up to 10 attempts). For high-availability applications, monitor the connection state and configure reconnection settings:


Order Expiry Checks

Always check order.expiry before filling. The SDK throws OrderExpiredError when you try to fill an expired order, but checking upfront avoids unnecessary gas estimation calls.


RFQ Key Backup

If your application creates RFQs, back up the ECDH private key. Without it, you cannot decrypt market maker offers or perform early settlement.

Keys are stored in .thetanuts-keys/ (Node.js) or localStorage (browser) with secure permissions. Add .thetanuts-keys/ to your backup strategy.


Compatibility Requirements

Requirement
Minimum Version

Node.js

>= 18

ethers.js

v6

TypeScript

>= 5.0

See Also

Last updated