Skip to content

Commit

Permalink
mpc api fee change from int to decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
haofengjiang committed Mar 9, 2023
1 parent 003556b commit 715df4c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public interface CoboMPCApiRestClient {
ApiResponse<MPCListSpendable> listSpendable(String coin, String address);

ApiResponse<MPCPostTransaction> createTransaction(String coin, String requestId, String fromAddr, String toAddr, BigInteger amount,
String toAddressDetails, BigInteger fee, BigInteger gasPrice, BigInteger gasLimit,
String toAddressDetails, BigDecimal fee, BigInteger gasPrice, BigInteger gasLimit,
Integer operation, String extraParameters);

ApiResponse<MPCPostTransaction> speedUpTransaction(String coboId, String requestId, BigInteger fee, BigInteger gasPrice, BigInteger gasLimit);
ApiResponse<MPCPostTransaction> speedUpTransaction(String coboId, String requestId, BigDecimal fee, BigInteger gasPrice, BigInteger gasLimit);

ApiResponse<MPCPostTransaction> dropTransaction(String coboId, String requestId, BigInteger fee, BigInteger gasPrice, BigInteger gasLimit);
ApiResponse<MPCPostTransaction> dropTransaction(String coboId, String requestId, BigDecimal fee, BigInteger gasPrice, BigInteger gasLimit);

ApiResponse<MPCTransactionInfos> transactionsByRequestIds(String requestIds, Integer status);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonProperty;

import java.math.BigDecimal;
import java.math.BigInteger;

public class MPCFee {
Expand All @@ -14,6 +15,9 @@ public class MPCFee {
@JsonProperty(value = "fee_used")
private String feeUsed;

@JsonProperty(value = "fee")
private BigDecimal fee;

public MPCCoin getFeeCoinDetail() {
return feeCoinDetail;
}
Expand Down Expand Up @@ -46,13 +50,22 @@ public void setFeeUsed(String feeUsed) {
this.feeUsed = feeUsed;
}

public BigDecimal getFee() {
return fee;
}

public void setFee(BigDecimal fee) {
this.fee = fee;
}

@Override
public String toString() {
return "{" +
"feeCoinDetail='" + feeCoinDetail + '\'' +
", gasPrice='" + gasPrice + '\'' +
", gasLimit='" + gasLimit + '\'' +
", feeUsed='" + feeUsed + '\'' +
", fee='" + fee + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ public ApiResponse<MPCListSpendable> listSpendable(String coin, String address)

@Override
public ApiResponse<MPCPostTransaction> createTransaction(String coin, String requestId, String fromAddr, String toAddr, BigInteger amount,
String toAddressDetails, BigInteger fee, BigInteger gasPrice, BigInteger gasLimit,
String toAddressDetails, BigDecimal fee, BigInteger gasPrice, BigInteger gasLimit,
Integer operation, String extraParameters) {
return executeSync(coboMPCApiService.createTransaction(coin, requestId, fromAddr, toAddr, amount,
toAddressDetails, fee, gasPrice, gasLimit, operation, extraParameters));
}

@Override
public ApiResponse<MPCPostTransaction> speedUpTransaction(String coboId, String requestId, BigInteger fee, BigInteger gasPrice, BigInteger gasLimit) {
public ApiResponse<MPCPostTransaction> speedUpTransaction(String coboId, String requestId, BigDecimal fee, BigInteger gasPrice, BigInteger gasLimit) {
return executeSync(coboMPCApiService.speedUpTransaction(coboId, requestId, fee, gasPrice, gasLimit));
}

@Override
public ApiResponse<MPCPostTransaction> dropTransaction(String coboId, String requestId, BigInteger fee, BigInteger gasPrice, BigInteger gasLimit) {
public ApiResponse<MPCPostTransaction> dropTransaction(String coboId, String requestId, BigDecimal fee, BigInteger gasPrice, BigInteger gasLimit) {
return executeSync(coboMPCApiService.dropTransaction(coboId, requestId, fee, gasPrice, gasLimit));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Call<ApiResponse<MPCPostTransaction>> createTransaction(@Field("coin") String co
@Field("to_address") String toAddr,
@Field("amount") BigInteger amount,
@Field("to_address_details") String toAddressDetails,
@Field("fee") BigInteger fee,
@Field("fee") BigDecimal fee,
@Field("gas_price") BigInteger gasPrice,
@Field("gas_limit") BigInteger gasLimit,
@Field("operation") Integer operation,
Expand All @@ -70,15 +70,15 @@ Call<ApiResponse<MPCPostTransaction>> createTransaction(@Field("coin") String co
@POST("/v1/custody/mpc/speedup_transaction/")
Call<ApiResponse<MPCPostTransaction>> speedUpTransaction(@Field("cobo_id") String coboId,
@Field("request_id") String requestId,
@Field("fee") BigInteger fee,
@Field("fee") BigDecimal fee,
@Field("gas_price") BigInteger gasPrice,
@Field("gas_limit") BigInteger gasLimit);

@FormUrlEncoded
@POST("/v1/custody/mpc/drop_transaction/")
Call<ApiResponse<MPCPostTransaction>> dropTransaction(@Field("cobo_id") String coboId,
@Field("request_id") String requestId,
@Field("fee") BigInteger fee,
@Field("fee") BigDecimal fee,
@Field("gas_price") BigInteger gasPrice,
@Field("gas_limit") BigInteger gasLimit);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.math.BigInteger;

import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -114,7 +115,7 @@ public void testCreateTransaction() {
String toAddr = "0xEEACb7a5e53600c144C0b9839A834bb4b39E540c";
BigInteger amount = new BigInteger("10");
String toAddressDetails = null;
BigInteger fee = null;
BigDecimal fee = null;
BigInteger gasPrice = null;
BigInteger gasLimit = null;
Integer operation = null;
Expand Down

0 comments on commit 715df4c

Please sign in to comment.