diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui index 1a4ac15ad..83909a059 100644 --- a/src/qt/forms/receivecoinsdialog.ui +++ b/src/qt/forms/receivecoinsdialog.ui @@ -7,7 +7,7 @@ 0 0 776 - 364 + 387 @@ -127,7 +127,7 @@ - + @@ -176,13 +176,23 @@ - + + + + + Request InstantSend + + + true + + + diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 6496500e3..581fba165 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -151,6 +151,8 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) QUrlQuery uriQuery(uri); QList > items = uriQuery.queryItems(); #endif + + rv.fUseInstantSend = false; for (QList >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; @@ -165,6 +167,13 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) rv.label = i->second; fShouldReturnFalse = false; } + if (i->first == "IS") + { + if(i->second.compare(QString("1")) == 0) + rv.fUseInstantSend = true; + + fShouldReturnFalse = false; + } if (i->first == "message") { rv.message = i->second; @@ -230,6 +239,12 @@ QString formatBitcoinURI(const SendCoinsRecipient &info) ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg); paramCount++; } + + if(info.fUseInstantSend) + { + ret += QString("%1IS=1").arg(paramCount == 0 ? "?" : "&"); + paramCount++; + } return ret; } diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 69cc0efa8..65c42e3d7 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -152,6 +152,7 @@ void ReceiveCoinsDialog::on_receiveButton_clicked() } SendCoinsRecipient info(address, label, ui->reqAmount->value(), ui->reqMessage->text()); + info.fUseInstantSend = ui->checkUseInstantSend->isChecked(); ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setModel(model->getOptionsModel()); diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index a6fa3efc9..fada57c80 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -149,6 +149,10 @@ void ReceiveRequestDialog::update() html += ""+tr("Label")+": " + GUIUtil::HtmlEscape(info.label) + "
"; if(!info.message.isEmpty()) html += ""+tr("Message")+": " + GUIUtil::HtmlEscape(info.message) + "
"; + if(info.fUseInstantSend) + html += ""+tr("InstantSend")+": Yes
"; + else + html += ""+tr("InstantSend")+": No
"; ui->outUri->setText(html); #ifdef USE_QRCODE diff --git a/src/qt/test/uritests.cpp b/src/qt/test/uritests.cpp index f045c45e2..fd5515124 100644 --- a/src/qt/test/uritests.cpp +++ b/src/qt/test/uritests.cpp @@ -63,4 +63,32 @@ void URITests::uriTests() uri.setUrl(QString("dash:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=1,000.0&label=Some Example")); QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv)); + + uri.setUrl(QString("dash:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=100&label=Some Example&message=Some Example Message&IS=1")); + QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); + QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg")); + QVERIFY(rv.amount == 10000000000LL); + QVERIFY(rv.label == QString("Some Example")); + QVERIFY(rv.message == QString("Some Example Message")); + QVERIFY(rv.fUseInstantSend == 1); + + uri.setUrl(QString("dash:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?amount=100&label=Some Example&message=Some Example Message&IS=Something Invalid")); + QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); + QVERIFY(rv.address == QString("XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg")); + QVERIFY(rv.amount == 10000000000LL); + QVERIFY(rv.label == QString("Some Example")); + QVERIFY(rv.message == QString("Some Example Message")); + QVERIFY(rv.fUseInstantSend != 1); + + uri.setUrl(QString("dash:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?IS=1")); + QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); + QVERIFY(rv.fUseInstantSend == 1); + + uri.setUrl(QString("dash:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg?IS=0")); + QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); + QVERIFY(rv.fUseInstantSend != 1); + + uri.setUrl(QString("dash:XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg")); + QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv)); + QVERIFY(rv.fUseInstantSend != 1); }