mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 14:11:09 +00:00
fix(wallet): configure new wallets for active network
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"testnet": {
|
||||
"checkpointHash": "0d25d71fca70d7008a892f6b3f768a4c66badbcd64e67d79ca595b92f1db544a",
|
||||
"sequencerAddress": "https://testnet.lez.logos.co/",
|
||||
"ammProgramId": "77eeaa23668ad2675fb768cd7ecb1893387be464b9a51f16756006c1d307db07",
|
||||
"tokenDefinitionIds": [
|
||||
"7b464ff9dd0d3bc07f7e2e0b0667ccd066d85ad12be4c79fc55687a863910aa6",
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -7,6 +7,7 @@ struct ActiveNetworkSnapshot {
|
||||
QString id;
|
||||
QString status;
|
||||
QString fingerprint;
|
||||
QString sequencerAddress;
|
||||
QString ammProgramId;
|
||||
QStringList tokenIds;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user