DeFi Daily News
Sunday, June 29, 2025
Advertisement
  • Cryptocurrency
    • Bitcoin
    • Ethereum
    • Altcoins
    • DeFi-IRA
  • DeFi
    • NFT
    • Metaverse
    • Web 3
  • Finance
    • Business Finance
    • Personal Finance
  • Markets
    • Crypto Market
    • Stock Market
    • Analysis
  • Other News
    • World & US
    • Politics
    • Entertainment
    • Tech
    • Sports
    • Health
  • Videos
No Result
View All Result
DeFi Daily News
  • Cryptocurrency
    • Bitcoin
    • Ethereum
    • Altcoins
    • DeFi-IRA
  • DeFi
    • NFT
    • Metaverse
    • Web 3
  • Finance
    • Business Finance
    • Personal Finance
  • Markets
    • Crypto Market
    • Stock Market
    • Analysis
  • Other News
    • World & US
    • Politics
    • Entertainment
    • Tech
    • Sports
    • Health
  • Videos
No Result
View All Result
DeFi Daily News
No Result
View All Result
Home DeFi Web 3

Uncovering the Simplest Method to Access a Wallet’s DeFi Positions with DeFi Protocol Data – Moralis Web3 | Enterprise-Grade Web3 APIs

David Olsson by David Olsson
August 14, 2024
in Web 3
0 0
0
Uncovering the Simplest Method to Access a Wallet’s DeFi Positions with DeFi Protocol Data – Moralis Web3 | Enterprise-Grade Web3 APIs
0
SHARES
0
VIEWS
Share on FacebookShare on TwitterShare on Telegram
Listen to this article

Are you looking to access decentralized finance (DeFi) protocol data easily? If so, you’re in the right place. This guide introduces Moralis’ DeFi API – your go-to solution for querying DeFi data. With the DeFi API, you can effortlessly fetch protocol data for any wallet with just a single API call. Eager to get going? Here’s how to quickly retrieve a summary of the DeFi protocols a wallet interacts with:

import fetch from ‘node-fetch’;


