diff --git a/api-docs/kotlin/src/main/kotlin/org/bitcoindevkit/bdk.kt b/api-docs/kotlin/src/main/kotlin/org/bitcoindevkit/bdk.kt index 3cd6e2f6..a343eebf 100644 --- a/api-docs/kotlin/src/main/kotlin/org/bitcoindevkit/bdk.kt +++ b/api-docs/kotlin/src/main/kotlin/org/bitcoindevkit/bdk.kt @@ -248,6 +248,7 @@ sealed class BlockchainConfig { * @property confirmationTime If the transaction is confirmed, [BlockTime] contains height and timestamp of the block containing the transaction. This property is null for unconfirmed transactions. */ data class TransactionDetails ( + var transaction?: Transaction, var fee: ULong?, var received: ULong, var sent: ULong, @@ -325,6 +326,23 @@ class Transaction(transactionBytes: List) { /** Returns true if this transactions nLockTime is enabled (BIP-65). */ fun isLockTimeEnabled(): Boolean {} + + /** The protocol version, is currently expected to be 1 or 2 (BIP 68). */ + fun version(): Int {} + + /** + * Block height or timestamp. Transaction cannot be included in a block until this height/time. + * Relevant BIPs + * BIP-65 OP_CHECKLOCKTIMEVERIFY + * BIP-113 Median time-past as endpoint for lock-time calculations + */ + fun lockTime(): UInt {} + + /** List of transaction inputs. */ + fun input(): List {} + + /** List of transaction outputs. */ + fun output(): List {} } /** @@ -366,11 +384,29 @@ data class OutPoint ( * A transaction output, which defines new coins to be created from old ones. * * @property value The value of the output, in satoshis. - * @property address The address of the output. + * @property scriptPubkey The script which must be satisfied for the output to be spent. */ data class TxOut ( var value: ULong, - var address: String + var scriptPubkey: Script +) + +/** + * Bitcoin transaction input. + * + * It contains the location of the previous transaction’s output, that it spends and set of scripts that satisfy its spending conditions. + * + * @property previousOutput The reference to the previous output that is being used an an input. + * @property scriptSig The script which pushes values on the stack which will cause the referenced output’s script to be accepted. + * @property sequence The sequence number, which suggests to miners which of two conflicting transactions should be preferred, or 0xFFFFFFFF to ignore this feature. This is generally never used since the miner behaviour cannot be enforced. + * @property witness Witness data: an array of byte-arrays. Note that this field is not (de)serialized with the rest of the TxIn in Encodable/Decodable, as it is (de)serialized at the end of the full Transaction. It is (de)serialized with the rest of the TxIn in other (de)serialization routines. + * + */ +data class TxIn ( + var previousOutput: OutPoint, + var scriptSig: Script, + var sequence: UInt, + var witness: List> ) /** diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 3897a211..2cac22e9 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -275,9 +275,9 @@ interface Transaction { u32 lock_time(); - sequence inputs(); + sequence input(); - sequence outputs(); + sequence output(); }; interface PartiallySignedTransaction { diff --git a/bdk-ffi/src/lib.rs b/bdk-ffi/src/lib.rs index 7d6ea617..090aa80b 100644 --- a/bdk-ffi/src/lib.rs +++ b/bdk-ffi/src/lib.rs @@ -193,6 +193,17 @@ pub struct TxOut { script_pubkey: Arc