Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

Get detailed DeFi positions by wallet and protocol

GEThttps://deep-index.moralis.io/api/v2.2/wallets/:address/defi/:protocol/positions

Get the detailed defi positions by protocol for a wallet address.

PATH PARAMS
addressstringrequired
Wallet address
protocolstringrequired
The protocol to query
QUERY PARAMS
chainstring
The chain to query
Responses
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.EvmApi.wallets.getDefiPositionsByProtocol({
"chain": "0x1",
"address": "0xcB1C1FdE09f811B294172696404e88E658659905",
"protocol": "uniswap-v3"
});

console.log(response.raw);
} catch (e) {
console.error(e);
}
Response Example
{
"protocol_name": "Uniswap v2",
"protocol_id": "uniswap-v2",
"protocol_url": "https://app.uniswap.org/pools/v2",
"protocol_logo": "https://cdn.moralis.io/defi/uniswap.png",
"total_usd_value": 47754.14278954011,
"total_unclaimed_usd_value": "",
"positions": [
{
"label": "liquidity",
"tokens": [
{
"token_type": "defi-token",
"name": "Wrapped Ether",
"symbol": "WETH",
"contract_address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"decimals": 18,
"logo": "https://logos.covalenthq.com/tokens/0x0000000000085d4780b73119b644ae5ecd22b376.png",
"thumbnail": "https://logos.covalenthq.com/tokens/0x0000000000085d4780b73119b644ae5ecd22b376.png",
"balance": "1000000",
"balance_formatted": "1.000000",
"usd_price": 1000000,
"usd_value": 1000000
}
],
"address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"balance_usd": 1000000,
"total_unclaimed_usd_value": 1000000,
"position_details": {
"fee_tier": 1,
"range_tnd": 1,
"reserves": [
"string"
],
"current_price": 1,
"is_in_range": true,
"price_upper": 1,
"price_lower": 1,
"price_label": "string",
"liquidity": 1,
"range_start": 1,
"pool_address": "string",
"position_key": "string",
"asset_standard": "string",
"apy": 1,
"is_debt": true,
"is_variable_debt": true,
"is_stable_debt": true,
"shares": "string",
"reserve0": "string",
"reserve1": "string",
"factory": "string",
"pair": "string",
"share_of_pool": 1
}
}
]
}