|
5 | 5 | /** |
6 | 6 | * EIP-41/EIP-11 compliant multi sig transaction |
7 | 7 | */ |
8 | | -public class MultisigTransaction { |
| 8 | +public abstract class MultisigTransaction { |
9 | 9 |
|
10 | 10 | /** |
11 | 11 | * @return transaction that is going to be signed |
12 | 12 | */ |
13 | | - public Transaction getTransaction() { |
14 | | - throw new UnsupportedOperationException(); |
15 | | - } |
16 | | - |
17 | | - /** |
18 | | - * @return multisig address this transaction was created for |
19 | | - */ |
20 | | - public MultisigAddress getMultisigAddress() { |
21 | | - throw new UnsupportedOperationException(); |
22 | | - } |
| 13 | + abstract public ReducedTransaction getTransaction(); |
23 | 14 |
|
24 | 15 | /** |
25 | | - * adds a new commitment to this multisig transaction |
| 16 | + * adds a new hint to this multisig transaction |
26 | 17 | * @param prover to add commitment for |
27 | 18 | */ |
28 | | - public void addCommitment(ErgoProver prover) { |
29 | | - throw new UnsupportedOperationException(); |
30 | | - } |
| 19 | + abstract public void addHint(ErgoProver prover); |
31 | 20 |
|
32 | 21 | /** |
33 | | - * adds the commitments not present on this instance from another multisig transaction instance |
| 22 | + * adds the hints not present on this instance from another multisig transaction instance |
34 | 23 | * for the same transaction. |
35 | 24 | */ |
36 | | - public void addCommitments(MultisigTransaction other) { |
37 | | - throw new UnsupportedOperationException(); |
38 | | - } |
| 25 | + abstract public void mergeHints(MultisigTransaction other); |
39 | 26 |
|
40 | 27 | /** |
41 | | - * @return list of participants that added a commitment for the transaction |
| 28 | + * adds the hints not present on this instance from the EIP-11 json |
42 | 29 | */ |
43 | | - public List<Address> getCommitingParticipants() { |
44 | | - throw new UnsupportedOperationException(); |
45 | | - } |
46 | | - |
47 | | - public boolean hasEnoughCommitments() { |
48 | | - throw new UnsupportedOperationException(); |
49 | | - } |
| 30 | + abstract public void mergeHints(String json); |
50 | 31 |
|
51 | 32 | /** |
52 | | - * @return the signed transaction if enough commitments are available |
53 | | - * @throws IllegalStateException if {@link #hasEnoughCommitments()} is false |
| 33 | + * @return list of participants that added a hint for the transaction |
54 | 34 | */ |
55 | | - public SignedTransaction toSignedTransaction() { |
56 | | - throw new UnsupportedOperationException(); |
57 | | - } |
| 35 | + abstract public List<Address> getCommitingParticipants(); |
| 36 | + /** |
| 37 | + * @return true if SignedTransaction can be built |
| 38 | + */ |
| 39 | + abstract public boolean isHintBagComplete(); |
58 | 40 |
|
59 | 41 | /** |
60 | | - * @return EIP-11 compliant json string to transfer the partially signed transaction to the |
61 | | - * next particpant |
| 42 | + * @return the signed transaction if enough commitments are available |
| 43 | + * @throws IllegalStateException if {@link #isHintBagComplete()} is false |
62 | 44 | */ |
63 | | - public String toJson() { |
64 | | - throw new UnsupportedOperationException(); |
65 | | - } |
| 45 | + abstract public SignedTransaction toSignedTransaction(); |
66 | 46 |
|
67 | 47 | /** |
68 | | - * constructs a multi sig transaction from an unsigned transaction. The first multi sig address |
69 | | - * in input boxes is used. |
| 48 | + * @return EIP-11 compliant json string to transfer the partially signed transaction to the |
| 49 | + * next participant |
70 | 50 | */ |
71 | | - public static MultisigTransaction fromTransaction(UnsignedTransaction transaction) { |
72 | | - throw new UnsupportedOperationException(); |
73 | | - } |
| 51 | + abstract public String hintsToJson(); |
74 | 52 |
|
75 | 53 | /** |
76 | 54 | * constructs a multi sig transaction from a reduced transaction |
77 | 55 | */ |
78 | | - public static MultisigTransaction fromTransaction(ReducedTransaction transaction, MultisigAddress address) { |
| 56 | + public static MultisigTransaction fromTransaction(ReducedTransaction transaction) { |
79 | 57 | throw new UnsupportedOperationException(); |
80 | 58 | } |
81 | 59 |
|
|
0 commit comments