fix: build error because of wrong types

This commit is contained in:
Khushboo Mehta 2026-06-24 15:55:39 +02:00
parent 4e11c4348a
commit 75116fe23e
4 changed files with 16424 additions and 520 deletions

16907
flake.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -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) {

View File

@ -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(); }

View File

@ -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);