MsgUniversalUpdateCollection
A universal message that can be used to either create a new collection or update an existing one. This message combines the functionality of both MsgCreateCollection and MsgUpdateCollection into a single interface.
Dual Purpose
Collection Creation: When
collectionIdis set to"0", this message creates a new collectionCollection Update: When
collectionIdis set to an existing collection ID, this message updates that collection
Update Flag Pattern
This message uses an update flag + value pattern for selective updates. Each updatable field has a corresponding boolean flag (e.g., updateValidTokenIds, updateCollectionPermissions).
If update flag is
true: The corresponding value field is processed and the collection is updated with the new valueIf update flag is
false: The corresponding value field is completely ignored, regardless of what data is provided
Authorization & Permissions
For Collection Creation: Can be executed by any address
For Collection Updates: Can only be executed by the current manager of the collection. All updates must obey the previously set permissions.
Path Addition Permissions
When adding paths to an existing collection, the following permissions are checked:
cosmosCoinWrapperPathsToAdd: RequirescanAddMoreCosmosCoinWrapperPathspermissionaliasPathsToAdd: RequirescanAddMoreAliasPathspermission
These permissions are checked before paths are processed. If the permission check fails, the transaction will be rejected. Both permissions use the ActionPermission type with time-based controls. Empty/nil permissions mean the action is allowed (neutral state).
Proto Definition
Usage Example
JSON Example - Creating a New Collection
JSON Example - Updating an Existing Collection
Key Differences from Other Messages
vs MsgCreateCollection
More flexible update flag pattern
Can be used for both creation and updates
Includes invariants support
vs MsgUpdateCollection
Can create new collections when collectionId = "0"
Includes creation-only fields like
defaultBalances
Includes invariants support
Invariants Support
When creating a new collection (collectionId = "0"), you can set collection invariants using the invariants field. Invariants cannot be modified after collection creation.
Related Messages
Last updated