From a5be3a97e8fd695149622ffe4eedc72fdb03522a Mon Sep 17 00:00:00 2001 From: boufni95 Date: Tue, 17 Jun 2025 14:17:50 +0000 Subject: [PATCH] get fw events --- proto/autogenerated/client.md | 24 +++++++ proto/autogenerated/go/http_client.go | 30 +++++++++ proto/autogenerated/go/types.go | 12 ++++ proto/autogenerated/ts/express_server.ts | 22 +++++++ proto/autogenerated/ts/http_client.ts | 14 ++++ proto/autogenerated/ts/nostr_client.ts | 15 +++++ proto/autogenerated/ts/nostr_transport.ts | 16 +++++ proto/autogenerated/ts/types.ts | 79 ++++++++++++++++++++++- proto/service/methods.proto | 9 +++ proto/service/structs.proto | 14 ++++ src/services/lnd/lnd.ts | 4 +- src/services/metrics/index.ts | 15 +++++ 12 files changed, 250 insertions(+), 4 deletions(-) diff --git a/proto/autogenerated/client.md b/proto/autogenerated/client.md index 2596a38e..5b68bcc0 100644 --- a/proto/autogenerated/client.md +++ b/proto/autogenerated/client.md @@ -133,6 +133,11 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __request__ body - output: [LiveUserOperation](#LiveUserOperation) +- GetLndForwardingMetrics + - auth type: __Metrics__ + - input: [LndMetricsRequest](#LndMetricsRequest) + - output: [LndForwardingMetrics](#LndForwardingMetrics) + - GetLndMetrics - auth type: __Metrics__ - input: [LndMetricsRequest](#LndMetricsRequest) @@ -567,6 +572,13 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __request__ body - output: [LiveUserOperation](#LiveUserOperation) +- GetLndForwardingMetrics + - auth type: __Metrics__ + - http method: __post__ + - http route: __/api/reports/lnd/forwarding__ + - input: [LndMetricsRequest](#LndMetricsRequest) + - output: [LndForwardingMetrics](#LndForwardingMetrics) + - GetLndMetrics - auth type: __Metrics__ - http method: __post__ @@ -1210,6 +1222,18 @@ The nostr server will send back a message response, and inside the body there wi ### LndChannels - __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_ +### LndForwardingEvent + - __amt_in__: _number_ + - __amt_out__: _number_ + - __at_unix__: _number_ + - __chan_id_in__: _string_ + - __chan_id_out__: _string_ + - __fee__: _number_ + +### LndForwardingMetrics + - __events__: ARRAY of: _[LndForwardingEvent](#LndForwardingEvent)_ + - __total_fees__: _number_ + ### LndGetInfoRequest - __nodeId__: _number_ diff --git a/proto/autogenerated/go/http_client.go b/proto/autogenerated/go/http_client.go index 1f29f872..bd9a32f0 100644 --- a/proto/autogenerated/go/http_client.go +++ b/proto/autogenerated/go/http_client.go @@ -85,6 +85,7 @@ type Client struct { GetLNURLChannelLink func() (*LnurlLinkResponse, error) GetLiveDebitRequests func() (*LiveDebitRequest, error) GetLiveUserOperations func() (*LiveUserOperation, error) + GetLndForwardingMetrics func(req LndMetricsRequest) (*LndForwardingMetrics, error) GetLndMetrics func(req LndMetricsRequest) (*LndMetrics, error) GetLnurlPayInfo func(query GetLnurlPayInfo_Query) (*LnurlPayInfoResponse, error) GetLnurlPayLink func() (*LnurlLinkResponse, error) @@ -906,6 +907,35 @@ func NewClient(params ClientParams) *Client { }, // server streaming method: GetLiveDebitRequests not implemented // server streaming method: GetLiveUserOperations not implemented + GetLndForwardingMetrics: func(req LndMetricsRequest) (*LndForwardingMetrics, error) { + auth, err := params.RetrieveMetricsAuth() + if err != nil { + return nil, err + } + finalRoute := "/api/reports/lnd/forwarding" + body, err := json.Marshal(req) + if err != nil { + return nil, err + } + resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth) + if err != nil { + return nil, err + } + result := ResultError{} + err = json.Unmarshal(resBody, &result) + if err != nil { + return nil, err + } + if result.Status == "ERROR" { + return nil, fmt.Errorf(result.Reason) + } + res := LndForwardingMetrics{} + err = json.Unmarshal(resBody, &res) + if err != nil { + return nil, err + } + return &res, nil + }, GetLndMetrics: func(req LndMetricsRequest) (*LndMetrics, error) { auth, err := params.RetrieveMetricsAuth() if err != nil { diff --git a/proto/autogenerated/go/types.go b/proto/autogenerated/go/types.go index 68d35a25..087e825e 100644 --- a/proto/autogenerated/go/types.go +++ b/proto/autogenerated/go/types.go @@ -361,6 +361,18 @@ type LiveUserOperation struct { type LndChannels struct { Open_channels []OpenChannel `json:"open_channels"` } +type LndForwardingEvent struct { + Amt_in int64 `json:"amt_in"` + Amt_out int64 `json:"amt_out"` + At_unix int64 `json:"at_unix"` + Chan_id_in string `json:"chan_id_in"` + Chan_id_out string `json:"chan_id_out"` + Fee int64 `json:"fee"` +} +type LndForwardingMetrics struct { + Events []LndForwardingEvent `json:"events"` + Total_fees int64 `json:"total_fees"` +} type LndGetInfoRequest struct { Nodeid int64 `json:"nodeId"` } diff --git a/proto/autogenerated/ts/express_server.ts b/proto/autogenerated/ts/express_server.ts index 7a3116ef..8e6e04f2 100644 --- a/proto/autogenerated/ts/express_server.ts +++ b/proto/autogenerated/ts/express_server.ts @@ -996,6 +996,28 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) + if (!opts.allowNotImplementedMethods && !methods.GetLndForwardingMetrics) throw new Error('method: GetLndForwardingMetrics is not implemented') + app.post('/api/reports/lnd/forwarding', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetLndForwardingMetrics', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetLndForwardingMetrics) throw new Error('method: GetLndForwardingMetrics is not implemented') + const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.LndMetricsRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.GetLndForwardingMetrics({rpcName:'GetLndForwardingMetrics', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) if (!opts.allowNotImplementedMethods && !methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') app.post('/api/reports/lnd', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'GetLndMetrics', batch: false, nostr: false, batchSize: 0} diff --git a/proto/autogenerated/ts/http_client.ts b/proto/autogenerated/ts/http_client.ts index 0afa72aa..5750aa3e 100644 --- a/proto/autogenerated/ts/http_client.ts +++ b/proto/autogenerated/ts/http_client.ts @@ -404,6 +404,20 @@ export default (params: ClientParams) => ({ }, GetLiveDebitRequests: async (cb: (v:ResultError | ({ status: 'OK' }& Types.LiveDebitRequest)) => void): Promise => { throw new Error('http streams are not supported')}, GetLiveUserOperations: async (cb: (v:ResultError | ({ status: 'OK' }& Types.LiveUserOperation)) => void): Promise => { throw new Error('http streams are not supported')}, + GetLndForwardingMetrics: async (request: Types.LndMetricsRequest): Promise => { + const auth = await params.retrieveMetricsAuth() + if (auth === null) throw new Error('retrieveMetricsAuth() returned null') + let finalRoute = '/api/reports/lnd/forwarding' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndForwardingMetricsValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, GetLndMetrics: async (request: Types.LndMetricsRequest): Promise => { const auth = await params.retrieveMetricsAuth() if (auth === null) throw new Error('retrieveMetricsAuth() returned null') diff --git a/proto/autogenerated/ts/nostr_client.ts b/proto/autogenerated/ts/nostr_client.ts index 6813815d..a08f4015 100644 --- a/proto/autogenerated/ts/nostr_client.ts +++ b/proto/autogenerated/ts/nostr_client.ts @@ -349,6 +349,21 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ return cb({ status: 'ERROR', reason: 'invalid response' }) }) }, + GetLndForwardingMetrics: async (request: Types.LndMetricsRequest): Promise => { + const auth = await params.retrieveNostrMetricsAuth() + if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'GetLndForwardingMetrics',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndForwardingMetricsValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, GetLndMetrics: async (request: Types.LndMetricsRequest): Promise => { const auth = await params.retrieveNostrMetricsAuth() if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') diff --git a/proto/autogenerated/ts/nostr_transport.ts b/proto/autogenerated/ts/nostr_transport.ts index 55553eb6..5e9ea211 100644 --- a/proto/autogenerated/ts/nostr_transport.ts +++ b/proto/autogenerated/ts/nostr_transport.ts @@ -741,6 +741,22 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { }}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break + case 'GetLndForwardingMetrics': + try { + if (!methods.GetLndForwardingMetrics) throw new Error('method: GetLndForwardingMetrics is not implemented') + const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.LndMetricsRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.GetLndForwardingMetrics({rpcName:'GetLndForwardingMetrics', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break case 'GetLndMetrics': try { if (!methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') diff --git a/proto/autogenerated/ts/types.ts b/proto/autogenerated/ts/types.ts index dff4ae99..ce2b8bbf 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -28,8 +28,8 @@ export type MetricsContext = { app_id: string operator_id: string } -export type MetricsMethodInputs = GetAppsMetrics_Input | GetBundleMetrics_Input | GetErrorStats_Input | GetLndMetrics_Input | GetProvidersDisruption_Input | GetSingleBundleMetrics_Input | GetSingleUsageMetrics_Input | GetUsageMetrics_Input | PingSubProcesses_Input | ResetMetricsStorages_Input | SubmitWebRtcMessage_Input | ZipMetricsStorages_Input -export type MetricsMethodOutputs = GetAppsMetrics_Output | GetBundleMetrics_Output | GetErrorStats_Output | GetLndMetrics_Output | GetProvidersDisruption_Output | GetSingleBundleMetrics_Output | GetSingleUsageMetrics_Output | GetUsageMetrics_Output | PingSubProcesses_Output | ResetMetricsStorages_Output | SubmitWebRtcMessage_Output | ZipMetricsStorages_Output +export type MetricsMethodInputs = GetAppsMetrics_Input | GetBundleMetrics_Input | GetErrorStats_Input | GetLndForwardingMetrics_Input | GetLndMetrics_Input | GetProvidersDisruption_Input | GetSingleBundleMetrics_Input | GetSingleUsageMetrics_Input | GetUsageMetrics_Input | PingSubProcesses_Input | ResetMetricsStorages_Input | SubmitWebRtcMessage_Input | ZipMetricsStorages_Input +export type MetricsMethodOutputs = GetAppsMetrics_Output | GetBundleMetrics_Output | GetErrorStats_Output | GetLndForwardingMetrics_Output | GetLndMetrics_Output | GetProvidersDisruption_Output | GetSingleBundleMetrics_Output | GetSingleUsageMetrics_Output | GetUsageMetrics_Output | PingSubProcesses_Output | ResetMetricsStorages_Output | SubmitWebRtcMessage_Output | ZipMetricsStorages_Output export type UserContext = { app_id: string app_user_id: string @@ -132,6 +132,9 @@ export type GetLiveDebitRequests_Output = ResultError | { status: 'OK' } export type GetLiveUserOperations_Input = {rpcName:'GetLiveUserOperations', cb:(res: LiveUserOperation, err:Error|null)=> void} export type GetLiveUserOperations_Output = ResultError | { status: 'OK' } +export type GetLndForwardingMetrics_Input = {rpcName:'GetLndForwardingMetrics', req: LndMetricsRequest} +export type GetLndForwardingMetrics_Output = ResultError | ({ status: 'OK' } & LndForwardingMetrics) + export type GetLndMetrics_Input = {rpcName:'GetLndMetrics', req: LndMetricsRequest} export type GetLndMetrics_Output = ResultError | ({ status: 'OK' } & LndMetrics) @@ -338,6 +341,7 @@ export type ServerMethods = { GetLNURLChannelLink?: (req: GetLNURLChannelLink_Input & {ctx: UserContext }) => Promise GetLiveDebitRequests?: (req: GetLiveDebitRequests_Input & {ctx: UserContext }) => Promise GetLiveUserOperations?: (req: GetLiveUserOperations_Input & {ctx: UserContext }) => Promise + GetLndForwardingMetrics?: (req: GetLndForwardingMetrics_Input & {ctx: MetricsContext }) => Promise GetLndMetrics?: (req: GetLndMetrics_Input & {ctx: MetricsContext }) => Promise GetLnurlPayInfo?: (req: GetLnurlPayInfo_Input & {ctx: GuestContext }) => Promise GetLnurlPayLink?: (req: GetLnurlPayLink_Input & {ctx: UserContext }) => Promise @@ -2049,6 +2053,77 @@ export const LndChannelsValidate = (o?: LndChannels, opts: LndChannelsOptions = return null } +export type LndForwardingEvent = { + amt_in: number + amt_out: number + at_unix: number + chan_id_in: string + chan_id_out: string + fee: number +} +export const LndForwardingEventOptionalFields: [] = [] +export type LndForwardingEventOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amt_in_CustomCheck?: (v: number) => boolean + amt_out_CustomCheck?: (v: number) => boolean + at_unix_CustomCheck?: (v: number) => boolean + chan_id_in_CustomCheck?: (v: string) => boolean + chan_id_out_CustomCheck?: (v: string) => boolean + fee_CustomCheck?: (v: number) => boolean +} +export const LndForwardingEventValidate = (o?: LndForwardingEvent, opts: LndForwardingEventOptions = {}, path: string = 'LndForwardingEvent::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.amt_in !== 'number') return new Error(`${path}.amt_in: is not a number`) + if (opts.amt_in_CustomCheck && !opts.amt_in_CustomCheck(o.amt_in)) return new Error(`${path}.amt_in: custom check failed`) + + if (typeof o.amt_out !== 'number') return new Error(`${path}.amt_out: is not a number`) + if (opts.amt_out_CustomCheck && !opts.amt_out_CustomCheck(o.amt_out)) return new Error(`${path}.amt_out: custom check failed`) + + if (typeof o.at_unix !== 'number') return new Error(`${path}.at_unix: is not a number`) + if (opts.at_unix_CustomCheck && !opts.at_unix_CustomCheck(o.at_unix)) return new Error(`${path}.at_unix: custom check failed`) + + if (typeof o.chan_id_in !== 'string') return new Error(`${path}.chan_id_in: is not a string`) + if (opts.chan_id_in_CustomCheck && !opts.chan_id_in_CustomCheck(o.chan_id_in)) return new Error(`${path}.chan_id_in: custom check failed`) + + if (typeof o.chan_id_out !== 'string') return new Error(`${path}.chan_id_out: is not a string`) + if (opts.chan_id_out_CustomCheck && !opts.chan_id_out_CustomCheck(o.chan_id_out)) return new Error(`${path}.chan_id_out: custom check failed`) + + if (typeof o.fee !== 'number') return new Error(`${path}.fee: is not a number`) + if (opts.fee_CustomCheck && !opts.fee_CustomCheck(o.fee)) return new Error(`${path}.fee: custom check failed`) + + return null +} + +export type LndForwardingMetrics = { + events: LndForwardingEvent[] + total_fees: number +} +export const LndForwardingMetricsOptionalFields: [] = [] +export type LndForwardingMetricsOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + events_ItemOptions?: LndForwardingEventOptions + events_CustomCheck?: (v: LndForwardingEvent[]) => boolean + total_fees_CustomCheck?: (v: number) => boolean +} +export const LndForwardingMetricsValidate = (o?: LndForwardingMetrics, opts: LndForwardingMetricsOptions = {}, path: string = 'LndForwardingMetrics::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (!Array.isArray(o.events)) return new Error(`${path}.events: is not an array`) + for (let index = 0; index < o.events.length; index++) { + const eventsErr = LndForwardingEventValidate(o.events[index], opts.events_ItemOptions, `${path}.events[${index}]`) + if (eventsErr !== null) return eventsErr + } + if (opts.events_CustomCheck && !opts.events_CustomCheck(o.events)) return new Error(`${path}.events: custom check failed`) + + if (typeof o.total_fees !== 'number') return new Error(`${path}.total_fees: is not a number`) + if (opts.total_fees_CustomCheck && !opts.total_fees_CustomCheck(o.total_fees)) return new Error(`${path}.total_fees: custom check failed`) + + return null +} + export type LndGetInfoRequest = { nodeId: number } diff --git a/proto/service/methods.proto b/proto/service/methods.proto index 7ebe175f..21f0a9d6 100644 --- a/proto/service/methods.proto +++ b/proto/service/methods.proto @@ -221,6 +221,15 @@ service LightningPub { option (http_route) = "/api/reports/lnd"; option (nostr) = true; } + + rpc GetLndForwardingMetrics(structs.LndMetricsRequest) returns (structs.LndForwardingMetrics) { + option (auth_type) = "Metrics"; + option (http_method) = "post"; + option (http_route) = "/api/reports/lnd/forwarding"; + option (nostr) = true; + } + + rpc SubmitWebRtcMessage(structs.WebRtcMessage) returns (structs.WebRtcAnswer) { option (auth_type) = "Metrics"; option (http_method) = "post"; diff --git a/proto/service/structs.proto b/proto/service/structs.proto index 068576c5..77268c86 100644 --- a/proto/service/structs.proto +++ b/proto/service/structs.proto @@ -213,6 +213,20 @@ message RootOperation { int64 created_at_unix = 4; } +message LndForwardingEvent { + string chan_id_in = 1; + string chan_id_out = 2; + int64 amt_in = 3; + int64 amt_out = 4; + int64 fee = 5; + int64 at_unix = 6; +} + +message LndForwardingMetrics { + int64 total_fees = 1; + repeated LndForwardingEvent events = 2; +} + message LndNodeMetrics { repeated GraphPoint chain_balance = 1; repeated GraphPoint channel_balance = 2; diff --git a/src/services/lnd/lnd.ts b/src/services/lnd/lnd.ts index df038b32..6541d470 100644 --- a/src/services/lnd/lnd.ts +++ b/src/services/lnd/lnd.ts @@ -448,8 +448,8 @@ export default class { return { confirmedBalance: Number(confirmedBalance), unconfirmedBalance: Number(unconfirmedBalance), totalBalance: Number(totalBalance), channelsBalance } } - async GetForwardingHistory(indexOffset: number, startTime = 0): Promise { - const { response } = await this.lightning.forwardingHistory({ indexOffset, numMaxEvents: 0, startTime: BigInt(startTime), endTime: 0n, peerAliasLookup: false }, DeadLineMetadata()) + async GetForwardingHistory(indexOffset: number, startTime = 0, endTime = 0): Promise { + const { response } = await this.lightning.forwardingHistory({ indexOffset, numMaxEvents: 0, startTime: BigInt(startTime), endTime: BigInt(endTime), peerAliasLookup: false }, DeadLineMetadata()) return response } diff --git a/src/services/metrics/index.ts b/src/services/metrics/index.ts index 41fb82fb..908765c9 100644 --- a/src/services/metrics/index.ts +++ b/src/services/metrics/index.ts @@ -309,6 +309,21 @@ export default class Handler { } + async GetLndForwardingMetrics(req: Types.LndMetricsRequest): Promise { + const fwEvents = await this.lnd.GetForwardingHistory(0, req.from_unix, req.to_unix) + let totalFees = 0 + const events: Types.LndForwardingEvent[] = fwEvents.forwardingEvents.map(e => { + totalFees += Number(e.fee) + return { + chan_id_in: e.chanIdIn, chan_id_out: e.chanIdOut, amt_in: Number(e.amtIn), amt_out: Number(e.amtOut), fee: Number(e.fee), at_unix: Number(e.timestampNs) + } + }) + return { + total_fees: totalFees, + events: events + } + } + async GetLndMetrics(req: Types.LndMetricsRequest): Promise { const [chansInfo, pendingChansInfo, closedChansInfo, routing, rootOps] = await Promise.all([