diff --git a/docs/cadence_migration_guide/nft-guide.mdx b/docs/cadence_migration_guide/nft-guide.mdx index 42d1c5b..3e29be3 100644 --- a/docs/cadence_migration_guide/nft-guide.mdx +++ b/docs/cadence_migration_guide/nft-guide.mdx @@ -459,7 +459,7 @@ so they can query collections to get the updated metadata to show in their user ```cadence access(all) event Updated(type: String, id: UInt64, uuid: UInt64, owner: Address?) - access(contract) view fun emitNFTUpdated(_ nftRef: auth(Update | Owner) &{NonFungibleToken.NFT}) + access(all) view fun emitNFTUpdated(_ nftRef: auth(Update | Owner) &{NonFungibleToken.NFT}) { emit Updated(type: nftRef.getType().identifier, id: nftRef.id, uuid: nftRef.uuid, owner: nftRef.owner?.address) } @@ -468,10 +468,9 @@ so they can query collections to get the updated metadata to show in their user As you can see, it requires an authorized reference to an NFT, so only the owner of and NFT can call this to emit an event. Additionally, as is noted in the example below, you have to use your own contract's name to call the function because the code -that emits the event is a default implementation of an `access(contract)` function. +that emits the event is a default implementation that can only be accessed from an implementation. -This restriction is to make it so only the code in your contract can call the function -to emit the events about your NFT. DO NOT Re-implement the `emitNFTUpdated` function +DO NOT Re-implement the `emitNFTUpdated` function in your contract or you will lose access to the ability to emit the standard event. This function could be called from within a `Collection` diff --git a/versioned_docs/version-1.0/cadence_migration_guide/nft-guide.mdx b/versioned_docs/version-1.0/cadence_migration_guide/nft-guide.mdx index 42d1c5b..3e29be3 100644 --- a/versioned_docs/version-1.0/cadence_migration_guide/nft-guide.mdx +++ b/versioned_docs/version-1.0/cadence_migration_guide/nft-guide.mdx @@ -459,7 +459,7 @@ so they can query collections to get the updated metadata to show in their user ```cadence access(all) event Updated(type: String, id: UInt64, uuid: UInt64, owner: Address?) - access(contract) view fun emitNFTUpdated(_ nftRef: auth(Update | Owner) &{NonFungibleToken.NFT}) + access(all) view fun emitNFTUpdated(_ nftRef: auth(Update | Owner) &{NonFungibleToken.NFT}) { emit Updated(type: nftRef.getType().identifier, id: nftRef.id, uuid: nftRef.uuid, owner: nftRef.owner?.address) } @@ -468,10 +468,9 @@ so they can query collections to get the updated metadata to show in their user As you can see, it requires an authorized reference to an NFT, so only the owner of and NFT can call this to emit an event. Additionally, as is noted in the example below, you have to use your own contract's name to call the function because the code -that emits the event is a default implementation of an `access(contract)` function. +that emits the event is a default implementation that can only be accessed from an implementation. -This restriction is to make it so only the code in your contract can call the function -to emit the events about your NFT. DO NOT Re-implement the `emitNFTUpdated` function +DO NOT Re-implement the `emitNFTUpdated` function in your contract or you will lose access to the ability to emit the standard event. This function could be called from within a `Collection`