Stellar PHP SDK API Documentation

AbstractTransaction
in package

AbstractYes

Abstract base class for all Stellar transaction types

This class provides common functionality for regular transactions and fee bump transactions, including signature management and XDR serialization. All transactions must be signed by the required signers before submission to the network.

Transaction Types:

  • Transaction: Regular transactions containing operations
  • FeeBumpTransaction: Wrapper transactions that increase fees for existing transactions

Security Notice: Always verify transaction contents before signing. Private keys should be handled securely and never exposed in logs or transmitted over insecure channels.

Tags
see
Transaction

For regular transactions

see
FeeBumpTransaction

For fee bump transactions

see
https://developers.stellar.org

Stellar developer docs

since
1.0.0

Table of Contents

Methods

__construct()  : mixed
Constructs a new AbstractTransaction with an empty signature list
addSignature()  : void
Adds a signature to the transaction
fromEnvelopeBase64XdrString()  : AbstractTransaction
Creates a transaction from a base64-encoded XDR string
fromEnvelopeXdr()  : AbstractTransaction
Creates a transaction from an XDR transaction envelope
getSignatures()  : array<string|int, XdrDecoratedSignature>
Gets all signatures attached to this transaction
hash()  : string
Calculates the hash of the transaction for signing
setSignatures()  : void
Sets the signatures for this transaction
sign()  : void
Signs the transaction with the provided keypair
signatureBase()  : string
Returns the signature base for this transaction
toEnvelopeXdr()  : XdrTransactionEnvelope
Converts the transaction to XDR envelope format
toEnvelopeXdrBase64()  : string
Converts the transaction to base64-encoded XDR envelope format

Methods

__construct()

Constructs a new AbstractTransaction with an empty signature list

public __construct() : mixed

fromEnvelopeBase64XdrString()

Creates a transaction from a base64-encoded XDR string

public static fromEnvelopeBase64XdrString(string $envelope) : AbstractTransaction
Parameters
$envelope : string

Base64-encoded XDR transaction envelope

Tags
throws
InvalidArgumentException

If the envelope type is unknown or XDR is invalid

Return values
AbstractTransaction

The decoded transaction (Transaction or FeeBumpTransaction)

hash()

Calculates the hash of the transaction for signing

public hash(Network $network) : string
Parameters
$network : Network

The network for which to calculate the hash

Return values
string

The transaction hash

sign()

Signs the transaction with the provided keypair

public sign(KeyPair $signer, Network $network) : void
Parameters
$signer : KeyPair

The keypair used to sign the transaction (must have private key)

$network : Network

The network for which this transaction is intended

Tags
throws
InvalidArgumentException

If the signer does not have a private key

signatureBase()

Returns the signature base for this transaction

public abstract signatureBase(Network $network) : string
Parameters
$network : Network

The network for which to generate the signature base

Return values
string

The signature base bytes

toEnvelopeXdrBase64()

Converts the transaction to base64-encoded XDR envelope format

public toEnvelopeXdrBase64() : string
Return values
string

Base64-encoded XDR transaction envelope


        
On this page

Search results