Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public final class SolanaTransaction

  1. Object
  2. SolanaTransaction
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.

Constructors

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

Methods

public SolanaMessage getMessage()The message.
public void sign(byte[] privateKey)Signs with the 32-byte Ed25519 seed of one of the message’s signers.
public void addSignature(SolanaAddress signer, byte[] signature)Places a signature made elsewhere, for instance by a hardware wallet.
public boolean isFullySigned()Whether every required signature is present and valid.
public byte[] getSignature(int index)The signature of a signer slot, a copy; all zeros while unsigned.
public String getId()The transaction id: the fee payer’s signature in Base58.
public byte[] getMessageBytes()The bytes that are signed.
public byte[] serialize()The wire form.
public String toBase64()The Base64 wire form, what sendTransaction takes with encoding: base64.
public static SolanaTransaction parse(byte[] data)Reads a transaction.
public static SolanaTransaction fromBase64(String base64)Reads a Base64 transaction.

Inherited methods

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.