You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often use Zerion Wallet and noticed that NFT prices sometimes deviate from actual market prices. I couldn't find an API library for real-time price validation, and after some research, I believe this functionality could be useful to add. From what I understand, the Zerion API is hosted at https://api-staging.zerion.io (as per the URL in the code snippet you provided). This got me thinking: we could build a parallel system that checks the current prices of NFTs across various trusted marketplaces.
The issue is that the prices of NFTs provided by Zerion sometimes do not match the prices on popular NFT marketplaces. I propose a solution that will:
Fetch NFT prices from Zerion.
Compare those prices with real-time prices from several trusted marketplaces (OpenSea, Zora, SuperRare, MagicEden, NFTScan, etc.).
Display the price that is most commonly found across these marketplaces.
Zerion’s internal API is used to fetch initial NFT price data.
A parallel system will pull NFT prices from various trusted sources like OpenSea, Zora, SuperRare, MagicEden, NFTScan, and others.
The price discrepancies between Zerion and these sources will be identified.
The final price will be determined by comparing prices across the sources, choosing the price that appears most frequently among them.
The most accurate price will then be displayed in the Zerion Wallet interface.
So, my proposal is create something like that:
Crete new axios library
Then create functions to fetch prices from different marketplaces:
Create a function to fetch and compare prices from all the marketplaces:
import { getOpenSeaPrice, getZoraPrice, getSuperRarePrice, getMagicEdenPrice, getNFTScanPrice } from './apiClients';
// Function to fetch prices from all sources
const getPricesFromPlatforms = async (tokenId) => {
const prices = await Promise.all([
getOpenSeaPrice(tokenId),
getZoraPrice(tokenId),
getSuperRarePrice(tokenId),
getMagicEdenPrice(tokenId),
getNFTScanPrice(tokenId),
// Add other API functions here if needed
]);
return prices.filter(price => price !== null);
};
// Function to get the most frequent price
const getMostFrequentPrice = (prices) => {
const priceCounts = prices.reduce((acc, price) => {
acc[price] = (acc[price] || 0) + 1;
return acc;
}, {});
return Object.entries(priceCounts).reduce((max, [price, count]) =>
count > max.count ? { price, count } : max, { price: null, count: 0 }).price;
};
// Example usage
const getNFTPrice = async (tokenId) => {
const prices = await getPricesFromPlatforms(tokenId);
if (prices.length === 0) {
return null; // No price data available
}
const mostFrequentPrice = getMostFrequentPrice(prices);
return mostFrequentPrice;
};
// Test with a sample tokenId
const tokenId = 'exampleTokenId';
getNFTPrice(tokenId).then((price) => {
console.log(`The most accurate price for NFT ${tokenId} is: ${price}`);
});
And integrate this price validation system with Zerion’s existing API to ensure that the price displayed is the most accurate one:
// zerionIntegration.js
import { client } from "../../"; // Assuming you're using Zerion's client library
import { getNFTPrice } from './priceComparison'; // Import the price comparison logic
import { address, url, apiToken } from "./config"; // Assuming these are defined elsewhere
client.configure({
url,
apiToken,
});
const currency = "usd";
client.addressPositions(
{
address,
currency,
},
{
onData: async (data) => {
const assetsToDisplay = Object.values(data.positions.positions)
.map(addressAsset => {
// Assuming `addressAsset.tokenId` is available
const tokenId = addressAsset.tokenId;
return getNFTPrice(tokenId).then((marketplacePrice) => {
return {
...addressAsset,
price: marketplacePrice || addressAsset.price, // Use marketplace price if available
};
});
})
.filter(asset => asset.value != null && asset.value > 1)
.sort((a, b) => Number(b.value) - Number(a.value));
// Wait for all the promises to resolve
Promise.all(assetsToDisplay).then((assetsWithPrices) => {
console.table(assetsWithPrices); // Display updated asset prices
});
},
}
);
By integrating this system into Zerion Wallet, users will get accurate and real-time NFT pricing data pulled from multiple trusted marketplaces. This will not only ensure the accuracy of NFT pricing displayed in Zerion but also improve user confidence in the platform.
Great wallet, great team.
Best regards
The text was updated successfully, but these errors were encountered:
Hello,
I often use Zerion Wallet and noticed that NFT prices sometimes deviate from actual market prices. I couldn't find an API library for real-time price validation, and after some research, I believe this functionality could be useful to add. From what I understand, the Zerion API is hosted at https://api-staging.zerion.io (as per the URL in the code snippet you provided). This got me thinking: we could build a parallel system that checks the current prices of NFTs across various trusted marketplaces.
The issue is that the prices of NFTs provided by Zerion sometimes do not match the prices on popular NFT marketplaces. I propose a solution that will:
Fetch NFT prices from Zerion.
Compare those prices with real-time prices from several trusted marketplaces (OpenSea, Zora, SuperRare, MagicEden, NFTScan, etc.).
Display the price that is most commonly found across these marketplaces.
Zerion’s internal API is used to fetch initial NFT price data.
A parallel system will pull NFT prices from various trusted sources like OpenSea, Zora, SuperRare, MagicEden, NFTScan, and others.
The price discrepancies between Zerion and these sources will be identified.
The final price will be determined by comparing prices across the sources, choosing the price that appears most frequently among them.
The most accurate price will then be displayed in the Zerion Wallet interface.
So, my proposal is create something like that:
Crete new axios library
Then create functions to fetch prices from different marketplaces:
Create a function to fetch and compare prices from all the marketplaces:
And integrate this price validation system with Zerion’s existing API to ensure that the price displayed is the most accurate one:
By integrating this system into Zerion Wallet, users will get accurate and real-time NFT pricing data pulled from multiple trusted marketplaces. This will not only ensure the accuracy of NFT pricing displayed in Zerion but also improve user confidence in the platform.
Great wallet, great team.
Best regards
The text was updated successfully, but these errors were encountered: