How to update metadata using the Ultra Tool Kit
An important aspect of the Ultra NFT standard is the ability to update metadata. Game publishers may want to modify a uniq's traits based on in-game events.
For this guide, we will use the uniq factory and uniq token created in the previous steps, utilizing the Ultra Testnet network.
Prerequisites
- You must have already created and uploaded the metadata files. Refer to How to create Uniq Metadata for more information.
- You must have already created a uniq factory. Refer to How to create a Uniq Factory using the Ultra Tool Kit for more information.
- Your account must have sufficient UOS tokens for transactions and fees. Refer to Tutorial - Using the Faucet and Buying RAM on Ultra Testnet for more information.
- Ensure your account is the uniq factory manager for the uniq factory whose metadata you intend to update, as only the uniq factory manager is authorized to perform metadata related updates.
Goal
The goal of this guide is to help you understand how you can update the metadata using Ultra Tool Kit. This guide is divided into three sections:
- Updating Uniq Factory Metadata: Will walk you through the process of updating metadata for a uniq factory.
- Updating Default Uniq Metadata: Will walk you through the process of updating metadata for the default uniq.
- Updating Uniq Metadata: Will walk you through the process of updating metadata for a specific uniq.
Updating Uniq Factory Metadata
If a content creator re-uploads a new uniq factory metadata, they can use the setmeta.b
action to update the metadata for the uniq factory. To do so, follow these steps:
- Login to Ultra Tool Kit using your account.
- Navigate to the factory management page by clicking on the
Uniq Actions
from the sidebar, and then clicking onFactory
. - On the factory page, search for
setmeta
action in the search box, and click on theSet factory metadata (eosio.nft.ft::setmeta.b)
action to open up the transaction modal.
Configure setmeta.b
Action
We will use the setmeta.b
action to update the metadata for a uniq factory. For more information on the action, refer to setmeta.b action documentation.
Once you have opened the transaction modal, fill the required fields for the setmeta.b
action:
- Token factory ID: Required, the ID of the uniq factory for which you want to update the metadata.
- Memo: Required, enter a text memo for your transaction. For example,
updating uniq factory metadata
. - Metadata URI: Required, URI of the new/updated factory metadata JSON file.
- Metadata hash: Required, SHA256 hash of the new/updated metadata JSON file.
Once you have inputted all the values, click on the Send 1 Action
button and it will open up the transaction confirmation modal. You can click on the Details
button to view the transaction in JSON form. Click on the Confirm
button to submit your transaction.
Confirm and sign the transaction using the Ultra Wallet extension.
After signing the transaction, you will see a confirmation screen indicating that the transaction was successfully completed.
You have now successfully updated the metadata for a uniq factory.
Updating Default Uniq Metadata
Default uniq metadata is used as a fallback mechanism whenever there's no metadata available for a uniq. To update the default uniq metadata, follow these steps:
- Login to Ultra Tool Kit using your account.
- Navigate to the factory management page by clicking on the
Uniq Actions
from the sidebar, and then clicking onFactory
. - On the factory page, search for
setdflttkn
action in the search box, and click on theSet default token metadata (eosio.nft.ft::setdflttkn)
action to open up the transaction modal.
Configure setdflttkn
Action
We will use the setdflttkn
action to update the metadata for a uniq factory. For more information on the action, refer to setdflttkn action documentation.
Once you have opened the transaction modal, fill the required fields for the setdflttkn
action:
- Token factory ID: Required, the ID of the uniq factory for which you want to update the default uniq metadata.
- Memo: Required, enter a text memo for your transaction. For example,
updating default uniq metadata
. - Metadata URI: Required, URI of the new/updated default uniq metadata JSON file.
- Metadata hash: SHA256 hash of the new/updated default uniq metadata JSON file.
- If you are using a dynamic metadata URI (e.g., https://developers.ultra.io/uniq-collections/AngryBananas/{serial_number}.json), you should leave this field blank.
- If you are using a static metadata URI (e.g., https://developers.ultra.io/uniq-collections/AngryBananas/ffc3121613cc7d52a3525bb68c0948edc469f6f2c16bcb7b6b7fa38f7eaed3cf.json), this field is required.
Once you have inputted all the values, click on the Send 1 Action
button and it will open up the transaction confirmation modal. You can click on the Details
button to view the transaction in JSON form. Click on the Confirm
button to submit your transaction.
Confirm and sign the transaction using the Ultra Wallet extension.
After signing the transaction, you will see a confirmation screen indicating that the transaction was successfully completed.
You have now successfully updated the default uniq metadata.
Updating Uniq Metadata
To update the uniq metadata, follow these steps:
- Login to Ultra Tool Kit using your account.
- Navigate to the uniq manager page by clicking on the
Uniq Actions
from the sidebar, and then clicking onUniq
. - On the uniq page, search for
settknmeta
action in the search box, and click on theSet token metadata (eosio.nft.ft::settknmeta)
action to open up the transaction modal.
Configure settknmeta
Action
We will use the settknmeta
action to update the metadata for a uniq. For more information on the action, refer to settknmeta action documentation.
Once you have opened the transaction modal, fill the required fields for the settknmeta
action:
- Token ID: Required, the ID of the uniq for which you want to update the metadata.
- Owner: Required, the account that owns this uniq.
- Memo: Required, enter a text memo for your transaction. For example,
updating default uniq metadata
. - Metadata URI: Optional, URI of the new/updated uniq metadata JSON file.
- Metadata hash: Optional, SHA256 hash of the new/updated uniq metadata JSON file.
Once you have inputted all the values, click on the Send 1 Action
button and it will open up the transaction confirmation modal. You can click on the Details
button to view the transaction in JSON form. Click on the Confirm
button to submit your transaction.
Confirm and sign the transaction using the Ultra Wallet extension.
After signing the transaction, you will see a confirmation screen indicating that the transaction was successfully completed.
You have now successfully updated the metadata for a uniq.
Disabling Metadata Changes
For certain use cases, it might make sense to make the uniq factory immutable. For such cases, we can use the lckfactory
action to enable a manager to disable any metadata updates. This can be particularly useful for an NFT art gallery, as it assures users that their artwork will never change.
Before we proceed, it is important to note that this change is irreversible.
To disable metadata updates for a uniq factory, follow these steps:
- Login to Ultra Tool Kit using your account.
- Navigate to the factory management page by clicking on the
Uniq Actions
from the sidebar, and then clicking onFactory
. - On the factory page, search for
lckfactory
action in the search box, and click on theLock factory (eosio.nft.ft::lckfactory)
action to open up the transaction modal.
Configure lckfactory
Action
We will use the lckfactory
action to update the metadata for a uniq factory. For more information on the action, refer to lckfactory action documentation.
Once you have opened the transaction modal, fill the required fields for the lckfactory
action:
- Token factory ID: Required, the ID of the uniq factory for which you want to disable metadata updates.
Click on the Send 1 Action
button and it will open up the transaction confirmation modal. You can click on the Details
button to view the transaction in JSON form. Click on the Confirm
button to submit your transaction.
Confirm and sign the transaction using the Ultra Wallet extension.
After signing the transaction, you will see a confirmation screen indicating that the transaction was successfully completed.
You have now successfully disabled metadata updates for the uniq factory. To verify that the uniq factory is locked for metadata changes, attempt to update the factory, default uniq, or uniq metadata for this factory using the aforementioned actions, and the transaction should fail.
What's next?
After practicing the basic metadata actions, you can move on to advanced actions with Uniqs and Factories: