public class SorobanDataBuilder
extends java.lang.Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
SorobanDataBuilder.Resources
Represents the resource metrics of the Soroban data.
|
Constructor and Description |
---|
SorobanDataBuilder()
Creates a new builder with an empty
SorobanTransactionData . |
SorobanDataBuilder(SorobanTransactionData sorobanData)
Creates a new builder from a
SorobanTransactionData . |
SorobanDataBuilder(java.lang.String sorobanData)
Creates a new builder from a base64 representation of
SorobanTransactionData . |
Modifier and Type | Method and Description |
---|---|
SorobanTransactionData |
build() |
SorobanDataBuilder |
setReadOnly(java.util.Collection<LedgerKey> readOnly)
Sets the read-only portion of the storage access footprint to be a certain set of ledger keys.
|
SorobanDataBuilder |
setReadWrite(java.util.Collection<LedgerKey> readWrite)
Sets the read-write portion of the storage access footprint to be a certain set of ledger keys.
|
SorobanDataBuilder |
setResourceFee(long fee)
Sets the "resource" fee portion of the Soroban data.
|
SorobanDataBuilder |
setResources(SorobanDataBuilder.Resources resources)
Sets up the resource metrics.
|
public SorobanDataBuilder()
SorobanTransactionData
.public SorobanDataBuilder(java.lang.String sorobanData)
SorobanTransactionData
.sorobanData
- base64 representation of SorobanTransactionData
public SorobanDataBuilder(SorobanTransactionData sorobanData)
SorobanTransactionData
.sorobanData
- SorobanTransactionData
.public SorobanDataBuilder setResourceFee(long fee)
fee
- the resource fee to set (int64)public SorobanDataBuilder setResources(SorobanDataBuilder.Resources resources)
You should almost NEVER need this, as its often generated/provided to you by transaction simulation/preflight from a Soroban RPC server.
resources
- the resource metrics to setpublic SorobanDataBuilder setReadOnly(@Nullable java.util.Collection<LedgerKey> readOnly)
Passing null
will leave that portion of the footprint untouched. If you want to
clear a portion of the footprint, pass an empty collection.
readOnly
- the set of ledger keys to set in the read-only portion of the transaction's
sorobanDatapublic SorobanDataBuilder setReadWrite(@Nullable java.util.Collection<LedgerKey> readWrite)
Passing null
will leave that portion of the footprint untouched. If you want to
clear a portion of the footprint, pass an empty collection.
readWrite
- the set of ledger keys to set in the read-write portion of the transaction's
sorobanDatapublic SorobanTransactionData build()
SorobanTransactionData
.