Merge pull request #2638 from ripcurlx/improve-issuance-info-popup

Add information of Satoshis needed for coloring
This commit is contained in:
Manfred Karrer 2019-04-04 07:46:54 -05:00 committed by GitHub
commit b9ab0f1965
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 9 deletions

View file

@ -1854,6 +1854,13 @@ dao.feeTx.confirm.details={0} fee: {1}\n\
Transaction size: {4} Kb\n\n\
Are you sure you want to publish the {5} transaction?
dao.feeTx.issuanceProposal.confirm.details={0} fee: {1}\n\
BTC needed for BSQ issuance: {2} ({3} Satoshis/BSQ)\n\
On acceptance, the proposal fee will be deducted from the issued BSQ.\n\n\
Mining fee: {4} ({5} Satoshis/byte)\n\
Transaction size: {6} Kb\n\n\
Are you sure you want to publish the {7} transaction?
dao.news.bisqDAO.title=THE BISQ DAO
dao.news.bisqDAO.description=Just as the Bisq exchange is decentralized and censorship-resistant, so is its \
governance model - and the Bisq DAO and BSQ token are the tools that make it possible.

View file

@ -35,6 +35,7 @@ import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.dao.DaoFacade;
import bisq.core.dao.governance.bond.Bond;
import bisq.core.dao.governance.param.Param;
import bisq.core.dao.governance.proposal.IssuanceProposal;
import bisq.core.dao.governance.proposal.ProposalType;
import bisq.core.dao.governance.proposal.ProposalValidationException;
import bisq.core.dao.governance.proposal.ProposalWithTransaction;
@ -334,7 +335,11 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
private void showFeeInfoAndPublishMyProposal(Proposal proposal, Transaction transaction, Coin miningFee, int txSize, Coin fee) {
if (!DevEnv.isDevMode()) {
GUIUtil.showBsqFeeInfoPopup(fee, miningFee, txSize, bsqFormatter, btcFormatter,
Coin btcForIssuance = null;
if (proposal instanceof IssuanceProposal) btcForIssuance = ((IssuanceProposal) proposal).getRequestedBsq();
GUIUtil.showBsqFeeInfoPopup(fee, miningFee, btcForIssuance, txSize, bsqFormatter, btcFormatter,
Res.get("dao.proposal"), () -> doPublishMyProposal(proposal, transaction));
} else {
doPublishMyProposal(proposal, transaction);

View file

@ -849,23 +849,44 @@ public class GUIUtil {
}
}
public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, int txSize, BsqFormatter bsqFormatter,
public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, Coin btcForIssuance, int txSize, BsqFormatter bsqFormatter,
BSFormatter btcFormatter, String type,
Runnable actionHandler) {
String confirmationMessage;
if (btcForIssuance != null) {
confirmationMessage = Res.get("dao.feeTx.issuanceProposal.confirm.details",
StringUtils.capitalize(type),
bsqFormatter.formatCoinWithCode(fee),
bsqFormatter.formatBTCWithCode(btcForIssuance),
100,
btcFormatter.formatCoinWithCode(miningFee),
CoinUtil.getFeePerByte(miningFee, txSize),
txSize / 1000d,
type);
} else {
confirmationMessage = Res.get("dao.feeTx.confirm.details",
StringUtils.capitalize(type),
bsqFormatter.formatCoinWithCode(fee),
btcFormatter.formatCoinWithCode(miningFee),
CoinUtil.getFeePerByte(miningFee, txSize),
txSize / 1000d,
type);
}
new Popup<>().headLine(Res.get("dao.feeTx.confirm", type))
.confirmation(Res.get("dao.feeTx.confirm.details",
StringUtils.capitalize(type),
bsqFormatter.formatCoinWithCode(fee),
btcFormatter.formatCoinWithCode(miningFee),
CoinUtil.getFeePerByte(miningFee, txSize),
txSize / 1000d,
type))
.confirmation(confirmationMessage)
.actionButtonText(Res.get("shared.yes"))
.onAction(actionHandler)
.closeButtonText(Res.get("shared.cancel"))
.show();
}
public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, int txSize, BsqFormatter bsqFormatter,
BSFormatter btcFormatter, String type,
Runnable actionHandler) {
showBsqFeeInfoPopup(fee, miningFee, null, txSize, bsqFormatter, btcFormatter, type, actionHandler);
}
public static void setFitToRowsForTableView(TableView tableView, int rowHeight, int headerHeight, int minNumRows, int maxNumRows) {
int size = tableView.getItems().size();
int minHeight = rowHeight * minNumRows + headerHeight;