setReadOnly

Sets the read-only portion of the storage footprint.

The read-only footprint contains ledger keys that the transaction will read but not modify. This includes:

  • Contract code (contracts being invoked)

  • Contract data being read

  • Account data being inspected

Footprint Requirements

All ledger entries accessed by a Soroban transaction MUST be declared in the footprint. Accessing undeclared entries causes transaction failure.

Null Behavior

  • null: Leaves the read-only footprint unchanged

  • Empty collection: Clears the read-only footprint

  • Non-empty collection: Replaces the read-only footprint

Return

This builder instance for chaining

Parameters

readOnly

The ledger keys to set as read-only (null to leave unchanged)