Position Management
Query and manage option positions using the client.option module.
Methods
getOptionInfo(address)
Get basic option details
No
getFullOptionInfo(address)
Get all info in a single call
No
calculatePayout(address, price)
Calculate payout at settlement price
No
calculateRequiredCollateral(address, strikes, contracts)
Get collateral needed
No
getStrikes(address)
Get strike prices
No
getExpiry(address)
Get expiry timestamp
No
isExpired(address)
Check if expired
No
isSettled(address)
Check if settled
No
getBuyer(address)
Get buyer address
No
getSeller(address)
Get seller address
No
getNumContracts(address)
Get contract count
No
getCollateralAmount(address)
Get collateral amount
No
close(address)
Close position
Yes
transfer(address, isBuyer, target)
Transfer buyer or seller role
Yes
split(address, amount)
Split position into two
Yes
payout(address)
Execute payout after expiry
Yes
Usage
Get Full Option Info
getFullOptionInfo() batches all state into a single RPC call. Use it when you need more than one field.
getFullOptionInfo()returns nullable fields (| null) for proxy contracts with incompatible ABI versions so it returns partial data instead of throwing.
Individual State Reads
Calculate Payout
calculatePayout() accepts the settlement price in 8-decimal format ($2000 = 200000000000n).
For off-chain payoff diagram data, use client.utils.calculatePayout() instead, which runs locally without RPC calls:
simulatePayout (current spot)
When you want the current expected payout without supplying a price, use simulatePayout(). It reads the option's TWAP from the on-chain consumer and runs calculatePayout against it. Pass an explicit price to override.
Close a Position
Both buyer and seller can close a position before expiry if both agree (bilateral close). Requires a signer.
Execute Payout
After expiry, either party can call payout() to settle the option and distribute proceeds.
Transfer a Position
Transfer the buyer or seller role to a new address.
Split a Position
Split one option contract into two separate contracts. Useful for partial exits.
Return Types
FullOptionInfo
See Also
Token Operations — approve collateral before close or payout
Events — query
getPositionClosedEventsfor settlement historyError Handling —
NotExpired,AlreadySettled,NotBuyerrevert reasons
Last updated

