Skip to content

Commit

Permalink
fix metrics page
Browse files Browse the repository at this point in the history
  • Loading branch information
boufni95 committed Nov 25, 2024
1 parent d376623 commit bd433c1
Show file tree
Hide file tree
Showing 23 changed files with 12,151 additions and 239 deletions.
12 changes: 12 additions & 0 deletions proto/autogenerated/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ The nostr server will send back a message response, and inside the body there wi
### ClosedChannel
- __capacity__: _number_
- __channel_id__: _string_
- __close_tx_timestamp__: _number_
- __closed_height__: _number_

### ClosureMigration
Expand Down Expand Up @@ -1006,6 +1007,7 @@ The nostr server will send back a message response, and inside the body there wi
- __online_channels__: _number_
- __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_
- __pending_channels__: _number_
- __root_ops__: ARRAY of: _[RootOperation](#RootOperation)_

### LndSeed
- __seed__: ARRAY of: _string_
Expand Down Expand Up @@ -1125,6 +1127,12 @@ The nostr server will send back a message response, and inside the body there wi
### RequestNPubLinkingTokenResponse
- __token__: _string_

### RootOperation
- __amount__: _number_
- __created_at_unix__: _number_
- __op_id__: _string_
- __op_type__: _[OperationType](#OperationType)_

### RoutingEvent
- __event_type__: _string_
- __failure_string__: _string_
Expand Down Expand Up @@ -1231,6 +1239,10 @@ The nostr server will send back a message response, and inside the body there wi
- __MONTH__
- __WEEK__

### OperationType
- __CHAIN_OP__
- __INVOICE_OP__

### UserOperationType
- __INCOMING_INVOICE__
- __INCOMING_TX__
Expand Down
21 changes: 18 additions & 3 deletions proto/autogenerated/go/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ const (
WEEK IntervalType = "WEEK"
)

type OperationType string

const (
CHAIN_OP OperationType = "CHAIN_OP"
INVOICE_OP OperationType = "INVOICE_OP"
)

type UserOperationType string

const (
Expand Down Expand Up @@ -175,9 +182,10 @@ type CloseChannelResponse struct {
Closing_txid string `json:"closing_txid"`
}
type ClosedChannel struct {
Capacity int64 `json:"capacity"`
Channel_id string `json:"channel_id"`
Closed_height int64 `json:"closed_height"`
Capacity int64 `json:"capacity"`
Channel_id string `json:"channel_id"`
Close_tx_timestamp int64 `json:"close_tx_timestamp"`
Closed_height int64 `json:"closed_height"`
}
type ClosureMigration struct {
Closes_at_unix int64 `json:"closes_at_unix"`
Expand Down Expand Up @@ -329,6 +337,7 @@ type LndNodeMetrics struct {
Online_channels int64 `json:"online_channels"`
Open_channels []OpenChannel `json:"open_channels"`
Pending_channels int64 `json:"pending_channels"`
Root_ops []RootOperation `json:"root_ops"`
}
type LndSeed struct {
Seed []string `json:"seed"`
Expand Down Expand Up @@ -448,6 +457,12 @@ type RequestNPubLinkingTokenRequest struct {
type RequestNPubLinkingTokenResponse struct {
Token string `json:"token"`
}
type RootOperation struct {
Amount int64 `json:"amount"`
Created_at_unix int64 `json:"created_at_unix"`
Op_id string `json:"op_id"`
Op_type OperationType `json:"op_type"`
}
type RoutingEvent struct {
Event_type string `json:"event_type"`
Failure_string string `json:"failure_string"`
Expand Down
56 changes: 56 additions & 0 deletions proto/autogenerated/ts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ export const enumCheckIntervalType = (e?: IntervalType): boolean => {
for (const v in IntervalType) if (e === v) return true
return false
}
export enum OperationType {
CHAIN_OP = 'CHAIN_OP',
INVOICE_OP = 'INVOICE_OP',
}
export const enumCheckOperationType = (e?: OperationType): boolean => {
for (const v in OperationType) if (e === v) return true
return false
}
export enum UserOperationType {
INCOMING_INVOICE = 'INCOMING_INVOICE',
INCOMING_TX = 'INCOMING_TX',
Expand Down Expand Up @@ -942,13 +950,15 @@ export const CloseChannelResponseValidate = (o?: CloseChannelResponse, opts: Clo
export type ClosedChannel = {
capacity: number
channel_id: string
close_tx_timestamp: number
closed_height: number
}
export const ClosedChannelOptionalFields: [] = []
export type ClosedChannelOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
capacity_CustomCheck?: (v: number) => boolean
channel_id_CustomCheck?: (v: string) => boolean
close_tx_timestamp_CustomCheck?: (v: number) => boolean
closed_height_CustomCheck?: (v: number) => boolean
}
export const ClosedChannelValidate = (o?: ClosedChannel, opts: ClosedChannelOptions = {}, path: string = 'ClosedChannel::root.'): Error | null => {
Expand All @@ -961,6 +971,9 @@ export const ClosedChannelValidate = (o?: ClosedChannel, opts: ClosedChannelOpti
if (typeof o.channel_id !== 'string') return new Error(`${path}.channel_id: is not a string`)
if (opts.channel_id_CustomCheck && !opts.channel_id_CustomCheck(o.channel_id)) return new Error(`${path}.channel_id: custom check failed`)

if (typeof o.close_tx_timestamp !== 'number') return new Error(`${path}.close_tx_timestamp: is not a number`)
if (opts.close_tx_timestamp_CustomCheck && !opts.close_tx_timestamp_CustomCheck(o.close_tx_timestamp)) return new Error(`${path}.close_tx_timestamp: custom check failed`)

if (typeof o.closed_height !== 'number') return new Error(`${path}.closed_height: is not a number`)
if (opts.closed_height_CustomCheck && !opts.closed_height_CustomCheck(o.closed_height)) return new Error(`${path}.closed_height: custom check failed`)

Expand Down Expand Up @@ -1820,6 +1833,7 @@ export type LndNodeMetrics = {
online_channels: number
open_channels: OpenChannel[]
pending_channels: number
root_ops: RootOperation[]
}
export const LndNodeMetricsOptionalFields: [] = []
export type LndNodeMetricsOptions = OptionsBaseMessage & {
Expand All @@ -1840,6 +1854,8 @@ export type LndNodeMetricsOptions = OptionsBaseMessage & {
open_channels_ItemOptions?: OpenChannelOptions
open_channels_CustomCheck?: (v: OpenChannel[]) => boolean
pending_channels_CustomCheck?: (v: number) => boolean
root_ops_ItemOptions?: RootOperationOptions
root_ops_CustomCheck?: (v: RootOperation[]) => boolean
}
export const LndNodeMetricsValidate = (o?: LndNodeMetrics, opts: LndNodeMetricsOptions = {}, path: string = 'LndNodeMetrics::root.'): Error | null => {
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
Expand Down Expand Up @@ -1898,6 +1914,13 @@ export const LndNodeMetricsValidate = (o?: LndNodeMetrics, opts: LndNodeMetricsO
if (typeof o.pending_channels !== 'number') return new Error(`${path}.pending_channels: is not a number`)
if (opts.pending_channels_CustomCheck && !opts.pending_channels_CustomCheck(o.pending_channels)) return new Error(`${path}.pending_channels: custom check failed`)

if (!Array.isArray(o.root_ops)) return new Error(`${path}.root_ops: is not an array`)
for (let index = 0; index < o.root_ops.length; index++) {
const root_opsErr = RootOperationValidate(o.root_ops[index], opts.root_ops_ItemOptions, `${path}.root_ops[${index}]`)
if (root_opsErr !== null) return root_opsErr
}
if (opts.root_ops_CustomCheck && !opts.root_ops_CustomCheck(o.root_ops)) return new Error(`${path}.root_ops: custom check failed`)

return null
}

Expand Down Expand Up @@ -2582,6 +2605,39 @@ export const RequestNPubLinkingTokenResponseValidate = (o?: RequestNPubLinkingTo
return null
}

export type RootOperation = {
amount: number
created_at_unix: number
op_id: string
op_type: OperationType
}
export const RootOperationOptionalFields: [] = []
export type RootOperationOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
amount_CustomCheck?: (v: number) => boolean
created_at_unix_CustomCheck?: (v: number) => boolean
op_id_CustomCheck?: (v: string) => boolean
op_type_CustomCheck?: (v: OperationType) => boolean
}
export const RootOperationValidate = (o?: RootOperation, opts: RootOperationOptions = {}, path: string = 'RootOperation::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.amount !== 'number') return new Error(`${path}.amount: is not a number`)
if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`)

if (typeof o.created_at_unix !== 'number') return new Error(`${path}.created_at_unix: is not a number`)
if (opts.created_at_unix_CustomCheck && !opts.created_at_unix_CustomCheck(o.created_at_unix)) return new Error(`${path}.created_at_unix: custom check failed`)

if (typeof o.op_id !== 'string') return new Error(`${path}.op_id: is not a string`)
if (opts.op_id_CustomCheck && !opts.op_id_CustomCheck(o.op_id)) return new Error(`${path}.op_id: custom check failed`)

if (!enumCheckOperationType(o.op_type)) return new Error(`${path}.op_type: is not a valid OperationType`)
if (opts.op_type_CustomCheck && !opts.op_type_CustomCheck(o.op_type)) return new Error(`${path}.op_type: custom check failed`)

return null
}

export type RoutingEvent = {
event_type: string
failure_string: string
Expand Down
8 changes: 4 additions & 4 deletions proto/lnd/chainnotifier.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { ChainNotifier } from "./chainnotifier.js";
import type { BlockEpoch } from "./chainnotifier.js";
import type { SpendEvent } from "./chainnotifier.js";
import type { SpendRequest } from "./chainnotifier.js";
import { ChainNotifier } from "./chainnotifier";
import type { BlockEpoch } from "./chainnotifier";
import type { SpendEvent } from "./chainnotifier";
import type { SpendRequest } from "./chainnotifier";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { ConfEvent } from "./chainnotifier";
import type { ConfRequest } from "./chainnotifier";
Expand Down
20 changes: 10 additions & 10 deletions proto/lnd/invoices.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { Invoices } from "./invoices.js";
import type { LookupInvoiceMsg } from "./invoices.js";
import type { SettleInvoiceResp } from "./invoices.js";
import type { SettleInvoiceMsg } from "./invoices.js";
import type { AddHoldInvoiceResp } from "./invoices.js";
import type { AddHoldInvoiceRequest } from "./invoices.js";
import type { CancelInvoiceResp } from "./invoices.js";
import type { CancelInvoiceMsg } from "./invoices.js";
import { Invoices } from "./invoices";
import type { LookupInvoiceMsg } from "./invoices";
import type { SettleInvoiceResp } from "./invoices";
import type { SettleInvoiceMsg } from "./invoices";
import type { AddHoldInvoiceResp } from "./invoices";
import type { AddHoldInvoiceRequest } from "./invoices";
import type { CancelInvoiceResp } from "./invoices";
import type { CancelInvoiceMsg } from "./invoices";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { Invoice } from "./lightning.js";
import type { SubscribeSingleInvoiceRequest } from "./invoices.js";
import type { Invoice } from "./lightning";
import type { SubscribeSingleInvoiceRequest } from "./invoices";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**
Expand Down
4 changes: 2 additions & 2 deletions proto/lnd/invoices.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @generated by protobuf-ts 2.8.1
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import { Invoice } from "./lightning.js";
import { Invoice } from "./lightning";
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
Expand All @@ -13,7 +13,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { RouteHint } from "./lightning.js";
import { RouteHint } from "./lightning";
/**
* @generated from protobuf message invoicesrpc.CancelInvoiceMsg
*/
Expand Down
Loading

0 comments on commit bd433c1

Please sign in to comment.