public class AssembledTransaction<T>
extends java.lang.Object
Constructor and Description |
---|
AssembledTransaction(TransactionBuilder transactionBuilder,
SorobanServer server,
KeyPair transactionSigner,
java.util.function.Function<SCVal,T> parseResultXdrFn,
int submitTimeout)
Creates a new AssembledTransaction.
|
Modifier and Type | Method and Description |
---|---|
Transaction |
getBuiltTransaction() |
GetTransactionResponse |
getGetTransactionResponse() |
SendTransactionResponse |
getSendTransactionResponse() |
SimulateTransactionResponse |
getSimulation() |
boolean |
isReadCall()
Check if the transaction is a read call.
|
java.util.Set<java.lang.String> |
needsNonInvokerSigningBy(boolean includeAlreadySigned)
Get the addresses that need to sign the authorization entries.
|
void |
restoreFootprint()
Restore the contract state.
|
T |
result()
Get the result of the function invocation from the simulation.
|
AssembledTransaction<T> |
sign(KeyPair transactionSigner,
boolean force)
Signs the transaction.
|
T |
signAndSubmit(KeyPair transactionSigner,
boolean force)
Signs and submits the transaction in one step.
|
AssembledTransaction<T> |
signAuthEntries(KeyPair authEntriesSigner)
Signs the transaction's authorization entries.
|
AssembledTransaction<T> |
signAuthEntries(KeyPair authEntriesSigner,
java.lang.Long validUntilLedgerSequence)
Signs the transaction's authorization entries.
|
AssembledTransaction<T> |
simulate(boolean restore)
Simulates the transaction on the network.
|
T |
submit()
Submits the transaction to the network.
|
java.lang.String |
toEnvelopeXdrBase64()
Get the transaction envelope XDR.
|
public AssembledTransaction(TransactionBuilder transactionBuilder, SorobanServer server, @Nullable KeyPair transactionSigner, @Nullable java.util.function.Function<SCVal,T> parseResultXdrFn, int submitTimeout)
transactionBuilder
- the transaction builderserver
- the Soroban servertransactionSigner
- the keypair to sign the transaction withparseResultXdrFn
- the function to parse the result XDRsubmitTimeout
- the timeout for submitting the transactionpublic AssembledTransaction<T> simulate(boolean restore)
restore
to
true
and this is not a read call.restore
- whether to automatically restore contract state if neededSimulationFailedException
- if the simulation failedRestorationFailureException
- if the contract state could not be restoredpublic T signAndSubmit(@Nullable KeyPair transactionSigner, boolean force)
A convenience method combining sign(KeyPair, boolean)
and submit()
.
transactionSigner
- the keypair to sign the transaction with, or null
to use
the signer provided in the constructorforce
- whether to sign and submit even if the transaction is a read callparseResultXdrFn
was
set, otherwise raw SCVal
NotYetSimulatedException
- if the transaction has not yet been simulatedNoSignatureNeededException
- if the transaction is a read call, and force
is
not set to true
NeedsMoreSignaturesException
- if the transaction requires more signaturesSendTransactionFailedException
- if sending the transaction to the network failedTransactionStillPendingException
- if the transaction is still pending after the timeoutExpiredStateException
- if the transaction requires restoring contract stateTransactionFailedException
- if the transaction failedpublic AssembledTransaction<T> sign(@Nullable KeyPair transactionSigner, boolean force)
transactionSigner
- the keypair to sign the transaction with, or null
to use
the signer provided in the constructorforce
- whether to sign and submit even if the transaction is a read callNotYetSimulatedException
- if the transaction has not yet been simulatedNoSignatureNeededException
- if the transaction is a read call, and force
is
not set to true
ExpiredStateException
- if the transaction requires restoring contract stateNeedsMoreSignaturesException
- if the transaction requires more signaturespublic AssembledTransaction<T> signAuthEntries(KeyPair authEntriesSigner)
An alias for signAuthEntries(KeyPair, Long)
with null
as the second
argument.
authEntriesSigner
- the keypair to sign the authorization entries withNotYetSimulatedException
- if the transaction has not yet been simulatedpublic AssembledTransaction<T> signAuthEntries(KeyPair authEntriesSigner, @Nullable java.lang.Long validUntilLedgerSequence)
authEntriesSigner
- the keypair to sign the authorization entries withvalidUntilLedgerSequence
- the ledger sequence number until which the authorization
entries are valid, or null
to set it to the current ledger sequence + 100NotYetSimulatedException
- if the transaction has not yet been simulatedpublic java.util.Set<java.lang.String> needsNonInvokerSigningBy(boolean includeAlreadySigned)
includeAlreadySigned
- whether to include addresses that have already signed the
authorization entriesNotYetSimulatedException
- if the transaction has not yet been simulatedpublic T result() throws NotYetSimulatedException
parseResultXdrFn
was
set, otherwise raw SCVal
NotYetSimulatedException
- if the transaction has not yet been simulatedpublic boolean isReadCall()
true
if the transaction is a read call, false
otherwiseNotYetSimulatedException
- if the transaction has not yet been simulatedpublic java.lang.String toEnvelopeXdrBase64()
public void restoreFootprint()
TransactionFailedException
- if the transaction failedTransactionStillPendingException
- if the transaction is still pending after the timeoutSendTransactionFailedException
- if sending the transaction to the network failedpublic T submit()
It will send the transaction to the network and wait for the result.
parseResultXdrFn
was
set, otherwise raw SCVal
NotYetSimulatedException
- if the transaction has not yet been simulatedSendTransactionFailedException
- if sending the transaction to the network failedTransactionStillPendingException
- if the transaction is still pending after the timeoutTransactionFailedException
- if the transaction failedpublic Transaction getBuiltTransaction()
public SimulateTransactionResponse getSimulation()
public SendTransactionResponse getSendTransactionResponse()
public GetTransactionResponse getGetTransactionResponse()