Redeem From Position
The redeemFromPosition function allows users to withdraw collateral from an existing position.
Function Signature
redeemFromPosition(
pcpId: string,
collateralToken: string,
indexToken: string,
amount: number,
long: boolean
): Promise<TransactionBlock>Parameters
pcpId: The ID of the position to redeem fromcollateralToken: The token used as collateral (e.g., "USDC")indexToken: The token used as the market index (e.g., "BTC")amount: The amount of collateral to withdrawlong: Boolean indicating if this is a long (true) or short (false) position
Return Value
Returns a Promise that resolves to a TransactionBlock object.
Usage Example
Last updated