Skip to content

Commit

Permalink
Improve explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Dec 10, 2024
1 parent 4dd0946 commit 6bba560
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions explanations/contract.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
This is a function you would include in your smart contract to create collections for accounts without them.
The createEmptyCollection function is part of the ExampleNFT contract and is used to create a new, empty collection for an account. A collection is a resource that allows users to store and manage their non-fungible tokens (NFTs) by bundling them together.

When invoked, the createEmptyCollection function creates a new instance of the Collection resource. This resource is initialized with an empty set of NFTs. The collection resource adheres to the CollectionInterface, which defines methods for depositing NFTs, withdrawing NFTs by their ID, and viewing the list of owned NFT IDs.

Once the collection is created, it is returned as a resource, which can then be stored in the account's private storage using a transaction. This enables the account to manage NFTs directly. Additionally, the function creates a public capability for the collection, which grants others access to the functionality provided by the collection (e.g., depositing and withdrawing NFTs) through the CollectionPublic interface.

A collection resource is returned which you then save into your account with a transaction.
4 changes: 2 additions & 2 deletions explanations/transaction.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This transaction is showing us how we would create a new empty collection and save that resource into a users account.
This transaction demonstrates how to create a new empty collection for an account and save it as a resource in the user's storage. Initially, the transaction checks if the account already has a collection. If one doesn't exist, it proceeds to create a new ExampleNFT.Collection and stores it in the account’s storage under a specified path.

We then create a public capability to this resource by linking the interface that contains functions the public can use on this resource for this account.
After saving the collection, the transaction creates a public capability for the collection. This capability allows others to interact with the collection by providing access to specific functions defined in the NonFungibleToken.CollectionPublic interface, such as viewing or transferring NFTs. The capability is then published to a public path, making it accessible to others who wish to interact with the collection.

0 comments on commit 6bba560

Please sign in to comment.