Skip to content

Commit 11875c6

Browse files
committed
add minted event to ExampleNFT
1 parent 66ce9ca commit 11875c6

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

contracts/ExampleNFT.cdc

+19
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ access(all) contract ExampleNFT: NonFungibleToken {
2626
/// The standard paths for the collection are stored in the collection resource type
2727
access(all) let MinterStoragePath: StoragePath
2828

29+
/// Event to show when an NFT is minted
30+
access(all) event Minted(
31+
type: String,
32+
id: UInt64,
33+
uuid: UInt64,
34+
minterAddress: Address?,
35+
minterUUID: UInt64,
36+
name: String,
37+
description: String
38+
)
39+
2940
/// We choose the name NFT here, but this type can have any name now
3041
/// because the interface does not require it to have a specific name any more
3142
access(all) resource NFT: NonFungibleToken.NFT {
@@ -396,6 +407,14 @@ access(all) contract ExampleNFT: NonFungibleToken {
396407
metadata: metadata,
397408
)
398409

410+
emit Minted(type: newNFT.getType().identifier,
411+
id: newNFT.id,
412+
uuid: newNFT.uuid,
413+
minterAddress: self.owner?.address,
414+
minterUUID: self.uuid,
415+
name: name,
416+
description: description)
417+
399418
return <-newNFT
400419
}
401420
}

flow.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@
132132
"mainnet": {
133133
"mainnet-nft": [
134134
"MetadataViews",
135-
"NonFungibleToken"
135+
"NonFungibleToken",
136+
"CrossVMMetadataViews"
136137
]
137138
}
138139
}

0 commit comments

Comments
 (0)