use of bisq.core.dao.proposal.compensation.CompensationAmountException in project bisq-desktop by bisq-network.
the class MakeProposalView method publishProposal.
private void publishProposal(ProposalType type) {
try {
Proposal proposal = createProposal(type);
Transaction tx = Objects.requireNonNull(proposal).getTx();
Coin miningFee = Objects.requireNonNull(tx).getFee();
int txSize = tx.bitcoinSerialize().length;
validateInputs();
new Popup<>().headLine(Res.get("dao.proposal.create.confirm")).confirmation(Res.get("dao.proposal.create.confirm.info", bsqFormatter.formatCoinWithCode(ProposalConsensus.getCreateCompensationRequestFee(readableBsqBlockChain)), btcFormatter.formatCoinWithCode(miningFee), CoinUtil.getFeePerByte(miningFee, txSize), (txSize / 1000d))).actionButtonText(Res.get("shared.yes")).onAction(() -> {
proposalCollectionsService.publishProposal(proposal, new FutureCallback<Transaction>() {
@Override
public void onSuccess(@Nullable Transaction transaction) {
proposalDisplay.clearForm();
proposalTypeComboBox.getSelectionModel().clearSelection();
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();
}
});
}).closeButtonText(Res.get("shared.cancel")).show();
} catch (InsufficientMoneyException e) {
BSFormatter formatter = e instanceof InsufficientBsqException ? bsqFormatter : btcFormatter;
new Popup<>().warning(Res.get("dao.proposal.create.missingFunds", formatter.formatCoinWithCode(e.missing))).show();
} catch (CompensationAmountException e) {
new Popup<>().warning(Res.get("validation.bsq.amountBelowMinAmount", bsqFormatter.formatCoinWithCode(e.required))).show();
} catch (TransactionVerificationException | WalletException e) {
log.error(e.toString());
e.printStackTrace();
new Popup<>().warning(e.toString()).show();
} catch (ChangeBelowDustException e) {
// TODO
e.printStackTrace();
}
}
Aggregations