diff --git a/proto/autogenerated/client.md b/proto/autogenerated/client.md index 9ee8079a..b2a729b4 100644 --- a/proto/autogenerated/client.md +++ b/proto/autogenerated/client.md @@ -854,6 +854,7 @@ The nostr server will send back a message response, and inside the body there wi ### ClosedChannel - __capacity__: _number_ - __channel_id__: _string_ + - __close_tx_timestamp__: _number_ - __closed_height__: _number_ ### ClosureMigration @@ -1006,6 +1007,7 @@ The nostr server will send back a message response, and inside the body there wi - __online_channels__: _number_ - __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_ - __pending_channels__: _number_ + - __root_ops__: ARRAY of: _[RootOperation](#RootOperation)_ ### LndSeed - __seed__: ARRAY of: _string_ @@ -1125,6 +1127,12 @@ The nostr server will send back a message response, and inside the body there wi ### RequestNPubLinkingTokenResponse - __token__: _string_ +### RootOperation + - __amount__: _number_ + - __created_at_unix__: _number_ + - __op_id__: _string_ + - __op_type__: _[OperationType](#OperationType)_ + ### RoutingEvent - __event_type__: _string_ - __failure_string__: _string_ @@ -1231,6 +1239,10 @@ The nostr server will send back a message response, and inside the body there wi - __MONTH__ - __WEEK__ +### OperationType + - __CHAIN_OP__ + - __INVOICE_OP__ + ### UserOperationType - __INCOMING_INVOICE__ - __INCOMING_TX__ diff --git a/proto/autogenerated/go/types.go b/proto/autogenerated/go/types.go index 69da589b..9b84c889 100644 --- a/proto/autogenerated/go/types.go +++ b/proto/autogenerated/go/types.go @@ -64,6 +64,13 @@ const ( WEEK IntervalType = "WEEK" ) +type OperationType string + +const ( + CHAIN_OP OperationType = "CHAIN_OP" + INVOICE_OP OperationType = "INVOICE_OP" +) + type UserOperationType string const ( @@ -175,9 +182,10 @@ type CloseChannelResponse struct { Closing_txid string `json:"closing_txid"` } type ClosedChannel struct { - Capacity int64 `json:"capacity"` - Channel_id string `json:"channel_id"` - Closed_height int64 `json:"closed_height"` + Capacity int64 `json:"capacity"` + Channel_id string `json:"channel_id"` + Close_tx_timestamp int64 `json:"close_tx_timestamp"` + Closed_height int64 `json:"closed_height"` } type ClosureMigration struct { Closes_at_unix int64 `json:"closes_at_unix"` @@ -329,6 +337,7 @@ type LndNodeMetrics struct { Online_channels int64 `json:"online_channels"` Open_channels []OpenChannel `json:"open_channels"` Pending_channels int64 `json:"pending_channels"` + Root_ops []RootOperation `json:"root_ops"` } type LndSeed struct { Seed []string `json:"seed"` @@ -448,6 +457,12 @@ type RequestNPubLinkingTokenRequest struct { type RequestNPubLinkingTokenResponse struct { Token string `json:"token"` } +type RootOperation struct { + Amount int64 `json:"amount"` + Created_at_unix int64 `json:"created_at_unix"` + Op_id string `json:"op_id"` + Op_type OperationType `json:"op_type"` +} type RoutingEvent struct { Event_type string `json:"event_type"` Failure_string string `json:"failure_string"` diff --git a/proto/autogenerated/ts/types.ts b/proto/autogenerated/ts/types.ts index 6851dbb5..ac253234 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -344,6 +344,14 @@ export const enumCheckIntervalType = (e?: IntervalType): boolean => { for (const v in IntervalType) if (e === v) return true return false } +export enum OperationType { + CHAIN_OP = 'CHAIN_OP', + INVOICE_OP = 'INVOICE_OP', +} +export const enumCheckOperationType = (e?: OperationType): boolean => { + for (const v in OperationType) if (e === v) return true + return false +} export enum UserOperationType { INCOMING_INVOICE = 'INCOMING_INVOICE', INCOMING_TX = 'INCOMING_TX', @@ -942,6 +950,7 @@ export const CloseChannelResponseValidate = (o?: CloseChannelResponse, opts: Clo export type ClosedChannel = { capacity: number channel_id: string + close_tx_timestamp: number closed_height: number } export const ClosedChannelOptionalFields: [] = [] @@ -949,6 +958,7 @@ export type ClosedChannelOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] capacity_CustomCheck?: (v: number) => boolean channel_id_CustomCheck?: (v: string) => boolean + close_tx_timestamp_CustomCheck?: (v: number) => boolean closed_height_CustomCheck?: (v: number) => boolean } export const ClosedChannelValidate = (o?: ClosedChannel, opts: ClosedChannelOptions = {}, path: string = 'ClosedChannel::root.'): Error | null => { @@ -961,6 +971,9 @@ export const ClosedChannelValidate = (o?: ClosedChannel, opts: ClosedChannelOpti if (typeof o.channel_id !== 'string') return new Error(`${path}.channel_id: is not a string`) if (opts.channel_id_CustomCheck && !opts.channel_id_CustomCheck(o.channel_id)) return new Error(`${path}.channel_id: custom check failed`) + if (typeof o.close_tx_timestamp !== 'number') return new Error(`${path}.close_tx_timestamp: is not a number`) + if (opts.close_tx_timestamp_CustomCheck && !opts.close_tx_timestamp_CustomCheck(o.close_tx_timestamp)) return new Error(`${path}.close_tx_timestamp: custom check failed`) + if (typeof o.closed_height !== 'number') return new Error(`${path}.closed_height: is not a number`) if (opts.closed_height_CustomCheck && !opts.closed_height_CustomCheck(o.closed_height)) return new Error(`${path}.closed_height: custom check failed`) @@ -1820,6 +1833,7 @@ export type LndNodeMetrics = { online_channels: number open_channels: OpenChannel[] pending_channels: number + root_ops: RootOperation[] } export const LndNodeMetricsOptionalFields: [] = [] export type LndNodeMetricsOptions = OptionsBaseMessage & { @@ -1840,6 +1854,8 @@ export type LndNodeMetricsOptions = OptionsBaseMessage & { open_channels_ItemOptions?: OpenChannelOptions open_channels_CustomCheck?: (v: OpenChannel[]) => boolean pending_channels_CustomCheck?: (v: number) => boolean + root_ops_ItemOptions?: RootOperationOptions + root_ops_CustomCheck?: (v: RootOperation[]) => boolean } export const LndNodeMetricsValidate = (o?: LndNodeMetrics, opts: LndNodeMetricsOptions = {}, path: string = 'LndNodeMetrics::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') @@ -1898,6 +1914,13 @@ export const LndNodeMetricsValidate = (o?: LndNodeMetrics, opts: LndNodeMetricsO if (typeof o.pending_channels !== 'number') return new Error(`${path}.pending_channels: is not a number`) if (opts.pending_channels_CustomCheck && !opts.pending_channels_CustomCheck(o.pending_channels)) return new Error(`${path}.pending_channels: custom check failed`) + if (!Array.isArray(o.root_ops)) return new Error(`${path}.root_ops: is not an array`) + for (let index = 0; index < o.root_ops.length; index++) { + const root_opsErr = RootOperationValidate(o.root_ops[index], opts.root_ops_ItemOptions, `${path}.root_ops[${index}]`) + if (root_opsErr !== null) return root_opsErr + } + if (opts.root_ops_CustomCheck && !opts.root_ops_CustomCheck(o.root_ops)) return new Error(`${path}.root_ops: custom check failed`) + return null } @@ -2582,6 +2605,39 @@ export const RequestNPubLinkingTokenResponseValidate = (o?: RequestNPubLinkingTo return null } +export type RootOperation = { + amount: number + created_at_unix: number + op_id: string + op_type: OperationType +} +export const RootOperationOptionalFields: [] = [] +export type RootOperationOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + created_at_unix_CustomCheck?: (v: number) => boolean + op_id_CustomCheck?: (v: string) => boolean + op_type_CustomCheck?: (v: OperationType) => boolean +} +export const RootOperationValidate = (o?: RootOperation, opts: RootOperationOptions = {}, path: string = 'RootOperation::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + if (typeof o.created_at_unix !== 'number') return new Error(`${path}.created_at_unix: is not a number`) + if (opts.created_at_unix_CustomCheck && !opts.created_at_unix_CustomCheck(o.created_at_unix)) return new Error(`${path}.created_at_unix: custom check failed`) + + if (typeof o.op_id !== 'string') return new Error(`${path}.op_id: is not a string`) + if (opts.op_id_CustomCheck && !opts.op_id_CustomCheck(o.op_id)) return new Error(`${path}.op_id: custom check failed`) + + if (!enumCheckOperationType(o.op_type)) return new Error(`${path}.op_type: is not a valid OperationType`) + if (opts.op_type_CustomCheck && !opts.op_type_CustomCheck(o.op_type)) return new Error(`${path}.op_type: custom check failed`) + + return null +} + export type RoutingEvent = { event_type: string failure_string: string diff --git a/proto/lnd/chainnotifier.client.ts b/proto/lnd/chainnotifier.client.ts index 23bc340e..d76e5cd8 100644 --- a/proto/lnd/chainnotifier.client.ts +++ b/proto/lnd/chainnotifier.client.ts @@ -3,10 +3,10 @@ // tslint:disable import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { ChainNotifier } from "./chainnotifier.js"; -import type { BlockEpoch } from "./chainnotifier.js"; -import type { SpendEvent } from "./chainnotifier.js"; -import type { SpendRequest } from "./chainnotifier.js"; +import { ChainNotifier } from "./chainnotifier"; +import type { BlockEpoch } from "./chainnotifier"; +import type { SpendEvent } from "./chainnotifier"; +import type { SpendRequest } from "./chainnotifier"; import { stackIntercept } from "@protobuf-ts/runtime-rpc"; import type { ConfEvent } from "./chainnotifier"; import type { ConfRequest } from "./chainnotifier"; diff --git a/proto/lnd/invoices.client.ts b/proto/lnd/invoices.client.ts index b529cca1..f4437d32 100644 --- a/proto/lnd/invoices.client.ts +++ b/proto/lnd/invoices.client.ts @@ -3,18 +3,18 @@ // tslint:disable import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { Invoices } from "./invoices.js"; -import type { LookupInvoiceMsg } from "./invoices.js"; -import type { SettleInvoiceResp } from "./invoices.js"; -import type { SettleInvoiceMsg } from "./invoices.js"; -import type { AddHoldInvoiceResp } from "./invoices.js"; -import type { AddHoldInvoiceRequest } from "./invoices.js"; -import type { CancelInvoiceResp } from "./invoices.js"; -import type { CancelInvoiceMsg } from "./invoices.js"; +import { Invoices } from "./invoices"; +import type { LookupInvoiceMsg } from "./invoices"; +import type { SettleInvoiceResp } from "./invoices"; +import type { SettleInvoiceMsg } from "./invoices"; +import type { AddHoldInvoiceResp } from "./invoices"; +import type { AddHoldInvoiceRequest } from "./invoices"; +import type { CancelInvoiceResp } from "./invoices"; +import type { CancelInvoiceMsg } from "./invoices"; import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { Invoice } from "./lightning.js"; -import type { SubscribeSingleInvoiceRequest } from "./invoices.js"; +import type { Invoice } from "./lightning"; +import type { SubscribeSingleInvoiceRequest } from "./invoices"; import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; /** diff --git a/proto/lnd/invoices.ts b/proto/lnd/invoices.ts index 4155cf06..a94573dc 100644 --- a/proto/lnd/invoices.ts +++ b/proto/lnd/invoices.ts @@ -1,7 +1,7 @@ // @generated by protobuf-ts 2.8.1 // @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3) // tslint:disable -import { Invoice } from "./lightning.js"; +import { Invoice } from "./lightning"; import { ServiceType } from "@protobuf-ts/runtime-rpc"; import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; import type { IBinaryWriter } from "@protobuf-ts/runtime"; @@ -13,7 +13,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime"; -import { RouteHint } from "./lightning.js"; +import { RouteHint } from "./lightning"; /** * @generated from protobuf message invoicesrpc.CancelInvoiceMsg */ diff --git a/proto/lnd/lightning.client.ts b/proto/lnd/lightning.client.ts index 52e938b9..0c3193df 100644 --- a/proto/lnd/lightning.client.ts +++ b/proto/lnd/lightning.client.ts @@ -3,155 +3,138 @@ // tslint:disable import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { Lightning } from "./lightning.js"; -import type { ListAliasesResponse } from "./lightning.js"; -import type { ListAliasesRequest } from "./lightning.js"; -import type { CustomMessage } from "./lightning.js"; -import type { SubscribeCustomMessagesRequest } from "./lightning.js"; -import type { SendCustomMessageResponse } from "./lightning.js"; -import type { SendCustomMessageRequest } from "./lightning.js"; -import type { RPCMiddlewareRequest } from "./lightning.js"; -import type { RPCMiddlewareResponse } from "./lightning.js"; -import type { CheckMacPermResponse } from "./lightning.js"; -import type { CheckMacPermRequest } from "./lightning.js"; -import type { ListPermissionsResponse } from "./lightning.js"; -import type { ListPermissionsRequest } from "./lightning.js"; -import type { DeleteMacaroonIDResponse } from "./lightning.js"; -import type { DeleteMacaroonIDRequest } from "./lightning.js"; -import type { ListMacaroonIDsResponse } from "./lightning.js"; -import type { ListMacaroonIDsRequest } from "./lightning.js"; -import type { BakeMacaroonResponse } from "./lightning.js"; -import type { BakeMacaroonRequest } from "./lightning.js"; -import type { ChannelBackupSubscription } from "./lightning.js"; -import type { RestoreBackupResponse } from "./lightning.js"; -import type { RestoreChanBackupRequest } from "./lightning.js"; -import type { VerifyChanBackupResponse } from "./lightning.js"; -import type { ChanBackupSnapshot } from "./lightning.js"; -import type { ChanBackupExportRequest } from "./lightning.js"; -import type { ChannelBackup } from "./lightning.js"; -import type { ExportChannelBackupRequest } from "./lightning.js"; -import type { ForwardingHistoryResponse } from "./lightning.js"; -import type { ForwardingHistoryRequest } from "./lightning.js"; -import type { PolicyUpdateResponse } from "./lightning.js"; -import type { PolicyUpdateRequest } from "./lightning.js"; -import type { FeeReportResponse } from "./lightning.js"; -import type { FeeReportRequest } from "./lightning.js"; -import type { DebugLevelResponse } from "./lightning.js"; -import type { DebugLevelRequest } from "./lightning.js"; -import type { GraphTopologyUpdate } from "./lightning.js"; -import type { GraphTopologySubscription } from "./lightning.js"; -import type { StopResponse } from "./lightning.js"; -import type { StopRequest } from "./lightning.js"; -import type { NetworkInfo } from "./lightning.js"; -import type { NetworkInfoRequest } from "./lightning.js"; -import type { QueryRoutesResponse } from "./lightning.js"; -import type { QueryRoutesRequest } from "./lightning.js"; -import type { NodeInfo } from "./lightning.js"; -import type { NodeInfoRequest } from "./lightning.js"; -import type { ChannelEdge } from "./lightning.js"; -import type { ChanInfoRequest } from "./lightning.js"; -import type { NodeMetricsResponse } from "./lightning.js"; -import type { NodeMetricsRequest } from "./lightning.js"; -import type { ChannelGraph } from "./lightning.js"; -import type { ChannelGraphRequest } from "./lightning.js"; -import type { DeleteAllPaymentsResponse } from "./lightning.js"; -import type { DeleteAllPaymentsRequest } from "./lightning.js"; -import type { DeletePaymentResponse } from "./lightning.js"; -import type { DeletePaymentRequest } from "./lightning.js"; -import type { ListPaymentsResponse } from "./lightning.js"; -import type { ListPaymentsRequest } from "./lightning.js"; -import type { PayReq } from "./lightning.js"; -import type { PayReqString } from "./lightning.js"; -import type { InvoiceSubscription } from "./lightning.js"; -import type { PaymentHash } from "./lightning.js"; -import type { ListInvoiceResponse } from "./lightning.js"; -import type { ListInvoiceRequest } from "./lightning.js"; -import type { AddInvoiceResponse } from "./lightning.js"; -import type { Invoice } from "./lightning.js"; -import type { SendToRouteRequest } from "./lightning.js"; -import type { SendResponse } from "./lightning.js"; -import type { SendRequest } from "./lightning.js"; -import type { AbandonChannelResponse } from "./lightning.js"; -import type { AbandonChannelRequest } from "./lightning.js"; -import type { CloseStatusUpdate } from "./lightning.js"; -import type { CloseChannelRequest } from "./lightning.js"; -import type { ChannelAcceptRequest } from "./lightning.js"; -import type { ChannelAcceptResponse } from "./lightning.js"; +import { Lightning } from "./lightning"; +import type { LookupHtlcResolutionResponse } from "./lightning"; +import type { LookupHtlcResolutionRequest } from "./lightning"; +import type { ListAliasesResponse } from "./lightning"; +import type { ListAliasesRequest } from "./lightning"; +import type { CustomMessage } from "./lightning"; +import type { SubscribeCustomMessagesRequest } from "./lightning"; +import type { SendCustomMessageResponse } from "./lightning"; +import type { SendCustomMessageRequest } from "./lightning"; +import type { RPCMiddlewareRequest } from "./lightning"; +import type { RPCMiddlewareResponse } from "./lightning"; +import type { CheckMacPermResponse } from "./lightning"; +import type { CheckMacPermRequest } from "./lightning"; +import type { ListPermissionsResponse } from "./lightning"; +import type { ListPermissionsRequest } from "./lightning"; +import type { DeleteMacaroonIDResponse } from "./lightning"; +import type { DeleteMacaroonIDRequest } from "./lightning"; +import type { ListMacaroonIDsResponse } from "./lightning"; +import type { ListMacaroonIDsRequest } from "./lightning"; +import type { BakeMacaroonResponse } from "./lightning"; +import type { BakeMacaroonRequest } from "./lightning"; +import type { ChannelBackupSubscription } from "./lightning"; +import type { RestoreBackupResponse } from "./lightning"; +import type { RestoreChanBackupRequest } from "./lightning"; +import type { VerifyChanBackupResponse } from "./lightning"; +import type { ChanBackupSnapshot } from "./lightning"; +import type { ChanBackupExportRequest } from "./lightning"; +import type { ChannelBackup } from "./lightning"; +import type { ExportChannelBackupRequest } from "./lightning"; +import type { ForwardingHistoryResponse } from "./lightning"; +import type { ForwardingHistoryRequest } from "./lightning"; +import type { PolicyUpdateResponse } from "./lightning"; +import type { PolicyUpdateRequest } from "./lightning"; +import type { FeeReportResponse } from "./lightning"; +import type { FeeReportRequest } from "./lightning"; +import type { DebugLevelResponse } from "./lightning"; +import type { DebugLevelRequest } from "./lightning"; +import type { GraphTopologyUpdate } from "./lightning"; +import type { GraphTopologySubscription } from "./lightning"; +import type { StopResponse } from "./lightning"; +import type { StopRequest } from "./lightning"; +import type { NetworkInfo } from "./lightning"; +import type { NetworkInfoRequest } from "./lightning"; +import type { QueryRoutesResponse } from "./lightning"; +import type { QueryRoutesRequest } from "./lightning"; +import type { NodeInfo } from "./lightning"; +import type { NodeInfoRequest } from "./lightning"; +import type { ChannelEdge } from "./lightning"; +import type { ChanInfoRequest } from "./lightning"; +import type { NodeMetricsResponse } from "./lightning"; +import type { NodeMetricsRequest } from "./lightning"; +import type { ChannelGraph } from "./lightning"; +import type { ChannelGraphRequest } from "./lightning"; +import type { DeleteAllPaymentsResponse } from "./lightning"; +import type { DeleteAllPaymentsRequest } from "./lightning"; +import type { DeletePaymentResponse } from "./lightning"; +import type { DeletePaymentRequest } from "./lightning"; +import type { ListPaymentsResponse } from "./lightning"; +import type { ListPaymentsRequest } from "./lightning"; +import type { PayReq } from "./lightning"; +import type { PayReqString } from "./lightning"; +import type { InvoiceSubscription } from "./lightning"; +import type { PaymentHash } from "./lightning"; +import type { ListInvoiceResponse } from "./lightning"; +import type { ListInvoiceRequest } from "./lightning"; +import type { AddInvoiceResponse } from "./lightning"; +import type { Invoice } from "./lightning"; +import type { SendToRouteRequest } from "./lightning"; +import type { SendResponse } from "./lightning"; +import type { SendRequest } from "./lightning"; +import type { AbandonChannelResponse } from "./lightning"; +import type { AbandonChannelRequest } from "./lightning"; +import type { CloseStatusUpdate } from "./lightning"; +import type { CloseChannelRequest } from "./lightning"; +import type { ChannelAcceptRequest } from "./lightning"; +import type { ChannelAcceptResponse } from "./lightning"; import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc"; -import type { FundingStateStepResp } from "./lightning.js"; -import type { FundingTransitionMsg } from "./lightning.js"; -import type { BatchOpenChannelResponse } from "./lightning.js"; -import type { BatchOpenChannelRequest } from "./lightning.js"; -import type { OpenStatusUpdate } from "./lightning.js"; -import type { ChannelPoint } from "./lightning.js"; -import type { OpenChannelRequest } from "./lightning.js"; -import type { ClosedChannelsResponse } from "./lightning.js"; -import type { ClosedChannelsRequest } from "./lightning.js"; -import type { ChannelEventUpdate } from "./lightning.js"; -import type { ChannelEventSubscription } from "./lightning.js"; -import type { ListChannelsResponse } from "./lightning.js"; -import type { ListChannelsRequest } from "./lightning.js"; -import type { PendingChannelsResponse } from "./lightning.js"; -import type { PendingChannelsRequest } from "./lightning.js"; -import type { GetRecoveryInfoResponse } from "./lightning.js"; -import type { GetRecoveryInfoRequest } from "./lightning.js"; -import type { GetInfoResponse } from "./lightning.js"; -import type { GetInfoRequest } from "./lightning.js"; -import type { PeerEvent } from "./lightning.js"; -import type { PeerEventSubscription } from "./lightning.js"; -import type { ListPeersResponse } from "./lightning.js"; -import type { ListPeersRequest } from "./lightning.js"; -import type { DisconnectPeerResponse } from "./lightning.js"; -import type { DisconnectPeerRequest } from "./lightning.js"; -import type { ConnectPeerResponse } from "./lightning.js"; -import type { ConnectPeerRequest } from "./lightning.js"; -import type { VerifyMessageResponse } from "./lightning.js"; -import type { VerifyMessageRequest } from "./lightning.js"; -import type { SignMessageResponse } from "./lightning.js"; -import type { SignMessageRequest } from "./lightning.js"; -import type { NewAddressResponse } from "./lightning.js"; -import type { NewAddressRequest } from "./lightning.js"; -import type { SendManyResponse } from "./lightning.js"; -import type { SendManyRequest } from "./lightning.js"; -import type { Transaction } from "./lightning.js"; +import type { FundingStateStepResp } from "./lightning"; +import type { FundingTransitionMsg } from "./lightning"; +import type { BatchOpenChannelResponse } from "./lightning"; +import type { BatchOpenChannelRequest } from "./lightning"; +import type { OpenStatusUpdate } from "./lightning"; +import type { ChannelPoint } from "./lightning"; +import type { OpenChannelRequest } from "./lightning"; +import type { ClosedChannelsResponse } from "./lightning"; +import type { ClosedChannelsRequest } from "./lightning"; +import type { ChannelEventUpdate } from "./lightning"; +import type { ChannelEventSubscription } from "./lightning"; +import type { ListChannelsResponse } from "./lightning"; +import type { ListChannelsRequest } from "./lightning"; +import type { PendingChannelsResponse } from "./lightning"; +import type { PendingChannelsRequest } from "./lightning"; +import type { GetRecoveryInfoResponse } from "./lightning"; +import type { GetRecoveryInfoRequest } from "./lightning"; +import type { GetDebugInfoResponse } from "./lightning"; +import type { GetDebugInfoRequest } from "./lightning"; +import type { GetInfoResponse } from "./lightning"; +import type { GetInfoRequest } from "./lightning"; +import type { PeerEvent } from "./lightning"; +import type { PeerEventSubscription } from "./lightning"; +import type { ListPeersResponse } from "./lightning"; +import type { ListPeersRequest } from "./lightning"; +import type { DisconnectPeerResponse } from "./lightning"; +import type { DisconnectPeerRequest } from "./lightning"; +import type { ConnectPeerResponse } from "./lightning"; +import type { ConnectPeerRequest } from "./lightning"; +import type { VerifyMessageResponse } from "./lightning"; +import type { VerifyMessageRequest } from "./lightning"; +import type { SignMessageResponse } from "./lightning"; +import type { SignMessageRequest } from "./lightning"; +import type { NewAddressResponse } from "./lightning"; +import type { NewAddressRequest } from "./lightning"; +import type { SendManyResponse } from "./lightning"; +import type { SendManyRequest } from "./lightning"; +import type { Transaction } from "./lightning"; import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc"; -import type { ListUnspentResponse } from "./lightning.js"; -import type { ListUnspentRequest } from "./lightning.js"; -import type { SendCoinsResponse } from "./lightning.js"; -import type { SendCoinsRequest } from "./lightning.js"; -import type { EstimateFeeResponse } from "./lightning.js"; -import type { EstimateFeeRequest } from "./lightning.js"; -import type { TransactionDetails } from "./lightning.js"; -import type { GetTransactionsRequest } from "./lightning.js"; -import type { ChannelBalanceResponse } from "./lightning.js"; -import type { ChannelBalanceRequest } from "./lightning.js"; +import type { ListUnspentResponse } from "./lightning"; +import type { ListUnspentRequest } from "./lightning"; +import type { SendCoinsResponse } from "./lightning"; +import type { SendCoinsRequest } from "./lightning"; +import type { EstimateFeeResponse } from "./lightning"; +import type { EstimateFeeRequest } from "./lightning"; +import type { TransactionDetails } from "./lightning"; +import type { GetTransactionsRequest } from "./lightning"; +import type { ChannelBalanceResponse } from "./lightning"; +import type { ChannelBalanceRequest } from "./lightning"; import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { WalletBalanceResponse } from "./lightning.js"; -import type { WalletBalanceRequest } from "./lightning.js"; +import type { WalletBalanceResponse } from "./lightning"; +import type { WalletBalanceRequest } from "./lightning"; import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; - -import type { GetDebugInfoResponse } from "./lightning.js"; -import type { GetDebugInfoRequest } from "./lightning.js"; - -import type { LookupHtlcResolutionResponse } from "./lightning.js"; -import type { LookupHtlcResolutionRequest } from "./lightning.js"; -// -// Comments in this file will be directly parsed into the API -// Documentation as descriptions of the associated method, message, or field. -// These descriptions should go right above the definition of the object, and -// can be in either block or // comment format. -// -// An RPC method can be matched to an lncli command by placing a line in the -// beginning of the description in exactly the following format: -// lncli: `methodname` -// -// Failure to specify the exact name of the command will cause documentation -// generation to fail. -// -// More information on how exactly the gRPC documentation is generated from -// this proto file can be found here: -// https://github.com/lightninglabs/lightning-api +// // Comments in this file will be directly parsed into the API // Documentation as descriptions of the associated method, message, or field. // These descriptions should go right above the definition of the object, and // can be in either block or // comment format. // // An RPC method can be matched to an lncli command by placing a line in the // beginning of the description in exactly the following format: // lncli: `methodname` // // Failure to specify the exact name of the command will cause documentation // generation to fail. // // More information on how exactly the gRPC documentation is generated from // this proto file can be found here: // https://github.com/lightninglabs/lightning-api /** * Lightning is the main RPC server of the daemon. @@ -327,7 +310,7 @@ export interface ILightningClient { * @generated from protobuf rpc: GetRecoveryInfo(lnrpc.GetRecoveryInfoRequest) returns (lnrpc.GetRecoveryInfoResponse); */ getRecoveryInfo(input: GetRecoveryInfoRequest, options?: RpcOptions): UnaryCall; - // TODO(roasbeef): merge with below with bool? + // TODO(roasbeef): merge with below with bool? /** * lncli: `pendingchannels` @@ -847,22 +830,7 @@ export interface ILightningClient { */ lookupHtlcResolution(input: LookupHtlcResolutionRequest, options?: RpcOptions): UnaryCall; } -// -// Comments in this file will be directly parsed into the API -// Documentation as descriptions of the associated method, message, or field. -// These descriptions should go right above the definition of the object, and -// can be in either block or // comment format. -// -// An RPC method can be matched to an lncli command by placing a line in the -// beginning of the description in exactly the following format: -// lncli: `methodname` -// -// Failure to specify the exact name of the command will cause documentation -// generation to fail. -// -// More information on how exactly the gRPC documentation is generated from -// this proto file can be found here: -// https://github.com/lightninglabs/lightning-api +// // Comments in this file will be directly parsed into the API // Documentation as descriptions of the associated method, message, or field. // These descriptions should go right above the definition of the object, and // can be in either block or // comment format. // // An RPC method can be matched to an lncli command by placing a line in the // beginning of the description in exactly the following format: // lncli: `methodname` // // Failure to specify the exact name of the command will cause documentation // generation to fail. // // More information on how exactly the gRPC documentation is generated from // this proto file can be found here: // https://github.com/lightninglabs/lightning-api /** * Lightning is the main RPC server of the daemon. @@ -1097,7 +1065,7 @@ export class LightningClient implements ILightningClient, ServiceInfo { const method = this.methods[17], opt = this._transport.mergeOptions(options); return stackIntercept("unary", this._transport, method, opt, input); } - // TODO(roasbeef): merge with below with bool? + // TODO(roasbeef): merge with below with bool? /** * lncli: `pendingchannels` diff --git a/proto/lnd/router.client.ts b/proto/lnd/router.client.ts index 27722e38..fc85cc79 100644 --- a/proto/lnd/router.client.ts +++ b/proto/lnd/router.client.ts @@ -3,40 +3,40 @@ // tslint:disable import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { Router } from "./router.js"; -import type { UpdateChanStatusResponse } from "./router.js"; -import type { UpdateChanStatusRequest } from "./router.js"; -import type { ForwardHtlcInterceptRequest } from "./router.js"; -import type { ForwardHtlcInterceptResponse } from "./router.js"; +import { Router } from "./router"; +import type { UpdateChanStatusResponse } from "./router"; +import type { UpdateChanStatusRequest } from "./router"; +import type { ForwardHtlcInterceptRequest } from "./router"; +import type { ForwardHtlcInterceptResponse } from "./router"; import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc"; -import type { PaymentStatus } from "./router.js"; -import type { HtlcEvent } from "./router.js"; -import type { SubscribeHtlcEventsRequest } from "./router.js"; -import type { BuildRouteResponse } from "./router.js"; -import type { BuildRouteRequest } from "./router.js"; -import type { QueryProbabilityResponse } from "./router.js"; -import type { QueryProbabilityRequest } from "./router.js"; -import type { SetMissionControlConfigResponse } from "./router.js"; -import type { SetMissionControlConfigRequest } from "./router.js"; -import type { GetMissionControlConfigResponse } from "./router.js"; -import type { GetMissionControlConfigRequest } from "./router.js"; -import type { XImportMissionControlResponse } from "./router.js"; -import type { XImportMissionControlRequest } from "./router.js"; -import type { QueryMissionControlResponse } from "./router.js"; -import type { QueryMissionControlRequest } from "./router.js"; -import type { ResetMissionControlResponse } from "./router.js"; -import type { ResetMissionControlRequest } from "./router.js"; -import type { HTLCAttempt } from "./lightning.js"; -import type { SendToRouteResponse } from "./router.js"; -import type { SendToRouteRequest } from "./router.js"; -import type { RouteFeeResponse } from "./router.js"; -import type { RouteFeeRequest } from "./router.js"; +import type { PaymentStatus } from "./router"; +import type { HtlcEvent } from "./router"; +import type { SubscribeHtlcEventsRequest } from "./router"; +import type { BuildRouteResponse } from "./router"; +import type { BuildRouteRequest } from "./router"; +import type { QueryProbabilityResponse } from "./router"; +import type { QueryProbabilityRequest } from "./router"; +import type { SetMissionControlConfigResponse } from "./router"; +import type { SetMissionControlConfigRequest } from "./router"; +import type { GetMissionControlConfigResponse } from "./router"; +import type { GetMissionControlConfigRequest } from "./router"; +import type { XImportMissionControlResponse } from "./router"; +import type { XImportMissionControlRequest } from "./router"; +import type { QueryMissionControlResponse } from "./router"; +import type { QueryMissionControlRequest } from "./router"; +import type { ResetMissionControlResponse } from "./router"; +import type { ResetMissionControlRequest } from "./router"; +import type { HTLCAttempt } from "./lightning"; +import type { SendToRouteResponse } from "./router"; +import type { SendToRouteRequest } from "./router"; +import type { RouteFeeResponse } from "./router"; +import type { RouteFeeRequest } from "./router"; import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { TrackPaymentsRequest } from "./router.js"; -import type { TrackPaymentRequest } from "./router.js"; +import type { TrackPaymentsRequest } from "./router"; +import type { TrackPaymentRequest } from "./router"; import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { Payment } from "./lightning.js"; -import type { SendPaymentRequest } from "./router.js"; +import type { Payment } from "./lightning"; +import type { SendPaymentRequest } from "./router"; import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; /** diff --git a/proto/lnd/router.ts b/proto/lnd/router.ts index edb624cd..2a52b054 100644 --- a/proto/lnd/router.ts +++ b/proto/lnd/router.ts @@ -1,7 +1,7 @@ // @generated by protobuf-ts 2.8.1 // @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3) // tslint:disable -import { Payment } from "./lightning.js"; +import { Payment } from "./lightning"; import { ServiceType } from "@protobuf-ts/runtime-rpc"; import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; import type { IBinaryWriter } from "@protobuf-ts/runtime"; @@ -13,13 +13,13 @@ import type { PartialMessage } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime"; -import { ChannelPoint } from "./lightning.js"; -import { HTLCAttempt } from "./lightning.js"; -import { Failure_FailureCode } from "./lightning.js"; -import { Failure } from "./lightning.js"; -import { Route } from "./lightning.js"; -import { FeatureBit } from "./lightning.js"; -import { RouteHint } from "./lightning.js"; +import { ChannelPoint } from "./lightning"; +import { HTLCAttempt } from "./lightning"; +import { Failure_FailureCode } from "./lightning"; +import { Failure } from "./lightning"; +import { Route } from "./lightning"; +import { FeatureBit } from "./lightning"; +import { RouteHint } from "./lightning"; /** * @generated from protobuf message routerrpc.SendPaymentRequest */ diff --git a/proto/lnd/signer.client.ts b/proto/lnd/signer.client.ts new file mode 100644 index 00000000..92ee85dd --- /dev/null +++ b/proto/lnd/signer.client.ts @@ -0,0 +1,394 @@ +// @generated by protobuf-ts 2.8.1 +// @generated from protobuf file "signer.proto" (package "signrpc", syntax proto3) +// tslint:disable +import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; +import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; +import { Signer } from "./signer"; +import type { MuSig2CleanupResponse } from "./signer"; +import type { MuSig2CleanupRequest } from "./signer"; +import type { MuSig2CombineSigResponse } from "./signer"; +import type { MuSig2CombineSigRequest } from "./signer"; +import type { MuSig2SignResponse } from "./signer"; +import type { MuSig2SignRequest } from "./signer"; +import type { MuSig2RegisterNoncesResponse } from "./signer"; +import type { MuSig2RegisterNoncesRequest } from "./signer"; +import type { MuSig2SessionResponse } from "./signer"; +import type { MuSig2SessionRequest } from "./signer"; +import type { MuSig2CombineKeysResponse } from "./signer"; +import type { MuSig2CombineKeysRequest } from "./signer"; +import type { SharedKeyResponse } from "./signer"; +import type { SharedKeyRequest } from "./signer"; +import type { VerifyMessageResp } from "./signer"; +import type { VerifyMessageReq } from "./signer"; +import type { SignMessageResp } from "./signer"; +import type { SignMessageReq } from "./signer"; +import type { InputScriptResp } from "./signer"; +import { stackIntercept } from "@protobuf-ts/runtime-rpc"; +import type { SignResp } from "./signer"; +import type { SignReq } from "./signer"; +import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; +import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; +/** + * Signer is a service that gives access to the signing functionality of the + * daemon's wallet. + * + * @generated from protobuf service signrpc.Signer + */ +export interface ISignerClient { + /** + * + * SignOutputRaw is a method that can be used to generated a signature for a + * set of inputs/outputs to a transaction. Each request specifies details + * concerning how the outputs should be signed, which keys they should be + * signed with, and also any optional tweaks. The return value is a fixed + * 64-byte signature (the same format as we use on the wire in Lightning). + * + * If we are unable to sign using the specified keys, then an error will be + * returned. + * + * @generated from protobuf rpc: SignOutputRaw(signrpc.SignReq) returns (signrpc.SignResp); + */ + signOutputRaw(input: SignReq, options?: RpcOptions): UnaryCall; + /** + * + * ComputeInputScript generates a complete InputIndex for the passed + * transaction with the signature as defined within the passed SignDescriptor. + * This method should be capable of generating the proper input script for both + * regular p2wkh/p2tr outputs and p2wkh outputs nested within a regular p2sh + * output. + * + * Note that when using this method to sign inputs belonging to the wallet, + * the only items of the SignDescriptor that need to be populated are pkScript + * in the TxOut field, the value in that same field, and finally the input + * index. + * + * @generated from protobuf rpc: ComputeInputScript(signrpc.SignReq) returns (signrpc.InputScriptResp); + */ + computeInputScript(input: SignReq, options?: RpcOptions): UnaryCall; + /** + * + * SignMessage signs a message with the key specified in the key locator. The + * returned signature is fixed-size LN wire format encoded. + * + * The main difference to SignMessage in the main RPC is that a specific key is + * used to sign the message instead of the node identity private key. + * + * @generated from protobuf rpc: SignMessage(signrpc.SignMessageReq) returns (signrpc.SignMessageResp); + */ + signMessage(input: SignMessageReq, options?: RpcOptions): UnaryCall; + /** + * + * VerifyMessage verifies a signature over a message using the public key + * provided. The signature must be fixed-size LN wire format encoded. + * + * The main difference to VerifyMessage in the main RPC is that the public key + * used to sign the message does not have to be a node known to the network. + * + * @generated from protobuf rpc: VerifyMessage(signrpc.VerifyMessageReq) returns (signrpc.VerifyMessageResp); + */ + verifyMessage(input: VerifyMessageReq, options?: RpcOptions): UnaryCall; + /** + * + * DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key + * derivation between the ephemeral public key in the request and the node's + * key specified in the key_desc parameter. Either a key locator or a raw + * public key is expected in the key_desc, if neither is supplied, defaults to + * the node's identity private key: + * P_shared = privKeyNode * ephemeralPubkey + * The resulting shared public key is serialized in the compressed format and + * hashed with sha256, resulting in the final key length of 256bit. + * + * @generated from protobuf rpc: DeriveSharedKey(signrpc.SharedKeyRequest) returns (signrpc.SharedKeyResponse); + */ + deriveSharedKey(input: SharedKeyRequest, options?: RpcOptions): UnaryCall; + /** + * + * MuSig2CombineKeys (experimental!) is a stateless helper RPC that can be used + * to calculate the combined MuSig2 public key from a list of all participating + * signers' public keys. This RPC is completely stateless and deterministic and + * does not create any signing session. It can be used to determine the Taproot + * public key that should be put in an on-chain output once all public keys are + * known. A signing session is only needed later when that output should be + * _spent_ again. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2CombineKeys(signrpc.MuSig2CombineKeysRequest) returns (signrpc.MuSig2CombineKeysResponse); + */ + muSig2CombineKeys(input: MuSig2CombineKeysRequest, options?: RpcOptions): UnaryCall; + /** + * + * MuSig2CreateSession (experimental!) creates a new MuSig2 signing session + * using the local key identified by the key locator. The complete list of all + * public keys of all signing parties must be provided, including the public + * key of the local signing key. If nonces of other parties are already known, + * they can be submitted as well to reduce the number of RPC calls necessary + * later on. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2CreateSession(signrpc.MuSig2SessionRequest) returns (signrpc.MuSig2SessionResponse); + */ + muSig2CreateSession(input: MuSig2SessionRequest, options?: RpcOptions): UnaryCall; + /** + * + * MuSig2RegisterNonces (experimental!) registers one or more public nonces of + * other signing participants for a session identified by its ID. This RPC can + * be called multiple times until all nonces are registered. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2RegisterNonces(signrpc.MuSig2RegisterNoncesRequest) returns (signrpc.MuSig2RegisterNoncesResponse); + */ + muSig2RegisterNonces(input: MuSig2RegisterNoncesRequest, options?: RpcOptions): UnaryCall; + /** + * + * MuSig2Sign (experimental!) creates a partial signature using the local + * signing key that was specified when the session was created. This can only + * be called when all public nonces of all participants are known and have been + * registered with the session. If this node isn't responsible for combining + * all the partial signatures, then the cleanup flag should be set, indicating + * that the session can be removed from memory once the signature was produced. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2Sign(signrpc.MuSig2SignRequest) returns (signrpc.MuSig2SignResponse); + */ + muSig2Sign(input: MuSig2SignRequest, options?: RpcOptions): UnaryCall; + /** + * + * MuSig2CombineSig (experimental!) combines the given partial signature(s) + * with the local one, if it already exists. Once a partial signature of all + * participants is registered, the final signature will be combined and + * returned. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2CombineSig(signrpc.MuSig2CombineSigRequest) returns (signrpc.MuSig2CombineSigResponse); + */ + muSig2CombineSig(input: MuSig2CombineSigRequest, options?: RpcOptions): UnaryCall; + /** + * + * MuSig2Cleanup (experimental!) allows a caller to clean up a session early in + * cases where it's obvious that the signing session won't succeed and the + * resources can be released. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2Cleanup(signrpc.MuSig2CleanupRequest) returns (signrpc.MuSig2CleanupResponse); + */ + muSig2Cleanup(input: MuSig2CleanupRequest, options?: RpcOptions): UnaryCall; +} +/** + * Signer is a service that gives access to the signing functionality of the + * daemon's wallet. + * + * @generated from protobuf service signrpc.Signer + */ +export class SignerClient implements ISignerClient, ServiceInfo { + typeName = Signer.typeName; + methods = Signer.methods; + options = Signer.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * + * SignOutputRaw is a method that can be used to generated a signature for a + * set of inputs/outputs to a transaction. Each request specifies details + * concerning how the outputs should be signed, which keys they should be + * signed with, and also any optional tweaks. The return value is a fixed + * 64-byte signature (the same format as we use on the wire in Lightning). + * + * If we are unable to sign using the specified keys, then an error will be + * returned. + * + * @generated from protobuf rpc: SignOutputRaw(signrpc.SignReq) returns (signrpc.SignResp); + */ + signOutputRaw(input: SignReq, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * ComputeInputScript generates a complete InputIndex for the passed + * transaction with the signature as defined within the passed SignDescriptor. + * This method should be capable of generating the proper input script for both + * regular p2wkh/p2tr outputs and p2wkh outputs nested within a regular p2sh + * output. + * + * Note that when using this method to sign inputs belonging to the wallet, + * the only items of the SignDescriptor that need to be populated are pkScript + * in the TxOut field, the value in that same field, and finally the input + * index. + * + * @generated from protobuf rpc: ComputeInputScript(signrpc.SignReq) returns (signrpc.InputScriptResp); + */ + computeInputScript(input: SignReq, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * SignMessage signs a message with the key specified in the key locator. The + * returned signature is fixed-size LN wire format encoded. + * + * The main difference to SignMessage in the main RPC is that a specific key is + * used to sign the message instead of the node identity private key. + * + * @generated from protobuf rpc: SignMessage(signrpc.SignMessageReq) returns (signrpc.SignMessageResp); + */ + signMessage(input: SignMessageReq, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * VerifyMessage verifies a signature over a message using the public key + * provided. The signature must be fixed-size LN wire format encoded. + * + * The main difference to VerifyMessage in the main RPC is that the public key + * used to sign the message does not have to be a node known to the network. + * + * @generated from protobuf rpc: VerifyMessage(signrpc.VerifyMessageReq) returns (signrpc.VerifyMessageResp); + */ + verifyMessage(input: VerifyMessageReq, options?: RpcOptions): UnaryCall { + const method = this.methods[3], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key + * derivation between the ephemeral public key in the request and the node's + * key specified in the key_desc parameter. Either a key locator or a raw + * public key is expected in the key_desc, if neither is supplied, defaults to + * the node's identity private key: + * P_shared = privKeyNode * ephemeralPubkey + * The resulting shared public key is serialized in the compressed format and + * hashed with sha256, resulting in the final key length of 256bit. + * + * @generated from protobuf rpc: DeriveSharedKey(signrpc.SharedKeyRequest) returns (signrpc.SharedKeyResponse); + */ + deriveSharedKey(input: SharedKeyRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[4], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * MuSig2CombineKeys (experimental!) is a stateless helper RPC that can be used + * to calculate the combined MuSig2 public key from a list of all participating + * signers' public keys. This RPC is completely stateless and deterministic and + * does not create any signing session. It can be used to determine the Taproot + * public key that should be put in an on-chain output once all public keys are + * known. A signing session is only needed later when that output should be + * _spent_ again. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2CombineKeys(signrpc.MuSig2CombineKeysRequest) returns (signrpc.MuSig2CombineKeysResponse); + */ + muSig2CombineKeys(input: MuSig2CombineKeysRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[5], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * MuSig2CreateSession (experimental!) creates a new MuSig2 signing session + * using the local key identified by the key locator. The complete list of all + * public keys of all signing parties must be provided, including the public + * key of the local signing key. If nonces of other parties are already known, + * they can be submitted as well to reduce the number of RPC calls necessary + * later on. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2CreateSession(signrpc.MuSig2SessionRequest) returns (signrpc.MuSig2SessionResponse); + */ + muSig2CreateSession(input: MuSig2SessionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[6], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * MuSig2RegisterNonces (experimental!) registers one or more public nonces of + * other signing participants for a session identified by its ID. This RPC can + * be called multiple times until all nonces are registered. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2RegisterNonces(signrpc.MuSig2RegisterNoncesRequest) returns (signrpc.MuSig2RegisterNoncesResponse); + */ + muSig2RegisterNonces(input: MuSig2RegisterNoncesRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[7], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * MuSig2Sign (experimental!) creates a partial signature using the local + * signing key that was specified when the session was created. This can only + * be called when all public nonces of all participants are known and have been + * registered with the session. If this node isn't responsible for combining + * all the partial signatures, then the cleanup flag should be set, indicating + * that the session can be removed from memory once the signature was produced. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2Sign(signrpc.MuSig2SignRequest) returns (signrpc.MuSig2SignResponse); + */ + muSig2Sign(input: MuSig2SignRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[8], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * MuSig2CombineSig (experimental!) combines the given partial signature(s) + * with the local one, if it already exists. Once a partial signature of all + * participants is registered, the final signature will be combined and + * returned. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2CombineSig(signrpc.MuSig2CombineSigRequest) returns (signrpc.MuSig2CombineSigResponse); + */ + muSig2CombineSig(input: MuSig2CombineSigRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[9], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * MuSig2Cleanup (experimental!) allows a caller to clean up a session early in + * cases where it's obvious that the signing session won't succeed and the + * resources can be released. + * + * NOTE: The MuSig2 BIP is not final yet and therefore this API must be + * considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + * releases. Backward compatibility is not guaranteed! + * + * @generated from protobuf rpc: MuSig2Cleanup(signrpc.MuSig2CleanupRequest) returns (signrpc.MuSig2CleanupResponse); + */ + muSig2Cleanup(input: MuSig2CleanupRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[10], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} diff --git a/proto/lnd/signer.ts b/proto/lnd/signer.ts new file mode 100644 index 00000000..cf9cf1d4 --- /dev/null +++ b/proto/lnd/signer.ts @@ -0,0 +1,2502 @@ +// @generated by protobuf-ts 2.8.1 +// @generated from protobuf file "signer.proto" (package "signrpc", syntax proto3) +// tslint:disable +import { ServiceType } from "@protobuf-ts/runtime-rpc"; +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { WireType } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +/** + * @generated from protobuf message signrpc.KeyLocator + */ +export interface KeyLocator { + /** + * The family of key being identified. + * + * @generated from protobuf field: int32 key_family = 1; + */ + keyFamily: number; + /** + * The precise index of the key being identified. + * + * @generated from protobuf field: int32 key_index = 2; + */ + keyIndex: number; +} +/** + * @generated from protobuf message signrpc.KeyDescriptor + */ +export interface KeyDescriptor { + /** + * + * The raw bytes of the public key in the key pair being identified. Either + * this or the KeyLocator must be specified. + * + * @generated from protobuf field: bytes raw_key_bytes = 1; + */ + rawKeyBytes: Uint8Array; + /** + * + * The key locator that identifies which private key to use for signing. + * Either this or the raw bytes of the target public key must be specified. + * + * @generated from protobuf field: signrpc.KeyLocator key_loc = 2; + */ + keyLoc?: KeyLocator; +} +/** + * @generated from protobuf message signrpc.TxOut + */ +export interface TxOut { + /** + * The value of the output being spent. + * + * @generated from protobuf field: int64 value = 1; + */ + value: bigint; + /** + * The script of the output being spent. + * + * @generated from protobuf field: bytes pk_script = 2; + */ + pkScript: Uint8Array; +} +/** + * @generated from protobuf message signrpc.SignDescriptor + */ +export interface SignDescriptor { + /** + * + * A descriptor that precisely describes *which* key to use for signing. This + * may provide the raw public key directly, or require the Signer to re-derive + * the key according to the populated derivation path. + * + * Note that if the key descriptor was obtained through walletrpc.DeriveKey, + * then the key locator MUST always be provided, since the derived keys are not + * persisted unlike with DeriveNextKey. + * + * @generated from protobuf field: signrpc.KeyDescriptor key_desc = 1; + */ + keyDesc?: KeyDescriptor; + /** + * + * A scalar value that will be added to the private key corresponding to the + * above public key to obtain the private key to be used to sign this input. + * This value is typically derived via the following computation: + * + * derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N + * + * @generated from protobuf field: bytes single_tweak = 2; + */ + singleTweak: Uint8Array; + /** + * + * A private key that will be used in combination with its corresponding + * private key to derive the private key that is to be used to sign the target + * input. Within the Lightning protocol, this value is typically the + * commitment secret from a previously revoked commitment transaction. This + * value is in combination with two hash values, and the original private key + * to derive the private key to be used when signing. + * + * k = (privKey*sha256(pubKey || tweakPub) + + * tweakPriv*sha256(tweakPub || pubKey)) mod N + * + * @generated from protobuf field: bytes double_tweak = 3; + */ + doubleTweak: Uint8Array; + /** + * + * The 32 byte input to the taproot tweak derivation that is used to derive + * the output key from an internal key: outputKey = internalKey + + * tagged_hash("tapTweak", internalKey || tapTweak). + * + * When doing a BIP 86 spend, this field can be an empty byte slice. + * + * When doing a normal key path spend, with the output key committing to an + * actual script root, then this field should be: the tapscript root hash. + * + * @generated from protobuf field: bytes tap_tweak = 10; + */ + tapTweak: Uint8Array; + /** + * + * The full script required to properly redeem the output. This field will + * only be populated if a p2tr, p2wsh or a p2sh output is being signed. If a + * taproot script path spend is being attempted, then this should be the raw + * leaf script. + * + * @generated from protobuf field: bytes witness_script = 4; + */ + witnessScript: Uint8Array; + /** + * + * A description of the output being spent. The value and script MUST be + * provided. + * + * @generated from protobuf field: signrpc.TxOut output = 5; + */ + output?: TxOut; + /** + * + * The target sighash type that should be used when generating the final + * sighash, and signature. + * + * @generated from protobuf field: uint32 sighash = 7; + */ + sighash: number; + /** + * + * The target input within the transaction that should be signed. + * + * @generated from protobuf field: int32 input_index = 8; + */ + inputIndex: number; + /** + * + * The sign method specifies how the input should be signed. Depending on the + * method, either the tap_tweak, witness_script or both need to be specified. + * Defaults to SegWit v0 signing to be backward compatible with older RPC + * clients. + * + * @generated from protobuf field: signrpc.SignMethod sign_method = 9; + */ + signMethod: SignMethod; +} +/** + * @generated from protobuf message signrpc.SignReq + */ +export interface SignReq { + /** + * The raw bytes of the transaction to be signed. + * + * @generated from protobuf field: bytes raw_tx_bytes = 1; + */ + rawTxBytes: Uint8Array; + /** + * A set of sign descriptors, for each input to be signed. + * + * @generated from protobuf field: repeated signrpc.SignDescriptor sign_descs = 2; + */ + signDescs: SignDescriptor[]; + /** + * + * The full list of UTXO information for each of the inputs being spent. This + * is required when spending one or more taproot (SegWit v1) outputs. + * + * @generated from protobuf field: repeated signrpc.TxOut prev_outputs = 3; + */ + prevOutputs: TxOut[]; +} +/** + * @generated from protobuf message signrpc.SignResp + */ +export interface SignResp { + /** + * + * A set of signatures realized in a fixed 64-byte format ordered in ascending + * input order. + * + * @generated from protobuf field: repeated bytes raw_sigs = 1; + */ + rawSigs: Uint8Array[]; +} +/** + * @generated from protobuf message signrpc.InputScript + */ +export interface InputScript { + /** + * The serializes witness stack for the specified input. + * + * @generated from protobuf field: repeated bytes witness = 1; + */ + witness: Uint8Array[]; + /** + * + * The optional sig script for the specified witness that will only be set if + * the input specified is a nested p2sh witness program. + * + * @generated from protobuf field: bytes sig_script = 2; + */ + sigScript: Uint8Array; +} +/** + * @generated from protobuf message signrpc.InputScriptResp + */ +export interface InputScriptResp { + /** + * The set of fully valid input scripts requested. + * + * @generated from protobuf field: repeated signrpc.InputScript input_scripts = 1; + */ + inputScripts: InputScript[]; +} +/** + * @generated from protobuf message signrpc.SignMessageReq + */ +export interface SignMessageReq { + /** + * + * The message to be signed. When using REST, this field must be encoded as + * base64. + * + * @generated from protobuf field: bytes msg = 1; + */ + msg: Uint8Array; + /** + * The key locator that identifies which key to use for signing. + * + * @generated from protobuf field: signrpc.KeyLocator key_loc = 2; + */ + keyLoc?: KeyLocator; + /** + * Double-SHA256 hash instead of just the default single round. + * + * @generated from protobuf field: bool double_hash = 3; + */ + doubleHash: boolean; + /** + * + * Use the compact (pubkey recoverable) format instead of the raw lnwire + * format. This option cannot be used with Schnorr signatures. + * + * @generated from protobuf field: bool compact_sig = 4; + */ + compactSig: boolean; + /** + * + * Use Schnorr signature. This option cannot be used with compact format. + * + * @generated from protobuf field: bool schnorr_sig = 5; + */ + schnorrSig: boolean; + /** + * + * The optional Taproot tweak bytes to apply to the private key before creating + * a Schnorr signature. The private key is tweaked as described in BIP-341: + * privKey + h_tapTweak(internalKey || tapTweak) + * + * @generated from protobuf field: bytes schnorr_sig_tap_tweak = 6; + */ + schnorrSigTapTweak: Uint8Array; + /** + * + * An optional tag that can be provided when taking a tagged hash of a + * message. This option can only be used when schnorr_sig is true. + * + * @generated from protobuf field: bytes tag = 7; + */ + tag: Uint8Array; +} +/** + * @generated from protobuf message signrpc.SignMessageResp + */ +export interface SignMessageResp { + /** + * + * The signature for the given message in the fixed-size LN wire format. + * + * @generated from protobuf field: bytes signature = 1; + */ + signature: Uint8Array; +} +/** + * @generated from protobuf message signrpc.VerifyMessageReq + */ +export interface VerifyMessageReq { + /** + * The message over which the signature is to be verified. When using + * REST, this field must be encoded as base64. + * + * @generated from protobuf field: bytes msg = 1; + */ + msg: Uint8Array; + /** + * + * The fixed-size LN wire encoded signature to be verified over the given + * message. When using REST, this field must be encoded as base64. + * + * @generated from protobuf field: bytes signature = 2; + */ + signature: Uint8Array; + /** + * + * The public key the signature has to be valid for. When using REST, this + * field must be encoded as base64. If the is_schnorr_sig option is true, then + * the public key is expected to be in the 32-byte x-only serialization + * according to BIP-340. + * + * @generated from protobuf field: bytes pubkey = 3; + */ + pubkey: Uint8Array; + /** + * + * Specifies if the signature is a Schnorr signature. + * + * @generated from protobuf field: bool is_schnorr_sig = 4; + */ + isSchnorrSig: boolean; + /** + * + * An optional tag that can be provided when taking a tagged hash of a + * message. This option can only be used when is_schnorr_sig is true. + * + * @generated from protobuf field: bytes tag = 5; + */ + tag: Uint8Array; +} +/** + * @generated from protobuf message signrpc.VerifyMessageResp + */ +export interface VerifyMessageResp { + /** + * Whether the signature was valid over the given message. + * + * @generated from protobuf field: bool valid = 1; + */ + valid: boolean; +} +/** + * @generated from protobuf message signrpc.SharedKeyRequest + */ +export interface SharedKeyRequest { + /** + * The ephemeral public key to use for the DH key derivation. + * + * @generated from protobuf field: bytes ephemeral_pubkey = 1; + */ + ephemeralPubkey: Uint8Array; + /** + * + * Deprecated. The optional key locator of the local key that should be used. + * If this parameter is not set then the node's identity private key will be + * used. + * + * @deprecated + * @generated from protobuf field: signrpc.KeyLocator key_loc = 2 [deprecated = true]; + */ + keyLoc?: KeyLocator; + /** + * + * A key descriptor describes the key used for performing ECDH. Either a key + * locator or a raw public key is expected, if neither is supplied, defaults to + * the node's identity private key. + * + * @generated from protobuf field: signrpc.KeyDescriptor key_desc = 3; + */ + keyDesc?: KeyDescriptor; +} +/** + * @generated from protobuf message signrpc.SharedKeyResponse + */ +export interface SharedKeyResponse { + /** + * The shared public key, hashed with sha256. + * + * @generated from protobuf field: bytes shared_key = 1; + */ + sharedKey: Uint8Array; +} +/** + * @generated from protobuf message signrpc.TweakDesc + */ +export interface TweakDesc { + /** + * + * Tweak is the 32-byte value that will modify the public key. + * + * @generated from protobuf field: bytes tweak = 1; + */ + tweak: Uint8Array; + /** + * + * Specifies if the target key should be converted to an x-only public key + * before tweaking. If true, then the public key will be mapped to an x-only + * key before the tweaking operation is applied. + * + * @generated from protobuf field: bool is_x_only = 2; + */ + isXOnly: boolean; +} +/** + * @generated from protobuf message signrpc.TaprootTweakDesc + */ +export interface TaprootTweakDesc { + /** + * + * The root hash of the tapscript tree if a script path is committed to. If + * the MuSig2 key put on chain doesn't also commit to a script path (BIP-0086 + * key spend only), then this needs to be empty and the key_spend_only field + * below must be set to true. This is required because gRPC cannot + * differentiate between a zero-size byte slice and a nil byte slice (both + * would be serialized the same way). So the extra boolean is required. + * + * @generated from protobuf field: bytes script_root = 1; + */ + scriptRoot: Uint8Array; + /** + * + * Indicates that the above script_root is expected to be empty because this + * is a BIP-0086 key spend only commitment where only the internal key is + * committed to instead of also including a script root hash. + * + * @generated from protobuf field: bool key_spend_only = 2; + */ + keySpendOnly: boolean; +} +/** + * @generated from protobuf message signrpc.MuSig2CombineKeysRequest + */ +export interface MuSig2CombineKeysRequest { + /** + * + * A list of all public keys (serialized in 32-byte x-only format for v0.4.0 + * and 33-byte compressed format for v1.0.0rc2!) participating in the signing + * session. The list will always be sorted lexicographically internally. This + * must include the local key which is described by the above key_loc. + * + * @generated from protobuf field: repeated bytes all_signer_pubkeys = 1; + */ + allSignerPubkeys: Uint8Array[]; + /** + * + * A series of optional generic tweaks to be applied to the aggregated + * public key. + * + * @generated from protobuf field: repeated signrpc.TweakDesc tweaks = 2; + */ + tweaks: TweakDesc[]; + /** + * + * An optional taproot specific tweak that must be specified if the MuSig2 + * combined key will be used as the main taproot key of a taproot output + * on-chain. + * + * @generated from protobuf field: signrpc.TaprootTweakDesc taproot_tweak = 3; + */ + taprootTweak?: TaprootTweakDesc; + /** + * + * The mandatory version of the MuSig2 BIP draft to use. This is necessary to + * differentiate between the changes that were made to the BIP while this + * experimental RPC was already released. Some of those changes affect how the + * combined key and nonces are created. + * + * @generated from protobuf field: signrpc.MuSig2Version version = 4; + */ + version: MuSig2Version; +} +/** + * @generated from protobuf message signrpc.MuSig2CombineKeysResponse + */ +export interface MuSig2CombineKeysResponse { + /** + * + * The combined public key (in the 32-byte x-only format) with all tweaks + * applied to it. If a taproot tweak is specified, this corresponds to the + * taproot key that can be put into the on-chain output. + * + * @generated from protobuf field: bytes combined_key = 1; + */ + combinedKey: Uint8Array; + /** + * + * The raw combined public key (in the 32-byte x-only format) before any tweaks + * are applied to it. If a taproot tweak is specified, this corresponds to the + * internal key that needs to be put into the witness if the script spend path + * is used. + * + * @generated from protobuf field: bytes taproot_internal_key = 2; + */ + taprootInternalKey: Uint8Array; + /** + * + * The version of the MuSig2 BIP that was used to combine the keys. + * + * @generated from protobuf field: signrpc.MuSig2Version version = 4; + */ + version: MuSig2Version; +} +/** + * @generated from protobuf message signrpc.MuSig2SessionRequest + */ +export interface MuSig2SessionRequest { + /** + * + * The key locator that identifies which key to use for signing. + * + * @generated from protobuf field: signrpc.KeyLocator key_loc = 1; + */ + keyLoc?: KeyLocator; + /** + * + * A list of all public keys (serialized in 32-byte x-only format for v0.4.0 + * and 33-byte compressed format for v1.0.0rc2!) participating in the signing + * session. The list will always be sorted lexicographically internally. This + * must include the local key which is described by the above key_loc. + * + * @generated from protobuf field: repeated bytes all_signer_pubkeys = 2; + */ + allSignerPubkeys: Uint8Array[]; + /** + * + * An optional list of all public nonces of other signing participants that + * might already be known. + * + * @generated from protobuf field: repeated bytes other_signer_public_nonces = 3; + */ + otherSignerPublicNonces: Uint8Array[]; + /** + * + * A series of optional generic tweaks to be applied to the aggregated + * public key. + * + * @generated from protobuf field: repeated signrpc.TweakDesc tweaks = 4; + */ + tweaks: TweakDesc[]; + /** + * + * An optional taproot specific tweak that must be specified if the MuSig2 + * combined key will be used as the main taproot key of a taproot output + * on-chain. + * + * @generated from protobuf field: signrpc.TaprootTweakDesc taproot_tweak = 5; + */ + taprootTweak?: TaprootTweakDesc; + /** + * + * The mandatory version of the MuSig2 BIP draft to use. This is necessary to + * differentiate between the changes that were made to the BIP while this + * experimental RPC was already released. Some of those changes affect how the + * combined key and nonces are created. + * + * @generated from protobuf field: signrpc.MuSig2Version version = 6; + */ + version: MuSig2Version; + /** + * + * A set of pre generated secret local nonces to use in the musig2 session. + * This field is optional. This can be useful for protocols that need to send + * nonces ahead of time before the set of signer keys are known. This value + * MUST be 97 bytes and be the concatenation of two CSPRNG generated 32 byte + * values and local public key used for signing as specified in the key_loc + * field. + * + * @generated from protobuf field: bytes pregenerated_local_nonce = 7; + */ + pregeneratedLocalNonce: Uint8Array; +} +/** + * @generated from protobuf message signrpc.MuSig2SessionResponse + */ +export interface MuSig2SessionResponse { + /** + * + * The unique ID that represents this signing session. A session can be used + * for producing a signature a single time. If the signing fails for any + * reason, a new session with the same participants needs to be created. + * + * @generated from protobuf field: bytes session_id = 1; + */ + sessionId: Uint8Array; + /** + * + * The combined public key (in the 32-byte x-only format) with all tweaks + * applied to it. If a taproot tweak is specified, this corresponds to the + * taproot key that can be put into the on-chain output. + * + * @generated from protobuf field: bytes combined_key = 2; + */ + combinedKey: Uint8Array; + /** + * + * The raw combined public key (in the 32-byte x-only format) before any tweaks + * are applied to it. If a taproot tweak is specified, this corresponds to the + * internal key that needs to be put into the witness if the script spend path + * is used. + * + * @generated from protobuf field: bytes taproot_internal_key = 3; + */ + taprootInternalKey: Uint8Array; + /** + * + * The two public nonces the local signer uses, combined into a single value + * of 66 bytes. Can be split into the two 33-byte points to get the individual + * nonces. + * + * @generated from protobuf field: bytes local_public_nonces = 4; + */ + localPublicNonces: Uint8Array; + /** + * + * Indicates whether all nonces required to start the signing process are known + * now. + * + * @generated from protobuf field: bool have_all_nonces = 5; + */ + haveAllNonces: boolean; + /** + * + * The version of the MuSig2 BIP that was used to create the session. + * + * @generated from protobuf field: signrpc.MuSig2Version version = 6; + */ + version: MuSig2Version; +} +/** + * @generated from protobuf message signrpc.MuSig2RegisterNoncesRequest + */ +export interface MuSig2RegisterNoncesRequest { + /** + * + * The unique ID of the signing session those nonces should be registered with. + * + * @generated from protobuf field: bytes session_id = 1; + */ + sessionId: Uint8Array; + /** + * + * A list of all public nonces of other signing participants that should be + * registered. + * + * @generated from protobuf field: repeated bytes other_signer_public_nonces = 3; + */ + otherSignerPublicNonces: Uint8Array[]; +} +/** + * @generated from protobuf message signrpc.MuSig2RegisterNoncesResponse + */ +export interface MuSig2RegisterNoncesResponse { + /** + * + * Indicates whether all nonces required to start the signing process are known + * now. + * + * @generated from protobuf field: bool have_all_nonces = 1; + */ + haveAllNonces: boolean; +} +/** + * @generated from protobuf message signrpc.MuSig2SignRequest + */ +export interface MuSig2SignRequest { + /** + * + * The unique ID of the signing session to use for signing. + * + * @generated from protobuf field: bytes session_id = 1; + */ + sessionId: Uint8Array; + /** + * + * The 32-byte SHA256 digest of the message to sign. + * + * @generated from protobuf field: bytes message_digest = 2; + */ + messageDigest: Uint8Array; + /** + * + * Cleanup indicates that after signing, the session state can be cleaned up, + * since another participant is going to be responsible for combining the + * partial signatures. + * + * @generated from protobuf field: bool cleanup = 3; + */ + cleanup: boolean; +} +/** + * @generated from protobuf message signrpc.MuSig2SignResponse + */ +export interface MuSig2SignResponse { + /** + * + * The partial signature created by the local signer. + * + * @generated from protobuf field: bytes local_partial_signature = 1; + */ + localPartialSignature: Uint8Array; +} +/** + * @generated from protobuf message signrpc.MuSig2CombineSigRequest + */ +export interface MuSig2CombineSigRequest { + /** + * + * The unique ID of the signing session to combine the signatures for. + * + * @generated from protobuf field: bytes session_id = 1; + */ + sessionId: Uint8Array; + /** + * + * The list of all other participants' partial signatures to add to the current + * session. + * + * @generated from protobuf field: repeated bytes other_partial_signatures = 2; + */ + otherPartialSignatures: Uint8Array[]; +} +/** + * @generated from protobuf message signrpc.MuSig2CombineSigResponse + */ +export interface MuSig2CombineSigResponse { + /** + * + * Indicates whether all partial signatures required to create a final, full + * signature are known yet. If this is true, then the final_signature field is + * set, otherwise it is empty. + * + * @generated from protobuf field: bool have_all_signatures = 1; + */ + haveAllSignatures: boolean; + /** + * + * The final, full signature that is valid for the combined public key. + * + * @generated from protobuf field: bytes final_signature = 2; + */ + finalSignature: Uint8Array; +} +/** + * @generated from protobuf message signrpc.MuSig2CleanupRequest + */ +export interface MuSig2CleanupRequest { + /** + * + * The unique ID of the signing session that should be removed/cleaned up. + * + * @generated from protobuf field: bytes session_id = 1; + */ + sessionId: Uint8Array; +} +/** + * @generated from protobuf message signrpc.MuSig2CleanupResponse + */ +export interface MuSig2CleanupResponse { +} +/** + * @generated from protobuf enum signrpc.SignMethod + */ +export enum SignMethod { + /** + * + * Specifies that a SegWit v0 (p2wkh, np2wkh, p2wsh) input script should be + * signed. + * + * @generated from protobuf enum value: SIGN_METHOD_WITNESS_V0 = 0; + */ + WITNESS_V0 = 0, + /** + * + * Specifies that a SegWit v1 (p2tr) input should be signed by using the + * BIP0086 method (commit to internal key only). + * + * @generated from protobuf enum value: SIGN_METHOD_TAPROOT_KEY_SPEND_BIP0086 = 1; + */ + TAPROOT_KEY_SPEND_BIP0086 = 1, + /** + * + * Specifies that a SegWit v1 (p2tr) input should be signed by using a given + * taproot hash to commit to in addition to the internal key. + * + * @generated from protobuf enum value: SIGN_METHOD_TAPROOT_KEY_SPEND = 2; + */ + TAPROOT_KEY_SPEND = 2, + /** + * + * Specifies that a SegWit v1 (p2tr) input should be spent using the script + * path and that a specific leaf script should be signed for. + * + * @generated from protobuf enum value: SIGN_METHOD_TAPROOT_SCRIPT_SPEND = 3; + */ + TAPROOT_SCRIPT_SPEND = 3 +} +/** + * @generated from protobuf enum signrpc.MuSig2Version + */ +export enum MuSig2Version { + /** + * + * The default value on the RPC is zero for enums so we need to represent an + * invalid/undefined version by default to make sure clients upgrade their + * software to set the version explicitly. + * + * @generated from protobuf enum value: MUSIG2_VERSION_UNDEFINED = 0; + */ + MUSIG2_VERSION_UNDEFINED = 0, + /** + * + * The version of MuSig2 that lnd 0.15.x shipped with, which corresponds to the + * version v0.4.0 of the MuSig2 BIP draft. + * + * @generated from protobuf enum value: MUSIG2_VERSION_V040 = 1; + */ + MUSIG2_VERSION_V040 = 1, + /** + * + * The current version of MuSig2 which corresponds to the version v1.0.0rc2 of + * the MuSig2 BIP draft. + * + * @generated from protobuf enum value: MUSIG2_VERSION_V100RC2 = 2; + */ + MUSIG2_VERSION_V100RC2 = 2 +} +// @generated message type with reflection information, may provide speed optimized methods +class KeyLocator$Type extends MessageType { + constructor() { + super("signrpc.KeyLocator", [ + { no: 1, name: "key_family", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 2, name: "key_index", kind: "scalar", T: 5 /*ScalarType.INT32*/ } + ]); + } + create(value?: PartialMessage): KeyLocator { + const message = { keyFamily: 0, keyIndex: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KeyLocator): KeyLocator { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int32 key_family */ 1: + message.keyFamily = reader.int32(); + break; + case /* int32 key_index */ 2: + message.keyIndex = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: KeyLocator, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int32 key_family = 1; */ + if (message.keyFamily !== 0) + writer.tag(1, WireType.Varint).int32(message.keyFamily); + /* int32 key_index = 2; */ + if (message.keyIndex !== 0) + writer.tag(2, WireType.Varint).int32(message.keyIndex); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.KeyLocator + */ +export const KeyLocator = new KeyLocator$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class KeyDescriptor$Type extends MessageType { + constructor() { + super("signrpc.KeyDescriptor", [ + { no: 1, name: "raw_key_bytes", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "key_loc", kind: "message", T: () => KeyLocator } + ]); + } + create(value?: PartialMessage): KeyDescriptor { + const message = { rawKeyBytes: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KeyDescriptor): KeyDescriptor { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes raw_key_bytes */ 1: + message.rawKeyBytes = reader.bytes(); + break; + case /* signrpc.KeyLocator key_loc */ 2: + message.keyLoc = KeyLocator.internalBinaryRead(reader, reader.uint32(), options, message.keyLoc); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: KeyDescriptor, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes raw_key_bytes = 1; */ + if (message.rawKeyBytes.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.rawKeyBytes); + /* signrpc.KeyLocator key_loc = 2; */ + if (message.keyLoc) + KeyLocator.internalBinaryWrite(message.keyLoc, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.KeyDescriptor + */ +export const KeyDescriptor = new KeyDescriptor$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class TxOut$Type extends MessageType { + constructor() { + super("signrpc.TxOut", [ + { no: 1, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 2, name: "pk_script", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): TxOut { + const message = { value: 0n, pkScript: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TxOut): TxOut { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int64 value */ 1: + message.value = reader.int64().toBigInt(); + break; + case /* bytes pk_script */ 2: + message.pkScript = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: TxOut, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int64 value = 1; */ + if (message.value !== 0n) + writer.tag(1, WireType.Varint).int64(message.value); + /* bytes pk_script = 2; */ + if (message.pkScript.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.pkScript); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.TxOut + */ +export const TxOut = new TxOut$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignDescriptor$Type extends MessageType { + constructor() { + super("signrpc.SignDescriptor", [ + { no: 1, name: "key_desc", kind: "message", T: () => KeyDescriptor }, + { no: 2, name: "single_tweak", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 3, name: "double_tweak", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 10, name: "tap_tweak", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "witness_script", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 5, name: "output", kind: "message", T: () => TxOut }, + { no: 7, name: "sighash", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 8, name: "input_index", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 9, name: "sign_method", kind: "enum", T: () => ["signrpc.SignMethod", SignMethod, "SIGN_METHOD_"] } + ]); + } + create(value?: PartialMessage): SignDescriptor { + const message = { singleTweak: new Uint8Array(0), doubleTweak: new Uint8Array(0), tapTweak: new Uint8Array(0), witnessScript: new Uint8Array(0), sighash: 0, inputIndex: 0, signMethod: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignDescriptor): SignDescriptor { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* signrpc.KeyDescriptor key_desc */ 1: + message.keyDesc = KeyDescriptor.internalBinaryRead(reader, reader.uint32(), options, message.keyDesc); + break; + case /* bytes single_tweak */ 2: + message.singleTweak = reader.bytes(); + break; + case /* bytes double_tweak */ 3: + message.doubleTweak = reader.bytes(); + break; + case /* bytes tap_tweak */ 10: + message.tapTweak = reader.bytes(); + break; + case /* bytes witness_script */ 4: + message.witnessScript = reader.bytes(); + break; + case /* signrpc.TxOut output */ 5: + message.output = TxOut.internalBinaryRead(reader, reader.uint32(), options, message.output); + break; + case /* uint32 sighash */ 7: + message.sighash = reader.uint32(); + break; + case /* int32 input_index */ 8: + message.inputIndex = reader.int32(); + break; + case /* signrpc.SignMethod sign_method */ 9: + message.signMethod = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignDescriptor, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* signrpc.KeyDescriptor key_desc = 1; */ + if (message.keyDesc) + KeyDescriptor.internalBinaryWrite(message.keyDesc, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* bytes single_tweak = 2; */ + if (message.singleTweak.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.singleTweak); + /* bytes double_tweak = 3; */ + if (message.doubleTweak.length) + writer.tag(3, WireType.LengthDelimited).bytes(message.doubleTweak); + /* bytes tap_tweak = 10; */ + if (message.tapTweak.length) + writer.tag(10, WireType.LengthDelimited).bytes(message.tapTweak); + /* bytes witness_script = 4; */ + if (message.witnessScript.length) + writer.tag(4, WireType.LengthDelimited).bytes(message.witnessScript); + /* signrpc.TxOut output = 5; */ + if (message.output) + TxOut.internalBinaryWrite(message.output, writer.tag(5, WireType.LengthDelimited).fork(), options).join(); + /* uint32 sighash = 7; */ + if (message.sighash !== 0) + writer.tag(7, WireType.Varint).uint32(message.sighash); + /* int32 input_index = 8; */ + if (message.inputIndex !== 0) + writer.tag(8, WireType.Varint).int32(message.inputIndex); + /* signrpc.SignMethod sign_method = 9; */ + if (message.signMethod !== 0) + writer.tag(9, WireType.Varint).int32(message.signMethod); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.SignDescriptor + */ +export const SignDescriptor = new SignDescriptor$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignReq$Type extends MessageType { + constructor() { + super("signrpc.SignReq", [ + { no: 1, name: "raw_tx_bytes", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "sign_descs", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => SignDescriptor }, + { no: 3, name: "prev_outputs", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => TxOut } + ]); + } + create(value?: PartialMessage): SignReq { + const message = { rawTxBytes: new Uint8Array(0), signDescs: [], prevOutputs: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignReq): SignReq { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes raw_tx_bytes */ 1: + message.rawTxBytes = reader.bytes(); + break; + case /* repeated signrpc.SignDescriptor sign_descs */ 2: + message.signDescs.push(SignDescriptor.internalBinaryRead(reader, reader.uint32(), options)); + break; + case /* repeated signrpc.TxOut prev_outputs */ 3: + message.prevOutputs.push(TxOut.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignReq, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes raw_tx_bytes = 1; */ + if (message.rawTxBytes.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.rawTxBytes); + /* repeated signrpc.SignDescriptor sign_descs = 2; */ + for (let i = 0; i < message.signDescs.length; i++) + SignDescriptor.internalBinaryWrite(message.signDescs[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* repeated signrpc.TxOut prev_outputs = 3; */ + for (let i = 0; i < message.prevOutputs.length; i++) + TxOut.internalBinaryWrite(message.prevOutputs[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.SignReq + */ +export const SignReq = new SignReq$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignResp$Type extends MessageType { + constructor() { + super("signrpc.SignResp", [ + { no: 1, name: "raw_sigs", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): SignResp { + const message = { rawSigs: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignResp): SignResp { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated bytes raw_sigs */ 1: + message.rawSigs.push(reader.bytes()); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated bytes raw_sigs = 1; */ + for (let i = 0; i < message.rawSigs.length; i++) + writer.tag(1, WireType.LengthDelimited).bytes(message.rawSigs[i]); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.SignResp + */ +export const SignResp = new SignResp$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class InputScript$Type extends MessageType { + constructor() { + super("signrpc.InputScript", [ + { no: 1, name: "witness", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "sig_script", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): InputScript { + const message = { witness: [], sigScript: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InputScript): InputScript { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated bytes witness */ 1: + message.witness.push(reader.bytes()); + break; + case /* bytes sig_script */ 2: + message.sigScript = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: InputScript, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated bytes witness = 1; */ + for (let i = 0; i < message.witness.length; i++) + writer.tag(1, WireType.LengthDelimited).bytes(message.witness[i]); + /* bytes sig_script = 2; */ + if (message.sigScript.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.sigScript); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.InputScript + */ +export const InputScript = new InputScript$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class InputScriptResp$Type extends MessageType { + constructor() { + super("signrpc.InputScriptResp", [ + { no: 1, name: "input_scripts", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => InputScript } + ]); + } + create(value?: PartialMessage): InputScriptResp { + const message = { inputScripts: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InputScriptResp): InputScriptResp { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated signrpc.InputScript input_scripts */ 1: + message.inputScripts.push(InputScript.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: InputScriptResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated signrpc.InputScript input_scripts = 1; */ + for (let i = 0; i < message.inputScripts.length; i++) + InputScript.internalBinaryWrite(message.inputScripts[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.InputScriptResp + */ +export const InputScriptResp = new InputScriptResp$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignMessageReq$Type extends MessageType { + constructor() { + super("signrpc.SignMessageReq", [ + { no: 1, name: "msg", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "key_loc", kind: "message", T: () => KeyLocator }, + { no: 3, name: "double_hash", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 4, name: "compact_sig", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 5, name: "schnorr_sig", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 6, name: "schnorr_sig_tap_tweak", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 7, name: "tag", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): SignMessageReq { + const message = { msg: new Uint8Array(0), doubleHash: false, compactSig: false, schnorrSig: false, schnorrSigTapTweak: new Uint8Array(0), tag: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignMessageReq): SignMessageReq { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes msg */ 1: + message.msg = reader.bytes(); + break; + case /* signrpc.KeyLocator key_loc */ 2: + message.keyLoc = KeyLocator.internalBinaryRead(reader, reader.uint32(), options, message.keyLoc); + break; + case /* bool double_hash */ 3: + message.doubleHash = reader.bool(); + break; + case /* bool compact_sig */ 4: + message.compactSig = reader.bool(); + break; + case /* bool schnorr_sig */ 5: + message.schnorrSig = reader.bool(); + break; + case /* bytes schnorr_sig_tap_tweak */ 6: + message.schnorrSigTapTweak = reader.bytes(); + break; + case /* bytes tag */ 7: + message.tag = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignMessageReq, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes msg = 1; */ + if (message.msg.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.msg); + /* signrpc.KeyLocator key_loc = 2; */ + if (message.keyLoc) + KeyLocator.internalBinaryWrite(message.keyLoc, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* bool double_hash = 3; */ + if (message.doubleHash !== false) + writer.tag(3, WireType.Varint).bool(message.doubleHash); + /* bool compact_sig = 4; */ + if (message.compactSig !== false) + writer.tag(4, WireType.Varint).bool(message.compactSig); + /* bool schnorr_sig = 5; */ + if (message.schnorrSig !== false) + writer.tag(5, WireType.Varint).bool(message.schnorrSig); + /* bytes schnorr_sig_tap_tweak = 6; */ + if (message.schnorrSigTapTweak.length) + writer.tag(6, WireType.LengthDelimited).bytes(message.schnorrSigTapTweak); + /* bytes tag = 7; */ + if (message.tag.length) + writer.tag(7, WireType.LengthDelimited).bytes(message.tag); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.SignMessageReq + */ +export const SignMessageReq = new SignMessageReq$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignMessageResp$Type extends MessageType { + constructor() { + super("signrpc.SignMessageResp", [ + { no: 1, name: "signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): SignMessageResp { + const message = { signature: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignMessageResp): SignMessageResp { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes signature */ 1: + message.signature = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignMessageResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes signature = 1; */ + if (message.signature.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.signature); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.SignMessageResp + */ +export const SignMessageResp = new SignMessageResp$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class VerifyMessageReq$Type extends MessageType { + constructor() { + super("signrpc.VerifyMessageReq", [ + { no: 1, name: "msg", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 3, name: "pubkey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "is_schnorr_sig", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 5, name: "tag", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): VerifyMessageReq { + const message = { msg: new Uint8Array(0), signature: new Uint8Array(0), pubkey: new Uint8Array(0), isSchnorrSig: false, tag: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: VerifyMessageReq): VerifyMessageReq { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes msg */ 1: + message.msg = reader.bytes(); + break; + case /* bytes signature */ 2: + message.signature = reader.bytes(); + break; + case /* bytes pubkey */ 3: + message.pubkey = reader.bytes(); + break; + case /* bool is_schnorr_sig */ 4: + message.isSchnorrSig = reader.bool(); + break; + case /* bytes tag */ 5: + message.tag = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: VerifyMessageReq, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes msg = 1; */ + if (message.msg.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.msg); + /* bytes signature = 2; */ + if (message.signature.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.signature); + /* bytes pubkey = 3; */ + if (message.pubkey.length) + writer.tag(3, WireType.LengthDelimited).bytes(message.pubkey); + /* bool is_schnorr_sig = 4; */ + if (message.isSchnorrSig !== false) + writer.tag(4, WireType.Varint).bool(message.isSchnorrSig); + /* bytes tag = 5; */ + if (message.tag.length) + writer.tag(5, WireType.LengthDelimited).bytes(message.tag); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.VerifyMessageReq + */ +export const VerifyMessageReq = new VerifyMessageReq$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class VerifyMessageResp$Type extends MessageType { + constructor() { + super("signrpc.VerifyMessageResp", [ + { no: 1, name: "valid", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): VerifyMessageResp { + const message = { valid: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: VerifyMessageResp): VerifyMessageResp { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bool valid */ 1: + message.valid = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: VerifyMessageResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bool valid = 1; */ + if (message.valid !== false) + writer.tag(1, WireType.Varint).bool(message.valid); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.VerifyMessageResp + */ +export const VerifyMessageResp = new VerifyMessageResp$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SharedKeyRequest$Type extends MessageType { + constructor() { + super("signrpc.SharedKeyRequest", [ + { no: 1, name: "ephemeral_pubkey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "key_loc", kind: "message", T: () => KeyLocator }, + { no: 3, name: "key_desc", kind: "message", T: () => KeyDescriptor } + ]); + } + create(value?: PartialMessage): SharedKeyRequest { + const message = { ephemeralPubkey: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SharedKeyRequest): SharedKeyRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes ephemeral_pubkey */ 1: + message.ephemeralPubkey = reader.bytes(); + break; + case /* signrpc.KeyLocator key_loc = 2 [deprecated = true];*/ 2: + message.keyLoc = KeyLocator.internalBinaryRead(reader, reader.uint32(), options, message.keyLoc); + break; + case /* signrpc.KeyDescriptor key_desc */ 3: + message.keyDesc = KeyDescriptor.internalBinaryRead(reader, reader.uint32(), options, message.keyDesc); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SharedKeyRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes ephemeral_pubkey = 1; */ + if (message.ephemeralPubkey.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.ephemeralPubkey); + /* signrpc.KeyLocator key_loc = 2 [deprecated = true]; */ + if (message.keyLoc) + KeyLocator.internalBinaryWrite(message.keyLoc, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* signrpc.KeyDescriptor key_desc = 3; */ + if (message.keyDesc) + KeyDescriptor.internalBinaryWrite(message.keyDesc, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.SharedKeyRequest + */ +export const SharedKeyRequest = new SharedKeyRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SharedKeyResponse$Type extends MessageType { + constructor() { + super("signrpc.SharedKeyResponse", [ + { no: 1, name: "shared_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): SharedKeyResponse { + const message = { sharedKey: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SharedKeyResponse): SharedKeyResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes shared_key */ 1: + message.sharedKey = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SharedKeyResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes shared_key = 1; */ + if (message.sharedKey.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.sharedKey); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.SharedKeyResponse + */ +export const SharedKeyResponse = new SharedKeyResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class TweakDesc$Type extends MessageType { + constructor() { + super("signrpc.TweakDesc", [ + { no: 1, name: "tweak", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "is_x_only", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): TweakDesc { + const message = { tweak: new Uint8Array(0), isXOnly: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TweakDesc): TweakDesc { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes tweak */ 1: + message.tweak = reader.bytes(); + break; + case /* bool is_x_only */ 2: + message.isXOnly = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: TweakDesc, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes tweak = 1; */ + if (message.tweak.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.tweak); + /* bool is_x_only = 2; */ + if (message.isXOnly !== false) + writer.tag(2, WireType.Varint).bool(message.isXOnly); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.TweakDesc + */ +export const TweakDesc = new TweakDesc$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class TaprootTweakDesc$Type extends MessageType { + constructor() { + super("signrpc.TaprootTweakDesc", [ + { no: 1, name: "script_root", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "key_spend_only", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): TaprootTweakDesc { + const message = { scriptRoot: new Uint8Array(0), keySpendOnly: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TaprootTweakDesc): TaprootTweakDesc { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes script_root */ 1: + message.scriptRoot = reader.bytes(); + break; + case /* bool key_spend_only */ 2: + message.keySpendOnly = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: TaprootTweakDesc, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes script_root = 1; */ + if (message.scriptRoot.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.scriptRoot); + /* bool key_spend_only = 2; */ + if (message.keySpendOnly !== false) + writer.tag(2, WireType.Varint).bool(message.keySpendOnly); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.TaprootTweakDesc + */ +export const TaprootTweakDesc = new TaprootTweakDesc$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2CombineKeysRequest$Type extends MessageType { + constructor() { + super("signrpc.MuSig2CombineKeysRequest", [ + { no: 1, name: "all_signer_pubkeys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "tweaks", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => TweakDesc }, + { no: 3, name: "taproot_tweak", kind: "message", T: () => TaprootTweakDesc }, + { no: 4, name: "version", kind: "enum", T: () => ["signrpc.MuSig2Version", MuSig2Version] } + ]); + } + create(value?: PartialMessage): MuSig2CombineKeysRequest { + const message = { allSignerPubkeys: [], tweaks: [], version: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2CombineKeysRequest): MuSig2CombineKeysRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated bytes all_signer_pubkeys */ 1: + message.allSignerPubkeys.push(reader.bytes()); + break; + case /* repeated signrpc.TweakDesc tweaks */ 2: + message.tweaks.push(TweakDesc.internalBinaryRead(reader, reader.uint32(), options)); + break; + case /* signrpc.TaprootTweakDesc taproot_tweak */ 3: + message.taprootTweak = TaprootTweakDesc.internalBinaryRead(reader, reader.uint32(), options, message.taprootTweak); + break; + case /* signrpc.MuSig2Version version */ 4: + message.version = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2CombineKeysRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated bytes all_signer_pubkeys = 1; */ + for (let i = 0; i < message.allSignerPubkeys.length; i++) + writer.tag(1, WireType.LengthDelimited).bytes(message.allSignerPubkeys[i]); + /* repeated signrpc.TweakDesc tweaks = 2; */ + for (let i = 0; i < message.tweaks.length; i++) + TweakDesc.internalBinaryWrite(message.tweaks[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* signrpc.TaprootTweakDesc taproot_tweak = 3; */ + if (message.taprootTweak) + TaprootTweakDesc.internalBinaryWrite(message.taprootTweak, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); + /* signrpc.MuSig2Version version = 4; */ + if (message.version !== 0) + writer.tag(4, WireType.Varint).int32(message.version); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2CombineKeysRequest + */ +export const MuSig2CombineKeysRequest = new MuSig2CombineKeysRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2CombineKeysResponse$Type extends MessageType { + constructor() { + super("signrpc.MuSig2CombineKeysResponse", [ + { no: 1, name: "combined_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "taproot_internal_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "version", kind: "enum", T: () => ["signrpc.MuSig2Version", MuSig2Version] } + ]); + } + create(value?: PartialMessage): MuSig2CombineKeysResponse { + const message = { combinedKey: new Uint8Array(0), taprootInternalKey: new Uint8Array(0), version: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2CombineKeysResponse): MuSig2CombineKeysResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes combined_key */ 1: + message.combinedKey = reader.bytes(); + break; + case /* bytes taproot_internal_key */ 2: + message.taprootInternalKey = reader.bytes(); + break; + case /* signrpc.MuSig2Version version */ 4: + message.version = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2CombineKeysResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes combined_key = 1; */ + if (message.combinedKey.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.combinedKey); + /* bytes taproot_internal_key = 2; */ + if (message.taprootInternalKey.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.taprootInternalKey); + /* signrpc.MuSig2Version version = 4; */ + if (message.version !== 0) + writer.tag(4, WireType.Varint).int32(message.version); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2CombineKeysResponse + */ +export const MuSig2CombineKeysResponse = new MuSig2CombineKeysResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2SessionRequest$Type extends MessageType { + constructor() { + super("signrpc.MuSig2SessionRequest", [ + { no: 1, name: "key_loc", kind: "message", T: () => KeyLocator }, + { no: 2, name: "all_signer_pubkeys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ }, + { no: 3, name: "other_signer_public_nonces", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "tweaks", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => TweakDesc }, + { no: 5, name: "taproot_tweak", kind: "message", T: () => TaprootTweakDesc }, + { no: 6, name: "version", kind: "enum", T: () => ["signrpc.MuSig2Version", MuSig2Version] }, + { no: 7, name: "pregenerated_local_nonce", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): MuSig2SessionRequest { + const message = { allSignerPubkeys: [], otherSignerPublicNonces: [], tweaks: [], version: 0, pregeneratedLocalNonce: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2SessionRequest): MuSig2SessionRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* signrpc.KeyLocator key_loc */ 1: + message.keyLoc = KeyLocator.internalBinaryRead(reader, reader.uint32(), options, message.keyLoc); + break; + case /* repeated bytes all_signer_pubkeys */ 2: + message.allSignerPubkeys.push(reader.bytes()); + break; + case /* repeated bytes other_signer_public_nonces */ 3: + message.otherSignerPublicNonces.push(reader.bytes()); + break; + case /* repeated signrpc.TweakDesc tweaks */ 4: + message.tweaks.push(TweakDesc.internalBinaryRead(reader, reader.uint32(), options)); + break; + case /* signrpc.TaprootTweakDesc taproot_tweak */ 5: + message.taprootTweak = TaprootTweakDesc.internalBinaryRead(reader, reader.uint32(), options, message.taprootTweak); + break; + case /* signrpc.MuSig2Version version */ 6: + message.version = reader.int32(); + break; + case /* bytes pregenerated_local_nonce */ 7: + message.pregeneratedLocalNonce = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2SessionRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* signrpc.KeyLocator key_loc = 1; */ + if (message.keyLoc) + KeyLocator.internalBinaryWrite(message.keyLoc, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* repeated bytes all_signer_pubkeys = 2; */ + for (let i = 0; i < message.allSignerPubkeys.length; i++) + writer.tag(2, WireType.LengthDelimited).bytes(message.allSignerPubkeys[i]); + /* repeated bytes other_signer_public_nonces = 3; */ + for (let i = 0; i < message.otherSignerPublicNonces.length; i++) + writer.tag(3, WireType.LengthDelimited).bytes(message.otherSignerPublicNonces[i]); + /* repeated signrpc.TweakDesc tweaks = 4; */ + for (let i = 0; i < message.tweaks.length; i++) + TweakDesc.internalBinaryWrite(message.tweaks[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join(); + /* signrpc.TaprootTweakDesc taproot_tweak = 5; */ + if (message.taprootTweak) + TaprootTweakDesc.internalBinaryWrite(message.taprootTweak, writer.tag(5, WireType.LengthDelimited).fork(), options).join(); + /* signrpc.MuSig2Version version = 6; */ + if (message.version !== 0) + writer.tag(6, WireType.Varint).int32(message.version); + /* bytes pregenerated_local_nonce = 7; */ + if (message.pregeneratedLocalNonce.length) + writer.tag(7, WireType.LengthDelimited).bytes(message.pregeneratedLocalNonce); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2SessionRequest + */ +export const MuSig2SessionRequest = new MuSig2SessionRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2SessionResponse$Type extends MessageType { + constructor() { + super("signrpc.MuSig2SessionResponse", [ + { no: 1, name: "session_id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "combined_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 3, name: "taproot_internal_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "local_public_nonces", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 5, name: "have_all_nonces", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 6, name: "version", kind: "enum", T: () => ["signrpc.MuSig2Version", MuSig2Version] } + ]); + } + create(value?: PartialMessage): MuSig2SessionResponse { + const message = { sessionId: new Uint8Array(0), combinedKey: new Uint8Array(0), taprootInternalKey: new Uint8Array(0), localPublicNonces: new Uint8Array(0), haveAllNonces: false, version: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2SessionResponse): MuSig2SessionResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes session_id */ 1: + message.sessionId = reader.bytes(); + break; + case /* bytes combined_key */ 2: + message.combinedKey = reader.bytes(); + break; + case /* bytes taproot_internal_key */ 3: + message.taprootInternalKey = reader.bytes(); + break; + case /* bytes local_public_nonces */ 4: + message.localPublicNonces = reader.bytes(); + break; + case /* bool have_all_nonces */ 5: + message.haveAllNonces = reader.bool(); + break; + case /* signrpc.MuSig2Version version */ 6: + message.version = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2SessionResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes session_id = 1; */ + if (message.sessionId.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.sessionId); + /* bytes combined_key = 2; */ + if (message.combinedKey.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.combinedKey); + /* bytes taproot_internal_key = 3; */ + if (message.taprootInternalKey.length) + writer.tag(3, WireType.LengthDelimited).bytes(message.taprootInternalKey); + /* bytes local_public_nonces = 4; */ + if (message.localPublicNonces.length) + writer.tag(4, WireType.LengthDelimited).bytes(message.localPublicNonces); + /* bool have_all_nonces = 5; */ + if (message.haveAllNonces !== false) + writer.tag(5, WireType.Varint).bool(message.haveAllNonces); + /* signrpc.MuSig2Version version = 6; */ + if (message.version !== 0) + writer.tag(6, WireType.Varint).int32(message.version); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2SessionResponse + */ +export const MuSig2SessionResponse = new MuSig2SessionResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2RegisterNoncesRequest$Type extends MessageType { + constructor() { + super("signrpc.MuSig2RegisterNoncesRequest", [ + { no: 1, name: "session_id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 3, name: "other_signer_public_nonces", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): MuSig2RegisterNoncesRequest { + const message = { sessionId: new Uint8Array(0), otherSignerPublicNonces: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2RegisterNoncesRequest): MuSig2RegisterNoncesRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes session_id */ 1: + message.sessionId = reader.bytes(); + break; + case /* repeated bytes other_signer_public_nonces */ 3: + message.otherSignerPublicNonces.push(reader.bytes()); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2RegisterNoncesRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes session_id = 1; */ + if (message.sessionId.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.sessionId); + /* repeated bytes other_signer_public_nonces = 3; */ + for (let i = 0; i < message.otherSignerPublicNonces.length; i++) + writer.tag(3, WireType.LengthDelimited).bytes(message.otherSignerPublicNonces[i]); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2RegisterNoncesRequest + */ +export const MuSig2RegisterNoncesRequest = new MuSig2RegisterNoncesRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2RegisterNoncesResponse$Type extends MessageType { + constructor() { + super("signrpc.MuSig2RegisterNoncesResponse", [ + { no: 1, name: "have_all_nonces", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): MuSig2RegisterNoncesResponse { + const message = { haveAllNonces: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2RegisterNoncesResponse): MuSig2RegisterNoncesResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bool have_all_nonces */ 1: + message.haveAllNonces = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2RegisterNoncesResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bool have_all_nonces = 1; */ + if (message.haveAllNonces !== false) + writer.tag(1, WireType.Varint).bool(message.haveAllNonces); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2RegisterNoncesResponse + */ +export const MuSig2RegisterNoncesResponse = new MuSig2RegisterNoncesResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2SignRequest$Type extends MessageType { + constructor() { + super("signrpc.MuSig2SignRequest", [ + { no: 1, name: "session_id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "message_digest", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 3, name: "cleanup", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): MuSig2SignRequest { + const message = { sessionId: new Uint8Array(0), messageDigest: new Uint8Array(0), cleanup: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2SignRequest): MuSig2SignRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes session_id */ 1: + message.sessionId = reader.bytes(); + break; + case /* bytes message_digest */ 2: + message.messageDigest = reader.bytes(); + break; + case /* bool cleanup */ 3: + message.cleanup = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2SignRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes session_id = 1; */ + if (message.sessionId.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.sessionId); + /* bytes message_digest = 2; */ + if (message.messageDigest.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.messageDigest); + /* bool cleanup = 3; */ + if (message.cleanup !== false) + writer.tag(3, WireType.Varint).bool(message.cleanup); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2SignRequest + */ +export const MuSig2SignRequest = new MuSig2SignRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2SignResponse$Type extends MessageType { + constructor() { + super("signrpc.MuSig2SignResponse", [ + { no: 1, name: "local_partial_signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): MuSig2SignResponse { + const message = { localPartialSignature: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2SignResponse): MuSig2SignResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes local_partial_signature */ 1: + message.localPartialSignature = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2SignResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes local_partial_signature = 1; */ + if (message.localPartialSignature.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.localPartialSignature); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2SignResponse + */ +export const MuSig2SignResponse = new MuSig2SignResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2CombineSigRequest$Type extends MessageType { + constructor() { + super("signrpc.MuSig2CombineSigRequest", [ + { no: 1, name: "session_id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "other_partial_signatures", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): MuSig2CombineSigRequest { + const message = { sessionId: new Uint8Array(0), otherPartialSignatures: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2CombineSigRequest): MuSig2CombineSigRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes session_id */ 1: + message.sessionId = reader.bytes(); + break; + case /* repeated bytes other_partial_signatures */ 2: + message.otherPartialSignatures.push(reader.bytes()); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2CombineSigRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes session_id = 1; */ + if (message.sessionId.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.sessionId); + /* repeated bytes other_partial_signatures = 2; */ + for (let i = 0; i < message.otherPartialSignatures.length; i++) + writer.tag(2, WireType.LengthDelimited).bytes(message.otherPartialSignatures[i]); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2CombineSigRequest + */ +export const MuSig2CombineSigRequest = new MuSig2CombineSigRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2CombineSigResponse$Type extends MessageType { + constructor() { + super("signrpc.MuSig2CombineSigResponse", [ + { no: 1, name: "have_all_signatures", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 2, name: "final_signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): MuSig2CombineSigResponse { + const message = { haveAllSignatures: false, finalSignature: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2CombineSigResponse): MuSig2CombineSigResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bool have_all_signatures */ 1: + message.haveAllSignatures = reader.bool(); + break; + case /* bytes final_signature */ 2: + message.finalSignature = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2CombineSigResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bool have_all_signatures = 1; */ + if (message.haveAllSignatures !== false) + writer.tag(1, WireType.Varint).bool(message.haveAllSignatures); + /* bytes final_signature = 2; */ + if (message.finalSignature.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.finalSignature); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2CombineSigResponse + */ +export const MuSig2CombineSigResponse = new MuSig2CombineSigResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2CleanupRequest$Type extends MessageType { + constructor() { + super("signrpc.MuSig2CleanupRequest", [ + { no: 1, name: "session_id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): MuSig2CleanupRequest { + const message = { sessionId: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2CleanupRequest): MuSig2CleanupRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes session_id */ 1: + message.sessionId = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: MuSig2CleanupRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes session_id = 1; */ + if (message.sessionId.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.sessionId); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2CleanupRequest + */ +export const MuSig2CleanupRequest = new MuSig2CleanupRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class MuSig2CleanupResponse$Type extends MessageType { + constructor() { + super("signrpc.MuSig2CleanupResponse", []); + } + create(value?: PartialMessage): MuSig2CleanupResponse { + const message = {}; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MuSig2CleanupResponse): MuSig2CleanupResponse { + return target ?? this.create(); + } + internalBinaryWrite(message: MuSig2CleanupResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message signrpc.MuSig2CleanupResponse + */ +export const MuSig2CleanupResponse = new MuSig2CleanupResponse$Type(); +/** + * @generated ServiceType for protobuf service signrpc.Signer + */ +export const Signer = new ServiceType("signrpc.Signer", [ + { name: "SignOutputRaw", options: {}, I: SignReq, O: SignResp }, + { name: "ComputeInputScript", options: {}, I: SignReq, O: InputScriptResp }, + { name: "SignMessage", options: {}, I: SignMessageReq, O: SignMessageResp }, + { name: "VerifyMessage", options: {}, I: VerifyMessageReq, O: VerifyMessageResp }, + { name: "DeriveSharedKey", options: {}, I: SharedKeyRequest, O: SharedKeyResponse }, + { name: "MuSig2CombineKeys", options: {}, I: MuSig2CombineKeysRequest, O: MuSig2CombineKeysResponse }, + { name: "MuSig2CreateSession", options: {}, I: MuSig2SessionRequest, O: MuSig2SessionResponse }, + { name: "MuSig2RegisterNonces", options: {}, I: MuSig2RegisterNoncesRequest, O: MuSig2RegisterNoncesResponse }, + { name: "MuSig2Sign", options: {}, I: MuSig2SignRequest, O: MuSig2SignResponse }, + { name: "MuSig2CombineSig", options: {}, I: MuSig2CombineSigRequest, O: MuSig2CombineSigResponse }, + { name: "MuSig2Cleanup", options: {}, I: MuSig2CleanupRequest, O: MuSig2CleanupResponse } +]); diff --git a/proto/lnd/walletkit.client.ts b/proto/lnd/walletkit.client.ts new file mode 100644 index 00000000..f47734ab --- /dev/null +++ b/proto/lnd/walletkit.client.ts @@ -0,0 +1,958 @@ +// @generated by protobuf-ts 2.8.1 +// @generated from protobuf file "walletkit.proto" (package "walletrpc", syntax proto3) +// tslint:disable +import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; +import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; +import { WalletKit } from "./walletkit"; +import type { FinalizePsbtResponse } from "./walletkit"; +import type { FinalizePsbtRequest } from "./walletkit"; +import type { SignPsbtResponse } from "./walletkit"; +import type { SignPsbtRequest } from "./walletkit"; +import type { FundPsbtResponse } from "./walletkit"; +import type { FundPsbtRequest } from "./walletkit"; +import type { LabelTransactionResponse } from "./walletkit"; +import type { LabelTransactionRequest } from "./walletkit"; +import type { ListSweepsResponse } from "./walletkit"; +import type { ListSweepsRequest } from "./walletkit"; +import type { BumpForceCloseFeeResponse } from "./walletkit"; +import type { BumpForceCloseFeeRequest } from "./walletkit"; +import type { BumpFeeResponse } from "./walletkit"; +import type { BumpFeeRequest } from "./walletkit"; +import type { PendingSweepsResponse } from "./walletkit"; +import type { PendingSweepsRequest } from "./walletkit"; +import type { EstimateFeeResponse } from "./walletkit"; +import type { EstimateFeeRequest } from "./walletkit"; +import type { SendOutputsResponse } from "./walletkit"; +import type { SendOutputsRequest } from "./walletkit"; +import type { RemoveTransactionResponse } from "./walletkit"; +import type { PublishResponse } from "./walletkit"; +import type { Transaction as Transaction$ } from "./walletkit"; +import type { ImportTapscriptResponse } from "./walletkit"; +import type { ImportTapscriptRequest } from "./walletkit"; +import type { ImportPublicKeyResponse } from "./walletkit"; +import type { ImportPublicKeyRequest } from "./walletkit"; +import type { ImportAccountResponse } from "./walletkit"; +import type { ImportAccountRequest } from "./walletkit"; +import type { VerifyMessageWithAddrResponse } from "./walletkit"; +import type { VerifyMessageWithAddrRequest } from "./walletkit"; +import type { SignMessageWithAddrResponse } from "./walletkit"; +import type { SignMessageWithAddrRequest } from "./walletkit"; +import type { ListAddressesResponse } from "./walletkit"; +import type { ListAddressesRequest } from "./walletkit"; +import type { RequiredReserveResponse } from "./walletkit"; +import type { RequiredReserveRequest } from "./walletkit"; +import type { ListAccountsResponse } from "./walletkit"; +import type { ListAccountsRequest } from "./walletkit"; +import type { Transaction } from "./lightning"; +import type { GetTransactionRequest } from "./walletkit"; +import type { AddrResponse } from "./walletkit"; +import type { AddrRequest } from "./walletkit"; +import type { KeyLocator } from "./signer"; +import type { KeyDescriptor } from "./signer"; +import type { KeyReq } from "./walletkit"; +import type { ListLeasesResponse } from "./walletkit"; +import type { ListLeasesRequest } from "./walletkit"; +import type { ReleaseOutputResponse } from "./walletkit"; +import type { ReleaseOutputRequest } from "./walletkit"; +import type { LeaseOutputResponse } from "./walletkit"; +import type { LeaseOutputRequest } from "./walletkit"; +import { stackIntercept } from "@protobuf-ts/runtime-rpc"; +import type { ListUnspentResponse } from "./walletkit"; +import type { ListUnspentRequest } from "./walletkit"; +import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; +import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; +// +// Comments in this file will be directly parsed into the API +// Documentation as descriptions of the associated method, message, or field. +// These descriptions should go right above the definition of the object, and +// can be in either block or // comment format. +// +// An RPC method can be matched to an lncli command by placing a line in the +// beginning of the description in exactly the following format: +// lncli: `methodname` +// +// Failure to specify the exact name of the command will cause documentation +// generation to fail. +// +// More information on how exactly the gRPC documentation is generated from +// this proto file can be found here: +// https://github.com/lightninglabs/lightning-api + +/** + * WalletKit is a service that gives access to the core functionalities of the + * daemon's wallet. + * + * @generated from protobuf service walletrpc.WalletKit + */ +export interface IWalletKitClient { + /** + * + * ListUnspent returns a list of all utxos spendable by the wallet with a + * number of confirmations between the specified minimum and maximum. By + * default, all utxos are listed. To list only the unconfirmed utxos, set + * the unconfirmed_only to true. + * + * @generated from protobuf rpc: ListUnspent(walletrpc.ListUnspentRequest) returns (walletrpc.ListUnspentResponse); + */ + listUnspent(input: ListUnspentRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet leaseoutput` + * LeaseOutput locks an output to the given ID, preventing it from being + * available for any future coin selection attempts. The absolute time of the + * lock's expiration is returned. The expiration of the lock can be extended by + * successive invocations of this RPC. Outputs can be unlocked before their + * expiration through `ReleaseOutput`. + * + * @generated from protobuf rpc: LeaseOutput(walletrpc.LeaseOutputRequest) returns (walletrpc.LeaseOutputResponse); + */ + leaseOutput(input: LeaseOutputRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet releaseoutput` + * ReleaseOutput unlocks an output, allowing it to be available for coin + * selection if it remains unspent. The ID should match the one used to + * originally lock the output. + * + * @generated from protobuf rpc: ReleaseOutput(walletrpc.ReleaseOutputRequest) returns (walletrpc.ReleaseOutputResponse); + */ + releaseOutput(input: ReleaseOutputRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet listleases` + * ListLeases lists all currently locked utxos. + * + * @generated from protobuf rpc: ListLeases(walletrpc.ListLeasesRequest) returns (walletrpc.ListLeasesResponse); + */ + listLeases(input: ListLeasesRequest, options?: RpcOptions): UnaryCall; + /** + * + * DeriveNextKey attempts to derive the *next* key within the key family + * (account in BIP43) specified. This method should return the next external + * child within this branch. + * + * @generated from protobuf rpc: DeriveNextKey(walletrpc.KeyReq) returns (signrpc.KeyDescriptor); + */ + deriveNextKey(input: KeyReq, options?: RpcOptions): UnaryCall; + /** + * + * DeriveKey attempts to derive an arbitrary key specified by the passed + * KeyLocator. + * + * @generated from protobuf rpc: DeriveKey(signrpc.KeyLocator) returns (signrpc.KeyDescriptor); + */ + deriveKey(input: KeyLocator, options?: RpcOptions): UnaryCall; + /** + * + * NextAddr returns the next unused address within the wallet. + * + * @generated from protobuf rpc: NextAddr(walletrpc.AddrRequest) returns (walletrpc.AddrResponse); + */ + nextAddr(input: AddrRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet gettx` + * GetTransaction returns details for a transaction found in the wallet. + * + * @generated from protobuf rpc: GetTransaction(walletrpc.GetTransactionRequest) returns (lnrpc.Transaction); + */ + getTransaction(input: GetTransactionRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet accounts list` + * ListAccounts retrieves all accounts belonging to the wallet by default. A + * name and key scope filter can be provided to filter through all of the + * wallet accounts and return only those matching. + * + * @generated from protobuf rpc: ListAccounts(walletrpc.ListAccountsRequest) returns (walletrpc.ListAccountsResponse); + */ + listAccounts(input: ListAccountsRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet requiredreserve` + * RequiredReserve returns the minimum amount of satoshis that should be kept + * in the wallet in order to fee bump anchor channels if necessary. The value + * scales with the number of public anchor channels but is capped at a maximum. + * + * @generated from protobuf rpc: RequiredReserve(walletrpc.RequiredReserveRequest) returns (walletrpc.RequiredReserveResponse); + */ + requiredReserve(input: RequiredReserveRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet addresses list` + * ListAddresses retrieves all the addresses along with their balance. An + * account name filter can be provided to filter through all of the + * wallet accounts and return the addresses of only those matching. + * + * @generated from protobuf rpc: ListAddresses(walletrpc.ListAddressesRequest) returns (walletrpc.ListAddressesResponse); + */ + listAddresses(input: ListAddressesRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet addresses signmessage` + * SignMessageWithAddr returns the compact signature (base64 encoded) created + * with the private key of the provided address. This requires the address + * to be solely based on a public key lock (no scripts). Obviously the internal + * lnd wallet has to possess the private key of the address otherwise + * an error is returned. + * + * This method aims to provide full compatibility with the bitcoin-core and + * btcd implementation. Bitcoin-core's algorithm is not specified in a + * BIP and only applicable for legacy addresses. This method enhances the + * signing for additional address types: P2WKH, NP2WKH, P2TR. + * For P2TR addresses this represents a special case. ECDSA is used to create + * a compact signature which makes the public key of the signature recoverable. + * + * @generated from protobuf rpc: SignMessageWithAddr(walletrpc.SignMessageWithAddrRequest) returns (walletrpc.SignMessageWithAddrResponse); + */ + signMessageWithAddr(input: SignMessageWithAddrRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet addresses verifymessage` + * VerifyMessageWithAddr returns the validity and the recovered public key of + * the provided compact signature (base64 encoded). The verification is + * twofold. First the validity of the signature itself is checked and then + * it is verified that the recovered public key of the signature equals + * the public key of the provided address. There is no dependence on the + * private key of the address therefore also external addresses are allowed + * to verify signatures. + * Supported address types are P2PKH, P2WKH, NP2WKH, P2TR. + * + * This method is the counterpart of the related signing method + * (SignMessageWithAddr) and aims to provide full compatibility to + * bitcoin-core's implementation. Although bitcoin-core/btcd only provide + * this functionality for legacy addresses this function enhances it to + * the address types: P2PKH, P2WKH, NP2WKH, P2TR. + * + * The verification for P2TR addresses is a special case and requires the + * ECDSA compact signature to compare the reovered public key to the internal + * taproot key. The compact ECDSA signature format was used because there + * are still no known compact signature schemes for schnorr signatures. + * + * @generated from protobuf rpc: VerifyMessageWithAddr(walletrpc.VerifyMessageWithAddrRequest) returns (walletrpc.VerifyMessageWithAddrResponse); + */ + verifyMessageWithAddr(input: VerifyMessageWithAddrRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet accounts import` + * ImportAccount imports an account backed by an account extended public key. + * The master key fingerprint denotes the fingerprint of the root key + * corresponding to the account public key (also known as the key with + * derivation path m/). This may be required by some hardware wallets for + * proper identification and signing. + * + * The address type can usually be inferred from the key's version, but may be + * required for certain keys to map them into the proper scope. + * + * For BIP-0044 keys, an address type must be specified as we intend to not + * support importing BIP-0044 keys into the wallet using the legacy + * pay-to-pubkey-hash (P2PKH) scheme. A nested witness address type will force + * the standard BIP-0049 derivation scheme, while a witness address type will + * force the standard BIP-0084 derivation scheme. + * + * For BIP-0049 keys, an address type must also be specified to make a + * distinction between the standard BIP-0049 address schema (nested witness + * pubkeys everywhere) and our own BIP-0049Plus address schema (nested pubkeys + * externally, witness pubkeys internally). + * + * NOTE: Events (deposits/spends) for keys derived from an account will only be + * detected by lnd if they happen after the import. Rescans to detect past + * events will be supported later on. + * + * @generated from protobuf rpc: ImportAccount(walletrpc.ImportAccountRequest) returns (walletrpc.ImportAccountResponse); + */ + importAccount(input: ImportAccountRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet accounts import-pubkey` + * ImportPublicKey imports a public key as watch-only into the wallet. The + * public key is converted into a simple address of the given type and that + * address script is watched on chain. For Taproot keys, this will only watch + * the BIP-0086 style output script. Use ImportTapscript for more advanced key + * spend or script spend outputs. + * + * NOTE: Events (deposits/spends) for a key will only be detected by lnd if + * they happen after the import. Rescans to detect past events will be + * supported later on. + * + * @generated from protobuf rpc: ImportPublicKey(walletrpc.ImportPublicKeyRequest) returns (walletrpc.ImportPublicKeyResponse); + */ + importPublicKey(input: ImportPublicKeyRequest, options?: RpcOptions): UnaryCall; + /** + * + * ImportTapscript imports a Taproot script and internal key and adds the + * resulting Taproot output key as a watch-only output script into the wallet. + * For BIP-0086 style Taproot keys (no root hash commitment and no script spend + * path) use ImportPublicKey. + * + * NOTE: Events (deposits/spends) for a key will only be detected by lnd if + * they happen after the import. Rescans to detect past events will be + * supported later on. + * + * NOTE: Taproot keys imported through this RPC currently _cannot_ be used for + * funding PSBTs. Only tracking the balance and UTXOs is currently supported. + * + * @generated from protobuf rpc: ImportTapscript(walletrpc.ImportTapscriptRequest) returns (walletrpc.ImportTapscriptResponse); + */ + importTapscript(input: ImportTapscriptRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet publishtx` + * PublishTransaction attempts to publish the passed transaction to the + * network. Once this returns without an error, the wallet will continually + * attempt to re-broadcast the transaction on start up, until it enters the + * chain. + * + * @generated from protobuf rpc: PublishTransaction(walletrpc.Transaction) returns (walletrpc.PublishResponse); + */ + publishTransaction(input: Transaction$, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet removetx` + * RemoveTransaction attempts to remove the provided transaction from the + * internal transaction store of the wallet. + * + * @generated from protobuf rpc: RemoveTransaction(walletrpc.GetTransactionRequest) returns (walletrpc.RemoveTransactionResponse); + */ + removeTransaction(input: GetTransactionRequest, options?: RpcOptions): UnaryCall; + /** + * + * SendOutputs is similar to the existing sendmany call in Bitcoind, and + * allows the caller to create a transaction that sends to several outputs at + * once. This is ideal when wanting to batch create a set of transactions. + * + * @generated from protobuf rpc: SendOutputs(walletrpc.SendOutputsRequest) returns (walletrpc.SendOutputsResponse); + */ + sendOutputs(input: SendOutputsRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet estimatefeerate` + * EstimateFee attempts to query the internal fee estimator of the wallet to + * determine the fee (in sat/kw) to attach to a transaction in order to + * achieve the confirmation target. + * + * @generated from protobuf rpc: EstimateFee(walletrpc.EstimateFeeRequest) returns (walletrpc.EstimateFeeResponse); + */ + estimateFee(input: EstimateFeeRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet pendingsweeps` + * PendingSweeps returns lists of on-chain outputs that lnd is currently + * attempting to sweep within its central batching engine. Outputs with similar + * fee rates are batched together in order to sweep them within a single + * transaction. + * + * NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to + * remain supported. This is an advanced API that depends on the internals of + * the UtxoSweeper, so things may change. + * + * @generated from protobuf rpc: PendingSweeps(walletrpc.PendingSweepsRequest) returns (walletrpc.PendingSweepsResponse); + */ + pendingSweeps(input: PendingSweepsRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet bumpfee` + * BumpFee is an endpoint that allows users to interact with lnd's sweeper + * directly. It takes an outpoint from an unconfirmed transaction and sends it + * to the sweeper for potential fee bumping. Depending on whether the outpoint + * has been registered in the sweeper (an existing input, e.g., an anchor + * output) or not (a new input, e.g., an unconfirmed wallet utxo), this will + * either be an RBF or CPFP attempt. + * + * When receiving an input, lnd’s sweeper needs to understand its time + * sensitivity to make economical fee bumps - internally a fee function is + * created using the deadline and budget to guide the process. When the + * deadline is approaching, the fee function will increase the fee rate and + * perform an RBF. + * + * When a force close happens, all the outputs from the force closing + * transaction will be registered in the sweeper. The sweeper will then handle + * the creation, publish, and fee bumping of the sweeping transactions. + * Everytime a new block comes in, unless the sweeping transaction is + * confirmed, an RBF is attempted. To interfere with this automatic process, + * users can use BumpFee to specify customized fee rate, budget, deadline, and + * whether the sweep should happen immediately. It's recommended to call + * `ListSweeps` to understand the shape of the existing sweeping transaction + * first - depending on the number of inputs in this transaction, the RBF + * requirements can be quite different. + * + * This RPC also serves useful when wanting to perform a Child-Pays-For-Parent + * (CPFP), where the child transaction pays for its parent's fee. This can be + * done by specifying an outpoint within the low fee transaction that is under + * the control of the wallet. + * + * @generated from protobuf rpc: BumpFee(walletrpc.BumpFeeRequest) returns (walletrpc.BumpFeeResponse); + */ + bumpFee(input: BumpFeeRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet bumpforceclosefee` + * BumpForceCloseFee is an endpoint that allows users to bump the fee of a + * channel force close. This only works for channels with option_anchors. + * + * @generated from protobuf rpc: BumpForceCloseFee(walletrpc.BumpForceCloseFeeRequest) returns (walletrpc.BumpForceCloseFeeResponse); + */ + bumpForceCloseFee(input: BumpForceCloseFeeRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet listsweeps` + * ListSweeps returns a list of the sweep transactions our node has produced. + * Note that these sweeps may not be confirmed yet, as we record sweeps on + * broadcast, not confirmation. + * + * @generated from protobuf rpc: ListSweeps(walletrpc.ListSweepsRequest) returns (walletrpc.ListSweepsResponse); + */ + listSweeps(input: ListSweepsRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet labeltx` + * LabelTransaction adds a label to a transaction. If the transaction already + * has a label the call will fail unless the overwrite bool is set. This will + * overwrite the existing transaction label. Labels must not be empty, and + * cannot exceed 500 characters. + * + * @generated from protobuf rpc: LabelTransaction(walletrpc.LabelTransactionRequest) returns (walletrpc.LabelTransactionResponse); + */ + labelTransaction(input: LabelTransactionRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet psbt fund` + * FundPsbt creates a fully populated PSBT that contains enough inputs to fund + * the outputs specified in the template. There are three ways a user can + * specify what we call the template (a list of inputs and outputs to use in + * the PSBT): Either as a PSBT packet directly with no coin selection (using + * the legacy "psbt" field), a PSBT with advanced coin selection support (using + * the new "coin_select" field) or as a raw RPC message (using the "raw" + * field). + * The legacy "psbt" and "raw" modes, the following restrictions apply: + * 1. If there are no inputs specified in the template, coin selection is + * performed automatically. + * 2. If the template does contain any inputs, it is assumed that full + * coin selection happened externally and no additional inputs are added. If + * the specified inputs aren't enough to fund the outputs with the given fee + * rate, an error is returned. + * + * The new "coin_select" mode does not have these restrictions and allows the + * user to specify a PSBT with inputs and outputs and still perform coin + * selection on top of that. + * For all modes this RPC requires any inputs that are specified to be locked + * by the user (if they belong to this node in the first place). + * + * After either selecting or verifying the inputs, all input UTXOs are locked + * with an internal app ID. + * + * NOTE: If this method returns without an error, it is the caller's + * responsibility to either spend the locked UTXOs (by finalizing and then + * publishing the transaction) or to unlock/release the locked UTXOs in case of + * an error on the caller's side. + * + * @generated from protobuf rpc: FundPsbt(walletrpc.FundPsbtRequest) returns (walletrpc.FundPsbtResponse); + */ + fundPsbt(input: FundPsbtRequest, options?: RpcOptions): UnaryCall; + /** + * + * SignPsbt expects a partial transaction with all inputs and outputs fully + * declared and tries to sign all unsigned inputs that have all required fields + * (UTXO information, BIP32 derivation information, witness or sig scripts) + * set. + * If no error is returned, the PSBT is ready to be given to the next signer or + * to be finalized if lnd was the last signer. + * + * NOTE: This RPC only signs inputs (and only those it can sign), it does not + * perform any other tasks (such as coin selection, UTXO locking or + * input/output/fee value validation, PSBT finalization). Any input that is + * incomplete will be skipped. + * + * @generated from protobuf rpc: SignPsbt(walletrpc.SignPsbtRequest) returns (walletrpc.SignPsbtResponse); + */ + signPsbt(input: SignPsbtRequest, options?: RpcOptions): UnaryCall; + /** + * lncli: `wallet psbt finalize` + * FinalizePsbt expects a partial transaction with all inputs and outputs fully + * declared and tries to sign all inputs that belong to the wallet. Lnd must be + * the last signer of the transaction. That means, if there are any unsigned + * non-witness inputs or inputs without UTXO information attached or inputs + * without witness data that do not belong to lnd's wallet, this method will + * fail. If no error is returned, the PSBT is ready to be extracted and the + * final TX within to be broadcast. + * + * NOTE: This method does NOT publish the transaction once finalized. It is the + * caller's responsibility to either publish the transaction on success or + * unlock/release any locked UTXOs in case of an error in this method. + * + * @generated from protobuf rpc: FinalizePsbt(walletrpc.FinalizePsbtRequest) returns (walletrpc.FinalizePsbtResponse); + */ + finalizePsbt(input: FinalizePsbtRequest, options?: RpcOptions): UnaryCall; +} +// +// Comments in this file will be directly parsed into the API +// Documentation as descriptions of the associated method, message, or field. +// These descriptions should go right above the definition of the object, and +// can be in either block or // comment format. +// +// An RPC method can be matched to an lncli command by placing a line in the +// beginning of the description in exactly the following format: +// lncli: `methodname` +// +// Failure to specify the exact name of the command will cause documentation +// generation to fail. +// +// More information on how exactly the gRPC documentation is generated from +// this proto file can be found here: +// https://github.com/lightninglabs/lightning-api + +/** + * WalletKit is a service that gives access to the core functionalities of the + * daemon's wallet. + * + * @generated from protobuf service walletrpc.WalletKit + */ +export class WalletKitClient implements IWalletKitClient, ServiceInfo { + typeName = WalletKit.typeName; + methods = WalletKit.methods; + options = WalletKit.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * + * ListUnspent returns a list of all utxos spendable by the wallet with a + * number of confirmations between the specified minimum and maximum. By + * default, all utxos are listed. To list only the unconfirmed utxos, set + * the unconfirmed_only to true. + * + * @generated from protobuf rpc: ListUnspent(walletrpc.ListUnspentRequest) returns (walletrpc.ListUnspentResponse); + */ + listUnspent(input: ListUnspentRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet leaseoutput` + * LeaseOutput locks an output to the given ID, preventing it from being + * available for any future coin selection attempts. The absolute time of the + * lock's expiration is returned. The expiration of the lock can be extended by + * successive invocations of this RPC. Outputs can be unlocked before their + * expiration through `ReleaseOutput`. + * + * @generated from protobuf rpc: LeaseOutput(walletrpc.LeaseOutputRequest) returns (walletrpc.LeaseOutputResponse); + */ + leaseOutput(input: LeaseOutputRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet releaseoutput` + * ReleaseOutput unlocks an output, allowing it to be available for coin + * selection if it remains unspent. The ID should match the one used to + * originally lock the output. + * + * @generated from protobuf rpc: ReleaseOutput(walletrpc.ReleaseOutputRequest) returns (walletrpc.ReleaseOutputResponse); + */ + releaseOutput(input: ReleaseOutputRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet listleases` + * ListLeases lists all currently locked utxos. + * + * @generated from protobuf rpc: ListLeases(walletrpc.ListLeasesRequest) returns (walletrpc.ListLeasesResponse); + */ + listLeases(input: ListLeasesRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[3], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * DeriveNextKey attempts to derive the *next* key within the key family + * (account in BIP43) specified. This method should return the next external + * child within this branch. + * + * @generated from protobuf rpc: DeriveNextKey(walletrpc.KeyReq) returns (signrpc.KeyDescriptor); + */ + deriveNextKey(input: KeyReq, options?: RpcOptions): UnaryCall { + const method = this.methods[4], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * DeriveKey attempts to derive an arbitrary key specified by the passed + * KeyLocator. + * + * @generated from protobuf rpc: DeriveKey(signrpc.KeyLocator) returns (signrpc.KeyDescriptor); + */ + deriveKey(input: KeyLocator, options?: RpcOptions): UnaryCall { + const method = this.methods[5], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * NextAddr returns the next unused address within the wallet. + * + * @generated from protobuf rpc: NextAddr(walletrpc.AddrRequest) returns (walletrpc.AddrResponse); + */ + nextAddr(input: AddrRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[6], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet gettx` + * GetTransaction returns details for a transaction found in the wallet. + * + * @generated from protobuf rpc: GetTransaction(walletrpc.GetTransactionRequest) returns (lnrpc.Transaction); + */ + getTransaction(input: GetTransactionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[7], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet accounts list` + * ListAccounts retrieves all accounts belonging to the wallet by default. A + * name and key scope filter can be provided to filter through all of the + * wallet accounts and return only those matching. + * + * @generated from protobuf rpc: ListAccounts(walletrpc.ListAccountsRequest) returns (walletrpc.ListAccountsResponse); + */ + listAccounts(input: ListAccountsRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[8], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet requiredreserve` + * RequiredReserve returns the minimum amount of satoshis that should be kept + * in the wallet in order to fee bump anchor channels if necessary. The value + * scales with the number of public anchor channels but is capped at a maximum. + * + * @generated from protobuf rpc: RequiredReserve(walletrpc.RequiredReserveRequest) returns (walletrpc.RequiredReserveResponse); + */ + requiredReserve(input: RequiredReserveRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[9], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet addresses list` + * ListAddresses retrieves all the addresses along with their balance. An + * account name filter can be provided to filter through all of the + * wallet accounts and return the addresses of only those matching. + * + * @generated from protobuf rpc: ListAddresses(walletrpc.ListAddressesRequest) returns (walletrpc.ListAddressesResponse); + */ + listAddresses(input: ListAddressesRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[10], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet addresses signmessage` + * SignMessageWithAddr returns the compact signature (base64 encoded) created + * with the private key of the provided address. This requires the address + * to be solely based on a public key lock (no scripts). Obviously the internal + * lnd wallet has to possess the private key of the address otherwise + * an error is returned. + * + * This method aims to provide full compatibility with the bitcoin-core and + * btcd implementation. Bitcoin-core's algorithm is not specified in a + * BIP and only applicable for legacy addresses. This method enhances the + * signing for additional address types: P2WKH, NP2WKH, P2TR. + * For P2TR addresses this represents a special case. ECDSA is used to create + * a compact signature which makes the public key of the signature recoverable. + * + * @generated from protobuf rpc: SignMessageWithAddr(walletrpc.SignMessageWithAddrRequest) returns (walletrpc.SignMessageWithAddrResponse); + */ + signMessageWithAddr(input: SignMessageWithAddrRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[11], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet addresses verifymessage` + * VerifyMessageWithAddr returns the validity and the recovered public key of + * the provided compact signature (base64 encoded). The verification is + * twofold. First the validity of the signature itself is checked and then + * it is verified that the recovered public key of the signature equals + * the public key of the provided address. There is no dependence on the + * private key of the address therefore also external addresses are allowed + * to verify signatures. + * Supported address types are P2PKH, P2WKH, NP2WKH, P2TR. + * + * This method is the counterpart of the related signing method + * (SignMessageWithAddr) and aims to provide full compatibility to + * bitcoin-core's implementation. Although bitcoin-core/btcd only provide + * this functionality for legacy addresses this function enhances it to + * the address types: P2PKH, P2WKH, NP2WKH, P2TR. + * + * The verification for P2TR addresses is a special case and requires the + * ECDSA compact signature to compare the reovered public key to the internal + * taproot key. The compact ECDSA signature format was used because there + * are still no known compact signature schemes for schnorr signatures. + * + * @generated from protobuf rpc: VerifyMessageWithAddr(walletrpc.VerifyMessageWithAddrRequest) returns (walletrpc.VerifyMessageWithAddrResponse); + */ + verifyMessageWithAddr(input: VerifyMessageWithAddrRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[12], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet accounts import` + * ImportAccount imports an account backed by an account extended public key. + * The master key fingerprint denotes the fingerprint of the root key + * corresponding to the account public key (also known as the key with + * derivation path m/). This may be required by some hardware wallets for + * proper identification and signing. + * + * The address type can usually be inferred from the key's version, but may be + * required for certain keys to map them into the proper scope. + * + * For BIP-0044 keys, an address type must be specified as we intend to not + * support importing BIP-0044 keys into the wallet using the legacy + * pay-to-pubkey-hash (P2PKH) scheme. A nested witness address type will force + * the standard BIP-0049 derivation scheme, while a witness address type will + * force the standard BIP-0084 derivation scheme. + * + * For BIP-0049 keys, an address type must also be specified to make a + * distinction between the standard BIP-0049 address schema (nested witness + * pubkeys everywhere) and our own BIP-0049Plus address schema (nested pubkeys + * externally, witness pubkeys internally). + * + * NOTE: Events (deposits/spends) for keys derived from an account will only be + * detected by lnd if they happen after the import. Rescans to detect past + * events will be supported later on. + * + * @generated from protobuf rpc: ImportAccount(walletrpc.ImportAccountRequest) returns (walletrpc.ImportAccountResponse); + */ + importAccount(input: ImportAccountRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[13], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet accounts import-pubkey` + * ImportPublicKey imports a public key as watch-only into the wallet. The + * public key is converted into a simple address of the given type and that + * address script is watched on chain. For Taproot keys, this will only watch + * the BIP-0086 style output script. Use ImportTapscript for more advanced key + * spend or script spend outputs. + * + * NOTE: Events (deposits/spends) for a key will only be detected by lnd if + * they happen after the import. Rescans to detect past events will be + * supported later on. + * + * @generated from protobuf rpc: ImportPublicKey(walletrpc.ImportPublicKeyRequest) returns (walletrpc.ImportPublicKeyResponse); + */ + importPublicKey(input: ImportPublicKeyRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[14], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * ImportTapscript imports a Taproot script and internal key and adds the + * resulting Taproot output key as a watch-only output script into the wallet. + * For BIP-0086 style Taproot keys (no root hash commitment and no script spend + * path) use ImportPublicKey. + * + * NOTE: Events (deposits/spends) for a key will only be detected by lnd if + * they happen after the import. Rescans to detect past events will be + * supported later on. + * + * NOTE: Taproot keys imported through this RPC currently _cannot_ be used for + * funding PSBTs. Only tracking the balance and UTXOs is currently supported. + * + * @generated from protobuf rpc: ImportTapscript(walletrpc.ImportTapscriptRequest) returns (walletrpc.ImportTapscriptResponse); + */ + importTapscript(input: ImportTapscriptRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[15], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet publishtx` + * PublishTransaction attempts to publish the passed transaction to the + * network. Once this returns without an error, the wallet will continually + * attempt to re-broadcast the transaction on start up, until it enters the + * chain. + * + * @generated from protobuf rpc: PublishTransaction(walletrpc.Transaction) returns (walletrpc.PublishResponse); + */ + publishTransaction(input: Transaction$, options?: RpcOptions): UnaryCall { + const method = this.methods[16], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet removetx` + * RemoveTransaction attempts to remove the provided transaction from the + * internal transaction store of the wallet. + * + * @generated from protobuf rpc: RemoveTransaction(walletrpc.GetTransactionRequest) returns (walletrpc.RemoveTransactionResponse); + */ + removeTransaction(input: GetTransactionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[17], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * SendOutputs is similar to the existing sendmany call in Bitcoind, and + * allows the caller to create a transaction that sends to several outputs at + * once. This is ideal when wanting to batch create a set of transactions. + * + * @generated from protobuf rpc: SendOutputs(walletrpc.SendOutputsRequest) returns (walletrpc.SendOutputsResponse); + */ + sendOutputs(input: SendOutputsRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[18], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet estimatefeerate` + * EstimateFee attempts to query the internal fee estimator of the wallet to + * determine the fee (in sat/kw) to attach to a transaction in order to + * achieve the confirmation target. + * + * @generated from protobuf rpc: EstimateFee(walletrpc.EstimateFeeRequest) returns (walletrpc.EstimateFeeResponse); + */ + estimateFee(input: EstimateFeeRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[19], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet pendingsweeps` + * PendingSweeps returns lists of on-chain outputs that lnd is currently + * attempting to sweep within its central batching engine. Outputs with similar + * fee rates are batched together in order to sweep them within a single + * transaction. + * + * NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to + * remain supported. This is an advanced API that depends on the internals of + * the UtxoSweeper, so things may change. + * + * @generated from protobuf rpc: PendingSweeps(walletrpc.PendingSweepsRequest) returns (walletrpc.PendingSweepsResponse); + */ + pendingSweeps(input: PendingSweepsRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[20], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet bumpfee` + * BumpFee is an endpoint that allows users to interact with lnd's sweeper + * directly. It takes an outpoint from an unconfirmed transaction and sends it + * to the sweeper for potential fee bumping. Depending on whether the outpoint + * has been registered in the sweeper (an existing input, e.g., an anchor + * output) or not (a new input, e.g., an unconfirmed wallet utxo), this will + * either be an RBF or CPFP attempt. + * + * When receiving an input, lnd’s sweeper needs to understand its time + * sensitivity to make economical fee bumps - internally a fee function is + * created using the deadline and budget to guide the process. When the + * deadline is approaching, the fee function will increase the fee rate and + * perform an RBF. + * + * When a force close happens, all the outputs from the force closing + * transaction will be registered in the sweeper. The sweeper will then handle + * the creation, publish, and fee bumping of the sweeping transactions. + * Everytime a new block comes in, unless the sweeping transaction is + * confirmed, an RBF is attempted. To interfere with this automatic process, + * users can use BumpFee to specify customized fee rate, budget, deadline, and + * whether the sweep should happen immediately. It's recommended to call + * `ListSweeps` to understand the shape of the existing sweeping transaction + * first - depending on the number of inputs in this transaction, the RBF + * requirements can be quite different. + * + * This RPC also serves useful when wanting to perform a Child-Pays-For-Parent + * (CPFP), where the child transaction pays for its parent's fee. This can be + * done by specifying an outpoint within the low fee transaction that is under + * the control of the wallet. + * + * @generated from protobuf rpc: BumpFee(walletrpc.BumpFeeRequest) returns (walletrpc.BumpFeeResponse); + */ + bumpFee(input: BumpFeeRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[21], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet bumpforceclosefee` + * BumpForceCloseFee is an endpoint that allows users to bump the fee of a + * channel force close. This only works for channels with option_anchors. + * + * @generated from protobuf rpc: BumpForceCloseFee(walletrpc.BumpForceCloseFeeRequest) returns (walletrpc.BumpForceCloseFeeResponse); + */ + bumpForceCloseFee(input: BumpForceCloseFeeRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[22], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet listsweeps` + * ListSweeps returns a list of the sweep transactions our node has produced. + * Note that these sweeps may not be confirmed yet, as we record sweeps on + * broadcast, not confirmation. + * + * @generated from protobuf rpc: ListSweeps(walletrpc.ListSweepsRequest) returns (walletrpc.ListSweepsResponse); + */ + listSweeps(input: ListSweepsRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[23], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet labeltx` + * LabelTransaction adds a label to a transaction. If the transaction already + * has a label the call will fail unless the overwrite bool is set. This will + * overwrite the existing transaction label. Labels must not be empty, and + * cannot exceed 500 characters. + * + * @generated from protobuf rpc: LabelTransaction(walletrpc.LabelTransactionRequest) returns (walletrpc.LabelTransactionResponse); + */ + labelTransaction(input: LabelTransactionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[24], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet psbt fund` + * FundPsbt creates a fully populated PSBT that contains enough inputs to fund + * the outputs specified in the template. There are three ways a user can + * specify what we call the template (a list of inputs and outputs to use in + * the PSBT): Either as a PSBT packet directly with no coin selection (using + * the legacy "psbt" field), a PSBT with advanced coin selection support (using + * the new "coin_select" field) or as a raw RPC message (using the "raw" + * field). + * The legacy "psbt" and "raw" modes, the following restrictions apply: + * 1. If there are no inputs specified in the template, coin selection is + * performed automatically. + * 2. If the template does contain any inputs, it is assumed that full + * coin selection happened externally and no additional inputs are added. If + * the specified inputs aren't enough to fund the outputs with the given fee + * rate, an error is returned. + * + * The new "coin_select" mode does not have these restrictions and allows the + * user to specify a PSBT with inputs and outputs and still perform coin + * selection on top of that. + * For all modes this RPC requires any inputs that are specified to be locked + * by the user (if they belong to this node in the first place). + * + * After either selecting or verifying the inputs, all input UTXOs are locked + * with an internal app ID. + * + * NOTE: If this method returns without an error, it is the caller's + * responsibility to either spend the locked UTXOs (by finalizing and then + * publishing the transaction) or to unlock/release the locked UTXOs in case of + * an error on the caller's side. + * + * @generated from protobuf rpc: FundPsbt(walletrpc.FundPsbtRequest) returns (walletrpc.FundPsbtResponse); + */ + fundPsbt(input: FundPsbtRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[25], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * + * SignPsbt expects a partial transaction with all inputs and outputs fully + * declared and tries to sign all unsigned inputs that have all required fields + * (UTXO information, BIP32 derivation information, witness or sig scripts) + * set. + * If no error is returned, the PSBT is ready to be given to the next signer or + * to be finalized if lnd was the last signer. + * + * NOTE: This RPC only signs inputs (and only those it can sign), it does not + * perform any other tasks (such as coin selection, UTXO locking or + * input/output/fee value validation, PSBT finalization). Any input that is + * incomplete will be skipped. + * + * @generated from protobuf rpc: SignPsbt(walletrpc.SignPsbtRequest) returns (walletrpc.SignPsbtResponse); + */ + signPsbt(input: SignPsbtRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[26], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * lncli: `wallet psbt finalize` + * FinalizePsbt expects a partial transaction with all inputs and outputs fully + * declared and tries to sign all inputs that belong to the wallet. Lnd must be + * the last signer of the transaction. That means, if there are any unsigned + * non-witness inputs or inputs without UTXO information attached or inputs + * without witness data that do not belong to lnd's wallet, this method will + * fail. If no error is returned, the PSBT is ready to be extracted and the + * final TX within to be broadcast. + * + * NOTE: This method does NOT publish the transaction once finalized. It is the + * caller's responsibility to either publish the transaction on success or + * unlock/release any locked UTXOs in case of an error in this method. + * + * @generated from protobuf rpc: FinalizePsbt(walletrpc.FinalizePsbtRequest) returns (walletrpc.FinalizePsbtResponse); + */ + finalizePsbt(input: FinalizePsbtRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[27], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} diff --git a/proto/lnd/walletkit.ts b/proto/lnd/walletkit.ts new file mode 100644 index 00000000..18819bb7 --- /dev/null +++ b/proto/lnd/walletkit.ts @@ -0,0 +1,5641 @@ +// @generated by protobuf-ts 2.8.1 +// @generated from protobuf file "walletkit.proto" (package "walletrpc", syntax proto3) +// tslint:disable +import { Transaction as Transaction$ } from "./lightning"; +import { KeyLocator } from "./signer"; +import { KeyDescriptor } from "./signer"; +import { ServiceType } from "@protobuf-ts/runtime-rpc"; +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { WireType } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +import { TransactionDetails } from "./lightning"; +import { ChannelPoint } from "./lightning"; +import { CoinSelectionStrategy } from "./lightning"; +import { TxOut } from "./signer"; +import { OutPoint } from "./lightning"; +import { Utxo } from "./lightning"; +/** + * @generated from protobuf message walletrpc.ListUnspentRequest + */ +export interface ListUnspentRequest { + /** + * The minimum number of confirmations to be included. + * + * @generated from protobuf field: int32 min_confs = 1; + */ + minConfs: number; + /** + * The maximum number of confirmations to be included. + * + * @generated from protobuf field: int32 max_confs = 2; + */ + maxConfs: number; + /** + * An optional filter to only include outputs belonging to an account. + * + * @generated from protobuf field: string account = 3; + */ + account: string; + /** + * + * When min_confs and max_confs are zero, setting false implicitly + * overrides max_confs to be MaxInt32, otherwise max_confs remains + * zero. An error is returned if the value is true and both min_confs + * and max_confs are non-zero. (default: false) + * + * @generated from protobuf field: bool unconfirmed_only = 4; + */ + unconfirmedOnly: boolean; +} +/** + * @generated from protobuf message walletrpc.ListUnspentResponse + */ +export interface ListUnspentResponse { + /** + * A list of utxos satisfying the specified number of confirmations. + * + * @generated from protobuf field: repeated lnrpc.Utxo utxos = 1; + */ + utxos: Utxo[]; +} +/** + * @generated from protobuf message walletrpc.LeaseOutputRequest + */ +export interface LeaseOutputRequest { + /** + * + * An ID of 32 random bytes that must be unique for each distinct application + * using this RPC which will be used to bound the output lease to. + * + * @generated from protobuf field: bytes id = 1; + */ + id: Uint8Array; + /** + * The identifying outpoint of the output being leased. + * + * @generated from protobuf field: lnrpc.OutPoint outpoint = 2; + */ + outpoint?: OutPoint; + /** + * The time in seconds before the lock expires. If set to zero, the default + * lock duration is used. + * + * @generated from protobuf field: uint64 expiration_seconds = 3; + */ + expirationSeconds: bigint; +} +/** + * @generated from protobuf message walletrpc.LeaseOutputResponse + */ +export interface LeaseOutputResponse { + /** + * + * The absolute expiration of the output lease represented as a unix timestamp. + * + * @generated from protobuf field: uint64 expiration = 1; + */ + expiration: bigint; +} +/** + * @generated from protobuf message walletrpc.ReleaseOutputRequest + */ +export interface ReleaseOutputRequest { + /** + * The unique ID that was used to lock the output. + * + * @generated from protobuf field: bytes id = 1; + */ + id: Uint8Array; + /** + * The identifying outpoint of the output being released. + * + * @generated from protobuf field: lnrpc.OutPoint outpoint = 2; + */ + outpoint?: OutPoint; +} +/** + * @generated from protobuf message walletrpc.ReleaseOutputResponse + */ +export interface ReleaseOutputResponse { + /** + * The status of the release operation. + * + * @generated from protobuf field: string status = 1; + */ + status: string; +} +/** + * @generated from protobuf message walletrpc.KeyReq + */ +export interface KeyReq { + /** + * + * Is the key finger print of the root pubkey that this request is targeting. + * This allows the WalletKit to possibly serve out keys for multiple HD chains + * via public derivation. + * + * @generated from protobuf field: int32 key_finger_print = 1; + */ + keyFingerPrint: number; + /** + * + * The target key family to derive a key from. In other contexts, this is + * known as the "account". + * + * @generated from protobuf field: int32 key_family = 2; + */ + keyFamily: number; +} +/** + * @generated from protobuf message walletrpc.AddrRequest + */ +export interface AddrRequest { + /** + * + * The name of the account to retrieve the next address of. If empty, the + * default wallet account is used. + * + * @generated from protobuf field: string account = 1; + */ + account: string; + /** + * + * The type of address to derive. + * + * @generated from protobuf field: walletrpc.AddressType type = 2; + */ + type: AddressType; + /** + * + * Whether a change address should be derived. + * + * @generated from protobuf field: bool change = 3; + */ + change: boolean; +} +/** + * @generated from protobuf message walletrpc.AddrResponse + */ +export interface AddrResponse { + /** + * + * The address encoded using a bech32 format. + * + * @generated from protobuf field: string addr = 1; + */ + addr: string; +} +/** + * @generated from protobuf message walletrpc.Account + */ +export interface Account { + /** + * The name used to identify the account. + * + * @generated from protobuf field: string name = 1; + */ + name: string; + /** + * The type of addresses the account supports. + * + * @generated from protobuf field: walletrpc.AddressType address_type = 2; + */ + addressType: AddressType; + /** + * + * The public key backing the account that all keys are derived from + * represented as an extended key. This will always be empty for the default + * imported account in which single public keys are imported into. + * + * @generated from protobuf field: string extended_public_key = 3; + */ + extendedPublicKey: string; + /** + * + * The fingerprint of the root key from which the account public key was + * derived from. This will always be zero for the default imported account in + * which single public keys are imported into. The bytes are in big-endian + * order. + * + * @generated from protobuf field: bytes master_key_fingerprint = 4; + */ + masterKeyFingerprint: Uint8Array; + /** + * + * The derivation path corresponding to the account public key. This will + * always be empty for the default imported account in which single public keys + * are imported into. + * + * @generated from protobuf field: string derivation_path = 5; + */ + derivationPath: string; + /** + * + * The number of keys derived from the external branch of the account public + * key. This will always be zero for the default imported account in which + * single public keys are imported into. + * + * @generated from protobuf field: uint32 external_key_count = 6; + */ + externalKeyCount: number; + /** + * + * The number of keys derived from the internal branch of the account public + * key. This will always be zero for the default imported account in which + * single public keys are imported into. + * + * @generated from protobuf field: uint32 internal_key_count = 7; + */ + internalKeyCount: number; + /** + * Whether the wallet stores private keys for the account. + * + * @generated from protobuf field: bool watch_only = 8; + */ + watchOnly: boolean; +} +/** + * @generated from protobuf message walletrpc.AddressProperty + */ +export interface AddressProperty { + /** + * + * The address encoded using the appropriate format depending on the + * address type (base58, bech32, bech32m). + * + * Note that lnd's internal/custom keys for channels and other + * functionality are derived from the same scope. Since they + * aren't really used as addresses and will never have an + * on-chain balance, we'll show the public key instead (only if + * the show_custom_accounts flag is provided). + * + * @generated from protobuf field: string address = 1; + */ + address: string; + /** + * Denotes if the address is a change address. + * + * @generated from protobuf field: bool is_internal = 2; + */ + isInternal: boolean; + /** + * The balance of the address. + * + * @generated from protobuf field: int64 balance = 3; + */ + balance: bigint; + /** + * The full derivation path of the address. This will be empty for imported + * addresses. + * + * @generated from protobuf field: string derivation_path = 4; + */ + derivationPath: string; + /** + * The public key of the address. This will be empty for imported addresses. + * + * @generated from protobuf field: bytes public_key = 5; + */ + publicKey: Uint8Array; +} +/** + * @generated from protobuf message walletrpc.AccountWithAddresses + */ +export interface AccountWithAddresses { + /** + * The name used to identify the account. + * + * @generated from protobuf field: string name = 1; + */ + name: string; + /** + * The type of addresses the account supports. + * + * @generated from protobuf field: walletrpc.AddressType address_type = 2; + */ + addressType: AddressType; + /** + * + * The derivation path corresponding to the account public key. This will + * always be empty for the default imported account in which single public keys + * are imported into. + * + * @generated from protobuf field: string derivation_path = 3; + */ + derivationPath: string; + /** + * + * List of address, its type internal/external & balance. + * Note that the order of addresses will be random and not according to the + * derivation index, since that information is not stored by the underlying + * wallet. + * + * @generated from protobuf field: repeated walletrpc.AddressProperty addresses = 4; + */ + addresses: AddressProperty[]; +} +/** + * @generated from protobuf message walletrpc.ListAccountsRequest + */ +export interface ListAccountsRequest { + /** + * An optional filter to only return accounts matching this name. + * + * @generated from protobuf field: string name = 1; + */ + name: string; + /** + * An optional filter to only return accounts matching this address type. + * + * @generated from protobuf field: walletrpc.AddressType address_type = 2; + */ + addressType: AddressType; +} +/** + * @generated from protobuf message walletrpc.ListAccountsResponse + */ +export interface ListAccountsResponse { + /** + * @generated from protobuf field: repeated walletrpc.Account accounts = 1; + */ + accounts: Account[]; +} +/** + * @generated from protobuf message walletrpc.RequiredReserveRequest + */ +export interface RequiredReserveRequest { + /** + * The number of additional channels the user would like to open. + * + * @generated from protobuf field: uint32 additional_public_channels = 1; + */ + additionalPublicChannels: number; +} +/** + * @generated from protobuf message walletrpc.RequiredReserveResponse + */ +export interface RequiredReserveResponse { + /** + * The amount of reserve required. + * + * @generated from protobuf field: int64 required_reserve = 1; + */ + requiredReserve: bigint; +} +/** + * @generated from protobuf message walletrpc.ListAddressesRequest + */ +export interface ListAddressesRequest { + /** + * An optional filter to only return addresses matching this account. + * + * @generated from protobuf field: string account_name = 1; + */ + accountName: string; + /** + * An optional flag to return LND's custom accounts (Purpose=1017) + * public key along with other addresses. + * + * @generated from protobuf field: bool show_custom_accounts = 2; + */ + showCustomAccounts: boolean; +} +/** + * @generated from protobuf message walletrpc.ListAddressesResponse + */ +export interface ListAddressesResponse { + /** + * A list of all the accounts and their addresses. + * + * @generated from protobuf field: repeated walletrpc.AccountWithAddresses account_with_addresses = 1; + */ + accountWithAddresses: AccountWithAddresses[]; +} +/** + * @generated from protobuf message walletrpc.GetTransactionRequest + */ +export interface GetTransactionRequest { + /** + * The txid of the transaction. + * + * @generated from protobuf field: string txid = 1; + */ + txid: string; +} +/** + * @generated from protobuf message walletrpc.SignMessageWithAddrRequest + */ +export interface SignMessageWithAddrRequest { + /** + * The message to be signed. When using REST, this field must be encoded as + * base64. + * + * @generated from protobuf field: bytes msg = 1; + */ + msg: Uint8Array; + /** + * The address which will be used to look up the private key and sign the + * corresponding message. + * + * @generated from protobuf field: string addr = 2; + */ + addr: string; +} +/** + * @generated from protobuf message walletrpc.SignMessageWithAddrResponse + */ +export interface SignMessageWithAddrResponse { + /** + * The compact ECDSA signature for the given message encoded in base64. + * + * @generated from protobuf field: string signature = 1; + */ + signature: string; +} +/** + * @generated from protobuf message walletrpc.VerifyMessageWithAddrRequest + */ +export interface VerifyMessageWithAddrRequest { + /** + * The message to be signed. When using REST, this field must be encoded as + * base64. + * + * @generated from protobuf field: bytes msg = 1; + */ + msg: Uint8Array; + /** + * The compact ECDSA signature to be verified over the given message + * ecoded in base64. + * + * @generated from protobuf field: string signature = 2; + */ + signature: string; + /** + * The address which will be used to look up the public key and verify the + * the signature. + * + * @generated from protobuf field: string addr = 3; + */ + addr: string; +} +/** + * @generated from protobuf message walletrpc.VerifyMessageWithAddrResponse + */ +export interface VerifyMessageWithAddrResponse { + /** + * Whether the signature was valid over the given message. + * + * @generated from protobuf field: bool valid = 1; + */ + valid: boolean; + /** + * The pubkey recovered from the signature. + * + * @generated from protobuf field: bytes pubkey = 2; + */ + pubkey: Uint8Array; +} +/** + * @generated from protobuf message walletrpc.ImportAccountRequest + */ +export interface ImportAccountRequest { + /** + * A name to identify the account with. + * + * @generated from protobuf field: string name = 1; + */ + name: string; + /** + * + * A public key that corresponds to a wallet account represented as an extended + * key. It must conform to a derivation path of the form + * m/purpose'/coin_type'/account'. + * + * @generated from protobuf field: string extended_public_key = 2; + */ + extendedPublicKey: string; + /** + * + * The fingerprint of the root key (also known as the key with derivation path + * m/) from which the account public key was derived from. This may be required + * by some hardware wallets for proper identification and signing. The bytes + * must be in big-endian order. + * + * @generated from protobuf field: bytes master_key_fingerprint = 3; + */ + masterKeyFingerprint: Uint8Array; + /** + * + * An address type is only required when the extended account public key has a + * legacy version (xpub, tpub, etc.), such that the wallet cannot detect what + * address scheme it belongs to. + * + * @generated from protobuf field: walletrpc.AddressType address_type = 4; + */ + addressType: AddressType; + /** + * + * Whether a dry run should be attempted when importing the account. This + * serves as a way to confirm whether the account is being imported correctly + * by returning the first N addresses for the external and internal branches of + * the account. If these addresses match as expected, then it should be safe to + * import the account as is. + * + * @generated from protobuf field: bool dry_run = 5; + */ + dryRun: boolean; +} +/** + * @generated from protobuf message walletrpc.ImportAccountResponse + */ +export interface ImportAccountResponse { + /** + * The details of the imported account. + * + * @generated from protobuf field: walletrpc.Account account = 1; + */ + account?: Account; + /** + * + * The first N addresses that belong to the external branch of the account. + * The external branch is typically used for external non-change addresses. + * These are only returned if a dry run was specified within the request. + * + * @generated from protobuf field: repeated string dry_run_external_addrs = 2; + */ + dryRunExternalAddrs: string[]; + /** + * + * The first N addresses that belong to the internal branch of the account. + * The internal branch is typically used for change addresses. These are only + * returned if a dry run was specified within the request. + * + * @generated from protobuf field: repeated string dry_run_internal_addrs = 3; + */ + dryRunInternalAddrs: string[]; +} +/** + * @generated from protobuf message walletrpc.ImportPublicKeyRequest + */ +export interface ImportPublicKeyRequest { + /** + * A compressed public key represented as raw bytes. + * + * @generated from protobuf field: bytes public_key = 1; + */ + publicKey: Uint8Array; + /** + * The type of address that will be generated from the public key. + * + * @generated from protobuf field: walletrpc.AddressType address_type = 2; + */ + addressType: AddressType; +} +/** + * @generated from protobuf message walletrpc.ImportPublicKeyResponse + */ +export interface ImportPublicKeyResponse { + /** + * The status of the import operation. + * + * @generated from protobuf field: string status = 1; + */ + status: string; +} +/** + * @generated from protobuf message walletrpc.ImportTapscriptRequest + */ +export interface ImportTapscriptRequest { + /** + * + * The internal public key, serialized as 32-byte x-only public key. + * + * @generated from protobuf field: bytes internal_public_key = 1; + */ + internalPublicKey: Uint8Array; + /** + * @generated from protobuf oneof: script + */ + script: { + oneofKind: "fullTree"; + /** + * + * The full script tree with all individual leaves is known and the root + * hash can be constructed from the full tree directly. + * + * @generated from protobuf field: walletrpc.TapscriptFullTree full_tree = 2; + */ + fullTree: TapscriptFullTree; + } | { + oneofKind: "partialReveal"; + /** + * + * Only a single script leaf is known. To construct the root hash, the full + * inclusion proof must also be provided. + * + * @generated from protobuf field: walletrpc.TapscriptPartialReveal partial_reveal = 3; + */ + partialReveal: TapscriptPartialReveal; + } | { + oneofKind: "rootHashOnly"; + /** + * + * Only the root hash of the Taproot script tree (or other form of Taproot + * commitment) is known. + * + * @generated from protobuf field: bytes root_hash_only = 4; + */ + rootHashOnly: Uint8Array; + } | { + oneofKind: "fullKeyOnly"; + /** + * + * Only the final, tweaked Taproot key is known and no additional + * information about the internal key or type of tweak that was used to + * derive it. When this is set, the wallet treats the key in + * internal_public_key as the Taproot key directly. This can be useful for + * tracking arbitrary Taproot outputs without the goal of ever being able + * to spend from them through the internal wallet. + * + * @generated from protobuf field: bool full_key_only = 5; + */ + fullKeyOnly: boolean; + } | { + oneofKind: undefined; + }; +} +/** + * @generated from protobuf message walletrpc.TapscriptFullTree + */ +export interface TapscriptFullTree { + /** + * + * The complete, ordered list of all tap leaves of the tree. + * + * @generated from protobuf field: repeated walletrpc.TapLeaf all_leaves = 1; + */ + allLeaves: TapLeaf[]; +} +/** + * @generated from protobuf message walletrpc.TapLeaf + */ +export interface TapLeaf { + /** + * The leaf version. Should be 0xc0 (192) in case of a SegWit v1 script. + * + * @generated from protobuf field: uint32 leaf_version = 1; + */ + leafVersion: number; + /** + * The script of the tap leaf. + * + * @generated from protobuf field: bytes script = 2; + */ + script: Uint8Array; +} +/** + * @generated from protobuf message walletrpc.TapscriptPartialReveal + */ +export interface TapscriptPartialReveal { + /** + * The tap leaf that is known and will be revealed. + * + * @generated from protobuf field: walletrpc.TapLeaf revealed_leaf = 1; + */ + revealedLeaf?: TapLeaf; + /** + * The BIP-0341 serialized inclusion proof that is required to prove that + * the revealed leaf is part of the tree. This contains 0..n blocks of 32 + * bytes. If the tree only contained a single leaf (which is the revealed + * leaf), this can be empty. + * + * @generated from protobuf field: bytes full_inclusion_proof = 2; + */ + fullInclusionProof: Uint8Array; +} +/** + * @generated from protobuf message walletrpc.ImportTapscriptResponse + */ +export interface ImportTapscriptResponse { + /** + * + * The resulting pay-to-Taproot address that represents the imported internal + * key with the script committed to it. + * + * @generated from protobuf field: string p2tr_address = 1 [json_name = "p2trAddress"]; + */ + p2TrAddress: string; +} +/** + * @generated from protobuf message walletrpc.Transaction + */ +export interface Transaction { + /** + * + * The raw serialized transaction. Despite the field name, this does need to be + * specified in raw bytes (or base64 encoded when using REST) and not in hex. + * To not break existing software, the field can't simply be renamed. + * + * @generated from protobuf field: bytes tx_hex = 1; + */ + txHex: Uint8Array; + /** + * + * An optional label to save with the transaction. Limited to 500 characters. + * + * @generated from protobuf field: string label = 2; + */ + label: string; +} +/** + * @generated from protobuf message walletrpc.PublishResponse + */ +export interface PublishResponse { + /** + * + * If blank, then no error occurred and the transaction was successfully + * published. If not the empty string, then a string representation of the + * broadcast error. + * + * TODO(roasbeef): map to a proper enum type + * + * @generated from protobuf field: string publish_error = 1; + */ + publishError: string; +} +/** + * @generated from protobuf message walletrpc.RemoveTransactionResponse + */ +export interface RemoveTransactionResponse { + /** + * The status of the remove transaction operation. + * + * @generated from protobuf field: string status = 1; + */ + status: string; +} +/** + * @generated from protobuf message walletrpc.SendOutputsRequest + */ +export interface SendOutputsRequest { + /** + * + * The number of satoshis per kilo weight that should be used when crafting + * this transaction. + * + * @generated from protobuf field: int64 sat_per_kw = 1; + */ + satPerKw: bigint; + /** + * + * A slice of the outputs that should be created in the transaction produced. + * + * @generated from protobuf field: repeated signrpc.TxOut outputs = 2; + */ + outputs: TxOut[]; + /** + * An optional label for the transaction, limited to 500 characters. + * + * @generated from protobuf field: string label = 3; + */ + label: string; + /** + * The minimum number of confirmations each one of your outputs used for + * the transaction must satisfy. + * + * @generated from protobuf field: int32 min_confs = 4; + */ + minConfs: number; + /** + * Whether unconfirmed outputs should be used as inputs for the transaction. + * + * @generated from protobuf field: bool spend_unconfirmed = 5; + */ + spendUnconfirmed: boolean; + /** + * The strategy to use for selecting coins during sending the outputs. + * + * @generated from protobuf field: lnrpc.CoinSelectionStrategy coin_selection_strategy = 6; + */ + coinSelectionStrategy: CoinSelectionStrategy; +} +/** + * @generated from protobuf message walletrpc.SendOutputsResponse + */ +export interface SendOutputsResponse { + /** + * + * The serialized transaction sent out on the network. + * + * @generated from protobuf field: bytes raw_tx = 1; + */ + rawTx: Uint8Array; +} +/** + * @generated from protobuf message walletrpc.EstimateFeeRequest + */ +export interface EstimateFeeRequest { + /** + * + * The number of confirmations to shoot for when estimating the fee. + * + * @generated from protobuf field: int32 conf_target = 1; + */ + confTarget: number; +} +/** + * @generated from protobuf message walletrpc.EstimateFeeResponse + */ +export interface EstimateFeeResponse { + /** + * + * The amount of satoshis per kw that should be used in order to reach the + * confirmation target in the request. + * + * @generated from protobuf field: int64 sat_per_kw = 1; + */ + satPerKw: bigint; + /** + * The current minimum relay fee based on our chain backend in sat/kw. + * + * @generated from protobuf field: int64 min_relay_fee_sat_per_kw = 2; + */ + minRelayFeeSatPerKw: bigint; +} +/** + * @generated from protobuf message walletrpc.PendingSweep + */ +export interface PendingSweep { + /** + * The outpoint of the output we're attempting to sweep. + * + * @generated from protobuf field: lnrpc.OutPoint outpoint = 1; + */ + outpoint?: OutPoint; + /** + * The witness type of the output we're attempting to sweep. + * + * @generated from protobuf field: walletrpc.WitnessType witness_type = 2; + */ + witnessType: WitnessType; + /** + * The value of the output we're attempting to sweep. + * + * @generated from protobuf field: uint32 amount_sat = 3; + */ + amountSat: number; + /** + * + * Deprecated, use sat_per_vbyte. + * The fee rate we'll use to sweep the output, expressed in sat/vbyte. The fee + * rate is only determined once a sweeping transaction for the output is + * created, so it's possible for this to be 0 before this. + * + * @deprecated + * @generated from protobuf field: uint32 sat_per_byte = 4 [deprecated = true]; + */ + satPerByte: number; + /** + * The number of broadcast attempts we've made to sweep the output. + * + * @generated from protobuf field: uint32 broadcast_attempts = 5; + */ + broadcastAttempts: number; + /** + * + * Deprecated. + * The next height of the chain at which we'll attempt to broadcast the + * sweep transaction of the output. + * + * @deprecated + * @generated from protobuf field: uint32 next_broadcast_height = 6 [deprecated = true]; + */ + nextBroadcastHeight: number; + /** + * + * Deprecated, use immediate. + * Whether this input must be force-swept. This means that it is swept + * immediately. + * + * @deprecated + * @generated from protobuf field: bool force = 7 [deprecated = true]; + */ + force: boolean; + /** + * + * Deprecated, use deadline. + * The requested confirmation target for this output, which is the deadline + * used by the sweeper. + * + * @deprecated + * @generated from protobuf field: uint32 requested_conf_target = 8 [deprecated = true]; + */ + requestedConfTarget: number; + /** + * Deprecated, use requested_sat_per_vbyte. + * The requested fee rate, expressed in sat/vbyte, for this output. + * + * @deprecated + * @generated from protobuf field: uint32 requested_sat_per_byte = 9 [deprecated = true]; + */ + requestedSatPerByte: number; + /** + * + * The current fee rate we'll use to sweep the output, expressed in sat/vbyte. + * The fee rate is only determined once a sweeping transaction for the output + * is created, so it's possible for this to be 0 before this. + * + * @generated from protobuf field: uint64 sat_per_vbyte = 10; + */ + satPerVbyte: bigint; + /** + * The requested starting fee rate, expressed in sat/vbyte, for this + * output. When not requested, this field will be 0. + * + * @generated from protobuf field: uint64 requested_sat_per_vbyte = 11; + */ + requestedSatPerVbyte: bigint; + /** + * + * Whether this input will be swept immediately. + * + * @generated from protobuf field: bool immediate = 12; + */ + immediate: boolean; + /** + * + * The budget for this sweep, expressed in satoshis. This is the maximum amount + * that can be spent as fees to sweep this output. + * + * @generated from protobuf field: uint64 budget = 13; + */ + budget: bigint; + /** + * + * The deadline height used for this output when perform fee bumping. + * + * @generated from protobuf field: uint32 deadline_height = 14; + */ + deadlineHeight: number; +} +/** + * @generated from protobuf message walletrpc.PendingSweepsRequest + */ +export interface PendingSweepsRequest { +} +/** + * @generated from protobuf message walletrpc.PendingSweepsResponse + */ +export interface PendingSweepsResponse { + /** + * + * The set of outputs currently being swept by lnd's central batching engine. + * + * @generated from protobuf field: repeated walletrpc.PendingSweep pending_sweeps = 1; + */ + pendingSweeps: PendingSweep[]; +} +/** + * @generated from protobuf message walletrpc.BumpFeeRequest + */ +export interface BumpFeeRequest { + /** + * The input we're attempting to bump the fee of. + * + * @generated from protobuf field: lnrpc.OutPoint outpoint = 1; + */ + outpoint?: OutPoint; + /** + * Optional. The deadline in number of blocks that the input should be spent + * within. When not set, for new inputs, the default value (1008) is used; + * for existing inputs, their current values will be retained. + * + * @generated from protobuf field: uint32 target_conf = 2; + */ + targetConf: number; + /** + * + * Deprecated, use sat_per_vbyte. + * The fee rate, expressed in sat/vbyte, that should be used to spend the input + * with. + * + * @deprecated + * @generated from protobuf field: uint32 sat_per_byte = 3 [deprecated = true]; + */ + satPerByte: number; + /** + * + * Deprecated, use immediate. + * Whether this input must be force-swept. This means that it is swept + * immediately. + * + * @deprecated + * @generated from protobuf field: bool force = 4 [deprecated = true]; + */ + force: boolean; + /** + * + * Optional. The starting fee rate, expressed in sat/vbyte, that will be used + * to spend the input with initially. This value will be used by the sweeper's + * fee function as its starting fee rate. When not set, the sweeper will use + * the estimated fee rate using the `target_conf` as the starting fee rate. + * + * @generated from protobuf field: uint64 sat_per_vbyte = 5; + */ + satPerVbyte: bigint; + /** + * + * Optional. Whether this input will be swept immediately. When set to true, + * the sweeper will sweep this input without waiting for the next batch. + * + * @generated from protobuf field: bool immediate = 6; + */ + immediate: boolean; + /** + * + * Optional. The max amount in sats that can be used as the fees. Setting this + * value greater than the input's value may result in CPFP - one or more wallet + * utxos will be used to pay the fees specified by the budget. If not set, for + * new inputs, by default 50% of the input's value will be treated as the + * budget for fee bumping; for existing inputs, their current budgets will be + * retained. + * + * @generated from protobuf field: uint64 budget = 7; + */ + budget: bigint; +} +/** + * @generated from protobuf message walletrpc.BumpFeeResponse + */ +export interface BumpFeeResponse { + /** + * The status of the bump fee operation. + * + * @generated from protobuf field: string status = 1; + */ + status: string; +} +/** + * @generated from protobuf message walletrpc.BumpForceCloseFeeRequest + */ +export interface BumpForceCloseFeeRequest { + /** + * The channel point which force close transaction we are attempting to + * bump the fee rate for. + * + * @generated from protobuf field: lnrpc.ChannelPoint chan_point = 1; + */ + chanPoint?: ChannelPoint; + /** + * Optional. The deadline delta in number of blocks that the anchor output + * should be spent within to bump the closing transaction. + * + * @generated from protobuf field: uint32 deadline_delta = 2; + */ + deadlineDelta: number; + /** + * + * Optional. The starting fee rate, expressed in sat/vbyte. This value will be + * used by the sweeper's fee function as its starting fee rate. When not set, + * the sweeper will use the estimated fee rate using the target_conf as the + * starting fee rate. + * + * @generated from protobuf field: uint64 starting_feerate = 3; + */ + startingFeerate: bigint; + /** + * + * Optional. Whether this cpfp transaction will be triggered immediately. When + * set to true, the sweeper will consider all currently registered sweeps and + * trigger new batch transactions including the sweeping of the anchor output + * related to the selected force close transaction. + * + * @generated from protobuf field: bool immediate = 4; + */ + immediate: boolean; + /** + * + * Optional. The max amount in sats that can be used as the fees. For already + * registered anchor outputs if not set explicitly the old value will be used. + * For channel force closes which have no HTLCs in their commitment transaction + * this value has to be set to an appropriate amount to pay for the cpfp + * transaction of the force closed channel otherwise the fee bumping will fail. + * + * @generated from protobuf field: uint64 budget = 5; + */ + budget: bigint; +} +/** + * @generated from protobuf message walletrpc.BumpForceCloseFeeResponse + */ +export interface BumpForceCloseFeeResponse { + /** + * The status of the force close fee bump operation. + * + * @generated from protobuf field: string status = 1; + */ + status: string; +} +/** + * @generated from protobuf message walletrpc.ListSweepsRequest + */ +export interface ListSweepsRequest { + /** + * + * Retrieve the full sweep transaction details. If false, only the sweep txids + * will be returned. Note that some sweeps that LND publishes will have been + * replaced-by-fee, so will not be included in this output. + * + * @generated from protobuf field: bool verbose = 1; + */ + verbose: boolean; + /** + * + * The start height to use when fetching sweeps. If not specified (0), the + * result will start from the earliest sweep. If set to -1 the result will + * only include unconfirmed sweeps (at the time of the call). + * + * @generated from protobuf field: int32 start_height = 2; + */ + startHeight: number; +} +/** + * @generated from protobuf message walletrpc.ListSweepsResponse + */ +export interface ListSweepsResponse { + /** + * @generated from protobuf oneof: sweeps + */ + sweeps: { + oneofKind: "transactionDetails"; + /** + * @generated from protobuf field: lnrpc.TransactionDetails transaction_details = 1; + */ + transactionDetails: TransactionDetails; + } | { + oneofKind: "transactionIds"; + /** + * @generated from protobuf field: walletrpc.ListSweepsResponse.TransactionIDs transaction_ids = 2; + */ + transactionIds: ListSweepsResponse_TransactionIDs; + } | { + oneofKind: undefined; + }; +} +/** + * @generated from protobuf message walletrpc.ListSweepsResponse.TransactionIDs + */ +export interface ListSweepsResponse_TransactionIDs { + /** + * + * Reversed, hex-encoded string representing the transaction ids of the + * sweeps that our node has broadcast. Note that these transactions may + * not have confirmed yet, we record sweeps on broadcast, not confirmation. + * + * @generated from protobuf field: repeated string transaction_ids = 1; + */ + transactionIds: string[]; +} +/** + * @generated from protobuf message walletrpc.LabelTransactionRequest + */ +export interface LabelTransactionRequest { + /** + * The txid of the transaction to label. Note: When using gRPC, the bytes + * must be in little-endian (reverse) order. + * + * @generated from protobuf field: bytes txid = 1; + */ + txid: Uint8Array; + /** + * The label to add to the transaction, limited to 500 characters. + * + * @generated from protobuf field: string label = 2; + */ + label: string; + /** + * Whether to overwrite the existing label, if it is present. + * + * @generated from protobuf field: bool overwrite = 3; + */ + overwrite: boolean; +} +/** + * @generated from protobuf message walletrpc.LabelTransactionResponse + */ +export interface LabelTransactionResponse { + /** + * The status of the label operation. + * + * @generated from protobuf field: string status = 1; + */ + status: string; +} +/** + * @generated from protobuf message walletrpc.FundPsbtRequest + */ +export interface FundPsbtRequest { + /** + * @generated from protobuf oneof: template + */ + template: { + oneofKind: "psbt"; + /** + * + * Use an existing PSBT packet as the template for the funded PSBT. + * + * The packet must contain at least one non-dust output. If one or more + * inputs are specified, no coin selection is performed. In that case every + * input must be an UTXO known to the wallet that has not been locked + * before. The sum of all inputs must be sufficiently greater than the sum + * of all outputs to pay a miner fee with the specified fee rate. A change + * output is added to the PSBT if necessary. + * + * @generated from protobuf field: bytes psbt = 1; + */ + psbt: Uint8Array; + } | { + oneofKind: "raw"; + /** + * + * Use the outputs and optional inputs from this raw template. + * + * @generated from protobuf field: walletrpc.TxTemplate raw = 2; + */ + raw: TxTemplate; + } | { + oneofKind: "coinSelect"; + /** + * + * Use an existing PSBT packet as the template for the funded PSBT. + * + * The difference to the pure PSBT template above is that coin selection is + * performed even if inputs are specified. The output amounts are summed up + * and used as the target amount for coin selection. A change output must + * either already exist in the PSBT and be marked as such, otherwise a new + * change output of the specified output type will be added. Any inputs + * already specified in the PSBT must already be locked (if they belong to + * this node), only newly added inputs will be locked by this RPC. + * + * In case the sum of the already provided inputs exceeds the required + * output amount, no new coins are selected. Instead only the fee and + * change amount calculation is performed (e.g. a change output is added if + * requested or the change is added to the specified existing change + * output, given there is any non-dust change). This can be identified by + * the returned locked UTXOs being empty. + * + * @generated from protobuf field: walletrpc.PsbtCoinSelect coin_select = 9; + */ + coinSelect: PsbtCoinSelect; + } | { + oneofKind: undefined; + }; + /** + * @generated from protobuf oneof: fees + */ + fees: { + oneofKind: "targetConf"; + /** + * + * The target number of blocks that the transaction should be confirmed in. + * + * @generated from protobuf field: uint32 target_conf = 3; + */ + targetConf: number; + } | { + oneofKind: "satPerVbyte"; + /** + * + * The fee rate, expressed in sat/vbyte, that should be used to spend the + * input with. + * + * @generated from protobuf field: uint64 sat_per_vbyte = 4; + */ + satPerVbyte: bigint; + } | { + oneofKind: "satPerKw"; + /** + * + * The fee rate, expressed in sat/kWU, that should be used to spend the + * input with. + * + * @generated from protobuf field: uint64 sat_per_kw = 11; + */ + satPerKw: bigint; + } | { + oneofKind: undefined; + }; + /** + * + * The name of the account to fund the PSBT with. If empty, the default wallet + * account is used. + * + * @generated from protobuf field: string account = 5; + */ + account: string; + /** + * The minimum number of confirmations each one of your outputs used for + * the transaction must satisfy. + * + * @generated from protobuf field: int32 min_confs = 6; + */ + minConfs: number; + /** + * Whether unconfirmed outputs should be used as inputs for the transaction. + * + * @generated from protobuf field: bool spend_unconfirmed = 7; + */ + spendUnconfirmed: boolean; + /** + * The address type for the change. If empty, P2WPKH addresses will be used + * for default accounts and single imported public keys. For custom + * accounts, no change type should be provided as the coin selection key + * scope will always be used to generate the change address. + * + * @generated from protobuf field: walletrpc.ChangeAddressType change_type = 8; + */ + changeType: ChangeAddressType; + /** + * The strategy to use for selecting coins during funding the PSBT. + * + * @generated from protobuf field: lnrpc.CoinSelectionStrategy coin_selection_strategy = 10; + */ + coinSelectionStrategy: CoinSelectionStrategy; + /** + * The max fee to total output amount ratio that this psbt should adhere to. + * + * @generated from protobuf field: double max_fee_ratio = 12; + */ + maxFeeRatio: number; +} +/** + * @generated from protobuf message walletrpc.FundPsbtResponse + */ +export interface FundPsbtResponse { + /** + * + * The funded but not yet signed PSBT packet. + * + * @generated from protobuf field: bytes funded_psbt = 1; + */ + fundedPsbt: Uint8Array; + /** + * + * The index of the added change output or -1 if no change was left over. + * + * @generated from protobuf field: int32 change_output_index = 2; + */ + changeOutputIndex: number; + /** + * + * The list of lock leases that were acquired for the inputs in the funded PSBT + * packet. Only inputs added to the PSBT by this RPC are locked, inputs that + * were already present in the PSBT are not locked. + * + * @generated from protobuf field: repeated walletrpc.UtxoLease locked_utxos = 3; + */ + lockedUtxos: UtxoLease[]; +} +/** + * @generated from protobuf message walletrpc.TxTemplate + */ +export interface TxTemplate { + /** + * + * An optional list of inputs to use. Every input must be an UTXO known to the + * wallet that has not been locked before. The sum of all inputs must be + * sufficiently greater than the sum of all outputs to pay a miner fee with the + * fee rate specified in the parent message. + * + * If no inputs are specified, coin selection will be performed instead and + * inputs of sufficient value will be added to the resulting PSBT. + * + * @generated from protobuf field: repeated lnrpc.OutPoint inputs = 1; + */ + inputs: OutPoint[]; + /** + * + * A map of all addresses and the amounts to send to in the funded PSBT. + * + * @generated from protobuf field: map outputs = 2; + */ + outputs: { + [key: string]: bigint; + }; +} +/** + * @generated from protobuf message walletrpc.PsbtCoinSelect + */ +export interface PsbtCoinSelect { + /** + * + * The template to use for the funded PSBT. The template must contain at least + * one non-dust output. The amount to be funded is calculated by summing up the + * amounts of all outputs in the template, subtracting all the input values of + * the already specified inputs. The change value is added to the output that + * is marked as such (or a new change output is added if none is marked). For + * the input amount calculation to be correct, the template must have the + * WitnessUtxo field set for all inputs. Any inputs already specified in the + * PSBT must already be locked (if they belong to this node), only newly added + * inputs will be locked by this RPC. + * + * @generated from protobuf field: bytes psbt = 1; + */ + psbt: Uint8Array; + /** + * @generated from protobuf oneof: change_output + */ + changeOutput: { + oneofKind: "existingOutputIndex"; + /** + * + * Use the existing output within the template PSBT with the specified + * index as the change output. Any leftover change will be added to the + * already specified amount of that output. To add a new change output to + * the PSBT, set the "add" field below instead. The type of change output + * added is defined by change_type in the parent message. + * + * @generated from protobuf field: int32 existing_output_index = 2; + */ + existingOutputIndex: number; + } | { + oneofKind: "add"; + /** + * + * Add a new change output to the PSBT using the change_type specified in + * the parent message. + * + * @generated from protobuf field: bool add = 3; + */ + add: boolean; + } | { + oneofKind: undefined; + }; +} +/** + * @generated from protobuf message walletrpc.UtxoLease + */ +export interface UtxoLease { + /** + * + * A 32 byte random ID that identifies the lease. + * + * @generated from protobuf field: bytes id = 1; + */ + id: Uint8Array; + /** + * The identifying outpoint of the output being leased. + * + * @generated from protobuf field: lnrpc.OutPoint outpoint = 2; + */ + outpoint?: OutPoint; + /** + * + * The absolute expiration of the output lease represented as a unix timestamp. + * + * @generated from protobuf field: uint64 expiration = 3; + */ + expiration: bigint; + /** + * + * The public key script of the leased output. + * + * @generated from protobuf field: bytes pk_script = 4; + */ + pkScript: Uint8Array; + /** + * + * The value of the leased output in satoshis. + * + * @generated from protobuf field: uint64 value = 5; + */ + value: bigint; +} +/** + * @generated from protobuf message walletrpc.SignPsbtRequest + */ +export interface SignPsbtRequest { + /** + * + * The PSBT that should be signed. The PSBT must contain all required inputs, + * outputs, UTXO data and custom fields required to identify the signing key. + * + * @generated from protobuf field: bytes funded_psbt = 1; + */ + fundedPsbt: Uint8Array; +} +/** + * @generated from protobuf message walletrpc.SignPsbtResponse + */ +export interface SignPsbtResponse { + /** + * The signed transaction in PSBT format. + * + * @generated from protobuf field: bytes signed_psbt = 1; + */ + signedPsbt: Uint8Array; + /** + * The indices of signed inputs. + * + * @generated from protobuf field: repeated uint32 signed_inputs = 2; + */ + signedInputs: number[]; +} +/** + * @generated from protobuf message walletrpc.FinalizePsbtRequest + */ +export interface FinalizePsbtRequest { + /** + * + * A PSBT that should be signed and finalized. The PSBT must contain all + * required inputs, outputs, UTXO data and partial signatures of all other + * signers. + * + * @generated from protobuf field: bytes funded_psbt = 1; + */ + fundedPsbt: Uint8Array; + /** + * + * The name of the account to finalize the PSBT with. If empty, the default + * wallet account is used. + * + * @generated from protobuf field: string account = 5; + */ + account: string; +} +/** + * @generated from protobuf message walletrpc.FinalizePsbtResponse + */ +export interface FinalizePsbtResponse { + /** + * The fully signed and finalized transaction in PSBT format. + * + * @generated from protobuf field: bytes signed_psbt = 1; + */ + signedPsbt: Uint8Array; + /** + * The fully signed and finalized transaction in the raw wire format. + * + * @generated from protobuf field: bytes raw_final_tx = 2; + */ + rawFinalTx: Uint8Array; +} +/** + * @generated from protobuf message walletrpc.ListLeasesRequest + */ +export interface ListLeasesRequest { +} +/** + * @generated from protobuf message walletrpc.ListLeasesResponse + */ +export interface ListLeasesResponse { + /** + * The list of currently leased utxos. + * + * @generated from protobuf field: repeated walletrpc.UtxoLease locked_utxos = 1; + */ + lockedUtxos: UtxoLease[]; +} +/** + * @generated from protobuf enum walletrpc.AddressType + */ +export enum AddressType { + /** + * @generated from protobuf enum value: UNKNOWN = 0; + */ + UNKNOWN = 0, + /** + * @generated from protobuf enum value: WITNESS_PUBKEY_HASH = 1; + */ + WITNESS_PUBKEY_HASH = 1, + /** + * @generated from protobuf enum value: NESTED_WITNESS_PUBKEY_HASH = 2; + */ + NESTED_WITNESS_PUBKEY_HASH = 2, + /** + * @generated from protobuf enum value: HYBRID_NESTED_WITNESS_PUBKEY_HASH = 3; + */ + HYBRID_NESTED_WITNESS_PUBKEY_HASH = 3, + /** + * @generated from protobuf enum value: TAPROOT_PUBKEY = 4; + */ + TAPROOT_PUBKEY = 4 +} +/** + * @generated from protobuf enum walletrpc.WitnessType + */ +export enum WitnessType { + /** + * @generated from protobuf enum value: UNKNOWN_WITNESS = 0; + */ + UNKNOWN_WITNESS = 0, + /** + * + * A witness that allows us to spend the output of a commitment transaction + * after a relative lock-time lockout. + * + * @generated from protobuf enum value: COMMITMENT_TIME_LOCK = 1; + */ + COMMITMENT_TIME_LOCK = 1, + /** + * + * A witness that allows us to spend a settled no-delay output immediately on a + * counterparty's commitment transaction. + * + * @generated from protobuf enum value: COMMITMENT_NO_DELAY = 2; + */ + COMMITMENT_NO_DELAY = 2, + /** + * + * A witness that allows us to sweep the settled output of a malicious + * counterparty's who broadcasts a revoked commitment transaction. + * + * @generated from protobuf enum value: COMMITMENT_REVOKE = 3; + */ + COMMITMENT_REVOKE = 3, + /** + * + * A witness that allows us to sweep an HTLC which we offered to the remote + * party in the case that they broadcast a revoked commitment state. + * + * @generated from protobuf enum value: HTLC_OFFERED_REVOKE = 4; + */ + HTLC_OFFERED_REVOKE = 4, + /** + * + * A witness that allows us to sweep an HTLC output sent to us in the case that + * the remote party broadcasts a revoked commitment state. + * + * @generated from protobuf enum value: HTLC_ACCEPTED_REVOKE = 5; + */ + HTLC_ACCEPTED_REVOKE = 5, + /** + * + * A witness that allows us to sweep an HTLC output that we extended to a + * party, but was never fulfilled. This HTLC output isn't directly on the + * commitment transaction, but is the result of a confirmed second-level HTLC + * transaction. As a result, we can only spend this after a CSV delay. + * + * @generated from protobuf enum value: HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 6; + */ + HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 6, + /** + * + * A witness that allows us to sweep an HTLC output that was offered to us, and + * for which we have a payment preimage. This HTLC output isn't directly on our + * commitment transaction, but is the result of confirmed second-level HTLC + * transaction. As a result, we can only spend this after a CSV delay. + * + * @generated from protobuf enum value: HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 7; + */ + HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 7, + /** + * + * A witness that allows us to sweep an HTLC that we offered to the remote + * party which lies in the commitment transaction of the remote party. We can + * spend this output after the absolute CLTV timeout of the HTLC as passed. + * + * @generated from protobuf enum value: HTLC_OFFERED_REMOTE_TIMEOUT = 8; + */ + HTLC_OFFERED_REMOTE_TIMEOUT = 8, + /** + * + * A witness that allows us to sweep an HTLC that was offered to us by the + * remote party. We use this witness in the case that the remote party goes to + * chain, and we know the pre-image to the HTLC. We can sweep this without any + * additional timeout. + * + * @generated from protobuf enum value: HTLC_ACCEPTED_REMOTE_SUCCESS = 9; + */ + HTLC_ACCEPTED_REMOTE_SUCCESS = 9, + /** + * + * A witness that allows us to sweep an HTLC from the remote party's commitment + * transaction in the case that the broadcast a revoked commitment, but then + * also immediately attempt to go to the second level to claim the HTLC. + * + * @generated from protobuf enum value: HTLC_SECOND_LEVEL_REVOKE = 10; + */ + HTLC_SECOND_LEVEL_REVOKE = 10, + /** + * + * A witness type that allows us to spend a regular p2wkh output that's sent to + * an output which is under complete control of the backing wallet. + * + * @generated from protobuf enum value: WITNESS_KEY_HASH = 11; + */ + WITNESS_KEY_HASH = 11, + /** + * + * A witness type that allows us to sweep an output that sends to a nested P2SH + * script that pays to a key solely under our control. + * + * @generated from protobuf enum value: NESTED_WITNESS_KEY_HASH = 12; + */ + NESTED_WITNESS_KEY_HASH = 12, + /** + * + * A witness type that allows us to spend our anchor on the commitment + * transaction. + * + * @generated from protobuf enum value: COMMITMENT_ANCHOR = 13; + */ + COMMITMENT_ANCHOR = 13, + /** + * + * A witness type that is similar to the COMMITMENT_NO_DELAY type, + * but it omits the tweak that randomizes the key we need to + * spend with a channel peer supplied set of randomness. + * + * @generated from protobuf enum value: COMMITMENT_NO_DELAY_TWEAKLESS = 14; + */ + COMMITMENT_NO_DELAY_TWEAKLESS = 14, + /** + * + * A witness type that allows us to spend our output on the counterparty's + * commitment transaction after a confirmation. + * + * @generated from protobuf enum value: COMMITMENT_TO_REMOTE_CONFIRMED = 15; + */ + COMMITMENT_TO_REMOTE_CONFIRMED = 15, + /** + * + * A witness type that allows us to sweep an HTLC output that we extended + * to a party, but was never fulfilled. This _is_ the HTLC output directly + * on our commitment transaction, and the input to the second-level HTLC + * timeout transaction. It can only be spent after CLTV expiry, and + * commitment confirmation. + * + * @generated from protobuf enum value: HTLC_OFFERED_TIMEOUT_SECOND_LEVEL_INPUT_CONFIRMED = 16; + */ + HTLC_OFFERED_TIMEOUT_SECOND_LEVEL_INPUT_CONFIRMED = 16, + /** + * + * A witness type that allows us to sweep an HTLC output that was offered + * to us, and for which we have a payment preimage. This _is_ the HTLC + * output directly on our commitment transaction, and the input to the + * second-level HTLC success transaction. It can only be spent after the + * commitment has confirmed. + * + * @generated from protobuf enum value: HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL_INPUT_CONFIRMED = 17; + */ + HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL_INPUT_CONFIRMED = 17, + /** + * + * A witness type that allows us to spend our output on our local + * commitment transaction after a relative and absolute lock-time lockout as + * part of the script enforced lease commitment type. + * + * @generated from protobuf enum value: LEASE_COMMITMENT_TIME_LOCK = 18; + */ + LEASE_COMMITMENT_TIME_LOCK = 18, + /** + * + * A witness type that allows us to spend our output on the counterparty's + * commitment transaction after a confirmation and absolute locktime as part + * of the script enforced lease commitment type. + * + * @generated from protobuf enum value: LEASE_COMMITMENT_TO_REMOTE_CONFIRMED = 19; + */ + LEASE_COMMITMENT_TO_REMOTE_CONFIRMED = 19, + /** + * + * A witness type that allows us to sweep an HTLC output that we extended + * to a party, but was never fulfilled. This HTLC output isn't directly on + * the commitment transaction, but is the result of a confirmed second-level + * HTLC transaction. As a result, we can only spend this after a CSV delay + * and CLTV locktime as part of the script enforced lease commitment type. + * + * @generated from protobuf enum value: LEASE_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 20; + */ + LEASE_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 20, + /** + * + * A witness type that allows us to sweep an HTLC output that was offered + * to us, and for which we have a payment preimage. This HTLC output isn't + * directly on our commitment transaction, but is the result of confirmed + * second-level HTLC transaction. As a result, we can only spend this after + * a CSV delay and CLTV locktime as part of the script enforced lease + * commitment type. + * + * @generated from protobuf enum value: LEASE_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 21; + */ + LEASE_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 21, + /** + * + * A witness type that allows us to spend a regular p2tr output that's sent + * to an output which is under complete control of the backing wallet. + * + * @generated from protobuf enum value: TAPROOT_PUB_KEY_SPEND = 22; + */ + TAPROOT_PUB_KEY_SPEND = 22, + /** + * + * A witness type that allows us to spend our settled local commitment after a + * CSV delay when we force close the channel. + * + * @generated from protobuf enum value: TAPROOT_LOCAL_COMMIT_SPEND = 23; + */ + TAPROOT_LOCAL_COMMIT_SPEND = 23, + /** + * + * A witness type that allows us to spend our settled local commitment after + * a CSV delay when the remote party has force closed the channel. + * + * @generated from protobuf enum value: TAPROOT_REMOTE_COMMIT_SPEND = 24; + */ + TAPROOT_REMOTE_COMMIT_SPEND = 24, + /** + * + * A witness type that we'll use for spending our own anchor output. + * + * @generated from protobuf enum value: TAPROOT_ANCHOR_SWEEP_SPEND = 25; + */ + TAPROOT_ANCHOR_SWEEP_SPEND = 25, + /** + * + * A witness that allows us to timeout an HTLC we offered to the remote party + * on our commitment transaction. We use this when we need to go on chain to + * time out an HTLC. + * + * @generated from protobuf enum value: TAPROOT_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 26; + */ + TAPROOT_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 26, + /** + * + * A witness type that allows us to sweep an HTLC we accepted on our commitment + * transaction after we go to the second level on chain. + * + * @generated from protobuf enum value: TAPROOT_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 27; + */ + TAPROOT_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 27, + /** + * + * A witness that allows us to sweep an HTLC on the revoked transaction of the + * remote party that goes to the second level. + * + * @generated from protobuf enum value: TAPROOT_HTLC_SECOND_LEVEL_REVOKE = 28; + */ + TAPROOT_HTLC_SECOND_LEVEL_REVOKE = 28, + /** + * + * A witness that allows us to sweep an HTLC sent to us by the remote party + * in the event that they broadcast a revoked state. + * + * @generated from protobuf enum value: TAPROOT_HTLC_ACCEPTED_REVOKE = 29; + */ + TAPROOT_HTLC_ACCEPTED_REVOKE = 29, + /** + * + * A witness that allows us to sweep an HTLC we offered to the remote party if + * they broadcast a revoked commitment. + * + * @generated from protobuf enum value: TAPROOT_HTLC_OFFERED_REVOKE = 30; + */ + TAPROOT_HTLC_OFFERED_REVOKE = 30, + /** + * + * A witness that allows us to sweep an HTLC we offered to the remote party + * that lies on the commitment transaction for the remote party. We can spend + * this output after the absolute CLTV timeout of the HTLC as passed. + * + * @generated from protobuf enum value: TAPROOT_HTLC_OFFERED_REMOTE_TIMEOUT = 31; + */ + TAPROOT_HTLC_OFFERED_REMOTE_TIMEOUT = 31, + /** + * + * A witness type that allows us to sign the second level HTLC timeout + * transaction when spending from an HTLC residing on our local commitment + * transaction. + * This is used by the sweeper to re-sign inputs if it needs to aggregate + * several second level HTLCs. + * + * @generated from protobuf enum value: TAPROOT_HTLC_LOCAL_OFFERED_TIMEOUT = 32; + */ + TAPROOT_HTLC_LOCAL_OFFERED_TIMEOUT = 32, + /** + * + * A witness that allows us to sweep an HTLC that was offered to us by the + * remote party for a taproot channels. We use this witness in the case that + * the remote party goes to chain, and we know the pre-image to the HTLC. We + * can sweep this without any additional timeout. + * + * @generated from protobuf enum value: TAPROOT_HTLC_ACCEPTED_REMOTE_SUCCESS = 33; + */ + TAPROOT_HTLC_ACCEPTED_REMOTE_SUCCESS = 33, + /** + * + * A witness type that allows us to sweep the HTLC offered to us on our local + * commitment transaction. We'll use this when we need to go on chain to sweep + * the HTLC. In this case, this is the second level HTLC success transaction. + * + * @generated from protobuf enum value: TAPROOT_HTLC_ACCEPTED_LOCAL_SUCCESS = 34; + */ + TAPROOT_HTLC_ACCEPTED_LOCAL_SUCCESS = 34, + /** + * + * A witness that allows us to sweep the settled output of a malicious + * counterparty's who broadcasts a revoked taproot commitment transaction. + * + * @generated from protobuf enum value: TAPROOT_COMMITMENT_REVOKE = 35; + */ + TAPROOT_COMMITMENT_REVOKE = 35 +} +/** + * The possible change address types for default accounts and single imported + * public keys. By default, P2WPKH will be used. We don't provide the + * possibility to choose P2PKH as it is a legacy key scope, nor NP2WPKH as + * no key scope permits to do so. For custom accounts, no change type should + * be provided as the coin selection key scope will always be used to generate + * the change address. + * + * @generated from protobuf enum walletrpc.ChangeAddressType + */ +export enum ChangeAddressType { + /** + * CHANGE_ADDRESS_TYPE_UNSPECIFIED indicates that no change address type is + * provided. We will then use P2WPKH address type for change (BIP0084 key + * scope). + * + * @generated from protobuf enum value: CHANGE_ADDRESS_TYPE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + /** + * CHANGE_ADDRESS_TYPE_P2TR indicates to use P2TR address for change output + * (BIP0086 key scope). + * + * @generated from protobuf enum value: CHANGE_ADDRESS_TYPE_P2TR = 1; + */ + P2TR = 1 +} +// @generated message type with reflection information, may provide speed optimized methods +class ListUnspentRequest$Type extends MessageType { + constructor() { + super("walletrpc.ListUnspentRequest", [ + { no: 1, name: "min_confs", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 2, name: "max_confs", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 3, name: "account", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "unconfirmed_only", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): ListUnspentRequest { + const message = { minConfs: 0, maxConfs: 0, account: "", unconfirmedOnly: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListUnspentRequest): ListUnspentRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int32 min_confs */ 1: + message.minConfs = reader.int32(); + break; + case /* int32 max_confs */ 2: + message.maxConfs = reader.int32(); + break; + case /* string account */ 3: + message.account = reader.string(); + break; + case /* bool unconfirmed_only */ 4: + message.unconfirmedOnly = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListUnspentRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int32 min_confs = 1; */ + if (message.minConfs !== 0) + writer.tag(1, WireType.Varint).int32(message.minConfs); + /* int32 max_confs = 2; */ + if (message.maxConfs !== 0) + writer.tag(2, WireType.Varint).int32(message.maxConfs); + /* string account = 3; */ + if (message.account !== "") + writer.tag(3, WireType.LengthDelimited).string(message.account); + /* bool unconfirmed_only = 4; */ + if (message.unconfirmedOnly !== false) + writer.tag(4, WireType.Varint).bool(message.unconfirmedOnly); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListUnspentRequest + */ +export const ListUnspentRequest = new ListUnspentRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListUnspentResponse$Type extends MessageType { + constructor() { + super("walletrpc.ListUnspentResponse", [ + { no: 1, name: "utxos", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Utxo } + ]); + } + create(value?: PartialMessage): ListUnspentResponse { + const message = { utxos: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListUnspentResponse): ListUnspentResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated lnrpc.Utxo utxos */ 1: + message.utxos.push(Utxo.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListUnspentResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated lnrpc.Utxo utxos = 1; */ + for (let i = 0; i < message.utxos.length; i++) + Utxo.internalBinaryWrite(message.utxos[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListUnspentResponse + */ +export const ListUnspentResponse = new ListUnspentResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LeaseOutputRequest$Type extends MessageType { + constructor() { + super("walletrpc.LeaseOutputRequest", [ + { no: 1, name: "id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "outpoint", kind: "message", T: () => OutPoint }, + { no: 3, name: "expiration_seconds", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } + ]); + } + create(value?: PartialMessage): LeaseOutputRequest { + const message = { id: new Uint8Array(0), expirationSeconds: 0n }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LeaseOutputRequest): LeaseOutputRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes id */ 1: + message.id = reader.bytes(); + break; + case /* lnrpc.OutPoint outpoint */ 2: + message.outpoint = OutPoint.internalBinaryRead(reader, reader.uint32(), options, message.outpoint); + break; + case /* uint64 expiration_seconds */ 3: + message.expirationSeconds = reader.uint64().toBigInt(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: LeaseOutputRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes id = 1; */ + if (message.id.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.id); + /* lnrpc.OutPoint outpoint = 2; */ + if (message.outpoint) + OutPoint.internalBinaryWrite(message.outpoint, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* uint64 expiration_seconds = 3; */ + if (message.expirationSeconds !== 0n) + writer.tag(3, WireType.Varint).uint64(message.expirationSeconds); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.LeaseOutputRequest + */ +export const LeaseOutputRequest = new LeaseOutputRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LeaseOutputResponse$Type extends MessageType { + constructor() { + super("walletrpc.LeaseOutputResponse", [ + { no: 1, name: "expiration", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } + ]); + } + create(value?: PartialMessage): LeaseOutputResponse { + const message = { expiration: 0n }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LeaseOutputResponse): LeaseOutputResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* uint64 expiration */ 1: + message.expiration = reader.uint64().toBigInt(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: LeaseOutputResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* uint64 expiration = 1; */ + if (message.expiration !== 0n) + writer.tag(1, WireType.Varint).uint64(message.expiration); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.LeaseOutputResponse + */ +export const LeaseOutputResponse = new LeaseOutputResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ReleaseOutputRequest$Type extends MessageType { + constructor() { + super("walletrpc.ReleaseOutputRequest", [ + { no: 1, name: "id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "outpoint", kind: "message", T: () => OutPoint } + ]); + } + create(value?: PartialMessage): ReleaseOutputRequest { + const message = { id: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ReleaseOutputRequest): ReleaseOutputRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes id */ 1: + message.id = reader.bytes(); + break; + case /* lnrpc.OutPoint outpoint */ 2: + message.outpoint = OutPoint.internalBinaryRead(reader, reader.uint32(), options, message.outpoint); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ReleaseOutputRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes id = 1; */ + if (message.id.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.id); + /* lnrpc.OutPoint outpoint = 2; */ + if (message.outpoint) + OutPoint.internalBinaryWrite(message.outpoint, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ReleaseOutputRequest + */ +export const ReleaseOutputRequest = new ReleaseOutputRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ReleaseOutputResponse$Type extends MessageType { + constructor() { + super("walletrpc.ReleaseOutputResponse", [ + { no: 1, name: "status", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): ReleaseOutputResponse { + const message = { status: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ReleaseOutputResponse): ReleaseOutputResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string status */ 1: + message.status = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ReleaseOutputResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string status = 1; */ + if (message.status !== "") + writer.tag(1, WireType.LengthDelimited).string(message.status); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ReleaseOutputResponse + */ +export const ReleaseOutputResponse = new ReleaseOutputResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class KeyReq$Type extends MessageType { + constructor() { + super("walletrpc.KeyReq", [ + { no: 1, name: "key_finger_print", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 2, name: "key_family", kind: "scalar", T: 5 /*ScalarType.INT32*/ } + ]); + } + create(value?: PartialMessage): KeyReq { + const message = { keyFingerPrint: 0, keyFamily: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: KeyReq): KeyReq { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int32 key_finger_print */ 1: + message.keyFingerPrint = reader.int32(); + break; + case /* int32 key_family */ 2: + message.keyFamily = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: KeyReq, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int32 key_finger_print = 1; */ + if (message.keyFingerPrint !== 0) + writer.tag(1, WireType.Varint).int32(message.keyFingerPrint); + /* int32 key_family = 2; */ + if (message.keyFamily !== 0) + writer.tag(2, WireType.Varint).int32(message.keyFamily); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.KeyReq + */ +export const KeyReq = new KeyReq$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class AddrRequest$Type extends MessageType { + constructor() { + super("walletrpc.AddrRequest", [ + { no: 1, name: "account", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "type", kind: "enum", T: () => ["walletrpc.AddressType", AddressType] }, + { no: 3, name: "change", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): AddrRequest { + const message = { account: "", type: 0, change: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddrRequest): AddrRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string account */ 1: + message.account = reader.string(); + break; + case /* walletrpc.AddressType type */ 2: + message.type = reader.int32(); + break; + case /* bool change */ 3: + message.change = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: AddrRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string account = 1; */ + if (message.account !== "") + writer.tag(1, WireType.LengthDelimited).string(message.account); + /* walletrpc.AddressType type = 2; */ + if (message.type !== 0) + writer.tag(2, WireType.Varint).int32(message.type); + /* bool change = 3; */ + if (message.change !== false) + writer.tag(3, WireType.Varint).bool(message.change); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.AddrRequest + */ +export const AddrRequest = new AddrRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class AddrResponse$Type extends MessageType { + constructor() { + super("walletrpc.AddrResponse", [ + { no: 1, name: "addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): AddrResponse { + const message = { addr: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddrResponse): AddrResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string addr */ 1: + message.addr = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: AddrResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string addr = 1; */ + if (message.addr !== "") + writer.tag(1, WireType.LengthDelimited).string(message.addr); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.AddrResponse + */ +export const AddrResponse = new AddrResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class Account$Type extends MessageType { + constructor() { + super("walletrpc.Account", [ + { no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "address_type", kind: "enum", T: () => ["walletrpc.AddressType", AddressType] }, + { no: 3, name: "extended_public_key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "master_key_fingerprint", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 5, name: "derivation_path", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 6, name: "external_key_count", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 7, name: "internal_key_count", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 8, name: "watch_only", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): Account { + const message = { name: "", addressType: 0, extendedPublicKey: "", masterKeyFingerprint: new Uint8Array(0), derivationPath: "", externalKeyCount: 0, internalKeyCount: 0, watchOnly: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Account): Account { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string name */ 1: + message.name = reader.string(); + break; + case /* walletrpc.AddressType address_type */ 2: + message.addressType = reader.int32(); + break; + case /* string extended_public_key */ 3: + message.extendedPublicKey = reader.string(); + break; + case /* bytes master_key_fingerprint */ 4: + message.masterKeyFingerprint = reader.bytes(); + break; + case /* string derivation_path */ 5: + message.derivationPath = reader.string(); + break; + case /* uint32 external_key_count */ 6: + message.externalKeyCount = reader.uint32(); + break; + case /* uint32 internal_key_count */ 7: + message.internalKeyCount = reader.uint32(); + break; + case /* bool watch_only */ 8: + message.watchOnly = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: Account, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string name = 1; */ + if (message.name !== "") + writer.tag(1, WireType.LengthDelimited).string(message.name); + /* walletrpc.AddressType address_type = 2; */ + if (message.addressType !== 0) + writer.tag(2, WireType.Varint).int32(message.addressType); + /* string extended_public_key = 3; */ + if (message.extendedPublicKey !== "") + writer.tag(3, WireType.LengthDelimited).string(message.extendedPublicKey); + /* bytes master_key_fingerprint = 4; */ + if (message.masterKeyFingerprint.length) + writer.tag(4, WireType.LengthDelimited).bytes(message.masterKeyFingerprint); + /* string derivation_path = 5; */ + if (message.derivationPath !== "") + writer.tag(5, WireType.LengthDelimited).string(message.derivationPath); + /* uint32 external_key_count = 6; */ + if (message.externalKeyCount !== 0) + writer.tag(6, WireType.Varint).uint32(message.externalKeyCount); + /* uint32 internal_key_count = 7; */ + if (message.internalKeyCount !== 0) + writer.tag(7, WireType.Varint).uint32(message.internalKeyCount); + /* bool watch_only = 8; */ + if (message.watchOnly !== false) + writer.tag(8, WireType.Varint).bool(message.watchOnly); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.Account + */ +export const Account = new Account$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class AddressProperty$Type extends MessageType { + constructor() { + super("walletrpc.AddressProperty", [ + { no: 1, name: "address", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "is_internal", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 3, name: "balance", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 4, name: "derivation_path", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 5, name: "public_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): AddressProperty { + const message = { address: "", isInternal: false, balance: 0n, derivationPath: "", publicKey: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddressProperty): AddressProperty { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string address */ 1: + message.address = reader.string(); + break; + case /* bool is_internal */ 2: + message.isInternal = reader.bool(); + break; + case /* int64 balance */ 3: + message.balance = reader.int64().toBigInt(); + break; + case /* string derivation_path */ 4: + message.derivationPath = reader.string(); + break; + case /* bytes public_key */ 5: + message.publicKey = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: AddressProperty, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string address = 1; */ + if (message.address !== "") + writer.tag(1, WireType.LengthDelimited).string(message.address); + /* bool is_internal = 2; */ + if (message.isInternal !== false) + writer.tag(2, WireType.Varint).bool(message.isInternal); + /* int64 balance = 3; */ + if (message.balance !== 0n) + writer.tag(3, WireType.Varint).int64(message.balance); + /* string derivation_path = 4; */ + if (message.derivationPath !== "") + writer.tag(4, WireType.LengthDelimited).string(message.derivationPath); + /* bytes public_key = 5; */ + if (message.publicKey.length) + writer.tag(5, WireType.LengthDelimited).bytes(message.publicKey); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.AddressProperty + */ +export const AddressProperty = new AddressProperty$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class AccountWithAddresses$Type extends MessageType { + constructor() { + super("walletrpc.AccountWithAddresses", [ + { no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "address_type", kind: "enum", T: () => ["walletrpc.AddressType", AddressType] }, + { no: 3, name: "derivation_path", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "addresses", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => AddressProperty } + ]); + } + create(value?: PartialMessage): AccountWithAddresses { + const message = { name: "", addressType: 0, derivationPath: "", addresses: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AccountWithAddresses): AccountWithAddresses { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string name */ 1: + message.name = reader.string(); + break; + case /* walletrpc.AddressType address_type */ 2: + message.addressType = reader.int32(); + break; + case /* string derivation_path */ 3: + message.derivationPath = reader.string(); + break; + case /* repeated walletrpc.AddressProperty addresses */ 4: + message.addresses.push(AddressProperty.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: AccountWithAddresses, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string name = 1; */ + if (message.name !== "") + writer.tag(1, WireType.LengthDelimited).string(message.name); + /* walletrpc.AddressType address_type = 2; */ + if (message.addressType !== 0) + writer.tag(2, WireType.Varint).int32(message.addressType); + /* string derivation_path = 3; */ + if (message.derivationPath !== "") + writer.tag(3, WireType.LengthDelimited).string(message.derivationPath); + /* repeated walletrpc.AddressProperty addresses = 4; */ + for (let i = 0; i < message.addresses.length; i++) + AddressProperty.internalBinaryWrite(message.addresses[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.AccountWithAddresses + */ +export const AccountWithAddresses = new AccountWithAddresses$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListAccountsRequest$Type extends MessageType { + constructor() { + super("walletrpc.ListAccountsRequest", [ + { no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "address_type", kind: "enum", T: () => ["walletrpc.AddressType", AddressType] } + ]); + } + create(value?: PartialMessage): ListAccountsRequest { + const message = { name: "", addressType: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListAccountsRequest): ListAccountsRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string name */ 1: + message.name = reader.string(); + break; + case /* walletrpc.AddressType address_type */ 2: + message.addressType = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListAccountsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string name = 1; */ + if (message.name !== "") + writer.tag(1, WireType.LengthDelimited).string(message.name); + /* walletrpc.AddressType address_type = 2; */ + if (message.addressType !== 0) + writer.tag(2, WireType.Varint).int32(message.addressType); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListAccountsRequest + */ +export const ListAccountsRequest = new ListAccountsRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListAccountsResponse$Type extends MessageType { + constructor() { + super("walletrpc.ListAccountsResponse", [ + { no: 1, name: "accounts", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Account } + ]); + } + create(value?: PartialMessage): ListAccountsResponse { + const message = { accounts: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListAccountsResponse): ListAccountsResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated walletrpc.Account accounts */ 1: + message.accounts.push(Account.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListAccountsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated walletrpc.Account accounts = 1; */ + for (let i = 0; i < message.accounts.length; i++) + Account.internalBinaryWrite(message.accounts[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListAccountsResponse + */ +export const ListAccountsResponse = new ListAccountsResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RequiredReserveRequest$Type extends MessageType { + constructor() { + super("walletrpc.RequiredReserveRequest", [ + { no: 1, name: "additional_public_channels", kind: "scalar", T: 13 /*ScalarType.UINT32*/ } + ]); + } + create(value?: PartialMessage): RequiredReserveRequest { + const message = { additionalPublicChannels: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RequiredReserveRequest): RequiredReserveRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* uint32 additional_public_channels */ 1: + message.additionalPublicChannels = reader.uint32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: RequiredReserveRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* uint32 additional_public_channels = 1; */ + if (message.additionalPublicChannels !== 0) + writer.tag(1, WireType.Varint).uint32(message.additionalPublicChannels); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.RequiredReserveRequest + */ +export const RequiredReserveRequest = new RequiredReserveRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RequiredReserveResponse$Type extends MessageType { + constructor() { + super("walletrpc.RequiredReserveResponse", [ + { no: 1, name: "required_reserve", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } + ]); + } + create(value?: PartialMessage): RequiredReserveResponse { + const message = { requiredReserve: 0n }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RequiredReserveResponse): RequiredReserveResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int64 required_reserve */ 1: + message.requiredReserve = reader.int64().toBigInt(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: RequiredReserveResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int64 required_reserve = 1; */ + if (message.requiredReserve !== 0n) + writer.tag(1, WireType.Varint).int64(message.requiredReserve); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.RequiredReserveResponse + */ +export const RequiredReserveResponse = new RequiredReserveResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListAddressesRequest$Type extends MessageType { + constructor() { + super("walletrpc.ListAddressesRequest", [ + { no: 1, name: "account_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "show_custom_accounts", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): ListAddressesRequest { + const message = { accountName: "", showCustomAccounts: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListAddressesRequest): ListAddressesRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string account_name */ 1: + message.accountName = reader.string(); + break; + case /* bool show_custom_accounts */ 2: + message.showCustomAccounts = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListAddressesRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string account_name = 1; */ + if (message.accountName !== "") + writer.tag(1, WireType.LengthDelimited).string(message.accountName); + /* bool show_custom_accounts = 2; */ + if (message.showCustomAccounts !== false) + writer.tag(2, WireType.Varint).bool(message.showCustomAccounts); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListAddressesRequest + */ +export const ListAddressesRequest = new ListAddressesRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListAddressesResponse$Type extends MessageType { + constructor() { + super("walletrpc.ListAddressesResponse", [ + { no: 1, name: "account_with_addresses", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => AccountWithAddresses } + ]); + } + create(value?: PartialMessage): ListAddressesResponse { + const message = { accountWithAddresses: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListAddressesResponse): ListAddressesResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated walletrpc.AccountWithAddresses account_with_addresses */ 1: + message.accountWithAddresses.push(AccountWithAddresses.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListAddressesResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated walletrpc.AccountWithAddresses account_with_addresses = 1; */ + for (let i = 0; i < message.accountWithAddresses.length; i++) + AccountWithAddresses.internalBinaryWrite(message.accountWithAddresses[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListAddressesResponse + */ +export const ListAddressesResponse = new ListAddressesResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class GetTransactionRequest$Type extends MessageType { + constructor() { + super("walletrpc.GetTransactionRequest", [ + { no: 1, name: "txid", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): GetTransactionRequest { + const message = { txid: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetTransactionRequest): GetTransactionRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string txid */ 1: + message.txid = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: GetTransactionRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string txid = 1; */ + if (message.txid !== "") + writer.tag(1, WireType.LengthDelimited).string(message.txid); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.GetTransactionRequest + */ +export const GetTransactionRequest = new GetTransactionRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignMessageWithAddrRequest$Type extends MessageType { + constructor() { + super("walletrpc.SignMessageWithAddrRequest", [ + { no: 1, name: "msg", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): SignMessageWithAddrRequest { + const message = { msg: new Uint8Array(0), addr: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignMessageWithAddrRequest): SignMessageWithAddrRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes msg */ 1: + message.msg = reader.bytes(); + break; + case /* string addr */ 2: + message.addr = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignMessageWithAddrRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes msg = 1; */ + if (message.msg.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.msg); + /* string addr = 2; */ + if (message.addr !== "") + writer.tag(2, WireType.LengthDelimited).string(message.addr); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.SignMessageWithAddrRequest + */ +export const SignMessageWithAddrRequest = new SignMessageWithAddrRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignMessageWithAddrResponse$Type extends MessageType { + constructor() { + super("walletrpc.SignMessageWithAddrResponse", [ + { no: 1, name: "signature", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): SignMessageWithAddrResponse { + const message = { signature: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignMessageWithAddrResponse): SignMessageWithAddrResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string signature */ 1: + message.signature = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignMessageWithAddrResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string signature = 1; */ + if (message.signature !== "") + writer.tag(1, WireType.LengthDelimited).string(message.signature); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.SignMessageWithAddrResponse + */ +export const SignMessageWithAddrResponse = new SignMessageWithAddrResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class VerifyMessageWithAddrRequest$Type extends MessageType { + constructor() { + super("walletrpc.VerifyMessageWithAddrRequest", [ + { no: 1, name: "msg", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "signature", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): VerifyMessageWithAddrRequest { + const message = { msg: new Uint8Array(0), signature: "", addr: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: VerifyMessageWithAddrRequest): VerifyMessageWithAddrRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes msg */ 1: + message.msg = reader.bytes(); + break; + case /* string signature */ 2: + message.signature = reader.string(); + break; + case /* string addr */ 3: + message.addr = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: VerifyMessageWithAddrRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes msg = 1; */ + if (message.msg.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.msg); + /* string signature = 2; */ + if (message.signature !== "") + writer.tag(2, WireType.LengthDelimited).string(message.signature); + /* string addr = 3; */ + if (message.addr !== "") + writer.tag(3, WireType.LengthDelimited).string(message.addr); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.VerifyMessageWithAddrRequest + */ +export const VerifyMessageWithAddrRequest = new VerifyMessageWithAddrRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class VerifyMessageWithAddrResponse$Type extends MessageType { + constructor() { + super("walletrpc.VerifyMessageWithAddrResponse", [ + { no: 1, name: "valid", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 2, name: "pubkey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): VerifyMessageWithAddrResponse { + const message = { valid: false, pubkey: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: VerifyMessageWithAddrResponse): VerifyMessageWithAddrResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bool valid */ 1: + message.valid = reader.bool(); + break; + case /* bytes pubkey */ 2: + message.pubkey = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: VerifyMessageWithAddrResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bool valid = 1; */ + if (message.valid !== false) + writer.tag(1, WireType.Varint).bool(message.valid); + /* bytes pubkey = 2; */ + if (message.pubkey.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.pubkey); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.VerifyMessageWithAddrResponse + */ +export const VerifyMessageWithAddrResponse = new VerifyMessageWithAddrResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ImportAccountRequest$Type extends MessageType { + constructor() { + super("walletrpc.ImportAccountRequest", [ + { no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "extended_public_key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "master_key_fingerprint", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "address_type", kind: "enum", T: () => ["walletrpc.AddressType", AddressType] }, + { no: 5, name: "dry_run", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): ImportAccountRequest { + const message = { name: "", extendedPublicKey: "", masterKeyFingerprint: new Uint8Array(0), addressType: 0, dryRun: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ImportAccountRequest): ImportAccountRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string name */ 1: + message.name = reader.string(); + break; + case /* string extended_public_key */ 2: + message.extendedPublicKey = reader.string(); + break; + case /* bytes master_key_fingerprint */ 3: + message.masterKeyFingerprint = reader.bytes(); + break; + case /* walletrpc.AddressType address_type */ 4: + message.addressType = reader.int32(); + break; + case /* bool dry_run */ 5: + message.dryRun = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ImportAccountRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string name = 1; */ + if (message.name !== "") + writer.tag(1, WireType.LengthDelimited).string(message.name); + /* string extended_public_key = 2; */ + if (message.extendedPublicKey !== "") + writer.tag(2, WireType.LengthDelimited).string(message.extendedPublicKey); + /* bytes master_key_fingerprint = 3; */ + if (message.masterKeyFingerprint.length) + writer.tag(3, WireType.LengthDelimited).bytes(message.masterKeyFingerprint); + /* walletrpc.AddressType address_type = 4; */ + if (message.addressType !== 0) + writer.tag(4, WireType.Varint).int32(message.addressType); + /* bool dry_run = 5; */ + if (message.dryRun !== false) + writer.tag(5, WireType.Varint).bool(message.dryRun); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ImportAccountRequest + */ +export const ImportAccountRequest = new ImportAccountRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ImportAccountResponse$Type extends MessageType { + constructor() { + super("walletrpc.ImportAccountResponse", [ + { no: 1, name: "account", kind: "message", T: () => Account }, + { no: 2, name: "dry_run_external_addrs", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "dry_run_internal_addrs", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): ImportAccountResponse { + const message = { dryRunExternalAddrs: [], dryRunInternalAddrs: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ImportAccountResponse): ImportAccountResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* walletrpc.Account account */ 1: + message.account = Account.internalBinaryRead(reader, reader.uint32(), options, message.account); + break; + case /* repeated string dry_run_external_addrs */ 2: + message.dryRunExternalAddrs.push(reader.string()); + break; + case /* repeated string dry_run_internal_addrs */ 3: + message.dryRunInternalAddrs.push(reader.string()); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ImportAccountResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* walletrpc.Account account = 1; */ + if (message.account) + Account.internalBinaryWrite(message.account, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* repeated string dry_run_external_addrs = 2; */ + for (let i = 0; i < message.dryRunExternalAddrs.length; i++) + writer.tag(2, WireType.LengthDelimited).string(message.dryRunExternalAddrs[i]); + /* repeated string dry_run_internal_addrs = 3; */ + for (let i = 0; i < message.dryRunInternalAddrs.length; i++) + writer.tag(3, WireType.LengthDelimited).string(message.dryRunInternalAddrs[i]); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ImportAccountResponse + */ +export const ImportAccountResponse = new ImportAccountResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ImportPublicKeyRequest$Type extends MessageType { + constructor() { + super("walletrpc.ImportPublicKeyRequest", [ + { no: 1, name: "public_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "address_type", kind: "enum", T: () => ["walletrpc.AddressType", AddressType] } + ]); + } + create(value?: PartialMessage): ImportPublicKeyRequest { + const message = { publicKey: new Uint8Array(0), addressType: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ImportPublicKeyRequest): ImportPublicKeyRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes public_key */ 1: + message.publicKey = reader.bytes(); + break; + case /* walletrpc.AddressType address_type */ 2: + message.addressType = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ImportPublicKeyRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes public_key = 1; */ + if (message.publicKey.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.publicKey); + /* walletrpc.AddressType address_type = 2; */ + if (message.addressType !== 0) + writer.tag(2, WireType.Varint).int32(message.addressType); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ImportPublicKeyRequest + */ +export const ImportPublicKeyRequest = new ImportPublicKeyRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ImportPublicKeyResponse$Type extends MessageType { + constructor() { + super("walletrpc.ImportPublicKeyResponse", [ + { no: 1, name: "status", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): ImportPublicKeyResponse { + const message = { status: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ImportPublicKeyResponse): ImportPublicKeyResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string status */ 1: + message.status = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ImportPublicKeyResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string status = 1; */ + if (message.status !== "") + writer.tag(1, WireType.LengthDelimited).string(message.status); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ImportPublicKeyResponse + */ +export const ImportPublicKeyResponse = new ImportPublicKeyResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ImportTapscriptRequest$Type extends MessageType { + constructor() { + super("walletrpc.ImportTapscriptRequest", [ + { no: 1, name: "internal_public_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "full_tree", kind: "message", oneof: "script", T: () => TapscriptFullTree }, + { no: 3, name: "partial_reveal", kind: "message", oneof: "script", T: () => TapscriptPartialReveal }, + { no: 4, name: "root_hash_only", kind: "scalar", oneof: "script", T: 12 /*ScalarType.BYTES*/ }, + { no: 5, name: "full_key_only", kind: "scalar", oneof: "script", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): ImportTapscriptRequest { + const message = { internalPublicKey: new Uint8Array(0), script: { oneofKind: undefined } }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ImportTapscriptRequest): ImportTapscriptRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes internal_public_key */ 1: + message.internalPublicKey = reader.bytes(); + break; + case /* walletrpc.TapscriptFullTree full_tree */ 2: + message.script = { + oneofKind: "fullTree", + fullTree: TapscriptFullTree.internalBinaryRead(reader, reader.uint32(), options, (message.script as any).fullTree) + }; + break; + case /* walletrpc.TapscriptPartialReveal partial_reveal */ 3: + message.script = { + oneofKind: "partialReveal", + partialReveal: TapscriptPartialReveal.internalBinaryRead(reader, reader.uint32(), options, (message.script as any).partialReveal) + }; + break; + case /* bytes root_hash_only */ 4: + message.script = { + oneofKind: "rootHashOnly", + rootHashOnly: reader.bytes() + }; + break; + case /* bool full_key_only */ 5: + message.script = { + oneofKind: "fullKeyOnly", + fullKeyOnly: reader.bool() + }; + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ImportTapscriptRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes internal_public_key = 1; */ + if (message.internalPublicKey.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.internalPublicKey); + /* walletrpc.TapscriptFullTree full_tree = 2; */ + if (message.script.oneofKind === "fullTree") + TapscriptFullTree.internalBinaryWrite(message.script.fullTree, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* walletrpc.TapscriptPartialReveal partial_reveal = 3; */ + if (message.script.oneofKind === "partialReveal") + TapscriptPartialReveal.internalBinaryWrite(message.script.partialReveal, writer.tag(3, WireType.LengthDelimited).fork(), options).join(); + /* bytes root_hash_only = 4; */ + if (message.script.oneofKind === "rootHashOnly") + writer.tag(4, WireType.LengthDelimited).bytes(message.script.rootHashOnly); + /* bool full_key_only = 5; */ + if (message.script.oneofKind === "fullKeyOnly") + writer.tag(5, WireType.Varint).bool(message.script.fullKeyOnly); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ImportTapscriptRequest + */ +export const ImportTapscriptRequest = new ImportTapscriptRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class TapscriptFullTree$Type extends MessageType { + constructor() { + super("walletrpc.TapscriptFullTree", [ + { no: 1, name: "all_leaves", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => TapLeaf } + ]); + } + create(value?: PartialMessage): TapscriptFullTree { + const message = { allLeaves: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapscriptFullTree): TapscriptFullTree { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated walletrpc.TapLeaf all_leaves */ 1: + message.allLeaves.push(TapLeaf.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: TapscriptFullTree, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated walletrpc.TapLeaf all_leaves = 1; */ + for (let i = 0; i < message.allLeaves.length; i++) + TapLeaf.internalBinaryWrite(message.allLeaves[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.TapscriptFullTree + */ +export const TapscriptFullTree = new TapscriptFullTree$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class TapLeaf$Type extends MessageType { + constructor() { + super("walletrpc.TapLeaf", [ + { no: 1, name: "leaf_version", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 2, name: "script", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): TapLeaf { + const message = { leafVersion: 0, script: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapLeaf): TapLeaf { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* uint32 leaf_version */ 1: + message.leafVersion = reader.uint32(); + break; + case /* bytes script */ 2: + message.script = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: TapLeaf, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* uint32 leaf_version = 1; */ + if (message.leafVersion !== 0) + writer.tag(1, WireType.Varint).uint32(message.leafVersion); + /* bytes script = 2; */ + if (message.script.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.script); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.TapLeaf + */ +export const TapLeaf = new TapLeaf$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class TapscriptPartialReveal$Type extends MessageType { + constructor() { + super("walletrpc.TapscriptPartialReveal", [ + { no: 1, name: "revealed_leaf", kind: "message", T: () => TapLeaf }, + { no: 2, name: "full_inclusion_proof", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): TapscriptPartialReveal { + const message = { fullInclusionProof: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapscriptPartialReveal): TapscriptPartialReveal { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* walletrpc.TapLeaf revealed_leaf */ 1: + message.revealedLeaf = TapLeaf.internalBinaryRead(reader, reader.uint32(), options, message.revealedLeaf); + break; + case /* bytes full_inclusion_proof */ 2: + message.fullInclusionProof = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: TapscriptPartialReveal, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* walletrpc.TapLeaf revealed_leaf = 1; */ + if (message.revealedLeaf) + TapLeaf.internalBinaryWrite(message.revealedLeaf, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* bytes full_inclusion_proof = 2; */ + if (message.fullInclusionProof.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.fullInclusionProof); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.TapscriptPartialReveal + */ +export const TapscriptPartialReveal = new TapscriptPartialReveal$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ImportTapscriptResponse$Type extends MessageType { + constructor() { + super("walletrpc.ImportTapscriptResponse", [ + { no: 1, name: "p2tr_address", kind: "scalar", jsonName: "p2trAddress", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): ImportTapscriptResponse { + const message = { p2TrAddress: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ImportTapscriptResponse): ImportTapscriptResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string p2tr_address = 1 [json_name = "p2trAddress"];*/ 1: + message.p2TrAddress = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ImportTapscriptResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string p2tr_address = 1 [json_name = "p2trAddress"]; */ + if (message.p2TrAddress !== "") + writer.tag(1, WireType.LengthDelimited).string(message.p2TrAddress); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ImportTapscriptResponse + */ +export const ImportTapscriptResponse = new ImportTapscriptResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class Transaction$Type extends MessageType { + constructor() { + super("walletrpc.Transaction", [ + { no: 1, name: "tx_hex", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "label", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): Transaction { + const message = { txHex: new Uint8Array(0), label: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Transaction): Transaction { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes tx_hex */ 1: + message.txHex = reader.bytes(); + break; + case /* string label */ 2: + message.label = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: Transaction, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes tx_hex = 1; */ + if (message.txHex.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.txHex); + /* string label = 2; */ + if (message.label !== "") + writer.tag(2, WireType.LengthDelimited).string(message.label); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.Transaction + */ +export const Transaction = new Transaction$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PublishResponse$Type extends MessageType { + constructor() { + super("walletrpc.PublishResponse", [ + { no: 1, name: "publish_error", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): PublishResponse { + const message = { publishError: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PublishResponse): PublishResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string publish_error */ 1: + message.publishError = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: PublishResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string publish_error = 1; */ + if (message.publishError !== "") + writer.tag(1, WireType.LengthDelimited).string(message.publishError); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.PublishResponse + */ +export const PublishResponse = new PublishResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RemoveTransactionResponse$Type extends MessageType { + constructor() { + super("walletrpc.RemoveTransactionResponse", [ + { no: 1, name: "status", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): RemoveTransactionResponse { + const message = { status: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RemoveTransactionResponse): RemoveTransactionResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string status */ 1: + message.status = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: RemoveTransactionResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string status = 1; */ + if (message.status !== "") + writer.tag(1, WireType.LengthDelimited).string(message.status); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.RemoveTransactionResponse + */ +export const RemoveTransactionResponse = new RemoveTransactionResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SendOutputsRequest$Type extends MessageType { + constructor() { + super("walletrpc.SendOutputsRequest", [ + { no: 1, name: "sat_per_kw", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 2, name: "outputs", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => TxOut }, + { no: 3, name: "label", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "min_confs", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 5, name: "spend_unconfirmed", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 6, name: "coin_selection_strategy", kind: "enum", T: () => ["lnrpc.CoinSelectionStrategy", CoinSelectionStrategy] } + ]); + } + create(value?: PartialMessage): SendOutputsRequest { + const message = { satPerKw: 0n, outputs: [], label: "", minConfs: 0, spendUnconfirmed: false, coinSelectionStrategy: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SendOutputsRequest): SendOutputsRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int64 sat_per_kw */ 1: + message.satPerKw = reader.int64().toBigInt(); + break; + case /* repeated signrpc.TxOut outputs */ 2: + message.outputs.push(TxOut.internalBinaryRead(reader, reader.uint32(), options)); + break; + case /* string label */ 3: + message.label = reader.string(); + break; + case /* int32 min_confs */ 4: + message.minConfs = reader.int32(); + break; + case /* bool spend_unconfirmed */ 5: + message.spendUnconfirmed = reader.bool(); + break; + case /* lnrpc.CoinSelectionStrategy coin_selection_strategy */ 6: + message.coinSelectionStrategy = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SendOutputsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int64 sat_per_kw = 1; */ + if (message.satPerKw !== 0n) + writer.tag(1, WireType.Varint).int64(message.satPerKw); + /* repeated signrpc.TxOut outputs = 2; */ + for (let i = 0; i < message.outputs.length; i++) + TxOut.internalBinaryWrite(message.outputs[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* string label = 3; */ + if (message.label !== "") + writer.tag(3, WireType.LengthDelimited).string(message.label); + /* int32 min_confs = 4; */ + if (message.minConfs !== 0) + writer.tag(4, WireType.Varint).int32(message.minConfs); + /* bool spend_unconfirmed = 5; */ + if (message.spendUnconfirmed !== false) + writer.tag(5, WireType.Varint).bool(message.spendUnconfirmed); + /* lnrpc.CoinSelectionStrategy coin_selection_strategy = 6; */ + if (message.coinSelectionStrategy !== 0) + writer.tag(6, WireType.Varint).int32(message.coinSelectionStrategy); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.SendOutputsRequest + */ +export const SendOutputsRequest = new SendOutputsRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SendOutputsResponse$Type extends MessageType { + constructor() { + super("walletrpc.SendOutputsResponse", [ + { no: 1, name: "raw_tx", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): SendOutputsResponse { + const message = { rawTx: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SendOutputsResponse): SendOutputsResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes raw_tx */ 1: + message.rawTx = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SendOutputsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes raw_tx = 1; */ + if (message.rawTx.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.rawTx); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.SendOutputsResponse + */ +export const SendOutputsResponse = new SendOutputsResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class EstimateFeeRequest$Type extends MessageType { + constructor() { + super("walletrpc.EstimateFeeRequest", [ + { no: 1, name: "conf_target", kind: "scalar", T: 5 /*ScalarType.INT32*/ } + ]); + } + create(value?: PartialMessage): EstimateFeeRequest { + const message = { confTarget: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EstimateFeeRequest): EstimateFeeRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int32 conf_target */ 1: + message.confTarget = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: EstimateFeeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int32 conf_target = 1; */ + if (message.confTarget !== 0) + writer.tag(1, WireType.Varint).int32(message.confTarget); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.EstimateFeeRequest + */ +export const EstimateFeeRequest = new EstimateFeeRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class EstimateFeeResponse$Type extends MessageType { + constructor() { + super("walletrpc.EstimateFeeResponse", [ + { no: 1, name: "sat_per_kw", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 2, name: "min_relay_fee_sat_per_kw", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ } + ]); + } + create(value?: PartialMessage): EstimateFeeResponse { + const message = { satPerKw: 0n, minRelayFeeSatPerKw: 0n }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EstimateFeeResponse): EstimateFeeResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int64 sat_per_kw */ 1: + message.satPerKw = reader.int64().toBigInt(); + break; + case /* int64 min_relay_fee_sat_per_kw */ 2: + message.minRelayFeeSatPerKw = reader.int64().toBigInt(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: EstimateFeeResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int64 sat_per_kw = 1; */ + if (message.satPerKw !== 0n) + writer.tag(1, WireType.Varint).int64(message.satPerKw); + /* int64 min_relay_fee_sat_per_kw = 2; */ + if (message.minRelayFeeSatPerKw !== 0n) + writer.tag(2, WireType.Varint).int64(message.minRelayFeeSatPerKw); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.EstimateFeeResponse + */ +export const EstimateFeeResponse = new EstimateFeeResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PendingSweep$Type extends MessageType { + constructor() { + super("walletrpc.PendingSweep", [ + { no: 1, name: "outpoint", kind: "message", T: () => OutPoint }, + { no: 2, name: "witness_type", kind: "enum", T: () => ["walletrpc.WitnessType", WitnessType] }, + { no: 3, name: "amount_sat", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 4, name: "sat_per_byte", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 5, name: "broadcast_attempts", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 6, name: "next_broadcast_height", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 7, name: "force", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 8, name: "requested_conf_target", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 9, name: "requested_sat_per_byte", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 10, name: "sat_per_vbyte", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 11, name: "requested_sat_per_vbyte", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 12, name: "immediate", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 13, name: "budget", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 14, name: "deadline_height", kind: "scalar", T: 13 /*ScalarType.UINT32*/ } + ]); + } + create(value?: PartialMessage): PendingSweep { + const message = { witnessType: 0, amountSat: 0, satPerByte: 0, broadcastAttempts: 0, nextBroadcastHeight: 0, force: false, requestedConfTarget: 0, requestedSatPerByte: 0, satPerVbyte: 0n, requestedSatPerVbyte: 0n, immediate: false, budget: 0n, deadlineHeight: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PendingSweep): PendingSweep { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* lnrpc.OutPoint outpoint */ 1: + message.outpoint = OutPoint.internalBinaryRead(reader, reader.uint32(), options, message.outpoint); + break; + case /* walletrpc.WitnessType witness_type */ 2: + message.witnessType = reader.int32(); + break; + case /* uint32 amount_sat */ 3: + message.amountSat = reader.uint32(); + break; + case /* uint32 sat_per_byte = 4 [deprecated = true];*/ 4: + message.satPerByte = reader.uint32(); + break; + case /* uint32 broadcast_attempts */ 5: + message.broadcastAttempts = reader.uint32(); + break; + case /* uint32 next_broadcast_height = 6 [deprecated = true];*/ 6: + message.nextBroadcastHeight = reader.uint32(); + break; + case /* bool force = 7 [deprecated = true];*/ 7: + message.force = reader.bool(); + break; + case /* uint32 requested_conf_target = 8 [deprecated = true];*/ 8: + message.requestedConfTarget = reader.uint32(); + break; + case /* uint32 requested_sat_per_byte = 9 [deprecated = true];*/ 9: + message.requestedSatPerByte = reader.uint32(); + break; + case /* uint64 sat_per_vbyte */ 10: + message.satPerVbyte = reader.uint64().toBigInt(); + break; + case /* uint64 requested_sat_per_vbyte */ 11: + message.requestedSatPerVbyte = reader.uint64().toBigInt(); + break; + case /* bool immediate */ 12: + message.immediate = reader.bool(); + break; + case /* uint64 budget */ 13: + message.budget = reader.uint64().toBigInt(); + break; + case /* uint32 deadline_height */ 14: + message.deadlineHeight = reader.uint32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: PendingSweep, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* lnrpc.OutPoint outpoint = 1; */ + if (message.outpoint) + OutPoint.internalBinaryWrite(message.outpoint, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* walletrpc.WitnessType witness_type = 2; */ + if (message.witnessType !== 0) + writer.tag(2, WireType.Varint).int32(message.witnessType); + /* uint32 amount_sat = 3; */ + if (message.amountSat !== 0) + writer.tag(3, WireType.Varint).uint32(message.amountSat); + /* uint32 sat_per_byte = 4 [deprecated = true]; */ + if (message.satPerByte !== 0) + writer.tag(4, WireType.Varint).uint32(message.satPerByte); + /* uint32 broadcast_attempts = 5; */ + if (message.broadcastAttempts !== 0) + writer.tag(5, WireType.Varint).uint32(message.broadcastAttempts); + /* uint32 next_broadcast_height = 6 [deprecated = true]; */ + if (message.nextBroadcastHeight !== 0) + writer.tag(6, WireType.Varint).uint32(message.nextBroadcastHeight); + /* bool force = 7 [deprecated = true]; */ + if (message.force !== false) + writer.tag(7, WireType.Varint).bool(message.force); + /* uint32 requested_conf_target = 8 [deprecated = true]; */ + if (message.requestedConfTarget !== 0) + writer.tag(8, WireType.Varint).uint32(message.requestedConfTarget); + /* uint32 requested_sat_per_byte = 9 [deprecated = true]; */ + if (message.requestedSatPerByte !== 0) + writer.tag(9, WireType.Varint).uint32(message.requestedSatPerByte); + /* uint64 sat_per_vbyte = 10; */ + if (message.satPerVbyte !== 0n) + writer.tag(10, WireType.Varint).uint64(message.satPerVbyte); + /* uint64 requested_sat_per_vbyte = 11; */ + if (message.requestedSatPerVbyte !== 0n) + writer.tag(11, WireType.Varint).uint64(message.requestedSatPerVbyte); + /* bool immediate = 12; */ + if (message.immediate !== false) + writer.tag(12, WireType.Varint).bool(message.immediate); + /* uint64 budget = 13; */ + if (message.budget !== 0n) + writer.tag(13, WireType.Varint).uint64(message.budget); + /* uint32 deadline_height = 14; */ + if (message.deadlineHeight !== 0) + writer.tag(14, WireType.Varint).uint32(message.deadlineHeight); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.PendingSweep + */ +export const PendingSweep = new PendingSweep$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PendingSweepsRequest$Type extends MessageType { + constructor() { + super("walletrpc.PendingSweepsRequest", []); + } + create(value?: PartialMessage): PendingSweepsRequest { + const message = {}; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PendingSweepsRequest): PendingSweepsRequest { + return target ?? this.create(); + } + internalBinaryWrite(message: PendingSweepsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.PendingSweepsRequest + */ +export const PendingSweepsRequest = new PendingSweepsRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PendingSweepsResponse$Type extends MessageType { + constructor() { + super("walletrpc.PendingSweepsResponse", [ + { no: 1, name: "pending_sweeps", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PendingSweep } + ]); + } + create(value?: PartialMessage): PendingSweepsResponse { + const message = { pendingSweeps: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PendingSweepsResponse): PendingSweepsResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated walletrpc.PendingSweep pending_sweeps */ 1: + message.pendingSweeps.push(PendingSweep.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: PendingSweepsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated walletrpc.PendingSweep pending_sweeps = 1; */ + for (let i = 0; i < message.pendingSweeps.length; i++) + PendingSweep.internalBinaryWrite(message.pendingSweeps[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.PendingSweepsResponse + */ +export const PendingSweepsResponse = new PendingSweepsResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class BumpFeeRequest$Type extends MessageType { + constructor() { + super("walletrpc.BumpFeeRequest", [ + { no: 1, name: "outpoint", kind: "message", T: () => OutPoint }, + { no: 2, name: "target_conf", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 3, name: "sat_per_byte", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 4, name: "force", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 5, name: "sat_per_vbyte", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 6, name: "immediate", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 7, name: "budget", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } + ]); + } + create(value?: PartialMessage): BumpFeeRequest { + const message = { targetConf: 0, satPerByte: 0, force: false, satPerVbyte: 0n, immediate: false, budget: 0n }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BumpFeeRequest): BumpFeeRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* lnrpc.OutPoint outpoint */ 1: + message.outpoint = OutPoint.internalBinaryRead(reader, reader.uint32(), options, message.outpoint); + break; + case /* uint32 target_conf */ 2: + message.targetConf = reader.uint32(); + break; + case /* uint32 sat_per_byte = 3 [deprecated = true];*/ 3: + message.satPerByte = reader.uint32(); + break; + case /* bool force = 4 [deprecated = true];*/ 4: + message.force = reader.bool(); + break; + case /* uint64 sat_per_vbyte */ 5: + message.satPerVbyte = reader.uint64().toBigInt(); + break; + case /* bool immediate */ 6: + message.immediate = reader.bool(); + break; + case /* uint64 budget */ 7: + message.budget = reader.uint64().toBigInt(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: BumpFeeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* lnrpc.OutPoint outpoint = 1; */ + if (message.outpoint) + OutPoint.internalBinaryWrite(message.outpoint, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* uint32 target_conf = 2; */ + if (message.targetConf !== 0) + writer.tag(2, WireType.Varint).uint32(message.targetConf); + /* uint32 sat_per_byte = 3 [deprecated = true]; */ + if (message.satPerByte !== 0) + writer.tag(3, WireType.Varint).uint32(message.satPerByte); + /* bool force = 4 [deprecated = true]; */ + if (message.force !== false) + writer.tag(4, WireType.Varint).bool(message.force); + /* uint64 sat_per_vbyte = 5; */ + if (message.satPerVbyte !== 0n) + writer.tag(5, WireType.Varint).uint64(message.satPerVbyte); + /* bool immediate = 6; */ + if (message.immediate !== false) + writer.tag(6, WireType.Varint).bool(message.immediate); + /* uint64 budget = 7; */ + if (message.budget !== 0n) + writer.tag(7, WireType.Varint).uint64(message.budget); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.BumpFeeRequest + */ +export const BumpFeeRequest = new BumpFeeRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class BumpFeeResponse$Type extends MessageType { + constructor() { + super("walletrpc.BumpFeeResponse", [ + { no: 1, name: "status", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): BumpFeeResponse { + const message = { status: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BumpFeeResponse): BumpFeeResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string status */ 1: + message.status = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: BumpFeeResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string status = 1; */ + if (message.status !== "") + writer.tag(1, WireType.LengthDelimited).string(message.status); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.BumpFeeResponse + */ +export const BumpFeeResponse = new BumpFeeResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class BumpForceCloseFeeRequest$Type extends MessageType { + constructor() { + super("walletrpc.BumpForceCloseFeeRequest", [ + { no: 1, name: "chan_point", kind: "message", T: () => ChannelPoint }, + { no: 2, name: "deadline_delta", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 3, name: "starting_feerate", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 4, name: "immediate", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 5, name: "budget", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } + ]); + } + create(value?: PartialMessage): BumpForceCloseFeeRequest { + const message = { deadlineDelta: 0, startingFeerate: 0n, immediate: false, budget: 0n }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BumpForceCloseFeeRequest): BumpForceCloseFeeRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* lnrpc.ChannelPoint chan_point */ 1: + message.chanPoint = ChannelPoint.internalBinaryRead(reader, reader.uint32(), options, message.chanPoint); + break; + case /* uint32 deadline_delta */ 2: + message.deadlineDelta = reader.uint32(); + break; + case /* uint64 starting_feerate */ 3: + message.startingFeerate = reader.uint64().toBigInt(); + break; + case /* bool immediate */ 4: + message.immediate = reader.bool(); + break; + case /* uint64 budget */ 5: + message.budget = reader.uint64().toBigInt(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: BumpForceCloseFeeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* lnrpc.ChannelPoint chan_point = 1; */ + if (message.chanPoint) + ChannelPoint.internalBinaryWrite(message.chanPoint, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* uint32 deadline_delta = 2; */ + if (message.deadlineDelta !== 0) + writer.tag(2, WireType.Varint).uint32(message.deadlineDelta); + /* uint64 starting_feerate = 3; */ + if (message.startingFeerate !== 0n) + writer.tag(3, WireType.Varint).uint64(message.startingFeerate); + /* bool immediate = 4; */ + if (message.immediate !== false) + writer.tag(4, WireType.Varint).bool(message.immediate); + /* uint64 budget = 5; */ + if (message.budget !== 0n) + writer.tag(5, WireType.Varint).uint64(message.budget); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.BumpForceCloseFeeRequest + */ +export const BumpForceCloseFeeRequest = new BumpForceCloseFeeRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class BumpForceCloseFeeResponse$Type extends MessageType { + constructor() { + super("walletrpc.BumpForceCloseFeeResponse", [ + { no: 1, name: "status", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): BumpForceCloseFeeResponse { + const message = { status: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BumpForceCloseFeeResponse): BumpForceCloseFeeResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string status */ 1: + message.status = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: BumpForceCloseFeeResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string status = 1; */ + if (message.status !== "") + writer.tag(1, WireType.LengthDelimited).string(message.status); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.BumpForceCloseFeeResponse + */ +export const BumpForceCloseFeeResponse = new BumpForceCloseFeeResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListSweepsRequest$Type extends MessageType { + constructor() { + super("walletrpc.ListSweepsRequest", [ + { no: 1, name: "verbose", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 2, name: "start_height", kind: "scalar", T: 5 /*ScalarType.INT32*/ } + ]); + } + create(value?: PartialMessage): ListSweepsRequest { + const message = { verbose: false, startHeight: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListSweepsRequest): ListSweepsRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bool verbose */ 1: + message.verbose = reader.bool(); + break; + case /* int32 start_height */ 2: + message.startHeight = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListSweepsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bool verbose = 1; */ + if (message.verbose !== false) + writer.tag(1, WireType.Varint).bool(message.verbose); + /* int32 start_height = 2; */ + if (message.startHeight !== 0) + writer.tag(2, WireType.Varint).int32(message.startHeight); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListSweepsRequest + */ +export const ListSweepsRequest = new ListSweepsRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListSweepsResponse$Type extends MessageType { + constructor() { + super("walletrpc.ListSweepsResponse", [ + { no: 1, name: "transaction_details", kind: "message", oneof: "sweeps", T: () => TransactionDetails }, + { no: 2, name: "transaction_ids", kind: "message", oneof: "sweeps", T: () => ListSweepsResponse_TransactionIDs } + ]); + } + create(value?: PartialMessage): ListSweepsResponse { + const message = { sweeps: { oneofKind: undefined } }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListSweepsResponse): ListSweepsResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* lnrpc.TransactionDetails transaction_details */ 1: + message.sweeps = { + oneofKind: "transactionDetails", + transactionDetails: TransactionDetails.internalBinaryRead(reader, reader.uint32(), options, (message.sweeps as any).transactionDetails) + }; + break; + case /* walletrpc.ListSweepsResponse.TransactionIDs transaction_ids */ 2: + message.sweeps = { + oneofKind: "transactionIds", + transactionIds: ListSweepsResponse_TransactionIDs.internalBinaryRead(reader, reader.uint32(), options, (message.sweeps as any).transactionIds) + }; + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListSweepsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* lnrpc.TransactionDetails transaction_details = 1; */ + if (message.sweeps.oneofKind === "transactionDetails") + TransactionDetails.internalBinaryWrite(message.sweeps.transactionDetails, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* walletrpc.ListSweepsResponse.TransactionIDs transaction_ids = 2; */ + if (message.sweeps.oneofKind === "transactionIds") + ListSweepsResponse_TransactionIDs.internalBinaryWrite(message.sweeps.transactionIds, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListSweepsResponse + */ +export const ListSweepsResponse = new ListSweepsResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListSweepsResponse_TransactionIDs$Type extends MessageType { + constructor() { + super("walletrpc.ListSweepsResponse.TransactionIDs", [ + { no: 1, name: "transaction_ids", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): ListSweepsResponse_TransactionIDs { + const message = { transactionIds: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListSweepsResponse_TransactionIDs): ListSweepsResponse_TransactionIDs { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated string transaction_ids */ 1: + message.transactionIds.push(reader.string()); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListSweepsResponse_TransactionIDs, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated string transaction_ids = 1; */ + for (let i = 0; i < message.transactionIds.length; i++) + writer.tag(1, WireType.LengthDelimited).string(message.transactionIds[i]); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListSweepsResponse.TransactionIDs + */ +export const ListSweepsResponse_TransactionIDs = new ListSweepsResponse_TransactionIDs$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LabelTransactionRequest$Type extends MessageType { + constructor() { + super("walletrpc.LabelTransactionRequest", [ + { no: 1, name: "txid", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "label", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "overwrite", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): LabelTransactionRequest { + const message = { txid: new Uint8Array(0), label: "", overwrite: false }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LabelTransactionRequest): LabelTransactionRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes txid */ 1: + message.txid = reader.bytes(); + break; + case /* string label */ 2: + message.label = reader.string(); + break; + case /* bool overwrite */ 3: + message.overwrite = reader.bool(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: LabelTransactionRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes txid = 1; */ + if (message.txid.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.txid); + /* string label = 2; */ + if (message.label !== "") + writer.tag(2, WireType.LengthDelimited).string(message.label); + /* bool overwrite = 3; */ + if (message.overwrite !== false) + writer.tag(3, WireType.Varint).bool(message.overwrite); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.LabelTransactionRequest + */ +export const LabelTransactionRequest = new LabelTransactionRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LabelTransactionResponse$Type extends MessageType { + constructor() { + super("walletrpc.LabelTransactionResponse", [ + { no: 1, name: "status", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): LabelTransactionResponse { + const message = { status: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LabelTransactionResponse): LabelTransactionResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string status */ 1: + message.status = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: LabelTransactionResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string status = 1; */ + if (message.status !== "") + writer.tag(1, WireType.LengthDelimited).string(message.status); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.LabelTransactionResponse + */ +export const LabelTransactionResponse = new LabelTransactionResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class FundPsbtRequest$Type extends MessageType { + constructor() { + super("walletrpc.FundPsbtRequest", [ + { no: 1, name: "psbt", kind: "scalar", oneof: "template", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "raw", kind: "message", oneof: "template", T: () => TxTemplate }, + { no: 9, name: "coin_select", kind: "message", oneof: "template", T: () => PsbtCoinSelect }, + { no: 3, name: "target_conf", kind: "scalar", oneof: "fees", T: 13 /*ScalarType.UINT32*/ }, + { no: 4, name: "sat_per_vbyte", kind: "scalar", oneof: "fees", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 11, name: "sat_per_kw", kind: "scalar", oneof: "fees", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 5, name: "account", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 6, name: "min_confs", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 7, name: "spend_unconfirmed", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 8, name: "change_type", kind: "enum", T: () => ["walletrpc.ChangeAddressType", ChangeAddressType, "CHANGE_ADDRESS_TYPE_"] }, + { no: 10, name: "coin_selection_strategy", kind: "enum", T: () => ["lnrpc.CoinSelectionStrategy", CoinSelectionStrategy] }, + { no: 12, name: "max_fee_ratio", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ } + ]); + } + create(value?: PartialMessage): FundPsbtRequest { + const message = { template: { oneofKind: undefined }, fees: { oneofKind: undefined }, account: "", minConfs: 0, spendUnconfirmed: false, changeType: 0, coinSelectionStrategy: 0, maxFeeRatio: 0 }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FundPsbtRequest): FundPsbtRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes psbt */ 1: + message.template = { + oneofKind: "psbt", + psbt: reader.bytes() + }; + break; + case /* walletrpc.TxTemplate raw */ 2: + message.template = { + oneofKind: "raw", + raw: TxTemplate.internalBinaryRead(reader, reader.uint32(), options, (message.template as any).raw) + }; + break; + case /* walletrpc.PsbtCoinSelect coin_select */ 9: + message.template = { + oneofKind: "coinSelect", + coinSelect: PsbtCoinSelect.internalBinaryRead(reader, reader.uint32(), options, (message.template as any).coinSelect) + }; + break; + case /* uint32 target_conf */ 3: + message.fees = { + oneofKind: "targetConf", + targetConf: reader.uint32() + }; + break; + case /* uint64 sat_per_vbyte */ 4: + message.fees = { + oneofKind: "satPerVbyte", + satPerVbyte: reader.uint64().toBigInt() + }; + break; + case /* uint64 sat_per_kw */ 11: + message.fees = { + oneofKind: "satPerKw", + satPerKw: reader.uint64().toBigInt() + }; + break; + case /* string account */ 5: + message.account = reader.string(); + break; + case /* int32 min_confs */ 6: + message.minConfs = reader.int32(); + break; + case /* bool spend_unconfirmed */ 7: + message.spendUnconfirmed = reader.bool(); + break; + case /* walletrpc.ChangeAddressType change_type */ 8: + message.changeType = reader.int32(); + break; + case /* lnrpc.CoinSelectionStrategy coin_selection_strategy */ 10: + message.coinSelectionStrategy = reader.int32(); + break; + case /* double max_fee_ratio */ 12: + message.maxFeeRatio = reader.double(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: FundPsbtRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes psbt = 1; */ + if (message.template.oneofKind === "psbt") + writer.tag(1, WireType.LengthDelimited).bytes(message.template.psbt); + /* walletrpc.TxTemplate raw = 2; */ + if (message.template.oneofKind === "raw") + TxTemplate.internalBinaryWrite(message.template.raw, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* walletrpc.PsbtCoinSelect coin_select = 9; */ + if (message.template.oneofKind === "coinSelect") + PsbtCoinSelect.internalBinaryWrite(message.template.coinSelect, writer.tag(9, WireType.LengthDelimited).fork(), options).join(); + /* uint32 target_conf = 3; */ + if (message.fees.oneofKind === "targetConf") + writer.tag(3, WireType.Varint).uint32(message.fees.targetConf); + /* uint64 sat_per_vbyte = 4; */ + if (message.fees.oneofKind === "satPerVbyte") + writer.tag(4, WireType.Varint).uint64(message.fees.satPerVbyte); + /* uint64 sat_per_kw = 11; */ + if (message.fees.oneofKind === "satPerKw") + writer.tag(11, WireType.Varint).uint64(message.fees.satPerKw); + /* string account = 5; */ + if (message.account !== "") + writer.tag(5, WireType.LengthDelimited).string(message.account); + /* int32 min_confs = 6; */ + if (message.minConfs !== 0) + writer.tag(6, WireType.Varint).int32(message.minConfs); + /* bool spend_unconfirmed = 7; */ + if (message.spendUnconfirmed !== false) + writer.tag(7, WireType.Varint).bool(message.spendUnconfirmed); + /* walletrpc.ChangeAddressType change_type = 8; */ + if (message.changeType !== 0) + writer.tag(8, WireType.Varint).int32(message.changeType); + /* lnrpc.CoinSelectionStrategy coin_selection_strategy = 10; */ + if (message.coinSelectionStrategy !== 0) + writer.tag(10, WireType.Varint).int32(message.coinSelectionStrategy); + /* double max_fee_ratio = 12; */ + if (message.maxFeeRatio !== 0) + writer.tag(12, WireType.Bit64).double(message.maxFeeRatio); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.FundPsbtRequest + */ +export const FundPsbtRequest = new FundPsbtRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class FundPsbtResponse$Type extends MessageType { + constructor() { + super("walletrpc.FundPsbtResponse", [ + { no: 1, name: "funded_psbt", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "change_output_index", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, + { no: 3, name: "locked_utxos", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => UtxoLease } + ]); + } + create(value?: PartialMessage): FundPsbtResponse { + const message = { fundedPsbt: new Uint8Array(0), changeOutputIndex: 0, lockedUtxos: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FundPsbtResponse): FundPsbtResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes funded_psbt */ 1: + message.fundedPsbt = reader.bytes(); + break; + case /* int32 change_output_index */ 2: + message.changeOutputIndex = reader.int32(); + break; + case /* repeated walletrpc.UtxoLease locked_utxos */ 3: + message.lockedUtxos.push(UtxoLease.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: FundPsbtResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes funded_psbt = 1; */ + if (message.fundedPsbt.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.fundedPsbt); + /* int32 change_output_index = 2; */ + if (message.changeOutputIndex !== 0) + writer.tag(2, WireType.Varint).int32(message.changeOutputIndex); + /* repeated walletrpc.UtxoLease locked_utxos = 3; */ + for (let i = 0; i < message.lockedUtxos.length; i++) + UtxoLease.internalBinaryWrite(message.lockedUtxos[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.FundPsbtResponse + */ +export const FundPsbtResponse = new FundPsbtResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class TxTemplate$Type extends MessageType { + constructor() { + super("walletrpc.TxTemplate", [ + { no: 1, name: "inputs", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => OutPoint }, + { no: 2, name: "outputs", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } } + ]); + } + create(value?: PartialMessage): TxTemplate { + const message = { inputs: [], outputs: {} }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TxTemplate): TxTemplate { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated lnrpc.OutPoint inputs */ 1: + message.inputs.push(OutPoint.internalBinaryRead(reader, reader.uint32(), options)); + break; + case /* map outputs */ 2: + this.binaryReadMap2(message.outputs, reader, options); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + private binaryReadMap2(map: TxTemplate["outputs"], reader: IBinaryReader, options: BinaryReadOptions): void { + let len = reader.uint32(), end = reader.pos + len, key: keyof TxTemplate["outputs"] | undefined, val: TxTemplate["outputs"][any] | undefined; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case 1: + key = reader.string(); + break; + case 2: + val = reader.uint64().toBigInt(); + break; + default: throw new globalThis.Error("unknown map entry field for field walletrpc.TxTemplate.outputs"); + } + } + map[key ?? ""] = val ?? 0n; + } + internalBinaryWrite(message: TxTemplate, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated lnrpc.OutPoint inputs = 1; */ + for (let i = 0; i < message.inputs.length; i++) + OutPoint.internalBinaryWrite(message.inputs[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + /* map outputs = 2; */ + for (let k of Object.keys(message.outputs)) + writer.tag(2, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.Varint).uint64(message.outputs[k]).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.TxTemplate + */ +export const TxTemplate = new TxTemplate$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PsbtCoinSelect$Type extends MessageType { + constructor() { + super("walletrpc.PsbtCoinSelect", [ + { no: 1, name: "psbt", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "existing_output_index", kind: "scalar", oneof: "changeOutput", T: 5 /*ScalarType.INT32*/ }, + { no: 3, name: "add", kind: "scalar", oneof: "changeOutput", T: 8 /*ScalarType.BOOL*/ } + ]); + } + create(value?: PartialMessage): PsbtCoinSelect { + const message = { psbt: new Uint8Array(0), changeOutput: { oneofKind: undefined } }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PsbtCoinSelect): PsbtCoinSelect { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes psbt */ 1: + message.psbt = reader.bytes(); + break; + case /* int32 existing_output_index */ 2: + message.changeOutput = { + oneofKind: "existingOutputIndex", + existingOutputIndex: reader.int32() + }; + break; + case /* bool add */ 3: + message.changeOutput = { + oneofKind: "add", + add: reader.bool() + }; + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: PsbtCoinSelect, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes psbt = 1; */ + if (message.psbt.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.psbt); + /* int32 existing_output_index = 2; */ + if (message.changeOutput.oneofKind === "existingOutputIndex") + writer.tag(2, WireType.Varint).int32(message.changeOutput.existingOutputIndex); + /* bool add = 3; */ + if (message.changeOutput.oneofKind === "add") + writer.tag(3, WireType.Varint).bool(message.changeOutput.add); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.PsbtCoinSelect + */ +export const PsbtCoinSelect = new PsbtCoinSelect$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class UtxoLease$Type extends MessageType { + constructor() { + super("walletrpc.UtxoLease", [ + { no: 1, name: "id", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "outpoint", kind: "message", T: () => OutPoint }, + { no: 3, name: "expiration", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, + { no: 4, name: "pk_script", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 5, name: "value", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } + ]); + } + create(value?: PartialMessage): UtxoLease { + const message = { id: new Uint8Array(0), expiration: 0n, pkScript: new Uint8Array(0), value: 0n }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UtxoLease): UtxoLease { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes id */ 1: + message.id = reader.bytes(); + break; + case /* lnrpc.OutPoint outpoint */ 2: + message.outpoint = OutPoint.internalBinaryRead(reader, reader.uint32(), options, message.outpoint); + break; + case /* uint64 expiration */ 3: + message.expiration = reader.uint64().toBigInt(); + break; + case /* bytes pk_script */ 4: + message.pkScript = reader.bytes(); + break; + case /* uint64 value */ 5: + message.value = reader.uint64().toBigInt(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: UtxoLease, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes id = 1; */ + if (message.id.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.id); + /* lnrpc.OutPoint outpoint = 2; */ + if (message.outpoint) + OutPoint.internalBinaryWrite(message.outpoint, writer.tag(2, WireType.LengthDelimited).fork(), options).join(); + /* uint64 expiration = 3; */ + if (message.expiration !== 0n) + writer.tag(3, WireType.Varint).uint64(message.expiration); + /* bytes pk_script = 4; */ + if (message.pkScript.length) + writer.tag(4, WireType.LengthDelimited).bytes(message.pkScript); + /* uint64 value = 5; */ + if (message.value !== 0n) + writer.tag(5, WireType.Varint).uint64(message.value); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.UtxoLease + */ +export const UtxoLease = new UtxoLease$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignPsbtRequest$Type extends MessageType { + constructor() { + super("walletrpc.SignPsbtRequest", [ + { no: 1, name: "funded_psbt", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): SignPsbtRequest { + const message = { fundedPsbt: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignPsbtRequest): SignPsbtRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes funded_psbt */ 1: + message.fundedPsbt = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignPsbtRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes funded_psbt = 1; */ + if (message.fundedPsbt.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.fundedPsbt); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.SignPsbtRequest + */ +export const SignPsbtRequest = new SignPsbtRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SignPsbtResponse$Type extends MessageType { + constructor() { + super("walletrpc.SignPsbtResponse", [ + { no: 1, name: "signed_psbt", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "signed_inputs", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 13 /*ScalarType.UINT32*/ } + ]); + } + create(value?: PartialMessage): SignPsbtResponse { + const message = { signedPsbt: new Uint8Array(0), signedInputs: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SignPsbtResponse): SignPsbtResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes signed_psbt */ 1: + message.signedPsbt = reader.bytes(); + break; + case /* repeated uint32 signed_inputs */ 2: + if (wireType === WireType.LengthDelimited) + for (let e = reader.int32() + reader.pos; reader.pos < e;) + message.signedInputs.push(reader.uint32()); + else + message.signedInputs.push(reader.uint32()); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: SignPsbtResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes signed_psbt = 1; */ + if (message.signedPsbt.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.signedPsbt); + /* repeated uint32 signed_inputs = 2; */ + if (message.signedInputs.length) { + writer.tag(2, WireType.LengthDelimited).fork(); + for (let i = 0; i < message.signedInputs.length; i++) + writer.uint32(message.signedInputs[i]); + writer.join(); + } + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.SignPsbtResponse + */ +export const SignPsbtResponse = new SignPsbtResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class FinalizePsbtRequest$Type extends MessageType { + constructor() { + super("walletrpc.FinalizePsbtRequest", [ + { no: 1, name: "funded_psbt", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 5, name: "account", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } + create(value?: PartialMessage): FinalizePsbtRequest { + const message = { fundedPsbt: new Uint8Array(0), account: "" }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FinalizePsbtRequest): FinalizePsbtRequest { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes funded_psbt */ 1: + message.fundedPsbt = reader.bytes(); + break; + case /* string account */ 5: + message.account = reader.string(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: FinalizePsbtRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes funded_psbt = 1; */ + if (message.fundedPsbt.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.fundedPsbt); + /* string account = 5; */ + if (message.account !== "") + writer.tag(5, WireType.LengthDelimited).string(message.account); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.FinalizePsbtRequest + */ +export const FinalizePsbtRequest = new FinalizePsbtRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class FinalizePsbtResponse$Type extends MessageType { + constructor() { + super("walletrpc.FinalizePsbtResponse", [ + { no: 1, name: "signed_psbt", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "raw_final_tx", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + create(value?: PartialMessage): FinalizePsbtResponse { + const message = { signedPsbt: new Uint8Array(0), rawFinalTx: new Uint8Array(0) }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FinalizePsbtResponse): FinalizePsbtResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* bytes signed_psbt */ 1: + message.signedPsbt = reader.bytes(); + break; + case /* bytes raw_final_tx */ 2: + message.rawFinalTx = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: FinalizePsbtResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* bytes signed_psbt = 1; */ + if (message.signedPsbt.length) + writer.tag(1, WireType.LengthDelimited).bytes(message.signedPsbt); + /* bytes raw_final_tx = 2; */ + if (message.rawFinalTx.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.rawFinalTx); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.FinalizePsbtResponse + */ +export const FinalizePsbtResponse = new FinalizePsbtResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListLeasesRequest$Type extends MessageType { + constructor() { + super("walletrpc.ListLeasesRequest", []); + } + create(value?: PartialMessage): ListLeasesRequest { + const message = {}; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListLeasesRequest): ListLeasesRequest { + return target ?? this.create(); + } + internalBinaryWrite(message: ListLeasesRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListLeasesRequest + */ +export const ListLeasesRequest = new ListLeasesRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ListLeasesResponse$Type extends MessageType { + constructor() { + super("walletrpc.ListLeasesResponse", [ + { no: 1, name: "locked_utxos", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => UtxoLease } + ]); + } + create(value?: PartialMessage): ListLeasesResponse { + const message = { lockedUtxos: [] }; + globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListLeasesResponse): ListLeasesResponse { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* repeated walletrpc.UtxoLease locked_utxos */ 1: + message.lockedUtxos.push(UtxoLease.internalBinaryRead(reader, reader.uint32(), options)); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: ListLeasesResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* repeated walletrpc.UtxoLease locked_utxos = 1; */ + for (let i = 0; i < message.lockedUtxos.length; i++) + UtxoLease.internalBinaryWrite(message.lockedUtxos[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message walletrpc.ListLeasesResponse + */ +export const ListLeasesResponse = new ListLeasesResponse$Type(); +/** + * @generated ServiceType for protobuf service walletrpc.WalletKit + */ +export const WalletKit = new ServiceType("walletrpc.WalletKit", [ + { name: "ListUnspent", options: {}, I: ListUnspentRequest, O: ListUnspentResponse }, + { name: "LeaseOutput", options: {}, I: LeaseOutputRequest, O: LeaseOutputResponse }, + { name: "ReleaseOutput", options: {}, I: ReleaseOutputRequest, O: ReleaseOutputResponse }, + { name: "ListLeases", options: {}, I: ListLeasesRequest, O: ListLeasesResponse }, + { name: "DeriveNextKey", options: {}, I: KeyReq, O: KeyDescriptor }, + { name: "DeriveKey", options: {}, I: KeyLocator, O: KeyDescriptor }, + { name: "NextAddr", options: {}, I: AddrRequest, O: AddrResponse }, + { name: "GetTransaction", options: {}, I: GetTransactionRequest, O: Transaction$ }, + { name: "ListAccounts", options: {}, I: ListAccountsRequest, O: ListAccountsResponse }, + { name: "RequiredReserve", options: {}, I: RequiredReserveRequest, O: RequiredReserveResponse }, + { name: "ListAddresses", options: {}, I: ListAddressesRequest, O: ListAddressesResponse }, + { name: "SignMessageWithAddr", options: {}, I: SignMessageWithAddrRequest, O: SignMessageWithAddrResponse }, + { name: "VerifyMessageWithAddr", options: {}, I: VerifyMessageWithAddrRequest, O: VerifyMessageWithAddrResponse }, + { name: "ImportAccount", options: {}, I: ImportAccountRequest, O: ImportAccountResponse }, + { name: "ImportPublicKey", options: {}, I: ImportPublicKeyRequest, O: ImportPublicKeyResponse }, + { name: "ImportTapscript", options: {}, I: ImportTapscriptRequest, O: ImportTapscriptResponse }, + { name: "PublishTransaction", options: {}, I: Transaction, O: PublishResponse }, + { name: "RemoveTransaction", options: {}, I: GetTransactionRequest, O: RemoveTransactionResponse }, + { name: "SendOutputs", options: {}, I: SendOutputsRequest, O: SendOutputsResponse }, + { name: "EstimateFee", options: {}, I: EstimateFeeRequest, O: EstimateFeeResponse }, + { name: "PendingSweeps", options: {}, I: PendingSweepsRequest, O: PendingSweepsResponse }, + { name: "BumpFee", options: {}, I: BumpFeeRequest, O: BumpFeeResponse }, + { name: "BumpForceCloseFee", options: {}, I: BumpForceCloseFeeRequest, O: BumpForceCloseFeeResponse }, + { name: "ListSweeps", options: {}, I: ListSweepsRequest, O: ListSweepsResponse }, + { name: "LabelTransaction", options: {}, I: LabelTransactionRequest, O: LabelTransactionResponse }, + { name: "FundPsbt", options: {}, I: FundPsbtRequest, O: FundPsbtResponse }, + { name: "SignPsbt", options: {}, I: SignPsbtRequest, O: SignPsbtResponse }, + { name: "FinalizePsbt", options: {}, I: FinalizePsbtRequest, O: FinalizePsbtResponse } +]); diff --git a/proto/lnd/walletunlocker.client.ts b/proto/lnd/walletunlocker.client.ts index a3e3d7da..ed94ca63 100644 --- a/proto/lnd/walletunlocker.client.ts +++ b/proto/lnd/walletunlocker.client.ts @@ -3,16 +3,16 @@ // tslint:disable import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { WalletUnlocker } from "./walletunlocker.js"; -import type { ChangePasswordResponse } from "./walletunlocker.js"; -import type { ChangePasswordRequest } from "./walletunlocker.js"; -import type { UnlockWalletResponse } from "./walletunlocker.js"; -import type { UnlockWalletRequest } from "./walletunlocker.js"; -import type { InitWalletResponse } from "./walletunlocker.js"; -import type { InitWalletRequest } from "./walletunlocker.js"; +import { WalletUnlocker } from "./walletunlocker"; +import type { ChangePasswordResponse } from "./walletunlocker"; +import type { ChangePasswordRequest } from "./walletunlocker"; +import type { UnlockWalletResponse } from "./walletunlocker"; +import type { UnlockWalletRequest } from "./walletunlocker"; +import type { InitWalletResponse } from "./walletunlocker"; +import type { InitWalletRequest } from "./walletunlocker"; import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { GenSeedResponse } from "./walletunlocker.js"; -import type { GenSeedRequest } from "./walletunlocker.js"; +import type { GenSeedResponse } from "./walletunlocker"; +import type { GenSeedRequest } from "./walletunlocker"; import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; // diff --git a/proto/lnd/walletunlocker.ts b/proto/lnd/walletunlocker.ts index a472c857..7851c675 100644 --- a/proto/lnd/walletunlocker.ts +++ b/proto/lnd/walletunlocker.ts @@ -12,7 +12,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime"; -import { ChanBackupSnapshot } from "./lightning.js"; +import { ChanBackupSnapshot } from "./lightning"; /** * @generated from protobuf message lnrpc.GenSeedRequest */ diff --git a/proto/others/signer.proto b/proto/others/signer.proto new file mode 100644 index 00000000..ad43f0d3 --- /dev/null +++ b/proto/others/signer.proto @@ -0,0 +1,709 @@ +syntax = "proto3"; + +package signrpc; + +option go_package = "github.com/lightningnetwork/lnd/lnrpc/signrpc"; + +// Signer is a service that gives access to the signing functionality of the +// daemon's wallet. +service Signer { + /* + SignOutputRaw is a method that can be used to generated a signature for a + set of inputs/outputs to a transaction. Each request specifies details + concerning how the outputs should be signed, which keys they should be + signed with, and also any optional tweaks. The return value is a fixed + 64-byte signature (the same format as we use on the wire in Lightning). + + If we are unable to sign using the specified keys, then an error will be + returned. + */ + rpc SignOutputRaw (SignReq) returns (SignResp); + + /* + ComputeInputScript generates a complete InputIndex for the passed + transaction with the signature as defined within the passed SignDescriptor. + This method should be capable of generating the proper input script for both + regular p2wkh/p2tr outputs and p2wkh outputs nested within a regular p2sh + output. + + Note that when using this method to sign inputs belonging to the wallet, + the only items of the SignDescriptor that need to be populated are pkScript + in the TxOut field, the value in that same field, and finally the input + index. + */ + rpc ComputeInputScript (SignReq) returns (InputScriptResp); + + /* + SignMessage signs a message with the key specified in the key locator. The + returned signature is fixed-size LN wire format encoded. + + The main difference to SignMessage in the main RPC is that a specific key is + used to sign the message instead of the node identity private key. + */ + rpc SignMessage (SignMessageReq) returns (SignMessageResp); + + /* + VerifyMessage verifies a signature over a message using the public key + provided. The signature must be fixed-size LN wire format encoded. + + The main difference to VerifyMessage in the main RPC is that the public key + used to sign the message does not have to be a node known to the network. + */ + rpc VerifyMessage (VerifyMessageReq) returns (VerifyMessageResp); + + /* + DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key + derivation between the ephemeral public key in the request and the node's + key specified in the key_desc parameter. Either a key locator or a raw + public key is expected in the key_desc, if neither is supplied, defaults to + the node's identity private key: + P_shared = privKeyNode * ephemeralPubkey + The resulting shared public key is serialized in the compressed format and + hashed with sha256, resulting in the final key length of 256bit. + */ + rpc DeriveSharedKey (SharedKeyRequest) returns (SharedKeyResponse); + + /* + MuSig2CombineKeys (experimental!) is a stateless helper RPC that can be used + to calculate the combined MuSig2 public key from a list of all participating + signers' public keys. This RPC is completely stateless and deterministic and + does not create any signing session. It can be used to determine the Taproot + public key that should be put in an on-chain output once all public keys are + known. A signing session is only needed later when that output should be + _spent_ again. + + NOTE: The MuSig2 BIP is not final yet and therefore this API must be + considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + releases. Backward compatibility is not guaranteed! + */ + rpc MuSig2CombineKeys (MuSig2CombineKeysRequest) + returns (MuSig2CombineKeysResponse); + + /* + MuSig2CreateSession (experimental!) creates a new MuSig2 signing session + using the local key identified by the key locator. The complete list of all + public keys of all signing parties must be provided, including the public + key of the local signing key. If nonces of other parties are already known, + they can be submitted as well to reduce the number of RPC calls necessary + later on. + + NOTE: The MuSig2 BIP is not final yet and therefore this API must be + considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + releases. Backward compatibility is not guaranteed! + */ + rpc MuSig2CreateSession (MuSig2SessionRequest) + returns (MuSig2SessionResponse); + + /* + MuSig2RegisterNonces (experimental!) registers one or more public nonces of + other signing participants for a session identified by its ID. This RPC can + be called multiple times until all nonces are registered. + + NOTE: The MuSig2 BIP is not final yet and therefore this API must be + considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + releases. Backward compatibility is not guaranteed! + */ + rpc MuSig2RegisterNonces (MuSig2RegisterNoncesRequest) + returns (MuSig2RegisterNoncesResponse); + + /* + MuSig2Sign (experimental!) creates a partial signature using the local + signing key that was specified when the session was created. This can only + be called when all public nonces of all participants are known and have been + registered with the session. If this node isn't responsible for combining + all the partial signatures, then the cleanup flag should be set, indicating + that the session can be removed from memory once the signature was produced. + + NOTE: The MuSig2 BIP is not final yet and therefore this API must be + considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + releases. Backward compatibility is not guaranteed! + */ + rpc MuSig2Sign (MuSig2SignRequest) returns (MuSig2SignResponse); + + /* + MuSig2CombineSig (experimental!) combines the given partial signature(s) + with the local one, if it already exists. Once a partial signature of all + participants is registered, the final signature will be combined and + returned. + + NOTE: The MuSig2 BIP is not final yet and therefore this API must be + considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + releases. Backward compatibility is not guaranteed! + */ + rpc MuSig2CombineSig (MuSig2CombineSigRequest) + returns (MuSig2CombineSigResponse); + + /* + MuSig2Cleanup (experimental!) allows a caller to clean up a session early in + cases where it's obvious that the signing session won't succeed and the + resources can be released. + + NOTE: The MuSig2 BIP is not final yet and therefore this API must be + considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming + releases. Backward compatibility is not guaranteed! + */ + rpc MuSig2Cleanup (MuSig2CleanupRequest) returns (MuSig2CleanupResponse); +} + +message KeyLocator { + // The family of key being identified. + int32 key_family = 1; + + // The precise index of the key being identified. + int32 key_index = 2; +} + +message KeyDescriptor { + /* + The raw bytes of the public key in the key pair being identified. Either + this or the KeyLocator must be specified. + */ + bytes raw_key_bytes = 1; + + /* + The key locator that identifies which private key to use for signing. + Either this or the raw bytes of the target public key must be specified. + */ + KeyLocator key_loc = 2; +} + +message TxOut { + // The value of the output being spent. + int64 value = 1; + + // The script of the output being spent. + bytes pk_script = 2; +} + +enum SignMethod { + /* + Specifies that a SegWit v0 (p2wkh, np2wkh, p2wsh) input script should be + signed. + */ + SIGN_METHOD_WITNESS_V0 = 0; + + /* + Specifies that a SegWit v1 (p2tr) input should be signed by using the + BIP0086 method (commit to internal key only). + */ + SIGN_METHOD_TAPROOT_KEY_SPEND_BIP0086 = 1; + + /* + Specifies that a SegWit v1 (p2tr) input should be signed by using a given + taproot hash to commit to in addition to the internal key. + */ + SIGN_METHOD_TAPROOT_KEY_SPEND = 2; + + /* + Specifies that a SegWit v1 (p2tr) input should be spent using the script + path and that a specific leaf script should be signed for. + */ + SIGN_METHOD_TAPROOT_SCRIPT_SPEND = 3; +} + +message SignDescriptor { + /* + A descriptor that precisely describes *which* key to use for signing. This + may provide the raw public key directly, or require the Signer to re-derive + the key according to the populated derivation path. + + Note that if the key descriptor was obtained through walletrpc.DeriveKey, + then the key locator MUST always be provided, since the derived keys are not + persisted unlike with DeriveNextKey. + */ + KeyDescriptor key_desc = 1; + + /* + A scalar value that will be added to the private key corresponding to the + above public key to obtain the private key to be used to sign this input. + This value is typically derived via the following computation: + + * derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N + */ + bytes single_tweak = 2; + + /* + A private key that will be used in combination with its corresponding + private key to derive the private key that is to be used to sign the target + input. Within the Lightning protocol, this value is typically the + commitment secret from a previously revoked commitment transaction. This + value is in combination with two hash values, and the original private key + to derive the private key to be used when signing. + + * k = (privKey*sha256(pubKey || tweakPub) + + tweakPriv*sha256(tweakPub || pubKey)) mod N + */ + bytes double_tweak = 3; + + /* + The 32 byte input to the taproot tweak derivation that is used to derive + the output key from an internal key: outputKey = internalKey + + tagged_hash("tapTweak", internalKey || tapTweak). + + When doing a BIP 86 spend, this field can be an empty byte slice. + + When doing a normal key path spend, with the output key committing to an + actual script root, then this field should be: the tapscript root hash. + */ + bytes tap_tweak = 10; + + /* + The full script required to properly redeem the output. This field will + only be populated if a p2tr, p2wsh or a p2sh output is being signed. If a + taproot script path spend is being attempted, then this should be the raw + leaf script. + */ + bytes witness_script = 4; + + /* + A description of the output being spent. The value and script MUST be + provided. + */ + TxOut output = 5; + + /* + The target sighash type that should be used when generating the final + sighash, and signature. + */ + uint32 sighash = 7; + + /* + The target input within the transaction that should be signed. + */ + int32 input_index = 8; + + /* + The sign method specifies how the input should be signed. Depending on the + method, either the tap_tweak, witness_script or both need to be specified. + Defaults to SegWit v0 signing to be backward compatible with older RPC + clients. + */ + SignMethod sign_method = 9; +} + +message SignReq { + // The raw bytes of the transaction to be signed. + bytes raw_tx_bytes = 1; + + // A set of sign descriptors, for each input to be signed. + repeated SignDescriptor sign_descs = 2; + + /* + The full list of UTXO information for each of the inputs being spent. This + is required when spending one or more taproot (SegWit v1) outputs. + */ + repeated TxOut prev_outputs = 3; +} + +message SignResp { + /* + A set of signatures realized in a fixed 64-byte format ordered in ascending + input order. + */ + repeated bytes raw_sigs = 1; +} + +message InputScript { + // The serializes witness stack for the specified input. + repeated bytes witness = 1; + + /* + The optional sig script for the specified witness that will only be set if + the input specified is a nested p2sh witness program. + */ + bytes sig_script = 2; +} + +message InputScriptResp { + // The set of fully valid input scripts requested. + repeated InputScript input_scripts = 1; +} + +message SignMessageReq { + /* + The message to be signed. When using REST, this field must be encoded as + base64. + */ + bytes msg = 1; + + // The key locator that identifies which key to use for signing. + KeyLocator key_loc = 2; + + // Double-SHA256 hash instead of just the default single round. + bool double_hash = 3; + + /* + Use the compact (pubkey recoverable) format instead of the raw lnwire + format. This option cannot be used with Schnorr signatures. + */ + bool compact_sig = 4; + + /* + Use Schnorr signature. This option cannot be used with compact format. + */ + bool schnorr_sig = 5; + + /* + The optional Taproot tweak bytes to apply to the private key before creating + a Schnorr signature. The private key is tweaked as described in BIP-341: + privKey + h_tapTweak(internalKey || tapTweak) + */ + bytes schnorr_sig_tap_tweak = 6; + + /* + An optional tag that can be provided when taking a tagged hash of a + message. This option can only be used when schnorr_sig is true. + */ + bytes tag = 7; +} +message SignMessageResp { + /* + The signature for the given message in the fixed-size LN wire format. + */ + bytes signature = 1; +} + +message VerifyMessageReq { + // The message over which the signature is to be verified. When using + // REST, this field must be encoded as base64. + bytes msg = 1; + + /* + The fixed-size LN wire encoded signature to be verified over the given + message. When using REST, this field must be encoded as base64. + */ + bytes signature = 2; + + /* + The public key the signature has to be valid for. When using REST, this + field must be encoded as base64. If the is_schnorr_sig option is true, then + the public key is expected to be in the 32-byte x-only serialization + according to BIP-340. + */ + bytes pubkey = 3; + + /* + Specifies if the signature is a Schnorr signature. + */ + bool is_schnorr_sig = 4; + + /* + An optional tag that can be provided when taking a tagged hash of a + message. This option can only be used when is_schnorr_sig is true. + */ + bytes tag = 5; +} + +message VerifyMessageResp { + // Whether the signature was valid over the given message. + bool valid = 1; +} + +message SharedKeyRequest { + // The ephemeral public key to use for the DH key derivation. + bytes ephemeral_pubkey = 1; + + /* + Deprecated. The optional key locator of the local key that should be used. + If this parameter is not set then the node's identity private key will be + used. + */ + KeyLocator key_loc = 2 [deprecated = true]; + + /* + A key descriptor describes the key used for performing ECDH. Either a key + locator or a raw public key is expected, if neither is supplied, defaults to + the node's identity private key. + */ + KeyDescriptor key_desc = 3; +} + +message SharedKeyResponse { + // The shared public key, hashed with sha256. + bytes shared_key = 1; +} + +message TweakDesc { + /* + Tweak is the 32-byte value that will modify the public key. + */ + bytes tweak = 1; + + /* + Specifies if the target key should be converted to an x-only public key + before tweaking. If true, then the public key will be mapped to an x-only + key before the tweaking operation is applied. + */ + bool is_x_only = 2; +} + +message TaprootTweakDesc { + /* + The root hash of the tapscript tree if a script path is committed to. If + the MuSig2 key put on chain doesn't also commit to a script path (BIP-0086 + key spend only), then this needs to be empty and the key_spend_only field + below must be set to true. This is required because gRPC cannot + differentiate between a zero-size byte slice and a nil byte slice (both + would be serialized the same way). So the extra boolean is required. + */ + bytes script_root = 1; + + /* + Indicates that the above script_root is expected to be empty because this + is a BIP-0086 key spend only commitment where only the internal key is + committed to instead of also including a script root hash. + */ + bool key_spend_only = 2; +} + +enum MuSig2Version { + /* + The default value on the RPC is zero for enums so we need to represent an + invalid/undefined version by default to make sure clients upgrade their + software to set the version explicitly. + */ + MUSIG2_VERSION_UNDEFINED = 0; + + /* + The version of MuSig2 that lnd 0.15.x shipped with, which corresponds to the + version v0.4.0 of the MuSig2 BIP draft. + */ + MUSIG2_VERSION_V040 = 1; + + /* + The current version of MuSig2 which corresponds to the version v1.0.0rc2 of + the MuSig2 BIP draft. + */ + MUSIG2_VERSION_V100RC2 = 2; +} + +message MuSig2CombineKeysRequest { + /* + A list of all public keys (serialized in 32-byte x-only format for v0.4.0 + and 33-byte compressed format for v1.0.0rc2!) participating in the signing + session. The list will always be sorted lexicographically internally. This + must include the local key which is described by the above key_loc. + */ + repeated bytes all_signer_pubkeys = 1; + + /* + A series of optional generic tweaks to be applied to the aggregated + public key. + */ + repeated TweakDesc tweaks = 2; + + /* + An optional taproot specific tweak that must be specified if the MuSig2 + combined key will be used as the main taproot key of a taproot output + on-chain. + */ + TaprootTweakDesc taproot_tweak = 3; + + /* + The mandatory version of the MuSig2 BIP draft to use. This is necessary to + differentiate between the changes that were made to the BIP while this + experimental RPC was already released. Some of those changes affect how the + combined key and nonces are created. + */ + MuSig2Version version = 4; +} + +message MuSig2CombineKeysResponse { + /* + The combined public key (in the 32-byte x-only format) with all tweaks + applied to it. If a taproot tweak is specified, this corresponds to the + taproot key that can be put into the on-chain output. + */ + bytes combined_key = 1; + + /* + The raw combined public key (in the 32-byte x-only format) before any tweaks + are applied to it. If a taproot tweak is specified, this corresponds to the + internal key that needs to be put into the witness if the script spend path + is used. + */ + bytes taproot_internal_key = 2; + + /* + The version of the MuSig2 BIP that was used to combine the keys. + */ + MuSig2Version version = 4; +} + +message MuSig2SessionRequest { + /* + The key locator that identifies which key to use for signing. + */ + KeyLocator key_loc = 1; + + /* + A list of all public keys (serialized in 32-byte x-only format for v0.4.0 + and 33-byte compressed format for v1.0.0rc2!) participating in the signing + session. The list will always be sorted lexicographically internally. This + must include the local key which is described by the above key_loc. + */ + repeated bytes all_signer_pubkeys = 2; + + /* + An optional list of all public nonces of other signing participants that + might already be known. + */ + repeated bytes other_signer_public_nonces = 3; + + /* + A series of optional generic tweaks to be applied to the aggregated + public key. + */ + repeated TweakDesc tweaks = 4; + + /* + An optional taproot specific tweak that must be specified if the MuSig2 + combined key will be used as the main taproot key of a taproot output + on-chain. + */ + TaprootTweakDesc taproot_tweak = 5; + + /* + The mandatory version of the MuSig2 BIP draft to use. This is necessary to + differentiate between the changes that were made to the BIP while this + experimental RPC was already released. Some of those changes affect how the + combined key and nonces are created. + */ + MuSig2Version version = 6; + + /* + A set of pre generated secret local nonces to use in the musig2 session. + This field is optional. This can be useful for protocols that need to send + nonces ahead of time before the set of signer keys are known. This value + MUST be 97 bytes and be the concatenation of two CSPRNG generated 32 byte + values and local public key used for signing as specified in the key_loc + field. + */ + bytes pregenerated_local_nonce = 7; +} + +message MuSig2SessionResponse { + /* + The unique ID that represents this signing session. A session can be used + for producing a signature a single time. If the signing fails for any + reason, a new session with the same participants needs to be created. + */ + bytes session_id = 1; + + /* + The combined public key (in the 32-byte x-only format) with all tweaks + applied to it. If a taproot tweak is specified, this corresponds to the + taproot key that can be put into the on-chain output. + */ + bytes combined_key = 2; + + /* + The raw combined public key (in the 32-byte x-only format) before any tweaks + are applied to it. If a taproot tweak is specified, this corresponds to the + internal key that needs to be put into the witness if the script spend path + is used. + */ + bytes taproot_internal_key = 3; + + /* + The two public nonces the local signer uses, combined into a single value + of 66 bytes. Can be split into the two 33-byte points to get the individual + nonces. + */ + bytes local_public_nonces = 4; + + /* + Indicates whether all nonces required to start the signing process are known + now. + */ + bool have_all_nonces = 5; + + /* + The version of the MuSig2 BIP that was used to create the session. + */ + MuSig2Version version = 6; +} + +message MuSig2RegisterNoncesRequest { + /* + The unique ID of the signing session those nonces should be registered with. + */ + bytes session_id = 1; + + /* + A list of all public nonces of other signing participants that should be + registered. + */ + repeated bytes other_signer_public_nonces = 3; +} + +message MuSig2RegisterNoncesResponse { + /* + Indicates whether all nonces required to start the signing process are known + now. + */ + bool have_all_nonces = 1; +} + +message MuSig2SignRequest { + /* + The unique ID of the signing session to use for signing. + */ + bytes session_id = 1; + + /* + The 32-byte SHA256 digest of the message to sign. + */ + bytes message_digest = 2; + + /* + Cleanup indicates that after signing, the session state can be cleaned up, + since another participant is going to be responsible for combining the + partial signatures. + */ + bool cleanup = 3; +} + +message MuSig2SignResponse { + /* + The partial signature created by the local signer. + */ + bytes local_partial_signature = 1; +} + +message MuSig2CombineSigRequest { + /* + The unique ID of the signing session to combine the signatures for. + */ + bytes session_id = 1; + + /* + The list of all other participants' partial signatures to add to the current + session. + */ + repeated bytes other_partial_signatures = 2; +} + +message MuSig2CombineSigResponse { + /* + Indicates whether all partial signatures required to create a final, full + signature are known yet. If this is true, then the final_signature field is + set, otherwise it is empty. + */ + bool have_all_signatures = 1; + + /* + The final, full signature that is valid for the combined public key. + */ + bytes final_signature = 2; +} + +message MuSig2CleanupRequest { + /* + The unique ID of the signing session that should be removed/cleaned up. + */ + bytes session_id = 1; +} + +message MuSig2CleanupResponse { +} \ No newline at end of file diff --git a/proto/others/walletkit.proto b/proto/others/walletkit.proto new file mode 100644 index 00000000..5ecb18a9 --- /dev/null +++ b/proto/others/walletkit.proto @@ -0,0 +1,1568 @@ +syntax = "proto3"; + +package walletrpc; + +import "lightning.proto"; +import "signer.proto"; + +option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc"; + +/* + * Comments in this file will be directly parsed into the API + * Documentation as descriptions of the associated method, message, or field. + * These descriptions should go right above the definition of the object, and + * can be in either block or // comment format. + * + * An RPC method can be matched to an lncli command by placing a line in the + * beginning of the description in exactly the following format: + * lncli: `methodname` + * + * Failure to specify the exact name of the command will cause documentation + * generation to fail. + * + * More information on how exactly the gRPC documentation is generated from + * this proto file can be found here: + * https://github.com/lightninglabs/lightning-api + */ + +// WalletKit is a service that gives access to the core functionalities of the +// daemon's wallet. +service WalletKit { + /* + ListUnspent returns a list of all utxos spendable by the wallet with a + number of confirmations between the specified minimum and maximum. By + default, all utxos are listed. To list only the unconfirmed utxos, set + the unconfirmed_only to true. + */ + rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse); + + /* lncli: `wallet leaseoutput` + LeaseOutput locks an output to the given ID, preventing it from being + available for any future coin selection attempts. The absolute time of the + lock's expiration is returned. The expiration of the lock can be extended by + successive invocations of this RPC. Outputs can be unlocked before their + expiration through `ReleaseOutput`. + */ + rpc LeaseOutput (LeaseOutputRequest) returns (LeaseOutputResponse); + + /* lncli: `wallet releaseoutput` + ReleaseOutput unlocks an output, allowing it to be available for coin + selection if it remains unspent. The ID should match the one used to + originally lock the output. + */ + rpc ReleaseOutput (ReleaseOutputRequest) returns (ReleaseOutputResponse); + + /* lncli: `wallet listleases` + ListLeases lists all currently locked utxos. + */ + rpc ListLeases (ListLeasesRequest) returns (ListLeasesResponse); + + /* + DeriveNextKey attempts to derive the *next* key within the key family + (account in BIP43) specified. This method should return the next external + child within this branch. + */ + rpc DeriveNextKey (KeyReq) returns (signrpc.KeyDescriptor); + + /* + DeriveKey attempts to derive an arbitrary key specified by the passed + KeyLocator. + */ + rpc DeriveKey (signrpc.KeyLocator) returns (signrpc.KeyDescriptor); + + /* + NextAddr returns the next unused address within the wallet. + */ + rpc NextAddr (AddrRequest) returns (AddrResponse); + + /* lncli: `wallet gettx` + GetTransaction returns details for a transaction found in the wallet. + */ + rpc GetTransaction (GetTransactionRequest) returns (lnrpc.Transaction); + + /* lncli: `wallet accounts list` + ListAccounts retrieves all accounts belonging to the wallet by default. A + name and key scope filter can be provided to filter through all of the + wallet accounts and return only those matching. + */ + rpc ListAccounts (ListAccountsRequest) returns (ListAccountsResponse); + + /* lncli: `wallet requiredreserve` + RequiredReserve returns the minimum amount of satoshis that should be kept + in the wallet in order to fee bump anchor channels if necessary. The value + scales with the number of public anchor channels but is capped at a maximum. + */ + rpc RequiredReserve (RequiredReserveRequest) + returns (RequiredReserveResponse); + + /* lncli: `wallet addresses list` + ListAddresses retrieves all the addresses along with their balance. An + account name filter can be provided to filter through all of the + wallet accounts and return the addresses of only those matching. + */ + rpc ListAddresses (ListAddressesRequest) returns (ListAddressesResponse); + + /* lncli: `wallet addresses signmessage` + SignMessageWithAddr returns the compact signature (base64 encoded) created + with the private key of the provided address. This requires the address + to be solely based on a public key lock (no scripts). Obviously the internal + lnd wallet has to possess the private key of the address otherwise + an error is returned. + + This method aims to provide full compatibility with the bitcoin-core and + btcd implementation. Bitcoin-core's algorithm is not specified in a + BIP and only applicable for legacy addresses. This method enhances the + signing for additional address types: P2WKH, NP2WKH, P2TR. + For P2TR addresses this represents a special case. ECDSA is used to create + a compact signature which makes the public key of the signature recoverable. + */ + rpc SignMessageWithAddr (SignMessageWithAddrRequest) + returns (SignMessageWithAddrResponse); + + /* lncli: `wallet addresses verifymessage` + VerifyMessageWithAddr returns the validity and the recovered public key of + the provided compact signature (base64 encoded). The verification is + twofold. First the validity of the signature itself is checked and then + it is verified that the recovered public key of the signature equals + the public key of the provided address. There is no dependence on the + private key of the address therefore also external addresses are allowed + to verify signatures. + Supported address types are P2PKH, P2WKH, NP2WKH, P2TR. + + This method is the counterpart of the related signing method + (SignMessageWithAddr) and aims to provide full compatibility to + bitcoin-core's implementation. Although bitcoin-core/btcd only provide + this functionality for legacy addresses this function enhances it to + the address types: P2PKH, P2WKH, NP2WKH, P2TR. + + The verification for P2TR addresses is a special case and requires the + ECDSA compact signature to compare the reovered public key to the internal + taproot key. The compact ECDSA signature format was used because there + are still no known compact signature schemes for schnorr signatures. + */ + rpc VerifyMessageWithAddr (VerifyMessageWithAddrRequest) + returns (VerifyMessageWithAddrResponse); + + /* lncli: `wallet accounts import` + ImportAccount imports an account backed by an account extended public key. + The master key fingerprint denotes the fingerprint of the root key + corresponding to the account public key (also known as the key with + derivation path m/). This may be required by some hardware wallets for + proper identification and signing. + + The address type can usually be inferred from the key's version, but may be + required for certain keys to map them into the proper scope. + + For BIP-0044 keys, an address type must be specified as we intend to not + support importing BIP-0044 keys into the wallet using the legacy + pay-to-pubkey-hash (P2PKH) scheme. A nested witness address type will force + the standard BIP-0049 derivation scheme, while a witness address type will + force the standard BIP-0084 derivation scheme. + + For BIP-0049 keys, an address type must also be specified to make a + distinction between the standard BIP-0049 address schema (nested witness + pubkeys everywhere) and our own BIP-0049Plus address schema (nested pubkeys + externally, witness pubkeys internally). + + NOTE: Events (deposits/spends) for keys derived from an account will only be + detected by lnd if they happen after the import. Rescans to detect past + events will be supported later on. + */ + rpc ImportAccount (ImportAccountRequest) returns (ImportAccountResponse); + + /* lncli: `wallet accounts import-pubkey` + ImportPublicKey imports a public key as watch-only into the wallet. The + public key is converted into a simple address of the given type and that + address script is watched on chain. For Taproot keys, this will only watch + the BIP-0086 style output script. Use ImportTapscript for more advanced key + spend or script spend outputs. + + NOTE: Events (deposits/spends) for a key will only be detected by lnd if + they happen after the import. Rescans to detect past events will be + supported later on. + */ + rpc ImportPublicKey (ImportPublicKeyRequest) + returns (ImportPublicKeyResponse); + + /* + ImportTapscript imports a Taproot script and internal key and adds the + resulting Taproot output key as a watch-only output script into the wallet. + For BIP-0086 style Taproot keys (no root hash commitment and no script spend + path) use ImportPublicKey. + + NOTE: Events (deposits/spends) for a key will only be detected by lnd if + they happen after the import. Rescans to detect past events will be + supported later on. + + NOTE: Taproot keys imported through this RPC currently _cannot_ be used for + funding PSBTs. Only tracking the balance and UTXOs is currently supported. + */ + rpc ImportTapscript (ImportTapscriptRequest) + returns (ImportTapscriptResponse); + + /* lncli: `wallet publishtx` + PublishTransaction attempts to publish the passed transaction to the + network. Once this returns without an error, the wallet will continually + attempt to re-broadcast the transaction on start up, until it enters the + chain. + */ + rpc PublishTransaction (Transaction) returns (PublishResponse); + + /* lncli: `wallet removetx` + RemoveTransaction attempts to remove the provided transaction from the + internal transaction store of the wallet. + */ + rpc RemoveTransaction (GetTransactionRequest) + returns (RemoveTransactionResponse); + + /* + SendOutputs is similar to the existing sendmany call in Bitcoind, and + allows the caller to create a transaction that sends to several outputs at + once. This is ideal when wanting to batch create a set of transactions. + */ + rpc SendOutputs (SendOutputsRequest) returns (SendOutputsResponse); + + /* lncli: `wallet estimatefeerate` + EstimateFee attempts to query the internal fee estimator of the wallet to + determine the fee (in sat/kw) to attach to a transaction in order to + achieve the confirmation target. + */ + rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse); + + /* lncli: `wallet pendingsweeps` + PendingSweeps returns lists of on-chain outputs that lnd is currently + attempting to sweep within its central batching engine. Outputs with similar + fee rates are batched together in order to sweep them within a single + transaction. + + NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to + remain supported. This is an advanced API that depends on the internals of + the UtxoSweeper, so things may change. + */ + rpc PendingSweeps (PendingSweepsRequest) returns (PendingSweepsResponse); + + /* lncli: `wallet bumpfee` + BumpFee is an endpoint that allows users to interact with lnd's sweeper + directly. It takes an outpoint from an unconfirmed transaction and sends it + to the sweeper for potential fee bumping. Depending on whether the outpoint + has been registered in the sweeper (an existing input, e.g., an anchor + output) or not (a new input, e.g., an unconfirmed wallet utxo), this will + either be an RBF or CPFP attempt. + + When receiving an input, lnd’s sweeper needs to understand its time + sensitivity to make economical fee bumps - internally a fee function is + created using the deadline and budget to guide the process. When the + deadline is approaching, the fee function will increase the fee rate and + perform an RBF. + + When a force close happens, all the outputs from the force closing + transaction will be registered in the sweeper. The sweeper will then handle + the creation, publish, and fee bumping of the sweeping transactions. + Everytime a new block comes in, unless the sweeping transaction is + confirmed, an RBF is attempted. To interfere with this automatic process, + users can use BumpFee to specify customized fee rate, budget, deadline, and + whether the sweep should happen immediately. It's recommended to call + `ListSweeps` to understand the shape of the existing sweeping transaction + first - depending on the number of inputs in this transaction, the RBF + requirements can be quite different. + + This RPC also serves useful when wanting to perform a Child-Pays-For-Parent + (CPFP), where the child transaction pays for its parent's fee. This can be + done by specifying an outpoint within the low fee transaction that is under + the control of the wallet. + */ + rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse); + + /* lncli: `wallet bumpforceclosefee` + BumpForceCloseFee is an endpoint that allows users to bump the fee of a + channel force close. This only works for channels with option_anchors. + */ + rpc BumpForceCloseFee (BumpForceCloseFeeRequest) + returns (BumpForceCloseFeeResponse); + + /* lncli: `wallet listsweeps` + ListSweeps returns a list of the sweep transactions our node has produced. + Note that these sweeps may not be confirmed yet, as we record sweeps on + broadcast, not confirmation. + */ + rpc ListSweeps (ListSweepsRequest) returns (ListSweepsResponse); + + /* lncli: `wallet labeltx` + LabelTransaction adds a label to a transaction. If the transaction already + has a label the call will fail unless the overwrite bool is set. This will + overwrite the existing transaction label. Labels must not be empty, and + cannot exceed 500 characters. + */ + rpc LabelTransaction (LabelTransactionRequest) + returns (LabelTransactionResponse); + + /* lncli: `wallet psbt fund` + FundPsbt creates a fully populated PSBT that contains enough inputs to fund + the outputs specified in the template. There are three ways a user can + specify what we call the template (a list of inputs and outputs to use in + the PSBT): Either as a PSBT packet directly with no coin selection (using + the legacy "psbt" field), a PSBT with advanced coin selection support (using + the new "coin_select" field) or as a raw RPC message (using the "raw" + field). + The legacy "psbt" and "raw" modes, the following restrictions apply: + 1. If there are no inputs specified in the template, coin selection is + performed automatically. + 2. If the template does contain any inputs, it is assumed that full + coin selection happened externally and no additional inputs are added. If + the specified inputs aren't enough to fund the outputs with the given fee + rate, an error is returned. + + The new "coin_select" mode does not have these restrictions and allows the + user to specify a PSBT with inputs and outputs and still perform coin + selection on top of that. + For all modes this RPC requires any inputs that are specified to be locked + by the user (if they belong to this node in the first place). + + After either selecting or verifying the inputs, all input UTXOs are locked + with an internal app ID. + + NOTE: If this method returns without an error, it is the caller's + responsibility to either spend the locked UTXOs (by finalizing and then + publishing the transaction) or to unlock/release the locked UTXOs in case of + an error on the caller's side. + */ + rpc FundPsbt (FundPsbtRequest) returns (FundPsbtResponse); + + /* + SignPsbt expects a partial transaction with all inputs and outputs fully + declared and tries to sign all unsigned inputs that have all required fields + (UTXO information, BIP32 derivation information, witness or sig scripts) + set. + If no error is returned, the PSBT is ready to be given to the next signer or + to be finalized if lnd was the last signer. + + NOTE: This RPC only signs inputs (and only those it can sign), it does not + perform any other tasks (such as coin selection, UTXO locking or + input/output/fee value validation, PSBT finalization). Any input that is + incomplete will be skipped. + */ + rpc SignPsbt (SignPsbtRequest) returns (SignPsbtResponse); + + /* lncli: `wallet psbt finalize` + FinalizePsbt expects a partial transaction with all inputs and outputs fully + declared and tries to sign all inputs that belong to the wallet. Lnd must be + the last signer of the transaction. That means, if there are any unsigned + non-witness inputs or inputs without UTXO information attached or inputs + without witness data that do not belong to lnd's wallet, this method will + fail. If no error is returned, the PSBT is ready to be extracted and the + final TX within to be broadcast. + + NOTE: This method does NOT publish the transaction once finalized. It is the + caller's responsibility to either publish the transaction on success or + unlock/release any locked UTXOs in case of an error in this method. + */ + rpc FinalizePsbt (FinalizePsbtRequest) returns (FinalizePsbtResponse); +} + +message ListUnspentRequest { + // The minimum number of confirmations to be included. + int32 min_confs = 1; + + // The maximum number of confirmations to be included. + int32 max_confs = 2; + + // An optional filter to only include outputs belonging to an account. + string account = 3; + + /* + When min_confs and max_confs are zero, setting false implicitly + overrides max_confs to be MaxInt32, otherwise max_confs remains + zero. An error is returned if the value is true and both min_confs + and max_confs are non-zero. (default: false) + */ + bool unconfirmed_only = 4; +} + +message ListUnspentResponse { + // A list of utxos satisfying the specified number of confirmations. + repeated lnrpc.Utxo utxos = 1; +} + +message LeaseOutputRequest { + /* + An ID of 32 random bytes that must be unique for each distinct application + using this RPC which will be used to bound the output lease to. + */ + bytes id = 1; + + // The identifying outpoint of the output being leased. + lnrpc.OutPoint outpoint = 2; + + // The time in seconds before the lock expires. If set to zero, the default + // lock duration is used. + uint64 expiration_seconds = 3; +} + +message LeaseOutputResponse { + /* + The absolute expiration of the output lease represented as a unix timestamp. + */ + uint64 expiration = 1; +} + +message ReleaseOutputRequest { + // The unique ID that was used to lock the output. + bytes id = 1; + + // The identifying outpoint of the output being released. + lnrpc.OutPoint outpoint = 2; +} + +message ReleaseOutputResponse { + // The status of the release operation. + string status = 1; +} + +message KeyReq { + /* + Is the key finger print of the root pubkey that this request is targeting. + This allows the WalletKit to possibly serve out keys for multiple HD chains + via public derivation. + */ + int32 key_finger_print = 1; + + /* + The target key family to derive a key from. In other contexts, this is + known as the "account". + */ + int32 key_family = 2; +} + +message AddrRequest { + /* + The name of the account to retrieve the next address of. If empty, the + default wallet account is used. + */ + string account = 1; + + /* + The type of address to derive. + */ + AddressType type = 2; + + /* + Whether a change address should be derived. + */ + bool change = 3; +} +message AddrResponse { + /* + The address encoded using a bech32 format. + */ + string addr = 1; +} + +enum AddressType { + UNKNOWN = 0; + WITNESS_PUBKEY_HASH = 1; + NESTED_WITNESS_PUBKEY_HASH = 2; + HYBRID_NESTED_WITNESS_PUBKEY_HASH = 3; + TAPROOT_PUBKEY = 4; +} +message Account { + // The name used to identify the account. + string name = 1; + + // The type of addresses the account supports. + AddressType address_type = 2; + + /* + The public key backing the account that all keys are derived from + represented as an extended key. This will always be empty for the default + imported account in which single public keys are imported into. + */ + string extended_public_key = 3; + + /* + The fingerprint of the root key from which the account public key was + derived from. This will always be zero for the default imported account in + which single public keys are imported into. The bytes are in big-endian + order. + */ + bytes master_key_fingerprint = 4; + + /* + The derivation path corresponding to the account public key. This will + always be empty for the default imported account in which single public keys + are imported into. + */ + string derivation_path = 5; + + /* + The number of keys derived from the external branch of the account public + key. This will always be zero for the default imported account in which + single public keys are imported into. + */ + uint32 external_key_count = 6; + + /* + The number of keys derived from the internal branch of the account public + key. This will always be zero for the default imported account in which + single public keys are imported into. + */ + uint32 internal_key_count = 7; + + // Whether the wallet stores private keys for the account. + bool watch_only = 8; +} + +message AddressProperty { + /* + The address encoded using the appropriate format depending on the + address type (base58, bech32, bech32m). + + Note that lnd's internal/custom keys for channels and other + functionality are derived from the same scope. Since they + aren't really used as addresses and will never have an + on-chain balance, we'll show the public key instead (only if + the show_custom_accounts flag is provided). + */ + string address = 1; + + // Denotes if the address is a change address. + bool is_internal = 2; + + // The balance of the address. + int64 balance = 3; + + // The full derivation path of the address. This will be empty for imported + // addresses. + string derivation_path = 4; + + // The public key of the address. This will be empty for imported addresses. + bytes public_key = 5; +} + +message AccountWithAddresses { + // The name used to identify the account. + string name = 1; + + // The type of addresses the account supports. + AddressType address_type = 2; + + /* + The derivation path corresponding to the account public key. This will + always be empty for the default imported account in which single public keys + are imported into. + */ + string derivation_path = 3; + + /* + List of address, its type internal/external & balance. + Note that the order of addresses will be random and not according to the + derivation index, since that information is not stored by the underlying + wallet. + */ + repeated AddressProperty addresses = 4; +} + +message ListAccountsRequest { + // An optional filter to only return accounts matching this name. + string name = 1; + + // An optional filter to only return accounts matching this address type. + AddressType address_type = 2; +} + +message ListAccountsResponse { + repeated Account accounts = 1; +} + +message RequiredReserveRequest { + // The number of additional channels the user would like to open. + uint32 additional_public_channels = 1; +} + +message RequiredReserveResponse { + // The amount of reserve required. + int64 required_reserve = 1; +} + +message ListAddressesRequest { + // An optional filter to only return addresses matching this account. + string account_name = 1; + + // An optional flag to return LND's custom accounts (Purpose=1017) + // public key along with other addresses. + bool show_custom_accounts = 2; +} + +message ListAddressesResponse { + // A list of all the accounts and their addresses. + repeated AccountWithAddresses account_with_addresses = 1; +} + +message GetTransactionRequest { + // The txid of the transaction. + string txid = 1; +} + +message SignMessageWithAddrRequest { + // The message to be signed. When using REST, this field must be encoded as + // base64. + bytes msg = 1; + + // The address which will be used to look up the private key and sign the + // corresponding message. + string addr = 2; +} + +message SignMessageWithAddrResponse { + // The compact ECDSA signature for the given message encoded in base64. + string signature = 1; +} + +message VerifyMessageWithAddrRequest { + // The message to be signed. When using REST, this field must be encoded as + // base64. + bytes msg = 1; + + // The compact ECDSA signature to be verified over the given message + // ecoded in base64. + string signature = 2; + + // The address which will be used to look up the public key and verify the + // the signature. + string addr = 3; +} + +message VerifyMessageWithAddrResponse { + // Whether the signature was valid over the given message. + bool valid = 1; + + // The pubkey recovered from the signature. + bytes pubkey = 2; +} + +message ImportAccountRequest { + // A name to identify the account with. + string name = 1; + + /* + A public key that corresponds to a wallet account represented as an extended + key. It must conform to a derivation path of the form + m/purpose'/coin_type'/account'. + */ + string extended_public_key = 2; + + /* + The fingerprint of the root key (also known as the key with derivation path + m/) from which the account public key was derived from. This may be required + by some hardware wallets for proper identification and signing. The bytes + must be in big-endian order. + */ + bytes master_key_fingerprint = 3; + + /* + An address type is only required when the extended account public key has a + legacy version (xpub, tpub, etc.), such that the wallet cannot detect what + address scheme it belongs to. + */ + AddressType address_type = 4; + + /* + Whether a dry run should be attempted when importing the account. This + serves as a way to confirm whether the account is being imported correctly + by returning the first N addresses for the external and internal branches of + the account. If these addresses match as expected, then it should be safe to + import the account as is. + */ + bool dry_run = 5; +} +message ImportAccountResponse { + // The details of the imported account. + Account account = 1; + + /* + The first N addresses that belong to the external branch of the account. + The external branch is typically used for external non-change addresses. + These are only returned if a dry run was specified within the request. + */ + repeated string dry_run_external_addrs = 2; + + /* + The first N addresses that belong to the internal branch of the account. + The internal branch is typically used for change addresses. These are only + returned if a dry run was specified within the request. + */ + repeated string dry_run_internal_addrs = 3; +} + +message ImportPublicKeyRequest { + // A compressed public key represented as raw bytes. + bytes public_key = 1; + + // The type of address that will be generated from the public key. + AddressType address_type = 2; +} +message ImportPublicKeyResponse { + // The status of the import operation. + string status = 1; +} + +message ImportTapscriptRequest { + /* + The internal public key, serialized as 32-byte x-only public key. + */ + bytes internal_public_key = 1; + + oneof script { + /* + The full script tree with all individual leaves is known and the root + hash can be constructed from the full tree directly. + */ + TapscriptFullTree full_tree = 2; + + /* + Only a single script leaf is known. To construct the root hash, the full + inclusion proof must also be provided. + */ + TapscriptPartialReveal partial_reveal = 3; + + /* + Only the root hash of the Taproot script tree (or other form of Taproot + commitment) is known. + */ + bytes root_hash_only = 4; + + /* + Only the final, tweaked Taproot key is known and no additional + information about the internal key or type of tweak that was used to + derive it. When this is set, the wallet treats the key in + internal_public_key as the Taproot key directly. This can be useful for + tracking arbitrary Taproot outputs without the goal of ever being able + to spend from them through the internal wallet. + */ + bool full_key_only = 5; + } +} + +message TapscriptFullTree { + /* + The complete, ordered list of all tap leaves of the tree. + */ + repeated TapLeaf all_leaves = 1; +} + +message TapLeaf { + // The leaf version. Should be 0xc0 (192) in case of a SegWit v1 script. + uint32 leaf_version = 1; + + // The script of the tap leaf. + bytes script = 2; +} + +message TapscriptPartialReveal { + // The tap leaf that is known and will be revealed. + TapLeaf revealed_leaf = 1; + + // The BIP-0341 serialized inclusion proof that is required to prove that + // the revealed leaf is part of the tree. This contains 0..n blocks of 32 + // bytes. If the tree only contained a single leaf (which is the revealed + // leaf), this can be empty. + bytes full_inclusion_proof = 2; +} + +message ImportTapscriptResponse { + /* + The resulting pay-to-Taproot address that represents the imported internal + key with the script committed to it. + */ + string p2tr_address = 1; +} + +message Transaction { + /* + The raw serialized transaction. Despite the field name, this does need to be + specified in raw bytes (or base64 encoded when using REST) and not in hex. + To not break existing software, the field can't simply be renamed. + */ + bytes tx_hex = 1; + + /* + An optional label to save with the transaction. Limited to 500 characters. + */ + string label = 2; +} + +message PublishResponse { + /* + If blank, then no error occurred and the transaction was successfully + published. If not the empty string, then a string representation of the + broadcast error. + + TODO(roasbeef): map to a proper enum type + */ + string publish_error = 1; +} + +message RemoveTransactionResponse { + // The status of the remove transaction operation. + string status = 1; +} + +message SendOutputsRequest { + /* + The number of satoshis per kilo weight that should be used when crafting + this transaction. + */ + int64 sat_per_kw = 1; + + /* + A slice of the outputs that should be created in the transaction produced. + */ + repeated signrpc.TxOut outputs = 2; + + // An optional label for the transaction, limited to 500 characters. + string label = 3; + + // The minimum number of confirmations each one of your outputs used for + // the transaction must satisfy. + int32 min_confs = 4; + + // Whether unconfirmed outputs should be used as inputs for the transaction. + bool spend_unconfirmed = 5; + + // The strategy to use for selecting coins during sending the outputs. + lnrpc.CoinSelectionStrategy coin_selection_strategy = 6; +} +message SendOutputsResponse { + /* + The serialized transaction sent out on the network. + */ + bytes raw_tx = 1; +} + +message EstimateFeeRequest { + /* + The number of confirmations to shoot for when estimating the fee. + */ + int32 conf_target = 1; +} +message EstimateFeeResponse { + /* + The amount of satoshis per kw that should be used in order to reach the + confirmation target in the request. + */ + int64 sat_per_kw = 1; + + // The current minimum relay fee based on our chain backend in sat/kw. + int64 min_relay_fee_sat_per_kw = 2; +} + +enum WitnessType { + UNKNOWN_WITNESS = 0; + + /* + A witness that allows us to spend the output of a commitment transaction + after a relative lock-time lockout. + */ + COMMITMENT_TIME_LOCK = 1; + + /* + A witness that allows us to spend a settled no-delay output immediately on a + counterparty's commitment transaction. + */ + COMMITMENT_NO_DELAY = 2; + + /* + A witness that allows us to sweep the settled output of a malicious + counterparty's who broadcasts a revoked commitment transaction. + */ + COMMITMENT_REVOKE = 3; + + /* + A witness that allows us to sweep an HTLC which we offered to the remote + party in the case that they broadcast a revoked commitment state. + */ + HTLC_OFFERED_REVOKE = 4; + + /* + A witness that allows us to sweep an HTLC output sent to us in the case that + the remote party broadcasts a revoked commitment state. + */ + HTLC_ACCEPTED_REVOKE = 5; + + /* + A witness that allows us to sweep an HTLC output that we extended to a + party, but was never fulfilled. This HTLC output isn't directly on the + commitment transaction, but is the result of a confirmed second-level HTLC + transaction. As a result, we can only spend this after a CSV delay. + */ + HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 6; + + /* + A witness that allows us to sweep an HTLC output that was offered to us, and + for which we have a payment preimage. This HTLC output isn't directly on our + commitment transaction, but is the result of confirmed second-level HTLC + transaction. As a result, we can only spend this after a CSV delay. + */ + HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 7; + + /* + A witness that allows us to sweep an HTLC that we offered to the remote + party which lies in the commitment transaction of the remote party. We can + spend this output after the absolute CLTV timeout of the HTLC as passed. + */ + HTLC_OFFERED_REMOTE_TIMEOUT = 8; + + /* + A witness that allows us to sweep an HTLC that was offered to us by the + remote party. We use this witness in the case that the remote party goes to + chain, and we know the pre-image to the HTLC. We can sweep this without any + additional timeout. + */ + HTLC_ACCEPTED_REMOTE_SUCCESS = 9; + + /* + A witness that allows us to sweep an HTLC from the remote party's commitment + transaction in the case that the broadcast a revoked commitment, but then + also immediately attempt to go to the second level to claim the HTLC. + */ + HTLC_SECOND_LEVEL_REVOKE = 10; + + /* + A witness type that allows us to spend a regular p2wkh output that's sent to + an output which is under complete control of the backing wallet. + */ + WITNESS_KEY_HASH = 11; + + /* + A witness type that allows us to sweep an output that sends to a nested P2SH + script that pays to a key solely under our control. + */ + NESTED_WITNESS_KEY_HASH = 12; + + /* + A witness type that allows us to spend our anchor on the commitment + transaction. + */ + COMMITMENT_ANCHOR = 13; + + /* + A witness type that is similar to the COMMITMENT_NO_DELAY type, + but it omits the tweak that randomizes the key we need to + spend with a channel peer supplied set of randomness. + */ + COMMITMENT_NO_DELAY_TWEAKLESS = 14; + + /* + A witness type that allows us to spend our output on the counterparty's + commitment transaction after a confirmation. + */ + COMMITMENT_TO_REMOTE_CONFIRMED = 15; + + /* + A witness type that allows us to sweep an HTLC output that we extended + to a party, but was never fulfilled. This _is_ the HTLC output directly + on our commitment transaction, and the input to the second-level HTLC + timeout transaction. It can only be spent after CLTV expiry, and + commitment confirmation. + */ + HTLC_OFFERED_TIMEOUT_SECOND_LEVEL_INPUT_CONFIRMED = 16; + + /* + A witness type that allows us to sweep an HTLC output that was offered + to us, and for which we have a payment preimage. This _is_ the HTLC + output directly on our commitment transaction, and the input to the + second-level HTLC success transaction. It can only be spent after the + commitment has confirmed. + */ + HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL_INPUT_CONFIRMED = 17; + + /* + A witness type that allows us to spend our output on our local + commitment transaction after a relative and absolute lock-time lockout as + part of the script enforced lease commitment type. + */ + LEASE_COMMITMENT_TIME_LOCK = 18; + + /* + A witness type that allows us to spend our output on the counterparty's + commitment transaction after a confirmation and absolute locktime as part + of the script enforced lease commitment type. + */ + LEASE_COMMITMENT_TO_REMOTE_CONFIRMED = 19; + + /* + A witness type that allows us to sweep an HTLC output that we extended + to a party, but was never fulfilled. This HTLC output isn't directly on + the commitment transaction, but is the result of a confirmed second-level + HTLC transaction. As a result, we can only spend this after a CSV delay + and CLTV locktime as part of the script enforced lease commitment type. + */ + LEASE_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 20; + + /* + A witness type that allows us to sweep an HTLC output that was offered + to us, and for which we have a payment preimage. This HTLC output isn't + directly on our commitment transaction, but is the result of confirmed + second-level HTLC transaction. As a result, we can only spend this after + a CSV delay and CLTV locktime as part of the script enforced lease + commitment type. + */ + LEASE_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 21; + + /* + A witness type that allows us to spend a regular p2tr output that's sent + to an output which is under complete control of the backing wallet. + */ + TAPROOT_PUB_KEY_SPEND = 22; + + /* + A witness type that allows us to spend our settled local commitment after a + CSV delay when we force close the channel. + */ + TAPROOT_LOCAL_COMMIT_SPEND = 23; + + /* + A witness type that allows us to spend our settled local commitment after + a CSV delay when the remote party has force closed the channel. + */ + TAPROOT_REMOTE_COMMIT_SPEND = 24; + + /* + A witness type that we'll use for spending our own anchor output. + */ + TAPROOT_ANCHOR_SWEEP_SPEND = 25; + + /* + A witness that allows us to timeout an HTLC we offered to the remote party + on our commitment transaction. We use this when we need to go on chain to + time out an HTLC. + */ + TAPROOT_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 26; + + /* + A witness type that allows us to sweep an HTLC we accepted on our commitment + transaction after we go to the second level on chain. + */ + TAPROOT_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 27; + + /* + A witness that allows us to sweep an HTLC on the revoked transaction of the + remote party that goes to the second level. + */ + TAPROOT_HTLC_SECOND_LEVEL_REVOKE = 28; + + /* + A witness that allows us to sweep an HTLC sent to us by the remote party + in the event that they broadcast a revoked state. + */ + TAPROOT_HTLC_ACCEPTED_REVOKE = 29; + + /* + A witness that allows us to sweep an HTLC we offered to the remote party if + they broadcast a revoked commitment. + */ + TAPROOT_HTLC_OFFERED_REVOKE = 30; + + /* + A witness that allows us to sweep an HTLC we offered to the remote party + that lies on the commitment transaction for the remote party. We can spend + this output after the absolute CLTV timeout of the HTLC as passed. + */ + TAPROOT_HTLC_OFFERED_REMOTE_TIMEOUT = 31; + + /* + A witness type that allows us to sign the second level HTLC timeout + transaction when spending from an HTLC residing on our local commitment + transaction. + This is used by the sweeper to re-sign inputs if it needs to aggregate + several second level HTLCs. + */ + TAPROOT_HTLC_LOCAL_OFFERED_TIMEOUT = 32; + + /* + A witness that allows us to sweep an HTLC that was offered to us by the + remote party for a taproot channels. We use this witness in the case that + the remote party goes to chain, and we know the pre-image to the HTLC. We + can sweep this without any additional timeout. + */ + TAPROOT_HTLC_ACCEPTED_REMOTE_SUCCESS = 33; + + /* + A witness type that allows us to sweep the HTLC offered to us on our local + commitment transaction. We'll use this when we need to go on chain to sweep + the HTLC. In this case, this is the second level HTLC success transaction. + */ + TAPROOT_HTLC_ACCEPTED_LOCAL_SUCCESS = 34; + + /* + A witness that allows us to sweep the settled output of a malicious + counterparty's who broadcasts a revoked taproot commitment transaction. + */ + TAPROOT_COMMITMENT_REVOKE = 35; +} + +message PendingSweep { + // The outpoint of the output we're attempting to sweep. + lnrpc.OutPoint outpoint = 1; + + // The witness type of the output we're attempting to sweep. + WitnessType witness_type = 2; + + // The value of the output we're attempting to sweep. + uint32 amount_sat = 3; + + /* + Deprecated, use sat_per_vbyte. + The fee rate we'll use to sweep the output, expressed in sat/vbyte. The fee + rate is only determined once a sweeping transaction for the output is + created, so it's possible for this to be 0 before this. + */ + uint32 sat_per_byte = 4 [deprecated = true]; + + // The number of broadcast attempts we've made to sweep the output. + uint32 broadcast_attempts = 5; + + /* + Deprecated. + The next height of the chain at which we'll attempt to broadcast the + sweep transaction of the output. + */ + uint32 next_broadcast_height = 6 [deprecated = true]; + + /* + Deprecated, use immediate. + Whether this input must be force-swept. This means that it is swept + immediately. + */ + bool force = 7 [deprecated = true]; + + /* + Deprecated, use deadline. + The requested confirmation target for this output, which is the deadline + used by the sweeper. + */ + uint32 requested_conf_target = 8 [deprecated = true]; + + // Deprecated, use requested_sat_per_vbyte. + // The requested fee rate, expressed in sat/vbyte, for this output. + uint32 requested_sat_per_byte = 9 [deprecated = true]; + + /* + The current fee rate we'll use to sweep the output, expressed in sat/vbyte. + The fee rate is only determined once a sweeping transaction for the output + is created, so it's possible for this to be 0 before this. + */ + uint64 sat_per_vbyte = 10; + + // The requested starting fee rate, expressed in sat/vbyte, for this + // output. When not requested, this field will be 0. + uint64 requested_sat_per_vbyte = 11; + + /* + Whether this input will be swept immediately. + */ + bool immediate = 12; + + /* + The budget for this sweep, expressed in satoshis. This is the maximum amount + that can be spent as fees to sweep this output. + */ + uint64 budget = 13; + + /* + The deadline height used for this output when perform fee bumping. + */ + uint32 deadline_height = 14; +} + +message PendingSweepsRequest { +} + +message PendingSweepsResponse { + /* + The set of outputs currently being swept by lnd's central batching engine. + */ + repeated PendingSweep pending_sweeps = 1; +} + +message BumpFeeRequest { + // The input we're attempting to bump the fee of. + lnrpc.OutPoint outpoint = 1; + + // Optional. The deadline in number of blocks that the input should be spent + // within. When not set, for new inputs, the default value (1008) is used; + // for existing inputs, their current values will be retained. + uint32 target_conf = 2; + + /* + Deprecated, use sat_per_vbyte. + The fee rate, expressed in sat/vbyte, that should be used to spend the input + with. + */ + uint32 sat_per_byte = 3 [deprecated = true]; + + /* + Deprecated, use immediate. + Whether this input must be force-swept. This means that it is swept + immediately. + */ + bool force = 4 [deprecated = true]; + + /* + Optional. The starting fee rate, expressed in sat/vbyte, that will be used + to spend the input with initially. This value will be used by the sweeper's + fee function as its starting fee rate. When not set, the sweeper will use + the estimated fee rate using the `target_conf` as the starting fee rate. + */ + uint64 sat_per_vbyte = 5; + + /* + Optional. Whether this input will be swept immediately. When set to true, + the sweeper will sweep this input without waiting for the next batch. + */ + bool immediate = 6; + + /* + Optional. The max amount in sats that can be used as the fees. Setting this + value greater than the input's value may result in CPFP - one or more wallet + utxos will be used to pay the fees specified by the budget. If not set, for + new inputs, by default 50% of the input's value will be treated as the + budget for fee bumping; for existing inputs, their current budgets will be + retained. + */ + uint64 budget = 7; +} + +message BumpFeeResponse { + // The status of the bump fee operation. + string status = 1; +} + +message BumpForceCloseFeeRequest { + // The channel point which force close transaction we are attempting to + // bump the fee rate for. + lnrpc.ChannelPoint chan_point = 1; + + // Optional. The deadline delta in number of blocks that the anchor output + // should be spent within to bump the closing transaction. + uint32 deadline_delta = 2; + + /* + Optional. The starting fee rate, expressed in sat/vbyte. This value will be + used by the sweeper's fee function as its starting fee rate. When not set, + the sweeper will use the estimated fee rate using the target_conf as the + starting fee rate. + */ + uint64 starting_feerate = 3; + + /* + Optional. Whether this cpfp transaction will be triggered immediately. When + set to true, the sweeper will consider all currently registered sweeps and + trigger new batch transactions including the sweeping of the anchor output + related to the selected force close transaction. + */ + bool immediate = 4; + + /* + Optional. The max amount in sats that can be used as the fees. For already + registered anchor outputs if not set explicitly the old value will be used. + For channel force closes which have no HTLCs in their commitment transaction + this value has to be set to an appropriate amount to pay for the cpfp + transaction of the force closed channel otherwise the fee bumping will fail. + */ + uint64 budget = 5; +} + +message BumpForceCloseFeeResponse { + // The status of the force close fee bump operation. + string status = 1; +} + +message ListSweepsRequest { + /* + Retrieve the full sweep transaction details. If false, only the sweep txids + will be returned. Note that some sweeps that LND publishes will have been + replaced-by-fee, so will not be included in this output. + */ + bool verbose = 1; + + /* + The start height to use when fetching sweeps. If not specified (0), the + result will start from the earliest sweep. If set to -1 the result will + only include unconfirmed sweeps (at the time of the call). + */ + int32 start_height = 2; +} + +message ListSweepsResponse { + message TransactionIDs { + /* + Reversed, hex-encoded string representing the transaction ids of the + sweeps that our node has broadcast. Note that these transactions may + not have confirmed yet, we record sweeps on broadcast, not confirmation. + */ + repeated string transaction_ids = 1; + } + + oneof sweeps { + lnrpc.TransactionDetails transaction_details = 1; + TransactionIDs transaction_ids = 2; + } +} + +message LabelTransactionRequest { + // The txid of the transaction to label. Note: When using gRPC, the bytes + // must be in little-endian (reverse) order. + bytes txid = 1; + + // The label to add to the transaction, limited to 500 characters. + string label = 2; + + // Whether to overwrite the existing label, if it is present. + bool overwrite = 3; +} + +message LabelTransactionResponse { + // The status of the label operation. + string status = 1; +} + +// The possible change address types for default accounts and single imported +// public keys. By default, P2WPKH will be used. We don't provide the +// possibility to choose P2PKH as it is a legacy key scope, nor NP2WPKH as +// no key scope permits to do so. For custom accounts, no change type should +// be provided as the coin selection key scope will always be used to generate +// the change address. +enum ChangeAddressType { + // CHANGE_ADDRESS_TYPE_UNSPECIFIED indicates that no change address type is + // provided. We will then use P2WPKH address type for change (BIP0084 key + // scope). + CHANGE_ADDRESS_TYPE_UNSPECIFIED = 0; + + // CHANGE_ADDRESS_TYPE_P2TR indicates to use P2TR address for change output + // (BIP0086 key scope). + CHANGE_ADDRESS_TYPE_P2TR = 1; +} + +message FundPsbtRequest { + oneof template { + /* + Use an existing PSBT packet as the template for the funded PSBT. + + The packet must contain at least one non-dust output. If one or more + inputs are specified, no coin selection is performed. In that case every + input must be an UTXO known to the wallet that has not been locked + before. The sum of all inputs must be sufficiently greater than the sum + of all outputs to pay a miner fee with the specified fee rate. A change + output is added to the PSBT if necessary. + */ + bytes psbt = 1; + + /* + Use the outputs and optional inputs from this raw template. + */ + TxTemplate raw = 2; + + /* + Use an existing PSBT packet as the template for the funded PSBT. + + The difference to the pure PSBT template above is that coin selection is + performed even if inputs are specified. The output amounts are summed up + and used as the target amount for coin selection. A change output must + either already exist in the PSBT and be marked as such, otherwise a new + change output of the specified output type will be added. Any inputs + already specified in the PSBT must already be locked (if they belong to + this node), only newly added inputs will be locked by this RPC. + + In case the sum of the already provided inputs exceeds the required + output amount, no new coins are selected. Instead only the fee and + change amount calculation is performed (e.g. a change output is added if + requested or the change is added to the specified existing change + output, given there is any non-dust change). This can be identified by + the returned locked UTXOs being empty. + */ + PsbtCoinSelect coin_select = 9; + } + + oneof fees { + /* + The target number of blocks that the transaction should be confirmed in. + */ + uint32 target_conf = 3; + + /* + The fee rate, expressed in sat/vbyte, that should be used to spend the + input with. + */ + uint64 sat_per_vbyte = 4; + + /* + The fee rate, expressed in sat/kWU, that should be used to spend the + input with. + */ + uint64 sat_per_kw = 11; + } + + /* + The name of the account to fund the PSBT with. If empty, the default wallet + account is used. + */ + string account = 5; + + // The minimum number of confirmations each one of your outputs used for + // the transaction must satisfy. + int32 min_confs = 6; + + // Whether unconfirmed outputs should be used as inputs for the transaction. + bool spend_unconfirmed = 7; + + // The address type for the change. If empty, P2WPKH addresses will be used + // for default accounts and single imported public keys. For custom + // accounts, no change type should be provided as the coin selection key + // scope will always be used to generate the change address. + ChangeAddressType change_type = 8; + + // The strategy to use for selecting coins during funding the PSBT. + lnrpc.CoinSelectionStrategy coin_selection_strategy = 10; + + // The max fee to total output amount ratio that this psbt should adhere to. + double max_fee_ratio = 12; +} +message FundPsbtResponse { + /* + The funded but not yet signed PSBT packet. + */ + bytes funded_psbt = 1; + + /* + The index of the added change output or -1 if no change was left over. + */ + int32 change_output_index = 2; + + /* + The list of lock leases that were acquired for the inputs in the funded PSBT + packet. Only inputs added to the PSBT by this RPC are locked, inputs that + were already present in the PSBT are not locked. + */ + repeated UtxoLease locked_utxos = 3; +} + +message TxTemplate { + /* + An optional list of inputs to use. Every input must be an UTXO known to the + wallet that has not been locked before. The sum of all inputs must be + sufficiently greater than the sum of all outputs to pay a miner fee with the + fee rate specified in the parent message. + + If no inputs are specified, coin selection will be performed instead and + inputs of sufficient value will be added to the resulting PSBT. + */ + repeated lnrpc.OutPoint inputs = 1; + + /* + A map of all addresses and the amounts to send to in the funded PSBT. + */ + map outputs = 2; +} + +message PsbtCoinSelect { + /* + The template to use for the funded PSBT. The template must contain at least + one non-dust output. The amount to be funded is calculated by summing up the + amounts of all outputs in the template, subtracting all the input values of + the already specified inputs. The change value is added to the output that + is marked as such (or a new change output is added if none is marked). For + the input amount calculation to be correct, the template must have the + WitnessUtxo field set for all inputs. Any inputs already specified in the + PSBT must already be locked (if they belong to this node), only newly added + inputs will be locked by this RPC. + */ + bytes psbt = 1; + + oneof change_output { + /* + Use the existing output within the template PSBT with the specified + index as the change output. Any leftover change will be added to the + already specified amount of that output. To add a new change output to + the PSBT, set the "add" field below instead. The type of change output + added is defined by change_type in the parent message. + */ + int32 existing_output_index = 2; + + /* + Add a new change output to the PSBT using the change_type specified in + the parent message. + */ + bool add = 3; + } +} + +message UtxoLease { + /* + A 32 byte random ID that identifies the lease. + */ + bytes id = 1; + + // The identifying outpoint of the output being leased. + lnrpc.OutPoint outpoint = 2; + + /* + The absolute expiration of the output lease represented as a unix timestamp. + */ + uint64 expiration = 3; + + /* + The public key script of the leased output. + */ + bytes pk_script = 4; + + /* + The value of the leased output in satoshis. + */ + uint64 value = 5; +} + +message SignPsbtRequest { + /* + The PSBT that should be signed. The PSBT must contain all required inputs, + outputs, UTXO data and custom fields required to identify the signing key. + */ + bytes funded_psbt = 1; +} + +message SignPsbtResponse { + // The signed transaction in PSBT format. + bytes signed_psbt = 1; + + // The indices of signed inputs. + repeated uint32 signed_inputs = 2; +} + +message FinalizePsbtRequest { + /* + A PSBT that should be signed and finalized. The PSBT must contain all + required inputs, outputs, UTXO data and partial signatures of all other + signers. + */ + bytes funded_psbt = 1; + + /* + The name of the account to finalize the PSBT with. If empty, the default + wallet account is used. + */ + string account = 5; +} +message FinalizePsbtResponse { + // The fully signed and finalized transaction in PSBT format. + bytes signed_psbt = 1; + + // The fully signed and finalized transaction in the raw wire format. + bytes raw_final_tx = 2; +} + +message ListLeasesRequest { +} + +message ListLeasesResponse { + // The list of currently leased utxos. + repeated UtxoLease locked_utxos = 1; +} \ No newline at end of file diff --git a/proto/service/structs.proto b/proto/service/structs.proto index 9bc561d6..79e43b44 100644 --- a/proto/service/structs.proto +++ b/proto/service/structs.proto @@ -119,12 +119,23 @@ message ClosedChannel { string channel_id = 1; int64 capacity = 2; int64 closed_height =4; + int64 close_tx_timestamp = 5; } message GraphPoint { int64 x = 1; int64 y = 2; } +enum OperationType { + CHAIN_OP = 0; + INVOICE_OP = 1; +} +message RootOperation { + OperationType op_type = 1; + string op_id = 2; + int64 amount = 3; + int64 created_at_unix = 4; +} message LndNodeMetrics { repeated GraphPoint chain_balance = 1; @@ -138,6 +149,7 @@ message LndNodeMetrics { repeated ClosedChannel closed_channels = 9; int64 forwarding_events = 11; int64 forwarding_fees = 12; + repeated RootOperation root_ops = 13; } message LndMetrics { diff --git a/src/services/lnd/lnd.ts b/src/services/lnd/lnd.ts index 05aa2aed..3df13920 100644 --- a/src/services/lnd/lnd.ts +++ b/src/services/lnd/lnd.ts @@ -19,6 +19,7 @@ import { HtlcEvent_EventType } from '../../../proto/lnd/router.js'; import { LiquidityProvider, LiquidityRequest } from '../main/liquidityProvider.js'; import { Utils } from '../helpers/utilsWrapper.js'; import { TxPointSettings } from '../storage/stateBundler.js'; +import { WalletKitClient } from '../../../proto/lnd/walletkit.client.js'; const DeadLineMetadata = (deadline = 10 * 1000) => ({ deadline: Date.now() + deadline }) const deadLndRetrySeconds = 5 type TxActionOptions = { useProvider: boolean, from: 'user' | 'system' } @@ -27,6 +28,7 @@ export default class { invoices: InvoicesClient router: RouterClient chainNotifier: ChainNotifierClient + walletKit: WalletKitClient settings: LndSettings ready = false latestKnownBlockHeigh = 0 @@ -67,6 +69,7 @@ export default class { this.invoices = new InvoicesClient(transport) this.router = new RouterClient(transport) this.chainNotifier = new ChainNotifierClient(transport) + this.walletKit = new WalletKitClient(transport) this.liquidProvider = liquidProvider } @@ -507,6 +510,11 @@ export default class { } + async GetTx(txid: string) { + const res = await this.walletKit.getTransaction({ txid }, DeadLineMetadata()) + return res.response + } + async AddPeer(pub: string, host: string, port: number) { const res = await this.lightning.connectPeer({ addr: { diff --git a/src/services/main/index.ts b/src/services/main/index.ts index 368c378d..bd9de9b9 100644 --- a/src/services/main/index.ts +++ b/src/services/main/index.ts @@ -148,7 +148,10 @@ export default class { return this.storage.StartTransaction(async tx => { const { blockHeight } = await this.lnd.GetInfo() const userAddress = await this.storage.paymentStorage.GetAddressOwner(address, tx) - if (!userAddress) { return } + if (!userAddress) { + await this.metricsManager.AddRootAddressPaid(address, txOutput, amount) + return + } const internal = used === 'internal' let log = getLogger({}) if (!userAddress.linkedApplication) { @@ -188,7 +191,10 @@ export default class { return this.storage.StartTransaction(async tx => { let log = getLogger({}) const userInvoice = await this.storage.paymentStorage.GetInvoiceOwner(paymentRequest, tx) - if (!userInvoice) { return } + if (!userInvoice) { + await this.metricsManager.AddRootInvoicePaid(paymentRequest, amount) + return + } const internal = used === 'internal' if (userInvoice.paid_at_unix > 0 && internal) { log("cannot pay internally, invoice already paid"); return } if (userInvoice.paid_at_unix > 0 && !internal && userInvoice.paidByLnd) { log("invoice already paid by lnd"); return } diff --git a/src/services/metrics/index.ts b/src/services/metrics/index.ts index 8995a1da..84b8a355 100644 --- a/src/services/metrics/index.ts +++ b/src/services/metrics/index.ts @@ -9,6 +9,8 @@ import LND from '../lnd/lnd.js' import HtlcTracker from './htlcTracker.js' const maxEvents = 100_000 export default class Handler { + + storage: Storage lnd: LND htlcTracker: HtlcTracker @@ -215,10 +217,17 @@ export default class Handler { async GetLndMetrics(req: Types.LndMetricsRequest): Promise { - const { openChannels, totalActive, totalInactive } = await this.GetChannelsInfo() - const { totalPendingOpen, totalPendingClose } = await this.GetPendingChannelsInfo() - const { channels: closedChannels } = await this.lnd.ListClosedChannels() - const rawRouting = await this.storage.metricsStorage.GetChannelRouting({ from: req.from_unix, to: req.to_unix }) + const [chansInfo, pendingChansInfo, closedChansInfo, routing, rootOps] = await Promise.all([ + this.GetChannelsInfo(), + this.GetPendingChannelsInfo(), + this.lnd.ListClosedChannels(), + this.storage.metricsStorage.GetChannelRouting({ from: req.from_unix, to: req.to_unix }), + this.storage.metricsStorage.GetRootOperations({ from: req.from_unix, to: req.to_unix }) + ]) + const { openChannels, totalActive, totalInactive } = chansInfo + const { totalPendingOpen, totalPendingClose } = pendingChansInfo + const { channels: closedChannels } = closedChansInfo + const rawRouting = routing let totalEvents = 0 let totalFees = 0 rawRouting.forEach(r => { @@ -242,7 +251,10 @@ export default class Handler { externalBalance.push({ x: e.block_height, y: e.external_balance }) } }) - + const closed = await Promise.all(closedChannels.map(async c => { + const tx = await this.lnd.GetTx(c.closingTxHash) + return { capacity: Number(c.capacity), channel_id: c.chanId, closed_height: c.closeHeight, close_tx_timestamp: Number(tx.timeStamp) } + })) return { nodes: [{ chain_balance: chainBalance, @@ -252,11 +264,28 @@ export default class Handler { pending_channels: totalPendingOpen, offline_channels: totalInactive, online_channels: totalActive, - closed_channels: closedChannels.map(c => ({ capacity: Number(c.capacity), channel_id: c.chanId, closed_height: c.closeHeight })), + closed_channels: closed, open_channels: openChannels.map(c => ({ channel_point: c.channelPoint, active: c.active, capacity: Number(c.capacity), channel_id: c.chanId, lifetime: Number(c.lifetime), local_balance: Number(c.localBalance), remote_balance: Number(c.remoteBalance), label: c.peerAlias })), forwarding_events: totalEvents, - forwarding_fees: totalFees + forwarding_fees: totalFees, + root_ops: rootOps.map(r => ({ amount: r.operation_amount, created_at_unix: r.created_at.getTime(), op_id: r.operation_identifier, op_type: mapRootOpType(r.operation_type) })), }], } } + + async AddRootAddressPaid(address: string, txOutput: { hash: string; index: number }, amount: number) { + await this.storage.metricsStorage.AddRootOperation("chain", `${address}:${txOutput.hash}:${txOutput.index}`, amount) + } + + async AddRootInvoicePaid(paymentRequest: string, amount: number) { + await this.storage.metricsStorage.AddRootOperation("invoice", paymentRequest, amount) + } +} + +const mapRootOpType = (opType: string): Types.OperationType => { + switch (opType) { + case "chain": return Types.OperationType.CHAIN_OP + case "invoice": return Types.OperationType.INVOICE_OP + default: throw new Error("Unknown operation type") + } } \ No newline at end of file diff --git a/src/services/storage/entity/RootOperation.ts b/src/services/storage/entity/RootOperation.ts new file mode 100644 index 00000000..96e54186 --- /dev/null +++ b/src/services/storage/entity/RootOperation.ts @@ -0,0 +1,22 @@ +import { Entity, PrimaryGeneratedColumn, Column, Index, Check, CreateDateColumn, UpdateDateColumn } from "typeorm" + +@Entity() +export class RootOperation { + @PrimaryGeneratedColumn() + serial_id: number + + @Column() + operation_type: string + + @Column() + operation_amount: number + + @Column() + operation_identifier: string + + @CreateDateColumn() + created_at: Date + + @UpdateDateColumn() + updated_at: Date +} diff --git a/src/services/storage/metricsStorage.ts b/src/services/storage/metricsStorage.ts index a08f314f..16e6e72d 100644 --- a/src/services/storage/metricsStorage.ts +++ b/src/services/storage/metricsStorage.ts @@ -5,8 +5,10 @@ import TransactionsQueue, { TX } from "./transactionsQueue.js"; import { StorageSettings } from "./index.js"; import { newMetricsDb } from "./db.js"; import { ChannelRouting } from "./entity/ChannelRouting.js"; +import { RootOperation } from "./entity/RootOperation.js"; export default class { + DB: DataSource | EntityManager settings: StorageSettings txQueue: TransactionsQueue @@ -98,6 +100,16 @@ export default class { await repo.update(existing.serial_id, { latest_index_offset: event.latest_index_offset }) } } + + async AddRootOperation(opType: string, id: string, amount: number, entityManager = this.DB) { + const newOp = entityManager.getRepository(RootOperation).create({ operation_type: opType, operation_amount: amount, operation_identifier: id }) + return this.txQueue.PushToQueue({ exec: async db => db.getRepository(RootOperation).save(newOp), dbTx: false }) + } + + async GetRootOperations({ from, to }: { from?: number, to?: number }, entityManager = this.DB) { + const q = getTimeQuery({ from, to }) + return entityManager.getRepository(RootOperation).find(q) + } } const getTimeQuery = ({ from, to }: { from?: number, to?: number }): FindManyOptions<{ created_at: Date }> => {