fix metrics page
This commit is contained in:
parent
d376623276
commit
bd433c1259
23 changed files with 12151 additions and 239 deletions
|
|
@ -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
|
||||
|
|
@ -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_
|
||||
|
|
@ -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_
|
||||
|
|
@ -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__
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
@ -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"`
|
||||
|
|
@ -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"`
|
||||
|
|
@ -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"`
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
@ -942,6 +950,7 @@ 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: [] = []
|
||||
|
|
@ -949,6 +958,7 @@ 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 => {
|
||||
|
|
@ -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`)
|
||||
|
||||
|
|
@ -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 & {
|
||||
|
|
@ -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')
|
||||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue