Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
osipov-mit committed Oct 20, 2023
1 parent 8885fc1 commit 8cecd2e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
27 changes: 17 additions & 10 deletions src/batchState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,32 @@ export class BatchState {
tokenId: string,
collection: NftCollection,
ownerAddress: string,
description: string,
name: string,
mediaUrl: string,
attribUrl: string[],
blockNumber: bigint,
timestamp: Date,
description?: string,
name?: string,
mediaUrl?: string,
blockNumber?: bigint,
timestamp?: Date,
mint = true,
) {
const id = `${collection.id}-${tokenId}`;

const owner = await this.getAccount(ownerAddress);
let nft = mint
? new Nft({ id, collection, mintedAt: timestamp, mintedAtBlock: blockNumber, tokenId, transfers: [] })
? new Nft({
id,
collection,
mintedAt: timestamp,
mintedAtBlock: blockNumber,
tokenId,
transfers: [],
mediaUrl,
name,
description,
owner,
})
: await this.getNft(id);

nft.owner = owner;
nft.description = description;
nft.name = name;
nft.mediaUrl = mediaUrl;
nft.attribUrl = attribUrl;

this.nfts.set(`${collection.id}-${tokenId}`, nft);
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/cb-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export async function cbNftHandler(
tokenId,
collection,
owner.toHex(),
collection.description,
collection.name + ' - ' + media.toString(),
linkIsFull ? link.toString() : `${link.toString()}/${tokenId}.png`,
activities.map(([name, times, ts]) => {
const timesFormatted = name.toString() === 'NFT minted' ? ', ' : ` ${times.toString()} times, `;
const date = getDate(ts.toString());
const dateFormatted = name.toString() === 'NFT minted' ? `date: ${date}` : `last game date: ${date}`;
return `${name}${timesFormatted}${dateFormatted}`;
}),
collection.description,
collection.name + ' - ' + media.toString(),
linkIsFull ? link.toString() : `${link.toString()}/${tokenId}.png`,
blockNumber,
ts,
data.isMinted,
Expand Down

0 comments on commit 8cecd2e

Please sign in to comment.