Class SorobanDataBuilder

java.lang.Object
org.stellar.sdk.SorobanDataBuilder

public class SorobanDataBuilder extends Object
Supports building SorobanTransactionData structures with various items set to specific values.

This is recommended for when you are building ExtendFootprintTTLOperation and RestoreFootprintOperation operations to avoid (re)building the entire data structure from scratch.

  • Constructor Details

  • Method Details

    • setResourceFee

      public SorobanDataBuilder setResourceFee(long fee)
      Sets the "resource" fee portion of the Soroban data.
      Parameters:
      fee - the resource fee to set (int64)
      Returns:
      this builder instance
    • setResources

      public SorobanDataBuilder setResources(SorobanDataBuilder.Resources resources)
      Sets up the resource metrics.

      You should almost NEVER need this, as its often generated/provided to you by transaction simulation/preflight from a Soroban RPC server.

      Parameters:
      resources - the resource metrics to set
      Returns:
      this builder instance
    • setReadOnly

      public SorobanDataBuilder setReadOnly(@Nullable Collection<LedgerKey> readOnly)
      Sets the read-only portion of the storage access footprint to be a certain set of ledger keys.

      Passing null will leave that portion of the footprint untouched. If you want to clear a portion of the footprint, pass an empty collection.

      Parameters:
      readOnly - the set of ledger keys to set in the read-only portion of the transaction's sorobanData
      Returns:
      this builder instance
    • setReadWrite

      public SorobanDataBuilder setReadWrite(@Nullable Collection<LedgerKey> readWrite)
      Sets the read-write portion of the storage access footprint to be a certain set of ledger keys.

      Passing null will leave that portion of the footprint untouched. If you want to clear a portion of the footprint, pass an empty collection.

      Parameters:
      readWrite - the set of ledger keys to set in the read-write portion of the transaction's sorobanData
      Returns:
      this builder instance
    • build

      public SorobanTransactionData build()
      Returns:
      the copy of the final SorobanTransactionData.