Skip to content
This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Commit e61d982

Browse files
Merge pull request #23 from mikesizz/feature/hide-burned-nft
Remove burned NFTs from creation list
2 parents 142084d + 891e174 commit e61d982

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

index.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const cors = require('cors')
55
const _ = require('lodash')
66
const conseilUtil = require('./conseilUtil')
77
const { random } = require('lodash')
8+
9+
const BURN_ADDRESS = 'tz1burnburnburnburnburnburnburjAYjjX'
10+
811
require('dotenv').config()
912

1013
const reducer = (accumulator, currentValue) => parseInt(accumulator) + parseInt(currentValue)
@@ -202,9 +205,28 @@ const getTzLedger = async (tz, res) => {
202205

203206
console.log(hdao)
204207

208+
var validCreations = []
209+
210+
await Promise.all(creations.map(async (c) => {
211+
c.token_id = c.objectId
212+
213+
await owners(c)
214+
215+
var burnAddrCount = c.owners[BURN_ADDRESS]
216+
var allIssuesBurned = burnAddrCount && burnAddrCount === c.total_amount
217+
218+
if (!allIssuesBurned) {
219+
delete c.owners
220+
221+
validCreations.push(c)
222+
}
223+
224+
return arr
225+
}))
226+
205227
var arr = []
206-
console.log([...collection, ...creations])
207-
var arr = [...collection, ...creations]
228+
console.log([...collection, ...validCreations])
229+
var arr = [...collection, ...validCreations]
208230

209231
var result = arr.map(async e => {
210232
e.token_info = await getIpfsHash(e.ipfsHash)

0 commit comments

Comments
 (0)