mirror of
https://github.com/logos-blockchain/logos-execution-zone-wallet-ui.git
synced 2026-07-29 14:13:52 +00:00
fix: build error because of wrong types
This commit is contained in:
parent
4e11c4348a
commit
75116fe23e
16907
flake.lock
generated
16907
flake.lock
generated
File diff suppressed because it is too large
Load Diff
@ -62,6 +62,30 @@ void LEZWalletAccountModel::replaceFromJsonArray(const QJsonArray& arr)
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
void LEZWalletAccountModel::replaceFromVariantList(const QVariantList& list)
|
||||
{
|
||||
beginResetModel();
|
||||
int oldCount = m_entries.size();
|
||||
m_entries.clear();
|
||||
for (const QVariant& v : list) {
|
||||
LEZWalletAccountEntry e;
|
||||
e.balance = QString();
|
||||
if (v.canConvert<QVariantMap>()) {
|
||||
const QVariantMap obj = v.toMap();
|
||||
e.accountId = obj.value(QStringLiteral("account_id")).toString();
|
||||
e.isPublic = obj.value(QStringLiteral("is_public"), true).toBool();
|
||||
} else {
|
||||
e.accountId = v.toString();
|
||||
e.isPublic = true;
|
||||
}
|
||||
e.name = QString();
|
||||
m_entries.append(e);
|
||||
}
|
||||
endResetModel();
|
||||
if (oldCount != m_entries.size())
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
void LEZWalletAccountModel::setBalanceByAccountId(const QString& accountId, const QString& balance)
|
||||
{
|
||||
for (int i = 0; i < m_entries.size(); ++i) {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <QJsonArray>
|
||||
#include <QString>
|
||||
#include <QVariantList>
|
||||
|
||||
struct LEZWalletAccountEntry {
|
||||
QString name;
|
||||
@ -30,6 +31,7 @@ public:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
void replaceFromJsonArray(const QJsonArray& arr);
|
||||
void replaceFromVariantList(const QVariantList& list);
|
||||
void setBalanceByAccountId(const QString& accountId, const QString& balance);
|
||||
int count() const { return m_entries.size(); }
|
||||
|
||||
|
||||
@ -128,8 +128,7 @@ void LEZWalletBackend::openIfPathsConfigured()
|
||||
if (err == WALLET_FFI_SUCCESS) {
|
||||
qDebug() << "LEZWalletBackend: wallet opened successfully";
|
||||
setIsWalletOpen(true);
|
||||
QJsonArray arr = m_logos->logos_execution_zone.list_accounts();
|
||||
m_accountModel->replaceFromJsonArray(arr);
|
||||
m_accountModel->replaceFromVariantList(m_logos->logos_execution_zone.list_accounts());
|
||||
fetchAndUpdateBlockHeights();
|
||||
startChunkedSync();
|
||||
refreshSequencerAddr();
|
||||
@ -141,8 +140,7 @@ void LEZWalletBackend::openIfPathsConfigured()
|
||||
|
||||
void LEZWalletBackend::refreshAccounts()
|
||||
{
|
||||
QJsonArray arr = m_logos->logos_execution_zone.list_accounts();
|
||||
m_accountModel->replaceFromJsonArray(arr);
|
||||
m_accountModel->replaceFromVariantList(m_logos->logos_execution_zone.list_accounts());
|
||||
fetchAndUpdateBlockHeights();
|
||||
if (!m_syncing)
|
||||
startChunkedSync();
|
||||
@ -364,8 +362,9 @@ bool LEZWalletBackend::createNew(QString configPath, QString storagePath, QStrin
|
||||
if (!sequencerAddr.isEmpty())
|
||||
applySequencerAddrToConfig(localConfigPath, sequencerAddr);
|
||||
|
||||
int err = m_logos->logos_execution_zone.create_new(localConfigPath, localStoragePath, password);
|
||||
if (err != WALLET_FFI_SUCCESS) return false;
|
||||
const QString mnemonic = m_logos->logos_execution_zone.create_new(
|
||||
localConfigPath, localStoragePath, password);
|
||||
if (mnemonic.isEmpty()) return false;
|
||||
|
||||
persistConfigPath(localConfigPath);
|
||||
persistStoragePath(localStoragePath);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user