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() { private async init() {
await initBreez(); await initBreez();
await this.cashuSDK.init();
await this.maybeMelt();
this.breezSDK = await breezConnect({ this.breezSDK = await breezConnect({
mnemonic: this.mnemonic, mnemonic: this.mnemonic,
config: defaultBreezConfig(this.network, this.breezApiKey), config: defaultBreezConfig(this.network, this.breezApiKey),
@ -116,11 +114,14 @@ export default class PortalBtcWallet {
} }
}, },
}); });
await this.cashuSDK.init();
await this.redeemCashuQuotes(); await this.redeemCashuQuotes();
await this.maybeMelt();
} }
private async refreshBreezBalances() { 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.balance = info?.walletInfo.balanceSat ?? 0;
this.balances.pendingReceive = info?.walletInfo.pendingReceiveSat ?? 0; this.balances.pendingReceive = info?.walletInfo.pendingReceiveSat ?? 0;
this.balances.pendingSend = info?.walletInfo.pendingSendSat ?? 0; this.balances.pendingSend = info?.walletInfo.pendingSendSat ?? 0;

View file

@ -6,7 +6,7 @@
"target": "ESNext", "target": "ESNext",
"module": "Preserve", "module": "Preserve",
"moduleDetection": "force", "moduleDetection": "force",
"allowJs": true, "allowJs": false,
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,