Skip to content

Commit fa9b511

Browse files
authored
Merge pull request #311 from kodadot/issue-310
fix: unlisted nfts are saved as `0` not `NULL`
2 parents 2a99fce + eadb8e2 commit fa9b511

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

src/mappings/nfts/buy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function handleTokenBuy(context: Context): Promise<void> {
2626
const originalPrice = event.price
2727
const originalOwner = entity.currentOwner ?? undefined
2828

29-
entity.price = BigInt(0)
29+
entity.price = null
3030
entity.currentOwner = event.caller
3131
entity.updatedAt = event.timestamp
3232

src/mappings/nfts/list.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function handleTokenList(context: Context): Promise<void> {
2323
const id = createTokenId(event.collectionId, event.sn)
2424
const entity = await getWith(context.store, NE, id, { collection: true })
2525

26-
entity.price = event.price
26+
entity.price = Boolean(event.price) ? event.price : null
2727

2828
if (event.price && (entity.collection.floor === 0n || event.price < entity.collection.floor)) {
2929
entity.collection.floor = event.price

src/mappings/nfts/mint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function handleTokenCreate(context: Context): Promise<void> {
4343
final.collection = collection
4444
final.sn = BigInt(event.sn)
4545
final.metadata = event.metadata || tokenUri(collection.baseUri, event.sn) || collection.metadata
46-
final.price = BigInt(0)
46+
final.price = null
4747
final.burned = false
4848
final.createdAt = event.timestamp
4949
final.updatedAt = event.timestamp

src/mappings/nfts/transfer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function handleTokenTransfer(context: Context): Promise<void> {
4141
const entity = await getWith(context.store, NE, id, { collection: true })
4242

4343
const oldOwner = entity.currentOwner
44-
entity.price = BigInt(0)
44+
entity.price = null
4545
entity.currentOwner = event.to
4646
entity.updatedAt = event.timestamp
4747

src/mappings/uniques/buy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function handleTokenBuy(context: Context): Promise<void> {
2626
const originalPrice = event.price
2727
const originalOwner = entity.currentOwner ?? undefined
2828

29-
entity.price = BigInt(0)
29+
entity.price = null
3030
entity.currentOwner = event.caller
3131
entity.updatedAt = event.timestamp
3232

src/mappings/uniques/list.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function handleTokenList(context: Context): Promise<void> {
2323
const id = createTokenId(event.collectionId, event.sn)
2424
const entity = await getWith(context.store, NE, id, { collection: true })
2525

26-
entity.price = event.price
26+
entity.price = Boolean(event.price) ? event.price : null
2727

2828
if (event.price && (entity.collection.floor === 0n || event.price < entity.collection.floor)) {
2929
entity.collection.floor = event.price

src/mappings/uniques/mint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function handleTokenCreate(context: Context): Promise<void> {
4343
final.collection = collection
4444
final.sn = BigInt(event.sn)
4545
final.metadata = event.metadata || collection.metadata
46-
final.price = BigInt(0)
46+
final.price = null
4747
final.burned = false
4848
final.createdAt = event.timestamp
4949
final.updatedAt = event.timestamp

src/mappings/uniques/transfer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function handleTokenTransfer(context: Context): Promise<void> {
2424
const entity = await getWith(context.store, NE, id, { collection: true })
2525

2626
const oldOwner = entity.currentOwner
27-
entity.price = BigInt(0)
27+
entity.price = null
2828
entity.currentOwner = event.to
2929
entity.updatedAt = event.timestamp
3030

0 commit comments

Comments
 (0)