Skip to content
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

TokenEntity/fix count calculation #109

Merged
merged 6 commits into from
Oct 12, 2023

Conversation

daiagi
Copy link
Contributor

@daiagi daiagi commented Oct 4, 2023

implements
#243
on stick

@daiagi daiagi requested a review from vikiival October 4, 2023 14:11
@daiagi
Copy link
Contributor Author

daiagi commented Oct 4, 2023

image

Burnt nft are kept but the count gets decremented

image

set metadata unlinks nft from token and add it to pre existing token or creates a new one

image

@daiagi daiagi changed the title Token enityt/fix count calc TokenEntity/fix count calculation Oct 4, 2023
@daiagi daiagi marked this pull request as draft October 4, 2023 16:59
@daiagi
Copy link
Contributor Author

daiagi commented Oct 4, 2023

converted to draft to improve performance

@daiagi daiagi marked this pull request as ready for review October 6, 2023 03:55
Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned in #110

import { Context } from '../utils/types'

const OPERATION = 'TokenEntity' as any

export async function handleTokenEntity(context: Context, collection: CE, nft: NE): Promise<TE | undefined> {
const nftMedia = nft.image || nft.media
function generateTokenId(collectionId: string, nftMedia: string): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use utils file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Comment on lines 40 to +41
count: Int!
totalCount: Int!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use same wording as collection has

count for total
supply for available

Screenshot 2023-10-06 at 12 04 10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok
so supply is only not burned
count is all

yes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes?

YES

}

async function createToken(context: Context, collection: CE, nft: NE): Promise<TE | undefined> {
const nftMedia = nft.image ?? nft.media
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned in #110

if (!nftMedia || nftMedia === '') {
warn(OPERATION, `MISSING NFT MEDIA ${nft.id}`)
return
}
const tokenId = generateTokenId(collection.id, nftMedia)
debug(OPERATION, { createToken: `Create TOKEN ${tokenId} for NFT ${nft.id}` })
const tokenName = typeof nft.name === 'string' ? nft.name?.replace(/([#_]\d+$)/g, '').trim() : ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned in #110

@vikiival
Copy link
Member

@daiagi still valid if I merge #110 ?

@vikiival vikiival merged commit ef65343 into kodadot:main Oct 12, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants