MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / parseBitcoinURI

Function parseBitcoinURI

src/qt/guiutil.cpp:121–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
122{
123 // return if URI is not valid or is no bitcoin: URI
124 if(!uri.isValid() || uri.scheme() != QString("bitcoingold"))
125 return false;
126
127 SendCoinsRecipient rv;
128 rv.address = uri.path();
129 // Trim any following forward slash which may have been added by the OS
130 if (rv.address.endsWith("/")) {
131 rv.address.truncate(rv.address.length() - 1);
132 }
133 rv.amount = 0;
134
135 QUrlQuery uriQuery(uri);
136 QList<QPair<QString, QString> > items = uriQuery.queryItems();
137 for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
138 {
139 bool fShouldReturnFalse = false;
140 if (i->first.startsWith("req-"))
141 {
142 i->first.remove(0, 4);
143 fShouldReturnFalse = true;
144 }
145
146 if (i->first == "label")
147 {
148 rv.label = i->second;
149 fShouldReturnFalse = false;
150 }
151 if (i->first == "message")
152 {
153 rv.message = i->second;
154 fShouldReturnFalse = false;
155 }
156 else if (i->first == "amount")
157 {
158 if(!i->second.isEmpty())
159 {
160 if(!BitcoinUnits::parse(BitcoinUnits::BTG, i->second, &rv.amount))
161 {
162 return false;
163 }
164 }
165 fShouldReturnFalse = false;
166 }
167
168 if (fShouldReturnFalse)
169 return false;
170 }
171 if(out)
172 {
173 *out = rv;
174 }
175 return true;
176}
177
178bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)

Callers 4

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

Calls 4

parseFunction · 0.85
isValidMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

uriTestsMethod · 0.68