support getXmrPrimaryAddress(), getXmrNewSubaddress()

This commit is contained in:
woodser 2022-05-15 13:46:01 -04:00
parent fa15612586
commit ffccf83ac5
4 changed files with 47 additions and 14 deletions

View File

@ -268,13 +268,17 @@ public class CoreApi {
public BalancesInfo getBalances(String currencyCode) {
return walletsService.getBalances(currencyCode);
}
public String getXmrSeed() {
return walletsService.getXmrSeed();
}
public String getNewDepositAddress() {
return walletsService.getNewDepositAddress();
public String getXmrPrimaryAddress() {
return walletsService.getXmrPrimaryAddress();
}
public String getXmrNewSubaddress() {
return walletsService.getXmrNewSubaddress();
}
public List<MoneroTxWallet> getXmrTxs() {

View File

@ -160,12 +160,16 @@ class CoreWalletsService {
return new BalancesInfo(getBtcBalances(), getXmrBalances());
}
}
String getXmrSeed() {
return xmrWalletService.getWallet().getMnemonic();
}
String getNewDepositAddress() {
String getXmrPrimaryAddress() {
return xmrWalletService.getWallet().getPrimaryAddress();
}
String getXmrNewSubaddress() {
accountService.checkAccountOpen();
return xmrWalletService.getWallet().createSubaddress(0).getAddress();
}

View File

@ -28,8 +28,10 @@ import bisq.proto.grpc.GetBalancesReply;
import bisq.proto.grpc.GetBalancesRequest;
import bisq.proto.grpc.GetFundingAddressesReply;
import bisq.proto.grpc.GetFundingAddressesRequest;
import bisq.proto.grpc.GetNewDepositAddressRequest;
import bisq.proto.grpc.GetNewDepositAddressReply;
import bisq.proto.grpc.GetXmrNewSubaddressRequest;
import bisq.proto.grpc.GetXmrPrimaryAddressReply;
import bisq.proto.grpc.GetXmrPrimaryAddressRequest;
import bisq.proto.grpc.GetXmrNewSubaddressReply;
import bisq.proto.grpc.GetXmrTxsRequest;
import bisq.proto.grpc.GetXmrTxsReply;
import bisq.proto.grpc.CreateXmrTxRequest;
@ -132,13 +134,27 @@ class GrpcWalletsService extends WalletsImplBase {
exceptionHandler.handleException(log, cause, responseObserver);
}
}
@Override
public void getXmrPrimaryAddress(GetXmrPrimaryAddressRequest req,
StreamObserver<GetXmrPrimaryAddressReply> responseObserver) {
try {
var reply = GetXmrPrimaryAddressReply.newBuilder()
.setPrimaryAddress(coreApi.getXmrPrimaryAddress())
.build();
responseObserver.onNext(reply);
responseObserver.onCompleted();
} catch (Throwable cause) {
exceptionHandler.handleException(log, cause, responseObserver);
}
}
@Override
public void getNewDepositAddress(GetNewDepositAddressRequest req,
StreamObserver<GetNewDepositAddressReply> responseObserver) {
public void getXmrNewSubaddress(GetXmrNewSubaddressRequest req,
StreamObserver<GetXmrNewSubaddressReply> responseObserver) {
try {
String subaddress = coreApi.getNewDepositAddress();
var reply = GetNewDepositAddressReply.newBuilder()
String subaddress = coreApi.getXmrNewSubaddress();
var reply = GetXmrNewSubaddressReply.newBuilder()
.setSubaddress(subaddress)
.build();
responseObserver.onNext(reply);

View File

@ -858,7 +858,9 @@ service Wallets {
}
rpc GetXmrSeed (GetXmrSeedRequest) returns (GetXmrSeedReply) {
}
rpc GetNewDepositAddress (GetNewDepositAddressRequest) returns (GetNewDepositAddressReply) {
rpc GetXmrPrimaryAddress (GetXmrPrimaryAddressRequest) returns (GetXmrPrimaryAddressReply) {
}
rpc GetXmrNewSubaddress (GetXmrNewSubaddressRequest) returns (GetXmrNewSubaddressReply) {
}
rpc GetXmrTxs (GetXmrTxsRequest) returns (GetXmrTxsReply) {
}
@ -905,10 +907,17 @@ message GetXmrSeedReply {
string seed = 1;
}
message GetNewDepositAddressRequest {
message GetXmrPrimaryAddressRequest {
}
message GetNewDepositAddressReply {
message GetXmrPrimaryAddressReply {
string primary_address = 1;
}
message GetXmrNewSubaddressRequest {
}
message GetXmrNewSubaddressReply {
string subaddress = 1;
}