fix initailization order
This commit is contained in:
parent
50ccef4dc4
commit
0aec49b25b
2 changed files with 5 additions and 4 deletions
7
index.ts
7
index.ts
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"target": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"allowJs": true,
|
||||
"allowJs": false,
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue