BchTransaction

class BchTransaction(val chainSelector: ChainSelector) : iTransaction

Bitcoin transaction

Constructors

Link copied to clipboard
constructor(chainSelector: ChainSelector)
constructor(chainSelector: ChainSelector, buf: ByteArray, format: SerializationType)

Deserialization constructor

constructor(chainSelector: ChainSelector, buf: BCHserialized)

Deserialization constructor

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val chainSelector: ChainSelector

Which blockchain is this transaction for

Link copied to clipboard
open override val fee: Long

What this transaction will be paying in transaction fees (might be calculated each time)

Link copied to clipboard
open val feeRate: Double

Transaction fee rate in satoshi/byte

Link copied to clipboard

Return this transaction's hash. Uses a cached value if one exists. If you change the transaction be sure to call calcHash() or invalidateHash() to update this value either greedily or lazily respectively

Link copied to clipboard
open override val id: Hash256

Return this transaction's id. If you change the transaction be sure to call changed() to update this value

Link copied to clipboard
open override val idem: Hash256

Return this transaction's id Uses a cached value if one exists. If you change the transaction be sure to call changed() to update this value

Link copied to clipboard
open override val inputs: MutableList<out iTxInput>

inputs to this transaction

Link copied to clipboard
Link copied to clipboard
open val inputTotal: Long

Total quantity of satoshis spent (input into this transaction), including grouped satoshis

Link copied to clipboard
open override var lockTime: Long

transaction lock time

Link copied to clipboard
open override val outpoints: Array<BchTxOutpoint>

Return the outpoints in this transaction

Link copied to clipboard
open override val outputs: MutableList<out iTxOutput>

outputs of this transaction

Link copied to clipboard
open val outputTotal: Long

Total quantity of satoshis sent (output from this transaction), including grouped satoshis

Link copied to clipboard
open override val size: Long

transaction size in bytes

Link copied to clipboard
open override var version: Int

transaction version

Functions

Link copied to clipboard
open override fun add(output: iTxOutput): iTransaction

Add an output to this transaction (at the end)

open override fun add(spendable: Spendable, reserve: SpendableReservation?): iTransaction

Add an input to this transaction (at the end)

open override fun add(input: iTxInput, reserve: SpendableReservation?): iTransaction

Append an input to this transaction (at the end).

Link copied to clipboard
fun iTransaction.addChange(wallet: Wallet, changeOverride: PayAddress? = null)
Link copied to clipboard
open fun amountSentTo(addr: PayAddress): Long
Link copied to clipboard
open override fun appendableSighash(extendInputs: Boolean, extendOutputs: Boolean): ByteArray

Return the sighash that allows new inputs and/or outputs to be appended to the transaction. This commits to all existing inputs and outputs.

Link copied to clipboard
open override fun BCHdeserialize(stream: BCHserialized): BCHserialized
Link copied to clipboard
open override fun BCHserialize(format: SerializationType): BCHserialized
Link copied to clipboard

Force recalculation of hash. To access the hash just use #hash

Link copied to clipboard
open override fun changed()

If you change transaction data, call this function to force lazy recalculation of the hash

Link copied to clipboard
open override fun clone(): iTransaction

Creates a shallow copy of this transaction. The iTransaction object is different, but the inputs and outputs are the same

Link copied to clipboard
open override fun copy(): iTransaction

Creates a deep copy of this transaction. The iTransaction object is different, but the inputs and outputs are the same

Link copied to clipboard
open fun createTdppUrl(requestingDomain: String = "", tdppFlags: Long = 0, applinkDomain: String? = "w.nexa.org"): String

Given this (partial) transaction, formulate a TDPP request that another wallet can complete.

Link copied to clipboard
open override fun debugDump()

Dump this transaction to stdout

Link copied to clipboard
open override fun details(): String

Pretty print the transaction details to a string

Link copied to clipboard
Link copied to clipboard
open override fun firstnSighash(numInputs: Int, numOutputs: Int): ByteArray

Return the sighash that signs the first N inputs/outputs. Pass Int.MAX_VALUE to sign "all", otherwise pass a number to sign those. This commits to the first inputs and outputs.

Link copied to clipboard
open override fun hasAuthority(grpId: GroupId, flags: ULong): Boolean

Returns true if this transaction has inputs that confer this authority. This function is used in transaction construction so if the input is read-only, it is assumed that it will be signed later (recall that unsigned read-only inputs are valid but do not confer any authorities), so true will be returned even though the authority is not conferred unless the read-only input is signed. If a blockchain does not support groups (or equivalent functionality), false is always returned.

Link copied to clipboard
open override fun isCoinbase(): Boolean

Returns true if this transaction is a coinbase tx

Link copied to clipboard
open override fun isOwnershipChallenge(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun setInputs(inputs: MutableList<out iTxInput>): iTransaction

Overwrite all inputs in this transaction with the provided list.

Link copied to clipboard
open override fun setOutputs(outputs: MutableList<out iTxOutput>): iTransaction

Overwrite all outputs with the provided list

Link copied to clipboard
open override fun spendable(index: Int): Spendable

Get outpoints that child transactions can use to spend the outputs of this transaction.

Link copied to clipboard
open fun toBase64Url(): String

Serialize this transaction into Base64Url format

Link copied to clipboard
open fun toByteArray(format: SerializationType = SerializationType.UNKNOWN): ByteArray

Serialize this transaction into a byte array (using network serialization)

Link copied to clipboard
open override fun toHex(): String

Serialize this transaction and return it as a hex encoded string

Link copied to clipboard
open override fun toString(): String

Default display: print the transaction hash