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() {
|
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;
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue