1 | <?php |
||
19 | class Signer |
||
20 | { |
||
21 | /** |
||
22 | * @var EcAdapterInterface |
||
23 | */ |
||
24 | private $ecAdapter; |
||
25 | |||
26 | /** |
||
27 | * @var TransactionInterface |
||
28 | */ |
||
29 | private $tx; |
||
30 | |||
31 | /** |
||
32 | * @var TransactionSignatureSerializer |
||
33 | */ |
||
34 | private $sigSerializer; |
||
35 | |||
36 | /** |
||
37 | * @var PublicKeySerializerInterface |
||
38 | */ |
||
39 | private $pubKeySerializer; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | private $tolerateInvalidPublicKey = false; |
||
45 | |||
46 | /** |
||
47 | * @var bool |
||
48 | */ |
||
49 | private $redeemBitcoinCash = false; |
||
50 | |||
51 | /** |
||
52 | * @var bool |
||
53 | */ |
||
54 | private $padUnsignedMultisigs = false; |
||
55 | |||
56 | /** |
||
57 | * @var bool |
||
58 | */ |
||
59 | private $allowComplexScripts = false; |
||
60 | |||
61 | /** |
||
62 | * @var InputSignerInterface[] |
||
63 | */ |
||
64 | private $signatureCreator = []; |
||
65 | |||
66 | /** |
||
67 | * TxWitnessSigner constructor. |
||
68 | * @param TransactionInterface $tx |
||
69 | * @param EcAdapterInterface $ecAdapter |
||
70 | */ |
||
71 | 81 | public function __construct(TransactionInterface $tx, EcAdapterInterface $ecAdapter = null) |
|
78 | |||
79 | /** |
||
80 | * @param bool $setting |
||
81 | * @return $this |
||
82 | */ |
||
83 | 1 | public function redeemBitcoinCash(bool $setting) |
|
88 | |||
89 | /** |
||
90 | * @param bool $setting |
||
91 | * @return $this |
||
92 | */ |
||
93 | 14 | public function padUnsignedMultisigs(bool $setting) |
|
98 | |||
99 | /** |
||
100 | * @param bool $setting |
||
101 | * @return $this |
||
102 | */ |
||
103 | 2 | public function tolerateInvalidPublicKey(bool $setting) |
|
108 | |||
109 | /** |
||
110 | * @param bool $setting |
||
111 | * @return $this |
||
112 | */ |
||
113 | 33 | public function allowComplexScripts(bool $setting) |
|
118 | |||
119 | /** |
||
120 | * @param int $nIn |
||
121 | * @param PrivateKeyInterface $key |
||
122 | * @param TransactionOutputInterface $txOut |
||
123 | * @param SignData $signData |
||
124 | * @param int $sigHashType |
||
125 | * @return $this |
||
126 | */ |
||
127 | 25 | public function sign(int $nIn, PrivateKeyInterface $key, TransactionOutputInterface $txOut, SignData $signData = null, $sigHashType = SigHash::ALL) |
|
136 | |||
137 | /** |
||
138 | * @param int $nIn |
||
139 | * @param TransactionOutputInterface $txOut |
||
140 | * @param SignData|null $signData |
||
141 | * @return InputSignerInterface |
||
142 | */ |
||
143 | 80 | public function input(int $nIn, TransactionOutputInterface $txOut, SignData $signData = null): InputSignerInterface |
|
162 | |||
163 | /** |
||
164 | * @return TransactionInterface |
||
165 | */ |
||
166 | 59 | public function get(): TransactionInterface |
|
185 | } |
||
186 |