channel rpc

This commit is contained in:
boufni95 2024-08-23 20:20:10 +02:00
parent 11860d099f
commit b5bd1a74d9
24 changed files with 35275 additions and 33084 deletions

View file

@ -38,6 +38,11 @@ The nostr server will send back a message response, and inside the body there wi
- This methods has an __empty__ __request__ body - This methods has an __empty__ __request__ body
- output: [LndSeed](#LndSeed) - output: [LndSeed](#LndSeed)
- ListChannels
- auth type: __Admin__
- This methods has an __empty__ __request__ body
- output: [LndChannels](#LndChannels)
- GetUsageMetrics - GetUsageMetrics
- auth type: __Metrics__ - auth type: __Metrics__
- This methods has an __empty__ __request__ body - This methods has an __empty__ __request__ body
@ -185,9 +190,9 @@ The nostr server will send back a message response, and inside the body there wi
- __User__: - __User__:
- expected context content - expected context content
- __user_id__: _string_
- __app_id__: _string_ - __app_id__: _string_
- __app_user_id__: _string_ - __app_user_id__: _string_
- __user_id__: _string_
- __Admin__: - __Admin__:
- expected context content - expected context content
@ -244,6 +249,13 @@ The nostr server will send back a message response, and inside the body there wi
- This methods has an __empty__ __request__ body - This methods has an __empty__ __request__ body
- output: [LndSeed](#LndSeed) - output: [LndSeed](#LndSeed)
- ListChannels
- auth type: __Admin__
- http method: __get__
- http route: __/api/admin/channels__
- This methods has an __empty__ __request__ body
- output: [LndChannels](#LndChannels)
- GetUsageMetrics - GetUsageMetrics
- auth type: __Metrics__ - auth type: __Metrics__
- http method: __post__ - http method: __post__
@ -601,131 +613,305 @@ The nostr server will send back a message response, and inside the body there wi
## Messages ## Messages
### The content of requests and response from the methods ### The content of requests and response from the methods
### AppsMetricsRequest ### AuthAppRequest
- __from_unix__: _number_ *this field is optional - __name__: _string_
- __to_unix__: _number_ *this field is optional - __allow_user_creation__: _boolean_ *this field is optional
- __include_operations__: _boolean_ *this field is optional
### SetMockAppBalanceRequest ### Application
- __amount__: _number_ - __name__: _string_
- __id__: _string_
- __balance__: _number_
- __npub__: _string_
### NewAddressResponse ### DecodeInvoiceRequest
- __address__: _string_ - __invoice__: _string_
### PayAddressResponse ### OpenChannel
- __txId__: _string_ - __channel_id__: _string_
- __operation_id__: _string_ - __capacity__: _number_
- __service_fee__: _number_ - __active__: _boolean_
- __network_fee__: _number_ - __lifetime__: _number_
- __local_balance__: _number_
- __remote_balance__: _number_
- __label__: _string_
### ChannelRouting
- __send_errors__: _number_
- __receive_errors__: _number_
- __missed_forward_fee_as_output__: _number_
- __events_number__: _number_
- __channel_id__: _string_
- __forward_errors_as_input__: _number_
- __forward_errors_as_output__: _number_
- __missed_forward_fee_as_input__: _number_
- __forward_fee_as_input__: _number_
- __forward_fee_as_output__: _number_
### ChainBalanceEvent
- __block_height__: _number_
- __confirmed_balance__: _number_
- __unconfirmed_balance__: _number_
- __total_balance__: _number_
### GetPaymentStateRequest
- __invoice__: _string_
### EncryptionExchangeRequest
- __deviceId__: _string_
- __publicKey__: _string_
### ChannelBalanceEvent
- __block_height__: _number_
- __channel_id__: _string_
- __local_balance_sats__: _number_
- __remote_balance_sats__: _number_
### HandleLnurlPayResponse ### HandleLnurlPayResponse
- __pr__: _string_ - __pr__: _string_
- __routes__: ARRAY of: _[Empty](#Empty)_ - __routes__: ARRAY of: _[Empty](#Empty)_
### GetProductBuyLinkResponse ### LiveUserOperation
- __link__: _string_ - __operation__: _[UserOperation](#UserOperation)_
### UsageMetric ### RequestNPubLinkingTokenRequest
- __parsed_in_nano__: _number_ - __user_identifier__: _string_
- __validate_in_nano__: _number_
- __handle_in_nano__: _number_
- __batch__: _boolean_
- __nostr__: _boolean_
- __batch_size__: _number_
- __processed_at_ms__: _number_
- __auth_in_nano__: _number_
- __rpc_name__: _string_
### AppMetrics ### HttpCreds
- __app__: _[Application](#Application)_ - __url__: _string_
- __users__: _[UsersInfo](#UsersInfo)_ - __token__: _string_
- __received__: _number_
- __total_fees__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
- __spent__: _number_
- __available__: _number_
- __fees__: _number_
- __invoices__: _number_
### LndMetrics ### AppsMetricsRequest
- __nodes__: ARRAY of: _[LndNodeMetrics](#LndNodeMetrics)_ - __from_unix__: _number_ *this field is optional
- __to_unix__: _number_ *this field is optional
- __include_operations__: _boolean_ *this field is optional
### Application ### LnurlWithdrawInfoResponse
- __balanceCheck__: _string_
- __payLink__: _string_
- __tag__: _string_
- __callback__: _string_
- __k1__: _string_
- __defaultDescription__: _string_
- __minWithdrawable__: _number_
- __maxWithdrawable__: _number_
### NewInvoiceRequest
- __memo__: _string_
- __amountSats__: _number_
### DecodeInvoiceResponse
- __amount__: _number_
### UserInfo
- __service_fee_bps__: _number_
- __network_max_fee_bps__: _number_
- __network_max_fee_fixed__: _number_
- __userId__: _string_
- __balance__: _number_ - __balance__: _number_
- __npub__: _string_ - __max_withdrawable__: _number_
- __name__: _string_ - __user_identifier__: _string_
- __id__: _string_
### AddAppInvoiceRequest ### SetMockInvoiceAsPaidRequest
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - __invoice__: _string_
- __payer_identifier__: _string_ - __amount__: _number_
- __http_callback_url__: _string_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_
### GetAppUserLNURLInfoRequest ### GetAppUserLNURLInfoRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
- __base_url_override__: _string_ - __base_url_override__: _string_
### GetPaymentStateRequest ### GetProductBuyLinkResponse
- __invoice__: _string_ - __link__: _string_
### ChannelRouting ### LndMetrics
- __forward_fee_as_output__: _number_ - __nodes__: ARRAY of: _[LndNodeMetrics](#LndNodeMetrics)_
- __events_number__: _number_
- __send_errors__: _number_
- __forward_errors_as_output__: _number_
- __forward_fee_as_input__: _number_
- __missed_forward_fee_as_input__: _number_
- __missed_forward_fee_as_output__: _number_
- __channel_id__: _string_
- __receive_errors__: _number_
- __forward_errors_as_input__: _number_
### PayAppUserInvoiceRequest ### AddAppUserRequest
- __user_identifier__: _string_ - __balance__: _number_
- __invoice__: _string_ - __identifier__: _string_
- __amount__: _number_ - __fail_if_exists__: _boolean_
### SetMockAppUserBalanceRequest ### BanUserResponse
- __user_identifier__: _string_ - __balance_sats__: _number_
- __amount__: _number_ - __banned_app_users__: ARRAY of: _[BannedAppUser](#BannedAppUser)_
### PayAddressRequest
- __address__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### GetUserOperationsRequest ### GetUserOperationsRequest
- __max_size__: _number_
- __latestIncomingInvoice__: _number_ - __latestIncomingInvoice__: _number_
- __latestOutgoingInvoice__: _number_ - __latestOutgoingInvoice__: _number_
- __latestIncomingTx__: _number_ - __latestIncomingTx__: _number_
- __latestOutgoingTx__: _number_ - __latestOutgoingTx__: _number_
- __latestIncomingUserToUserPayment__: _number_ - __latestIncomingUserToUserPayment__: _number_
- __latestOutgoingUserToUserPayment__: _number_ - __latestOutgoingUserToUserPayment__: _number_
- __max_size__: _number_
### MigrationUpdate
- __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
### LinkNPubThroughTokenRequest
- __token__: _string_
### LndGetInfoRequest
- __nodeId__: _number_
### BannedAppUser
- __app_name__: _string_
- __app_id__: _string_
- __user_identifier__: _string_
- __nostr_pub__: _string_
### Product ### Product
- __id__: _string_ - __id__: _string_
- __name__: _string_ - __name__: _string_
- __price_sats__: _number_ - __price_sats__: _number_
### UseInviteLinkRequest ### GetInviteTokenStateResponse
- __invite_token__: _string_ - __used__: _boolean_
### AppsMetrics ### PayInvoiceResponse
- __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_ - __preimage__: _string_
- __amount_paid__: _number_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### SetMockInvoiceAsPaidRequest ### OpenChannelResponse
- __invoice__: _string_ - __channelId__: _string_
### PayAddressResponse
- __service_fee__: _number_
- __network_fee__: _number_
- __txId__: _string_
- __operation_id__: _string_
### PaymentState
- __network_fee__: _number_
- __paid_at_unix__: _number_
- __amount__: _number_
- __service_fee__: _number_
### UsersInfo
- __no_balance__: _number_
- __negative_balance__: _number_
- __always_been_inactive__: _number_
- __balance_avg__: _number_
- __balance_median__: _number_
- __total__: _number_
### LndGetInfoResponse
- __alias__: _string_
### LndMetricsRequest
- __to_unix__: _number_ *this field is optional
- __from_unix__: _number_ *this field is optional
### SetMockAppUserBalanceRequest
- __amount__: _number_
- __user_identifier__: _string_
### RelaysMigration
- __relays__: ARRAY of: _string_
### UsageMetric
- __rpc_name__: _string_
- __batch__: _boolean_
- __nostr__: _boolean_
- __processed_at_ms__: _number_
- __auth_in_nano__: _number_
- __handle_in_nano__: _number_
- __batch_size__: _number_
- __parsed_in_nano__: _number_
- __validate_in_nano__: _number_
### AppUser
- __identifier__: _string_
- __info__: _[UserInfo](#UserInfo)_
- __max_withdrawable__: _number_
### PayAddressRequest
- __address__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### CreateOneTimeInviteLinkResponse
- __invitation_link__: _string_
### LndSeed
- __seed__: ARRAY of: _string_
### LndChannels
- __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_
### OpenChannelRequest
- __pushAmount__: _number_
- __closeAddress__: _string_
- __destination__: _string_
- __fundingAmount__: _number_
### UserOperations
- __fromIndex__: _number_
- __toIndex__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### Empty
### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_
- __to_user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### BanUserRequest ### LnurlPayInfoResponse
- __user_id__: _string_ - __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
- __allowsNostr__: _boolean_
- __nostrPubkey__: _string_
- __tag__: _string_
- __callback__: _string_
### AddProductRequest
- __name__: _string_
- __price_sats__: _number_
### RequestNPubLinkingTokenResponse
- __token__: _string_
### EnrollAdminTokenRequest
- __admin_token__: _string_
### CreateOneTimeInviteLinkRequest
- __sats__: _number_ *this field is optional
### GetInviteTokenStateRequest
- __invite_token__: _string_
### RoutingEvent
- __forward_fail_event__: _boolean_
- __incoming_channel_id__: _number_
- __incoming_htlc_id__: _number_
- __event_type__: _string_
- __incoming_amt_msat__: _number_
- __failure_string__: _string_
- __settled__: _boolean_
- __offchain__: _boolean_
- __outgoing_channel_id__: _number_
- __outgoing_htlc_id__: _number_
- __timestamp_ns__: _number_
- __outgoing_amt_msat__: _number_
### GetAppUserRequest ### GetAppUserRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
### NewInvoiceResponse ### PayInvoiceRequest
- __invoice__: _string_ - __invoice__: _string_
- __amount__: _number_
### GetUserOperationsResponse ### GetUserOperationsResponse
- __latestIncomingTxOperations__: _[UserOperations](#UserOperations)_ - __latestIncomingTxOperations__: _[UserOperations](#UserOperations)_
@ -735,266 +921,96 @@ The nostr server will send back a message response, and inside the body there wi
- __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_ - __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_
- __latestOutgoingTxOperations__: _[UserOperations](#UserOperations)_ - __latestOutgoingTxOperations__: _[UserOperations](#UserOperations)_
### LndMetricsRequest ### UsageMetrics
- __from_unix__: _number_ *this field is optional - __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_
- __to_unix__: _number_ *this field is optional
### AuthApp ### NewAddressRequest
- __app__: _[Application](#Application)_ - __addressType__: _[AddressType](#AddressType)_
- __auth_token__: _string_
### DecodeInvoiceRequest ### ClosedChannel
- __invoice__: _string_ - __channel_id__: _string_
- __capacity__: _number_
- __closed_height__: _number_
### LnurlLinkResponse ### LndNodeMetrics
- __lnurl__: _string_ - __channels_balance_events__: ARRAY of: _[ChannelBalanceEvent](#ChannelBalanceEvent)_
- __k1__: _string_ - __chain_balance_events__: ARRAY of: _[ChainBalanceEvent](#ChainBalanceEvent)_
- __closed_channels__: ARRAY of: _[ClosedChannel](#ClosedChannel)_
- __channel_routing__: ARRAY of: _[ChannelRouting](#ChannelRouting)_
- __offline_channels__: _number_
- __online_channels__: _number_
- __pending_channels__: _number_
- __closing_channels__: _number_
- __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_
### RequestNPubLinkingTokenResponse ### BanUserRequest
- __token__: _string_ - __user_id__: _string_
### CreateOneTimeInviteLinkResponse
- __invitation_link__: _string_
### UsersInfo
- __total__: _number_
- __no_balance__: _number_
- __negative_balance__: _number_
- __always_been_inactive__: _number_
- __balance_avg__: _number_
- __balance_median__: _number_
### RoutingEvent
- __outgoing_channel_id__: _number_
- __incoming_amt_msat__: _number_
- __settled__: _boolean_
- __outgoing_amt_msat__: _number_
- __failure_string__: _string_
- __offchain__: _boolean_
- __incoming_channel_id__: _number_
- __incoming_htlc_id__: _number_
- __outgoing_htlc_id__: _number_
- __timestamp_ns__: _number_
- __event_type__: _string_
- __forward_fail_event__: _boolean_
### UserInfo
- __user_identifier__: _string_
- __service_fee_bps__: _number_
- __network_max_fee_bps__: _number_
- __network_max_fee_fixed__: _number_
- __userId__: _string_
- __balance__: _number_
- __max_withdrawable__: _number_
### LndGetInfoRequest
- __nodeId__: _number_
### AddAppRequest ### AddAppRequest
- __name__: _string_ - __name__: _string_
- __allow_user_creation__: _boolean_ - __allow_user_creation__: _boolean_
### AddAppUserInvoiceRequest ### AddAppUserInvoiceRequest
- __receiver_identifier__: _string_
- __payer_identifier__: _string_ - __payer_identifier__: _string_
- __http_callback_url__: _string_ - __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
- __receiver_identifier__: _string_
### LinkNPubThroughTokenRequest ### SetMockAppBalanceRequest
- __token__: _string_ - __amount__: _number_
### PayInvoiceResponse ### AppMetrics
- __network_fee__: _number_ - __spent__: _number_
- __preimage__: _string_ - __available__: _number_
- __amount_paid__: _number_ - __fees__: _number_
- __operation_id__: _string_ - __invoices__: _number_
- __service_fee__: _number_ - __operations__: ARRAY of: _[UserOperation](#UserOperation)_
- __app__: _[Application](#Application)_
- __users__: _[UsersInfo](#UsersInfo)_
- __received__: _number_
- __total_fees__: _number_
### LnurlPayInfoResponse ### AppsMetrics
- __allowsNostr__: _boolean_ - __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_
- __nostrPubkey__: _string_
- __tag__: _string_
- __callback__: _string_
- __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
### ClosureMigration ### ClosureMigration
- __closes_at_unix__: _number_ - __closes_at_unix__: _number_
### ChainBalanceEvent ### PayAppUserInvoiceRequest
- __block_height__: _number_ - __user_identifier__: _string_
- __confirmed_balance__: _number_
- __unconfirmed_balance__: _number_
- __total_balance__: _number_
### LndNodeMetrics
- __channels_balance_events__: ARRAY of: _[ChannelBalanceEvent](#ChannelBalanceEvent)_
- __channel_routing__: ARRAY of: _[ChannelRouting](#ChannelRouting)_
- __closing_channels__: _number_
- __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_
- __closed_channels__: ARRAY of: _[ClosedChannel](#ClosedChannel)_
- __chain_balance_events__: ARRAY of: _[ChainBalanceEvent](#ChainBalanceEvent)_
- __offline_channels__: _number_
- __online_channels__: _number_
- __pending_channels__: _number_
### UserOperation
- __network_fee__: _number_
- __type__: _[UserOperationType](#UserOperationType)_
- __identifier__: _string_
- __service_fee__: _number_
- __operationId__: _string_
- __confirmed__: _boolean_
- __tx_hash__: _string_
- __internal__: _boolean_
- __paidAtUnix__: _number_
- __inbound__: _boolean_
- __amount__: _number_
### GetInviteTokenStateRequest
- __invite_token__: _string_
### ChannelBalanceEvent
- __block_height__: _number_
- __channel_id__: _string_
- __local_balance_sats__: _number_
- __remote_balance_sats__: _number_
### OpenChannel
- __channel_id__: _string_
- __capacity__: _number_
- __active__: _boolean_
- __lifetime__: _number_
- __local_balance__: _number_
- __remote_balance__: _number_
### BanUserResponse
- __balance_sats__: _number_
- __banned_app_users__: ARRAY of: _[BannedAppUser](#BannedAppUser)_
### AppUser
- __identifier__: _string_
- __info__: _[UserInfo](#UserInfo)_
- __max_withdrawable__: _number_
### PaymentState
- __amount__: _number_
- __service_fee__: _number_
- __network_fee__: _number_
- __paid_at_unix__: _number_
### MigrationUpdate
- __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
### HttpCreds
- __url__: _string_
- __token__: _string_
### ClosedChannel
- __capacity__: _number_
- __closed_height__: _number_
- __channel_id__: _string_
### LndGetInfoResponse
- __alias__: _string_
### PayInvoiceRequest
- __invoice__: _string_ - __invoice__: _string_
- __amount__: _number_ - __amount__: _number_
### SendAppUserToAppPaymentRequest ### NewAddressResponse
- __from_user_identifier__: _string_ - __address__: _string_
- __amount__: _number_
### OpenChannelRequest ### NewInvoiceResponse
- __closeAddress__: _string_ - __invoice__: _string_
- __destination__: _string_
- __fundingAmount__: _number_
- __pushAmount__: _number_
### EnrollAdminTokenRequest ### UserOperation
- __admin_token__: _string_
### Empty
### NewAddressRequest
- __addressType__: _[AddressType](#AddressType)_
### AddProductRequest
- __name__: _string_
- __price_sats__: _number_
### GetInviteTokenStateResponse
- __used__: _boolean_
### EncryptionExchangeRequest
- __publicKey__: _string_
- __deviceId__: _string_
### UsageMetrics
- __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_
### AuthAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### AddAppUserRequest
- __identifier__: _string_ - __identifier__: _string_
- __fail_if_exists__: _boolean_ - __operationId__: _string_
- __balance__: _number_ - __network_fee__: _number_
- __confirmed__: _boolean_
### DecodeInvoiceResponse - __tx_hash__: _string_
- __paidAtUnix__: _number_
- __type__: _[UserOperationType](#UserOperationType)_
- __amount__: _number_ - __amount__: _number_
- __internal__: _boolean_
- __inbound__: _boolean_
- __service_fee__: _number_
### RelaysMigration ### UseInviteLinkRequest
- __relays__: ARRAY of: _string_ - __invite_token__: _string_
### CreateOneTimeInviteLinkRequest ### AuthApp
- __sats__: _number_ *this field is optional - __app__: _[Application](#Application)_
- __auth_token__: _string_
### BannedAppUser ### AddAppInvoiceRequest
- __app_name__: _string_ - __payer_identifier__: _string_
- __app_id__: _string_ - __http_callback_url__: _string_
- __user_identifier__: _string_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
- __nostr_pub__: _string_
### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_
- __to_user_identifier__: _string_
- __amount__: _number_
### NewInvoiceRequest
- __amountSats__: _number_
- __memo__: _string_
### OpenChannelResponse
- __channelId__: _string_
### LiveUserOperation
- __operation__: _[UserOperation](#UserOperation)_
### LndSeed
- __seed__: ARRAY of: _string_
### LnurlWithdrawInfoResponse
- __maxWithdrawable__: _number_
- __balanceCheck__: _string_
- __payLink__: _string_
- __tag__: _string_
- __callback__: _string_
- __k1__: _string_
- __defaultDescription__: _string_
- __minWithdrawable__: _number_
### UserOperations
- __toIndex__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
- __fromIndex__: _number_
### RequestNPubLinkingTokenRequest
- __user_identifier__: _string_
## Enums ## Enums
### The enumerators used in the messages ### The enumerators used in the messages

File diff suppressed because it is too large Load diff

View file

@ -141,6 +141,25 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
opts.metricsCallback([{ ...info, ...stats, ...authContext }]) 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 } } 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.ListChannels) throw new Error('method: ListChannels is not implemented')
app.get('/api/admin/channels', async (req, res) => {
const info: Types.RequestInfo = { rpcName: 'ListChannels', 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.ListChannels) throw new Error('method: ListChannels is not implemented')
const authContext = await opts.AdminAuthGuard(req.headers['authorization'])
authCtx = authContext
stats.guard = process.hrtime.bigint()
stats.validate = stats.guard
const query = req.query
const params = req.params
const response = await methods.ListChannels({rpcName:'ListChannels', ctx:authContext })
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.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') if (!opts.allowNotImplementedMethods && !methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented')
app.post('/api/reports/usage', async (req, res) => { app.post('/api/reports/usage', async (req, res) => {
const info: Types.RequestInfo = { rpcName: 'GetUsageMetrics', batch: false, nostr: false, batchSize: 0} const info: Types.RequestInfo = { rpcName: 'GetUsageMetrics', batch: false, nostr: false, batchSize: 0}

View file

@ -87,6 +87,20 @@ export default (params: ClientParams) => ({
} }
return { status: 'ERROR', reason: 'invalid response' } return { status: 'ERROR', reason: 'invalid response' }
}, },
ListChannels: async (): Promise<ResultError | ({ status: 'OK' }& Types.LndChannels)> => {
const auth = await params.retrieveAdminAuth()
if (auth === null) throw new Error('retrieveAdminAuth() returned null')
let finalRoute = '/api/admin/channels'
const { data } = await axios.get(params.baseUrl + finalRoute, { 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.LndChannelsValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetUsageMetrics: async (): Promise<ResultError | ({ status: 'OK' }& Types.UsageMetrics)> => { GetUsageMetrics: async (): Promise<ResultError | ({ status: 'OK' }& Types.UsageMetrics)> => {
const auth = await params.retrieveMetricsAuth() const auth = await params.retrieveMetricsAuth()
if (auth === null) throw new Error('retrieveMetricsAuth() returned null') if (auth === null) throw new Error('retrieveMetricsAuth() returned null')

View file

@ -86,6 +86,20 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ
} }
return { status: 'ERROR', reason: 'invalid response' } return { status: 'ERROR', reason: 'invalid response' }
}, },
ListChannels: async (): Promise<ResultError | ({ status: 'OK' }& Types.LndChannels)> => {
const auth = await params.retrieveNostrAdminAuth()
if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null')
const nostrRequest: NostrRequest = {}
const data = await send(params.pubDestination, {rpcName:'ListChannels',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.LndChannelsValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetUsageMetrics: async (): Promise<ResultError | ({ status: 'OK' }& Types.UsageMetrics)> => { GetUsageMetrics: async (): Promise<ResultError | ({ status: 'OK' }& Types.UsageMetrics)> => {
const auth = await params.retrieveNostrMetricsAuth() const auth = await params.retrieveNostrMetricsAuth()
if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null')

View file

@ -16,10 +16,10 @@ export type NostrOptions = {
logger?: Logger logger?: Logger
throwErrors?: true throwErrors?: true
metricsCallback: (metrics: Types.RequestMetric[]) => void metricsCallback: (metrics: Types.RequestMetric[]) => void
NostrAdminAuthGuard: (appId?:string, identifier?: string) => Promise<Types.AdminContext>
NostrMetricsAuthGuard: (appId?:string, identifier?: string) => Promise<Types.MetricsContext>
NostrUserAuthGuard: (appId?:string, identifier?: string) => Promise<Types.UserContext> NostrUserAuthGuard: (appId?:string, identifier?: string) => Promise<Types.UserContext>
NostrGuestWithPubAuthGuard: (appId?:string, identifier?: string) => Promise<Types.GuestWithPubContext> NostrGuestWithPubAuthGuard: (appId?:string, identifier?: string) => Promise<Types.GuestWithPubContext>
NostrAdminAuthGuard: (appId?:string, identifier?: string) => Promise<Types.AdminContext>
NostrMetricsAuthGuard: (appId?:string, identifier?: string) => Promise<Types.MetricsContext>
} }
const logErrorAndReturnResponse = (error: Error, response: string, res: NostrResponse, logger: Logger, metric: Types.RequestMetric, metricsCallback: (metrics: Types.RequestMetric[]) => void) => { const logErrorAndReturnResponse = (error: Error, response: string, res: NostrResponse, logger: Logger, metric: Types.RequestMetric, metricsCallback: (metrics: Types.RequestMetric[]) => void) => {
logger.error(error.message || error); metricsCallback([{ ...metric, error: response }]); res({ status: 'ERROR', reason: response }) logger.error(error.message || error); metricsCallback([{ ...metric, error: response }]); res({ status: 'ERROR', reason: response })
@ -109,6 +109,19 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => {
opts.metricsCallback([{ ...info, ...stats, ...authContext }]) 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 } }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 break
case 'ListChannels':
try {
if (!methods.ListChannels) throw new Error('method: ListChannels is not implemented')
const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier)
stats.guard = process.hrtime.bigint()
authCtx = authContext
stats.validate = stats.guard
const response = await methods.ListChannels({rpcName:'ListChannels', ctx:authContext })
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 'GetUsageMetrics': case 'GetUsageMetrics':
try { try {
if (!methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') if (!methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented')

File diff suppressed because it is too large Load diff

View file

@ -1,128 +1,128 @@
// @generated by protobuf-ts 2.8.1 // @generated by protobuf-ts 2.8.1
// @generated from protobuf file "chainnotifier.proto" (package "chainrpc", syntax proto3) // @generated from protobuf file "chainnotifier.proto" (package "chainrpc", syntax proto3)
// tslint:disable // tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { ChainNotifier } from "./chainnotifier.js"; import { ChainNotifier } from "./chainnotifier.js";
import type { BlockEpoch } from "./chainnotifier.js"; import type { BlockEpoch } from "./chainnotifier.js";
import type { SpendEvent } from "./chainnotifier.js"; import type { SpendEvent } from "./chainnotifier.js";
import type { SpendRequest } from "./chainnotifier.js"; import type { SpendRequest } from "./chainnotifier.js";
import { stackIntercept } from "@protobuf-ts/runtime-rpc"; import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { ConfEvent } from "./chainnotifier.js"; import type { ConfEvent } from "./chainnotifier";
import type { ConfRequest } from "./chainnotifier.js"; import type { ConfRequest } from "./chainnotifier";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc"; import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/** /**
* ChainNotifier is a service that can be used to get information about the * ChainNotifier is a service that can be used to get information about the
* chain backend by registering notifiers for chain events. * chain backend by registering notifiers for chain events.
* *
* @generated from protobuf service chainrpc.ChainNotifier * @generated from protobuf service chainrpc.ChainNotifier
*/ */
export interface IChainNotifierClient { export interface IChainNotifierClient {
/** /**
* *
* RegisterConfirmationsNtfn is a synchronous response-streaming RPC that * RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
* registers an intent for a client to be notified once a confirmation request * registers an intent for a client to be notified once a confirmation request
* has reached its required number of confirmations on-chain. * has reached its required number of confirmations on-chain.
* *
* A confirmation request must have a valid output script. It is also possible * A confirmation request must have a valid output script. It is also possible
* to give a transaction ID. If the transaction ID is not set, a notification * to give a transaction ID. If the transaction ID is not set, a notification
* is sent once the output script confirms. If the transaction ID is also set, * is sent once the output script confirms. If the transaction ID is also set,
* a notification is sent once the output script confirms in the given * a notification is sent once the output script confirms in the given
* transaction. * transaction.
* *
* @generated from protobuf rpc: RegisterConfirmationsNtfn(chainrpc.ConfRequest) returns (stream chainrpc.ConfEvent); * @generated from protobuf rpc: RegisterConfirmationsNtfn(chainrpc.ConfRequest) returns (stream chainrpc.ConfEvent);
*/ */
registerConfirmationsNtfn(input: ConfRequest, options?: RpcOptions): ServerStreamingCall<ConfRequest, ConfEvent>; registerConfirmationsNtfn(input: ConfRequest, options?: RpcOptions): ServerStreamingCall<ConfRequest, ConfEvent>;
/** /**
* *
* RegisterSpendNtfn is a synchronous response-streaming RPC that registers an * RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
* intent for a client to be notification once a spend request has been spent * intent for a client to be notification once a spend request has been spent
* by a transaction that has confirmed on-chain. * by a transaction that has confirmed on-chain.
* *
* A client can specify whether the spend request should be for a particular * A client can specify whether the spend request should be for a particular
* outpoint or for an output script by specifying a zero outpoint. * outpoint or for an output script by specifying a zero outpoint.
* *
* @generated from protobuf rpc: RegisterSpendNtfn(chainrpc.SpendRequest) returns (stream chainrpc.SpendEvent); * @generated from protobuf rpc: RegisterSpendNtfn(chainrpc.SpendRequest) returns (stream chainrpc.SpendEvent);
*/ */
registerSpendNtfn(input: SpendRequest, options?: RpcOptions): ServerStreamingCall<SpendRequest, SpendEvent>; registerSpendNtfn(input: SpendRequest, options?: RpcOptions): ServerStreamingCall<SpendRequest, SpendEvent>;
/** /**
* *
* RegisterBlockEpochNtfn is a synchronous response-streaming RPC that * RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
* registers an intent for a client to be notified of blocks in the chain. The * registers an intent for a client to be notified of blocks in the chain. The
* stream will return a hash and height tuple of a block for each new/stale * stream will return a hash and height tuple of a block for each new/stale
* block in the chain. It is the client's responsibility to determine whether * block in the chain. It is the client's responsibility to determine whether
* the tuple returned is for a new or stale block in the chain. * the tuple returned is for a new or stale block in the chain.
* *
* A client can also request a historical backlog of blocks from a particular * A client can also request a historical backlog of blocks from a particular
* point. This allows clients to be idempotent by ensuring that they do not * point. This allows clients to be idempotent by ensuring that they do not
* missing processing a single block within the chain. * missing processing a single block within the chain.
* *
* @generated from protobuf rpc: RegisterBlockEpochNtfn(chainrpc.BlockEpoch) returns (stream chainrpc.BlockEpoch); * @generated from protobuf rpc: RegisterBlockEpochNtfn(chainrpc.BlockEpoch) returns (stream chainrpc.BlockEpoch);
*/ */
registerBlockEpochNtfn(input: BlockEpoch, options?: RpcOptions): ServerStreamingCall<BlockEpoch, BlockEpoch>; registerBlockEpochNtfn(input: BlockEpoch, options?: RpcOptions): ServerStreamingCall<BlockEpoch, BlockEpoch>;
} }
/** /**
* ChainNotifier is a service that can be used to get information about the * ChainNotifier is a service that can be used to get information about the
* chain backend by registering notifiers for chain events. * chain backend by registering notifiers for chain events.
* *
* @generated from protobuf service chainrpc.ChainNotifier * @generated from protobuf service chainrpc.ChainNotifier
*/ */
export class ChainNotifierClient implements IChainNotifierClient, ServiceInfo { export class ChainNotifierClient implements IChainNotifierClient, ServiceInfo {
typeName = ChainNotifier.typeName; typeName = ChainNotifier.typeName;
methods = ChainNotifier.methods; methods = ChainNotifier.methods;
options = ChainNotifier.options; options = ChainNotifier.options;
constructor(private readonly _transport: RpcTransport) { constructor(private readonly _transport: RpcTransport) {
} }
/** /**
* *
* RegisterConfirmationsNtfn is a synchronous response-streaming RPC that * RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
* registers an intent for a client to be notified once a confirmation request * registers an intent for a client to be notified once a confirmation request
* has reached its required number of confirmations on-chain. * has reached its required number of confirmations on-chain.
* *
* A confirmation request must have a valid output script. It is also possible * A confirmation request must have a valid output script. It is also possible
* to give a transaction ID. If the transaction ID is not set, a notification * to give a transaction ID. If the transaction ID is not set, a notification
* is sent once the output script confirms. If the transaction ID is also set, * is sent once the output script confirms. If the transaction ID is also set,
* a notification is sent once the output script confirms in the given * a notification is sent once the output script confirms in the given
* transaction. * transaction.
* *
* @generated from protobuf rpc: RegisterConfirmationsNtfn(chainrpc.ConfRequest) returns (stream chainrpc.ConfEvent); * @generated from protobuf rpc: RegisterConfirmationsNtfn(chainrpc.ConfRequest) returns (stream chainrpc.ConfEvent);
*/ */
registerConfirmationsNtfn(input: ConfRequest, options?: RpcOptions): ServerStreamingCall<ConfRequest, ConfEvent> { registerConfirmationsNtfn(input: ConfRequest, options?: RpcOptions): ServerStreamingCall<ConfRequest, ConfEvent> {
const method = this.methods[0], opt = this._transport.mergeOptions(options); const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept<ConfRequest, ConfEvent>("serverStreaming", this._transport, method, opt, input); return stackIntercept<ConfRequest, ConfEvent>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* RegisterSpendNtfn is a synchronous response-streaming RPC that registers an * RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
* intent for a client to be notification once a spend request has been spent * intent for a client to be notification once a spend request has been spent
* by a transaction that has confirmed on-chain. * by a transaction that has confirmed on-chain.
* *
* A client can specify whether the spend request should be for a particular * A client can specify whether the spend request should be for a particular
* outpoint or for an output script by specifying a zero outpoint. * outpoint or for an output script by specifying a zero outpoint.
* *
* @generated from protobuf rpc: RegisterSpendNtfn(chainrpc.SpendRequest) returns (stream chainrpc.SpendEvent); * @generated from protobuf rpc: RegisterSpendNtfn(chainrpc.SpendRequest) returns (stream chainrpc.SpendEvent);
*/ */
registerSpendNtfn(input: SpendRequest, options?: RpcOptions): ServerStreamingCall<SpendRequest, SpendEvent> { registerSpendNtfn(input: SpendRequest, options?: RpcOptions): ServerStreamingCall<SpendRequest, SpendEvent> {
const method = this.methods[1], opt = this._transport.mergeOptions(options); const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept<SpendRequest, SpendEvent>("serverStreaming", this._transport, method, opt, input); return stackIntercept<SpendRequest, SpendEvent>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* RegisterBlockEpochNtfn is a synchronous response-streaming RPC that * RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
* registers an intent for a client to be notified of blocks in the chain. The * registers an intent for a client to be notified of blocks in the chain. The
* stream will return a hash and height tuple of a block for each new/stale * stream will return a hash and height tuple of a block for each new/stale
* block in the chain. It is the client's responsibility to determine whether * block in the chain. It is the client's responsibility to determine whether
* the tuple returned is for a new or stale block in the chain. * the tuple returned is for a new or stale block in the chain.
* *
* A client can also request a historical backlog of blocks from a particular * A client can also request a historical backlog of blocks from a particular
* point. This allows clients to be idempotent by ensuring that they do not * point. This allows clients to be idempotent by ensuring that they do not
* missing processing a single block within the chain. * missing processing a single block within the chain.
* *
* @generated from protobuf rpc: RegisterBlockEpochNtfn(chainrpc.BlockEpoch) returns (stream chainrpc.BlockEpoch); * @generated from protobuf rpc: RegisterBlockEpochNtfn(chainrpc.BlockEpoch) returns (stream chainrpc.BlockEpoch);
*/ */
registerBlockEpochNtfn(input: BlockEpoch, options?: RpcOptions): ServerStreamingCall<BlockEpoch, BlockEpoch> { registerBlockEpochNtfn(input: BlockEpoch, options?: RpcOptions): ServerStreamingCall<BlockEpoch, BlockEpoch> {
const method = this.methods[2], opt = this._transport.mergeOptions(options); const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept<BlockEpoch, BlockEpoch>("serverStreaming", this._transport, method, opt, input); return stackIntercept<BlockEpoch, BlockEpoch>("serverStreaming", this._transport, method, opt, input);
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,139 +1,139 @@
// @generated by protobuf-ts 2.8.1 // @generated by protobuf-ts 2.8.1
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3) // @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable // tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { Invoices } from "./invoices.js"; import { Invoices } from "./invoices.js";
import type { LookupInvoiceMsg } from "./invoices.js"; import type { LookupInvoiceMsg } from "./invoices.js";
import type { SettleInvoiceResp } from "./invoices.js"; import type { SettleInvoiceResp } from "./invoices.js";
import type { SettleInvoiceMsg } from "./invoices.js"; import type { SettleInvoiceMsg } from "./invoices.js";
import type { AddHoldInvoiceResp } from "./invoices.js"; import type { AddHoldInvoiceResp } from "./invoices.js";
import type { AddHoldInvoiceRequest } from "./invoices.js"; import type { AddHoldInvoiceRequest } from "./invoices.js";
import type { CancelInvoiceResp } from "./invoices.js"; import type { CancelInvoiceResp } from "./invoices.js";
import type { CancelInvoiceMsg } from "./invoices.js"; import type { CancelInvoiceMsg } from "./invoices.js";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import { stackIntercept } from "@protobuf-ts/runtime-rpc"; import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { Invoice } from "./lightning.js"; import type { Invoice } from "./lightning.js";
import type { SubscribeSingleInvoiceRequest } from "./invoices.js"; import type { SubscribeSingleInvoiceRequest } from "./invoices.js";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc"; import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/** /**
* Invoices is a service that can be used to create, accept, settle and cancel * Invoices is a service that can be used to create, accept, settle and cancel
* invoices. * invoices.
* *
* @generated from protobuf service invoicesrpc.Invoices * @generated from protobuf service invoicesrpc.Invoices
*/ */
export interface IInvoicesClient { export interface IInvoicesClient {
/** /**
* *
* SubscribeSingleInvoice returns a uni-directional stream (server -> client) * SubscribeSingleInvoice returns a uni-directional stream (server -> client)
* to notify the client of state transitions of the specified invoice. * to notify the client of state transitions of the specified invoice.
* Initially the current invoice state is always sent out. * Initially the current invoice state is always sent out.
* *
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice); * @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
*/ */
subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice>; subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice>;
/** /**
* *
* CancelInvoice cancels a currently open invoice. If the invoice is already * CancelInvoice cancels a currently open invoice. If the invoice is already
* canceled, this call will succeed. If the invoice is already settled, it will * canceled, this call will succeed. If the invoice is already settled, it will
* fail. * fail.
* *
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp); * @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
*/ */
cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp>; cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp>;
/** /**
* *
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash * AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
* supplied in the request. * supplied in the request.
* *
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp); * @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
*/ */
addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp>; addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp>;
/** /**
* *
* SettleInvoice settles an accepted invoice. If the invoice is already * SettleInvoice settles an accepted invoice. If the invoice is already
* settled, this call will succeed. * settled, this call will succeed.
* *
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp); * @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
*/ */
settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp>; settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp>;
/** /**
* *
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced * LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
* using either its payment hash, payment address, or set ID. * using either its payment hash, payment address, or set ID.
* *
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice); * @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
*/ */
lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice>; lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice>;
} }
/** /**
* Invoices is a service that can be used to create, accept, settle and cancel * Invoices is a service that can be used to create, accept, settle and cancel
* invoices. * invoices.
* *
* @generated from protobuf service invoicesrpc.Invoices * @generated from protobuf service invoicesrpc.Invoices
*/ */
export class InvoicesClient implements IInvoicesClient, ServiceInfo { export class InvoicesClient implements IInvoicesClient, ServiceInfo {
typeName = Invoices.typeName; typeName = Invoices.typeName;
methods = Invoices.methods; methods = Invoices.methods;
options = Invoices.options; options = Invoices.options;
constructor(private readonly _transport: RpcTransport) { constructor(private readonly _transport: RpcTransport) {
} }
/** /**
* *
* SubscribeSingleInvoice returns a uni-directional stream (server -> client) * SubscribeSingleInvoice returns a uni-directional stream (server -> client)
* to notify the client of state transitions of the specified invoice. * to notify the client of state transitions of the specified invoice.
* Initially the current invoice state is always sent out. * Initially the current invoice state is always sent out.
* *
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice); * @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
*/ */
subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice> { subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice> {
const method = this.methods[0], opt = this._transport.mergeOptions(options); const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept<SubscribeSingleInvoiceRequest, Invoice>("serverStreaming", this._transport, method, opt, input); return stackIntercept<SubscribeSingleInvoiceRequest, Invoice>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* CancelInvoice cancels a currently open invoice. If the invoice is already * CancelInvoice cancels a currently open invoice. If the invoice is already
* canceled, this call will succeed. If the invoice is already settled, it will * canceled, this call will succeed. If the invoice is already settled, it will
* fail. * fail.
* *
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp); * @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
*/ */
cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp> { cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp> {
const method = this.methods[1], opt = this._transport.mergeOptions(options); const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept<CancelInvoiceMsg, CancelInvoiceResp>("unary", this._transport, method, opt, input); return stackIntercept<CancelInvoiceMsg, CancelInvoiceResp>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash * AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
* supplied in the request. * supplied in the request.
* *
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp); * @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
*/ */
addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp> { addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp> {
const method = this.methods[2], opt = this._transport.mergeOptions(options); const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept<AddHoldInvoiceRequest, AddHoldInvoiceResp>("unary", this._transport, method, opt, input); return stackIntercept<AddHoldInvoiceRequest, AddHoldInvoiceResp>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* SettleInvoice settles an accepted invoice. If the invoice is already * SettleInvoice settles an accepted invoice. If the invoice is already
* settled, this call will succeed. * settled, this call will succeed.
* *
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp); * @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
*/ */
settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp> { settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp> {
const method = this.methods[3], opt = this._transport.mergeOptions(options); const method = this.methods[3], opt = this._transport.mergeOptions(options);
return stackIntercept<SettleInvoiceMsg, SettleInvoiceResp>("unary", this._transport, method, opt, input); return stackIntercept<SettleInvoiceMsg, SettleInvoiceResp>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced * LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
* using either its payment hash, payment address, or set ID. * using either its payment hash, payment address, or set ID.
* *
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice); * @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
*/ */
lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice> { lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice> {
const method = this.methods[4], opt = this._transport.mergeOptions(options); const method = this.methods[4], opt = this._transport.mergeOptions(options);
return stackIntercept<LookupInvoiceMsg, Invoice>("unary", this._transport, method, opt, input); return stackIntercept<LookupInvoiceMsg, Invoice>("unary", this._transport, method, opt, input);
} }
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,446 +1,446 @@
// @generated by protobuf-ts 2.8.1 // @generated by protobuf-ts 2.8.1
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3) // @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
// tslint:disable // tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { Router } from "./router.js"; import { Router } from "./router.js";
import type { UpdateChanStatusResponse } from "./router.js"; import type { UpdateChanStatusResponse } from "./router.js";
import type { UpdateChanStatusRequest } from "./router.js"; import type { UpdateChanStatusRequest } from "./router.js";
import type { ForwardHtlcInterceptRequest } from "./router.js"; import type { ForwardHtlcInterceptRequest } from "./router.js";
import type { ForwardHtlcInterceptResponse } from "./router.js"; import type { ForwardHtlcInterceptResponse } from "./router.js";
import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc"; import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { PaymentStatus } from "./router.js"; import type { PaymentStatus } from "./router.js";
import type { HtlcEvent } from "./router.js"; import type { HtlcEvent } from "./router.js";
import type { SubscribeHtlcEventsRequest } from "./router.js"; import type { SubscribeHtlcEventsRequest } from "./router.js";
import type { BuildRouteResponse } from "./router.js"; import type { BuildRouteResponse } from "./router.js";
import type { BuildRouteRequest } from "./router.js"; import type { BuildRouteRequest } from "./router.js";
import type { QueryProbabilityResponse } from "./router.js"; import type { QueryProbabilityResponse } from "./router.js";
import type { QueryProbabilityRequest } from "./router.js"; import type { QueryProbabilityRequest } from "./router.js";
import type { SetMissionControlConfigResponse } from "./router.js"; import type { SetMissionControlConfigResponse } from "./router.js";
import type { SetMissionControlConfigRequest } from "./router.js"; import type { SetMissionControlConfigRequest } from "./router.js";
import type { GetMissionControlConfigResponse } from "./router.js"; import type { GetMissionControlConfigResponse } from "./router.js";
import type { GetMissionControlConfigRequest } from "./router.js"; import type { GetMissionControlConfigRequest } from "./router.js";
import type { XImportMissionControlResponse } from "./router.js"; import type { XImportMissionControlResponse } from "./router.js";
import type { XImportMissionControlRequest } from "./router.js"; import type { XImportMissionControlRequest } from "./router.js";
import type { QueryMissionControlResponse } from "./router.js"; import type { QueryMissionControlResponse } from "./router.js";
import type { QueryMissionControlRequest } from "./router.js"; import type { QueryMissionControlRequest } from "./router.js";
import type { ResetMissionControlResponse } from "./router.js"; import type { ResetMissionControlResponse } from "./router.js";
import type { ResetMissionControlRequest } from "./router.js"; import type { ResetMissionControlRequest } from "./router.js";
import type { HTLCAttempt } from "./lightning.js"; import type { HTLCAttempt } from "./lightning.js";
import type { SendToRouteResponse } from "./router.js"; import type { SendToRouteResponse } from "./router.js";
import type { SendToRouteRequest } from "./router.js"; import type { SendToRouteRequest } from "./router.js";
import type { RouteFeeResponse } from "./router.js"; import type { RouteFeeResponse } from "./router.js";
import type { RouteFeeRequest } from "./router.js"; import type { RouteFeeRequest } from "./router.js";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { TrackPaymentsRequest } from "./router.js"; import type { TrackPaymentsRequest } from "./router.js";
import type { TrackPaymentRequest } from "./router.js"; import type { TrackPaymentRequest } from "./router.js";
import { stackIntercept } from "@protobuf-ts/runtime-rpc"; import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { Payment } from "./lightning.js"; import type { Payment } from "./lightning.js";
import type { SendPaymentRequest } from "./router.js"; import type { SendPaymentRequest } from "./router.js";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc"; import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/** /**
* Router is a service that offers advanced interaction with the router * Router is a service that offers advanced interaction with the router
* subsystem of the daemon. * subsystem of the daemon.
* *
* @generated from protobuf service routerrpc.Router * @generated from protobuf service routerrpc.Router
*/ */
export interface IRouterClient { export interface IRouterClient {
/** /**
* *
* SendPaymentV2 attempts to route a payment described by the passed * SendPaymentV2 attempts to route a payment described by the passed
* PaymentRequest to the final destination. The call returns a stream of * PaymentRequest to the final destination. The call returns a stream of
* payment updates. * payment updates.
* *
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment); * @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
*/ */
sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment>; sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment>;
/** /**
* *
* TrackPaymentV2 returns an update stream for the payment identified by the * TrackPaymentV2 returns an update stream for the payment identified by the
* payment hash. * payment hash.
* *
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment); * @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
*/ */
trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment>; trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment>;
/** /**
* *
* TrackPayments returns an update stream for every payment that is not in a * TrackPayments returns an update stream for every payment that is not in a
* terminal state. Note that if payments are in-flight while starting a new * terminal state. Note that if payments are in-flight while starting a new
* subscription, the start of the payment stream could produce out-of-order * subscription, the start of the payment stream could produce out-of-order
* and/or duplicate events. In order to get updates for every in-flight * and/or duplicate events. In order to get updates for every in-flight
* payment attempt make sure to subscribe to this method before initiating any * payment attempt make sure to subscribe to this method before initiating any
* payments. * payments.
* *
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment); * @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
*/ */
trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment>; trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment>;
/** /**
* *
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it * EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
* may cost to send an HTLC to the target end destination. * may cost to send an HTLC to the target end destination.
* *
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse); * @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
*/ */
estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse>; estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse>;
/** /**
* *
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via * Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
* the specified route. This method differs from SendPayment in that it * the specified route. This method differs from SendPayment in that it
* allows users to specify a full route manually. This can be used for * allows users to specify a full route manually. This can be used for
* things like rebalancing, and atomic swaps. It differs from the newer * things like rebalancing, and atomic swaps. It differs from the newer
* SendToRouteV2 in that it doesn't return the full HTLC information. * SendToRouteV2 in that it doesn't return the full HTLC information.
* *
* @deprecated * @deprecated
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse); * @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
*/ */
sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse>; sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse>;
/** /**
* *
* SendToRouteV2 attempts to make a payment via the specified route. This * SendToRouteV2 attempts to make a payment via the specified route. This
* method differs from SendPayment in that it allows users to specify a full * method differs from SendPayment in that it allows users to specify a full
* route manually. This can be used for things like rebalancing, and atomic * route manually. This can be used for things like rebalancing, and atomic
* swaps. * swaps.
* *
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt); * @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
*/ */
sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt>; sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt>;
/** /**
* *
* ResetMissionControl clears all mission control state and starts with a clean * ResetMissionControl clears all mission control state and starts with a clean
* slate. * slate.
* *
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse); * @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
*/ */
resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse>; resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse>;
/** /**
* *
* QueryMissionControl exposes the internal mission control state to callers. * QueryMissionControl exposes the internal mission control state to callers.
* It is a development feature. * It is a development feature.
* *
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse); * @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
*/ */
queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse>; queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse>;
/** /**
* *
* XImportMissionControl is an experimental API that imports the state provided * XImportMissionControl is an experimental API that imports the state provided
* to the internal mission control's state, using all results which are more * to the internal mission control's state, using all results which are more
* recent than our existing values. These values will only be imported * recent than our existing values. These values will only be imported
* in-memory, and will not be persisted across restarts. * in-memory, and will not be persisted across restarts.
* *
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse); * @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
*/ */
xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse>; xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse>;
/** /**
* *
* GetMissionControlConfig returns mission control's current config. * GetMissionControlConfig returns mission control's current config.
* *
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse); * @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
*/ */
getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse>; getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse>;
/** /**
* *
* SetMissionControlConfig will set mission control's config, if the config * SetMissionControlConfig will set mission control's config, if the config
* provided is valid. * provided is valid.
* *
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse); * @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
*/ */
setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse>; setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse>;
/** /**
* *
* QueryProbability returns the current success probability estimate for a * QueryProbability returns the current success probability estimate for a
* given node pair and amount. * given node pair and amount.
* *
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse); * @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
*/ */
queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse>; queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse>;
/** /**
* *
* BuildRoute builds a fully specified route based on a list of hop public * BuildRoute builds a fully specified route based on a list of hop public
* keys. It retrieves the relevant channel policies from the graph in order to * keys. It retrieves the relevant channel policies from the graph in order to
* calculate the correct fees and time locks. * calculate the correct fees and time locks.
* *
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse); * @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
*/ */
buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse>; buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse>;
/** /**
* *
* SubscribeHtlcEvents creates a uni-directional stream from the server to * SubscribeHtlcEvents creates a uni-directional stream from the server to
* the client which delivers a stream of htlc events. * the client which delivers a stream of htlc events.
* *
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent); * @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
*/ */
subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent>; subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent>;
/** /**
* *
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment * Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
* described by the passed PaymentRequest to the final destination. The call * described by the passed PaymentRequest to the final destination. The call
* returns a stream of payment status updates. * returns a stream of payment status updates.
* *
* @deprecated * @deprecated
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus); * @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/ */
sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus>; sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus>;
/** /**
* *
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for * Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
* the payment identified by the payment hash. * the payment identified by the payment hash.
* *
* @deprecated * @deprecated
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus); * @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/ */
trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus>; trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus>;
/** /**
* * * *
* HtlcInterceptor dispatches a bi-directional streaming RPC in which * HtlcInterceptor dispatches a bi-directional streaming RPC in which
* Forwarded HTLC requests are sent to the client and the client responds with * Forwarded HTLC requests are sent to the client and the client responds with
* a boolean that tells LND if this htlc should be intercepted. * a boolean that tells LND if this htlc should be intercepted.
* In case of interception, the htlc can be either settled, cancelled or * In case of interception, the htlc can be either settled, cancelled or
* resumed later by using the ResolveHoldForward endpoint. * resumed later by using the ResolveHoldForward endpoint.
* *
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest); * @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
*/ */
htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>; htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>;
/** /**
* *
* UpdateChanStatus attempts to manually set the state of a channel * UpdateChanStatus attempts to manually set the state of a channel
* (enabled, disabled, or auto). A manual "disable" request will cause the * (enabled, disabled, or auto). A manual "disable" request will cause the
* channel to stay disabled until a subsequent manual request of either * channel to stay disabled until a subsequent manual request of either
* "enable" or "auto". * "enable" or "auto".
* *
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse); * @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
*/ */
updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse>; updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse>;
} }
/** /**
* Router is a service that offers advanced interaction with the router * Router is a service that offers advanced interaction with the router
* subsystem of the daemon. * subsystem of the daemon.
* *
* @generated from protobuf service routerrpc.Router * @generated from protobuf service routerrpc.Router
*/ */
export class RouterClient implements IRouterClient, ServiceInfo { export class RouterClient implements IRouterClient, ServiceInfo {
typeName = Router.typeName; typeName = Router.typeName;
methods = Router.methods; methods = Router.methods;
options = Router.options; options = Router.options;
constructor(private readonly _transport: RpcTransport) { constructor(private readonly _transport: RpcTransport) {
} }
/** /**
* *
* SendPaymentV2 attempts to route a payment described by the passed * SendPaymentV2 attempts to route a payment described by the passed
* PaymentRequest to the final destination. The call returns a stream of * PaymentRequest to the final destination. The call returns a stream of
* payment updates. * payment updates.
* *
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment); * @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
*/ */
sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment> { sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment> {
const method = this.methods[0], opt = this._transport.mergeOptions(options); const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept<SendPaymentRequest, Payment>("serverStreaming", this._transport, method, opt, input); return stackIntercept<SendPaymentRequest, Payment>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* TrackPaymentV2 returns an update stream for the payment identified by the * TrackPaymentV2 returns an update stream for the payment identified by the
* payment hash. * payment hash.
* *
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment); * @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
*/ */
trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment> { trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment> {
const method = this.methods[1], opt = this._transport.mergeOptions(options); const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept<TrackPaymentRequest, Payment>("serverStreaming", this._transport, method, opt, input); return stackIntercept<TrackPaymentRequest, Payment>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* TrackPayments returns an update stream for every payment that is not in a * TrackPayments returns an update stream for every payment that is not in a
* terminal state. Note that if payments are in-flight while starting a new * terminal state. Note that if payments are in-flight while starting a new
* subscription, the start of the payment stream could produce out-of-order * subscription, the start of the payment stream could produce out-of-order
* and/or duplicate events. In order to get updates for every in-flight * and/or duplicate events. In order to get updates for every in-flight
* payment attempt make sure to subscribe to this method before initiating any * payment attempt make sure to subscribe to this method before initiating any
* payments. * payments.
* *
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment); * @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
*/ */
trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment> { trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment> {
const method = this.methods[2], opt = this._transport.mergeOptions(options); const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept<TrackPaymentsRequest, Payment>("serverStreaming", this._transport, method, opt, input); return stackIntercept<TrackPaymentsRequest, Payment>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it * EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
* may cost to send an HTLC to the target end destination. * may cost to send an HTLC to the target end destination.
* *
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse); * @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
*/ */
estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse> { estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse> {
const method = this.methods[3], opt = this._transport.mergeOptions(options); const method = this.methods[3], opt = this._transport.mergeOptions(options);
return stackIntercept<RouteFeeRequest, RouteFeeResponse>("unary", this._transport, method, opt, input); return stackIntercept<RouteFeeRequest, RouteFeeResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via * Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
* the specified route. This method differs from SendPayment in that it * the specified route. This method differs from SendPayment in that it
* allows users to specify a full route manually. This can be used for * allows users to specify a full route manually. This can be used for
* things like rebalancing, and atomic swaps. It differs from the newer * things like rebalancing, and atomic swaps. It differs from the newer
* SendToRouteV2 in that it doesn't return the full HTLC information. * SendToRouteV2 in that it doesn't return the full HTLC information.
* *
* @deprecated * @deprecated
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse); * @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
*/ */
sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse> { sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse> {
const method = this.methods[4], opt = this._transport.mergeOptions(options); const method = this.methods[4], opt = this._transport.mergeOptions(options);
return stackIntercept<SendToRouteRequest, SendToRouteResponse>("unary", this._transport, method, opt, input); return stackIntercept<SendToRouteRequest, SendToRouteResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* SendToRouteV2 attempts to make a payment via the specified route. This * SendToRouteV2 attempts to make a payment via the specified route. This
* method differs from SendPayment in that it allows users to specify a full * method differs from SendPayment in that it allows users to specify a full
* route manually. This can be used for things like rebalancing, and atomic * route manually. This can be used for things like rebalancing, and atomic
* swaps. * swaps.
* *
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt); * @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
*/ */
sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt> { sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt> {
const method = this.methods[5], opt = this._transport.mergeOptions(options); const method = this.methods[5], opt = this._transport.mergeOptions(options);
return stackIntercept<SendToRouteRequest, HTLCAttempt>("unary", this._transport, method, opt, input); return stackIntercept<SendToRouteRequest, HTLCAttempt>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* ResetMissionControl clears all mission control state and starts with a clean * ResetMissionControl clears all mission control state and starts with a clean
* slate. * slate.
* *
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse); * @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
*/ */
resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse> { resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse> {
const method = this.methods[6], opt = this._transport.mergeOptions(options); const method = this.methods[6], opt = this._transport.mergeOptions(options);
return stackIntercept<ResetMissionControlRequest, ResetMissionControlResponse>("unary", this._transport, method, opt, input); return stackIntercept<ResetMissionControlRequest, ResetMissionControlResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* QueryMissionControl exposes the internal mission control state to callers. * QueryMissionControl exposes the internal mission control state to callers.
* It is a development feature. * It is a development feature.
* *
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse); * @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
*/ */
queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse> { queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse> {
const method = this.methods[7], opt = this._transport.mergeOptions(options); const method = this.methods[7], opt = this._transport.mergeOptions(options);
return stackIntercept<QueryMissionControlRequest, QueryMissionControlResponse>("unary", this._transport, method, opt, input); return stackIntercept<QueryMissionControlRequest, QueryMissionControlResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* XImportMissionControl is an experimental API that imports the state provided * XImportMissionControl is an experimental API that imports the state provided
* to the internal mission control's state, using all results which are more * to the internal mission control's state, using all results which are more
* recent than our existing values. These values will only be imported * recent than our existing values. These values will only be imported
* in-memory, and will not be persisted across restarts. * in-memory, and will not be persisted across restarts.
* *
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse); * @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
*/ */
xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse> { xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse> {
const method = this.methods[8], opt = this._transport.mergeOptions(options); const method = this.methods[8], opt = this._transport.mergeOptions(options);
return stackIntercept<XImportMissionControlRequest, XImportMissionControlResponse>("unary", this._transport, method, opt, input); return stackIntercept<XImportMissionControlRequest, XImportMissionControlResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* GetMissionControlConfig returns mission control's current config. * GetMissionControlConfig returns mission control's current config.
* *
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse); * @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
*/ */
getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse> { getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse> {
const method = this.methods[9], opt = this._transport.mergeOptions(options); const method = this.methods[9], opt = this._transport.mergeOptions(options);
return stackIntercept<GetMissionControlConfigRequest, GetMissionControlConfigResponse>("unary", this._transport, method, opt, input); return stackIntercept<GetMissionControlConfigRequest, GetMissionControlConfigResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* SetMissionControlConfig will set mission control's config, if the config * SetMissionControlConfig will set mission control's config, if the config
* provided is valid. * provided is valid.
* *
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse); * @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
*/ */
setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse> { setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse> {
const method = this.methods[10], opt = this._transport.mergeOptions(options); const method = this.methods[10], opt = this._transport.mergeOptions(options);
return stackIntercept<SetMissionControlConfigRequest, SetMissionControlConfigResponse>("unary", this._transport, method, opt, input); return stackIntercept<SetMissionControlConfigRequest, SetMissionControlConfigResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* QueryProbability returns the current success probability estimate for a * QueryProbability returns the current success probability estimate for a
* given node pair and amount. * given node pair and amount.
* *
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse); * @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
*/ */
queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse> { queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse> {
const method = this.methods[11], opt = this._transport.mergeOptions(options); const method = this.methods[11], opt = this._transport.mergeOptions(options);
return stackIntercept<QueryProbabilityRequest, QueryProbabilityResponse>("unary", this._transport, method, opt, input); return stackIntercept<QueryProbabilityRequest, QueryProbabilityResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* BuildRoute builds a fully specified route based on a list of hop public * BuildRoute builds a fully specified route based on a list of hop public
* keys. It retrieves the relevant channel policies from the graph in order to * keys. It retrieves the relevant channel policies from the graph in order to
* calculate the correct fees and time locks. * calculate the correct fees and time locks.
* *
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse); * @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
*/ */
buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse> { buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse> {
const method = this.methods[12], opt = this._transport.mergeOptions(options); const method = this.methods[12], opt = this._transport.mergeOptions(options);
return stackIntercept<BuildRouteRequest, BuildRouteResponse>("unary", this._transport, method, opt, input); return stackIntercept<BuildRouteRequest, BuildRouteResponse>("unary", this._transport, method, opt, input);
} }
/** /**
* *
* SubscribeHtlcEvents creates a uni-directional stream from the server to * SubscribeHtlcEvents creates a uni-directional stream from the server to
* the client which delivers a stream of htlc events. * the client which delivers a stream of htlc events.
* *
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent); * @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
*/ */
subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent> { subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent> {
const method = this.methods[13], opt = this._transport.mergeOptions(options); const method = this.methods[13], opt = this._transport.mergeOptions(options);
return stackIntercept<SubscribeHtlcEventsRequest, HtlcEvent>("serverStreaming", this._transport, method, opt, input); return stackIntercept<SubscribeHtlcEventsRequest, HtlcEvent>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment * Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
* described by the passed PaymentRequest to the final destination. The call * described by the passed PaymentRequest to the final destination. The call
* returns a stream of payment status updates. * returns a stream of payment status updates.
* *
* @deprecated * @deprecated
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus); * @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/ */
sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus> { sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus> {
const method = this.methods[14], opt = this._transport.mergeOptions(options); const method = this.methods[14], opt = this._transport.mergeOptions(options);
return stackIntercept<SendPaymentRequest, PaymentStatus>("serverStreaming", this._transport, method, opt, input); return stackIntercept<SendPaymentRequest, PaymentStatus>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* *
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for * Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
* the payment identified by the payment hash. * the payment identified by the payment hash.
* *
* @deprecated * @deprecated
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus); * @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/ */
trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus> { trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus> {
const method = this.methods[15], opt = this._transport.mergeOptions(options); const method = this.methods[15], opt = this._transport.mergeOptions(options);
return stackIntercept<TrackPaymentRequest, PaymentStatus>("serverStreaming", this._transport, method, opt, input); return stackIntercept<TrackPaymentRequest, PaymentStatus>("serverStreaming", this._transport, method, opt, input);
} }
/** /**
* * * *
* HtlcInterceptor dispatches a bi-directional streaming RPC in which * HtlcInterceptor dispatches a bi-directional streaming RPC in which
* Forwarded HTLC requests are sent to the client and the client responds with * Forwarded HTLC requests are sent to the client and the client responds with
* a boolean that tells LND if this htlc should be intercepted. * a boolean that tells LND if this htlc should be intercepted.
* In case of interception, the htlc can be either settled, cancelled or * In case of interception, the htlc can be either settled, cancelled or
* resumed later by using the ResolveHoldForward endpoint. * resumed later by using the ResolveHoldForward endpoint.
* *
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest); * @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
*/ */
htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest> { htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest> {
const method = this.methods[16], opt = this._transport.mergeOptions(options); const method = this.methods[16], opt = this._transport.mergeOptions(options);
return stackIntercept<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>("duplex", this._transport, method, opt); return stackIntercept<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>("duplex", this._transport, method, opt);
} }
/** /**
* *
* UpdateChanStatus attempts to manually set the state of a channel * UpdateChanStatus attempts to manually set the state of a channel
* (enabled, disabled, or auto). A manual "disable" request will cause the * (enabled, disabled, or auto). A manual "disable" request will cause the
* channel to stay disabled until a subsequent manual request of either * channel to stay disabled until a subsequent manual request of either
* "enable" or "auto". * "enable" or "auto".
* *
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse); * @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
*/ */
updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse> { updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse> {
const method = this.methods[17], opt = this._transport.mergeOptions(options); const method = this.methods[17], opt = this._transport.mergeOptions(options);
return stackIntercept<UpdateChanStatusRequest, UpdateChanStatusResponse>("unary", this._transport, method, opt, input); return stackIntercept<UpdateChanStatusRequest, UpdateChanStatusResponse>("unary", this._transport, method, opt, input);
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -3,16 +3,16 @@
// tslint:disable // tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { WalletUnlocker } from "./walletunlocker.js"; import { WalletUnlocker } from "./walletunlocker";
import type { ChangePasswordResponse } from "./walletunlocker.js"; import type { ChangePasswordResponse } from "./walletunlocker";
import type { ChangePasswordRequest } from "./walletunlocker.js"; import type { ChangePasswordRequest } from "./walletunlocker";
import type { UnlockWalletResponse } from "./walletunlocker.js"; import type { UnlockWalletResponse } from "./walletunlocker";
import type { UnlockWalletRequest } from "./walletunlocker.js"; import type { UnlockWalletRequest } from "./walletunlocker";
import type { InitWalletResponse } from "./walletunlocker.js"; import type { InitWalletResponse } from "./walletunlocker";
import type { InitWalletRequest } from "./walletunlocker.js"; import type { InitWalletRequest } from "./walletunlocker";
import { stackIntercept } from "@protobuf-ts/runtime-rpc"; import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { GenSeedResponse } from "./walletunlocker.js"; import type { GenSeedResponse } from "./walletunlocker";
import type { GenSeedRequest } from "./walletunlocker.js"; import type { GenSeedRequest } from "./walletunlocker";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
// //

View file

@ -12,7 +12,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime";
import { ChanBackupSnapshot } from "./lightning.js"; import { ChanBackupSnapshot } from "./lightning";
/** /**
* @generated from protobuf message lnrpc.GenSeedRequest * @generated from protobuf message lnrpc.GenSeedRequest
*/ */

View file

@ -101,8 +101,10 @@ service Lightning {
rpc SignMessage (SignMessageRequest) returns (SignMessageResponse); rpc SignMessage (SignMessageRequest) returns (SignMessageResponse);
/* lncli: `verifymessage` /* lncli: `verifymessage`
VerifyMessage verifies a signature over a msg. The signature must be VerifyMessage verifies a signature over a message and recovers the signer's
zbase32 encoded and signed by an active node in the resident node's public key. The signature is only deemed valid if the recovered public key
corresponds to a node key in the public Lightning network. The signature
must be zbase32 encoded and signed by an active node in the resident node's
channel database. In addition to returning the validity of the signature, channel database. In addition to returning the validity of the signature,
VerifyMessage also returns the recovered pubkey from the signature. VerifyMessage also returns the recovered pubkey from the signature.
*/ */
@ -141,6 +143,13 @@ service Lightning {
*/ */
rpc GetInfo (GetInfoRequest) returns (GetInfoResponse); rpc GetInfo (GetInfoRequest) returns (GetInfoResponse);
/* lncli: 'getdebuginfo'
GetDebugInfo returns debug information concerning the state of the daemon
and its subsystems. This includes the full configuration and the latest log
entries from the log file.
*/
rpc GetDebugInfo (GetDebugInfoRequest) returns (GetDebugInfoResponse);
/** lncli: `getrecoveryinfo` /** lncli: `getrecoveryinfo`
GetRecoveryInfo returns information concerning the recovery mode including GetRecoveryInfo returns information concerning the recovery mode including
whether it's in a recovery mode, whether the recovery is finished, and the whether it's in a recovery mode, whether the recovery is finished, and the
@ -320,7 +329,7 @@ service Lightning {
optionally specify the add_index and/or the settle_index. If the add_index optionally specify the add_index and/or the settle_index. If the add_index
is specified, then we'll first start by sending add invoice events for all is specified, then we'll first start by sending add invoice events for all
invoices with an add_index greater than the specified value. If the invoices with an add_index greater than the specified value. If the
settle_index is specified, the next, we'll send out all settle events for settle_index is specified, then next, we'll send out all settle events for
invoices with a settle_index greater than the specified value. One or both invoices with a settle_index greater than the specified value. One or both
of these fields can be set. If no fields are set, then we'll only send out of these fields can be set. If no fields are set, then we'll only send out
the latest add/settle events. the latest add/settle events.
@ -339,13 +348,13 @@ service Lightning {
*/ */
rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse); rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse);
/* /* lncli: `deletepayments`
DeletePayment deletes an outgoing payment from DB. Note that it will not DeletePayment deletes an outgoing payment from DB. Note that it will not
attempt to delete an In-Flight payment, since that would be unsafe. attempt to delete an In-Flight payment, since that would be unsafe.
*/ */
rpc DeletePayment (DeletePaymentRequest) returns (DeletePaymentResponse); rpc DeletePayment (DeletePaymentRequest) returns (DeletePaymentResponse);
/* /* lncli: `deletepayments --all`
DeleteAllPayments deletes all outgoing payments from DB. Note that it will DeleteAllPayments deletes all outgoing payments from DB. Note that it will
not attempt to delete In-Flight payments, since that would be unsafe. not attempt to delete In-Flight payments, since that would be unsafe.
*/ */
@ -477,7 +486,7 @@ service Lightning {
rpc ExportAllChannelBackups (ChanBackupExportRequest) rpc ExportAllChannelBackups (ChanBackupExportRequest)
returns (ChanBackupSnapshot); returns (ChanBackupSnapshot);
/* /* lncli: `verifychanbackup`
VerifyChanBackup allows a caller to verify the integrity of a channel backup VerifyChanBackup allows a caller to verify the integrity of a channel backup
snapshot. This method will accept either a packed Single or a packed Multi. snapshot. This method will accept either a packed Single or a packed Multi.
Specifying both will result in an error. Specifying both will result in an error.
@ -567,6 +576,10 @@ service Lightning {
/* lncli: `subscribecustom` /* lncli: `subscribecustom`
SubscribeCustomMessages subscribes to a stream of incoming custom peer SubscribeCustomMessages subscribes to a stream of incoming custom peer
messages. messages.
To include messages with type outside of the custom range (>= 32768) lnd
needs to be compiled with the `dev` build tag, and the message type to
override should be specified in lnd's experimental protocol configuration.
*/ */
rpc SubscribeCustomMessages (SubscribeCustomMessagesRequest) rpc SubscribeCustomMessages (SubscribeCustomMessagesRequest)
returns (stream CustomMessage); returns (stream CustomMessage);
@ -578,18 +591,26 @@ service Lightning {
*/ */
rpc ListAliases (ListAliasesRequest) returns (ListAliasesResponse); rpc ListAliases (ListAliasesRequest) returns (ListAliasesResponse);
rpc LookupHtlc (LookupHtlcRequest) returns (LookupHtlcResponse); /*
LookupHtlcResolution retrieves a final htlc resolution from the database.
If the htlc has no final resolution yet, a NotFound grpc status code is
returned.
*/
rpc LookupHtlcResolution (LookupHtlcResolutionRequest)
returns (LookupHtlcResolutionResponse);
} }
message LookupHtlcRequest { message LookupHtlcResolutionRequest {
uint64 chan_id = 1; uint64 chan_id = 1;
uint64 htlc_index = 2; uint64 htlc_index = 2;
} }
message LookupHtlcResponse { message LookupHtlcResolutionResponse {
// Settled is true is the htlc was settled. If false, the htlc was failed.
bool settled = 1; bool settled = 1;
// Offchain indicates whether the htlc was resolved off-chain or on-chain.
bool offchain = 2; bool offchain = 2;
} }
@ -612,6 +633,9 @@ message SendCustomMessageRequest {
bytes peer = 1; bytes peer = 1;
// Message type. This value needs to be in the custom range (>= 32768). // Message type. This value needs to be in the custom range (>= 32768).
// To send a type < custom range, lnd needs to be compiled with the `dev`
// build tag, and the message type to override should be specified in lnd's
// experimental protocol configuration.
uint32 type = 2; uint32 type = 2;
// Raw message data. // Raw message data.
@ -860,7 +884,8 @@ message SendRequest {
repeated FeatureBit dest_features = 15; repeated FeatureBit dest_features = 15;
/* /*
The payment address of the generated invoice. The payment address of the generated invoice. This is also called
payment secret in specifications (e.g. BOLT 11).
*/ */
bytes payment_addr = 16; bytes payment_addr = 16;
} }
@ -1066,6 +1091,18 @@ message LightningAddress {
string host = 2; string host = 2;
} }
enum CoinSelectionStrategy {
// Use the coin selection strategy defined in the global configuration
// (lnd.conf).
STRATEGY_USE_GLOBAL_CONFIG = 0;
// Select the largest available coins first during coin selection.
STRATEGY_LARGEST = 1;
// Randomly select the available coins during coin selection.
STRATEGY_RANDOM = 2;
}
message EstimateFeeRequest { message EstimateFeeRequest {
// The map from addresses to amounts for the transaction. // The map from addresses to amounts for the transaction.
map<string, int64> AddrToAmount = 1; map<string, int64> AddrToAmount = 1;
@ -1080,6 +1117,9 @@ message EstimateFeeRequest {
// Whether unconfirmed outputs should be used as inputs for the transaction. // Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 4; bool spend_unconfirmed = 4;
// The strategy to use for selecting coins during fees estimation.
CoinSelectionStrategy coin_selection_strategy = 5;
} }
message EstimateFeeResponse { message EstimateFeeResponse {
@ -1120,6 +1160,9 @@ message SendManyRequest {
// Whether unconfirmed outputs should be used as inputs for the transaction. // Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 8; bool spend_unconfirmed = 8;
// The strategy to use for selecting coins during sending many requests.
CoinSelectionStrategy coin_selection_strategy = 9;
} }
message SendManyResponse { message SendManyResponse {
// The id of the transaction // The id of the transaction
@ -1147,9 +1190,8 @@ message SendCoinsRequest {
int64 sat_per_byte = 5 [deprecated = true]; int64 sat_per_byte = 5 [deprecated = true];
/* /*
If set, then the amount field will be ignored, and lnd will attempt to If set, the amount field should be unset. It indicates lnd will send all
send all the coins under control of the internal wallet to the specified wallet coins or all selected coins to the specified address.
address.
*/ */
bool send_all = 6; bool send_all = 6;
@ -1162,6 +1204,12 @@ message SendCoinsRequest {
// Whether unconfirmed outputs should be used as inputs for the transaction. // Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 9; bool spend_unconfirmed = 9;
// The strategy to use for selecting coins.
CoinSelectionStrategy coin_selection_strategy = 10;
// A list of selected outpoints as inputs for the transaction.
repeated OutPoint outpoints = 11;
} }
message SendCoinsResponse { message SendCoinsResponse {
// The transaction ID of the transaction // The transaction ID of the transaction
@ -1335,6 +1383,13 @@ enum CommitmentType {
channel before its maturity date. channel before its maturity date.
*/ */
SCRIPT_ENFORCED_LEASE = 4; SCRIPT_ENFORCED_LEASE = 4;
/*
A channel that uses musig2 for the funding output, and the new tapscript
features where relevant.
*/
// TODO(roasbeef): need script enforce mirror type for the above as well?
SIMPLE_TAPROOT = 5;
} }
message ChannelConstraints { message ChannelConstraints {
@ -1524,6 +1579,19 @@ message Channel {
// This is the confirmed / on-chain zero-conf SCID. // This is the confirmed / on-chain zero-conf SCID.
uint64 zero_conf_confirmed_scid = 33; uint64 zero_conf_confirmed_scid = 33;
// The configured alias name of our peer.
string peer_alias = 34;
// This is the peer SCID alias.
uint64 peer_scid_alias = 35 [jstype = JS_STRING];
/*
An optional note-to-self to go along with the channel containing some
useful information. This is only ever stored locally and in no way impacts
the channel's operation.
*/
string memo = 36;
} }
message ListChannelsRequest { message ListChannelsRequest {
@ -1537,6 +1605,11 @@ message ListChannelsRequest {
empty, all channels will be returned. empty, all channels will be returned.
*/ */
bytes peer = 5; bytes peer = 5;
// Informs the server if the peer alias lookup per channel should be
// enabled. It is turned off by default in order to avoid degradation of
// performance for existing clients.
bool peer_alias_lookup = 6;
} }
message ListChannelsResponse { message ListChannelsResponse {
// The list of active channels // The list of active channels
@ -1884,12 +1957,16 @@ message GetInfoResponse {
/* /*
Whether the current node is connected to testnet. This field is Whether the current node is connected to testnet. This field is
deprecated and the network field should be used instead deprecated and the network field should be used instead
**/ */
bool testnet = 10 [deprecated = true]; bool testnet = 10 [deprecated = true];
reserved 11; reserved 11;
// A list of active chains the node is connected to /*
A list of active chains the node is connected to. This will only
ever contain a single entry since LND will only ever have a single
chain backend during its lifetime.
*/
repeated Chain chains = 16; repeated Chain chains = 16;
// The URIs of the current node. // The URIs of the current node.
@ -1905,6 +1982,17 @@ message GetInfoResponse {
Indicates whether the HTLC interceptor API is in always-on mode. Indicates whether the HTLC interceptor API is in always-on mode.
*/ */
bool require_htlc_interceptor = 21; bool require_htlc_interceptor = 21;
// Indicates whether final htlc resolutions are stored on disk.
bool store_final_htlc_resolutions = 22;
}
message GetDebugInfoRequest {
}
message GetDebugInfoResponse {
map<string, string> config = 1;
repeated string log = 2;
} }
message GetRecoveryInfoRequest { message GetRecoveryInfoRequest {
@ -1921,8 +2009,9 @@ message GetRecoveryInfoResponse {
} }
message Chain { message Chain {
// The blockchain the node is on (eg bitcoin, litecoin) // Deprecated. The chain is now always assumed to be bitcoin.
string chain = 1; // The blockchain the node is on (must be bitcoin)
string chain = 1 [deprecated = true];
// The network the node is on (eg regtest, testnet, mainnet) // The network the node is on (eg regtest, testnet, mainnet)
string network = 2; string network = 2;
@ -1982,12 +2071,18 @@ message CloseChannelRequest {
// //
// NOTE: This field is only respected if we're the initiator of the channel. // NOTE: This field is only respected if we're the initiator of the channel.
uint64 max_fee_per_vbyte = 7; uint64 max_fee_per_vbyte = 7;
// If true, then the rpc call will not block while it awaits a closing txid.
// Consequently this RPC call will not return a closing txid if this value
// is set.
bool no_wait = 8;
} }
message CloseStatusUpdate { message CloseStatusUpdate {
oneof update { oneof update {
PendingUpdate close_pending = 1; PendingUpdate close_pending = 1;
ChannelCloseUpdate chan_close = 3; ChannelCloseUpdate chan_close = 3;
InstantUpdate close_instant = 4;
} }
} }
@ -1996,6 +2091,9 @@ message PendingUpdate {
uint32 output_index = 2; uint32 output_index = 2;
} }
message InstantUpdate {
}
message ReadyForPsbtFunding { message ReadyForPsbtFunding {
/* /*
The P2WSH address of the channel funding multisig address that the below The P2WSH address of the channel funding multisig address that the below
@ -2040,6 +2138,9 @@ message BatchOpenChannelRequest {
// An optional label for the batch transaction, limited to 500 characters. // An optional label for the batch transaction, limited to 500 characters.
string label = 6; string label = 6;
// The strategy to use for selecting coins during batch opening channels.
CoinSelectionStrategy coin_selection_strategy = 7;
} }
message BatchOpenChannel { message BatchOpenChannel {
@ -2090,6 +2191,76 @@ message BatchOpenChannel {
the remote peer supports explicit channel negotiation. the remote peer supports explicit channel negotiation.
*/ */
CommitmentType commitment_type = 9; CommitmentType commitment_type = 9;
/*
The maximum amount of coins in millisatoshi that can be pending within
the channel. It only applies to the remote party.
*/
uint64 remote_max_value_in_flight_msat = 10;
/*
The maximum number of concurrent HTLCs we will allow the remote party to add
to the commitment transaction.
*/
uint32 remote_max_htlcs = 11;
/*
Max local csv is the maximum csv delay we will allow for our own commitment
transaction.
*/
uint32 max_local_csv = 12;
/*
If this is true, then a zero-conf channel open will be attempted.
*/
bool zero_conf = 13;
/*
If this is true, then an option-scid-alias channel-type open will be
attempted.
*/
bool scid_alias = 14;
/*
The base fee charged regardless of the number of milli-satoshis sent.
*/
uint64 base_fee = 15;
/*
The fee rate in ppm (parts per million) that will be charged in
proportion of the value of each forwarded HTLC.
*/
uint64 fee_rate = 16;
/*
If use_base_fee is true the open channel announcement will update the
channel base fee with the value specified in base_fee. In the case of
a base_fee of 0 use_base_fee is needed downstream to distinguish whether
to use the default base fee value specified in the config or 0.
*/
bool use_base_fee = 17;
/*
If use_fee_rate is true the open channel announcement will update the
channel fee rate with the value specified in fee_rate. In the case of
a fee_rate of 0 use_fee_rate is needed downstream to distinguish whether
to use the default fee rate value specified in the config or 0.
*/
bool use_fee_rate = 18;
/*
The number of satoshis we require the remote peer to reserve. This value,
if specified, must be above the dust limit and below 20% of the channel
capacity.
*/
uint64 remote_chan_reserve_sat = 19;
/*
An optional note-to-self to go along with the channel containing some
useful information. This is only ever stored locally and in no way impacts
the channel's operation.
*/
string memo = 20;
} }
message BatchOpenChannelResponse { message BatchOpenChannelResponse {
@ -2238,6 +2409,25 @@ message OpenChannelRequest {
capacity. capacity.
*/ */
uint64 remote_chan_reserve_sat = 25; uint64 remote_chan_reserve_sat = 25;
/*
If set, then lnd will attempt to commit all the coins under control of the
internal wallet to open the channel, and the LocalFundingAmount field must
be zero and is ignored.
*/
bool fund_max = 26;
/*
An optional note-to-self to go along with the channel containing some
useful information. This is only ever stored locally and in no way impacts
the channel's operation.
*/
string memo = 27;
/*
A list of selected outpoints that are allocated for channel funding.
*/
repeated OutPoint outpoints = 28;
} }
message OpenStatusUpdate { message OpenStatusUpdate {
oneof update { oneof update {
@ -2319,6 +2509,11 @@ message ChanPointShim {
the value is less than 500,000, or as an absolute height otherwise. the value is less than 500,000, or as an absolute height otherwise.
*/ */
uint32 thaw_height = 6; uint32 thaw_height = 6;
/*
Indicates that the funding output is using a MuSig2 multi-sig output.
*/
bool musig2 = 7;
} }
message PsbtShim { message PsbtShim {
@ -2469,6 +2664,9 @@ message PendingHTLC {
} }
message PendingChannelsRequest { message PendingChannelsRequest {
// Indicates whether to include the raw transaction hex for
// waiting_close_channels.
bool include_raw_tx = 1;
} }
message PendingChannelsResponse { message PendingChannelsResponse {
message PendingChannel { message PendingChannel {
@ -2504,6 +2702,13 @@ message PendingChannelsResponse {
// Whether this channel is advertised to the network or not. // Whether this channel is advertised to the network or not.
bool private = 12; bool private = 12;
/*
An optional note-to-self to go along with the channel containing some
useful information. This is only ever stored locally and in no way
impacts the channel's operation.
*/
string memo = 13;
} }
message PendingOpenChannel { message PendingOpenChannel {
@ -2531,6 +2736,17 @@ message PendingChannelsResponse {
// Previously used for confirmation_height. Do not reuse. // Previously used for confirmation_height. Do not reuse.
reserved 2; reserved 2;
// The number of blocks until the funding transaction is considered
// expired. If this value gets close to zero, there is a risk that the
// channel funding will be canceled by the channel responder. The
// channel should be fee bumped using CPFP (see walletrpc.BumpFee) to
// ensure that the channel confirms in time. Otherwise a force-close
// will be necessary if the channel confirms after the funding
// transaction expires. A negative value means the channel responder has
// very likely canceled the funding and the channel will never become
// fully operational.
int32 funding_expiry_blocks = 3;
} }
message WaitingCloseChannel { message WaitingCloseChannel {
@ -2548,6 +2764,10 @@ message PendingChannelsResponse {
// The transaction id of the closing transaction // The transaction id of the closing transaction
string closing_txid = 4; string closing_txid = 4;
// The raw hex encoded bytes of the closing transaction. Included if
// include_raw_tx in the request is true.
string closing_tx_hex = 5;
} }
message Commitments { message Commitments {
@ -2683,6 +2903,14 @@ message WalletAccountBalance {
} }
message WalletBalanceRequest { message WalletBalanceRequest {
// The wallet account the balance is shown for.
// If this is not specified, the balance of the "default" account is shown.
string account = 1;
// The minimum number of confirmations each one of your outputs used for the
// funding transaction must satisfy. If this is not specified, the default
// value of 1 is used.
int32 min_confs = 2;
} }
message WalletBalanceResponse { message WalletBalanceResponse {
@ -2768,6 +2996,9 @@ message QueryRoutesRequest {
not add any additional block padding on top of final_ctlv_delta. This not add any additional block padding on top of final_ctlv_delta. This
padding of a few blocks needs to be added manually or otherwise failures may padding of a few blocks needs to be added manually or otherwise failures may
happen when a block comes in while the payment is in flight. happen when a block comes in while the payment is in flight.
Note: must not be set if making a payment to a blinded path (delta is
set by the aggregate parameters provided by blinded_payment_paths)
*/ */
int32 final_cltv_delta = 4; int32 final_cltv_delta = 4;
@ -2841,12 +3072,21 @@ message QueryRoutesRequest {
*/ */
repeated lnrpc.RouteHint route_hints = 16; repeated lnrpc.RouteHint route_hints = 16;
/*
An optional blinded path(s) to reach the destination. Note that the
introduction node must be provided as the first hop in the route.
*/
repeated BlindedPaymentPath blinded_payment_paths = 19;
/* /*
Features assumed to be supported by the final node. All transitive feature Features assumed to be supported by the final node. All transitive feature
dependencies must also be set properly. For a given feature bit pair, either dependencies must also be set properly. For a given feature bit pair, either
optional or remote may be set, but not both. If this field is nil or empty, optional or remote may be set, but not both. If this field is nil or empty,
the router will try to load destination features from the graph as a the router will try to load destination features from the graph as a
fallback. fallback.
Note: must not be set if making a payment to a blinded route (features
are provided in blinded_payment_paths).
*/ */
repeated lnrpc.FeatureBit dest_features = 17; repeated lnrpc.FeatureBit dest_features = 17;
@ -2952,6 +3192,32 @@ message Hop {
// The payment metadata to send along with the payment to the payee. // The payment metadata to send along with the payment to the payee.
bytes metadata = 13; bytes metadata = 13;
/*
Blinding point is an optional blinding point included for introduction
nodes in blinded paths. This field is mandatory for hops that represents
the introduction point in a blinded path.
*/
bytes blinding_point = 14;
/*
Encrypted data is a receiver-produced blob of data that provides hops
in a blinded route with forwarding data. As this data is encrypted by
the recipient, we will not be able to parse it - it is essentially an
arbitrary blob of data from our node's perspective. This field is
mandatory for all hops in a blinded path, including the introduction
node.
*/
bytes encrypted_data = 15;
/*
The total amount that is sent to the recipient (possibly across multiple
HTLCs), as specified by the sender when making a payment to a blinded path.
This value is only set in the final hop payload of a blinded payment. This
value is analogous to the MPPRecord that is used for regular (non-blinded)
MPP payments.
*/
uint64 total_amt_msat = 16;
} }
message MPPRecord { message MPPRecord {
@ -2959,7 +3225,8 @@ message MPPRecord {
A unique, random identifier used to authenticate the sender as the intended A unique, random identifier used to authenticate the sender as the intended
payer of a multi-path payment. The payment_addr must be the same for all payer of a multi-path payment. The payment_addr must be the same for all
subpayments, and match the payment_addr provided in the receiver's invoice. subpayments, and match the payment_addr provided in the receiver's invoice.
The same payment_addr must be used on all subpayments. The same payment_addr must be used on all subpayments. This is also called
payment secret in specifications (e.g. BOLT 11).
*/ */
bytes payment_addr = 11; bytes payment_addr = 11;
@ -3089,6 +3356,9 @@ message RoutingPolicy {
// Custom channel update tlv records. // Custom channel update tlv records.
map<uint64, bytes> custom_records = 8; map<uint64, bytes> custom_records = 8;
int32 inbound_fee_base_msat = 9;
int32 inbound_fee_rate_milli_msat = 10;
} }
/* /*
@ -3175,6 +3445,10 @@ message ChanInfoRequest {
output index for the channel. output index for the channel.
*/ */
uint64 chan_id = 1 [jstype = JS_STRING]; uint64 chan_id = 1 [jstype = JS_STRING];
// The channel point of the channel in format funding_txid:output_index. If
// chan_id is specified, this field is ignored.
string chan_point = 2;
} }
message NetworkInfoRequest { message NetworkInfoRequest {
@ -3297,6 +3571,64 @@ message RouteHint {
repeated HopHint hop_hints = 1; repeated HopHint hop_hints = 1;
} }
message BlindedPaymentPath {
// The blinded path to send the payment to.
BlindedPath blinded_path = 1;
// The base fee for the blinded path provided, expressed in msat.
uint64 base_fee_msat = 2;
/*
The proportional fee for the blinded path provided, expressed in parts
per million.
*/
uint32 proportional_fee_rate = 3;
/*
The total CLTV delta for the blinded path provided, including the
final CLTV delta for the receiving node.
*/
uint32 total_cltv_delta = 4;
/*
The minimum hltc size that may be sent over the blinded path, expressed
in msat.
*/
uint64 htlc_min_msat = 5;
/*
The maximum htlc size that may be sent over the blinded path, expressed
in msat.
*/
uint64 htlc_max_msat = 6;
// The feature bits for the route.
repeated FeatureBit features = 7;
}
message BlindedPath {
// The unblinded pubkey of the introduction node for the route.
bytes introduction_node = 1;
// The ephemeral pubkey used by nodes in the blinded route.
bytes blinding_point = 2;
/*
A set of blinded node keys and data blobs for the blinded portion of the
route. Note that the first hop is expected to be the introduction node,
so the route is always expected to have at least one hop.
*/
repeated BlindedHop blinded_hops = 3;
}
message BlindedHop {
// The blinded public key of the node.
bytes blinded_node = 1;
// An encrypted blob of data provided to the blinded node.
bytes encrypted_data = 2;
}
message AMPInvoiceState { message AMPInvoiceState {
// The state the HTLCs associated with this setID are in. // The state the HTLCs associated with this setID are in.
InvoiceHTLCState state = 1; InvoiceHTLCState state = 1;
@ -3351,7 +3683,7 @@ message Invoice {
int64 value_msat = 23; int64 value_msat = 23;
/* /*
Whether this invoice has been fulfilled Whether this invoice has been fulfilled.
The field is deprecated. Use the state field instead (compare to SETTLED). The field is deprecated. Use the state field instead (compare to SETTLED).
*/ */
@ -3359,12 +3691,14 @@ message Invoice {
/* /*
When this invoice was created. When this invoice was created.
Measured in seconds since the unix epoch.
Note: Output only, don't specify for creating an invoice. Note: Output only, don't specify for creating an invoice.
*/ */
int64 creation_date = 7; int64 creation_date = 7;
/* /*
When this invoice was settled. When this invoice was settled.
Measured in seconds since the unix epoch.
Note: Output only, don't specify for creating an invoice. Note: Output only, don't specify for creating an invoice.
*/ */
int64 settle_date = 8; int64 settle_date = 8;
@ -3385,7 +3719,7 @@ message Invoice {
*/ */
bytes description_hash = 10; bytes description_hash = 10;
// Payment request expiry time in seconds. Default is 3600 (1 hour). // Payment request expiry time in seconds. Default is 86400 (24 hours).
int64 expiry = 11; int64 expiry = 11;
// Fallback on-chain address. // Fallback on-chain address.
@ -3401,6 +3735,8 @@ message Invoice {
repeated RouteHint route_hints = 14; repeated RouteHint route_hints = 14;
// Whether this invoice should include routing hints for private channels. // Whether this invoice should include routing hints for private channels.
// Note: When enabled, if value and value_msat are zero, a large number of
// hints with these channels can be included, which might not be desirable.
bool private = 15; bool private = 15;
/* /*
@ -3426,22 +3762,22 @@ message Invoice {
/* /*
The amount that was accepted for this invoice, in satoshis. This will ONLY The amount that was accepted for this invoice, in satoshis. This will ONLY
be set if this invoice has been settled. We provide this field as if the be set if this invoice has been settled or accepted. We provide this field
invoice was created with a zero value, then we need to record what amount as if the invoice was created with a zero value, then we need to record what
was ultimately accepted. Additionally, it's possible that the sender paid amount was ultimately accepted. Additionally, it's possible that the sender
MORE that was specified in the original invoice. So we'll record that here paid MORE that was specified in the original invoice. So we'll record that
as well. here as well.
Note: Output only, don't specify for creating an invoice. Note: Output only, don't specify for creating an invoice.
*/ */
int64 amt_paid_sat = 19; int64 amt_paid_sat = 19;
/* /*
The amount that was accepted for this invoice, in millisatoshis. This will The amount that was accepted for this invoice, in millisatoshis. This will
ONLY be set if this invoice has been settled. We provide this field as if ONLY be set if this invoice has been settled or accepted. We provide this
the invoice was created with a zero value, then we need to record what field as if the invoice was created with a zero value, then we need to
amount was ultimately accepted. Additionally, it's possible that the sender record what amount was ultimately accepted. Additionally, it's possible that
paid MORE that was specified in the original invoice. So we'll record that the sender paid MORE that was specified in the original invoice. So we'll
here as well. record that here as well.
Note: Output only, don't specify for creating an invoice. Note: Output only, don't specify for creating an invoice.
*/ */
int64 amt_paid_msat = 20; int64 amt_paid_msat = 20;
@ -3479,9 +3815,10 @@ message Invoice {
bool is_keysend = 25; bool is_keysend = 25;
/* /*
The payment address of this invoice. This value will be used in MPP The payment address of this invoice. This is also called payment secret in
payments, and also for newer invoices that always require the MPP payload specifications (e.g. BOLT 11). This value will be used in MPP payments, and
for added end-to-end security. also for newer invoices that always require the MPP payload for added
end-to-end security.
Note: Output only, don't specify for creating an invoice. Note: Output only, don't specify for creating an invoice.
*/ */
bytes payment_addr = 26; bytes payment_addr = 26;
@ -3501,6 +3838,48 @@ message Invoice {
Note: Output only, don't specify for creating an invoice. Note: Output only, don't specify for creating an invoice.
*/ */
map<string, AMPInvoiceState> amp_invoice_state = 28; map<string, AMPInvoiceState> amp_invoice_state = 28;
/*
Signals that the invoice should include blinded paths to hide the true
identity of the recipient.
*/
bool is_blinded = 29;
/*
Config values to use when creating blinded paths for this invoice. These
can be used to override the defaults config values provided in by the
global config. This field is only used if is_blinded is true.
*/
BlindedPathConfig blinded_path_config = 30;
}
message BlindedPathConfig {
/*
The minimum number of real hops to include in a blinded path. This doesn't
include our node, so if the minimum is 1, then the path will contain at
minimum our node along with an introduction node hop. If it is zero then
the shortest path will use our node as an introduction node.
*/
optional uint32 min_num_real_hops = 1;
/*
The number of hops to include in a blinded path. This doesn't include our
node, so if it is 1, then the path will contain our node along with an
introduction node or dummy node hop. If paths shorter than NumHops is
found, then they will be padded using dummy hops.
*/
optional uint32 num_hops = 2;
/*
The maximum number of blinded paths to select and add to an invoice.
*/
optional uint32 max_num_paths = 3;
/*
A list of node IDs of nodes that should not be used in any of our generated
blinded paths.
*/
repeated bytes node_omission_list = 4;
} }
enum InvoiceHTLCState { enum InvoiceHTLCState {
@ -3586,9 +3965,9 @@ message AddInvoiceResponse {
uint64 add_index = 16; uint64 add_index = 16;
/* /*
The payment address of the generated invoice. This value should be used The payment address of the generated invoice. This is also called
in all payments for this invoice as we require it for end to end payment secret in specifications (e.g. BOLT 11). This value should be used
security. in all payments for this invoice as we require it for end to end security.
*/ */
bytes payment_addr = 17; bytes payment_addr = 17;
} }
@ -3629,7 +4008,16 @@ message ListInvoiceRequest {
specified index offset. This can be used to paginate backwards. specified index offset. This can be used to paginate backwards.
*/ */
bool reversed = 6; bool reversed = 6;
// If set, returns all invoices with a creation date greater than or equal
// to it. Measured in seconds since the unix epoch.
uint64 creation_date_start = 7;
// If set, returns all invoices with a creation date less than or equal to
// it. Measured in seconds since the unix epoch.
uint64 creation_date_end = 8;
} }
message ListInvoiceResponse { message ListInvoiceResponse {
/* /*
A list of invoices from the time slice of the time series specified in the A list of invoices from the time slice of the time series specified in the
@ -3700,6 +4088,11 @@ enum PaymentFailureReason {
Insufficient local balance. Insufficient local balance.
*/ */
FAILURE_REASON_INSUFFICIENT_BALANCE = 5; FAILURE_REASON_INSUFFICIENT_BALANCE = 5;
/*
The payment was canceled.
*/
FAILURE_REASON_CANCELED = 6;
} }
message Payment { message Payment {
@ -3730,10 +4123,20 @@ message Payment {
string payment_request = 9; string payment_request = 9;
enum PaymentStatus { enum PaymentStatus {
UNKNOWN = 0; // Deprecated. This status will never be returned.
UNKNOWN = 0 [deprecated = true];
// Payment has inflight HTLCs.
IN_FLIGHT = 1; IN_FLIGHT = 1;
// Payment is settled.
SUCCEEDED = 2; SUCCEEDED = 2;
// Payment is failed.
FAILED = 3; FAILED = 3;
// Payment is created and has not attempted any HTLCs.
INITIATED = 4;
} }
// The status of the payment. // The status of the payment.
@ -3828,6 +4231,14 @@ message ListPaymentsRequest {
of payments, as all of them have to be iterated through to be counted. of payments, as all of them have to be iterated through to be counted.
*/ */
bool count_total_payments = 5; bool count_total_payments = 5;
// If set, returns all payments with a creation date greater than or equal
// to it. Measured in seconds since the unix epoch.
uint64 creation_date_start = 6;
// If set, returns all payments with a creation date less than or equal to
// it. Measured in seconds since the unix epoch.
uint64 creation_date_end = 7;
} }
message ListPaymentsResponse { message ListPaymentsResponse {
@ -3873,6 +4284,10 @@ message DeleteAllPaymentsRequest {
Only delete failed HTLCs from payments, not the payment itself. Only delete failed HTLCs from payments, not the payment itself.
*/ */
bool failed_htlcs_only = 2; bool failed_htlcs_only = 2;
// Delete all payments. NOTE: Using this option requires careful
// consideration as it is a destructive operation.
bool all_payments = 3;
} }
message DeletePaymentResponse { message DeletePaymentResponse {
@ -3923,6 +4338,7 @@ message PayReq {
bytes payment_addr = 11; bytes payment_addr = 11;
int64 num_msat = 12; int64 num_msat = 12;
map<uint32, Feature> features = 13; map<uint32, Feature> features = 13;
repeated BlindedPaymentPath blinded_paths = 14;
} }
enum FeatureBit { enum FeatureBit {
@ -3949,6 +4365,8 @@ enum FeatureBit {
ANCHORS_OPT = 21; ANCHORS_OPT = 21;
ANCHORS_ZERO_FEE_HTLC_REQ = 22; ANCHORS_ZERO_FEE_HTLC_REQ = 22;
ANCHORS_ZERO_FEE_HTLC_OPT = 23; ANCHORS_ZERO_FEE_HTLC_OPT = 23;
ROUTE_BLINDING_REQUIRED = 24;
ROUTE_BLINDING_OPTIONAL = 25;
AMP_REQ = 30; AMP_REQ = 30;
AMP_OPT = 31; AMP_OPT = 31;
} }
@ -3978,7 +4396,15 @@ message ChannelFeeReport {
// The effective fee rate in milli-satoshis. Computed by dividing the // The effective fee rate in milli-satoshis. Computed by dividing the
// fee_per_mil value by 1 million. // fee_per_mil value by 1 million.
double fee_rate = 4; double fee_rate = 4;
// The base fee charged regardless of the number of milli-satoshis sent.
int32 inbound_base_fee_msat = 6;
// The amount charged per milli-satoshis transferred expressed in
// millionths of a satoshi.
int32 inbound_fee_per_mil = 7;
} }
message FeeReportResponse { message FeeReportResponse {
// An array of channel fee reports which describes the current fee schedule // An array of channel fee reports which describes the current fee schedule
// for each channel. // for each channel.
@ -3997,6 +4423,16 @@ message FeeReportResponse {
uint64 month_fee_sum = 4; uint64 month_fee_sum = 4;
} }
message InboundFee {
// The inbound base fee charged regardless of the number of milli-satoshis
// received in the channel. By default, only negative values are accepted.
int32 base_fee_msat = 1;
// The effective inbound fee rate in micro-satoshis (parts per million).
// By default, only negative values are accepted.
int32 fee_rate_ppm = 2;
}
message PolicyUpdateRequest { message PolicyUpdateRequest {
oneof scope { oneof scope {
// If set, then this update applies to all currently active channels. // If set, then this update applies to all currently active channels.
@ -4029,7 +4465,12 @@ message PolicyUpdateRequest {
// If true, min_htlc_msat is applied. // If true, min_htlc_msat is applied.
bool min_htlc_msat_specified = 8; bool min_htlc_msat_specified = 8;
// Optional inbound fee. If unset, the previously set value will be
// retained [EXPERIMENTAL].
InboundFee inbound_fee = 10;
} }
enum UpdateFailure { enum UpdateFailure {
UPDATE_FAILURE_UNKNOWN = 0; UPDATE_FAILURE_UNKNOWN = 0;
UPDATE_FAILURE_PENDING = 1; UPDATE_FAILURE_PENDING = 1;
@ -4305,6 +4746,7 @@ message Failure {
EXPIRY_TOO_FAR = 22; EXPIRY_TOO_FAR = 22;
MPP_TIMEOUT = 23; MPP_TIMEOUT = 23;
INVALID_ONION_PAYLOAD = 24; INVALID_ONION_PAYLOAD = 24;
INVALID_ONION_BLINDING = 25;
/* /*
An internal error occurred. An internal error occurred.

View file

@ -137,6 +137,13 @@ service LightningPub {
option (nostr) = true; option (nostr) = true;
} }
rpc ListChannels(structs.Empty) returns (structs.LndChannels) {
option (auth_type) = "Admin";
option (http_method) = "get";
option (http_route) = "/api/admin/channels";
option (nostr) = true;
}
rpc GetUsageMetrics(structs.Empty) returns (structs.UsageMetrics) { rpc GetUsageMetrics(structs.Empty) returns (structs.UsageMetrics) {
option (auth_type) = "Metrics"; option (auth_type) = "Metrics";
option (http_method) = "post"; option (http_method) = "post";

View file

@ -108,6 +108,7 @@ message OpenChannel {
int64 lifetime =4 ; int64 lifetime =4 ;
int64 local_balance=5; int64 local_balance=5;
int64 remote_balance = 6; int64 remote_balance = 6;
string label = 7;
} }
message ClosedChannel { message ClosedChannel {
string channel_id = 1; string channel_id = 1;
@ -145,6 +146,10 @@ message LndMetrics {
} }
message LndChannels {
repeated OpenChannel open_channels = 1;
}
message LndGetInfoRequest { message LndGetInfoRequest {
int64 nodeId = 1; int64 nodeId = 1;
} }

View file

@ -8,7 +8,7 @@ import { LightningClient } from '../../../proto/lnd/lightning.client.js'
import { InvoicesClient } from '../../../proto/lnd/invoices.client.js' import { InvoicesClient } from '../../../proto/lnd/invoices.client.js'
import { RouterClient } from '../../../proto/lnd/router.client.js' import { RouterClient } from '../../../proto/lnd/router.client.js'
import { ChainNotifierClient } from '../../../proto/lnd/chainnotifier.client.js' import { ChainNotifierClient } from '../../../proto/lnd/chainnotifier.client.js'
import { GetInfoResponse, AddressType, NewAddressResponse, AddInvoiceResponse, Invoice_InvoiceState, PayReq, Payment_PaymentStatus, Payment, PaymentFailureReason, SendCoinsResponse, EstimateFeeResponse, ChannelBalanceResponse, TransactionDetails, ListChannelsResponse, ClosedChannelsResponse, PendingChannelsResponse, ForwardingHistoryResponse } from '../../../proto/lnd/lightning.js' import { GetInfoResponse, AddressType, NewAddressResponse, AddInvoiceResponse, Invoice_InvoiceState, PayReq, Payment_PaymentStatus, Payment, PaymentFailureReason, SendCoinsResponse, EstimateFeeResponse, ChannelBalanceResponse, TransactionDetails, ListChannelsResponse, ClosedChannelsResponse, PendingChannelsResponse, ForwardingHistoryResponse, CoinSelectionStrategy } from '../../../proto/lnd/lightning.js'
import { OpenChannelReq } from './openChannelReq.js'; import { OpenChannelReq } from './openChannelReq.js';
import { AddInvoiceReq } from './addInvoiceReq.js'; import { AddInvoiceReq } from './addInvoiceReq.js';
import { PayInvoiceReq } from './payInvoiceReq.js'; import { PayInvoiceReq } from './payInvoiceReq.js';
@ -113,12 +113,12 @@ export default class {
return res.response return res.response
} }
async ListPendingChannels(): Promise<PendingChannelsResponse> { async ListPendingChannels(): Promise<PendingChannelsResponse> {
const res = await this.lightning.pendingChannels({}, DeadLineMetadata()) const res = await this.lightning.pendingChannels({ includeRawTx: false }, DeadLineMetadata())
return res.response return res.response
} }
async ListChannels(): Promise<ListChannelsResponse> { async ListChannels(peerLookup = false): Promise<ListChannelsResponse> {
const res = await this.lightning.listChannels({ const res = await this.lightning.listChannels({
activeOnly: false, inactiveOnly: false, privateOnly: false, publicOnly: false, peer: Buffer.alloc(0) activeOnly: false, inactiveOnly: false, privateOnly: false, publicOnly: false, peer: Buffer.alloc(0), peerAliasLookup: peerLookup
}, DeadLineMetadata()) }, DeadLineMetadata())
return res.response return res.response
} }
@ -350,7 +350,8 @@ export default class {
addrToAmount: { [address]: BigInt(amount) }, addrToAmount: { [address]: BigInt(amount) },
minConfs: 1, minConfs: 1,
spendUnconfirmed: false, spendUnconfirmed: false,
targetConf: targetConf targetConf: targetConf,
coinSelectionStrategy: CoinSelectionStrategy.STRATEGY_LARGEST
}) })
return res.response return res.response
} }
@ -385,7 +386,7 @@ export default class {
} }
async GetWalletBalance() { async GetWalletBalance() {
const res = await this.lightning.walletBalance({}, DeadLineMetadata()) const res = await this.lightning.walletBalance({ account: "", minConfs: 1 }, DeadLineMetadata())
return res.response return res.response
} }
@ -404,10 +405,10 @@ export default class {
} }
async GetBalance(): Promise<BalanceInfo> { // TODO: remove this async GetBalance(): Promise<BalanceInfo> { // TODO: remove this
const wRes = await this.lightning.walletBalance({}, DeadLineMetadata()) const wRes = await this.lightning.walletBalance({ account: "", minConfs: 1 }, DeadLineMetadata())
const { confirmedBalance, unconfirmedBalance, totalBalance } = wRes.response const { confirmedBalance, unconfirmedBalance, totalBalance } = wRes.response
const { response } = await this.lightning.listChannels({ const { response } = await this.lightning.listChannels({
activeOnly: false, inactiveOnly: false, privateOnly: false, publicOnly: false, peer: Buffer.alloc(0) activeOnly: false, inactiveOnly: false, privateOnly: false, publicOnly: false, peer: Buffer.alloc(0), peerAliasLookup: false
}, DeadLineMetadata()) }, DeadLineMetadata())
const channelsBalance = response.channels.map(c => ({ const channelsBalance = response.channels.map(c => ({
channelId: c.chanId, channelId: c.chanId,
@ -424,11 +425,11 @@ export default class {
} }
async GetAllPaidInvoices(max: number) { async GetAllPaidInvoices(max: number) {
const res = await this.lightning.listInvoices({ indexOffset: 0n, numMaxInvoices: BigInt(max), pendingOnly: false, reversed: true }, DeadLineMetadata()) const res = await this.lightning.listInvoices({ indexOffset: 0n, numMaxInvoices: BigInt(max), pendingOnly: false, reversed: true, creationDateEnd: 0n, creationDateStart: 0n }, DeadLineMetadata())
return res.response return res.response
} }
async GetAllPayments(max: number) { async GetAllPayments(max: number) {
const res = await this.lightning.listPayments({ countTotalPayments: false, includeIncomplete: false, indexOffset: 0n, maxPayments: BigInt(max), reversed: true }) const res = await this.lightning.listPayments({ countTotalPayments: false, includeIncomplete: false, indexOffset: 0n, maxPayments: BigInt(max), reversed: true, creationDateEnd: 0n, creationDateStart: 0n })
return res.response return res.response
} }
@ -438,7 +439,7 @@ export default class {
} }
const indexOffset = BigInt(paymentIndex - 1) const indexOffset = BigInt(paymentIndex - 1)
const res = await this.lightning.listPayments({ const res = await this.lightning.listPayments({
countTotalPayments: false, includeIncomplete: true, indexOffset, maxPayments: 1n, reversed: false countTotalPayments: false, includeIncomplete: true, indexOffset, maxPayments: 1n, reversed: false, creationDateEnd: 0n, creationDateStart: 0n
}, DeadLineMetadata()) }, DeadLineMetadata())
return res.response return res.response
} }
@ -446,7 +447,7 @@ export default class {
async GetLatestPaymentIndex(from = 0) { async GetLatestPaymentIndex(from = 0) {
let indexOffset = BigInt(from) let indexOffset = BigInt(from)
while (true) { while (true) {
const res = await this.lightning.listPayments({ countTotalPayments: false, includeIncomplete: false, indexOffset, maxPayments: 0n, reversed: false }, DeadLineMetadata()) const res = await this.lightning.listPayments({ countTotalPayments: false, includeIncomplete: false, indexOffset, maxPayments: 0n, reversed: false, creationDateEnd: 0n, creationDateStart: 0n }, DeadLineMetadata())
if (res.response.payments.length === 0) { if (res.response.payments.length === 0) {
return Number(indexOffset) return Number(indexOffset)
} }

View file

@ -4,6 +4,7 @@ import { getLogger } from "../helpers/logger.js";
import { MainSettings, getDataPath } from "./settings.js"; import { MainSettings, getDataPath } from "./settings.js";
import Storage from "../storage/index.js"; import Storage from "../storage/index.js";
import * as Types from '../../../proto/autogenerated/ts/types.js' import * as Types from '../../../proto/autogenerated/ts/types.js'
import LND from "../lnd/lnd.js";
export class AdminManager { export class AdminManager {
storage: Storage storage: Storage
@ -16,6 +17,7 @@ export class AdminManager {
appNprofilePath: string appNprofilePath: string
interval: NodeJS.Timer interval: NodeJS.Timer
appNprofile: string appNprofile: string
lnd: LND
constructor(mainSettings: MainSettings, storage: Storage) { constructor(mainSettings: MainSettings, storage: Storage) {
this.storage = storage this.storage = storage
this.dataDir = mainSettings.storageSettings.dataDir this.dataDir = mainSettings.storageSettings.dataDir
@ -26,6 +28,10 @@ export class AdminManager {
this.start() this.start()
} }
setLND = (lnd: LND) => {
this.lnd = lnd
}
setAppNprofile = (nprofile: string) => { setAppNprofile = (nprofile: string) => {
this.appNprofile = nprofile this.appNprofile = nprofile
const enrollToken = this.ReadAdminEnrollToken() const enrollToken = this.ReadAdminEnrollToken()
@ -118,7 +124,7 @@ export class AdminManager {
CreateInviteLink = async (adminNpub: string, sats?: number): Promise<Types.CreateOneTimeInviteLinkResponse> => { CreateInviteLink = async (adminNpub: string, sats?: number): Promise<Types.CreateOneTimeInviteLinkResponse> => {
const adminAppUser = await this.storage.applicationStorage.FindNostrAppUser(adminNpub) const adminAppUser = await this.storage.applicationStorage.FindNostrAppUser(adminNpub)
if (!adminAppUser) { if (!adminAppUser) {
throw new Error("Admin user expected but not found!!!"); throw new Error("Admin user expected but not found!!!");
} }
const newInviteToken = await this.storage.applicationStorage.AddInviteToken(adminAppUser.application, sats); const newInviteToken = await this.storage.applicationStorage.AddInviteToken(adminAppUser.application, sats);
return { return {
@ -135,4 +141,19 @@ export class AdminManager {
used: inviteToken.used used: inviteToken.used
} }
} }
ListChannels = async (): Promise<Types.LndChannels> => {
const channels = await this.lnd.ListChannels()
return {
open_channels: channels.channels.map(c => ({
active: c.active,
capacity: Number(c.capacity),
local_balance: Number(c.localBalance),
remote_balance: Number(c.remoteBalance),
channel_id: c.chanId,
label: c.peerAlias || c.remotePubkey,
lifetime: Number(c.lifetime)
}))
}
}
} }

View file

@ -36,7 +36,8 @@ export const initMainHandler = async (log: PubLogger, mainSettings: MainSettings
} }
} }
const mainHandler = new Main(reloadedSettings, storageManager, adminManager, utils,unlocker) const mainHandler = new Main(reloadedSettings, storageManager, adminManager, utils, unlocker)
adminManager.setLND(mainHandler.lnd)
await mainHandler.lnd.Warmup() await mainHandler.lnd.Warmup()
if (!reloadedSettings.skipSanityCheck) { if (!reloadedSettings.skipSanityCheck) {
const sanityChecker = new SanityChecker(storageManager, mainHandler.lnd) const sanityChecker = new SanityChecker(storageManager, mainHandler.lnd)

View file

@ -13,6 +13,9 @@ export default (mainHandler: Main): Types.ServerMethods => {
GetLndMetrics: async ({ ctx, req }) => { GetLndMetrics: async ({ ctx, req }) => {
return mainHandler.metricsManager.GetLndMetrics(req) return mainHandler.metricsManager.GetLndMetrics(req)
}, },
ListChannels: async ({ ctx }) => {
return mainHandler.adminManager.ListChannels()
},
EncryptionExchange: async () => { }, EncryptionExchange: async () => { },
Health: async () => { await mainHandler.lnd.Health() }, Health: async () => { await mainHandler.lnd.Health() },
LndGetInfo: async ({ ctx }) => { LndGetInfo: async ({ ctx }) => {