Market Queries
The Market Queries module provides (wrapped) GraphQL-based methods for querying position data across markets. This client specifically handles ownership-related queries using the Aptos GraphQL endpoint.
Position Queries
getOwnedPositionAddresses
Retrieves all position addresses owned by a specific address across all markets.
async getOwnedPositionAddresses(owner: string): Promise<string[]>Parameters:
owner: The Aptos address of the position owner
Returns:
- Array of position object addresses owned by the specified address
Example:
const owner = "0x123..."
const positionAddresses = await mirageClient.market.queries.getOwnedPositionAddresses(owner)
// Returns ["0xabc...", "0xdef..."]getOwnedPositionAddressesByMarket
Retrieves position addresses owned by a specific address for a particular market.
async getOwnedPositionAddressesByMarket(
perpSymbol: string,
marginSymbol: string,
owner: string
): Promise<string[]>Parameters:
perpSymbol: The symbol of the perpetual market (e.g., "BTCPERP")marginSymbol: The symbol of the margin token (e.g., "mUSD")owner: The Aptos address of the position owner
Returns:
- Array of position object addresses for the specified market owned by the address
Example:
const owner = "0x123..."
const positionAddresses = await mirageClient.market.queries.getOwnedPositionAddressesByMarket(
"BTCPERP", // Perpetual symbol
"mUSD", // Margin symbol
owner
)
// Returns ["0xabc..."] - positions in BTCPERP-mUSD market owned by the address