fix(wallet): configure new wallets for active network

This commit is contained in:
Ricardo Guilherme Schmidt
2026-07-18 19:55:49 -03:00
parent 23df9bbf59
commit ee878c5379
5 changed files with 8 additions and 1 deletions
+1
View File
@@ -1,6 +1,7 @@
{
"testnet": {
"checkpointHash": "0d25d71fca70d7008a892f6b3f768a4c66badbcd64e67d79ca595b92f1db544a",
"sequencerAddress": "https://testnet.lez.logos.co/",
"ammProgramId": "77eeaa23668ad2675fb768cd7ecb1893387be464b9a51f16756006c1d307db07",
"tokenDefinitionIds": [
"7b464ff9dd0d3bc07f7e2e0b0667ccd066d85ad12be4c79fc55687a863910aa6",
+1
View File
@@ -63,6 +63,7 @@ bool ActiveNetwork::load()
m_expectedIdentity = entry.value(QStringLiteral("checkpointHash")).toString();
}
m_network.sequencerAddress = entry.value(QStringLiteral("sequencerAddress")).toString();
m_network.ammProgramId = entry.value(QStringLiteral("ammProgramId")).toString();
if (!isValidIdentity(m_expectedIdentity)
|| !isLowerHex(m_network.ammProgramId, 64)) {
+1
View File
@@ -7,6 +7,7 @@ struct ActiveNetworkSnapshot {
QString id;
QString status;
QString fingerprint;
QString sequencerAddress;
QString ammProgramId;
QStringList tokenIds;
};
+1
View File
@@ -84,6 +84,7 @@ AmmUiBackend::AmmUiBackend(LogosAPI* logosAPI, QObject* parent)
connect(m_identityRetryTimer, &QTimer::timeout,
this, &AmmUiBackend::probeNetworkIdentity);
m_network.load();
m_walletController->setDefaultSequencerAddress(m_network.snapshot().sequencerAddress);
connect(m_walletController.get(), &WalletController::stateChanged,
this, &AmmUiBackend::syncWalletState);
+4 -1
View File
@@ -19,12 +19,14 @@ int main()
const QString identity(64, QLatin1Char('a'));
const QString programId(64, QLatin1Char('b'));
const QString tokenId(64, QLatin1Char('c'));
const QString sequencerAddress = QStringLiteral("https://sequencer.example/");
QTemporaryFile config;
if (!config.open())
return 1;
config.write(QJsonDocument(QJsonObject {
{ QStringLiteral("channelId"), identity },
{ QStringLiteral("sequencerAddress"), sequencerAddress },
{ QStringLiteral("ammProgramId"), programId },
{ QStringLiteral("tokenDefinitionIds"), QJsonArray { tokenId } },
}).toJson(QJsonDocument::Compact));
@@ -74,7 +76,8 @@ int main()
"devnet fingerprint should use channel identity"))
return 1;
if (!expect(snapshot.ammProgramId == programId
&& snapshot.tokenIds == QStringList { tokenId },
&& snapshot.tokenIds == QStringList { tokenId }
&& snapshot.sequencerAddress == sequencerAddress,
"network snapshot should preserve configured program and tokens"))
return 1;