Skip to content

Commit

Permalink
#13 Enable closeReminderTo for asset transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
satran004 committed Mar 19, 2021
1 parent cb5b94e commit 784a6d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public Result destroyAsset(Account signer, Address sender, AssetTxnParameters fi
}

public Result assetTransfer(Account signer, Address sender, String receiver, AccountAsset asset, BigInteger amount,
TxnDetailsParameters txnDetailsParameters, RequestMode requestMode) throws Exception {
Address closeReminderTo, TxnDetailsParameters txnDetailsParameters, RequestMode requestMode) throws Exception {
if((signer == null && sender == null)
|| (signer == null && !requestMode.equals(RequestMode.EXPORT_UNSIGNED))) {
logListener.error("Invalid sender or mnemonic phrase");
Expand Down Expand Up @@ -288,6 +288,9 @@ public Result assetTransfer(Account signer, Address sender, String receiver, Acc
.assetReceiver(receiver)
.sender(sender);

if(closeReminderTo != null)
builder.assetCloseTo(closeReminderTo);

if (builder == null) {
logListener.error("Transaction could not be built");
return Result.error();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void run(@NotNull ProgressIndicator indicator) {
result = transactionService.transfer(signerAccount, fromAddress, toAddress.toString(), amountTuple._2().longValue(),
closeReminderTo, txnDetailsParameters, requestMode);
} else { //asset transfer
result = assetTransactionService.assetTransfer(signerAccount, fromAddress, toAddress.toString(), asset, amountTuple._2(), txnDetailsParameters, requestMode);
result = assetTransactionService.assetTransfer(signerAccount, fromAddress, toAddress.toString(), asset, amountTuple._2(), closeReminderTo, txnDetailsParameters, requestMode);
}

processResult(project, module, result, requestMode, logListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,13 @@ public void focusLost(FocusEvent e) {
} catch(Exception ex) {
console.showErrorMessage("Unable fetch balance", ex);
}

//enable close reminder
enableCloseReminderSection(true);
}
});

otherAssetsRadioButton.addActionListener(e -> {
if(otherAssetsRadioButton.isSelected()) {
enableOtherAssetPanel(true);
setUnitLabel();

//disable close remninder to
enableCloseReminderSection(false);
}
});

Expand Down Expand Up @@ -230,12 +224,6 @@ private void clearAssetRelatedData() {
assetIdComboBoxModel.removeAllElements();
}

private void enableCloseReminderSection(boolean flag) {
closeReminderTo.setText("");
closeReminderTo.setEnabled(flag);
closeReminderAccountChooserBtn.setEnabled(flag);
}

private void fetchAssetFortheAccount(Project project) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
@Override
Expand Down

0 comments on commit 784a6d2

Please sign in to comment.