MCPcopy Create free account
hub / github.com/ElementsProject/elements / PrepareSendText

Method PrepareSendText

src/qt/sendcoinsdialog.cpp:253–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informative_text, QString& detailed_text)
254{
255 QList<SendAssetsRecipient> recipients;
256 bool valid = true;
257
258 for(int i = 0; i < ui->entries->count(); ++i)
259 {
260 SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
261 if(entry)
262 {
263 if(entry->validate(model->node()))
264 {
265 recipients.append(entry->getValue());
266 }
267 else if (valid)
268 {
269 ui->scrollArea->ensureWidgetVisible(entry);
270 valid = false;
271 }
272 }
273 }
274
275 if(!valid || recipients.isEmpty())
276 {
277 return false;
278 }
279
280 fNewRecipientAllowed = false;
281 WalletModel::UnlockContext ctx(model->requestUnlock());
282 if(!ctx.isValid())
283 {
284 // Unlock wallet was cancelled
285 fNewRecipientAllowed = true;
286 return false;
287 }
288
289 // prepare transaction for getting txFee earlier
290 m_current_transaction = std::make_unique<WalletModelTransaction>(recipients);
291 if (g_con_elementsmode)
292 m_current_blind_details = std::make_unique<wallet::BlindDetails>();
293 WalletModel::SendCoinsReturn prepareStatus;
294
295 updateCoinControlState();
296
297 prepareStatus = model->prepareTransaction(*m_current_transaction, m_current_blind_details.get(), *m_coin_control);
298
299 // process prepareStatus and on error generate message shown to user
300 processSendCoinsReturn(prepareStatus,
301 BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), m_current_transaction->getTransactionFee()));
302
303 if(prepareStatus.status != WalletModel::OK) {
304 fNewRecipientAllowed = true;
305 return false;
306 }
307
308 CAmount txFee = m_current_transaction->getTransactionFee();
309 int bitcoin_unit = model->getOptionsModel()->getDisplayUnit();
310 QStringList formatted;

Callers

nothing calls this directly

Calls 15

formatAssetAmountFunction · 0.85
HtmlEscapeFunction · 0.85
formatMultiAssetAmountFunction · 0.85
countMethod · 0.80
getValueMethod · 0.80
requestUnlockMethod · 0.80
prepareTransactionMethod · 0.80
getDisplayUnitMethod · 0.80
getTransactionFeeMethod · 0.80
getRecipientsMethod · 0.80
isMultiwalletMethod · 0.80
privateKeysDisabledMethod · 0.80

Tested by

no test coverage detected