-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avalanche Ranker #1
Comments
Glad you like it @ericlam1114! You can check out the Moralis documentation for getting NFT collections here: https://docs.moralis.io/moralis-server/web3-sdk/token#getalltokenids But essentially to get NFT collections on AVAX just pass as a parameter avax chain to the |
Thanks for your help @IAmJaysWay i'm trying to show this collection. https://twitter.com/Avaxdogs?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor this is my code... `const Moralis = require("moralis/node"); const serverUrl = "https://wurgiuz7dwbk.usemoralis.com:2053/server"; //Moralis Server Url here const resolveLink = (url) => { const collectionAddress = "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d"; //Collection Address Here async function generateRarity() { ; const totalNum = NFTs.total; const timer = (ms) => new Promise((res) => setTimeout(res, ms)); for (let i = pageSize; i < totalNum; i = i + pageSize) { let metadata = allNFTs.map((e) => JSON.parse(e.metadata).attributes); let tally = { TraitCount: {} }; for (let j = 0; j < metadata.length; j++) {
} const collectionAttributes = Object.keys(tally);
} nftArr.sort((a, b) => b.Rarity - a.Rarity); for (let i = 0; i < nftArr.length; i++) {
} generateRarity();` do you know why it's not working properly? am i using moralis wrong? |
I tried using the avalanche chain code for the avax testnet too avalanche testnet, 0xa869 that one. still nothin. sorry for the sporadic updates. really trying to figure this out. so excited at the possibilities!! |
Hey @ericlam1114, I opened this back up and will have a look on it today and come back to you with any updates :) |
import fetch from "node-fetch"; const serverUrl = "";//Server URL Here const resolveLink = (url) => { const collectionAddress = "0x2cca3a1a45c1b1036d7194cd15a981b8c2f9dee4"; //Collection Address Here async function generateRarity() { let totalNum = NFTs.total;//NFTs.total; const timer = (ms) => new Promise((res) => setTimeout(res, ms)); for (let i = pageSize; i < totalNum; i = i + pageSize) { let metadata = await Promise.all(allNFTs.map(async (e) => { console.log(metadata); let tally = { TraitCount: {} }; for (let j = 0; j < metadata.length; j++) {
} const collectionAttributes = Object.keys(tally);
} nftArr.sort((a, b) => b.Rarity - a.Rarity); for (let i = 0; i < nftArr.length; i++) {
} generateRarity(); |
@ericlam1114 this seems to work :), I think you may have had the wrong contract address for the nft collection... I also added a manual fetch of the metadata for when there is missing metadata in the web3 api call so for that to work you will have to add :
into the Hope this works for you |
Here is my code. https://github.com/ericlam1114/Rarity-Ranking-NFT |
Hey sir it is great to build this one and everything is working nice in app but one question in rarity tools there is trait rarity ,statistical rarity , average rarity can u update repo or give the mathematical calculations to calculate these rarity score.. bcz I search but I don't get these calculations method |
@ericlam1114 when you run the generator are the NFTs being saved in your database in the AvalancheDogsReborn class? |
@Lalaji23 you can view the video on Moralis youtube channel as to how this generator calculates rarity :)https://www.youtube.com/watch?v=TXpfRRHwjak&t=1s |
They don’t appear to be, no. Does my code attached previously help?
…Sent from my iPhone
On Jan 7, 2022, at 3:52 AM, IAmJaysWay ***@***.***> wrote:
@ericlam1114 when you run the generator are the NFTs being saved in your database in the AvalancheDogsReborn class?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Hey. This is amazing. Thank you so much for your work.
How do we get this to work with avalanche instead of ethereum?
The text was updated successfully, but these errors were encountered: