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

@ -273,8 +273,12 @@ public class CoreApi {
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

@ -165,7 +165,11 @@ class CoreWalletsService {
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;
@ -134,11 +136,25 @@ class GrpcWalletsService extends WalletsImplBase {
}
@Override
public void getNewDepositAddress(GetNewDepositAddressRequest req,
StreamObserver<GetNewDepositAddressReply> responseObserver) {
public void getXmrPrimaryAddress(GetXmrPrimaryAddressRequest req,
StreamObserver<GetXmrPrimaryAddressReply> responseObserver) {
try {
String subaddress = coreApi.getNewDepositAddress();
var reply = GetNewDepositAddressReply.newBuilder()
var reply = GetXmrPrimaryAddressReply.newBuilder()
.setPrimaryAddress(coreApi.getXmrPrimaryAddress())
.build();
responseObserver.onNext(reply);
responseObserver.onCompleted();
} catch (Throwable cause) {
exceptionHandler.handleException(log, cause, responseObserver);
}
}
@Override
public void getXmrNewSubaddress(GetXmrNewSubaddressRequest req,
StreamObserver<GetXmrNewSubaddressReply> responseObserver) {
try {
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;
}