fix(amm): avoid duplicate wallet context refreshes

This commit is contained in:
Ricardo Guilherme Schmidt 2026-07-17 19:55:38 -03:00
parent a66ffddfe4
commit 72bde7af6e
No known key found for this signature in database
GPG Key ID: 1396EA17DE132FFE

View File

@ -85,7 +85,6 @@ AmmUiBackend::AmmUiBackend(LogosAPI* logosAPI, QObject* parent)
connect(m_walletController.get(), &WalletController::stateChanged, connect(m_walletController.get(), &WalletController::stateChanged,
this, &AmmUiBackend::syncWalletState); this, &AmmUiBackend::syncWalletState);
syncWalletState(); syncWalletState();
refreshNewPositionContext({});
m_walletController->start(); m_walletController->start();
} }
@ -98,31 +97,22 @@ WalletAccountModel* AmmUiBackend::accountModel() const
QString AmmUiBackend::createNewDefault(QString password) QString AmmUiBackend::createNewDefault(QString password)
{ {
const QString mnemonic = m_walletController->createDefaultWallet(password); return m_walletController->createDefaultWallet(password);
syncWalletState();
return mnemonic;
} }
QString AmmUiBackend::createNew(QString configPath, QString storagePath, QString password) QString AmmUiBackend::createNew(QString configPath, QString storagePath, QString password)
{ {
const QString mnemonic = return m_walletController->createWallet(configPath, storagePath, password);
m_walletController->createWallet(configPath, storagePath, password);
syncWalletState();
return mnemonic;
} }
bool AmmUiBackend::openExisting() bool AmmUiBackend::openExisting()
{ {
const bool opened = m_walletController->open(); return m_walletController->open();
syncWalletState();
return opened;
} }
void AmmUiBackend::disconnectWallet() void AmmUiBackend::disconnectWallet()
{ {
m_walletController->disconnect(); m_walletController->disconnect();
m_newPosition->clearWalletAccounts();
refreshNewPositionContext(QVariantMap());
} }
QString AmmUiBackend::createAccountPublic() QString AmmUiBackend::createAccountPublic()