const options = {
method: 'GET',
headers: {
accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
};

fetch('https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/defi/summary?chain=eth', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

Running the code above provides a summary of all DeFi protocols linked to a wallet, including the number of positions, total USD value, unclaimed rewards, protocol names, logos, and more. Here’s an example of the output:


{
active_protocols: 8,
total_positions: 12,
total_usd_value: 871.6550972487607,
total_unclaimed_usd_value: 26.31655680118138,
protocols: [
{
protocol_name: 'Uniswap v3',
protocol_id: 'uniswap-v3',
protocol_url: 'https://app.uniswap.org',
protocol_logo: 'https://cdn.moralis.io/defi/uniswap.png',
total_usd_value: 433.6700616074799,
total_unclaimed_usd_value: 26.31655680118138,
positions: 3
},
//...
]
}

That’s it! Fetching DeFi protocol data is easy with Moralis. For a detailed breakdown, check out the official DeFi API documentation or follow this guide to learn more.

Ready to start querying DeFi protocol data? Sign up for a free Moralis account to access our industry-leading development tools instantly!

Overview

Wallet holders often have significant portions of their portfolios locked in DeFi protocols to, for instance, earn yield. However, tracking these positions can be challenging, complicating the development of tools like portfolio trackers, wallets, and tax platforms. That’s why we introduced our DeFi Positions feature.


With Moralis’ DeFi Positions, you can query DeFi protocol data with just a few lines of code. Are you curious about how it works? If so, join us in this guide, and we’ll show you. Let’s dive in!

What is DeFi Protocol Data?

DeFi protocol data encompasses detailed information about a wallet’s positions across various DeFi platforms, such as Uniswap and Aave. This data includes liquidity positions, yield farming activities and other interactions within the DeFi ecosystem. Given that many wallet holders lock assets in DeFi protocols, this data is crucial for building portfolio trackers, crypto tax platforms, and other Web3 projects, along with ensuring overall accurate financial reporting.

DeFi protocol data.

Traditionally, retrieving DeFi protocol data has been complex and time-consuming. However, Moralis’ DeFi API simplifies this process, offering a streamlined way to access comprehensive DeFi protocol data.

So, what exactly is Moralis’ DeFi API, and how does it work? Let’s explore its features and benefits!

Moralis’ DeFi API – The Easiest Way to Get DeFi Protocol Data

Moralis’ DeFi API is the simplest and most powerful way to access DeFi protocol data. This leading API provides a unified interface to query liquidity pairs, ERC-20 allowances, liquidity provider tokens, DeFi positions, and more – all in one place.

Moralis' DeFi API.

With robust cross-chain support, Moralis’ DeFi API enables you to retrieve data across major blockchain networks and protocols, including Ethereum, Polygon, BNB Smart Chain (BSC), and others.

As such, whether you’re developing lending platforms, portfolio trackers, or similar applications, Moralis’ DeFi API equips you with the necessary tools.

So, how can you use Moralis’ DeFi API to get protocol data? This is where our DeFi Positions feature comes into play!

Introducing Moralis’ DeFi Positions

One of the DeFi API’s most prominent features is DeFi Positions, which provides comprehensive insight into any wallet’s DeFi activities. But what does this actually entail? Our DeFi Positions feature comprises three key endpoints:

Summary DeFi Protocols by Wallet

Retrieve a comprehensive summary of all DeFi protocols associated with a specific wallet address. Below is an example of the endpoint in action:


import fetch from 'node-fetch';

const options = {
method: 'GET',
headers: {
accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
};

fetch('https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/defi/summary?chain=eth', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

When you call this endpoint, you’ll receive a detailed summary of the DeFi protocols the wallet interacts with, including the total USD value of all positions, unclaimed rewards, protocol names, and additional relevant data. Here’s an example of the response:


{
active_protocols: 8,
total_positions: 12,
total_usd_value: 871.6550972487607,
total_unclaimed_usd_value: 26.31655680118138,
protocols: [
{
protocol_name: 'Uniswap v3',
protocol_id: 'uniswap-v3',
protocol_url: 'https://app.uniswap.org',
protocol_logo: 'https://cdn.moralis.io/defi/uniswap.png',
total_usd_value: 433.6700616074799,
total_unclaimed_usd_value: 26.31655680118138,
positions: 3
},
//...
]
}

Summary DeFi Positions by Wallet

Fetch a summary of all DeFi positions associated with a wallet, including unclaimed rewards for each position. Down below, you’ll find an example of what it might look like when calling this endpoint:


import fetch from 'node-fetch';

const options = {
method: 'GET',
headers: {
accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
};

fetch('https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/defi/positions?chain=eth', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

Running the code above returns a detailed summary of all DeFi positions for a wallet. This includes position labels, associated tokens, USD values for each position, and other relevant details. Here’s an example output:


[
{
"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",
"position": {
"label": "liquidity",
"tokens": [
{
"token_type": "supplied",
"name": "USD Coin",
"symbol": "USDC",
"contract_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"decimals": "6",
"logo": "https://logo.moralis.io/0x1_0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_ac01a87aaf98ddb0f349ee4ebe97f0d8",
"thumbnail": "https://logo.moralis.io/0x1_0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_ac01a87aaf98ddb0f349ee4ebe97f0d8",
"balance": "9762775.56142477145245169357",
"balance_formatted": "9.76277556142477145245169357",
"usd_price": 0.9999274263552301,
"usd_value": 9.76206704121921
},
//...
],
"address": "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc",
"balance_usd": 19.509109037404016,
"total_unclaimed_usd_value": 5.127740503730312,
"position_details": {
"reserve0": "9.76277556142477145245169357",
"reserve1": "0.00356975548622332765688138345279600856",
"factory": "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
"pair": "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc",
"share_of_pool": 0.000021077221080781
}
}
},
//...
]

Detailed DeFi Positions by Wallet & Protocol

Query detailed data on positions for a specific wallet and protocol. Here’s an example of what it might look like:


import fetch from 'node-fetch';

const options = {
method: 'GET',
headers: {
accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
};

fetch('https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/defi/uniswap-v3/positions?chain=eth', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

Running the code returns comprehensive DeFi positions for the specified wallet and protocol, including position labels, tokens, USD values for each position, unclaimed rewards, and more. See an example response below:


{
"protocol_name": "Uniswap v3",
"protocol_id": "uniswap-v3",
"protocol_url": "https://app.uniswap.org",
"protocol_logo": "https://cdn.moralis.io/defi/uniswap.png",
"total_usd_value": 433.28689509249983,
"total_unclaimed_usd_value": 26.291817301924766,
"positions": [
{
"label": "liquidity",
"tokens": [
{
"token_type": "supplied",
"name": "Coinbase Wrapped Staked ETH",
"symbol": "cbETH",
"contract_address": "0xbe9895146f7af43049ca1c1ae358b0541ea49704",
"decimals": "18",
"logo": "https://logo.moralis.io/0x1_0xbe9895146f7af43049ca1c1ae358b0541ea49704_22de8d667f6e46b09b33c805e7973049",
"thumbnail": "https://logo.moralis.io/0x1_0xbe9895146f7af43049ca1c1ae358b0541ea49704_22de8d667f6e46b09b33c805e7973049",
"balance": "0",
"balance_formatted": "0",
"usd_price": 2937.5037898342443,
"usd_value": 0
},
//...
{
"token_type": "reward",
"name": "Coinbase Wrapped Staked ETH",
"symbol": "cbETH",
"contract_address": "0xbe9895146f7af43049ca1c1ae358b0541ea49704",
"decimals": "18",
"logo": "https://logo.moralis.io/0x1_0xbe9895146f7af43049ca1c1ae358b0541ea49704_22de8d667f6e46b09b33c805e7973049",
"thumbnail": "https://logo.moralis.io/0x1_0xbe9895146f7af43049ca1c1ae358b0541ea49704_22de8d667f6e46b09b33c805e7973049",
"balance": "880092663147703",
"balance_formatted": "0.000880092663147703",
"usd_price": 2937.5037898342443,
"usd_value": 2.5852755334016906
},
//...
],
"address": "0x840deeef2f115cf50da625f7368c24af6fe74410",
"balance_usd": 78.95335940631567,
"total_unclaimed_usd_value": 5.121540153915798,
"position_details": {



Source link

Tags: accessAPIsdataDefiEnterpriseGradeMethodMoralisPositionsProtocolSimplestUncoveringWalletsWeb3
ShareTweetShare
Previous Post

Is BNB Price Resuming its Upward Trajectory? Will it Surpass $535?

Next Post

China Loan Drop Stokes ‘Balance Sheet Recession’ Fears | Bloomberg: The China Show 8/14/2024

Next Post
China Loan Drop Stokes ‘Balance Sheet Recession’ Fears | Bloomberg: The China Show 8/14/2024

China Loan Drop Stokes 'Balance Sheet Recession' Fears | Bloomberg: The China Show 8/14/2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
  • Trending
  • Comments
  • Latest
rewrite this title with good SEO Bitcoin Could Explode On Bessent’s 0 Billion Deregulation Shock

rewrite this title with good SEO Bitcoin Could Explode On Bessent’s $250 Billion Deregulation Shock

May 28, 2025
Mastering Crypto Mining: A Step-By-Step Guide

Mastering Crypto Mining: A Step-By-Step Guide

September 12, 2024
CRYPTO IS DUMPING DUE TO THIS… What Comes Next?

CRYPTO IS DUMPING DUE TO THIS… What Comes Next?

June 13, 2025
Bitcoin Surpasses ,000 Amidst ‘Liquidity Hunt’ After Surge – Decrypt

Bitcoin Surpasses $67,000 Amidst ‘Liquidity Hunt’ After Surge – Decrypt

October 23, 2024
rewrite this title XRP vs SEC: Legal Expert Says Ripple Is Delaying The Lawsuit

rewrite this title XRP vs SEC: Legal Expert Says Ripple Is Delaying The Lawsuit

June 19, 2025
Configuring Web3j for Android Development

Configuring Web3j for Android Development

July 24, 2024
rewrite this title Ethereum Historical Pattern Hints At Potential ,000 Surge – Analyst

rewrite this title Ethereum Historical Pattern Hints At Potential $10,000 Surge – Analyst

June 28, 2025
rewrite this title 4 directions for The Judgment Day after WWE Night of Champions 2025

rewrite this title 4 directions for The Judgment Day after WWE Night of Champions 2025

June 28, 2025
rewrite this title Jayne Mansfield’s Death: How Mariska Hargitay’s Mom Died in 1967

rewrite this title Jayne Mansfield’s Death: How Mariska Hargitay’s Mom Died in 1967

June 28, 2025
rewrite this title Can China’s MiniMax-M1 AI Topple US Rivals? We Put It to the Test – Decrypt

rewrite this title Can China’s MiniMax-M1 AI Topple US Rivals? We Put It to the Test – Decrypt

June 28, 2025
rewrite this title Tesla says it delivered its first car autonomously from factory to customer

rewrite this title Tesla says it delivered its first car autonomously from factory to customer

June 28, 2025
rewrite this title with good SEO Here’s What Happens If Dogecoin Follows Previous Cycle Trends | Bitcoinist.com

rewrite this title with good SEO Here’s What Happens If Dogecoin Follows Previous Cycle Trends | Bitcoinist.com

June 28, 2025
DeFi Daily

Stay updated with DeFi Daily, your trusted source for the latest news, insights, and analysis in finance and cryptocurrency. Explore breaking news, expert analysis, market data, and educational resources to navigate the world of decentralized finance.

  • About Us
  • Blogs
  • DeFi-IRA | Learn More.
  • Advertise with Us
  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2024 Defi Daily.
Defi Daily is not responsible for the content of external sites.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Cryptocurrency
    • Bitcoin
    • Ethereum
    • Altcoins
    • DeFi-IRA
  • DeFi
    • NFT
    • Metaverse
    • Web 3
  • Finance
    • Business Finance
    • Personal Finance
  • Markets
    • Crypto Market
    • Stock Market
    • Analysis
  • Other News
    • World & US
    • Politics
    • Entertainment
    • Tech
    • Sports
    • Health
  • Videos

Copyright © 2024 Defi Daily.
Defi Daily is not responsible for the content of external sites.