Cancel Order
The cancelOrder
function allows users to cancel an existing order.
Function Signature
cancelOrder(
orderCapId: string,
collateralToken: string,
indexToken: string,
long: boolean,
type: string
): Promise<TransactionBlock>
Parameters
orderCapId
: The ID of the order to cancelcollateralToken
: The token used as collateral (e.g., "USDC")indexToken
: The token used as the market index (e.g., "BTC")long
: Boolean indicating if this is a long (true) or short (false) positiontype
: The type of order ("OPEN_POSITION" or "DECREASE_POSITION")
Return Value
Returns a Promise
that resolves to a TransactionBlock
object.
Usage Example
const tx = await sudoAPI.cancelOrder(
'0x123...', // orderCapId
'USDC', // collateralToken
'BTC', // indexToken
true, // long position
'OPEN_POSITION' // order type
);
Last updated