mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Change sendbsq's amount parameter type to String
This commit is contained in:
parent
9b4bdfc5ad
commit
65df9e1503
@ -160,7 +160,7 @@ public class MethodTest extends ApiTestCase {
|
||||
return GetUnusedBsqAddressRequest.newBuilder().build();
|
||||
}
|
||||
|
||||
protected final SendBsqRequest createSendBsqRequest(String address, double amount) {
|
||||
protected final SendBsqRequest createSendBsqRequest(String address, String amount) {
|
||||
return SendBsqRequest.newBuilder().setAddress(address).setAmount(amount).build();
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public class MethodTest extends ApiTestCase {
|
||||
return grpcStubs(bisqAppConfig).walletsService.getUnusedBsqAddress(createGetUnusedBsqAddressRequest()).getAddress();
|
||||
}
|
||||
|
||||
protected final void sendBsq(BisqAppConfig bisqAppConfig, String address, double amount) {
|
||||
protected final void sendBsq(BisqAppConfig bisqAppConfig, String address, String amount) {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
grpcStubs(bisqAppConfig).walletsService.sendBsq(createSendBsqRequest(address, amount));
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class BsqWalletTest extends MethodTest {
|
||||
0,
|
||||
0);
|
||||
|
||||
private static final double SEND_BSQ_AMOUNT = 25000.50;
|
||||
private static final String SEND_BSQ_AMOUNT = "25000.50";
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
@ -92,13 +92,13 @@ public class BsqWalletTest extends MethodTest {
|
||||
@Order(2)
|
||||
public void testInitialBsqBalances(final TestInfo testInfo) {
|
||||
BsqBalanceInfo alicesBsqBalances = getBsqBalances(alicedaemon);
|
||||
log.info("{} -> Alice's BSQ Initial Balances -> \n{}",
|
||||
log.debug("{} -> Alice's BSQ Initial Balances -> \n{}",
|
||||
testName(testInfo),
|
||||
formatBsqBalanceInfoTbl(alicesBsqBalances));
|
||||
verifyBsqBalances(ALICES_INITIAL_BSQ_BALANCES, alicesBsqBalances);
|
||||
|
||||
BsqBalanceInfo bobsBsqBalances = getBsqBalances(bobdaemon);
|
||||
log.info("{} -> Bob's BSQ Initial Balances -> \n{}",
|
||||
log.debug("{} -> Bob's BSQ Initial Balances -> \n{}",
|
||||
testName(testInfo),
|
||||
formatBsqBalanceInfoTbl(bobsBsqBalances));
|
||||
verifyBsqBalances(BOBS_INITIAL_BSQ_BALANCES, bobsBsqBalances);
|
||||
@ -114,7 +114,7 @@ public class BsqWalletTest extends MethodTest {
|
||||
BsqBalanceInfo alicesBsqBalances = getBsqBalances(alicedaemon);
|
||||
BsqBalanceInfo bobsBsqBalances = waitForNonZeroUnverifiedBalance(bobdaemon);
|
||||
|
||||
log.info("BSQ Balances Before BTC Block Gen...");
|
||||
log.debug("BSQ Balances Before BTC Block Gen...");
|
||||
printBobAndAliceBsqBalances(testInfo,
|
||||
bobsBsqBalances,
|
||||
alicesBsqBalances,
|
||||
@ -147,7 +147,7 @@ public class BsqWalletTest extends MethodTest {
|
||||
BsqBalanceInfo alicesBsqBalances = getBsqBalances(alicedaemon);
|
||||
BsqBalanceInfo bobsBsqBalances = waitForNewAvailableConfirmedBalance(bobdaemon, 150000000);
|
||||
|
||||
log.info("See Available Confirmed BSQ Balances...");
|
||||
log.debug("See Available Confirmed BSQ Balances...");
|
||||
printBobAndAliceBsqBalances(testInfo,
|
||||
bobsBsqBalances,
|
||||
alicesBsqBalances,
|
||||
@ -214,13 +214,13 @@ public class BsqWalletTest extends MethodTest {
|
||||
BsqBalanceInfo bobsBsqBalances,
|
||||
BsqBalanceInfo alicesBsqBalances,
|
||||
BisqAppConfig senderApp) {
|
||||
log.info("{} -> Bob's BSQ Balances After {} {} BSQ-> \n{}",
|
||||
log.debug("{} -> Bob's BSQ Balances After {} {} BSQ-> \n{}",
|
||||
testName(testInfo),
|
||||
senderApp.equals(bobdaemon) ? "Sending" : "Receiving",
|
||||
SEND_BSQ_AMOUNT,
|
||||
formatBsqBalanceInfoTbl(bobsBsqBalances));
|
||||
|
||||
log.info("{} -> Alice's Balances After {} {} BSQ-> \n{}",
|
||||
log.debug("{} -> Alice's Balances After {} {} BSQ-> \n{}",
|
||||
testName(testInfo),
|
||||
senderApp.equals(alicedaemon) ? "Sending" : "Receiving",
|
||||
SEND_BSQ_AMOUNT,
|
||||
|
@ -258,11 +258,12 @@ public class CliMain {
|
||||
if (nonOptionArgs.size() < 3)
|
||||
throw new IllegalArgumentException("no bsq amount specified");
|
||||
|
||||
double amount;
|
||||
var amount = nonOptionArgs.get(2);
|
||||
|
||||
try {
|
||||
amount = Double.parseDouble(nonOptionArgs.get(2));
|
||||
Double.parseDouble(amount);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException(format("'%s' is not a number", nonOptionArgs.get(2)));
|
||||
throw new IllegalArgumentException(format("'%s' is not a number", amount));
|
||||
}
|
||||
|
||||
var request = SendBsqRequest.newBuilder()
|
||||
@ -270,7 +271,7 @@ public class CliMain {
|
||||
.setAmount(amount)
|
||||
.build();
|
||||
walletsService.sendBsq(request);
|
||||
out.printf("%.2f BSQ sent to %s%n", amount, address);
|
||||
out.printf("%s BSQ sent to %s%n", amount, address);
|
||||
return;
|
||||
}
|
||||
case gettxfeerate: {
|
||||
|
@ -244,7 +244,7 @@ public class CoreApi {
|
||||
return walletsService.getUnusedBsqAddress();
|
||||
}
|
||||
|
||||
public void sendBsq(String address, double amount, TxBroadcaster.Callback callback) {
|
||||
public void sendBsq(String address, String amount, TxBroadcaster.Callback callback) {
|
||||
walletsService.sendBsq(address, amount, callback);
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class CoreWalletsService {
|
||||
}
|
||||
|
||||
void sendBsq(String address,
|
||||
double amount,
|
||||
String amount,
|
||||
TxBroadcaster.Callback callback) {
|
||||
try {
|
||||
LegacyAddress legacyAddress = getValidBsqLegacyAddress(address);
|
||||
@ -205,7 +205,8 @@ class CoreWalletsService {
|
||||
|
||||
void getTxFeeRate(ResultHandler resultHandler) {
|
||||
try {
|
||||
ListenableFuture<Void> future = (ListenableFuture<Void>) executor.submit(() -> feeService.requestFees());
|
||||
ListenableFuture<Void> future =
|
||||
(ListenableFuture<Void>) executor.submit(() -> feeService.requestFees());
|
||||
Futures.addCallback(future, new FutureCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(@Nullable Void ignored) {
|
||||
@ -420,11 +421,11 @@ class CoreWalletsService {
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a Coin for the double amount, or a RuntimeException if invalid.
|
||||
private Coin getValidBsqTransferAmount(double amount) {
|
||||
Coin amountAsCoin = parseToCoin(Double.toString(amount), bsqFormatter);
|
||||
// Returns a Coin for the amount string, or a RuntimeException if invalid.
|
||||
private Coin getValidBsqTransferAmount(String amount) {
|
||||
Coin amountAsCoin = parseToCoin(amount, bsqFormatter);
|
||||
if (amountAsCoin.equals(Coin.ZERO))
|
||||
throw new IllegalStateException(format("%.2f bsq is an invalid send amount", amount));
|
||||
throw new IllegalStateException(format("%s bsq is an invalid send amount", amount));
|
||||
|
||||
return amountAsCoin;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ message GetUnusedBsqAddressReply {
|
||||
|
||||
message SendBsqRequest {
|
||||
string address = 1;
|
||||
double amount = 2;
|
||||
string amount = 2;
|
||||
}
|
||||
|
||||
message SendBsqReply {
|
||||
|
Loading…
Reference in New Issue
Block a user