🏆 FXHash collectors

Project Name or ID


💡 Enter a fxhash project name ID to show its collectors


This tool is created by Mark Knol.
Buy me a coffee ☕ 2.5tz

Marketplace stats
${statsHTML}
`; output.innerHTML += `
` + leaderboard.map((item,idx) => `
🏆 ${idx+1}

${getOwner(item)} (${item.total})

${item.objkts.map(objkt => ``).join("")}
`).join('') + `
`; output.innerHTML += ``; output.innerHTML += ``; output.innerHTML += ``; let marketPlaceHTMl = ""; if (project.market_stat.listed > 0) { marketPlaceHTMl += `
`; if(project.chain !== "TEZOS") marketPlaceHTMl += `
Floor sweeping not supported for ${project.chain.toLowerCase()}.
`; else marketPlaceHTMl += `
See what others are sweeping 👀`; marketplaceObjkts.forEach(item => item.objkts.sort((a,b) => { if (a.active_listings && b.active_listings) return a.active_listings.price - b.active_listings.price; else return 0; })); marketPlaceHTMl += `
` + marketplaceObjkts.map((marketplace,idx) => `
🏪

${getOwner(marketplace)} (${marketplace.total})

${marketplace.objkts.map(objkt => ` `).join("")}
`).join('') + `
` marketPlaceHTMl += `
`; // .marketplace-wrapper objktsOnFxMarketPlace.sort((a,b) => a.active_listings.price - b.active_listings.price); marketPlaceHTMl += `

${project.name} — fxhash marketplace

` marketPlaceHTMl += `
` + objktsOnFxMarketPlace.map(objkt => `


#${objkt.name.split('#').pop()}

owned by ${getOwner(objkt.owner)}
Price: ${tez(objkt.active_listings.price)}
`).join('') + `
`; } else { marketPlaceHTMl = `

Nothing to see here


😅️ It kinda looks like this project is sold out? Maybe try again tomorrow.







`; } output.innerHTML += ``; owners.innerHTML += `
wallet,totalwallet,token id,amount`; artworks.innerHTML = `` + artworks.innerHTML; /* let footerNav = `
`; output.innerHTML += footerNav; */ requestAnimationFrame(() => { let locationHash = location.hash.substr(1); console.log(locationHash); let hashOptions = ['page=ranking','page=artworks','page=owners','page=marketplace']; let hashOption = hashOptions.includes(locationHash) ? locationHash : hashOptions[0]; let firstPage = hashOption.replace("page=",''); show(firstPage, [...document.querySelectorAll('nav button')][hashOptions.indexOf(hashOption)]); }); } function updateMarketplace() { let selectedIds = [...document.querySelectorAll(".marketplace-item input[type=checkbox]:checked")].map(checkbox => (checkbox.dataset.id)); let selectedObjkts = project.objkts.filter(objkt => selectedIds.includes(objkt.id)); let listings = selectedObjkts.map(objkt => ({...objkt, objktId:objkt.id, ...objkt.active_listings, gentkContractAddress:objkt.gentkContractAddress})); let totalPrice = listings.reduce((v,l)=> v += parseInt(l.price), 0); basket.innerHTML = `

🛒 Cart

