Class AbstractTransaction

java.lang.Object
org.stellar.sdk.AbstractTransaction
Direct Known Subclasses:
FeeBumpTransaction, Transaction

public abstract class AbstractTransaction extends Object
Abstract class for transaction classes.
  • Field Details

  • Method Details

    • sign

      public void sign(@NonNull @NonNull KeyPair signer)
      Adds a new signature ed25519PublicKey to this transaction.
      Parameters:
      signer - KeyPair object representing a signer
    • sign

      public void sign(byte @NonNull [] preimage)
      Adds a new sha256Hash signature to this transaction by revealing preimage.
      Parameters:
      preimage - the sha256 hash of preimage should be equal to signer hash
    • hash

      public byte[] hash()
      Returns transaction hash.
      Returns:
      the transaction hash
    • hashHex

      public String hashHex()
      Returns transaction hash encoded as a hexadecimal string.
      Returns:
      the transaction hash as a hexadecimal string
    • signatureBase

      public abstract byte[] signatureBase()
      Returns signature base.
      Returns:
      the signature base
    • getSignatures

      public List<DecoratedSignature> getSignatures()
      Gets read only list(immutable) of the signatures on transaction.
      Returns:
      immutable list of signatures
    • addSignature

      public void addSignature(DecoratedSignature signature)
      Adds a signature to the transaction's existing list of signatures.
      Parameters:
      signature - the signature to add
    • toEnvelopeXdr

      public abstract TransactionEnvelope toEnvelopeXdr()
    • toEnvelopeXdrBase64

      public String toEnvelopeXdrBase64()
      Returns base64-encoded TransactionEnvelope XDR object. Transaction need to have at least one signature.
      Returns:
      the base64-encoded TransactionEnvelope XDR object.
    • fromEnvelopeXdr

      public static AbstractTransaction fromEnvelopeXdr(AccountConverter accountConverter, TransactionEnvelope envelope, Network network)
      Creates a AbstractTransaction instance from previously build TransactionEnvelope
      Parameters:
      accountConverter - the AccountConverter to use for this transaction
      envelope - the transaction envelope
      network - the network that the transaction is to be submitted to
      Returns:
      the Transaction or FeeBumpTransaction instance
    • fromEnvelopeXdr

      public static AbstractTransaction fromEnvelopeXdr(TransactionEnvelope envelope, Network network)
      Creates a AbstractTransaction instance from previously build TransactionEnvelope
      Parameters:
      envelope - the transaction envelope
      network - the network that the transaction is to be submitted to
      Returns:
      the Transaction or FeeBumpTransaction instance
    • fromEnvelopeXdr

      public static AbstractTransaction fromEnvelopeXdr(AccountConverter accountConverter, String envelope, Network network) throws IOException
      Creates a Transaction instance from previously build TransactionEnvelope
      Parameters:
      envelope - Base-64 encoded TransactionEnvelope
      Returns:
      the Transaction or FeeBumpTransaction instance
      Throws:
      IOException - if the envelope is malformed
    • fromEnvelopeXdr

      public static AbstractTransaction fromEnvelopeXdr(String envelope, Network network) throws IOException
      Creates a Transaction instance from previously build TransactionEnvelope
      Parameters:
      envelope - Base-64 encoded TransactionEnvelope
      Returns:
      the Transaction or FeeBumpTransaction instance
      Throws:
      IOException - if the envelope is malformed
    • getTransactionSignatureBase

      public static byte[] getTransactionSignatureBase(TransactionSignaturePayload.TransactionSignaturePayloadTaggedTransaction taggedTransaction, Network network)
      Get the signature base of this transaction envelope.
      Parameters:
      taggedTransaction - the tagged transaction for signing
      network - the network that the transaction is to be submitted to
      Returns:
      the signature base of this transaction envelope
    • getNetwork

      @NonNull public @NonNull Network getNetwork()
      The network that the transaction is to be submitted to.
    • getAccountConverter

      @NonNull public @NonNull AccountConverter getAccountConverter()
      The AccountConverter for this transaction.