diff --git a/lnd_methods/info/get_channel.d.ts b/lnd_methods/info/get_channel.d.ts index 852334a..f2a76df 100644 --- a/lnd_methods/info/get_channel.d.ts +++ b/lnd_methods/info/get_channel.d.ts @@ -1,6 +1,7 @@ import { AuthenticatedLightningArgs, AuthenticatedLightningMethod, + ChannelPolicy, } from '../../typescript'; export type GetChannelArgs = AuthenticatedLightningArgs<{ @@ -13,24 +14,7 @@ export type GetChannelResult = { capacity: number; /** Standard Format Channel Id */ id: string; - policies: { - /** Base Fee Millitokens */ - base_fee_mtokens?: string; - /** Locktime Delta */ - cltv_delta?: number; - /** Fees Charged Per Million Millitokens */ - fee_rate?: number; - /** Channel Is Disabled */ - is_disabled?: boolean; - /** Maximum HTLC Millitokens Value */ - max_htlc_mtokens?: string; - /** Minimum HTLC Millitokens Value */ - min_htlc_mtokens?: string; - /** Node Public Key */ - public_key: string; - /** Policy Last Updated At ISO 8601 Date */ - updated_at?: string; - }[]; + policies: ChannelPolicy[]; /** Transaction Id Hex */ transaction_id: string; /** Transaction Output Index */ diff --git a/lnd_methods/info/get_network_graph.d.ts b/lnd_methods/info/get_network_graph.d.ts index d603872..bb8e978 100644 --- a/lnd_methods/info/get_network_graph.d.ts +++ b/lnd_methods/info/get_network_graph.d.ts @@ -1,43 +1,29 @@ -import {AuthenticatedLnd} from '../../lnd_grpc'; -import {AuthenticatedLightningMethod} from '../../typescript'; +import type {AuthenticatedLnd} from '../../lnd_grpc'; +import type { + AuthenticatedLightningMethod, + ChannelPolicy, +} from '../../typescript'; export type GetNetworkGraphResult = { - channels: { + channels: Array<{ /** Channel Capacity Tokens */ capacity: number; /** Standard Format Channel Id */ id: string; - policies: { - /** Base Fee Millitokens */ - base_fee_mtokens?: string; - /** CLTV Height Delta */ - cltv_delta?: number; - /** Fee Rate In Millitokens Per Million */ - fee_rate?: number; - /** Edge is Disabled */ - is_disabled?: boolean; - /** Maximum HTLC Millitokens */ - max_htlc_mtokens?: string; - /** Minimum HTLC Millitokens */ - min_htlc_mtokens?: string; - /** Public Key */ - public_key: string; - /** Last Update Epoch ISO 8601 Date */ - updated_at?: string; - }[]; + policies: ChannelPolicy[]; /** Funding Transaction Id */ transaction_id: string; /** Funding Transaction Output Index */ transaction_vout: number; /** Last Update Epoch ISO 8601 Date */ updated_at?: string; - }[]; - nodes: { + }>; + nodes: Array<{ /** Name */ alias: string; /** Hex Encoded Color */ color: string; - features: { + features: Array<{ /** BOLT 09 Feature Bit */ bit: number; /** Feature is Known */ @@ -46,14 +32,14 @@ export type GetNetworkGraphResult = { is_required: boolean; /** Feature Type */ type: string; - }[]; + }>; /** Node Public Key */ public_key: string; /** Network Addresses and Ports */ sockets: string[]; /** Last Updated ISO 8601 Date */ updated_at: string; - }[]; + }>; }; /** diff --git a/lnd_methods/info/get_node.d.ts b/lnd_methods/info/get_node.d.ts index 5da8633..c4cf087 100644 --- a/lnd_methods/info/get_node.d.ts +++ b/lnd_methods/info/get_node.d.ts @@ -1,6 +1,7 @@ -import { +import type { AuthenticatedLightningArgs, AuthenticatedLightningMethod, + ChannelPolicy, } from '../../typescript'; export type GetNodeArgs = AuthenticatedLightningArgs<{ @@ -17,39 +18,22 @@ export type GetNodeResult = { capacity: number; /** Known Node Channels */ channel_count: number; - channels?: { + channels?: Array<{ /** Maximum Tokens */ capacity: number; /** Standard Format Channel Id */ id: string; - policies: { - /** Base Fee Millitokens */ - base_fee_mtokens?: string; - /** Locktime Delta */ - cltv_delta?: number; - /** Fees Charged Per Million Millitokens */ - fee_rate?: number; - /** Channel Is Disabled */ - is_disabled?: boolean; - /** Maximum HTLC Millitokens Value */ - max_htlc_mtokens?: string; - /** Minimum HTLC Millitokens Value */ - min_htlc_mtokens?: string; - /** Node Public Key */ - public_key: string; - /** Policy Last Updated At ISO 8601 Date */ - updated_at?: string; - }[]; + policies: ChannelPolicy[]; /** Transaction Id Hex */ transaction_id: string; /** Transaction Output Index */ transaction_vout: number; /** Channel Last Updated At ISO 8601 Date */ updated_at?: string; - }[]; + }>; /** RGB Hex Color */ color: string; - features: { + features: Array<{ /** BOLT 09 Feature Bit */ bit: number; /** Feature is Known */ @@ -58,13 +42,13 @@ export type GetNodeResult = { is_required: boolean; /** Feature Type */ type: string; - }[]; - sockets: { + }>; + sockets: Array<{ /** Host and Port */ socket: string; /** Socket Type */ type: string; - }[]; + }>; /** Last Known Update ISO 8601 Date */ updated_at?: string; }; diff --git a/typescript/shared.d.ts b/typescript/shared.d.ts index 42a33cd..910b116 100644 --- a/typescript/shared.d.ts +++ b/typescript/shared.d.ts @@ -19,13 +19,13 @@ export type LightningError = TError extends undefined export type LightningCallback = ( error: LightningError | undefined | null, - result: TResult extends void ? undefined : TResult + result: TResult extends void ? undefined : TResult, ) => void; export type LightningMethod< TArgs = EmptyObject, TResult = void, - TErrorDetails = any + TErrorDetails = any, > = { (args: TArgs): Promise; (args: TArgs, callback: LightningCallback): void; @@ -34,21 +34,21 @@ export type LightningMethod< export type AuthenticatedLightningMethod< TArgs extends {lnd: AuthenticatedLnd} = {lnd: AuthenticatedLnd}, TResult = void, - TErrorDetails = any + TErrorDetails = any, > = LightningMethod; export type UnauthenticatedLightningMethod< TArgs extends {lnd: UnauthenticatedLnd} = {lnd: UnauthenticatedLnd}, TResult = void, - TErrorDetails = any + TErrorDetails = any, > = LightningMethod; export type AuthenticatedLightningSubscription< - TArgs extends {lnd: AuthenticatedLnd} = {lnd: AuthenticatedLnd} + TArgs extends {lnd: AuthenticatedLnd} = {lnd: AuthenticatedLnd}, > = (args: TArgs) => events.EventEmitter; export type UnauthenticatedLightningSubscription< - TArgs extends {lnd: UnauthenticatedLnd} = {lnd: UnauthenticatedLnd} + TArgs extends {lnd: UnauthenticatedLnd} = {lnd: UnauthenticatedLnd}, > = (args: TArgs) => events.EventEmitter; type CommonStatus = 'IN_FLIGHT' | 'SUCCEEDED' | 'FAILED'; @@ -113,10 +113,41 @@ export type RouteNode = { fee_rate?: number; /** Forward Edge Public Key Hex */ public_key: string; -} +}; + +export type Route = RouteNode[]; -export type Route = RouteNode[] +export type Routes = Route[]; -export type Routes = Route[] +export type UtxoSelection = 'largest' | 'random'; -export type UtxoSelection = "largest" | "random"; +export interface ChannelPolicy { + /** Base Fee Millitokens */ + base_fee_mtokens?: string; + /** Locktime Delta */ + cltv_delta?: number; + /** Fees Charged Per Million Millitokens */ + fee_rate?: number; + /** + * Source Based Base Fee Reduction String + * + * Not supported on LND 0.17.5 and below + */ + inbound_base_discount_mtokens?: string; + /** + * Source Based Per Million Rate Reduction Number + * + * Not supported on LND 0.17.5 and below + */ + inbound_rate_discount?: number; + /** Channel Is Disabled */ + is_disabled?: boolean; + /** Maximum HTLC Millitokens Value */ + max_htlc_mtokens?: string; + /** Minimum HTLC Millitokens Value */ + min_htlc_mtokens?: string; + /** Node Public Key */ + public_key: string; + /** Policy Last Updated At ISO 8601 Date */ + updated_at?: string; +}