mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:36:47 +02:00
Merge pull request #11771 from zfox23/commerce_seedingFrontend
Commerce: Seeding Frontend
This commit is contained in:
commit
31dc140ea6
4 changed files with 39 additions and 25 deletions
|
@ -196,7 +196,38 @@ Item {
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 24;
|
|
||||||
|
Item {
|
||||||
|
visible: transactionHistoryModel.count === 0 && root.historyReceived;
|
||||||
|
anchors.centerIn: parent;
|
||||||
|
width: parent.width - 12;
|
||||||
|
height: parent.height;
|
||||||
|
|
||||||
|
HifiControlsUit.Separator {
|
||||||
|
colorScheme: 1;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.top: parent.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
id: noActivityText;
|
||||||
|
text: "<b>The Wallet app is in closed Beta.</b><br><br>To request entry and <b>receive free HFC</b>, please contact " +
|
||||||
|
"<b>info@highfidelity.com</b> with your High Fidelity account username and the email address registered to that account.";
|
||||||
|
// Text size
|
||||||
|
size: 24;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.blueAccent;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 12;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 12;
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
height: paintedHeight;
|
||||||
|
wrapMode: Text.WordWrap;
|
||||||
|
horizontalAlignment: Text.AlignHCenter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: transactionHistory;
|
id: transactionHistory;
|
||||||
|
@ -294,17 +325,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should never be visible (since you immediately get 100 HFC)
|
|
||||||
FiraSansRegular {
|
|
||||||
id: emptyTransationHistory;
|
|
||||||
size: 24;
|
|
||||||
visible: !transactionHistory.visible && root.historyReceived;
|
|
||||||
text: "Recent Activity Unavailable";
|
|
||||||
anchors.fill: parent;
|
|
||||||
horizontalAlignment: Text.AlignHCenter;
|
|
||||||
verticalAlignment: Text.AlignVCenter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +370,9 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
root.pendingCount = pendingCount;
|
root.pendingCount = pendingCount;
|
||||||
transactionHistoryModel.insert(0, {"transaction_type": "pendingCount"});
|
if (pendingCount > 0) {
|
||||||
|
transactionHistoryModel.insert(0, {"transaction_type": "pendingCount"});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -90,7 +90,7 @@ void Ledger::buy(const QString& hfc_key, int cost, const QString& asset_id, cons
|
||||||
signedSend("transaction", transactionString, hfc_key, "buy", "buySuccess", "buyFailure", controlled_failure);
|
signedSend("transaction", transactionString, hfc_key, "buy", "buySuccess", "buyFailure", controlled_failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ledger::receiveAt(const QString& hfc_key, const QString& old_key, const QString& machine_fingerprint) {
|
bool Ledger::receiveAt(const QString& hfc_key, const QString& old_key) {
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
if (!accountManager->isLoggedIn()) {
|
if (!accountManager->isLoggedIn()) {
|
||||||
qCWarning(commerce) << "Cannot set receiveAt when not logged in.";
|
qCWarning(commerce) << "Cannot set receiveAt when not logged in.";
|
||||||
|
@ -99,13 +99,7 @@ bool Ledger::receiveAt(const QString& hfc_key, const QString& old_key, const QSt
|
||||||
return false; // We know right away that we will fail, so tell the caller.
|
return false; // We know right away that we will fail, so tell the caller.
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject transaction;
|
signedSend("public_key", hfc_key.toUtf8(), old_key, "receive_at", "receiveAtSuccess", "receiveAtFailure");
|
||||||
transaction["hfc_key"] = hfc_key;
|
|
||||||
transaction["machine_fingerprint"] = machine_fingerprint;
|
|
||||||
QJsonDocument transactionDoc{ transaction };
|
|
||||||
auto transactionString = transactionDoc.toJson(QJsonDocument::Compact);
|
|
||||||
|
|
||||||
signedSend("transaction", transactionString, old_key, "receive_at", "receiveAtSuccess", "receiveAtFailure");
|
|
||||||
return true; // Note that there may still be an asynchronous signal of failure that callers might be interested in.
|
return true; // Note that there may still be an asynchronous signal of failure that callers might be interested in.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Ledger : public QObject, public Dependency {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void buy(const QString& hfc_key, int cost, const QString& asset_id, const QString& inventory_key, const bool controlled_failure = false);
|
void buy(const QString& hfc_key, int cost, const QString& asset_id, const QString& inventory_key, const bool controlled_failure = false);
|
||||||
bool receiveAt(const QString& hfc_key, const QString& old_key, const QString& machine_fingerprint);
|
bool receiveAt(const QString& hfc_key, const QString& old_key);
|
||||||
void balance(const QStringList& keys);
|
void balance(const QStringList& keys);
|
||||||
void inventory(const QStringList& keys);
|
void inventory(const QStringList& keys);
|
||||||
void history(const QStringList& keys);
|
void history(const QStringList& keys);
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "ui/ImageProvider.h"
|
#include "ui/ImageProvider.h"
|
||||||
#include "scripting/HMDScriptingInterface.h"
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
|
|
||||||
#include <FingerprintUtils.h>
|
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <OffscreenUi.h>
|
#include <OffscreenUi.h>
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
|
@ -542,8 +541,7 @@ bool Wallet::generateKeyPair() {
|
||||||
// 2. It is maximally private, and we can step back from that later if desired.
|
// 2. It is maximally private, and we can step back from that later if desired.
|
||||||
// 3. It maximally exercises all the machinery, so we are most likely to surface issues now.
|
// 3. It maximally exercises all the machinery, so we are most likely to surface issues now.
|
||||||
auto ledger = DependencyManager::get<Ledger>();
|
auto ledger = DependencyManager::get<Ledger>();
|
||||||
QString machineFingerprint = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint());
|
return ledger->receiveAt(key, oldKey);
|
||||||
return ledger->receiveAt(key, oldKey, machineFingerprint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Wallet::listPublicKeys() {
|
QStringList Wallet::listPublicKeys() {
|
||||||
|
|
Loading…
Reference in a new issue