Fetch Positions on an Identity

`GET` request to `/identity/:id/positions` to fetch Identity Positions for an Identity that matches the provided `identity_id`.

As we're in our Beta Testnet we're aware of potential inconsistencies with the returned response data. We encourage you to build proofs of concept that utilize this request but be mindful that the response data may be different than expected.

GET to /identity/:id/positions

Retrieves Positions on an Identity that matches the provided id.

GET https://api.intuition.systems/identity/:id
   await fetch(`${apiUrl}/identity/${id}/positions`, {
      method: 'GET',
      "headers": {
        "Content-Type": "application/json",
        "x-api-key": <API_KEY>
      },
    })

Security

This request requires a valid API Key to be included with each request.

Headers

  • Content-Type: application/json

  • x-api-key: <API_Key>

Path Parameters

Response

This includes the Paginated Response

{
    "page": 1, // The current page in pagination sequence
    "limit": 100, // The max number of items returned on a single page
    "total": 50, // Total number of items 
    "data": [{}] // Array of response items
}

If Positions are found for the Identity's id you'll receive back an Identity Positions object.

{
  "id": "00000000-0000-0000-0000-000000000000",
  "user": {
    "wallet": "0x..." // wallet for user who staked
  },
  "direction": "for", // Identities can only be staked 'for'
  "vault_id": "1",
  "amount_staked": "1000000000000000",
  "conviction": "318743917544004046",
  "assets": "2000000000000000",
  "fee": "1000000000000000",
  "delta_assets": "0",
  "total": 1 // can be ignored -- we're aware of this. it's a duplicate of the pagination response
}

Here is an example Zod schema and TypeScript interface you can use for the Identity Positions:

export const IdentityPositionSchema = z.object({
  id: z.string(),
  user: EmbedUserUserAggregatesSchema,
  updated_at: z.string().transform((date) => {
    const d = new Date(Number.parseInt(date))
    return d.toISOString()
  }), // unix timestamp
  assets: z.string(), // bigint
  conviction: z.string(), // bigint
  fee: z.string(), // TBD - bigint
  delta_assets: z.string(), // assets gain/loss

Response Codes

Last updated