Package org.stellar.sdk
Class SorobanDataBuilder
java.lang.Object
org.stellar.sdk.SorobanDataBuilder
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Represents the resource metrics of the Soroban data. -
Constructor Summary
ConstructorDescriptionCreates a new builder with an emptySorobanTransactionData
.SorobanDataBuilder
(String sorobanData) Creates a new builder from a base64 representation ofSorobanTransactionData
.SorobanDataBuilder
(SorobanTransactionData sorobanData) Creates a new builder from aSorobanTransactionData
. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
setReadOnly
(Collection<LedgerKey> readOnly) Sets the read-only portion of the storage access footprint to be a certain set of ledger keys.setReadWrite
(Collection<LedgerKey> readWrite) Sets the read-write portion of the storage access footprint to be a certain set of ledger keys.setResourceFee
(long fee) Sets the "resource" fee portion of the Soroban data.setResources
(SorobanDataBuilder.Resources resources) Sets up the resource metrics.
-
Constructor Details
-
SorobanDataBuilder
public SorobanDataBuilder()Creates a new builder with an emptySorobanTransactionData
. -
SorobanDataBuilder
Creates a new builder from a base64 representation ofSorobanTransactionData
.- Parameters:
sorobanData
- base64 representation ofSorobanTransactionData
-
SorobanDataBuilder
Creates a new builder from aSorobanTransactionData
.- Parameters:
sorobanData
-SorobanTransactionData
.
-
-
Method Details
-
setResourceFee
Sets the "resource" fee portion of the Soroban data.- Parameters:
fee
- the resource fee to set (int64)- Returns:
- this builder instance
-
setResources
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
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
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
- Returns:
- the copy of the final
SorobanTransactionData
.
-