PayDestination

abstract class PayDestination(val chainSelector: ChainSelector) : BCHserializable

A destination for payments. This includes all the information needed to send and spend from this destination. It is often assumed that Bitcoin addresses are payment destinations, but this is not true. You really need an output script, and also (if P2SH) a redeem script. The reason why P2PKH addresses "work" as payment destinations is because they imply a specific script. But "baking in" this assumption will make the wallet a lot less flexible.

Inheritors

Constructors

Link copied to clipboard
constructor(chainSelector: ChainSelector)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val address: PayAddress?

Get the %budoc/glossary/P2SH or %budoc/glossary/P2PKH address associated with this destination Note that only a subset of PayDestinations have addresses. A PayAddress will only exist if this destination constrains spending to require a signature (in the P2PKH case) or a script (P2SH case)

Link copied to clipboard

Return a set of bytes that can be put into a bloom filter to select any transaction that contains this destination

Link copied to clipboard
Link copied to clipboard
open val derivedType: Int = 0

What type of destination is this?

Link copied to clipboard
open var index: Long

If a Bip44 wallet, this is be the BIP44 index. Otherwise its the an incrementing integer every time a new destination is created

Link copied to clipboard

An indication to retire this address as soon as coins are received (typically used for change). RAM only

Link copied to clipboard
abstract val pubkey: ByteArray?

Get the public key if a single signature is needed to spend this destination

Link copied to clipboard
abstract val secret: Secret?

Get the secret key if a single signature is needed to spend this destination

Functions

Link copied to clipboard
open fun argsHash(): ByteArray?
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

Get the constraint script needed to send coins to this destination. This script will contain spend constraints in the non-P2SH case, or in the P2SH case this script only constrains spending to execution of the redeemScript and any additional constraints are located in the redeemScript

Link copied to clipboard
fun groupedConstraintScript(groupId: GroupId, groupAmount: Long): SatoshiScript
Link copied to clipboard
open fun groupedOutputScript(groupId: GroupId, groupAmount: Long): SatoshiScript

Get the output script needed to send tokens to this group destination. This script will contain spend constraints in the non-P2SH case, or in the P2SH case this script only constrains spending to execution of the redeemScript and any additional constraints are located in the redeemScript

Link copied to clipboard

Get the groupless suffix constraint script needed to send coins to this destination. In other words, this is not a complete output script -- it needs a prefix to either choose no group (NEXA) or a group. It is used as a fragment in script template operations.

Link copied to clipboard
open fun output(satoshis: Long): iTxOutput

Get an output (constrained to this destination) suitable for placing in a transaction

Link copied to clipboard

Get the constraint script needed to send coins to this destination. This script will contain spend constraints in the non-P2SH case, or in the P2SH case this script only constrains spending to execution of the redeemScript and any additional constraints are located in the redeemScript

Link copied to clipboard
fun pkh(): ByteArray?

Calculate the public key hash (PKH)

Link copied to clipboard

Get the %budoc/glossary/P2SH %budoc/glossary/redeem_script needed to spend this destination.

Link copied to clipboard
fun satisfierScript(flatTx: ByteArray, inputIdx: Long, sigHashType: ByteArray, inputAmount: Long, vararg params: ByteArray): SatoshiScript
Link copied to clipboard
Link copied to clipboard

serialize any derived class & the type indicator

Link copied to clipboard
open fun spendScript(vararg params: ByteArray): SatoshiScript

Create a spend (input) script that will satisfy the constraints specified by the outputScript and the redeemScript (if applicable). This script will contain the redeemScript in the P2SH case.

open fun spendScript(flatTx: ByteArray, inputIdx: Long, sigHashType: ByteArray, inputAmount: Long, vararg params: ByteArray): SatoshiScript

Create a spend (input) script that will satisfy the constraints specified by the outputScript and the redeemScript (if applicable). This script will contain the redeemScript in the P2SH case. Many scripts require signatures. This API provides the data needed for this class to craft signatures, and provides additional derived-class defined params.

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

Get the output script needed to send native coins to this destination. This script will contain spend constraints in the non-P2SH case, or in the P2SH case this script only constrains spending to execution of the redeemScript and any additional constraints are located in the redeemScript