| 206 | } |
| 207 | |
| 208 | QString formatBitcoinURI(const SendCoinsRecipient &info) |
| 209 | { |
| 210 | bool bech_32 = info.address.startsWith(QString::fromStdString(Params().Bech32HRP() + "1")); |
| 211 | |
| 212 | QString network = QString("bitcoin:%1"); |
| 213 | if (g_con_elementsmode) { |
| 214 | network = Params().NetworkIDString() == "liquidtestnet" ? QString("liquidtestnet:%1") : QString("liquidnetwork:%1"); |
| 215 | } |
| 216 | QString ret = network.arg(bech_32 ? info.address.toUpper() : info.address); |
| 217 | int paramCount = 0; |
| 218 | |
| 219 | if (info.amount) |
| 220 | { |
| 221 | ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, info.amount, false, BitcoinUnits::SeparatorStyle::NEVER)); |
| 222 | paramCount++; |
| 223 | } |
| 224 | |
| 225 | if (!info.label.isEmpty()) |
| 226 | { |
| 227 | QString lbl(QUrl::toPercentEncoding(info.label)); |
| 228 | ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl); |
| 229 | paramCount++; |
| 230 | } |
| 231 | |
| 232 | if (!info.message.isEmpty()) |
| 233 | { |
| 234 | QString msg(QUrl::toPercentEncoding(info.message)); |
| 235 | ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg); |
| 236 | paramCount++; |
| 237 | } |
| 238 | |
| 239 | return ret; |
| 240 | } |
| 241 | |
| 242 | bool isDust(interfaces::Node& node, const QString& address, const CAmount& amount) |
| 243 | { |