moar logs
This commit is contained in:
parent
765f488f09
commit
845b7a60c6
3 changed files with 8 additions and 5 deletions
|
|
@ -20,8 +20,9 @@ export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSett
|
|||
let j: NostrRequest
|
||||
try {
|
||||
j = JSON.parse(event.content)
|
||||
log("nostr event", j.rpcName || 'no rpc name')
|
||||
} catch {
|
||||
console.error("invalid json event received", event.content)
|
||||
log("ERROR", "invalid json event received", event.content)
|
||||
return
|
||||
}
|
||||
nostrTransport({ ...j, appId: event.appId }, res => {
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export default class {
|
|||
if (tx.numConfirmations === 0) { // only process pending transactions, confirmed transaction are processed by the newBlock CB
|
||||
tx.outputDetails.forEach(output => {
|
||||
if (output.isOurAddress) {
|
||||
this.log("received chan TX", Number(output.amount), "sats")
|
||||
this.log("received chan TX", Number(output.amount), "sats", "for", output.address)
|
||||
this.addressPaidCb({ hash: tx.txHash, index: Number(output.outputIndex) }, output.address, Number(output.amount), false)
|
||||
}
|
||||
})
|
||||
|
|
@ -203,6 +203,7 @@ export default class {
|
|||
}
|
||||
|
||||
async NewAddress(addressType: Types.AddressType): Promise<NewAddressResponse> {
|
||||
this.log("generating new address")
|
||||
await this.Health()
|
||||
let lndAddressType: AddressType
|
||||
switch (addressType) {
|
||||
|
|
@ -219,15 +220,15 @@ export default class {
|
|||
throw new Error("unknown address type " + addressType)
|
||||
}
|
||||
const res = await this.lightning.newAddress({ account: "", type: lndAddressType }, DeadLineMetadata())
|
||||
this.log("new address", res.response.address)
|
||||
return res.response
|
||||
}
|
||||
|
||||
async NewInvoice(value: number, memo: string, expiry: number): Promise<Invoice> {
|
||||
getLogger({})("adding invoice...")
|
||||
this.log("generating new invoice for", value, "sats")
|
||||
await this.Health()
|
||||
getLogger({})("lnd healthy")
|
||||
const res = await this.lightning.addInvoice(AddInvoiceReq(value, expiry, false, memo), DeadLineMetadata())
|
||||
getLogger({})("got the invoice")
|
||||
this.log("new invoice", res.response.paymentRequest)
|
||||
return { payRequest: res.response.paymentRequest }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ export default class {
|
|||
}
|
||||
|
||||
async PayInvoice(userId: string, req: Types.PayInvoiceRequest, linkedApplication: Application): Promise<Types.PayInvoiceResponse> {
|
||||
this.log("paying invoice", req.invoice)
|
||||
const decoded = await this.lnd.DecodeInvoice(req.invoice)
|
||||
if (decoded.numSatoshis !== 0 && req.amount !== 0) {
|
||||
throw new Error("invoice has value, do not provide amount the the request")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue