Assembled Transaction
Represents a prepared transaction ready for signing and submission.
AssembledTransaction is obtained from ContractClient methods (ContractClient.invoke, ContractClient.buildInvoke) and should not be constructed directly.
AssembledTransaction manages the complete lifecycle:
Simulate - Get resource estimates from the network
Sign - Add transaction and/or authorization signatures
Submit - Send to network and poll for completion
Parse - Convert result to desired type
Usage Patterns
Read-Only Call (No Signing)
val assembled = client.invoke<Long>(
functionName = "balance",
parameters = listOf(Scv.toAddress(account)),
source = account,
signer = null,
parseResultXdrFn = { Scv.fromInt128(it).toLong() }
)
val balance = assembled.result() // Returns simulated resultWrite Call (Standard Flow)
val assembled = client.invoke<Unit>(
functionName = "transfer",
parameters = listOf(from, to, amount),
source = account,
signer = keypair,
parseResultXdrFn = null
)
val result = assembled.signAndSubmit(keypair) // One-stepAdvanced Flow (Separate Steps)
val assembled = client.invoke<TransferResult>(...)
assembled.sign(keypair) // Sign transaction
assembled.signAuthEntries(keypair) // Sign auth entries if needed
val result = assembled.submit() // Submit and waitMulti-Auth Workflow (Atomic Swaps, etc.)
// Build transaction (e.g., atomic swap between Alice and Bob)
val tx = atomicSwapClient.invoke<Unit>(
functionName = "swap",
parameters = listOf(alice, bob, tokenA, tokenB, amounts...),
source = invokerAccount,
signer = invokerKeyPair
)
// Check who needs to sign auth entries
val whoElseNeedsToSign = tx.needsNonInvokerSigningBy()
// Returns: ["GALICE...", "GBOB..."]
// Sign auth entries for Alice
tx.signAuthEntries(aliceKeyPair)
// Sign auth entries for Bob (using delegate for remote signing)
tx.signAuthEntries(
authEntriesSigner = KeyPair.fromAccountId(bobId),
authorizeEntryDelegate = { entry, network ->
// Send to remote server for signing
val entryXdr = entry.toXdrBase64()
val signedXdr = remoteSignService.sign(entryXdr)
SorobanAuthorizationEntryXdr.fromXdrBase64(signedXdr)
}
)
// Submit transaction
val result = tx.signAndSubmit(invokerKeyPair)Parameters
The type of the parsed result
Properties
The built transaction after simulation (null before simulation).
The get transaction response (null before completion).
The TransactionBuilder before simulation.
The send transaction response (null before submission).
The signed transaction (separate from builtTransaction).
The simulation response (null before simulation).
Functions
Get structured simulation result data.
Check if this is a read-only call.
Get the addresses that need to sign authorization entries.
Restores the contract footprint.
Signs the transaction and submits it in one step.
Signs authorization entries in the transaction.
Simulates the transaction on the network.
Get the transaction envelope as base64-encoded XDR.