mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 14:11:09 +00:00
feat(wallet): humanize shared wallet experience
Consolidate wallet account decoding and portfolio handling around the shared Rust IDL decoder. Simplify AMM wallet integration, remove obsolete caches and network plumbing, and cover account selection and live flows.
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <QVariant>
|
||||
#include <QVariantList>
|
||||
|
||||
#include <functional>
|
||||
|
||||
class LogosAPI;
|
||||
|
||||
class FakeExecutionZone {
|
||||
@@ -48,6 +50,13 @@ public:
|
||||
return openResult;
|
||||
}
|
||||
|
||||
void openAsync(const QString& config,
|
||||
const QString& storage,
|
||||
std::function<void(int)> callback)
|
||||
{
|
||||
callback(open(config, storage));
|
||||
}
|
||||
|
||||
QString create_new(const QString& config,
|
||||
const QString& storage,
|
||||
const QString& password)
|
||||
@@ -66,34 +75,69 @@ public:
|
||||
|
||||
QString create_account_public() { return publicAccountId; }
|
||||
QString create_account_private() { return privateAccountId; }
|
||||
QString account_id_to_base58(const QString& accountId) const
|
||||
{
|
||||
return QStringLiteral("base58-") + accountId;
|
||||
}
|
||||
|
||||
int get_last_synced_block() const { return lastSyncedBlock; }
|
||||
int get_current_block_height() const { return currentBlockHeight; }
|
||||
void get_last_synced_blockAsync(std::function<void(int)> callback)
|
||||
{
|
||||
callback(get_last_synced_block());
|
||||
}
|
||||
void get_current_block_heightAsync(std::function<void(int)> callback)
|
||||
{
|
||||
callback(get_current_block_height());
|
||||
}
|
||||
|
||||
int sync_to_block(quint64)
|
||||
{
|
||||
++syncCalls;
|
||||
return syncResult;
|
||||
}
|
||||
void sync_to_blockAsync(int blockId, std::function<void(int)> callback)
|
||||
{
|
||||
callback(sync_to_block(static_cast<quint64>(blockId)));
|
||||
}
|
||||
|
||||
QString get_sequencer_addr() const { return sequencerAddress; }
|
||||
void get_sequencer_addrAsync(std::function<void(QString)> callback)
|
||||
{
|
||||
callback(get_sequencer_addr());
|
||||
}
|
||||
|
||||
QVariantList list_accounts()
|
||||
{
|
||||
++listCalls;
|
||||
return accounts;
|
||||
}
|
||||
void list_accountsAsync(std::function<void(QVariantList)> callback)
|
||||
{
|
||||
callback(list_accounts());
|
||||
}
|
||||
|
||||
QString get_account_public(const QString& accountId)
|
||||
{
|
||||
++publicReadCalls;
|
||||
return publicAccounts.value(accountId);
|
||||
}
|
||||
void get_account_publicAsync(const QString& accountId,
|
||||
std::function<void(QString)> callback)
|
||||
{
|
||||
callback(get_account_public(accountId));
|
||||
}
|
||||
|
||||
QString get_balance(const QString& accountId, bool) const
|
||||
{
|
||||
return balances.value(accountId);
|
||||
}
|
||||
void get_balanceAsync(const QString& accountId,
|
||||
bool isPublic,
|
||||
std::function<void(QString)> callback)
|
||||
{
|
||||
callback(get_balance(accountId, isPublic));
|
||||
}
|
||||
|
||||
QString send_generic_public_transaction(
|
||||
const QStringList& accountIds,
|
||||
@@ -108,6 +152,7 @@ public:
|
||||
submittedProgramId = programId;
|
||||
return transactionResponse;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct LogosModules {
|
||||
|
||||
Reference in New Issue
Block a user