mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Apply display strings for dao
This commit is contained in:
parent
1cfda23100
commit
9d8b3ed6eb
17 changed files with 285 additions and 225 deletions
|
@ -427,6 +427,10 @@ public class Utilities {
|
|||
return Utilities.isWindows() ? System.getenv("USERPROFILE") : System.getProperty("user.home");
|
||||
}
|
||||
|
||||
public static double getFeePerByte(Coin miningFee, int txSize) {
|
||||
return Utilities.getFeePerByte(miningFee, txSize);
|
||||
}
|
||||
|
||||
private static class AnnotationExclusionStrategy implements ExclusionStrategy {
|
||||
@Override
|
||||
public boolean shouldSkipField(FieldAttributes f) {
|
||||
|
|
|
@ -77,13 +77,13 @@ public class AccountSettingsView extends ActivatableViewAndModel {
|
|||
};
|
||||
|
||||
ToggleGroup toggleGroup = new ToggleGroup();
|
||||
paymentAccount = new MenuItem(navigation, toggleGroup, Res.get("account.paymentAccount"), FiatAccountsView.class, AwesomeIcon.MONEY);
|
||||
altCoinsAccountView = new MenuItem(navigation, toggleGroup, Res.get("account.altCoinsAccountView"), AltCoinAccountsView.class, AwesomeIcon.LINK);
|
||||
arbitratorSelection = new MenuItem(navigation, toggleGroup, Res.get("account.arbitratorSelection"),
|
||||
paymentAccount = new MenuItem(navigation, toggleGroup, Res.get("account.menu.paymentAccount"), FiatAccountsView.class, AwesomeIcon.MONEY);
|
||||
altCoinsAccountView = new MenuItem(navigation, toggleGroup, Res.get("account.menu.altCoinsAccountView"), AltCoinAccountsView.class, AwesomeIcon.LINK);
|
||||
arbitratorSelection = new MenuItem(navigation, toggleGroup, Res.get("account.menu.arbitratorSelection"),
|
||||
ArbitratorSelectionView.class, AwesomeIcon.USER_MD);
|
||||
password = new MenuItem(navigation, toggleGroup, Res.get("account.password"), PasswordView.class, AwesomeIcon.UNLOCK_ALT);
|
||||
seedWords = new MenuItem(navigation, toggleGroup, Res.get("account.seedWords"), SeedWordsView.class, AwesomeIcon.KEY);
|
||||
backup = new MenuItem(navigation, toggleGroup, Res.get("account.backup"), BackupView.class, AwesomeIcon.CLOUD_DOWNLOAD);
|
||||
password = new MenuItem(navigation, toggleGroup, Res.get("account.menu.password"), PasswordView.class, AwesomeIcon.UNLOCK_ALT);
|
||||
seedWords = new MenuItem(navigation, toggleGroup, Res.get("account.menu.seedWords"), SeedWordsView.class, AwesomeIcon.KEY);
|
||||
backup = new MenuItem(navigation, toggleGroup, Res.get("account.menu.backup"), BackupView.class, AwesomeIcon.CLOUD_DOWNLOAD);
|
||||
|
||||
leftVBox.getChildren().addAll(paymentAccount, altCoinsAccountView, arbitratorSelection, password, seedWords, backup);
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
|||
|
||||
@Override
|
||||
public void initialize() {
|
||||
bsqWalletTab.setText(Res.get("daoView.tab.bsqWallet"));
|
||||
compensationTab.setText(Res.get("daoView.tab.compensation"));
|
||||
votingTab.setText(Res.get("daoView.tab.voting"));
|
||||
bsqWalletTab.setText(Res.get("dao.tab.bsqWallet"));
|
||||
compensationTab.setText(Res.get("dao.tab.compensation"));
|
||||
votingTab.setText(Res.get("dao.tab.voting"));
|
||||
|
||||
navigationListener = viewPath -> {
|
||||
if (viewPath.size() == 3 && viewPath.indexOf(DaoView.class) == 1) {
|
||||
|
|
|
@ -20,6 +20,7 @@ package io.bitsquare.gui.main.dao.compensation;
|
|||
import io.bitsquare.dao.compensation.CompensationRequestPayload;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.gui.util.Layout;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -43,17 +44,18 @@ public class CompensationRequestDisplay {
|
|||
|
||||
public void createAllFields(String title, double top) {
|
||||
addTitledGroupBg(gridPane, gridRow, 10, title, top);
|
||||
uidTextField = addLabelInputTextField(gridPane, gridRow, "ID:", top == Layout.GROUP_DISTANCE ? Layout.FIRST_ROW_AND_GROUP_DISTANCE : Layout.FIRST_ROW_DISTANCE).second;
|
||||
uidTextField = addLabelInputTextField(gridPane, gridRow, Res.getWithCol("shared.id"), top == Layout.GROUP_DISTANCE ? Layout.FIRST_ROW_AND_GROUP_DISTANCE : Layout.FIRST_ROW_DISTANCE).second;
|
||||
uidTextField.setEditable(false);
|
||||
nameTextField = addLabelInputTextField(gridPane, ++gridRow, "Name/nickname:").second;
|
||||
titleTextField = addLabelInputTextField(gridPane, ++gridRow, "Title:").second;
|
||||
categoryTextField = addLabelInputTextField(gridPane, ++gridRow, "Category:").second;
|
||||
descriptionTextField = addLabelInputTextField(gridPane, ++gridRow, "Description:").second;
|
||||
linkTextField = addLabelInputTextField(gridPane, ++gridRow, "Link to detail info:").second;
|
||||
startDateTextField = addLabelInputTextField(gridPane, ++gridRow, "Start date:").second;
|
||||
endDateTextField = addLabelInputTextField(gridPane, ++gridRow, "Delivery date:").second;
|
||||
requestedBTCTextField = addLabelInputTextField(gridPane, ++gridRow, "Requested funds in BTC:").second;
|
||||
btcAddressTextField = addLabelInputTextField(gridPane, ++gridRow, "Bitcoin address:").second;
|
||||
nameTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.name")).second;
|
||||
titleTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.title")).second;
|
||||
categoryTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.category")).second;
|
||||
descriptionTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.description")).second;
|
||||
linkTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.link")).second;
|
||||
startDateTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.startDate")).second;
|
||||
endDateTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.endDate")).second;
|
||||
requestedBTCTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.requestedBTC")).second;
|
||||
btcAddressTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.compensation.display.btcAddress")).second;
|
||||
|
||||
}
|
||||
|
||||
public void fillWithData(CompensationRequestPayload data) {
|
||||
|
|
|
@ -27,6 +27,7 @@ import io.bitsquare.gui.main.dao.compensation.active.ActiveCompensationRequestVi
|
|||
import io.bitsquare.gui.main.dao.compensation.create.CreateCompensationRequestView;
|
||||
import io.bitsquare.gui.main.dao.compensation.past.PastCompensationRequestView;
|
||||
import io.bitsquare.gui.util.Colors;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -73,9 +74,9 @@ public class CompensationView extends ActivatableViewAndModel {
|
|||
};
|
||||
|
||||
ToggleGroup toggleGroup = new ToggleGroup();
|
||||
create = new MenuItem(navigation, toggleGroup, "Create request", CreateCompensationRequestView.class, AwesomeIcon.EDIT);
|
||||
active = new MenuItem(navigation, toggleGroup, "Active requests", ActiveCompensationRequestView.class, AwesomeIcon.ARROW_RIGHT);
|
||||
past = new MenuItem(navigation, toggleGroup, "Past requests", PastCompensationRequestView.class, AwesomeIcon.LIST);
|
||||
create = new MenuItem(navigation, toggleGroup, Res.get("dao.compensation.menuItem.createRequest"), CreateCompensationRequestView.class, AwesomeIcon.EDIT);
|
||||
active = new MenuItem(navigation, toggleGroup, Res.get("dao.compensation.menuItem.activeRequests"), ActiveCompensationRequestView.class, AwesomeIcon.ARROW_RIGHT);
|
||||
past = new MenuItem(navigation, toggleGroup, Res.get("dao.compensation.menuItem.pastRequests"), PastCompensationRequestView.class, AwesomeIcon.LIST);
|
||||
leftVBox.getChildren().addAll(create, active, past);
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class ActiveCompensationRequestView extends ActivatableView<SplitPane, Vo
|
|||
AnchorPane.setTopAnchor(gridPane, 10d);
|
||||
topAnchorPane.getChildren().add(gridPane);
|
||||
|
||||
TableGroupHeadline header = new TableGroupHeadline("Active compensation request");
|
||||
TableGroupHeadline header = new TableGroupHeadline(Res.get("dao.compensation.active.header"));
|
||||
GridPane.setRowIndex(header, 0);
|
||||
GridPane.setMargin(header, new Insets(0, -10, -10, -10));
|
||||
gridPane.getChildren().add(header);
|
||||
|
@ -123,7 +123,7 @@ public class ActiveCompensationRequestView extends ActivatableView<SplitPane, Vo
|
|||
|
||||
// tableView.setMinHeight(100);
|
||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
tableView.setPlaceholder(new Label("No transactions available"));
|
||||
tableView.setPlaceholder(new Label(Res.get("table.placeholder.noData")));
|
||||
sortedList = new SortedList<>(compensationRequestManger.getObservableCompensationRequestsList());
|
||||
tableView.setItems(sortedList);
|
||||
setColumns();
|
||||
|
@ -174,22 +174,22 @@ public class ActiveCompensationRequestView extends ActivatableView<SplitPane, Vo
|
|||
compensationRequestDisplay = new CompensationRequestDisplay(gridPane);
|
||||
}
|
||||
compensationRequestDisplay.removeAllFields();
|
||||
compensationRequestDisplay.createAllFields("Selected compensation request", Layout.GROUP_DISTANCE);
|
||||
compensationRequestDisplay.createAllFields(Res.get("dao.compensation.active.selectedRequest"), Layout.GROUP_DISTANCE);
|
||||
|
||||
//TODO
|
||||
compensationRequest.setInVotePeriod(true);
|
||||
|
||||
if (compensationRequest.isWaitingForVotingPeriod()) {
|
||||
addLabel(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), "This compensation request is not open anymore for funding. Please wait until the next funding period starts.");
|
||||
addLabel(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), Res.get("dao.compensation.active.notOpenAnymore"));
|
||||
} else if (compensationRequest.isInVotePeriod()) {
|
||||
voteButton = addButtonAfterGroup(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), "Vote on compensation request");
|
||||
voteButton = addButtonAfterGroup(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), Res.get("dao.compensation.active.vote"));
|
||||
voteButton.setOnAction(event -> {
|
||||
compensationRequestManger.setSelectedCompensationRequest(compensationRequest);
|
||||
navigation.navigateTo(MainView.class, DaoView.class, VotingView.class, VoteView.class);
|
||||
});
|
||||
} else if (compensationRequest.isInFundingPeriod()) {
|
||||
checkArgument(compensationRequest.isAccepted(), "A compensation request with state OPEN_FOR_FUNDING must be accepted.");
|
||||
fundButton = addButtonAfterGroup(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), "Fund compensation request");
|
||||
fundButton = addButtonAfterGroup(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), Res.get("dao.compensation.active.fund"));
|
||||
fundButton.setOnAction(event -> {
|
||||
fundCompensationRequestWindow.applyCompensationRequest(compensationRequest.getCompensationRequestPayload()).
|
||||
onAction(() -> {
|
||||
|
@ -198,7 +198,7 @@ public class ActiveCompensationRequestView extends ActivatableView<SplitPane, Vo
|
|||
new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(Transaction transaction) {
|
||||
UserThread.runAfter(() -> new Popup<>().feedback("Compensation request successfully funded.").show(), 1);
|
||||
UserThread.runAfter(() -> new Popup<>().feedback(Res.get("dao.compensation.active.successfullyFunded")).show(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -210,7 +210,7 @@ public class ActiveCompensationRequestView extends ActivatableView<SplitPane, Vo
|
|||
}).show();
|
||||
});
|
||||
} else if (compensationRequest.isClosed()) {
|
||||
addLabel(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), "This compensation request is not open anymore for funding. Please wait until the next funding period starts.");
|
||||
addLabel(gridPane, compensationRequestDisplay.incrementAndGetGridRow(), Res.get("dao.compensation.active.notOpenAnymore"));
|
||||
}
|
||||
compensationRequestDisplay.setAllFieldsEditable(false);
|
||||
|
||||
|
@ -250,7 +250,7 @@ public class ActiveCompensationRequestView extends ActivatableView<SplitPane, Vo
|
|||
tableView.getSortOrder().add(dateColumn);
|
||||
|
||||
|
||||
TableColumn<CompensationRequest, CompensationRequest> nameColumn = new TableColumn<>("Name");
|
||||
TableColumn<CompensationRequest, CompensationRequest> nameColumn = new TableColumn<>(Res.get("shared.name"));
|
||||
nameColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
|
||||
nameColumn.setCellFactory(
|
||||
new Callback<TableColumn<CompensationRequest, CompensationRequest>, TableCell<CompensationRequest,
|
||||
|
@ -274,7 +274,7 @@ public class ActiveCompensationRequestView extends ActivatableView<SplitPane, Vo
|
|||
tableView.getColumns().add(nameColumn);
|
||||
|
||||
|
||||
TableColumn<CompensationRequest, CompensationRequest> uidColumn = new TableColumn<>("ID");
|
||||
TableColumn<CompensationRequest, CompensationRequest> uidColumn = new TableColumn<>(Res.get("shared.id"));
|
||||
uidColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
|
||||
uidColumn.setCellFactory(
|
||||
new Callback<TableColumn<CompensationRequest, CompensationRequest>, TableCell<CompensationRequest,
|
||||
|
|
|
@ -27,7 +27,6 @@ import io.bitsquare.btc.wallet.BsqWalletService;
|
|||
import io.bitsquare.btc.wallet.BtcWalletService;
|
||||
import io.bitsquare.btc.wallet.ChangeBelowDustException;
|
||||
import io.bitsquare.common.crypto.KeyRing;
|
||||
import io.bitsquare.common.util.MathUtils;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.dao.compensation.CompensationRequestManager;
|
||||
import io.bitsquare.dao.compensation.CompensationRequestPayload;
|
||||
|
@ -97,8 +96,8 @@ public class CreateCompensationRequestView extends ActivatableView<GridPane, Voi
|
|||
public void initialize() {
|
||||
compensationRequestDisplay = new CompensationRequestDisplay(root);
|
||||
compensationRequestDisplay.removeAllFields();
|
||||
compensationRequestDisplay.createAllFields("Create new compensation request", 0);
|
||||
createButton = addButtonAfterGroup(root, compensationRequestDisplay.incrementAndGetGridRow(), "Create compensation request");
|
||||
compensationRequestDisplay.createAllFields(Res.get("dao.compensation.create.createNew"), 0);
|
||||
createButton = addButtonAfterGroup(root, compensationRequestDisplay.incrementAndGetGridRow(), Res.get("dao.compensation.create.create.button"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,101 +110,98 @@ public class CreateCompensationRequestView extends ActivatableView<GridPane, Voi
|
|||
|
||||
// TODO can be null if we are still not full connected
|
||||
nodeAddress = p2PService.getAddress();
|
||||
if (nodeAddress != null) {
|
||||
CompensationRequestPayload compensationRequestPayload = new CompensationRequestPayload(UUID.randomUUID().toString(),
|
||||
compensationRequestDisplay.nameTextField.getText(),
|
||||
compensationRequestDisplay.titleTextField.getText(),
|
||||
compensationRequestDisplay.categoryTextField.getText(),
|
||||
compensationRequestDisplay.descriptionTextField.getText(),
|
||||
compensationRequestDisplay.linkTextField.getText(),
|
||||
startDate,
|
||||
endDate,
|
||||
btcFormatter.parseToCoin(compensationRequestDisplay.requestedBTCTextField.getText()),
|
||||
compensationRequestDisplay.btcAddressTextField.getText(),
|
||||
nodeAddress,
|
||||
p2pStorageSignaturePubKey
|
||||
);
|
||||
|
||||
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
||||
Coin createCompensationRequestFee = feeService.getCreateCompensationRequestFee();
|
||||
Transaction preparedSendTx = bsqWalletService.getPreparedBurnFeeTx(createCompensationRequestFee);
|
||||
// TODO we neet to wait until all services are initiated before calling the code below
|
||||
checkNotNull(nodeAddress, "nodeAddress must not be null");
|
||||
CompensationRequestPayload compensationRequestPayload = new CompensationRequestPayload(UUID.randomUUID().toString(),
|
||||
compensationRequestDisplay.nameTextField.getText(),
|
||||
compensationRequestDisplay.titleTextField.getText(),
|
||||
compensationRequestDisplay.categoryTextField.getText(),
|
||||
compensationRequestDisplay.descriptionTextField.getText(),
|
||||
compensationRequestDisplay.linkTextField.getText(),
|
||||
startDate,
|
||||
endDate,
|
||||
btcFormatter.parseToCoin(compensationRequestDisplay.requestedBTCTextField.getText()),
|
||||
compensationRequestDisplay.btcAddressTextField.getText(),
|
||||
nodeAddress,
|
||||
p2pStorageSignaturePubKey
|
||||
);
|
||||
|
||||
checkArgument(!preparedSendTx.getInputs().isEmpty(), "preparedSendTx inputs must not be empty");
|
||||
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
||||
Coin createCompensationRequestFee = feeService.getCreateCompensationRequestFee();
|
||||
Transaction preparedSendTx = bsqWalletService.getPreparedBurnFeeTx(createCompensationRequestFee);
|
||||
|
||||
// We use the key of the first BSQ input for signing the data
|
||||
TransactionOutput connectedOutput = preparedSendTx.getInputs().get(0).getConnectedOutput();
|
||||
checkNotNull(connectedOutput, "connectedOutput must not be null");
|
||||
DeterministicKey bsqKeyPair = bsqWalletService.findKeyFromPubKeyHash(connectedOutput.getScriptPubKey().getPubKeyHash());
|
||||
checkNotNull(bsqKeyPair, "bsqKeyPair must not be null");
|
||||
checkArgument(!preparedSendTx.getInputs().isEmpty(), "preparedSendTx inputs must not be empty");
|
||||
|
||||
// We get the JSON of the object excluding signature and feeTxId
|
||||
String payloadAsJson = StringUtils.deleteWhitespace(Utilities.objectToJson(compensationRequestPayload));
|
||||
log.error(payloadAsJson);
|
||||
// Signs a text message using the standard Bitcoin messaging signing format and returns the signature as a base64
|
||||
// encoded string.
|
||||
String signature = bsqKeyPair.signMessage(payloadAsJson);
|
||||
compensationRequestPayload.setSignature(signature);
|
||||
|
||||
String dataAndSig = payloadAsJson + signature;
|
||||
byte[] dataAndSigAsBytes = dataAndSig.getBytes();
|
||||
outputStream.write(Version.COMPENSATION_REQUEST_VERSION);
|
||||
outputStream.write(Utils.sha256hash160(dataAndSigAsBytes));
|
||||
byte hash[] = outputStream.toByteArray();
|
||||
//TODO should we store the hash in the compensationRequestPayload object?
|
||||
// We use the key of the first BSQ input for signing the data
|
||||
TransactionOutput connectedOutput = preparedSendTx.getInputs().get(0).getConnectedOutput();
|
||||
checkNotNull(connectedOutput, "connectedOutput must not be null");
|
||||
DeterministicKey bsqKeyPair = bsqWalletService.findKeyFromPubKeyHash(connectedOutput.getScriptPubKey().getPubKeyHash());
|
||||
checkNotNull(bsqKeyPair, "bsqKeyPair must not be null");
|
||||
|
||||
// We get the JSON of the object excluding signature and feeTxId
|
||||
String payloadAsJson = StringUtils.deleteWhitespace(Utilities.objectToJson(compensationRequestPayload));
|
||||
log.error(payloadAsJson);
|
||||
// Signs a text message using the standard Bitcoin messaging signing format and returns the signature as a base64
|
||||
// encoded string.
|
||||
String signature = bsqKeyPair.signMessage(payloadAsJson);
|
||||
compensationRequestPayload.setSignature(signature);
|
||||
|
||||
String dataAndSig = payloadAsJson + signature;
|
||||
byte[] dataAndSigAsBytes = dataAndSig.getBytes();
|
||||
outputStream.write(Version.COMPENSATION_REQUEST_VERSION);
|
||||
outputStream.write(Utils.sha256hash160(dataAndSigAsBytes));
|
||||
byte hash[] = outputStream.toByteArray();
|
||||
//TODO should we store the hash in the compensationRequestPayload object?
|
||||
|
||||
|
||||
//TODO 1 Btc output (small payment to own compensation receiving address)
|
||||
Transaction txWithBtcFee = btcWalletService.completePreparedBsqTx(preparedSendTx, false, hash);
|
||||
Transaction signedTx = bsqWalletService.signTx(txWithBtcFee);
|
||||
Coin miningFee = signedTx.getFee();
|
||||
int txSize = signedTx.bitcoinSerialize().length;
|
||||
new Popup().headLine("Confirm compensation request fee payment transaction")
|
||||
.confirmation("Voting fee: " + btcFormatter.formatCoinWithCode(createCompensationRequestFee) + "\n" +
|
||||
"Mining fee: " + btcFormatter.formatCoinWithCode(miningFee) + " (" +
|
||||
MathUtils.roundDouble(((double) miningFee.value / (double) txSize), 2) +
|
||||
" Satoshis/byte)\n" +
|
||||
"Transaction size: " + (txSize / 1000d) + " Kb\n\n" +
|
||||
"Are you sure you want to send the transaction?")
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
try {
|
||||
bsqWalletService.commitTx(txWithBtcFee);
|
||||
// We need to create another instance, otherwise the tx would trigger an invalid state exception
|
||||
// if it gets committed 2 times
|
||||
btcWalletService.commitTx(btcWalletService.getClonedTransaction(txWithBtcFee));
|
||||
bsqWalletService.broadcastTx(signedTx, new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(@Nullable Transaction transaction) {
|
||||
checkNotNull(transaction, "Transaction must not be null at broadcastTx callback.");
|
||||
compensationRequestPayload.setFeeTxId(transaction.getHashAsString());
|
||||
compensationRequestManager.addToP2PNetwork(compensationRequestPayload);
|
||||
compensationRequestDisplay.clearForm();
|
||||
new Popup<>().confirmation("Your transaction has been successfully published.").show();
|
||||
}
|
||||
//TODO 1 Btc output (small payment to own compensation receiving address)
|
||||
Transaction txWithBtcFee = btcWalletService.completePreparedBsqTx(preparedSendTx, false, hash);
|
||||
Transaction signedTx = bsqWalletService.signTx(txWithBtcFee);
|
||||
Coin miningFee = signedTx.getFee();
|
||||
int txSize = signedTx.bitcoinSerialize().length;
|
||||
new Popup().headLine(Res.get("dao.compensation.create.confirm"))
|
||||
.confirmation(Res.get("dao.tx.summary",
|
||||
btcFormatter.formatCoinWithCode(createCompensationRequestFee),
|
||||
btcFormatter.formatCoinWithCode(miningFee),
|
||||
Utilities.getFeePerByte(miningFee, txSize),
|
||||
(txSize / 1000d)))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
try {
|
||||
bsqWalletService.commitTx(txWithBtcFee);
|
||||
// We need to create another instance, otherwise the tx would trigger an invalid state exception
|
||||
// if it gets committed 2 times
|
||||
btcWalletService.commitTx(btcWalletService.getClonedTransaction(txWithBtcFee));
|
||||
bsqWalletService.broadcastTx(signedTx, new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(@Nullable Transaction transaction) {
|
||||
checkNotNull(transaction, "Transaction must not be null at broadcastTx callback.");
|
||||
compensationRequestPayload.setFeeTxId(transaction.getHashAsString());
|
||||
compensationRequestManager.addToP2PNetwork(compensationRequestPayload);
|
||||
compensationRequestDisplay.clearForm();
|
||||
new Popup<>().confirmation(Res.get("dao.tx.published.success")).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable t) {
|
||||
log.error(t.toString());
|
||||
new Popup<>().warning(t.toString()).show();
|
||||
}
|
||||
});
|
||||
} catch (WalletException | TransactionVerificationException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
new Popup<>().warning(e.toString());
|
||||
}
|
||||
})
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show();
|
||||
} catch (InsufficientFundsException | IOException |
|
||||
TransactionVerificationException | WalletException | InsufficientMoneyException | ChangeBelowDustException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
new Popup<>().warning(e.toString()).show();
|
||||
}
|
||||
} else {
|
||||
//TODO check if that can happen
|
||||
new Popup<>().warning("Your node address is not known yet. Please try again after your hidden service is published.").show();
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable t) {
|
||||
log.error(t.toString());
|
||||
new Popup<>().warning(t.toString()).show();
|
||||
}
|
||||
});
|
||||
} catch (WalletException | TransactionVerificationException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
new Popup<>().warning(e.toString());
|
||||
}
|
||||
})
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show();
|
||||
} catch (InsufficientFundsException | IOException |
|
||||
TransactionVerificationException | WalletException | InsufficientMoneyException | ChangeBelowDustException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
new Popup<>().warning(e.toString()).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import io.bitsquare.gui.main.dao.voting.dashboard.VotingDashboardView;
|
|||
import io.bitsquare.gui.main.dao.voting.history.VotingHistoryView;
|
||||
import io.bitsquare.gui.main.dao.voting.vote.VoteView;
|
||||
import io.bitsquare.gui.util.Colors;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -73,9 +74,9 @@ public class VotingView extends ActivatableViewAndModel {
|
|||
};
|
||||
|
||||
ToggleGroup toggleGroup = new ToggleGroup();
|
||||
dashboard = new MenuItem(navigation, toggleGroup, "Dashboard", VotingDashboardView.class, AwesomeIcon.DASHBOARD);
|
||||
vote = new MenuItem(navigation, toggleGroup, "Vote", VoteView.class, AwesomeIcon.EDIT);
|
||||
history = new MenuItem(navigation, toggleGroup, "History", VotingHistoryView.class, AwesomeIcon.TABLE);
|
||||
dashboard = new MenuItem(navigation, toggleGroup, Res.get("shared.dashboard"), VotingDashboardView.class, AwesomeIcon.DASHBOARD);
|
||||
vote = new MenuItem(navigation, toggleGroup, Res.get("share.vote"), VoteView.class, AwesomeIcon.EDIT);
|
||||
history = new MenuItem(navigation, toggleGroup, Res.get("share.history"), VotingHistoryView.class, AwesomeIcon.TABLE);
|
||||
leftVBox.getChildren().addAll(dashboard, vote, history);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import io.bitsquare.gui.components.HyperlinkWithIcon;
|
|||
import io.bitsquare.gui.main.MainView;
|
||||
import io.bitsquare.gui.main.dao.compensation.CompensationRequestDisplay;
|
||||
import io.bitsquare.gui.util.Layout;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.beans.property.DoubleProperty;
|
||||
import javafx.geometry.HPos;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -108,17 +109,16 @@ public class CompensationViewItem {
|
|||
|
||||
|
||||
CompensationRequestDisplay compensationRequestDisplay = new CompensationRequestDisplay(gridPane);
|
||||
compensationRequestDisplay.createAllFields("Compensation request", Layout.GROUP_DISTANCE);
|
||||
compensationRequestDisplay.createAllFields(Res.get("dao.voting.item.title"), Layout.GROUP_DISTANCE);
|
||||
compensationRequestDisplay.setAllFieldsEditable(false);
|
||||
compensationRequestDisplay.fillWithData(compensationRequestPayload);
|
||||
|
||||
Scene scene = new Scene(anchorPane);
|
||||
scene.getStylesheets().setAll(
|
||||
"/io/bitsquare/gui/bitsquare.css",
|
||||
"/io/bitsquare/gui/images.css",
|
||||
"/io/bitsquare/gui/CandleStickChart.css");
|
||||
"/io/bitsquare/gui/images.css");
|
||||
Stage stage = new Stage();
|
||||
stage.setTitle("Compensation request with ID: " + compensationRequestPayload.getShortId());
|
||||
stage.setTitle(Res.get("dao.voting.item.stage.title", compensationRequestPayload.getShortId()));
|
||||
stage.setScene(scene);
|
||||
if (owner == null)
|
||||
owner = MainView.getRootContainer();
|
||||
|
@ -136,10 +136,10 @@ public class CompensationViewItem {
|
|||
|
||||
});
|
||||
|
||||
acceptCheckBox = new CheckBox("Accept");
|
||||
acceptCheckBox = new CheckBox(Res.get("shared.accept"));
|
||||
HBox.setMargin(acceptCheckBox, new Insets(5, 0, 0, 0));
|
||||
|
||||
declineCheckBox = new CheckBox("Decline");
|
||||
declineCheckBox = new CheckBox(Res.get("shared.decline"));
|
||||
HBox.setMargin(declineCheckBox, new Insets(5, 0, 0, 0));
|
||||
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class CompensationViewItem {
|
|||
});
|
||||
declineCheckBox.setSelected(compensationRequestVoteItem.isDeclineVote());
|
||||
|
||||
removeButton = new Button("Remove");
|
||||
removeButton = new Button(Res.get("shared.remove"));
|
||||
removeButton.setOnAction(event -> {
|
||||
vBox.getChildren().remove(hBox);
|
||||
cleanupInstance();
|
||||
|
|
|
@ -21,6 +21,7 @@ import io.bitsquare.common.UserThread;
|
|||
import io.bitsquare.dao.vote.VoteItem;
|
||||
import io.bitsquare.dao.vote.VotingDefaultValues;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -142,12 +143,12 @@ public class ParameterViewItem {
|
|||
};
|
||||
slider.valueProperty().addListener(sliderListener);
|
||||
|
||||
resetButton = new Button("Reset");
|
||||
resetButton = new Button(Res.get("shared.reset"));
|
||||
resetButton.setOnAction(event -> {
|
||||
inputTextField.setText(String.valueOf(originalValue));
|
||||
});
|
||||
|
||||
removeButton = new Button("Remove");
|
||||
removeButton = new Button(Res.get("shared.remove"));
|
||||
removeButton.setOnAction(event -> {
|
||||
vBox.getChildren().remove(hBox);
|
||||
cleanupInstance();
|
||||
|
|
|
@ -26,7 +26,6 @@ import io.bitsquare.btc.wallet.BsqWalletService;
|
|||
import io.bitsquare.btc.wallet.BtcWalletService;
|
||||
import io.bitsquare.btc.wallet.ChangeBelowDustException;
|
||||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.util.MathUtils;
|
||||
import io.bitsquare.dao.compensation.CompensationRequest;
|
||||
import io.bitsquare.dao.compensation.CompensationRequestManager;
|
||||
import io.bitsquare.dao.vote.*;
|
||||
|
@ -107,10 +106,10 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
|
||||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, gridRow, 2, "Add items for voting");
|
||||
addTitledGroupBg(root, gridRow, 2, Res.get("dao.voting.addItems"));
|
||||
|
||||
compensationRequestsComboBox = addLabelComboBox(root, gridRow, "", Layout.FIRST_ROW_DISTANCE).second;
|
||||
compensationRequestsComboBox.setPromptText("Add compensation request");
|
||||
compensationRequestsComboBox.setPromptText(Res.get("dao.voting.addRequest"));
|
||||
compensationRequestsComboBox.setConverter(new StringConverter<CompensationRequestVoteItem>() {
|
||||
@Override
|
||||
public String toString(CompensationRequestVoteItem item) {
|
||||
|
@ -131,7 +130,7 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
() -> compensationRequestsTitledGroupBg.setManaged(!CompensationViewItem.isEmpty()));
|
||||
UserThread.execute(selectionModel::clearSelection);
|
||||
} else {
|
||||
new Popup<>().warning("You have already that compensation request added.").show();
|
||||
new Popup<>().warning(Res.get("dao.voting.requestAlreadyAdded")).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +138,7 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
});
|
||||
|
||||
parametersComboBox = addLabelComboBox(root, ++gridRow, "").second;
|
||||
parametersComboBox.setPromptText("Add parameter");
|
||||
parametersComboBox.setPromptText(Res.get("dao.voting.addParameter"));
|
||||
parametersComboBox.setConverter(new StringConverter<VoteItem>() {
|
||||
@Override
|
||||
public String toString(VoteItem item) {
|
||||
|
@ -160,14 +159,14 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
() -> parametersTitledGroupBg.setManaged(!ParameterViewItem.isEmpty()));
|
||||
UserThread.execute(selectionModel::clearSelection);
|
||||
} else {
|
||||
new Popup<>().warning("You have already that parameter added.").show();
|
||||
new Popup<>().warning(Res.get("dao.voting.parameterAlreadyAdded")).show();
|
||||
}
|
||||
}
|
||||
parametersTitledGroupBg.setManaged(!ParameterViewItem.isEmpty());
|
||||
|
||||
});
|
||||
|
||||
compensationRequestsTitledGroupBg = addTitledGroupBg(root, ++gridRow, 1, "Compensation requests", Layout.GROUP_DISTANCE);
|
||||
compensationRequestsTitledGroupBg = addTitledGroupBg(root, ++gridRow, 1, Res.get("dao.voting.compensationRequests"), Layout.GROUP_DISTANCE);
|
||||
compensationRequestsTitledGroupBg.setManaged(false);
|
||||
compensationRequestsTitledGroupBg.visibleProperty().bind(compensationRequestsTitledGroupBg.managedProperty());
|
||||
|
||||
|
@ -181,7 +180,7 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
compensationRequestsVBox.visibleProperty().bind(compensationRequestsVBox.managedProperty());
|
||||
|
||||
|
||||
parametersTitledGroupBg = addTitledGroupBg(root, ++gridRow, 1, "Parameters", Layout.GROUP_DISTANCE);
|
||||
parametersTitledGroupBg = addTitledGroupBg(root, ++gridRow, 1, Res.get("shared.parameters"), Layout.GROUP_DISTANCE);
|
||||
parametersTitledGroupBg.setManaged(false);
|
||||
parametersTitledGroupBg.visibleProperty().bind(parametersTitledGroupBg.managedProperty());
|
||||
|
||||
|
@ -194,7 +193,7 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
parametersVBox.managedProperty().bind(parametersTitledGroupBg.managedProperty());
|
||||
parametersVBox.visibleProperty().bind(parametersVBox.managedProperty());
|
||||
|
||||
voteButton = addButtonAfterGroup(root, ++gridRow, "Vote");
|
||||
voteButton = addButtonAfterGroup(root, ++gridRow, Res.get("shared.vote"));
|
||||
voteButton.managedProperty().bind(createBooleanBinding(() -> compensationRequestsTitledGroupBg.isManaged() || parametersTitledGroupBg.isManaged(),
|
||||
compensationRequestsTitledGroupBg.managedProperty(), parametersTitledGroupBg.managedProperty()));
|
||||
voteButton.visibleProperty().bind(voteButton.managedProperty());
|
||||
|
@ -203,11 +202,11 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
log.error(voteItemsList.toString());
|
||||
//TODO
|
||||
if (voteItemsList.isMyVote()) {
|
||||
new Popup<>().warning("You voted already.").show();
|
||||
new Popup<>().warning(Res.get("dao.voting.votedAlready")).show();
|
||||
} else if (!voteItemsList.stream().filter(VoteItem::hasVoted).findAny().isPresent() &&
|
||||
!voteItemsList.stream().filter(e -> e instanceof CompensationRequestVoteItemCollection)
|
||||
.filter(e -> ((CompensationRequestVoteItemCollection) e).hasVotedOnAnyItem()).findAny().isPresent()) {
|
||||
new Popup<>().warning("You did not vote on any entry.").show();
|
||||
new Popup<>().warning(Res.get("dao.voting.notVotedOnAnyEntry")).show();
|
||||
} else {
|
||||
try {
|
||||
byte[] opReturnData = voteManager.calculateOpReturnData(voteItemsList);
|
||||
|
@ -218,13 +217,12 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
Transaction signedTx = bsqWalletService.signTx(txWithBtcFee);
|
||||
Coin miningFee = signedTx.getFee();
|
||||
int txSize = signedTx.bitcoinSerialize().length;
|
||||
new Popup().headLine("Confirm voting fee payment transaction")
|
||||
.confirmation("Voting fee: " + btcFormatter.formatCoinWithCode(votingTxFee) + "\n" +
|
||||
"Mining fee: " + btcFormatter.formatCoinWithCode(miningFee) + " (" +
|
||||
MathUtils.roundDouble(((double) miningFee.value / (double) txSize), 2) +
|
||||
" Satoshis/byte)\n" +
|
||||
"Transaction size: " + (txSize / 1000d) + " Kb\n\n" +
|
||||
"Are you sure you want to send the transaction?")
|
||||
new Popup().headLine(Res.get("dao.voting.confirmTx"))
|
||||
.confirmation(Res.get("dao.tx.summary",
|
||||
btcFormatter.formatCoinWithCode(votingTxFee),
|
||||
btcFormatter.formatCoinWithCode(miningFee),
|
||||
Utilities.getFeePerByte(miningFee, txSize),
|
||||
(txSize / 1000d)))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
try {
|
||||
|
@ -237,7 +235,7 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
public void onSuccess(@Nullable Transaction transaction) {
|
||||
checkNotNull(transaction, "Transaction must not be null at doSend callback.");
|
||||
log.error("tx successful published" + transaction.getHashAsString());
|
||||
new Popup<>().confirmation("Your transaction has been successfully published.").show();
|
||||
new Popup<>().confirmation(Res.get("dao.tx.published.success")).show();
|
||||
voteItemsList.setIsMyVote(true);
|
||||
|
||||
//TODO send to P2P network
|
||||
|
|
|
@ -55,7 +55,6 @@ public class BalanceUtil {
|
|||
walletEventListener = new WalletEventListener() {
|
||||
@Override
|
||||
public void onKeysAdded(List<ECKey> keys) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,7 +79,6 @@ public class BalanceUtil {
|
|||
|
||||
@Override
|
||||
public void onWalletChanged(Wallet wallet) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@ import io.bitsquare.gui.main.dao.wallet.receive.BsqReceiveView;
|
|||
import io.bitsquare.gui.main.dao.wallet.send.BsqSendView;
|
||||
import io.bitsquare.gui.main.dao.wallet.tx.BsqTransactionsView;
|
||||
import io.bitsquare.gui.util.Colors;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -74,10 +75,10 @@ public class BsqWalletView extends ActivatableViewAndModel {
|
|||
};
|
||||
|
||||
ToggleGroup toggleGroup = new ToggleGroup();
|
||||
dashboard = new MenuItem(navigation, toggleGroup, "Dashboard", BsqDashboardView.class, AwesomeIcon.DASHBOARD);
|
||||
send = new MenuItem(navigation, toggleGroup, "Send", BsqSendView.class, AwesomeIcon.SIGNOUT);
|
||||
receive = new MenuItem(navigation, toggleGroup, "Receive", BsqReceiveView.class, AwesomeIcon.SIGNIN);
|
||||
transactions = new MenuItem(navigation, toggleGroup, "Transactions", BsqTransactionsView.class, AwesomeIcon.TABLE);
|
||||
dashboard = new MenuItem(navigation, toggleGroup, Res.get("shared.dashboard"), BsqDashboardView.class, AwesomeIcon.DASHBOARD);
|
||||
send = new MenuItem(navigation, toggleGroup, Res.get("dao.wallet.menuItem.send"), BsqSendView.class, AwesomeIcon.SIGNOUT);
|
||||
receive = new MenuItem(navigation, toggleGroup, Res.get("dao.wallet.menuItem.receive"), BsqReceiveView.class, AwesomeIcon.SIGNIN);
|
||||
transactions = new MenuItem(navigation, toggleGroup, Res.get("dao.wallet.menuItem.transactions"), BsqTransactionsView.class, AwesomeIcon.TABLE);
|
||||
leftVBox.getChildren().addAll(dashboard, send, receive, transactions);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import io.bitsquare.gui.common.view.FxmlView;
|
|||
import io.bitsquare.gui.main.dao.wallet.BalanceUtil;
|
||||
import io.bitsquare.gui.util.BsqFormatter;
|
||||
import io.bitsquare.gui.util.Layout;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
|
@ -56,8 +57,8 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> {
|
|||
|
||||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, gridRow, 1, "Balance");
|
||||
balanceTextField = addLabelTextField(root, gridRow, "BSQ balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
addTitledGroupBg(root, gridRow, 1, Res.get("shared.balance"));
|
||||
balanceTextField = addLabelTextField(root, gridRow, Res.get("shared.bsqBalance"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceUtil.setBalanceTextField(balanceTextField);
|
||||
balanceUtil.initialize();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import io.bitsquare.gui.main.overlays.windows.QRCodeWindow;
|
|||
import io.bitsquare.gui.util.BsqFormatter;
|
||||
import io.bitsquare.gui.util.GUIUtil;
|
||||
import io.bitsquare.gui.util.Layout;
|
||||
import io.bitsquare.locale.Res;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.Tooltip;
|
||||
|
@ -74,30 +75,30 @@ public class BsqReceiveView extends ActivatableView<GridPane, Void> {
|
|||
this.bsqWalletService = bsqWalletService;
|
||||
this.formatter = formatter;
|
||||
this.balanceUtil = balanceUtil;
|
||||
paymentLabelString = "Fund Bitsquare BSQ wallet";
|
||||
paymentLabelString = Res.get("dao.wallet.receive.fundBSQWallet");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, gridRow, 1, "Balance");
|
||||
balanceTextField = addLabelTextField(root, gridRow, "BSQ balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
addTitledGroupBg(root, gridRow, 1, Res.get("shared.balance"));
|
||||
balanceTextField = addLabelTextField(root, gridRow, Res.get("shared.bsqBalance"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceUtil.setBalanceTextField(balanceTextField);
|
||||
balanceUtil.initialize();
|
||||
|
||||
addTitledGroupBg(root, ++gridRow, 3, "Fund your BSQ wallet", Layout.GROUP_DISTANCE);
|
||||
addTitledGroupBg(root, ++gridRow, 3, Res.get("dao.wallet.receive.fundYourWallet"), Layout.GROUP_DISTANCE);
|
||||
|
||||
qrCodeImageView = new ImageView();
|
||||
qrCodeImageView.setStyle("-fx-cursor: hand;");
|
||||
Tooltip.install(qrCodeImageView, new Tooltip("Open large QR-Code window"));
|
||||
Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
|
||||
GridPane.setRowIndex(qrCodeImageView, gridRow);
|
||||
GridPane.setColumnIndex(qrCodeImageView, 1);
|
||||
GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
|
||||
root.getChildren().add(qrCodeImageView);
|
||||
|
||||
addressTextField = addLabelAddressTextField(root, ++gridRow, "Address:").second;
|
||||
addressTextField = addLabelAddressTextField(root, ++gridRow, Res.getWithCol("shared.address")).second;
|
||||
addressTextField.setPaymentLabel(paymentLabelString);
|
||||
|
||||
amountTextField = addLabelInputTextField(root, ++gridRow, "Amount (optional):").second;
|
||||
amountTextField = addLabelInputTextField(root, ++gridRow, Res.get("dao.wallet.receive.amountOptional")).second;
|
||||
if (DevFlags.DEV_MODE)
|
||||
amountTextField.setText("10");
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import io.bitsquare.btc.exceptions.WalletException;
|
|||
import io.bitsquare.btc.provider.fee.FeeService;
|
||||
import io.bitsquare.btc.wallet.BsqWalletService;
|
||||
import io.bitsquare.btc.wallet.BtcWalletService;
|
||||
import io.bitsquare.common.util.MathUtils;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.gui.common.view.ActivatableView;
|
||||
import io.bitsquare.gui.common.view.FxmlView;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
|
@ -84,19 +84,20 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
|
|||
|
||||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, gridRow, 1, "Balance");
|
||||
balanceTextField = addLabelTextField(root, gridRow, "BSQ balance:", Layout.FIRST_ROW_DISTANCE).second;
|
||||
addTitledGroupBg(root, gridRow, 1, Res.get("shared.balance"));
|
||||
balanceTextField = addLabelTextField(root, gridRow, Res.get("shared.bsqBalance"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
balanceUtil.setBalanceTextField(balanceTextField);
|
||||
balanceUtil.initialize();
|
||||
|
||||
addTitledGroupBg(root, ++gridRow, 3, "Send funds", Layout.GROUP_DISTANCE);
|
||||
amountInputTextField = addLabelInputTextField(root, gridRow, "Amount in BSQ:", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
amountInputTextField.setPromptText("Set amount to withdraw (min. amount is 547");
|
||||
addTitledGroupBg(root, ++gridRow, 3, Res.get("dao.wallet.send.sendFunds"), Layout.GROUP_DISTANCE);
|
||||
amountInputTextField = addLabelInputTextField(root, gridRow, Res.get("dao.wallet.send.amount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
amountInputTextField.setPromptText(Res.get("dao.wallet.send.setAmount", Transaction.MIN_NONDUST_OUTPUT.value));
|
||||
|
||||
receiversAddressInputTextField = addLabelInputTextField(root, ++gridRow, "Receiver's address:").second;
|
||||
receiversAddressInputTextField.setPromptText("Fill in your destination address");
|
||||
receiversAddressInputTextField = addLabelInputTextField(root, ++gridRow,
|
||||
Res.get("dao.wallet.send.receiverAddress")).second;
|
||||
receiversAddressInputTextField.setPromptText(Res.get("dao.wallet.send.setDestinationAddress"));
|
||||
|
||||
sendButton = addButtonAfterGroup(root, ++gridRow, "Send BSQ funds");
|
||||
sendButton = addButtonAfterGroup(root, ++gridRow, Res.get("dao.wallet.send.send"));
|
||||
|
||||
if (DevFlags.DEV_MODE) {
|
||||
amountInputTextField.setText("2.730"); // 2730 is dust limit
|
||||
|
@ -110,19 +111,16 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
|
|||
Transaction preparedSendTx = bsqWalletService.getPreparedSendTx(receiversAddressString, receiverAmount);
|
||||
Transaction txWithBtcFee = btcWalletService.completePreparedSendBsqTx(preparedSendTx, true);
|
||||
Transaction signedTx = bsqWalletService.signTx(txWithBtcFee);
|
||||
|
||||
Coin miningFee = signedTx.getFee();
|
||||
int txSize = signedTx.bitcoinSerialize().length;
|
||||
new Popup().headLine("Confirm withdrawal request")
|
||||
.confirmation("Sending: " + bsqFormatter.formatCoinWithCode(receiverAmount) + "\n" +
|
||||
/* "From address: " + withdrawFromTextField.getText() + "\n" +*/
|
||||
"Receiver address: " + receiversAddressString + "\n" +
|
||||
"Transaction fee: " + btcFormatter.formatCoinWithCode(miningFee) + " (" +
|
||||
MathUtils.roundDouble(((double) miningFee.value / (double) txSize), 2) +
|
||||
" Satoshis/byte)\n" +
|
||||
"Transaction size: " + (txSize / 1000d) + " Kb\n\n" +
|
||||
/*"The recipient will receive: " + bsqFormatter.formatCoinWithCode(receiverAmount) + "\n\n" +*/
|
||||
"Are you sure you want to withdraw that amount?")
|
||||
new Popup().headLine(Res.get("dao.wallet.send.sendFunds.headline"))
|
||||
.confirmation(Res.get("dao.wallet.send.sendFunds.details",
|
||||
bsqFormatter.formatCoinWithCode(receiverAmount),
|
||||
receiversAddressString,
|
||||
btcFormatter.formatCoinWithCode(miningFee),
|
||||
Utilities.getFeePerByte(miningFee, txSize),
|
||||
txSize / 1000d,
|
||||
bsqFormatter.formatCoinWithCode(receiverAmount.subtract(miningFee))))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
try {
|
||||
|
|
|
@ -104,6 +104,31 @@ shared.language=Language
|
|||
shared.country=Country
|
||||
shared.applyAndShutDown=Apply and shut down
|
||||
shared.selectPaymentMethod=Select payment method
|
||||
shared.accountNameAlreadyUsed=That account name is already used in a saved account.\nPlease use another name.
|
||||
shared.askConfirmDeleteAccount=Do you really want to delete the selected account?
|
||||
shared.cannotDeleteAccount=You cannot delete that account because it is used in an open offer or in a trade.
|
||||
shared.noAccountsSetupYet=There are no accounts set up yet
|
||||
shared.manageAccounts=Manage accounts
|
||||
shared.addNewAccount=Add new account
|
||||
shared.ExportAccounts=Export Accounts
|
||||
shared.importAccounts=Import Accounts
|
||||
shared.createNewAccount=Create new account
|
||||
shared.saveNewAccount=Save new account
|
||||
shared.selectedAccount=Selected account
|
||||
shared.deleteAccount=Delete account
|
||||
shared.errorMessage=\nError message: {0}
|
||||
shared.information=Information
|
||||
shared.name=Name
|
||||
shared.id=ID
|
||||
shared.dashboard=Dashboard
|
||||
shared.accept=Accept
|
||||
shared.decline=Decline
|
||||
shared.reset=Reset
|
||||
shared.vote=Vote
|
||||
shared.parameters=Parameters
|
||||
shared.balance=Balance
|
||||
shared.bsqBalance=BSQ balance:
|
||||
share.history=History
|
||||
|
||||
|
||||
####################################################################
|
||||
|
@ -231,7 +256,6 @@ offerbook.warning.offerBlocked=That offer was blocked by the Bitsquare developer
|
|||
offerbook.warning.nodeBlocked=The onion address of that trader was blocked by the Bitsquare developers.\nProbably there is an unhandled bug causing issues when taking offers from that trader.
|
||||
|
||||
|
||||
|
||||
####################################################################
|
||||
# Offerbook / Create offer
|
||||
####################################################################
|
||||
|
@ -283,7 +307,6 @@ createOffer.priceOutSideOfDeviation=The price you have entered is outside the ma
|
|||
createOffer.changePrice=Change price
|
||||
|
||||
|
||||
|
||||
####################################################################
|
||||
# Offerbook / Take offer
|
||||
####################################################################
|
||||
|
@ -339,7 +362,6 @@ takeOffer.error.payoutPublished=\n\nThe payout transaction is already published.
|
|||
takeOffer.error.disputed=\n\nThe trade is handled already by an arbitrator.\nPlease try to restart you application and check your network connection to see if you can resolve the issue.\nIf the problem still remains please contact the arbitrator or the developers for support.
|
||||
|
||||
|
||||
|
||||
####################################################################
|
||||
# Portfolio
|
||||
####################################################################
|
||||
|
@ -600,7 +622,6 @@ under \"Portfolio/Open trades\" and type the key combination \"cmd + o\" or \"cr
|
|||
the support ticket."
|
||||
|
||||
|
||||
|
||||
####################################################################
|
||||
# Settings
|
||||
####################################################################
|
||||
|
@ -690,12 +711,12 @@ For Bitcoin trading, you are not required to set up any additional accounts. We
|
|||
Privacy & Security:\n\
|
||||
Bitsquare is a decentralized exchange – meaning all of your data is kept on your computer, there are no servers and we have no access to your personal info, your funds or even your IP address. Data such as bank account numbers, altcoin & Bitcoin addresses, etc are only shared with your trading partner to fulfill trades you initiate (in case of a dispute the arbitrator will see the same data like your trading peer).
|
||||
|
||||
account.paymentAccount=National currency accounts
|
||||
account.altCoinsAccountView=Altcoin accounts
|
||||
account.arbitratorSelection=Arbitrator selection
|
||||
account.password=Wallet password
|
||||
account.seedWords=Wallet seed
|
||||
account.backup=Backup
|
||||
account.menu.paymentAccount=National currency accounts
|
||||
account.menu.altCoinsAccountView=Altcoin accounts
|
||||
account.menu.arbitratorSelection=Arbitrator selection
|
||||
account.menu.password=Wallet password
|
||||
account.menu.seedWords=Wallet seed
|
||||
account.menu.backup=Backup
|
||||
|
||||
account.arbitratorRegistration.pubKey=Public key:
|
||||
account.arbitratorRegistration.yourLanguage=Your languages:
|
||||
|
@ -784,34 +805,71 @@ account.seed.restore.success=Wallets restored successfully with the new seed wor
|
|||
account.seed.restore.error=An error occurred when restoring the wallets with seed words.{0}
|
||||
|
||||
|
||||
|
||||
shared.accountNameAlreadyUsed=That account name is already used in a saved account.\nPlease use another name.
|
||||
shared.askConfirmDeleteAccount=Do you really want to delete the selected account?
|
||||
shared.cannotDeleteAccount=You cannot delete that account because it is used in an open offer or in a trade.
|
||||
shared.noAccountsSetupYet=There are no accounts set up yet
|
||||
shared.manageAccounts=Manage accounts
|
||||
shared.addNewAccount=Add new account
|
||||
shared.ExportAccounts=Export Accounts
|
||||
shared.importAccounts=Import Accounts
|
||||
shared.createNewAccount=Create new account
|
||||
shared.saveNewAccount=Save new account
|
||||
shared.selectedAccount=Selected account
|
||||
shared.deleteAccount=Delete account
|
||||
shared.errorMessage=\nError message: {0}
|
||||
shared.information=Information
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
####################################################################
|
||||
# DAO
|
||||
####################################################################
|
||||
|
||||
daoView.tab.bsqWallet=BSQ wallet
|
||||
daoView.tab.compensation=Compensation
|
||||
daoView.tab.voting=Voting
|
||||
dao.tab.bsqWallet=BSQ wallet
|
||||
dao.tab.compensation=Compensation
|
||||
dao.tab.voting=Voting
|
||||
|
||||
dao.tx.summary=Voting fee: {0}\nMining fee: {1} ({2} Satoshis/byte)\nTransaction size: {3} Kb\n\nAre you sure you want to send the transaction?
|
||||
dao.tx.published.success=Your transaction has been successfully published.
|
||||
|
||||
dao.compensation.menuItem.createRequest=Create request
|
||||
dao.compensation.menuItem.activeRequests=Active requests
|
||||
dao.compensation.menuItem.pastRequests=Past requests
|
||||
|
||||
dao.compensation.active.header=Active compensation request
|
||||
dao.compensation.active.selectedRequest=Selected compensation request
|
||||
dao.compensation.active.notOpenAnymore=This compensation request is not open anymore for funding. Please wait until the next funding period starts.
|
||||
dao.compensation.active.vote=Vote on compensation request
|
||||
dao.compensation.active.fund=Fund compensation request
|
||||
dao.compensation.active.successfullyFunded=Compensation request successfully funded.
|
||||
|
||||
dao.compensation.create.createNew=Create new compensation request
|
||||
dao.compensation.create.create.button=Create compensation request
|
||||
dao.compensation.create.confirm=Confirm compensation request fee payment transaction
|
||||
|
||||
dao.compensation.display.name=Name/nickname:
|
||||
dao.compensation.display.title=Title:
|
||||
dao.compensation.display.category=Category:
|
||||
dao.compensation.display.description=Description:
|
||||
dao.compensation.display.link=Link to detail info:
|
||||
dao.compensation.display.startDate=Start date:
|
||||
dao.compensation.display.endDate=Delivery date:
|
||||
dao.compensation.display.requestedBTC=Requested funds in BTC:
|
||||
dao.compensation.display.btcAddress=Bitcoin address:
|
||||
|
||||
dao.voting.item.title=Compensation request
|
||||
dao.voting.item.stage.title=Compensation request with ID: {0}
|
||||
|
||||
dao.voting.addItems=Add items for voting
|
||||
dao.voting.addRequest=Add compensation request
|
||||
dao.voting.requestAlreadyAdded=You have already that compensation request added.
|
||||
dao.voting.addParameter=Add parameter
|
||||
dao.voting.parameterAlreadyAdded=You have already that parameter added.
|
||||
dao.voting.compensationRequests=Compensation requests
|
||||
dao.voting.votedAlready=You voted already.
|
||||
dao.voting.notVotedOnAnyEntry=You did not vote on any entry.
|
||||
dao.voting.confirmTx=Confirm voting fee payment transaction
|
||||
|
||||
dao.wallet.menuItem.send=Send
|
||||
dao.wallet.menuItem.receive=Receive
|
||||
dao.wallet.menuItem.transactions=Transactions
|
||||
|
||||
dao.wallet.receive.fundBSQWallet=Fund Bitsquare BSQ wallet
|
||||
dao.wallet.receive.fundYourWallet=Fund your BSQ wallet
|
||||
dao.wallet.receive.amountOptional=Amount (optional)
|
||||
|
||||
dao.wallet.send.sendFunds=Send funds
|
||||
dao.wallet.send.amount=Amount in BSQ:
|
||||
dao.wallet.send.setAmount=Set amount to withdraw (min. amount is {0})
|
||||
dao.wallet.send.receiverAddress=Receiver's address:
|
||||
dao.wallet.send.setDestinationAddress=Fill in your destination address
|
||||
dao.wallet.send.send=Send BSQ funds
|
||||
dao.wallet.send.sendFunds.headline=Confirm withdrawal request
|
||||
dao.wallet.send.sendFunds.details="Sending: {0}\nTo receiving address: {1}.\nRequired transaction fee is: {2} ({3} Satoshis/byte)\nTransaction size: {4} Kb\n\nThe recipient will receive: {5}\n\nAre you sure you want to withdraw that amount?"
|
||||
|
||||
|
||||
####################################################################
|
||||
|
@ -825,7 +883,6 @@ notification.tradeCompleted.headline=Trade completed
|
|||
notification.tradeCompleted.msg=You can withdraw your funds now to your external Bitcoin wallet or transfer it to the Bitsquare wallet.
|
||||
|
||||
|
||||
|
||||
####################################################################
|
||||
# Popups
|
||||
####################################################################
|
||||
|
@ -890,7 +947,6 @@ list.currency.select=Select currency
|
|||
list.currency.showAll=Show all
|
||||
list.currency.editList=Edit currency list
|
||||
|
||||
|
||||
table.placeholder.noItems=Currently there are no {0} available
|
||||
table.placeholder.noData=Currently there is no data available
|
||||
|
||||
|
@ -928,11 +984,13 @@ navigation.funds.transactions=\"Funds/Transactions\"
|
|||
# Domain specific
|
||||
####################################################################
|
||||
|
||||
# dynamic values are not recognized by IntelliJ
|
||||
marketPrice.ask=Ask
|
||||
marketPrice.bid=Bid
|
||||
marketPrice.last=Last
|
||||
|
||||
# we use enum values here
|
||||
# dynamic values are not recognized by IntelliJ
|
||||
MAINNET=Mainnet
|
||||
TESTNET=Testnet
|
||||
REGTEST=Regtest
|
||||
|
@ -954,7 +1012,6 @@ password.walletEncrypted=Wallet successfully encrypted and password protection e
|
|||
password.passwordsDoNotMatch=The 2 passwords you entered do not match.
|
||||
|
||||
|
||||
|
||||
####################################################################
|
||||
# Payment methods
|
||||
####################################################################
|
||||
|
@ -1005,6 +1062,7 @@ payment.mobile=Mobile no.:
|
|||
payment.postal.address=Postal address:
|
||||
|
||||
# We use constants from the code so we don't use our normal naming convention
|
||||
# dynamic values are not recognized by IntelliJ
|
||||
N/A=Not available
|
||||
OK_PAY=OKPay
|
||||
PERFECT_MONEY=Perfect Money
|
||||
|
|
Loading…
Add table
Reference in a new issue