Solana.Transaction (Solana v0.1.0)
View SourceFunctions for building and encoding Solana transactions
Summary
Types
The possible errors encountered when encoding a transaction.
All the details needed to encode a transaction.
Functions
Checks to see if a transaction's signature is valid.
decodes a base58-encoded signature and returns it in a tuple.
decodes a base58-encoded signature and returns it.
Parses a Solana.Transaction.t/0 from data encoded in Solana's binary
format
Encodes a Solana.Transaction.t/0 into a binary
format
Types
@type encoding_err() ::
:no_payer
| :no_blockhash
| :no_program
| :no_instructions
| :mismatched_signers
The possible errors encountered when encoding a transaction.
@type t() :: %Solana.Transaction{ blockhash: binary() | nil, instructions: [Solana.Instruction.t()], payer: Solana.key() | nil, signers: [Solana.keypair()] }
All the details needed to encode a transaction.
Functions
Checks to see if a transaction's signature is valid.
Returns {:ok, signature} if it is, and an error tuple if it isn't.
decodes a base58-encoded signature and returns it in a tuple.
If it fails, return an error tuple.
decodes a base58-encoded signature and returns it.
Throws an ArgumentError if it fails.
@spec encode_message(tx :: t()) :: binary() | {:error, encoding_err()}
Parses a Solana.Transaction.t/0 from data encoded in Solana's binary
format
Returns {transaction, extras} if the transaction was successfully
parsed, or :error if the provided binary could not be parsed. extras
is a keyword list containing information about the encoded transaction,
namely:
:header- the transaction message header:accounts- an ordered array of accounts:signatures- a list of signed copies of the transaction message
@spec to_binary(tx :: t()) :: {:ok, binary()} | {:error, encoding_err()}
Encodes a Solana.Transaction.t/0 into a binary
format
Returns {:ok, encoded_transaction} if the transaction was successfully
encoded, or an error tuple if the encoding failed -- plus more error details
via Logger.error/1.