|
|
|
@ -24,21 +24,20 @@ import java.util.Objects; |
|
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator; |
|
|
|
|
import com.fasterxml.jackson.annotation.JsonGetter; |
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty; |
|
|
|
|
import io.vertx.core.json.JsonObject; |
|
|
|
|
|
|
|
|
|
public class WithdrawalRequestParameter { |
|
|
|
|
|
|
|
|
|
private final String sourceAddress; |
|
|
|
|
private final String validatorPubKey; |
|
|
|
|
private final String validatorPublicKey; |
|
|
|
|
private final String amount; |
|
|
|
|
|
|
|
|
|
@JsonCreator |
|
|
|
|
public WithdrawalRequestParameter( |
|
|
|
|
@JsonProperty("sourceAddress") final String sourceAddress, |
|
|
|
|
@JsonProperty("validatorPublicKey") final String validatorPubKey, |
|
|
|
|
@JsonProperty("validatorPublicKey") final String validatorPublicKey, |
|
|
|
|
@JsonProperty("amount") final String amount) { |
|
|
|
|
this.sourceAddress = sourceAddress; |
|
|
|
|
this.validatorPubKey = validatorPubKey; |
|
|
|
|
this.validatorPublicKey = validatorPublicKey; |
|
|
|
|
this.amount = amount; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -53,25 +52,18 @@ public class WithdrawalRequestParameter { |
|
|
|
|
public WithdrawalRequest toWithdrawalRequest() { |
|
|
|
|
return new WithdrawalRequest( |
|
|
|
|
Address.fromHexString(sourceAddress), |
|
|
|
|
BLSPublicKey.fromHexString(validatorPubKey), |
|
|
|
|
BLSPublicKey.fromHexString(validatorPublicKey), |
|
|
|
|
GWei.fromHexString(amount)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public JsonObject asJsonObject() { |
|
|
|
|
return new JsonObject() |
|
|
|
|
.put("sourceAddress", sourceAddress) |
|
|
|
|
.put("validatorPubKey", validatorPubKey) |
|
|
|
|
.put("amount", amount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@JsonGetter |
|
|
|
|
public String getSourceAddress() { |
|
|
|
|
return sourceAddress; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@JsonGetter |
|
|
|
|
public String getValidatorPubKey() { |
|
|
|
|
return validatorPubKey; |
|
|
|
|
public String getValidatorPublicKey() { |
|
|
|
|
return validatorPublicKey; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@JsonGetter |
|
|
|
@ -85,13 +77,13 @@ public class WithdrawalRequestParameter { |
|
|
|
|
if (o == null || getClass() != o.getClass()) return false; |
|
|
|
|
final WithdrawalRequestParameter that = (WithdrawalRequestParameter) o; |
|
|
|
|
return Objects.equals(sourceAddress, that.sourceAddress) |
|
|
|
|
&& Objects.equals(validatorPubKey, that.validatorPubKey) |
|
|
|
|
&& Objects.equals(validatorPublicKey, that.validatorPublicKey) |
|
|
|
|
&& Objects.equals(amount, that.amount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int hashCode() { |
|
|
|
|
return Objects.hash(sourceAddress, validatorPubKey, amount); |
|
|
|
|
return Objects.hash(sourceAddress, validatorPublicKey, amount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -101,7 +93,7 @@ public class WithdrawalRequestParameter { |
|
|
|
|
+ sourceAddress |
|
|
|
|
+ '\'' |
|
|
|
|
+ ", validatorPubKey='" |
|
|
|
|
+ validatorPubKey |
|
|
|
|
+ validatorPublicKey |
|
|
|
|
+ '\'' |
|
|
|
|
+ ", amount='" |
|
|
|
|
+ amount |
|
|
|
|