Class SolanaTransaction

java.lang.Object
com.codename1.crypto.solana.SolanaTransaction

public final class SolanaTransaction extends Object
A Solana transaction: a SolanaMessage and one Ed25519 signature per required signer. A slot whose signer has not signed yet holds 64 zero bytes, which is how a transaction is passed between parties that sign it in turn.
  • Constructor Details

    • SolanaTransaction

      public SolanaTransaction(SolanaMessage message)
      An unsigned transaction for a message.
  • Method Details

    • getMessage

      public SolanaMessage getMessage()
      The message.
    • sign

      public void sign(byte[] privateKey)

      Signs with the 32-byte Ed25519 seed of one of the message's signers.

      Throws
      • IllegalArgumentException: if the key is not one of the message's signers
    • addSignature

      public void addSignature(SolanaAddress signer, byte[] signature)

      Places a signature made elsewhere, for instance by a hardware wallet.

      Throws
      • IllegalArgumentException: if the signer is not required or the signature is invalid
    • isFullySigned

      public boolean isFullySigned()
      Whether every required signature is present and valid.
    • getSignature

      public byte[] getSignature(int index)
      The signature of a signer slot, a copy; all zeros while unsigned.
    • getId

      public String getId()
      The transaction id: the fee payer's signature in Base58.
    • getMessageBytes

      public byte[] getMessageBytes()
      The bytes that are signed.
    • serialize

      public byte[] serialize()
      The wire form.
    • toBase64

      public String toBase64()
      The Base64 wire form, what sendTransaction takes with encoding: base64.
    • parse

      public static SolanaTransaction parse(byte[] data)

      Reads a transaction.

      Throws
      • IllegalArgumentException: for malformed data, or a signature count that does not match the message
    • fromBase64

      public static SolanaTransaction fromBase64(String base64)
      Reads a Base64 transaction.