-
Notifications
You must be signed in to change notification settings - Fork 11
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
Conversation
converted to draft to improve performance |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use utils file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
count: Int! | ||
totalCount: Int! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this 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
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() : '' |
There was a problem hiding this 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
implements
#243
on stick