ekzyis 62a922247d
Add timeouts to all wallet API calls (#1722)
* Add timeout to all wallet API calls

* Pass timeout signal to wallet API

* Fix timeout error message not shown on timeout

* Fix cross-fetch throws generic error message on abort

* Fix wrong method in error message

* Always use FetchTimeoutError

* Catch NDK timeout error to replace with custom timeout error

* Also use 15s for NWC connect timeout

* Add timeout delay
2024-12-16 14:05:31 -06:00

28 lines
589 B
JavaScript

import { createInvoice as clnCreateInvoice } from '@/lib/cln'
export * from '@/wallets/cln'
export const testCreateInvoice = async ({ socket, rune, cert }, { signal }) => {
return await createInvoice({ msats: 1000, expiry: 1, description: '' }, { socket, rune, cert }, { signal })
}
export const createInvoice = async (
{ msats, description, expiry },
{ socket, rune, cert },
{ signal }) => {
const inv = await clnCreateInvoice(
{
msats,
description,
expiry
},
{
socket,
rune,
cert
},
{ signal })
return inv.bolt11
}