Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpc add wallet supported coins #49

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public interface CoboMPCApiRestClient {

ApiResponse<MPCCoins> getSupportedCoins(String chainCode);

ApiResponse<MPCWalletCoins> getWalletSupportedCoins();

ApiResponse<Boolean> isValidAddress(String coin, String address);

ApiResponse<MPCAddressList> getMainAddress(String chainCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

public class MPCCoin {
private String coin;

@JsonProperty(value = "chain_code")
private String chainCode;
@JsonProperty(value = "display_code")
private String displayCode;
private String description;
Expand All @@ -23,6 +26,14 @@ public void setCoin(String coin) {
this.coin = coin;
}

public String getChainCode() {
return chainCode;
}

public void setChainCode(String chainCode) {
this.chainCode = chainCode;
}

public String getDisplayCode() {
return displayCode;
}
Expand Down Expand Up @@ -75,6 +86,7 @@ public void setConfirmingThreshold(Integer confirmingThreshold) {
public String toString() {
return "{" +
"coin='" + coin + '\'' +
"chainCode='" + chainCode + '\'' +
", displayCode='" + displayCode + '\'' +
", description='" + description + '\'' +
", decimal=" + decimal +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.cobo.custody.api.client.domain.account;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

public class MPCWalletCoins {
@JsonProperty(value = "wallet_name")
private String walletName;
private List<MPCCoin> coins;

public String getWalletName() {
return walletName;
}

public void setWalletName(String walletName) {
this.walletName = walletName;
}

public List<MPCCoin> getCoins() {
return coins;
}

public void setCoins(List<MPCCoin> coins) {
this.coins = coins;
}

@Override
public String toString() {
return "{" +
"walletName='" + walletName + '\'' +
", coins='" + coins + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public ApiResponse<MPCCoins> getSupportedCoins(String chainCode) {
return executeSync(coboMPCApiService.getSupportedCoins(chainCode));
}

@Override
public ApiResponse<MPCWalletCoins> getWalletSupportedCoins() {
return executeSync(coboMPCApiService.getWalletSupportedCoins());
}

@Override
public ApiResponse<Boolean> isValidAddress(String coin, String address) {
return executeSync(coboMPCApiService.isValidAddress(coin, address));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public interface CoboMPCApiService {
@GET("/v1/custody/mpc/get_supported_coins/")
Call<ApiResponse<MPCCoins>> getSupportedCoins(@Query("chain_code") String chainCode);

@GET("/v1/custody/mpc/get_wallet_supported_coins/")
Call<ApiResponse<MPCWalletCoins>> getWalletSupportedCoins();

@GET("/v1/custody/mpc/is_valid_address/")
Call<ApiResponse<Boolean>> isValidAddress(@Query("coin") String coin,
@Query("address") String address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@ public void testGetSupportedChains() {
}

@Test
public void testgetSupportedCoins() {
public void testGetSupportedCoins() {
String chainCode = "GETH";
ApiResponse<MPCCoins> res = mpcClient.getSupportedCoins(chainCode);
System.out.println(res.getResult());
assertTrue(res.isSuccess());
}

@Test
public void testGetWalletSupportedCoins() {
ApiResponse<MPCWalletCoins> res = mpcClient.getWalletSupportedCoins();
System.out.println(res.getResult());
assertTrue(res.isSuccess());
}

@Test
public void testIsValidAddress() {
String coin = "GETH";
Expand Down