Skip to main content

Update Body

Update the body field of an Entity resource. The body stores arbitrary JSON‑formatted metadata string, e.g. content metadata, external resource pointers, custom application payload. Only the current Entity owner is permitted to execute this instruction.

open-token entity update-body --help

Synopsis

open-token entity update-body <Name> <Body>

Arguments

ArgumentTypeRequiredDescription
<Name>StringYesTarget entity resource name (e.g. open://google.com, open://app.google.com). Must reference an existing non‑expired on‑chain entity account, supports multi‑level dot‑separated hierarchy. Corresponding human‑readable URI: open://google.com, open://app.google.com.
<Body>JSON‑StringYesRaw JSON string payload. Must be valid JSON serialized string. Subject to on‑chain program maximum byte‑length limit. Program stores the string verbatim; it does not validate or interpret JSON semantics.

Behaviour

  • Transaction signer must match stored Entity owner public key; returns OwnerMismatch on authorization failure.
  • Validates target entity exists and ownership term is not expired (NameExpired).
  • Validates parent Ecosystem namespace exists on‑chain (ParentNotCreated).
  • Overwrites the on‑chain body field with the supplied raw JSON string.
  • Does not modify owner, renter, expiry timestamps, sale‑offer, rent‑offer configuration.
  • Active usership lease (if present) remains unaffected; renter’s usership rights stay intact.
  • The program only persists the JSON text; JSON schema and content validation are left to off‑chain client applications.
  • Logical resolution note: Even after updating entity body, the entity cannot be resolved via open:// scheme if its parent Ecosystem is expired.

Constraints & Validation Rules

  1. OwnerMismatch: Transaction signer is not the Entity owner.
  2. NameExpired: Entity ownership registration expired; cannot update metadata.
  3. ParentNotCreated: Parent Ecosystem namespace does not exist on‑chain.
  4. MaxEntityLevelIsFour: Entity name hierarchy depth exceeds program‑defined maximum level.
  5. NameTooLong / NameEmpty: Invalid entity name input.
  6. BodyTooLong: Supplied JSON string exceeds program‑defined maximum byte‑length limit.

Note: On‑chain program does not reject malformed JSON. JSON syntax correctness is the caller’s responsibility.

Usage Example

Set body for entity open://google.com with escaped JSON string for shell:

open-token entity update-body open://google.com "{\"uri\":\"ipfs://QmXYZabc\",\"title\":\"Google Entity Metadata\"}"