` + listings.map(objkt => `${objkt.name}: ${tez(objkt.price)}`).join('
') + `
` if (selectedObjkts.length > 0) { basket.innerHTML += `
Total: ${tez(totalPrice)}
`; basket.innerHTML += `` let needsToPayFee = true;//payFeeCheckbox.checked; buyButton.onclick = () => collectListings(listings, needsToPayFee ? [{ kind: beacon.TezosOperationType.TRANSACTION, destination: "tz1gU8X5YHwaMewFkbobgKsCMjJUeZkRw2dH", amount: Math.max(totalPrice == 0 ? listings.length * 10000 : (totalPrice * 0.01), 10), }] : []); } } async function customConfirm(listings) { let html = `
`; for(let listing of listings) { html += `
#${listing.name.split("#").pop()} ${tez(listing.price)}
`; } html += `
`; html += `
`; html += `
`; document.body.innerHTML += html; const onButtonClick = async (button, onClicked, getResult) => new Promise(onConfirm => button.onclick = () => ( onConfirm(getResult()),onClicked())); const updateTotal = () => cartTotalLabel.innerText = `Total: ${tez(listings.reduce((v,l)=>v+=l.price,0))}`; updateTotal(); [...document.querySelectorAll(".cart-item .removeCartItemButton")].forEach(button => { button.onclick = () => { listings = listings.filter(listing => listing.id != button.dataset.listingId); button.closest(".cart-item").remove(); updateTotal(); } }); function onClosePopup() { document.querySelector(".cart-popup").remove(); } return await Promise.any([ onButtonClick(cartConfirmButton, onClosePopup, () => listings), onButtonClick(confirmCloseButton, onClosePopup, () => []), onButtonClick(cartCancelButton, onClosePopup, () => []), ]); } async function collectFloor(collectionId) { let MAX = 100; let amount = parseInt(prompt(`How many? (max ${MAX})`)); if (amount && !isNaN(amount) && amount > 0) { [...document.querySelectorAll(".marketplace-item input[type=checkbox]")].filter((_,idx)=>idxcb.checked=true); updateMarketplace(); return; amount = Math.min(amount, MAX); let queryData = await graphql("FxListingQuery", project.id, amount); let activeListedObjkts = queryData.data.generativeToken.activeListedObjkts; activeListedObjkts.forEach(objkt => objkt.activeListing.thumbnailUri = project.entireCollection.find(o => o.id == objkt.id).metadata.thumbnailUri); let listings = activeListedObjkts.map(objkt => ({...objkt.active_listings, name: objkt.name, gentkContractAddress: objkt.gentkContractAddress})); listings = listings.filter((_,idx) => idx < amount); listings = await customConfirm(listings); console.log(listings); if (listings.length) { // if (await confirm(`You are going to collect: \n${listings.map(l=>` * ${l.name} (${tez(l.price)})`).join("\n")}\n Total: ${tez(listings.reduce((v,l)=>v+=l.price,0))}`)) { collectListings(listings); } } else { alert("Invalid input, try again!"); } } function getListingFA2Contract(listing) { console.log(listing); if (listing.gentkContractAddress) { //return listing.gentkContractAddress; } if (listing.version === 0) { return "KT1Xo5B7PNBAeynZPmca4bRh6LQow4og1Zb9"; } else { return "KT1GbyoDi7H1sfXmimXpptZJuCdHMh66WS9u"; } } function getListingAcceptEp(listing) { if (listing.version === 0) { return "collect"; } else { return "listing_accept"; } } let dAppClient = new beacon.DAppClient({ name: "FXCollectors" }); async function collectListings(listings, feeTransactions = []) { console.log(listings); try { await dAppClient.clearActiveAccount(); } catch(e) {} let activeAccount = await dAppClient.getActiveAccount(); console.log("activeAccount", activeAccount); if (activeAccount) { console.log("Already connected:", activeAccount.address); } else { const permissions = await dAppClient.requestPermissions(); console.log("New connection:", permissions.address); activeAccount = await dAppClient.getActiveAccount(); } if (activeAccount) { try { const result = await dAppClient.requestOperation({ operationDetails: [...listings.map(listing => ({ storage_limit: `200`, kind: beacon.TezosOperationType.TRANSACTION, source: activeAccount.address, amount: `${listing.price}`, destination: getListingFA2Contract(listing), parameters: { entrypoint: getListingAcceptEp(listing), value: { int: `${listing.id}`, }, } })), ...feeTransactions], }); alert(`Congrats! You've bought ${listings.map(l => l.name).join(", ")} for ${tez(listings.reduce((v,l) => v+=l.price, 0))}. It will show up in your wallet within minutes.`); } catch(e) { console.error(e); } } } function downloadThumbnails() { if (confirm("You will be downloading all images separately, this can take some time and cannot be stopped, sure?")) { if (!document.getElementById("downloadlist")) { output.innerHTML += ``; let html = ""; objkts.forEach(objkt => html += `` ); downloadlist.innerHTML = html; } let delay=0; [...document.querySelectorAll('#downloadlist img')].forEach(image => { image.onclick = () => { var imgCanvas = document.createElement("canvas"), imgContext = imgCanvas.getContext("2d"); imgCanvas.width = image.width; imgCanvas.height = image.height; imgContext.drawImage(image, 0, 0, image.width, image.height); var imgAsDataURL = imgCanvas.toDataURL(); var element = document.createElement('a'); element.setAttribute('href', imgAsDataURL); element.setAttribute('download', image.getAttribute("download")); document.body.appendChild(element); element.click(); } setTimeout(() => image.onclick(), 2500 + (delay++) * 200); }); } } function getThumbnail(metadata, data) { if (!!data) { return data.name.split("#").pop() + ".png"; } return getImagePath(metadata.thumbnailUri); } function getImagePath(uri) { if (!uri) return ''; let hash = uri.replace("ipfs://", ""); return `https://gateway.fxhash.xyz/ipfs/${hash}`; } function show(className, button) { location.hash = "page="+className; ranking.style.display = className == "ranking" ? "block": "none"; artworks.style.display = className == "artworks" ? "block": "none"; owners.style.display = className == "owners" ? "block": "none"; marketplace.style.display = className == "marketplace" ? "block": "none"; [...document.querySelectorAll('nav button')].forEach(button => button.classList.remove('active')); if (button) button.classList.add('active'); else document.querySelector('#button_'+className).classList.add('active'); } function getSalesFeed(className, button) { show(className, button); salesFeed.innerHTML = '

