Merge pull request #406 from shocknet/fix/payment-addr

buffer to string
This commit is contained in:
CapDog 2021-06-22 13:50:02 -04:00 committed by GitHub
commit b9eaea2f0b
3 changed files with 7 additions and 6 deletions

View file

@ -255,7 +255,7 @@ const listenerForAddr = (addr, SEA) => async (order, orderID) => {
//logger.info(`[PERF] Added invoice to GunDB in ${invoicePutEndTime}ms`)
/**
*
* @param {Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:string}} paidInvoice
* @param {Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:Buffer}} paidInvoice
*/
const invoicePaidCb = async paidInvoice => {
console.log('INVOICE PAID')
@ -265,8 +265,9 @@ const listenerForAddr = (addr, SEA) => async (order, orderID) => {
const {
amt_paid_sat: amt,
add_index: addIndex,
payment_addr: paymentAddr
payment_addr
} = paidInvoice
const paymentAddr = payment_addr.toString('hex')
const orderType = serviceOrderType || order.targetType
const { ackInfo } = order //a string representing what has been requested
switch (orderType) {

View file

@ -429,7 +429,7 @@ return orderedOrders
}*/
/**
* @typedef {Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:string}} Invoice
* @typedef {Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:Buffer}} Invoice
*/
/**
* @type {Record<string,(invoice:Invoice) =>void>}
@ -448,7 +448,7 @@ return orderedOrders
/**
*
* @param {Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:string}} data
* @param {Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:Buffer}} data
*/
invoiceStreamDataCb(data) {
if (!data.settled) {
@ -468,7 +468,7 @@ return orderedOrders
coordinateIndex: parseInt(data.add_index, 10),
inbound: true,
amount: amt,
toLndPub: data.payment_addr,
toLndPub: data.payment_addr.toString('hex'),
invoiceMemo: data.memo
})
}

View file

@ -578,7 +578,7 @@ const addInvoice = (value, memo = '', confidential = true, expiry = 180) =>
*
*/
/**
* @param {(invoice:Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:string}) => (boolean | undefined)} dataCb
* @param {(invoice:Common.Schema.InvoiceWhenListed & {r_hash:Buffer,payment_addr:Buffer}) => (boolean | undefined)} dataCb
* @param {(error:lndErr) => void} errorCb
*/
const subscribeInvoices = (dataCb, errorCb) => {