Skip to content

Update Tokenized Record

Updates the data of a tokenized record while preserving its token and other properties.

Parameters

ParameterTypeDescription
authoritySignerThe record owner or class authority (for permissioned classes)
mintPublicKey | PdaThe mint account for the tokenized record
tokenAccountPublicKey | PdaThe token account holding the tokenized record
recordPublicKey | PdaThe record account associated with the tokenized record
token2022?PublicKey | PdaOptional Token2022 Program account
class?PublicKey | PdaOptional class account of the record
newDatastringNew serialized data for the tokenized record

Returns

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

Example

import { updateTokenizedRecord } from "srs-lib";
 
const transaction = updateTokenizedRecord(context, {
    authority: authority,
    mint: mintPublicKey,
    tokenAccount: tokenAccountPublicKey,
    record: recordPublicKey,
    token2022: token2022ProgramPublicKey,
    class: classPublicKey, // Optional, but recommended for permissioned classes
    newData: JSON.stringify({
        title: "Updated Tokenized Record",
        description: "Updated tokenized record description",
        // Additional data fields conforming to the class schema
    })
});
 
// Send the transaction
await transaction.sendAndConfirm();

Important Notes

  • The authority must be either the record owner or the class authority (for permissioned classes)
  • The tokenized record must not be frozen
  • The new data must conform to the schema defined in the record's class
  • The data must be properly serialized
  • The record's token and ownership remain unchanged
  • The token account must hold exactly one token
  • For permissioned classes, providing the class account is recommended to ensure proper authority verification
  • This operation can be performed multiple times
  • The data update is permanent and cannot be undone

Related