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_VOut
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 out"
4 *
5 * NB: This does not account for multisig transactions.
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 * @used-by Transaction_Interface::get_v_out()
18 */
19readonly class Transaction_VOut {
20
21    /**
22     * Constructor.
23     *
24     * @see https://learnmeabitcoin.com/technical/transaction/output/scriptpubkey/
25     *
26     * @param Money   $value The value of the transaction output.
27     * @param ?string $scriptpubkey_address Locking code.
28     */
29    public function __construct(
30        public Money $value,
31        // public int $n, // index of vouts for transaction?
32        // TODO: properly parse the scriptpubkey to an object with all its properties.
33        // TODO: when could this be null BtcRpcExplorer says: "null for non-standard scripts".
34        public ?string $scriptpubkey_address,
35    ) {
36    }
37}