MsgSetManager
MsgSetManager transfers a collection's manager role and sets the canUpdateManager permission in one message.
Sets the manager of a collection and the permission that guards future manager changes. Only the current manager can sign it. For multi-field updates use MsgUpdateCollection.
Example
bb tx tokenization set-manager ./set-manager.json --from alice --chain-id bitbadges-1import { BitBadgesSigningClient, GenericCosmosAdapter, MsgSetManager } from 'bitbadges';
const adapter = await GenericCosmosAdapter.fromMnemonic(process.env.MNEMONIC!, 'bitbadges-1');
const client = new BitBadgesSigningClient({ adapter, network: 'mainnet' });
// alice hands the manager role to bob.
const msg = new MsgSetManager({
creator: 'bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d',
collectionId: 1n,
manager: 'bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue',
canUpdateManager: [
{
permanentlyPermittedTimes: [{ start: 1n, end: 18446744073709551615n }],
permanentlyForbiddenTimes: []
}
]
});
const result = await client.signAndBroadcast([msg]);
console.log(result.txHash, result.success);{
"creator": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d",
"collectionId": "1",
"manager": "bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue",
"canUpdateManager": [
{
"permanentlyPermittedTimes": [{ "start": "1", "end": "18446744073709551615" }],
"permanentlyForbiddenTimes": []
}
]
}Fields
| Field | Type | Required | Description |
|---|---|---|---|
creator | string | yes | Signer. Must be the current manager. |
collectionId | Uint | yes | Collection to update. |
manager | string | yes | New manager address. An empty string leaves the collection with no manager, which locks every manager-only action. |
canUpdateManager | ActionPermission[] | no | New permission. permanentlyPermittedTimes, permanentlyForbiddenTimes. |
The response contains collectionId.
Behavior
- Builds a MsgUniversalUpdateCollection with
updateManager: trueandupdateCollectionPermissions: true. Every other permission is copied from the stored collection. - The change is checked against the stored
canUpdateManagerfor the current time. - The new manager takes effect immediately after this message. The signer loses manager rights in the same block.
- Errors:
ErrCollectionNotExists,ErrSenderIsNotManager,ErrCollectionIsArchived, permission forbidden.