MCPcopy Create free account
hub / github.com/LUX-Core/lux / parseBitcoinURI

Function parseBitcoinURI

src/qt/guiutil.cpp:166–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166bool parseBitcoinURI(const QUrl& uri, SendCoinsRecipient* out)
167{
168 // return if URI is not valid or is no LUX: URI
169 if (!uri.isValid() || uri.scheme() != QString(URI_SCHEME))
170 return false;
171
172 SendCoinsRecipient rv;
173 rv.address = uri.path();
174 // Trim any following forward slash which may have been added by the OS
175 if (rv.address.endsWith("/")) {
176 rv.address.truncate(rv.address.length() - 1);
177 }
178 rv.amount = 0;
179
180#if QT_VERSION < 0x050000
181 QList<QPair<QString, QString> > items = uri.queryItems();
182#else
183 QUrlQuery uriQuery(uri);
184 QList<QPair<QString, QString> > items = uriQuery.queryItems();
185#endif
186 for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++) {
187 bool fShouldReturnFalse = false;
188 if (i->first.startsWith("req-")) {
189 i->first.remove(0, 4);
190 fShouldReturnFalse = true;
191 }
192
193 if (i->first == "label") {
194 rv.label = i->second;
195 fShouldReturnFalse = false;
196 }
197 if (i->first == "message") {
198 rv.message = i->second;
199 fShouldReturnFalse = false;
200 } else if (i->first == "amount") {
201 if (!i->second.isEmpty()) {
202 if (!BitcoinUnits::parse(BitcoinUnits::LUX, i->second, &rv.amount)) {
203 return false;
204 }
205 }
206 fShouldReturnFalse = false;
207 }
208
209 if (fShouldReturnFalse)
210 return false;
211 }
212 if (out) {
213 *out = rv;
214 }
215 return true;
216}
217
218bool parseBitcoinURI(QString uri, SendCoinsRecipient* out)
219{

Callers 4

ipcParseCommandLineMethod · 0.85
handleURIOrFileMethod · 0.85
acceptMethod · 0.85
uriTestsMethod · 0.85

Calls 8

replaceMethod · 0.80
parseFunction · 0.70
isValidMethod · 0.45
lengthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
removeMethod · 0.45
isEmptyMethod · 0.45

Tested by 1

uriTestsMethod · 0.68