SorobanDataBuilder

constructor()

Creates a new builder with empty SorobanTransactionData.

Initializes with:

  • Resource fee: 0

  • CPU instructions: 0

  • Disk read bytes: 0

  • Write bytes: 0

  • Empty read-only footprint

  • Empty read-write footprint


constructor(sorobanData: String)

Creates a new builder from base64-encoded XDR string.

Parses the XDR and uses it as the starting point for building. Useful when working with simulation results or existing transactions.

Example

val simulation = server.simulateTransaction(tx)
val builder = SorobanDataBuilder(simulation.transactionData!!)

Parameters

sorobanData

Base64-encoded SorobanTransactionData XDR

Throws

If the XDR is invalid


constructor(sorobanData: SorobanTransactionDataXdr)

Creates a new builder from existing SorobanTransactionData.

Creates a deep copy of the provided data to ensure immutability. Any modifications through builder methods create a new instance.

Example

val existing = transaction.sorobanData!!
val modified = SorobanDataBuilder(existing)
.setResourceFee(existing.resourceFee + 5000)
.build()

Parameters

sorobanData

The SorobanTransactionData to copy