new endpoint
This commit is contained in:
parent
b751470747
commit
1530f6b65e
4 changed files with 14 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import * as Types from '../../../proto/autogenerated/ts/types.js'
|
||||
import { GetInfoResponse, NewAddressResponse, AddInvoiceResponse, PayReq, Payment, SendCoinsResponse, EstimateFeeResponse, TransactionDetails, ClosedChannelsResponse, ListChannelsResponse, PendingChannelsResponse, ListInvoiceResponse, ListPaymentsResponse } from '../../../proto/lnd/lightning.js'
|
||||
import { GetInfoResponse, NewAddressResponse, AddInvoiceResponse, PayReq, Payment, SendCoinsResponse, EstimateFeeResponse, TransactionDetails, ClosedChannelsResponse, ListChannelsResponse, PendingChannelsResponse, ListInvoiceResponse, ListPaymentsResponse, ChannelBalanceResponse } from '../../../proto/lnd/lightning.js'
|
||||
import { EnvMustBeNonEmptyString, EnvMustBeInteger, EnvCanBeBoolean } from '../helpers/envParser.js'
|
||||
import { AddressPaidCb, BalanceInfo, DecodedInvoice, HtlcCb, Invoice, InvoicePaidCb, LndSettings, NewBlockCb, NodeInfo, PaidInvoice } from './settings.js'
|
||||
import LND from './lnd.js'
|
||||
|
|
@ -32,6 +32,7 @@ export interface LightningHandler {
|
|||
ChannelBalance(): Promise<{ local: number, remote: number }>
|
||||
GetTransactions(startHeight: number): Promise<TransactionDetails>
|
||||
GetBalance(): Promise<BalanceInfo>
|
||||
GetChannelBalance(): Promise<ChannelBalanceResponse>
|
||||
ListClosedChannels(): Promise<ClosedChannelsResponse>
|
||||
ListChannels(): Promise<ListChannelsResponse>
|
||||
ListPendingChannels(): Promise<PendingChannelsResponse>
|
||||
|
|
|
|||
|
|
@ -317,6 +317,11 @@ export default class {
|
|||
return res.response
|
||||
}
|
||||
|
||||
async GetChannelBalance() {
|
||||
const res = await this.lightning.channelBalance({}, DeadLineMetadata())
|
||||
return res.response
|
||||
}
|
||||
|
||||
async GetBalance(): Promise<BalanceInfo> {
|
||||
const wRes = await this.lightning.walletBalance({}, DeadLineMetadata())
|
||||
const { confirmedBalance, unconfirmedBalance, totalBalance } = wRes.response
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import * as Types from '../../../proto/autogenerated/ts/types.js'
|
|||
import { LightningClient } from '../../../proto/lnd/lightning.client.js'
|
||||
import { InvoicesClient } from '../../../proto/lnd/invoices.client.js'
|
||||
import { RouterClient } from '../../../proto/lnd/router.client.js'
|
||||
import { GetInfoResponse, AddressType, NewAddressResponse, AddInvoiceResponse, Invoice_InvoiceState, PayReq, Payment_PaymentStatus, Payment, PaymentFailureReason, SendCoinsResponse, EstimateFeeResponse, TransactionDetails, ClosedChannelsResponse, ListChannelsResponse, PendingChannelsResponse, ListInvoiceResponse, ListPaymentsResponse } from '../../../proto/lnd/lightning.js'
|
||||
import { GetInfoResponse, AddressType, NewAddressResponse, AddInvoiceResponse, Invoice_InvoiceState, PayReq, Payment_PaymentStatus, Payment, PaymentFailureReason, SendCoinsResponse, EstimateFeeResponse, TransactionDetails, ClosedChannelsResponse, ListChannelsResponse, PendingChannelsResponse, ListInvoiceResponse, ListPaymentsResponse, ChannelBalanceResponse } from '../../../proto/lnd/lightning.js'
|
||||
import { OpenChannelReq } from './openChannelReq.js';
|
||||
import { AddInvoiceReq } from './addInvoiceReq.js';
|
||||
import { PayInvoiceReq } from './payInvoiceReq.js';
|
||||
|
|
@ -35,7 +35,9 @@ export default class {
|
|||
this.invoicePaidCb(invoice, decoded.numSatoshis || amount, false)
|
||||
delete this.invoicesAwaiting[invoice]
|
||||
}
|
||||
|
||||
GetChannelBalance(): Promise<ChannelBalanceResponse> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
Stop() { }
|
||||
async Warmup() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,11 @@ export class Watchdog {
|
|||
}, 1000 * 60)
|
||||
}
|
||||
|
||||
|
||||
|
||||
getTotalLndBalance = async (usersTotal: number) => {
|
||||
const localLog = getLogger({ appName: "debugLndBalancev2" })
|
||||
getLogger({ appName: "debugChannelBalanceRpc" })(await this.lnd.GetChannelBalance())
|
||||
const { confirmedBalance, channelsBalance } = await this.lnd.GetBalance()
|
||||
this.log(confirmedBalance, "sats in chain wallet")
|
||||
localLog({ c: channelsBalance, u: usersTotal })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue