Fix NWC support detection (#845)
* Fix NWC support detection * Fix missing toast if support for pay_invoice not detected
This commit is contained in:
parent
7065008f5d
commit
81ab960d92
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue