add address/label autocomplete

This commit is contained in:
Aditya Kulkarni
2018-11-06 22:35:57 -08:00
parent 19b8cc643d
commit b60d65ee82
7 changed files with 145 additions and 86 deletions

View File

@@ -31,36 +31,37 @@ const QString Utils::getDevSproutAddr() {
// Get the dev fee address based on the transaction
const QString Utils::getDevAddr(Tx tx) {
auto testnetAddrLookup = [=] (const QString& addr) -> QString {
if (addr.startsWith("ztestsapling")) {
return "ztestsapling1kdp74adyfsmm9838jaupgfyx3npgw8ut63stjjx757pc248cuc0ymzphqeux60c64qe5qt68ygh";
} else if (addr.startsWith("zt")) {
return getDevSproutAddr();
} else {
return QString();
}
};
return QString();
// auto testnetAddrLookup = [=] (const QString& addr) -> QString {
// if (addr.startsWith("ztestsapling")) {
// return "ztestsapling1kdp74adyfsmm9838jaupgfyx3npgw8ut63stjjx757pc248cuc0ymzphqeux60c64qe5qt68ygh";
// } else if (addr.startsWith("zt")) {
// return getDevSproutAddr();
// } else {
// return QString();
// }
// };
if (Settings::getInstance()->isTestnet()) {
auto devAddr = testnetAddrLookup(tx.fromAddr);
if (!devAddr.isEmpty()) {
return devAddr;
}
// if (Settings::getInstance()->isTestnet()) {
// auto devAddr = testnetAddrLookup(tx.fromAddr);
// if (!devAddr.isEmpty()) {
// return devAddr;
// }
// t-Addr, find if it is going to a Sprout or Sapling address
for (const ToFields& to : tx.toAddrs) {
devAddr = testnetAddrLookup(to.addr);
if (!devAddr.isEmpty()) {
return devAddr;
}
}
// // t-Addr, find if it is going to a Sprout or Sapling address
// for (const ToFields& to : tx.toAddrs) {
// devAddr = testnetAddrLookup(to.addr);
// if (!devAddr.isEmpty()) {
// return devAddr;
// }
// }
// If this is a t-Addr -> t-Addr transaction, use the Sapling address by default
return testnetAddrLookup("ztestsapling");
} else {
// Mainnet doesn't have a fee yet!
return QString();
}
// // If this is a t-Addr -> t-Addr transaction, use the Sapling address by default
// return testnetAddrLookup("ztestsapling");
// } else {
// // Mainnet doesn't have a fee yet!
// return QString();
// }
}
@@ -82,7 +83,7 @@ QString Utils::getZboardAddr() {
}
double Utils::getDevFee() {
if (Settings::getInstance()->isTestnet()) {
return 0.0001;
return 0;
} else {
return 0;
}