Loading..

'; //graphql(''), } window.onhashchange = () => { show(location.hash.replace('#page=',''), null) } function isMarketPlace(objkt) { let id = objkt.owner.id; let isMarketPlaceId = id.startsWith("KT"); let isForSale = !!objkt.active_listings; return isMarketPlaceId || isForSale; } function toMutez(tez) { return (tez * 1000000); } function toTez(mutez) { return (mutez / 1000000); } function toEth(unit) { return (unit / 1e18); } function tez(price, chain = project.chain) { let currency = (chain === "TEZOS") ? "tz" : "eth"; let convertedPrice = (chain === "TEZOS") ? toTez(price) : toEth(price); let out = (convertedPrice).toFixed(2) + currency; if (out.endsWith(".00" + currency)) return out.replace(".00" + currency, currency); return out; } function sanitize(value) { return value .replaceAll("&","&") .replaceAll(">",">") .replaceAll("<","<") .replaceAll("'","'") .replaceAll('"',"""); } function median(numbers) { if (numbers.length === 0) return 0; const sorted = [...numbers].sort((a, b) => a - b); const middle = Math.floor(sorted.length / 2); if (sorted.length % 2 === 0) { return (sorted[middle - 1] + sorted[middle]) / 2; } return sorted[middle]; } function getShortWallet(id) { return `${id.substr(0,5)}...${id.substr(id.length-5,5)}`; } function getOwner(user, internal = true, postfix = '', className = 'username') { let html = ''; let {id,name,flag,collaborations} = user; if (collaborations && collaborations.length) { return collaborations.map(collaborator => getOwner(collaborator.user,internal,postfix, className)).join(' and '); } if (flag === 'SUSPICIOUS' || flag === 'MALICIOUS' || flag === 'REVIEW') { className += ' sus-user'; console.log('sus',user); } let linkUrl = ''; let linkText = ''; let flagText = ''; if (id == "KT1FvqJwEDWb1Gwc55Jd1jjTHRVWbYKUUpyq") { linkUrl = `https://objkt.com/search?search=${projectName}&sortBy=askAsc&fa2=KT1KEa8z6vWXDJrVqtMrAeDVzsvxat3kHaCE`; linkText = 'objkt.com marketplace'; } else if (id == "KT1Xo5B7PNBAeynZPmca4bRh6LQow4og1Zb9" || id == "KT1GbyoDi7H1sfXmimXpptZJuCdHMh66WS9u") { linkUrl = `https://www.fxhash.xyz/marketplace/generative/${projectID}`; linkText =`fxhash marketplace`; } else if (id.startsWith("KT")) { linkUrl = `https://www.fxhash.xyz/pkh/${id}`; linkText = `Unknown contract (${getShortWallet(id)})`; } else{ if (name) { linkUrl = `https://www.fxhash.xyz/u/${encodeURIComponent(name)}`; linkText = sanitize(name); } else { linkText = getShortWallet(id); if (id.startsWith("0x")) { linkUrl = `https://www.fxhash.xyz/u/${id}`; } else { linkUrl = `https://www.fxhash.xyz/pkh/${id}`; } } if (flag === 'VERIFIED') { flagText = ``; } } return `${linkText}${flagText}${postfix}`; } function lsTest() { var test = 'localstorage-works'; try { localStorage.setItem(test, test); localStorage.removeItem(test); return true; } catch(e) { return false; } }