diff --git a/apitest/docs/build-run.md b/apitest/docs/build-run.md
index 308fe02cf66..9d1165ca88e 100644
--- a/apitest/docs/build-run.md
+++ b/apitest/docs/build-run.md
@@ -48,7 +48,7 @@ To run all test cases in a package:
To run a single test case:
- $ ./gradlew :apitest:test --tests "bisq.apitest.method.GetBalanceTest" -DrunApiTests=true
+ $ ./gradlew :apitest:test --tests "bisq.apitest.method.wallet.GetBalanceTest" -DrunApiTests=true
To run test cases from Intellij, add two JVM arguments to your JUnit launchers:
diff --git a/apitest/src/test/java/bisq/apitest/method/MethodTest.java b/apitest/src/test/java/bisq/apitest/method/MethodTest.java
index 43073ba995b..39cb0b5e971 100644
--- a/apitest/src/test/java/bisq/apitest/method/MethodTest.java
+++ b/apitest/src/test/java/bisq/apitest/method/MethodTest.java
@@ -26,6 +26,7 @@
import bisq.proto.grpc.GetOfferRequest;
import bisq.proto.grpc.GetPaymentAccountsRequest;
import bisq.proto.grpc.GetTradeRequest;
+import bisq.proto.grpc.GetUnusedBsqAddressRequest;
import bisq.proto.grpc.KeepFundsRequest;
import bisq.proto.grpc.LockWalletRequest;
import bisq.proto.grpc.MarketPriceRequest;
@@ -107,6 +108,10 @@ protected final GetBalanceRequest createBalanceRequest() {
return GetBalanceRequest.newBuilder().build();
}
+ protected final GetUnusedBsqAddressRequest createGetUnusedBsqAddressRequest() {
+ return GetUnusedBsqAddressRequest.newBuilder().build();
+ }
+
protected final SetWalletPasswordRequest createSetWalletPasswordRequest(String password) {
return SetWalletPasswordRequest.newBuilder().setPassword(password).build();
}
diff --git a/apitest/src/test/java/bisq/apitest/method/wallet/BsqWalletTest.java b/apitest/src/test/java/bisq/apitest/method/wallet/BsqWalletTest.java
new file mode 100644
index 00000000000..406308a919c
--- /dev/null
+++ b/apitest/src/test/java/bisq/apitest/method/wallet/BsqWalletTest.java
@@ -0,0 +1,64 @@
+package bisq.apitest.method.wallet;
+
+import org.bitcoinj.core.LegacyAddress;
+import org.bitcoinj.core.NetworkParameters;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import static bisq.apitest.Scaffold.BitcoinCoreApp.bitcoind;
+import static bisq.apitest.config.BisqAppConfig.alicedaemon;
+import static bisq.apitest.config.BisqAppConfig.seednode;
+import static org.bitcoinj.core.NetworkParameters.PAYMENT_PROTOCOL_ID_MAINNET;
+import static org.bitcoinj.core.NetworkParameters.PAYMENT_PROTOCOL_ID_REGTEST;
+import static org.bitcoinj.core.NetworkParameters.PAYMENT_PROTOCOL_ID_TESTNET;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+
+
+
+import bisq.apitest.method.MethodTest;
+
+// @Disabled
+@Slf4j
+@TestMethodOrder(OrderAnnotation.class)
+public class BsqWalletTest extends MethodTest {
+
+ @BeforeAll
+ public static void setUp() {
+ startSupportingApps(false,
+ true,
+ bitcoind,
+ seednode,
+ alicedaemon);
+ }
+
+ @Test
+ @Order(1)
+ public void testGetUnusedBsqAddress() {
+ var request = createGetUnusedBsqAddressRequest();
+
+ String address = grpcStubs(alicedaemon).walletsService.getUnusedBsqAddress(request).getAddress();
+ assertFalse(address.isEmpty());
+ assertTrue(address.startsWith("B"));
+
+ NetworkParameters networkParameters = LegacyAddress.getParametersFromAddress(address.substring(1));
+ String addressNetwork = networkParameters.getPaymentProtocolId();
+ assertNotEquals(PAYMENT_PROTOCOL_ID_MAINNET, addressNetwork);
+ // TODO Fix bug(?) causing the regtest bsq address network to be evaluated as 'testnet' here.
+ assertTrue(addressNetwork.equals(PAYMENT_PROTOCOL_ID_TESTNET)
+ || addressNetwork.equals(PAYMENT_PROTOCOL_ID_REGTEST));
+ }
+
+ @AfterAll
+ public static void tearDown() {
+ tearDownScaffold();
+ }
+}
diff --git a/apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java b/apitest/src/test/java/bisq/apitest/method/wallet/GetBalanceTest.java
similarity index 96%
rename from apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java
rename to apitest/src/test/java/bisq/apitest/method/wallet/GetBalanceTest.java
index 1d44590837b..b31ccd99e02 100644
--- a/apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java
+++ b/apitest/src/test/java/bisq/apitest/method/wallet/GetBalanceTest.java
@@ -15,7 +15,7 @@
* along with Bisq. If not, see .
*/
-package bisq.apitest.method;
+package bisq.apitest.method.wallet;
import bisq.proto.grpc.GetBalanceRequest;
@@ -36,6 +36,10 @@
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+
+
+import bisq.apitest.method.MethodTest;
+
@Disabled
@Slf4j
@TestMethodOrder(OrderAnnotation.class)
diff --git a/apitest/src/test/java/bisq/apitest/method/WalletProtectionTest.java b/apitest/src/test/java/bisq/apitest/method/wallet/WalletProtectionTest.java
similarity index 98%
rename from apitest/src/test/java/bisq/apitest/method/WalletProtectionTest.java
rename to apitest/src/test/java/bisq/apitest/method/wallet/WalletProtectionTest.java
index 08547e9ebb9..82174f5195a 100644
--- a/apitest/src/test/java/bisq/apitest/method/WalletProtectionTest.java
+++ b/apitest/src/test/java/bisq/apitest/method/wallet/WalletProtectionTest.java
@@ -1,4 +1,4 @@
-package bisq.apitest.method;
+package bisq.apitest.method.wallet;
import io.grpc.StatusRuntimeException;
@@ -18,6 +18,10 @@
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+
+
+import bisq.apitest.method.MethodTest;
+
@SuppressWarnings("ResultOfMethodCallIgnored")
@Disabled
@Slf4j
diff --git a/apitest/src/test/java/bisq/apitest/scenario/WalletTest.java b/apitest/src/test/java/bisq/apitest/scenario/WalletTest.java
index ecd38dc2295..36e16142eaf 100644
--- a/apitest/src/test/java/bisq/apitest/scenario/WalletTest.java
+++ b/apitest/src/test/java/bisq/apitest/scenario/WalletTest.java
@@ -35,7 +35,7 @@
import bisq.apitest.method.MethodTest;
-import bisq.apitest.method.WalletProtectionTest;
+import bisq.apitest.method.wallet.WalletProtectionTest;
@Slf4j
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
diff --git a/cli/src/main/java/bisq/cli/CliMain.java b/cli/src/main/java/bisq/cli/CliMain.java
index ec0e5e71bb6..cfeb1981db9 100644
--- a/cli/src/main/java/bisq/cli/CliMain.java
+++ b/cli/src/main/java/bisq/cli/CliMain.java
@@ -29,6 +29,7 @@
import bisq.proto.grpc.GetOffersRequest;
import bisq.proto.grpc.GetPaymentAccountsRequest;
import bisq.proto.grpc.GetTradeRequest;
+import bisq.proto.grpc.GetUnusedBsqAddressRequest;
import bisq.proto.grpc.GetVersionRequest;
import bisq.proto.grpc.KeepFundsRequest;
import bisq.proto.grpc.LockWalletRequest;
@@ -90,6 +91,7 @@ private enum Method {
getbalance,
getaddressbalance,
getfundingaddresses,
+ getunusedbsqaddress,
lockwallet,
unlockwallet,
removewalletpassword,
@@ -205,6 +207,12 @@ public static void run(String[] args) {
out.println(formatAddressBalanceTbl(reply.getAddressBalanceInfoList()));
return;
}
+ case getunusedbsqaddress: {
+ var request = GetUnusedBsqAddressRequest.newBuilder().build();
+ var reply = walletsService.getUnusedBsqAddress(request);
+ out.println(reply.getAddress());
+ return;
+ }
case createoffer: {
if (nonOptionArgs.size() < 9)
throw new IllegalArgumentException("incorrect parameter count,"
@@ -223,6 +231,7 @@ public static void run(String[] args) {
marketPriceMargin = new BigDecimal(nonOptionArgs.get(7));
else
fixedPrice = nonOptionArgs.get(7);
+
var securityDeposit = new BigDecimal(nonOptionArgs.get(8));
var request = CreateOfferRequest.newBuilder()
@@ -283,7 +292,8 @@ public static void run(String[] args) {
}
case takeoffer: {
if (nonOptionArgs.size() < 3)
- throw new IllegalArgumentException("incorrect parameter count, expecting offer id, payment acct id");
+ throw new IllegalArgumentException("incorrect parameter count, "
+ + " expecting offer id, payment acct id");
var offerId = nonOptionArgs.get(1);
var paymentAccountId = nonOptionArgs.get(2);
@@ -297,7 +307,8 @@ public static void run(String[] args) {
}
case gettrade: {
if (nonOptionArgs.size() < 2)
- throw new IllegalArgumentException("incorrect parameter count, expecting trade id, [,showcontract = true|false]");
+ throw new IllegalArgumentException("incorrect parameter count, "
+ + " expecting trade id [,showcontract = true|false]");
var tradeId = nonOptionArgs.get(1);
var showContract = false;
@@ -352,7 +363,8 @@ public static void run(String[] args) {
}
case withdrawfunds: {
if (nonOptionArgs.size() < 3)
- throw new IllegalArgumentException("incorrect parameter count, expecting trade id, bitcoin wallet address");
+ throw new IllegalArgumentException("incorrect parameter count, "
+ + " expecting trade id, bitcoin wallet address");
var tradeId = nonOptionArgs.get(1);
var address = nonOptionArgs.get(2);
@@ -485,6 +497,7 @@ private static void printHelp(OptionParser parser, PrintStream stream) {
stream.format(rowFormat, "getbalance", "", "Get server wallet balance");
stream.format(rowFormat, "getaddressbalance", "address", "Get server wallet address balance");
stream.format(rowFormat, "getfundingaddresses", "", "Get BTC funding addresses");
+ stream.format(rowFormat, "getunusedbsqaddress", "", "Get unused BSQ address");
stream.format(rowFormat, "createoffer", "payment acct id, buy | sell, currency code, \\", "Create and place an offer");
stream.format(rowFormat, "", "amount (btc), min amount, use mkt based price, \\", "");
stream.format(rowFormat, "", "fixed price (btc) | mkt price margin (%), \\", "");
@@ -493,7 +506,7 @@ private static void printHelp(OptionParser parser, PrintStream stream) {
stream.format(rowFormat, "getoffer", "offer id", "Get current offer with id");
stream.format(rowFormat, "getoffers", "buy | sell, currency code", "Get current offers");
stream.format(rowFormat, "takeoffer", "offer id", "Take offer with id");
- stream.format(rowFormat, "gettrade", "trade id [,showcontract]", "Get trade summary or full contract");
+ stream.format(rowFormat, "gettrade", "trade id [,showcontract = true|false]", "Get trade summary or full contract");
stream.format(rowFormat, "confirmpaymentstarted", "trade id", "Confirm payment started");
stream.format(rowFormat, "confirmpaymentreceived", "trade id", "Confirm payment received");
stream.format(rowFormat, "keepfunds", "trade id", "Keep received funds in Bisq wallet");
diff --git a/core/src/main/java/bisq/core/api/CoreApi.java b/core/src/main/java/bisq/core/api/CoreApi.java
index 7cfcc5ce152..4e569d8a342 100644
--- a/core/src/main/java/bisq/core/api/CoreApi.java
+++ b/core/src/main/java/bisq/core/api/CoreApi.java
@@ -229,6 +229,10 @@ public List getFundingAddresses() {
return walletsService.getFundingAddresses();
}
+ public String getUnusedBsqAddress() {
+ return walletsService.getUnusedBsqAddress();
+ }
+
public void setWalletPassword(String password, String newPassword) {
walletsService.setWalletPassword(password, newPassword);
}
diff --git a/core/src/main/java/bisq/core/api/CoreWalletsService.java b/core/src/main/java/bisq/core/api/CoreWalletsService.java
index fc15ec5062a..37ec60d0d52 100644
--- a/core/src/main/java/bisq/core/api/CoreWalletsService.java
+++ b/core/src/main/java/bisq/core/api/CoreWalletsService.java
@@ -20,6 +20,7 @@
import bisq.core.api.model.AddressBalanceInfo;
import bisq.core.btc.Balances;
import bisq.core.btc.model.AddressEntry;
+import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.WalletsManager;
@@ -55,6 +56,7 @@ class CoreWalletsService {
private final Balances balances;
private final WalletsManager walletsManager;
+ private final BsqWalletService bsqWalletService;
private final BtcWalletService btcWalletService;
@Nullable
@@ -66,9 +68,11 @@ class CoreWalletsService {
@Inject
public CoreWalletsService(Balances balances,
WalletsManager walletsManager,
+ BsqWalletService bsqWalletService,
BtcWalletService btcWalletService) {
this.balances = balances;
this.walletsManager = walletsManager;
+ this.bsqWalletService = bsqWalletService;
this.btcWalletService = btcWalletService;
}
@@ -134,6 +138,10 @@ List getFundingAddresses() {
.collect(Collectors.toList());
}
+ String getUnusedBsqAddress() {
+ return bsqWalletService.getUnusedBsqAddressAsString();
+ }
+
int getNumConfirmationsForMostRecentTransaction(String addressString) {
Address address = getAddressEntry(addressString).getAddress();
TransactionConfidence confidence = btcWalletService.getConfidenceForAddress(address);
diff --git a/core/src/main/java/bisq/core/api/model/BalancesInfo.java b/core/src/main/java/bisq/core/api/model/BalancesInfo.java
new file mode 100644
index 00000000000..39179fde2b3
--- /dev/null
+++ b/core/src/main/java/bisq/core/api/model/BalancesInfo.java
@@ -0,0 +1,42 @@
+package bisq.core.api.model;
+
+import bisq.common.Payload;
+
+import lombok.Getter;
+
+@Getter
+public class BalancesInfo implements Payload {
+
+ private final BsqBalanceInfo bsqBalanceInfo;
+ private final BtcBalanceInfo btcBalanceInfo;
+
+ public BalancesInfo(BsqBalanceInfo bsqBalanceInfo, BtcBalanceInfo btcBalanceInfo) {
+ this.bsqBalanceInfo = bsqBalanceInfo;
+ this.btcBalanceInfo = btcBalanceInfo;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ // PROTO BUFFER
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ public bisq.proto.grpc.BalancesInfo toProtoMessage() {
+ return bisq.proto.grpc.BalancesInfo.newBuilder()
+ .setBsqBalanceInfo(bsqBalanceInfo.toProtoMessage())
+ .setBtcBalanceInfo(btcBalanceInfo.toProtoMessage())
+ .build();
+ }
+
+ public static BalancesInfo fromProto(bisq.proto.grpc.BalancesInfo proto) {
+ return new BalancesInfo(BsqBalanceInfo.fromProto(proto.getBsqBalanceInfo()),
+ BtcBalanceInfo.fromProto(proto.getBtcBalanceInfo()));
+ }
+
+ @Override
+ public String toString() {
+ return "BalancesInfo{" + "\n" +
+ " " + bsqBalanceInfo.toString() + "\n" +
+ ", " + btcBalanceInfo.toString() + "\n" +
+ '}';
+ }
+}
diff --git a/core/src/main/java/bisq/core/api/model/BsqBalanceInfo.java b/core/src/main/java/bisq/core/api/model/BsqBalanceInfo.java
new file mode 100644
index 00000000000..ff314e087ba
--- /dev/null
+++ b/core/src/main/java/bisq/core/api/model/BsqBalanceInfo.java
@@ -0,0 +1,87 @@
+package bisq.core.api.model;
+
+import bisq.common.Payload;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import lombok.Getter;
+
+@Getter
+public class BsqBalanceInfo implements Payload {
+
+ // All balances are in BSQ satoshis.
+ private final long availableConfirmedBalance;
+ private final long unverifiedBalance;
+ private final long unconfirmedChangeBalance;
+ private final long lockedForVotingBalance;
+ private final long lockupBondsBalance;
+ private final long unlockingBondsBalance;
+
+ public BsqBalanceInfo(long availableConfirmedBalance,
+ long unverifiedBalance,
+ long unconfirmedChangeBalance,
+ long lockedForVotingBalance,
+ long lockupBondsBalance,
+ long unlockingBondsBalance) {
+ this.availableConfirmedBalance = availableConfirmedBalance;
+ this.unverifiedBalance = unverifiedBalance;
+ this.unconfirmedChangeBalance = unconfirmedChangeBalance;
+ this.lockedForVotingBalance = lockedForVotingBalance;
+ this.lockupBondsBalance = lockupBondsBalance;
+ this.unlockingBondsBalance = unlockingBondsBalance;
+ }
+
+ @VisibleForTesting
+ public static BsqBalanceInfo valueOf(long availableConfirmedBalance,
+ long unverifiedBalance,
+ long unconfirmedChangeBalance,
+ long lockedForVotingBalance,
+ long lockupBondsBalance,
+ long unlockingBondsBalance) {
+ // Convenience for creating a model instance instead of a proto.
+ return new BsqBalanceInfo(availableConfirmedBalance,
+ unverifiedBalance,
+ unconfirmedChangeBalance,
+ lockedForVotingBalance,
+ lockupBondsBalance,
+ unlockingBondsBalance);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ // PROTO BUFFER
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ public bisq.proto.grpc.BsqBalanceInfo toProtoMessage() {
+ return bisq.proto.grpc.BsqBalanceInfo.newBuilder()
+ .setAvailableConfirmedBalance(availableConfirmedBalance)
+ .setUnverifiedBalance(unverifiedBalance)
+ .setUnconfirmedChangeBalance(unconfirmedChangeBalance)
+ .setLockedForVotingBalance(lockedForVotingBalance)
+ .setLockupBondsBalance(lockupBondsBalance)
+ .setUnlockingBondsBalance(unlockingBondsBalance)
+ .build();
+
+ }
+
+ public static BsqBalanceInfo fromProto(bisq.proto.grpc.BsqBalanceInfo proto) {
+ return new BsqBalanceInfo(proto.getAvailableConfirmedBalance(),
+ proto.getUnverifiedBalance(),
+ proto.getUnconfirmedChangeBalance(),
+ proto.getLockedForVotingBalance(),
+ proto.getLockupBondsBalance(),
+ proto.getUnlockingBondsBalance());
+ }
+
+ @Override
+ public String toString() {
+ return "BsqBalanceInfo{" +
+ "availableConfirmedBalance=" + availableConfirmedBalance +
+ ", unverifiedBalance=" + unverifiedBalance +
+ ", unconfirmedChangeBalance=" + unconfirmedChangeBalance +
+ ", lockedForVotingBalance=" + lockedForVotingBalance +
+ ", lockupBondsBalance=" + lockupBondsBalance +
+ ", unlockingBondsBalance=" + unlockingBondsBalance +
+ '}';
+ }
+}
diff --git a/core/src/main/java/bisq/core/api/model/BtcBalanceInfo.java b/core/src/main/java/bisq/core/api/model/BtcBalanceInfo.java
new file mode 100644
index 00000000000..6e8708c3e37
--- /dev/null
+++ b/core/src/main/java/bisq/core/api/model/BtcBalanceInfo.java
@@ -0,0 +1,70 @@
+package bisq.core.api.model;
+
+import bisq.common.Payload;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import lombok.Getter;
+
+@Getter
+public class BtcBalanceInfo implements Payload {
+
+ // All balances are in BTC satoshis.
+ private final long availableBalance;
+ private final long reservedBalance;
+ private final long totalAvailableBalance; // available + reserved
+ private final long lockedBalance;
+
+ public BtcBalanceInfo(long availableBalance,
+ long reservedBalance,
+ long totalAvailableBalance,
+ long lockedBalance) {
+ this.availableBalance = availableBalance;
+ this.reservedBalance = reservedBalance;
+ this.totalAvailableBalance = totalAvailableBalance;
+ this.lockedBalance = lockedBalance;
+ }
+
+ @VisibleForTesting
+ public static BtcBalanceInfo valueOf(long availableBalance,
+ long reservedBalance,
+ long totalAvailableBalance,
+ long lockedBalance) {
+ // Convenience for creating a model instance instead of a proto.
+ return new BtcBalanceInfo(availableBalance,
+ reservedBalance,
+ totalAvailableBalance,
+ lockedBalance);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ // PROTO BUFFER
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ public bisq.proto.grpc.BtcBalanceInfo toProtoMessage() {
+ return bisq.proto.grpc.BtcBalanceInfo.newBuilder()
+ .setAvailableBalance(availableBalance)
+ .setReservedBalance(reservedBalance)
+ .setTotalAvailableBalance(totalAvailableBalance)
+ .setLockedBalance(lockedBalance)
+ .build();
+ }
+
+ public static BtcBalanceInfo fromProto(bisq.proto.grpc.BtcBalanceInfo proto) {
+ return new BtcBalanceInfo(proto.getAvailableBalance(),
+ proto.getReservedBalance(),
+ proto.getTotalAvailableBalance(),
+ proto.getLockedBalance());
+ }
+
+ @Override
+ public String toString() {
+ return "BtcBalanceInfo{" +
+ "availableBalance=" + availableBalance +
+ ", reservedBalance=" + reservedBalance +
+ ", totalAvailableBalance=" + totalAvailableBalance +
+ ", lockedBalance=" + lockedBalance +
+ '}';
+ }
+}
diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java
index 1b5cb42e4cc..3e636a663d8 100644
--- a/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java
+++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java
@@ -26,6 +26,8 @@
import bisq.proto.grpc.GetBalanceRequest;
import bisq.proto.grpc.GetFundingAddressesReply;
import bisq.proto.grpc.GetFundingAddressesRequest;
+import bisq.proto.grpc.GetUnusedBsqAddressReply;
+import bisq.proto.grpc.GetUnusedBsqAddressRequest;
import bisq.proto.grpc.LockWalletReply;
import bisq.proto.grpc.LockWalletRequest;
import bisq.proto.grpc.RemoveWalletPasswordReply;
@@ -110,6 +112,23 @@ public void getFundingAddresses(GetFundingAddressesRequest req,
}
}
+ @Override
+ public void getUnusedBsqAddress(GetUnusedBsqAddressRequest req,
+ StreamObserver responseObserver) {
+ try {
+ String address = coreApi.getUnusedBsqAddress();
+ var reply = GetUnusedBsqAddressReply.newBuilder()
+ .setAddress(address)
+ .build();
+ responseObserver.onNext(reply);
+ responseObserver.onCompleted();
+ } catch (IllegalStateException cause) {
+ var ex = new StatusRuntimeException(Status.UNKNOWN.withDescription(cause.getMessage()));
+ responseObserver.onError(ex);
+ throw ex;
+ }
+ }
+
@Override
public void setWalletPassword(SetWalletPasswordRequest req,
StreamObserver responseObserver) {
diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto
index d9e0a3973d8..5005ad1eef8 100644
--- a/proto/src/main/proto/grpc.proto
+++ b/proto/src/main/proto/grpc.proto
@@ -81,6 +81,7 @@ message CreateOfferRequest {
uint64 minAmount = 7;
double buyerSecurityDeposit = 8;
string paymentAccountId = 9;
+ string makerFeeCurrencyCode = 10;
}
message CreateOfferReply {
@@ -105,13 +106,14 @@ message OfferInfo {
uint64 volume = 8;
uint64 minVolume = 9;
uint64 buyerSecurityDeposit = 10;
- string paymentAccountId = 11;
- string paymentMethodId = 12;
- string paymentMethodShortName = 13;
- string baseCurrencyCode = 14;
- string counterCurrencyCode = 15;
- uint64 date = 16;
- string state = 17;
+ bool isCurrencyForMakerFeeBtc = 11;
+ string paymentAccountId = 12;
+ string paymentMethodId = 13;
+ string paymentMethodShortName = 14;
+ string baseCurrencyCode = 15;
+ string counterCurrencyCode = 16;
+ uint64 date = 17;
+ string state = 18;
}
///////////////////////////////////////////////////////////////////////////////////////////
@@ -198,6 +200,7 @@ service Trades {
message TakeOfferRequest {
string offerId = 1;
string paymentAccountId = 2;
+ string takerFeeCurrencyCode = 3;
}
message TakeOfferReply {
@@ -275,8 +278,18 @@ message TradeInfo {
service Wallets {
rpc GetBalance (GetBalanceRequest) returns (GetBalanceReply) {
}
+ rpc GetBalances (GetBalancesRequest) returns (GetBalancesReply) {
+ }
+ rpc GetBsqBalances (GetBsqBalancesRequest) returns (GetBsqBalancesReply) {
+ }
+ rpc GetBtcBalances (GetBtcBalancesRequest) returns (GetBtcBalancesReply) {
+ }
rpc GetAddressBalance (GetAddressBalanceRequest) returns (GetAddressBalanceReply) {
}
+ rpc GetUnusedBsqAddress (GetUnusedBsqAddressRequest) returns (GetUnusedBsqAddressReply) {
+ }
+ rpc SendBsq (SendBsqRequest) returns (SendBsqReply) {
+ }
rpc GetFundingAddresses (GetFundingAddressesRequest) returns (GetFundingAddressesReply) {
}
rpc SetWalletPassword (SetWalletPasswordRequest) returns (SetWalletPasswordReply) {
@@ -296,6 +309,27 @@ message GetBalanceReply {
uint64 balance = 1;
}
+message GetBalancesRequest {
+}
+
+message GetBalancesReply {
+ BalancesInfo balances = 1;
+}
+
+message GetBsqBalancesRequest {
+}
+
+message GetBsqBalancesReply {
+ BsqBalanceInfo bsqBalanceInfo = 1;
+}
+
+message GetBtcBalancesRequest {
+}
+
+message GetBtcBalancesReply {
+ BtcBalanceInfo btcBalanceInfo = 1;
+}
+
message GetAddressBalanceRequest {
string address = 1;
}
@@ -304,6 +338,21 @@ message GetAddressBalanceReply {
AddressBalanceInfo addressBalanceInfo = 1;
}
+message GetUnusedBsqAddressRequest {
+}
+
+message GetUnusedBsqAddressReply {
+ string address = 1;
+}
+
+message SendBsqRequest {
+ string address = 1;
+ double amount = 2;
+}
+
+message SendBsqReply {
+}
+
message GetFundingAddressesRequest {
}
@@ -340,6 +389,27 @@ message UnlockWalletRequest {
message UnlockWalletReply {
}
+message BalancesInfo {
+ BsqBalanceInfo bsqBalanceInfo = 1;
+ BtcBalanceInfo btcBalanceInfo = 2;
+}
+
+message BsqBalanceInfo {
+ uint64 availableConfirmedBalance = 1;
+ uint64 unverifiedBalance = 2;
+ uint64 unconfirmedChangeBalance = 3;
+ uint64 lockedForVotingBalance = 4;
+ uint64 lockupBondsBalance = 5;
+ uint64 unlockingBondsBalance = 6;
+}
+
+message BtcBalanceInfo {
+ uint64 availableBalance = 1;
+ uint64 reservedBalance = 2;
+ uint64 totalAvailableBalance = 3;
+ uint64 lockedBalance = 4;
+}
+
message AddressBalanceInfo {
string address = 1;
int64 balance = 2;