Skip to content

PendingTransaction (Class)

A transaction ready for signing and submission.

Created by iterating over a Generator. Contains the transaction along with metadata about fees, amounts, and UTXOs being spent.

aggregate_input_amount property

aggregate_input_amount: int

The total value of all inputs in sompi.

aggregate_output_amount property

aggregate_output_amount: int

The total value of all outputs in sompi.

change_amount property

change_amount: int

The change amount returned to the sender in sompi.

fee_amount property

fee_amount: int

The transaction fee in sompi.

id property

id: str

The transaction ID (hash) as a hex string.

mass property

mass: int

The transaction mass (used for fee calculation).

minimum_signatures property

minimum_signatures: int

The minimum number of signatures required.

payment_amount property

payment_amount: Optional[int]

The total payment amount in sompi (excluding change and fees), or None for sweep transactions.

transaction property

transaction: Transaction

The underlying transaction object for manual inspection or modification.

transaction_type property

transaction_type: str

The transaction type: "batch" for intermediate or "final" for last.

addresses

addresses() -> list[Address]

Get the unique addresses referenced by this transaction's inputs.

RETURNS DESCRIPTION
list[Address]

list[Address]: List of addresses.

create_input_signature

create_input_signature(input_index: int, private_key: PrivateKey, sighash_type: str | SighashType | None = All) -> str

Create a signature for a specific input.

PARAMETER DESCRIPTION
input_index

The index of the input to sign.

TYPE: int

private_key

The private key for signing.

TYPE: PrivateKey

sighash_type

The signature hash type (default: All).

TYPE: str | SighashType | None DEFAULT: All

RETURNS DESCRIPTION
str

The signature as a hex string.

TYPE: str

RAISES DESCRIPTION
Exception

If signing fails.

fill_input

fill_input(input_index: int, signature_script: Binary) -> None

Fill an input's signature script with a pre-computed signature.

PARAMETER DESCRIPTION
input_index

The index of the input to fill.

TYPE: int

signature_script

The signature script bytes.

TYPE: Binary

RAISES DESCRIPTION
Exception

If filling fails.

get_utxo_entries

get_utxo_entries() -> list[UtxoEntryReference]

Get the UTXO entries being spent by this transaction.

RETURNS DESCRIPTION
list[UtxoEntryReference]

list[UtxoEntryReference]: List of UTXO entries.

sign

sign(private_keys: list, check_fully_signed: Optional[bool] = None) -> None

Sign all inputs with the provided private keys.

PARAMETER DESCRIPTION
private_keys

List of PrivateKey objects for signing.

TYPE: list

check_fully_signed

Verify all inputs are signed (default: None).

TYPE: Optional[bool] DEFAULT: None

RAISES DESCRIPTION
Exception

If signing fails or transaction is not fully signed.

sign_input

sign_input(input_index: int, private_key: PrivateKey, sighash_type: str | SighashType | None = All) -> None

Sign a specific input with a private key.

PARAMETER DESCRIPTION
input_index

The index of the input to sign.

TYPE: int

private_key

The private key for signing.

TYPE: PrivateKey

sighash_type

The signature hash type (default: All).

TYPE: str | SighashType | None DEFAULT: All

RAISES DESCRIPTION
Exception

If signing fails.

submit

submit(rpc_client: RpcClient) -> str

Submit the signed transaction to the network.

PARAMETER DESCRIPTION
rpc_client

The RPC client for submission.

TYPE: RpcClient

RETURNS DESCRIPTION
str

The transaction ID on success (async).

TYPE: str

RAISES DESCRIPTION
Exception

If submission fails.