Skip to content

MsgSetIsArchived archives or unarchives a collection and sets the canArchiveCollection permission in one message.

Sets the archive flag of a collection and the permission that guards future changes. An archived collection is read-only: every transfer and update fails until it is unarchived. Only the current manager can sign it.

Example

bash
bb tx tokenization set-setisarchived ./set-is-archived.json --from alice --chain-id bitbadges-1
ts
import { BitBadgesSigningClient, GenericCosmosAdapter, MsgSetIsArchived } from 'bitbadges';

const adapter = await GenericCosmosAdapter.fromMnemonic(process.env.MNEMONIC!, 'bitbadges-1');
const client = new BitBadgesSigningClient({ adapter, network: 'mainnet' });

const msg = new MsgSetIsArchived({
  creator: 'bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d',
  collectionId: 1n,
  isArchived: true,
  canArchiveCollection: [
    {
      permanentlyPermittedTimes: [{ start: 1n, end: 18446744073709551615n }],
      permanentlyForbiddenTimes: []
    }
  ]
});

const result = await client.signAndBroadcast([msg]);
console.log(result.txHash, result.success);
json
{
  "creator": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d",
  "collectionId": "1",
  "isArchived": true,
  "canArchiveCollection": [
    {
      "permanentlyPermittedTimes": [{ "start": "1", "end": "18446744073709551615" }],
      "permanentlyForbiddenTimes": []
    }
  ]
}

Fields

FieldTypeRequiredDescription
creatorstringyesSigner. Must be the current manager.
collectionIdUintyesCollection to update.
isArchivedboolyestrue to archive, false to unarchive.
canArchiveCollectionActionPermission[]noNew permission.

The response contains collectionId.

Behavior

  • Builds a MsgUniversalUpdateCollection with updateIsArchived: true and updateCollectionPermissions: true. Every other permission is copied from the stored collection.
  • The change is checked against the stored canArchiveCollection only when the value actually changes.
  • Archiving is the one update an archived collection accepts in reverse: a message that sets isArchived: false on an archived collection succeeds. Any other message on an archived collection fails with ErrCollectionIsArchived.
  • If canArchiveCollection is permanently forbidden while the collection is archived, the collection is frozen forever.
  • Errors: ErrCollectionNotExists, ErrSenderIsNotManager, permission forbidden.

Edit this page on GitHub