15 lines
503 B
JavaScript
15 lines
503 B
JavaScript
import { supportedMethods, nwcTryRun } from '@/wallets/nwc'
|
|
export * from '@/wallets/nwc'
|
|
|
|
export async function testSendPayment ({ nwcUrl }, { signal }) {
|
|
const supported = await supportedMethods(nwcUrl, { signal })
|
|
if (!supported.includes('pay_invoice')) {
|
|
throw new Error('pay_invoice not supported')
|
|
}
|
|
}
|
|
|
|
export async function sendPayment (bolt11, { nwcUrl }, { signal }) {
|
|
const result = await nwcTryRun(nwc => nwc.payInvoice(bolt11), { nwcUrl }, { signal })
|
|
return result.preimage
|
|
}
|