This commit is contained in:
2023-09-14 13:15:07 +01:00
parent 24d3f43600
commit dd4d73e81c
4 changed files with 39 additions and 55 deletions

View File

@ -22,7 +22,9 @@ processWorkQueue(WebLNQueue);
*/
export function setupWebLNWalletConfig(store: WalletStore) {
const wallets = store.list();
if (window.webln && !wallets.some(a => a.kind === WalletKind.WebLN)) {
const existing = wallets.find(a => a.kind === WalletKind.WebLN);
if (window.webln && !existing) {
const newConfig = {
id: "webln",
kind: WalletKind.WebLN,
@ -32,6 +34,8 @@ export function setupWebLNWalletConfig(store: WalletStore) {
},
} as WalletConfig;
store.add(newConfig);
} else if (existing) {
store.remove(existing.id);
}
}