feat: Introduce SequencerClient for enhanced account management and transaction querying

- Added SequencerClient class to handle asynchronous account reads and transaction queries.
- Updated NewPositionRuntime to integrate SequencerClient, allowing for improved wallet account management.
- Modified existing tests to accommodate changes in the new position schema from v1 to v2.
- Enhanced QML tests to validate new position form behavior with updated holding selections and context handling.
- Refactored code to ensure compatibility with the new SequencerClient functionalities.
This commit is contained in:
Ricardo Guilherme Schmidt
2026-07-18 19:55:15 -03:00
parent 5cb408379c
commit 2f029d4c91
31 changed files with 1956 additions and 414 deletions
+23 -2
View File
@@ -19,6 +19,11 @@ namespace {
return {};
}
void connectAsync(const WalletPaths&, SessionCallback callback) override
{
callback({});
}
WalletCreation createWallet(const WalletPaths&, const QString&) override
{
return {};
@@ -29,6 +34,11 @@ namespace {
return {};
}
void snapshotAsync(bool, SnapshotCallback callback) override
{
callback({});
}
void clearSnapshot() override {}
WalletAccountCreation createAccount(bool isPublic) override
@@ -102,7 +112,7 @@ namespace {
AmmClientResult quote(const QJsonObject&) const override
{
return success({
{ QStringLiteral("schema"), QStringLiteral("new-position.v1") },
{ QStringLiteral("schema"), QStringLiteral("new-position.v2") },
{ QStringLiteral("status"), QStringLiteral("ok") },
{ QStringLiteral("canSubmit"), true },
{ QStringLiteral("quoteHash"), quoteHash },
@@ -116,6 +126,8 @@ namespace {
return success({
{ QStringLiteral("status"), QStringLiteral("ready") },
{ QStringLiteral("accountIds"), QJsonArray { QStringLiteral("account") } },
{ QStringLiteral("affectedAccountIds"),
QJsonArray { QStringLiteral("account") } },
{ QStringLiteral("signingRequirements"), QJsonArray { true } },
{ QStringLiteral("instruction"), QJsonArray { 1 } },
{ QStringLiteral("programId"), QStringLiteral("program") },
@@ -124,6 +136,11 @@ namespace {
});
}
AmmClientResult normalizeAccountRpc(const QJsonObject&) const override
{
return {};
}
static AmmClientResult success(const QJsonObject& value)
{
return { true, value };
@@ -149,7 +166,7 @@ namespace {
int main()
{
const QVariantMap request {
{ QStringLiteral("schema"), QStringLiteral("new-position.v1") },
{ QStringLiteral("schema"), QStringLiteral("new-position.v2") },
{ QStringLiteral("tokenAId"), QStringLiteral("token-a") },
{ QStringLiteral("tokenBId"), QStringLiteral("token-b") },
{ QStringLiteral("feeBps"), 30 },
@@ -168,6 +185,10 @@ int main()
== QStringLiteral("1thX6LZfHDZZKUs92febYZhYRcXddmzfzF2NvTkPNE"),
"native hash should become the expected base58 transaction ID"))
return 1;
if (!expect(result.value(QStringLiteral("nativeTransactionHash")).toString()
== wallet.transactionHash,
"submitted result should preserve the native hash for polling"))
return 1;
if (!expect(wallet.createdAccounts == 1 && client.sawFreshLp,
"fresh LP account should enter the plan"))
return 1;