Rename HODL to JIT in frontend comments (#843)
This commit is contained in:
parent
3d1bcd38c6
commit
03b1b173ad
@ -326,11 +326,11 @@ const waitForWebLNPayment = async ({ provider, invoice, pollInvoice, gqlCacheUpd
|
|||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
// be optimistic and pretend zap was already successful for consistent zapping UX
|
// be optimistic and pretend zap was already successful for consistent zapping UX
|
||||||
undoUpdate = gqlCacheUpdate?.()
|
undoUpdate = gqlCacheUpdate?.()
|
||||||
// can't use await here since we might be paying HODL invoices
|
// can't use await here since we might be paying JIT invoices
|
||||||
// and sendPaymentAsync is not supported yet.
|
// and sendPaymentAsync is not supported yet.
|
||||||
// see https://www.webln.guide/building-lightning-apps/webln-reference/webln.sendpaymentasync
|
// see https://www.webln.guide/building-lightning-apps/webln-reference/webln.sendpaymentasync
|
||||||
provider.sendPayment(invoice)
|
provider.sendPayment(invoice)
|
||||||
// WebLN payment will never resolve here for HODL invoices
|
// WebLN payment will never resolve here for JIT invoices
|
||||||
// since they only get resolved after settlement which can't happen here
|
// since they only get resolved after settlement which can't happen here
|
||||||
.then(() => resolve({ webLn: true, gqlCacheUpdateUndo: undoUpdate }))
|
.then(() => resolve({ webLn: true, gqlCacheUpdateUndo: undoUpdate }))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
@ -87,7 +87,7 @@ function RawWebLNProvider ({ children }) {
|
|||||||
autohide: false,
|
autohide: false,
|
||||||
onCancel: async () => {
|
onCancel: async () => {
|
||||||
try {
|
try {
|
||||||
// hash and hmac are only passed for HODL invoices
|
// hash and hmac are only passed for JIT invoices
|
||||||
if (hash && hmac) await cancelInvoice({ variables: { hash, hmac } })
|
if (hash && hmac) await cancelInvoice({ variables: { hash, hmac } })
|
||||||
canceled = true
|
canceled = true
|
||||||
toaster.warning('payment canceled')
|
toaster.warning('payment canceled')
|
||||||
|
@ -19,7 +19,7 @@ export async function nip57 ({ data: { hash }, boss, lnd, models }) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if invoice still exists since HODL invoices get deleted after usage
|
// check if invoice still exists since JIT invoices get deleted after usage
|
||||||
if (!inv) return
|
if (!inv) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -127,7 +127,7 @@ async function checkInvoice ({ data: { hash }, boss, models, lnd }) {
|
|||||||
models.invoice.update({ where: { hash }, data: { confirmedIndex: inv.confirmed_index } })
|
models.invoice.update({ where: { hash }, data: { confirmedIndex: inv.confirmed_index } })
|
||||||
)
|
)
|
||||||
|
|
||||||
// don't send notifications for hodl invoices
|
// don't send notifications for JIT invoices
|
||||||
if (dbInv.preimage) return
|
if (dbInv.preimage) return
|
||||||
|
|
||||||
sendUserNotification(dbInv.userId, {
|
sendUserNotification(dbInv.userId, {
|
||||||
@ -140,7 +140,7 @@ async function checkInvoice ({ data: { hash }, boss, models, lnd }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inv.is_held) {
|
if (inv.is_held) {
|
||||||
// First query makes sure that after payment, HODL invoices are settled
|
// First query makes sure that after payment, JIT invoices are settled
|
||||||
// within 60 seconds or they will be canceled to minimize risk of
|
// within 60 seconds or they will be canceled to minimize risk of
|
||||||
// force closures or wallets banning us.
|
// force closures or wallets banning us.
|
||||||
// Second query is basically confirm_invoice without setting confirmed_at
|
// Second query is basically confirm_invoice without setting confirmed_at
|
||||||
@ -286,7 +286,7 @@ export async function autoDropBolt11s ({ models, lnd }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The callback subscriptions above will NOT get called for HODL invoices that are already paid.
|
// The callback subscriptions above will NOT get called for JIT invoices that are already paid.
|
||||||
// So we manually cancel the HODL invoice here if it wasn't settled by user action
|
// So we manually cancel the HODL invoice here if it wasn't settled by user action
|
||||||
export async function finalizeHodlInvoice ({ data: { hash }, models, lnd, ...args }) {
|
export async function finalizeHodlInvoice ({ data: { hash }, models, lnd, ...args }) {
|
||||||
const inv = await getInvoice({ id: hash, lnd })
|
const inv = await getInvoice({ id: hash, lnd })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user