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
Options | Description | Example |
---|---|---|
chain | Target chain to filter positions by. | 1 |
token | Token Address to filter by, for token you want out | 0x6b175474e89094c44da98b954eedeac495271d0f |
protocol | Protocol to filter by, see this list (opens in a new tab) for a list of protocol names. | aave-v2 |
Response
Property | Type | Description | Example Value |
---|---|---|---|
position | Position[] | Position | |
status | LoadingState | Status of the request | loading |