Fix NWC support detection (#845)

* Fix NWC support detection

* Fix missing toast if support for pay_invoice not detected
This commit is contained in:
ekzyis 2024-02-17 17:30:13 +01:00 committed by GitHub
parent 7065008f5d
commit 81ab960d92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 6 deletions

View File

@ -47,8 +47,8 @@ export function NWCProvider ({ children }) {
setSecret(params.secret)
try {
const supported = await validateParams(params)
setEnabled(supported.includes('pay_invoice'))
await validateParams(params)
setEnabled(true)
await updateRelay(params.relayUrl)
} catch (err) {
console.error('invalid NWC config:', err)
@ -78,8 +78,8 @@ export function NWCProvider ({ children }) {
window.localStorage.setItem(storageKey, JSON.stringify(config))
try {
const supported = await validateParams(params)
setEnabled(supported.includes('pay_invoice'))
await validateParams(params)
setEnabled(true)
await updateRelay(params.relayUrl)
} catch (err) {
console.error('invalid NWC config:', err)
@ -214,8 +214,8 @@ async function getInfoWithRelay (relay, walletPubkey) {
], {
onevent (event) {
clearTimeout(timer)
const supported = event.content.split()
resolve(supported)
const supported = event.content.split(',')
supported.includes('pay_invoice') ? resolve() : reject(new Error('wallet does not support pay_invoice'))
sub.close()
},
onclose (reason) {