GET /v2/amplify/userPositions returns a user’s shareBalance, positionValueInBase, baseAssetAddress, and exchangeRateToBase per chain each vault is deployed on. Use it to render a user’s holdings in a portfolio or vault detail view without re-implementing the share-to-base math client-side.
positionValueInBase is computed as shareBalance * exchangeRateToBase at the accountant contract’s current rate, so the value reflects up-to-the-block on-chain state.
userAddress is required as a top-level query parameter. filter is a
single AIP-160-style query parameter and is optional. The flags inside the
filter are also optional: vaultAddress (hex) scopes to one vault,
chainId (number) scopes to one chain. With no filter, the user’s position
is returned for every live vault deployment.Some vaults are deployed as stand-in vaults on a chain where the canonical
base asset isn’t natively available (e.g. soohoUSDGt on Base). In that case
the endpoint reports
baseAssetAddress from the on-chain accountant.base()
call. The endpoint transparently falls back to accountant.base() whenever
the DB has no baseAssetAddress for that deployment.Each response includes a
tokenMetadata map keyed by lowercase address,
populated for the vaultAddress and baseAssetAddress returned in
userPositions[]. Use it to render token symbols/decimals without making a
separate metadata call.Parameters
Example
- curl
- Node.js
- Python
- Go