[ad_1]
Are you in search of the simplest method to get crypto logos? You then’re exactly the place it’s essential to be! At Moralis, we’ve got enriched our Token API responses with logos, which means you don’t have to name a number of endpoints or trouble with a number of suppliers to get and combine this information into your decentralized software (dapp). Merely use one among our present endpoints for balances, transfers, or metadata – and also you’re good to go!
For a sneak peek of how this works, let’s take a look at our endpoint for fetching a pockets’s token balances with costs for example:
import Moralis from ‘moralis’;
attempt {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});
const response = await Moralis.EvmApi.wallets.getWalletTokenBalancesPrice({
“chain”: “0x1”,
“handle”: “0xcB1C1FdE09f811B294172696404e88E658659905”
});
console.log(response.uncooked);
} catch (e) {
console.error(e);
}
All it’s important to do is exchange YOUR_API_KEY together with your Moralis API key, configure the question parameters, and run the code. In return, you’ll obtain a response that features the balances of the pockets in query, together with costs, metadata, and crypto logos:
{
//…
“consequence”: [
{
“token_address”: “0xae7ab96520de3a18e5e111b5eaab095312d7fe84”,
“symbol”: “stETH”,
“name”: “Liquid staked Ether 2.0”,
“logo”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“thumbnail”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“decimals”: 18,
“balance”: “90318376196090571”,
“possible_spam”: false,
“verified_contract”: true,
“balance_formatted”: “0.090318376196090571”,
“usd_price”: 3586.211067676367,
“usd_price_24hr_percent_change”: 2.6911259013267164,
“usd_price_24hr_usd_change”: 96.5094549184841,
“usd_value”: 323.9007603289777,
“usd_value_24hr_usd_change”: 8.71657725580729,
“native_token”: false,
“portfolio_percentage”: 54.6316
},
//…
]
}
That’s it; getting crypto logos doesn’t need to be tougher than that when working with Moralis. Should you’d like a extra detailed tutorial on how this works, be part of us on this information as we dive deeper into the method.
Additionally, if you wish to begin leveraging the Token API your self, join with Moralis immediately. You may create an account freed from cost, and also you’ll achieve instantaneous entry to our premier Web3 API suite!
Overview
When constructing dapps, your tasks will most undoubtedly profit from crypto logos, as this will considerably enhance the consumer expertise and increase engagement. However what’s the best method to get and combine token logos into your dapp? Nicely, beforehand, it has been bothersome and time-consuming to get complete token protection on your dapps. Happily, that is not the case, as we at Moralis have integrated token brand protection throughout our complete Token API. As such, you now mechanically get crypto logos when querying one among our endpoints for token balances, transfers, or metadata!
So, it doesn’t matter when you’re constructing a decentralized alternate (DEX), cryptocurrency pockets, or some other platform; this information on the way to get crypto logos is for you. Let’s dive straight in by initially introducing you to Moralis!
What’s Moralis?
Moralis is the {industry}’s main Web3 infra supplier, supplying you with the assets to streamline on-chain information integration on your dapps. Our suite of improvement instruments consists of blockchain nodes for all main chains and ten+ use case-specific Web3 APIs. Consequently, when working with Moralis, you’ll be able to seamlessly construct all the pieces from decentralized exchanges (DEXs) to cryptocurrency wallets with out breaking a sweat!
However what makes Moralis stand out from the competitors?
One API for All Your Information Wants: At Moralis, we enrich all our API responses with information from a number of on-chain and off-chain sources. This provides you extra information with fewer API calls, which means you don’t need to trouble with the complexities of integrating a number of suppliers. Unmatched Safety: Moralis stands out because the {industry}’s solely SOC 2 Kind 2 licensed Web3 infra supplier. So, if you wish to construct dapps with enterprise-grade information safety, then Moralis is your go-to alternative. Trusted by Trade Leaders: Moralis is used and trusted by the largest names in Web3, together with MetaMask, Opera, Blockchain.com, and lots of others.
That provides you an outline of Moralis. Let’s now introduce you to our Token API – the last word device for fetching and integrating token logos into your dapps!
Moralis’ Token API – The Best Technique to Get Crypto Logos
Moralis’ Token API is the last word device for integrating ERC-20 token information into your dapps, masking each single token throughout all main networks, together with Ethereum, BNB Good Chain (BSC), Polygon, and lots of others!
With the Token API, you’ll be able to seamlessly get pockets balances, metadata, costs, and many others., with a single endpoint. We lately additionally enriched all Token API responses with crypto logos, making it a breeze to combine partaking visuals into your dapps.
So, how do you get token logos on your dapp with the Token API?
Nicely, to focus on the accessibility and comprehensiveness of Moralis, let’s have a look at our getWalletTokenBalancesPrice() endpoint for example. With this single endpoint, you get a pockets’s token balances – together with costs, metadata, and crypto logos – in a single response.
Right here’s what the endpoint seems to be like:
import Moralis from ‘moralis’;
attempt {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});
const response = await Moralis.EvmApi.wallets.getWalletTokenBalancesPrice({
“chain”: “0x1”,
“handle”: “0xcB1C1FdE09f811B294172696404e88E658659905”
});
console.log(response.uncooked);
} catch (e) {
console.error(e);
}
In return for calling the endpoint above, you’ll get a response comprising an array of token objects, every with a brand hooked up:
{
//…
“consequence”: [
{
“token_address”: “0xae7ab96520de3a18e5e111b5eaab095312d7fe84”,
“symbol”: “stETH”,
“name”: “Liquid staked Ether 2.0”,
“logo”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“thumbnail”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“decimals”: 18,
“balance”: “90318376196090571”,
“possible_spam”: false,
“verified_contract”: true,
“balance_formatted”: “0.090318376196090571”,
“usd_price”: 3586.211067676367,
“usd_price_24hr_percent_change”: 2.6911259013267164,
“usd_price_24hr_usd_change”: 96.5094549184841,
“usd_value”: 323.9007603289777,
“usd_value_24hr_usd_change”: 8.71657725580729,
“native_token”: false,
“portfolio_percentage”: 54.6316
},
//…
]
}
Whereas we solely have a look at getWalletTokenBalancesPrice() for example, all our Token API endpoints are enriched with logos. So, when you’d wish to expertise the simplest method to get token logos on your dapps, join with Moralis.
Now, within the following part, we’ll see the Token API in motion and provide you with a easy three-step tutorial on the way to get logos on your dapp!
3-Step Tutorial: Learn how to Get Crypto Logos with Moralis
For this transient tutorial, we’ll present you the way to seamlessly get crypto logos utilizing Moralis’ Token API. To take action, we’ll be utilizing the getWalletTokenBalancesPrice() endpoint for example. And due to the accessibility of Moralis, you will get the information you want in three easy steps:
Step 1: Get a Moralis API KeyStep 2: Write a Script Calling the getWalletTokenBalancesPrice() EndpointStep 3: Run the Code
However earlier than we are able to soar into step one, it’s essential to cope with a few stipulations!
Stipulations
For this tutorial, we’ll be utilizing JavaScript and Node.js. As such, earlier than you proceed, be sure you have the next prepared:
Step 1: Get a Moralis API Key
Begin by signing up with Moralis at no cost by clicking on the ”Begin for Free” button on the prime proper of Moralis’ homepage:
From right here, navigate to the ”Settings” tab to the left, scroll all the way down to the ”API Keys” part, and replica your key:
Hold the important thing for now, as you’ll want it within the following part!
Step 2: Write a Script Calling the getWalletTokenBalancesPrice() Endpoint
Open your most popular IDE, arrange a brand new folder, and initialize a mission by working the next command within the terminal:
npm init
You may then go forward and execute the instructions beneath to put in the wanted dependencies:
npm set up node-fetch –save
npm set up moralis @moralisweb3/common-evm-utils
Subsequent, open the ”bundle.json” file of your mission and add ”sort”: ”module” to the checklist:
From right here, create an ”index.js” file and add the next code:
import Moralis from ‘moralis’;
attempt {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});
const response = await Moralis.EvmApi.wallets.getWalletTokenBalancesPrice({
“chain”: “0x1”,
“handle”: “0xcB1C1FdE09f811B294172696404e88E658659905”
});
console.log(response.uncooked);
} catch (e) {
console.error(e);
}
You now have to make a number of configurations to the code. Initially, exchange YOUR_API_KEY together with your Moralis API key:
Subsequent, additionally be certain that to configure the chain and handle parameters to suit your question:
That’s it; you’re now able to run the code!
Step 3: Run the Code
To execute the code, open a brand new terminal, cd into the mission folder, and run this command:
node index.js
In return, you’ll obtain an array of token objects containing logos, the stability, and different helpful information. Right here’s an instance of what it would appear like:
{
//…
“consequence”: [
{
“token_address”: “0xae7ab96520de3a18e5e111b5eaab095312d7fe84”,
“symbol”: “stETH”,
“name”: “Liquid staked Ether 2.0”,
“logo”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“thumbnail”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“decimals”: 18,
“balance”: “90318376196090571”,
“possible_spam”: false,
“verified_contract”: true,
“balance_formatted”: “0.090318376196090571”,
“usd_price”: 3586.211067676367,
“usd_price_24hr_percent_change”: 2.6911259013267164,
“usd_price_24hr_usd_change”: 96.5094549184841,
“usd_value”: 323.9007603289777,
“usd_value_24hr_usd_change”: 8.71657725580729,
“native_token”: false,
“portfolio_percentage”: 54.6316
},
//…
]
}
To entry the picture, merely use the hyperlink within the metadata. You may also go to the handle when you’d like a preview of the picture:
From right here, now you can seamlessly get and combine token logos into your dapp!
Why Ought to You Use Moralis to Get and Combine Crypto Logos Into Your Dapps?
Now that you understand how to get token logos, let’s additionally briefly focus on a number of the advantages of utilizing Moralis to combine this info into your dapps!
Highest Token Brand Protection: Whereas a number of different API suppliers additionally present logos, Moralis options one of the best token protection. Furthermore, since we add logos to all our Token API endpoints, you don’t need to make any further calls.
Enhance Your Dapp’s Consumer Expertise: Cryptocurrencies are an vital element of most dapps, and including logos to your tasks can considerably enhance the consumer expertise. This can result in greater consumer worth and enhanced buyer retention. Increase Consumer Engagement: Crypto logos can considerably increase consumer engagement by contributing a visually interesting interface. This can make your customers extra more likely to work together with and return to your dapp.
Crypto Logos Use Circumstances
Nearly all dapps can profit considerably from token logos, making this characteristic important in most conditions. Nevertheless, to present you some examples, let’s have a look at three outstanding use instances:
Portfolio View: Cryptocurrency wallets and portfolio trackers sometimes characteristic portfolio views, giving customers an outline of all their token holdings. To offer a compelling consumer expertise, it is best to at all times embody crypto logos to make the interface extra visually interesting:
Token Pages: One other outstanding use case for crypto logos is token pages – which give customers extra perception into the efficiency of digital belongings:
Token Lists: Platforms like DEXs, token explorers, and different analytics platforms sometimes characteristic huge lists of tokens. By integrating logos, these lists turn out to be extra visually partaking, which might contribute to activating customers:
Past the Token API – Diving Deeper Into Moralis
Along with Moralis’ Token API, we provide a complete suite of different industry-leading interfaces. As such, let’s dive a bit deeper into three further APIs you’ll probably discover helpful in your improvement endeavors:
Pockets APINFT APIStreams API
If you wish to discover all our obtainable interfaces, please take a look at our Web3 API web page!
Pockets API
Moralis’ Pockets API boasts a formidable array of options, distinctive flexibility, and unparalleled scalability. And it stands out because the {industry}’s premier interface for anybody trying to combine pockets performance into their dapps!
With single endpoints, you should use the Pockets API to fetch the token balances, buying and selling historical past, internet value, profitability, and many others., of any pockets. As such, when utilizing this top-tier device, you’ll be able to seamlessly construct all the pieces from cryptocurrency wallets to portfolio trackers with out breaking a sweat.
To focus on the accessibility of the Pockets API, let’s have a look at our endpoint for fetching the web value of a pockets:
import fetch from ‘node-fetch’;
const choices = {
methodology: ‘GET’,
headers: {
settle for: ‘software/json’,
‘X-API-Key’: ‘YOUR_API_KEY’
},
};
fetch(‘https://deep-index.moralis.io/api/v2.2/wallets/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/net-worth?exclude_spam=true&exclude_unverified_contracts=true’, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
All it’s important to do is exchange YOUR_API_KEY, configure the parameters to suit your question, and execute the code. In return, you’ll get the web value of the pockets in a single question with out having to cope with any guide information aggregation your self. Right here’s an instance of what it would appear like:
{
“total_networth_usd”: “4286806.08”,
“chains”: [
{
“chain”: “eth”,
“native_balance”: “1085515469813080189177”,
“native_balance_formatted”: “1085.515469813080189177”,
“native_balance_usd”: “3550067.16”,
“token_balance_usd”: “735008.04”,
“networth_usd”: “4285075.20”
},
{
“chain”: “polygon”,
“native_balance”: “426857449018746625825”,
“native_balance_formatted”: “426.857449018746625825”,
“native_balance_usd”: “445.31”,
“token_balance_usd”: “1285.57”,
“networth_usd”: “1730.88”
}
]
}
NFT API
Moralis’ NFT API is the last word device for anybody trying to streamline NFT information integration of their dapps. This premier interface helps over three million NFT collections and counting throughout all main EVM chains, together with all the pieces from established tasks to tokens that dropped simply seconds in the past!
With the NFT API, you solely want single traces of code to get enriched metadata, real-time NFT transfers, on-chain costs, and far more. Consequently, this premier interface lets you seamlessly construct all the pieces from NFT marketplaces to Web3 video games.
To showcase the accessibility and energy of the NFT API, let’s have a look at our endpoint for querying the metadata of a token:
import Moralis from ‘moralis’;
attempt {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});
const response = await Moralis.EvmApi.nft.getNFTMetadata({
“chain”: “0x1”,
“handle”: “0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB”,
“tokenId”: “1”
});
console.log(response.uncooked);
} catch (e) {
console.error(e);
}
Merely exchange YOUR_API_KEY, configure the question parameters, and execute the script. In return, you’ll get a response comprising the token’s metadata. Right here’s an instance of what it would appear like:
{
“quantity”: “1”,
“token_id”: “1”,
“token_address”: “0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb”,
“contract_type”: “CRYPTOPUNKS”,
“owner_of”: “0xffa914c83d851b9fe372e4ba6a6e131373aa16ab”,
“last_metadata_sync”: “2024-03-31T10:21:26.907Z”,
“last_token_uri_sync”: “2024-03-31T10:21:26.823Z”,
“metadata”: “{“picture”:”https://www.larvalabs.com/cryptopunks/cryptopunk001.png”,”title”:”CryptoPunk 001″,”attributes”:[“Smile”,”Mohawk”],”description”:”Male”}”,
“block_number”: “16079985”,
“block_number_minted”: “3918216”,
“title”: “CRYPTOPUNKS”,
“image”: “Ͼ”,
“token_hash”: “a99d02058e62e327e79aabd57e0b88a3”,
“token_uri”: “Invalid uri”,
“minter_address”: “0xc352b534e8b987e036a93539fd6897f53488e56a”,
“verified_collection”: true,
“possible_spam”: false,
“collection_logo”: “https://i.seadn.io/gae/BdxvLseXcfl57BiuQcQYdJ64v-aI8din7WPk0Pgo3qQFhAUH-B6i-dCqqc_mCkRIzULmwzwecnohLhrcH8A9mpWIZqA7ygc52Sr81hE?w=500&auto=format”,
“collection_banner_image”: “https://i.seadn.io/gae/48oVuDyfe_xhs24BC2TTVcaYCX7rrU5mpuQLyTgRDbKHj2PtzKZsQ5qC3xTH4ar34wwAXxEKH8uUDPAGffbg7boeGYqX6op5vBDcbA?w=500&auto=format”
}
Streams API
The Streams API is the right device for integrating real-time alerts into your dapps. With a number of traces of code, you should use this premier API to arrange streams and get instantaneous, customizable updates despatched on to your tasks’ backends by way of webhooks. Additionally, the Streams API helps over 44 million contracts and covers all sorts of occasions, tokens, NFTs, wallets, and many others.
So, how does the Streams API work?
Nicely, due to the accessibility of this API, now you can arrange a stream in three easy steps:
Step 1: Configure your stream by selecting the chains you’re focused on, selecting the occasions you want to monitor, and including a webhook vacation spot:
Step 2: Add your stream and get a check webhook in return:
Step 3: Add one to 100 million addresses to your stream and watch the information roll in:
To be taught extra about this course of, take a look at our official Streams API documentation web page!
Abstract: Learn how to Get Crypto Logos with an API
The best method to get and combine token logos into your dapp is to leverage Moralis. We’ve integrated token brand protection throughout our complete Token API, so all our responses are enriched with logos. This implies you solely have to name one among our endpoints for balances, transfers, or metadata, and also you’ll mechanically get crypto logos with out breaking a sweat!
However why do you have to use Moralis to get crypto logos?
Unparalleled Token Protection: Moralis presents distinctive protection, supporting extra tokens than rivals like Alchemy and QuickNode. Increase Engagement: You may seamlessly increase consumer engagement by incorporating visuals into your dapp. Enhance Your Dapp’s Consumer Expertise: Including token logos to your tasks will create a extra interesting interface, which results in a extra compelling consumer expertise.
So, in case you have adopted alongside this far, you now know the way to seamlessly get crypto logos with Moralis!
Should you favored this information on the way to get crypto logos, contemplate studying extra content material right here on the weblog. As an illustration, take a look at our information on SOC 2 in Web3 or discover one of the best Alchemy API alternate options. Additionally, don’t neglect to enroll with Moralis. You may create an account at no cost, and also you’ll achieve instantaneous entry to instruments just like the Token API so you’ll be able to enrich your dapp with crypto logos!
[ad_2]
Source link