add grpc call to get new deposit subaddress
This commit is contained in:
parent
91cd984d85
commit
6e21508a94
@ -280,6 +280,10 @@ public class CoreApi {
|
||||
public BalancesInfo getBalances(String currencyCode) {
|
||||
return walletsService.getBalances(currencyCode);
|
||||
}
|
||||
|
||||
public String getNewDepositSubaddress() {
|
||||
return walletsService.getNewDepositSubaddress();
|
||||
}
|
||||
|
||||
public long getAddressBalance(String addressString) {
|
||||
return walletsService.getAddressBalance(addressString);
|
||||
|
@ -38,6 +38,7 @@ import bisq.core.btc.wallet.BsqWalletService;
|
||||
import bisq.core.btc.wallet.BtcWalletService;
|
||||
import bisq.core.btc.wallet.TxBroadcaster;
|
||||
import bisq.core.btc.wallet.WalletsManager;
|
||||
import bisq.core.btc.wallet.XmrWalletService;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
@ -103,6 +104,7 @@ class CoreWalletsService {
|
||||
private final BsqTransferService bsqTransferService;
|
||||
private final BsqFormatter bsqFormatter;
|
||||
private final BtcWalletService btcWalletService;
|
||||
private final XmrWalletService xmrWalletService;
|
||||
private final CoinFormatter btcFormatter;
|
||||
private final FeeService feeService;
|
||||
private final Preferences preferences;
|
||||
@ -125,6 +127,7 @@ class CoreWalletsService {
|
||||
BsqTransferService bsqTransferService,
|
||||
BsqFormatter bsqFormatter,
|
||||
BtcWalletService btcWalletService,
|
||||
XmrWalletService xmrWalletService,
|
||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter,
|
||||
FeeService feeService,
|
||||
Preferences preferences) {
|
||||
@ -137,6 +140,7 @@ class CoreWalletsService {
|
||||
this.bsqTransferService = bsqTransferService;
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
this.btcWalletService = btcWalletService;
|
||||
this.xmrWalletService = xmrWalletService;
|
||||
this.btcFormatter = btcFormatter;
|
||||
this.feeService = feeService;
|
||||
this.preferences = preferences;
|
||||
@ -170,6 +174,10 @@ class CoreWalletsService {
|
||||
return new BalancesInfo(getBsqBalances(), getBtcBalances(), getXmrBalances());
|
||||
}
|
||||
}
|
||||
|
||||
String getNewDepositSubaddress() {
|
||||
return xmrWalletService.getWallet().createSubaddress(0).getAddress();
|
||||
}
|
||||
|
||||
long getAddressBalance(String addressString) {
|
||||
Address address = getAddressEntry(addressString).getAddress();
|
||||
|
@ -29,6 +29,8 @@ import bisq.proto.grpc.GetBalancesReply;
|
||||
import bisq.proto.grpc.GetBalancesRequest;
|
||||
import bisq.proto.grpc.GetFundingAddressesReply;
|
||||
import bisq.proto.grpc.GetFundingAddressesRequest;
|
||||
import bisq.proto.grpc.GetNewDepositSubaddressRequest;
|
||||
import bisq.proto.grpc.GetNewDepositSubaddressReply;
|
||||
import bisq.proto.grpc.GetTransactionReply;
|
||||
import bisq.proto.grpc.GetTransactionRequest;
|
||||
import bisq.proto.grpc.GetTxFeeRateReply;
|
||||
@ -108,6 +110,21 @@ class GrpcWalletsService extends WalletsImplBase {
|
||||
exceptionHandler.handleException(log, cause, responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNewDepositSubaddress(GetNewDepositSubaddressRequest req,
|
||||
StreamObserver<GetNewDepositSubaddressReply> responseObserver) {
|
||||
try {
|
||||
String subaddress = coreApi.getNewDepositSubaddress();
|
||||
var reply = GetNewDepositSubaddressReply.newBuilder()
|
||||
.setSubaddress(subaddress)
|
||||
.build();
|
||||
responseObserver.onNext(reply);
|
||||
responseObserver.onCompleted();
|
||||
} catch (Throwable cause) {
|
||||
exceptionHandler.handleException(log, cause, responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAddressBalance(GetAddressBalanceRequest req,
|
||||
|
@ -431,6 +431,8 @@ message TxInfo {
|
||||
service Wallets {
|
||||
rpc GetBalances (GetBalancesRequest) returns (GetBalancesReply) {
|
||||
}
|
||||
rpc GetNewDepositSubaddress (GetNewDepositSubaddressRequest) returns (GetNewDepositSubaddressReply) {
|
||||
}
|
||||
rpc GetAddressBalance (GetAddressBalanceRequest) returns (GetAddressBalanceReply) {
|
||||
}
|
||||
rpc GetUnusedBsqAddress (GetUnusedBsqAddressRequest) returns (GetUnusedBsqAddressReply) {
|
||||
@ -469,6 +471,13 @@ message GetBalancesReply {
|
||||
BalancesInfo balances = 1;
|
||||
}
|
||||
|
||||
message GetNewDepositSubaddressRequest {
|
||||
}
|
||||
|
||||
message GetNewDepositSubaddressReply {
|
||||
string subaddress = 1;
|
||||
}
|
||||
|
||||
message GetAddressBalanceRequest {
|
||||
string address = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user