Skip to content

Update Class Metadata

Updates the metadata of an existing class while preserving its schema and other properties.

Parameters

ParameterTypeDescription
authoritySignerThe authority that has control over the class
classPublicKey | PdaThe class account to be updated
systemProgram?PublicKey | PdaOptional System Program account
metadatastringNew serialized metadata for the class

Returns

Returns a TransactionBuilder that can be used to build and send the transaction.

Example

import { updateClassMetadata } from "srs-lib";
 
const transaction = updateClassMetadata(context, {
    authority: authority,
    class: classPublicKey,
    systemProgram: systemProgramPublicKey,
    metadata: JSON.stringify({
        description: "Updated class description",
        version: "2.0",
        // Additional metadata fields
    })
});
 
// Send the transaction
await transaction.sendAndConfirm();

Important Notes

  • Only the class authority can update the class metadata
  • The class schema cannot be modified through this instruction
  • The metadata must be properly serialized
  • Existing records in the class are not affected by metadata updates
  • The class's permission and freeze states remain unchanged
  • This operation can be performed multiple times
  • The metadata update is permanent and cannot be undone

Related