fix initailization order

This commit is contained in:
Danny Morabito 2025-07-09 12:54:15 +02:00
parent 50ccef4dc4
commit 0aec49b25b
Signed by: dannym
GPG key ID: 7CC8056A5A04557E
2 changed files with 5 additions and 4 deletions

View file

@ -95,8 +95,6 @@ export default class PortalBtcWallet {
private async init() {
await initBreez();
await this.cashuSDK.init();
await this.maybeMelt();
this.breezSDK = await breezConnect({
mnemonic: this.mnemonic,
config: defaultBreezConfig(this.network, this.breezApiKey),
@ -116,11 +114,14 @@ export default class PortalBtcWallet {
}
},
});
await this.cashuSDK.init();
await this.redeemCashuQuotes();
await this.maybeMelt();
}
private async refreshBreezBalances() {
const info = await this.breezSDK?.getInfo();
if (!this.breezSDK) throw new Error("Breez SDK not initialized");
const info = await this.breezSDK.getInfo();
this.balances.balance = info?.walletInfo.balanceSat ?? 0;
this.balances.pendingReceive = info?.walletInfo.pendingReceiveSat ?? 0;
this.balances.pendingSend = info?.walletInfo.pendingSendSat ?? 0;