From e839afee2226d76a8ae6384bf1f2f695a3c765a1 Mon Sep 17 00:00:00 2001 From: roiLeo Date: Thu, 11 Jan 2024 16:14:53 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20mint=20send=5Fto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mappings/nfts/mint.ts | 13 ++++++++----- src/mappings/uniques/mint.ts | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/mappings/nfts/mint.ts b/src/mappings/nfts/mint.ts index 34384147..4d03a337 100644 --- a/src/mappings/nfts/mint.ts +++ b/src/mappings/nfts/mint.ts @@ -70,9 +70,12 @@ export async function handleTokenCreate(context: Context): Promise { success(OPERATION, `${final.id}`) await context.store.save(final) await context.store.save(collection) - await createEvent(final, OPERATION, event, '', context.store) - - if (final.issuer !== final.currentOwner) { - await createEvent(final, Action.SEND, event, final.currentOwner, context.store, final.issuer) - } + await createEvent( + final, + OPERATION, + event, + final.issuer !== final.currentOwner ? final.currentOwner : '', + context.store, + final.issuer !== final.currentOwner ? final.issuer : undefined + ) } diff --git a/src/mappings/uniques/mint.ts b/src/mappings/uniques/mint.ts index 6a450b61..19ad0568 100644 --- a/src/mappings/uniques/mint.ts +++ b/src/mappings/uniques/mint.ts @@ -68,9 +68,12 @@ export async function handleTokenCreate(context: Context): Promise { success(OPERATION, `${final.id}`) await context.store.save(final) await context.store.save(collection) - await createEvent(final, OPERATION, event, '', context.store) - - if (final.issuer !== final.currentOwner) { - await createEvent(final, Action.SEND, event, final.currentOwner, context.store, final.issuer) - } + await createEvent( + final, + OPERATION, + event, + final.issuer !== final.currentOwner ? final.currentOwner : '', + context.store, + final.issuer !== final.currentOwner ? final.issuer : undefined + ) } From 717202aa94a826a43eb1e104f7e7b6f3e65455e4 Mon Sep 17 00:00:00 2001 From: Viki Val Date: Fri, 12 Jan 2024 11:09:05 +0100 Subject: [PATCH 2/2] :technologist: bit better readability --- src/mappings/nfts/mint.ts | 5 ++++- src/mappings/uniques/mint.ts | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mappings/nfts/mint.ts b/src/mappings/nfts/mint.ts index 4d03a337..37d5bbd9 100644 --- a/src/mappings/nfts/mint.ts +++ b/src/mappings/nfts/mint.ts @@ -70,11 +70,14 @@ export async function handleTokenCreate(context: Context): Promise { success(OPERATION, `${final.id}`) await context.store.save(final) await context.store.save(collection) + + const destinationAddress = final.issuer !== final.currentOwner ? final.currentOwner : '' + await createEvent( final, OPERATION, event, - final.issuer !== final.currentOwner ? final.currentOwner : '', + destinationAddress, context.store, final.issuer !== final.currentOwner ? final.issuer : undefined ) diff --git a/src/mappings/uniques/mint.ts b/src/mappings/uniques/mint.ts index 19ad0568..be8b57e9 100644 --- a/src/mappings/uniques/mint.ts +++ b/src/mappings/uniques/mint.ts @@ -65,6 +65,8 @@ export async function handleTokenCreate(context: Context): Promise { await mintHandler(context, collection, final) + const destinationAddress = final.issuer !== final.currentOwner ? final.currentOwner : '' + success(OPERATION, `${final.id}`) await context.store.save(final) await context.store.save(collection) @@ -72,7 +74,7 @@ export async function handleTokenCreate(context: Context): Promise { final, OPERATION, event, - final.issuer !== final.currentOwner ? final.currentOwner : '', + destinationAddress, context.store, final.issuer !== final.currentOwner ? final.issuer : undefined )