React Hooks Library
API-Reference
UsePositions

UsePositions Hook

Hook to retrieve all positions available on Enso infrastructure, with additional filters to search for specific positions.

Example

const { data: positions } = usePositions({
  chain: 1,
  token: "0x6b175474e89094c44da98b954eedeac495271d0f",
})
 
console.log(positions[0])
// First result:
// {
//   "name": "Dai Stablecoin",
//   "symbol": "DAI",
//   "decimals": 18,
//   "logoURI": "https://metadata-service.herokuapp.com/api/token/1/0x6b175474e89094c44da98b954eedeac495271d0f/icon",
//   "address": "0x6b175474e89094c44da98b954eedeac495271d0f",
//   "id": "0x6b175474e89094c44da98b954eedeac495271d0f",
//   "chainId": 1
// }

Options

OptionsDescriptionExample
chainTarget chain to filter positions by.1
tokenToken Address to filter by, for token you want out0x6b175474e89094c44da98b954eedeac495271d0f
protocolProtocol to filter by, see this list (opens in a new tab) for a list of protocol names.aave-v2

Response

PropertyTypeDescriptionExample Value
positionPosition[]Position
statusLoadingStateStatus of the requestloading