9c55f1ebe2
* lnurlp paid action * lnurlp has 10% sybil fee * fix merge issue * Update pages/settings/index.js Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com> * fix notifications * fix destructure * pass lud18Data to lnurlp action * minor cleanup * truncate invoice description to permitted length * remove redundant targetUserId * lnurlp paidAction -> receive paidAction * remove redundant user query * improve determining if peer is invoiceable * fix inconsistent relative imports * prevent paying self-proxied invoices and better held invoice cancellation * make gun/horse streak zap specific * unique withdrawal hash should apply to confirmed payments too * prevent receive from exceeding wallet limits * notifications * fix notifications & enhance invoice/withdrawl page * notification indicator, proxy receive based on threshold, refinements --------- Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com> Co-authored-by: k00b <k00b@stacker.news>
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
export * from '@/wallets/phoenixd'
|
|
|
|
export async function testSendPayment (config, { logger }) {
|
|
// TODO:
|
|
// Not sure which endpoint to call to test primary password
|
|
// see https://phoenix.acinq.co/server/api
|
|
// Maybe just wait until test payments with HODL invoices?
|
|
|
|
}
|
|
|
|
export async function sendPayment (bolt11, { url, primaryPassword }) {
|
|
// https://phoenix.acinq.co/server/api#pay-bolt11-invoice
|
|
const path = '/payinvoice'
|
|
|
|
const headers = new Headers()
|
|
headers.set('Authorization', 'Basic ' + Buffer.from(':' + primaryPassword).toString('base64'))
|
|
headers.set('Content-type', 'application/x-www-form-urlencoded')
|
|
|
|
const body = new URLSearchParams()
|
|
body.append('invoice', bolt11)
|
|
|
|
const res = await fetch(url + path, {
|
|
method: 'POST',
|
|
headers,
|
|
body
|
|
})
|
|
if (!res.ok) {
|
|
throw new Error(`POST ${res.url}: ${res.status} ${res.statusText}`)
|
|
}
|
|
|
|
const payment = await res.json()
|
|
const preimage = payment.paymentPreimage
|
|
if (!preimage) {
|
|
throw new Error(payment.reason)
|
|
}
|
|
|
|
return preimage
|
|
}
|