Migration Guide

This guide helps existing users upgrade to the latest SDK patterns and APIs.

Table of Contents


Breaking Changes

collateralAmount Parameter

The most critical change: collateralAmount must now always be 0 when creating RFQs.

Before (Incorrect Pattern)

// ❌ OLD: Calculating and passing collateralAmount
const strike = 1850;
const numContracts = 1.5;
const collateralAmount = BigInt(Math.round(strike * numContracts * 1e6));

const params = {
  // ...
  collateralAmount: collateralAmount,  // WRONG!
  // ...
};

After (Correct Pattern)

Why This Changed

Collateral is NOT locked at RFQ creation time. It is pulled from both parties at settlement time. The collateralAmount parameter in RFQ was misleading and should always be 0.

For SELL positions: You still need to calculate collateral, but only for token approval:


New Helper Methods

buildRFQParams()

High-level RFQ builder that:

  • Enforces collateralAmount = 0 automatically

  • Resolves addresses from chain config (no hardcoding)

  • Handles decimal conversions

buildRFQRequest()

Complete RFQ request builder including tracking and reserve price:

strikeToChain() / strikeFromChain()

Precision-safe strike conversion using string-based parsing (avoids floating-point errors):

getFullOptionInfo()

Aggregated option info in a single call (replaces multiple Promise.all patterns):

MM Pricing Filter Utilities

New utilities for filtering and sorting pricing data:


Code Migration Examples

Example 1: RFQ Creation for BUY Position

Example 2: RFQ Creation for SELL Position

Example 3: Option Position Queries

Example 4: Strike Price Conversion


Deprecation Notices

Deprecated Patterns

Pattern
Status
Replacement

Hardcoded contract addresses

Deprecated

Use client.chainConfig

Manual collateralAmount calculation

Deprecated

Always use BigInt(0) or buildRFQParams()

Multiple Promise.all for option info

Deprecated

Use getFullOptionInfo()

Manual strike scaling

Deprecated

Use strikeToChain() / strikeFromChain()

API Method Renames

To clarify data sources, some API methods have been renamed:

Old Method
New Method
Data Source

getUserPositions()

getUserPositionsFromIndexer()

Indexer API

getUserHistory()

getUserHistoryFromIndexer()

Indexer API

getStats()

getStatsFromIndexer()

Indexer API

getUserRFQs()

getUserRFQsFromRfq()

State/RFQ API

getRFQ()

getRFQFromRfq()

State/RFQ API

The old method names are still available as aliases but may be removed in a future version.


See Also

Last updated