public class TransactionProcessor
extends java.lang.Object
The TransactionProcessor allows the developer to:
- Get input Action
- Create transaction
- Serialize Transaction
- Sign Transaction
- Broadcast Transaction
Constructor and Description |
---|
TransactionProcessor(@NotNull ISerializationProvider serializationProvider,
@NotNull IRPCProvider rpcProvider,
@NotNull IABIProvider abiProvider,
@NotNull ISignatureProvider signatureProvider)
Constructor with all provider references from
TransactionSession |
TransactionProcessor(@NotNull ISerializationProvider serializationProvider,
@NotNull IRPCProvider rpcProvider,
@NotNull IABIProvider abiProvider,
@NotNull ISignatureProvider signatureProvider,
@NotNull Transaction transaction)
Constructor with all provider references from
TransactionSession and preset
Transaction |
Modifier and Type | Method and Description |
---|---|
@NotNull PushTransactionResponse |
broadcast()
Broadcast transaction to blockchain.
|
@Nullable Transaction |
getOriginalTransaction()
Gets Transaction instance that holds the original transaction reference after signature provider
returns the signing result.
|
@Nullable java.lang.String |
getSerializedTransaction()
Gets serialized version of Transaction.
|
@NotNull java.util.List<java.lang.String> |
getSignatures()
List of signatures that will be available after they are returned from the signature
provider.
|
@Nullable Transaction |
getTransaction()
Gets transaction instance which holds all data relating to EOS Transaction
|
@NotNull TransactionConfig |
getTransactionConfig()
Gets configuration for Transaction which offers ability to set:
|
boolean |
isTransactionModificationAllowed()
Should the signature provider be able to modify the transaction?
|
void |
prepare(@NotNull java.util.List<Action> actions)
Prepare action's data from input and create new instance of Transaction if it is not set.
|
void |
prepare(@NotNull java.util.List<Action> actions,
@NotNull java.util.List<Action> contextFreeActions)
Prepare action's data from input and create new instance of Transaction if it is not set.
|
@Nullable java.lang.String |
serialize()
Getting serialized version of Transaction
|
void |
setAvailableKeys(@NotNull java.util.List<java.lang.String> availableKeys)
Set value for available keys list.
|
void |
setChainId(@Nullable java.lang.String chainId)
Sets chain id value.
|
void |
setIsTransactionModificationAllowed(boolean isTransactionModificationAllowed)
True: The transaction could be modified and updated to current transaction by Signature
provider.
|
void |
setRequiredKeys(@NotNull java.util.List<java.lang.String> requiredKeys)
Set value for required keys list
|
void |
setTransactionConfig(@NotNull TransactionConfig transactionConfig)
Sets configuration for Transaction which offers ability to set:
|
boolean |
sign()
Sign the transaction by passing
EosioTransactionSignatureRequest to signature
provider |
@NotNull PushTransactionResponse |
signAndBroadcast()
Sign and broadcast the transaction and signature/s to chain
|
@Nullable java.lang.String |
toJSON()
Return transaction in JSON string format.
|
public TransactionProcessor(@NotNull @NotNull ISerializationProvider serializationProvider, @NotNull @NotNull IRPCProvider rpcProvider, @NotNull @NotNull IABIProvider abiProvider, @NotNull @NotNull ISignatureProvider signatureProvider)
TransactionSession
serializationProvider
- the serialization provider.rpcProvider
- the rpc provider.abiProvider
- the abi provider.signatureProvider
- the signature provider.public TransactionProcessor(@NotNull @NotNull ISerializationProvider serializationProvider, @NotNull @NotNull IRPCProvider rpcProvider, @NotNull @NotNull IABIProvider abiProvider, @NotNull @NotNull ISignatureProvider signatureProvider, @NotNull @NotNull Transaction transaction) throws TransactionProcessorConstructorInputError
TransactionSession
and preset
TransactionserializationProvider
- the serialization provider.rpcProvider
- the rpc provider.abiProvider
- the abi provider.signatureProvider
- the signature provider.transaction
- - preset TransactionTransactionProcessorConstructorInputError
- thrown if the input transaction has an empty action list.public void prepare(@NotNull @NotNull java.util.List<Action> actions, @NotNull @NotNull java.util.List<Action> contextFreeActions) throws TransactionPrepareError
Check prepare() flow in "Complete Workflow" doc for more detail
actions
- - List of actions with data. If the transaction is preset or has a value and it has its own actions, that list will be over-ridden by this input list.contextFreeActions
- - List of context free actions with data.TransactionPrepareError
- thrown if:
IRPCProvider.getInfo()
is blank
GetInfoResponse.getHeadBlockTime()
TransactionPrepareInputError
thrown if inputs are invalid
TransactionPrepareRpcError
thrown if any RPC call (IRPCProvider.getInfo()
and IRPCProvider.getBlock(GetBlockRequest)
) return or throw an errorpublic void prepare(@NotNull @NotNull java.util.List<Action> actions) throws TransactionPrepareError
Use this method if you don't want to provide context free actions.
Check prepare() flow in "Complete Workflow" doc for more detail.
actions
- - List of actions with data. If the transaction is preset or has a value and it
has its own actions, that list will be over-ridden by this input list.TransactionPrepareError
- thrown if:
IRPCProvider.getInfo()
is blank
GetInfoResponse.getHeadBlockTime()
TransactionPrepareInputError
thrown if input is invalid
TransactionPrepareRpcError
thrown if any RPC call (IRPCProvider.getInfo()
and IRPCProvider.getBlock(GetBlockRequest)
) return or throw an errorpublic boolean sign() throws TransactionSignError
EosioTransactionSignatureRequest
to signature
provider
Check sign() flow in "Complete Workflow" document for more detail
TransactionSignError
- thrown if there are any exceptions during the following:
TransactionCreateSignatureRequestError
TransactionGetSignatureError
or SignatureProviderError
@NotNull public @NotNull PushTransactionResponse broadcast() throws TransactionBroadCastError
Check broadcast() flow in "Complete Workflow" document for more detail.
TransactionBroadCastError
- thrown under the following conditions:
TransactionPushTransactionError
@NotNull public @NotNull PushTransactionResponse signAndBroadcast() throws TransactionSignAndBroadCastError
TransactionSignAndBroadCastError
- thrown under the following conditions:
TransactionCreateSignatureRequestError
TransactionGetSignatureError
or SignatureProviderError
TransactionPushTransactionError
@Nullable public @Nullable java.lang.String toJSON()
@Nullable public @Nullable java.lang.String serialize() throws TransactionSerializeError
Check serialize() flow in "Complete Workflow" document for more detail.
TransactionSerializeError
- thrown if there are any exceptions while serializing
transaction. Cause: TransactionCreateSignatureRequestError
Utils.clone(Serializable)
TransactionCreateSignatureRequestRpcError
, which is thrown if any Rpc call
(IRPCProvider.getInfo()
) causes an exception
TransactionCreateSignatureRequestAbiError
thrown if any error occurs while
calling IABIProvider.getAbi(String, EOSIOName)
to get the ABI needed to
serialize each action
TransactionCreateSignatureRequestSerializationError
, which is thrown if any
error happens while calling
ISerializationProvider.serialize(AbiEosSerializationObject)
to serialize
each action or calling ISerializationProvider.serializeTransaction(String)
to serialize the whole transaction.@Nullable public @Nullable Transaction getTransaction()
This object holds the non-serialized version of Transaction
@Nullable public @Nullable Transaction getOriginalTransaction()
@NotNull public @NotNull java.util.List<java.lang.String> getSignatures()
Check getSignature() flow in "Complete Workflow" document for more details.
@Nullable public @Nullable java.lang.String getSerializedTransaction()
If the transaction has been modified, this object needs to be cleared or updated.
Check getSignature() flow in "Complete Workflow" document for more details.
@NotNull public @NotNull TransactionConfig getTransactionConfig()
- The expiration period for the transaction in seconds
- How many blocks behind
public void setTransactionConfig(@NotNull @NotNull TransactionConfig transactionConfig)
- The expiration period for the transaction in seconds
- How many blocks behind
transactionConfig
- the input configuration for transactionpublic void setChainId(@Nullable @Nullable java.lang.String chainId)
chainId
- - input chain idpublic void setAvailableKeys(@NotNull @NotNull java.util.List<java.lang.String> availableKeys)
List of available keys which most likely come from signature provider.
If this list is set, TransactionProcessor won't ask for available keys from the signature provider and will use this list.
Check createSignatureRequest() flow in "Complete Workflow" document for more details.
availableKeys
- the input available keyspublic void setRequiredKeys(@NotNull @NotNull java.util.List<java.lang.String> requiredKeys)
List of required keys to sign the transaction.
If this list is set, TransactionProcessor won't make RPC call for getRequiredKeys().
Check createSignatureRequest() flow in "Complete Workflow" document for more details.
requiredKeys
- the input required keyspublic boolean isTransactionModificationAllowed()
public void setIsTransactionModificationAllowed(boolean isTransactionModificationAllowed)
False: No modification. TransactionGetSignatureNotAllowModifyTransactionError
will be
thrown if transaction is modified.
isTransactionModificationAllowed
- Whether allow transaction to be modified by Signature Provider.