getPositionCapInfoList
The getPositionCapInfoList
function retrieves a list of position cap information for a given owner address.
Function Signature
getPositionCapInfoList(owner: string): Promise<IPositionCapInfo[]>
Parameters
owner
: A string representing the owner's address.
Return Value
Returns a Promise
that resolves to an array of IPositionCapInfo
objects. Each IPositionCapInfo
object has the following structure:
interface IPositionCapInfo {
positionCapId: string;
symbol0: string;
symbol1: string;
long: boolean;
}
positionCapId
: The ID of the position cap.symbol0
: The first symbol in the trading pair.symbol1
: The second symbol in the trading pair.long
: A boolean indicating whether the position is long (true) or short (false).
Description
This function fetches all position caps owned by the specified address. It filters for objects of type PositionCap
and extracts relevant information from each position cap.
Usage Example
const owner = "0x1234..."; // Replace with actual owner address
const sudoAPI = new SudoAPI(network, provider);
try {
const positionCaps = await sudoAPI.getPositionCapInfoList(owner);
console.log("Position Caps:", positionCaps);
} catch (error) {
console.error("Error fetching position caps:", error);
}
Last updated