MiguelMedeiros / lnbits-js

NPM Package for LNBits.com API.
23 stars 14 forks source link

Allow passing in `AxiosRequestConfig` adapter #11

Open fresheneesz opened 1 year ago

fresheneesz commented 1 year ago

Right now lnbits can't be used in a cloudflare worker, because cloudflare workers can only use fetch to interact. We can use @vespaiach/axios-fetch-adapter if only we could pass it in. It looks like all the primary source files should be updated to allow passing in the adapter, or probably more general axios config overrides.

My current workaround is to monkey patch the adapter in. Eg:

const { withdraw } = LNBits.default({ ... });
withdraw.api.defaults.adapter = fetchAdapter;