From f4120b869d66b9aecc6ac0bd7c75e6b50d5589bf Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 10 May 2022 14:58:47 -0400 Subject: [PATCH] support getXmrSeed() --- core/src/main/java/bisq/core/api/CoreApi.java | 4 ++++ .../java/bisq/core/api/CoreWalletsService.java | 4 ++++ .../bisq/daemon/grpc/GrpcWalletsService.java | 16 ++++++++++++++++ proto/src/main/proto/grpc.proto | 9 +++++++++ 4 files changed, 33 insertions(+) diff --git a/core/src/main/java/bisq/core/api/CoreApi.java b/core/src/main/java/bisq/core/api/CoreApi.java index 5d77129f..d16cff04 100644 --- a/core/src/main/java/bisq/core/api/CoreApi.java +++ b/core/src/main/java/bisq/core/api/CoreApi.java @@ -268,6 +268,10 @@ public class CoreApi { public BalancesInfo getBalances(String currencyCode) { return walletsService.getBalances(currencyCode); } + + public String getXmrSeed() { + return walletsService.getXmrSeed(); + } public String getNewDepositAddress() { return walletsService.getNewDepositAddress(); diff --git a/core/src/main/java/bisq/core/api/CoreWalletsService.java b/core/src/main/java/bisq/core/api/CoreWalletsService.java index d1f44c74..dd34a180 100644 --- a/core/src/main/java/bisq/core/api/CoreWalletsService.java +++ b/core/src/main/java/bisq/core/api/CoreWalletsService.java @@ -160,6 +160,10 @@ class CoreWalletsService { return new BalancesInfo(getBtcBalances(), getXmrBalances()); } } + + String getXmrSeed() { + return xmrWalletService.getWallet().getMnemonic(); + } String getNewDepositAddress() { accountService.checkAccountOpen(); diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java index ea8e43e4..7102c822 100644 --- a/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java @@ -40,6 +40,8 @@ import bisq.proto.grpc.GetTransactionReply; import bisq.proto.grpc.GetTransactionRequest; import bisq.proto.grpc.GetTxFeeRateReply; import bisq.proto.grpc.GetTxFeeRateRequest; +import bisq.proto.grpc.GetXmrSeedReply; +import bisq.proto.grpc.GetXmrSeedRequest; import bisq.proto.grpc.LockWalletReply; import bisq.proto.grpc.LockWalletRequest; import bisq.proto.grpc.RemoveWalletPasswordReply; @@ -117,6 +119,20 @@ class GrpcWalletsService extends WalletsImplBase { }); } + @Override + public void getXmrSeed(GetXmrSeedRequest req, + StreamObserver responseObserver) { + try { + var reply = GetXmrSeedReply.newBuilder() + .setSeed(coreApi.getXmrSeed()) + .build(); + responseObserver.onNext(reply); + responseObserver.onCompleted(); + } catch (Throwable cause) { + exceptionHandler.handleException(log, cause, responseObserver); + } + } + @Override public void getNewDepositAddress(GetNewDepositAddressRequest req, StreamObserver responseObserver) { diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index 5199fe6f..a5445733 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -856,6 +856,8 @@ message TxInfo { service Wallets { rpc GetBalances (GetBalancesRequest) returns (GetBalancesReply) { } + rpc GetXmrSeed (GetXmrSeedRequest) returns (GetXmrSeedReply) { + } rpc GetNewDepositAddress (GetNewDepositAddressRequest) returns (GetNewDepositAddressReply) { } rpc GetXmrTxs (GetXmrTxsRequest) returns (GetXmrTxsReply) { @@ -896,6 +898,13 @@ message GetBalancesReply { BalancesInfo balances = 1; } +message GetXmrSeedRequest { +} + +message GetXmrSeedReply { + string seed = 1; +} + message GetNewDepositAddressRequest { }