Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Transaction_VIn
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * Vector-in/Value-in
4 *
5 * TODO: This has not been fully implemented yet in a way that is working with all three APIs.
6 *
7 * @see https://developer.bitcoin.org/reference/transactions.html
8 *
9 * @package brianhenryie/bh-wp-bitcoin-gateway
10 */
11
12namespace BrianHenryIE\WP_Bitcoin_Gateway\API\Model\Payments;
13
14use BrianHenryIE\WP_Bitcoin_Gateway\Brick\Money\Money;
15
16/**
17 * Represents a transaction input (vector-in) in a Bitcoin transaction.
18 *
19 * A transaction input references a previous transaction output that is being spent.
20 */
21readonly class Transaction_VIn {
22    /**
23     * Constructor.
24     *
25     * @param int    $sequence The sequence number for this input, used for transaction replacement and locktime.
26     * @param string $scriptsig The scriptSig (signature script) that satisfies the conditions of the previous output's scriptPubKey.
27     * @param string $address The Bitcoin address that owned the previous output being spent.
28     * @param string $prevout_scriptpubkey The scriptPubKey from the previous transaction output being referenced.
29     * @param Money  $value The amount of Bitcoin from the previous output being spent in this input.
30     * @param int    $prev_out_n The index of the output in the previous transaction that this input is spending.
31     */
32    public function __construct(
33        public int $sequence,
34        public string $scriptsig,
35        // TODO: for transactions we are concerned about, this will usually be our payment address. Document when it might not be, e.g. miner.
36        public string $address,
37        public string $prevout_scriptpubkey,
38        public Money $value,
39        public int $prev_out_n,
40        // TODO: witness.
41    ) {
42    }
43}