Skip to content

Commit

Permalink
add PairingVersion V2
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroleak committed May 22, 2019
1 parent bbdc5d0 commit 695fb1c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
24 changes: 21 additions & 3 deletions java/com/samourai/wallet/api/pairing/PairingPayload.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ public class PairingPayload {

private CliPairingValue pairing;

public PairingPayload(PairingType type, PairingVersion version, PairingNetwork network, String mnemonic) {
this.pairing = new CliPairingValue(type, version, network, mnemonic);
public PairingPayload() {
this.pairing = new CliPairingValue();
}

public PairingPayload(PairingType type, PairingVersion version, PairingNetwork network, String mnemonic, Boolean passphrase) {
this.pairing = new CliPairingValue(type, version, network, mnemonic, passphrase);
}

protected void validate() throws Exception {
Expand All @@ -33,12 +37,18 @@ public static class CliPairingValue {
private PairingVersion version;
private PairingNetwork network;
private String mnemonic;
private Boolean passphrase; // NULL for V1

public CliPairingValue() {

}

public CliPairingValue(PairingType type, PairingVersion version, PairingNetwork network, String mnemonic) {
public CliPairingValue(PairingType type, PairingVersion version, PairingNetwork network, String mnemonic, Boolean passphrase) {
this.type = type;
this.version = version;
this.network = network;
this.mnemonic = mnemonic;
this.passphrase = passphrase;
}

protected void validate() throws Exception {
Expand Down Expand Up @@ -90,6 +100,14 @@ public String getMnemonic() {
public void setMnemonic(String mnemonic) {
this.mnemonic = mnemonic;
}

public Boolean getPassphrase() {
return passphrase;
}

public void setPassphrase(Boolean passphrase) {
this.passphrase = passphrase;
}
}

}
3 changes: 2 additions & 1 deletion java/com/samourai/wallet/api/pairing/PairingVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import com.google.common.base.Optional;

public enum PairingVersion {
V1_0_0("1.0.0");
V1_0_0("1.0.0"),
V2_0_0("2.0.0");

private String value;

Expand Down

0 comments on commit 695fb1c

Please sign in to comment.