Some checks are pending
Docker Compose Actions Workflow / test (push) Waiting to run
## Summary - Adds a modular extension system for Lightning.Pub enabling third-party plugins - Provides isolated SQLite databases per extension for data safety - Implements ExtensionContext API for accessing Lightning.Pub services (payments, Nostr, storage) - Supports RPC method registration with automatic namespacing - Includes HTTP route handling for protocols like LNURL - Event routing for payment receipts and Nostr events - Comprehensive documentation with architecture overview and working examples ## Key Components - `src/extensions/types.ts` - Core extension interfaces - `src/extensions/loader.ts` - Extension discovery, loading, and lifecycle management - `src/extensions/context.ts` - Bridge between extensions and Lightning.Pub services - `src/extensions/database.ts` - SQLite isolation with WAL mode - `src/extensions/README.md` - Full documentation with examples ## ExtensionContext API | Method | Description | |--------|-------------| | `getApplication()` | Get application info | | `createInvoice()` | Create Lightning invoice | | `payInvoice()` | Pay Lightning invoice | | `getLnurlPayInfo()` | Get LNURL-pay info for a user (enables Lightning Address/zaps) | | `sendEncryptedDM()` | Send Nostr DM (NIP-44) | | `publishNostrEvent()` | Publish Nostr event | | `registerMethod()` | Register RPC method | | `onPaymentReceived()` | Subscribe to payment callbacks | | `onNostrEvent()` | Subscribe to Nostr events | ## Test plan - [x] Review extension loader code for correctness - [x] Verify TypeScript compilation succeeds - [x] Test extension discovery from `src/extensions/` directory - [x] Test RPC method registration and routing - [x] Test database isolation between extensions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: boufni95 <boufni95@gmail.com> Co-authored-by: Patrick Mulligan <patjmulligan@protonmail.com> Reviewed-on: #3
1037 lines
45 KiB
TypeScript
1037 lines
45 KiB
TypeScript
// @generated by protobuf-ts 2.11.1
|
|
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", 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 { MessageType } from "@protobuf-ts/runtime";
|
|
import { Invoice } from "./lightning.js";
|
|
import { RouteHint } from "./lightning.js";
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.CancelInvoiceMsg
|
|
*/
|
|
export interface CancelInvoiceMsg {
|
|
/**
|
|
* Hash corresponding to the (hold) invoice to cancel. When using
|
|
* REST, this field must be encoded as base64.
|
|
*
|
|
* @generated from protobuf field: bytes payment_hash = 1
|
|
*/
|
|
paymentHash: Uint8Array;
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.CancelInvoiceResp
|
|
*/
|
|
export interface CancelInvoiceResp {
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.AddHoldInvoiceRequest
|
|
*/
|
|
export interface AddHoldInvoiceRequest {
|
|
/**
|
|
*
|
|
* An optional memo to attach along with the invoice. Used for record keeping
|
|
* purposes for the invoice's creator, and will also be set in the description
|
|
* field of the encoded payment request if the description_hash field is not
|
|
* being used.
|
|
*
|
|
* @generated from protobuf field: string memo = 1
|
|
*/
|
|
memo: string;
|
|
/**
|
|
* The hash of the preimage
|
|
*
|
|
* @generated from protobuf field: bytes hash = 2
|
|
*/
|
|
hash: Uint8Array;
|
|
/**
|
|
*
|
|
* The value of this invoice in satoshis
|
|
*
|
|
* The fields value and value_msat are mutually exclusive.
|
|
*
|
|
* @generated from protobuf field: int64 value = 3
|
|
*/
|
|
value: bigint;
|
|
/**
|
|
*
|
|
* The value of this invoice in millisatoshis
|
|
*
|
|
* The fields value and value_msat are mutually exclusive.
|
|
*
|
|
* @generated from protobuf field: int64 value_msat = 10
|
|
*/
|
|
valueMsat: bigint;
|
|
/**
|
|
*
|
|
* Hash (SHA-256) of a description of the payment. Used if the description of
|
|
* payment (memo) is too long to naturally fit within the description field
|
|
* of an encoded payment request.
|
|
*
|
|
* @generated from protobuf field: bytes description_hash = 4
|
|
*/
|
|
descriptionHash: Uint8Array;
|
|
/**
|
|
* Payment request expiry time in seconds. Default is 86400 (24 hours).
|
|
*
|
|
* @generated from protobuf field: int64 expiry = 5
|
|
*/
|
|
expiry: bigint;
|
|
/**
|
|
* Fallback on-chain address.
|
|
*
|
|
* @generated from protobuf field: string fallback_addr = 6
|
|
*/
|
|
fallbackAddr: string;
|
|
/**
|
|
* Delta to use for the time-lock of the CLTV extended to the final hop.
|
|
*
|
|
* @generated from protobuf field: uint64 cltv_expiry = 7
|
|
*/
|
|
cltvExpiry: bigint;
|
|
/**
|
|
*
|
|
* Route hints that can each be individually used to assist in reaching the
|
|
* invoice's destination.
|
|
*
|
|
* @generated from protobuf field: repeated lnrpc.RouteHint route_hints = 8
|
|
*/
|
|
routeHints: RouteHint[];
|
|
/**
|
|
* Whether this invoice should include routing hints for private channels.
|
|
*
|
|
* @generated from protobuf field: bool private = 9
|
|
*/
|
|
private: boolean;
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.AddHoldInvoiceResp
|
|
*/
|
|
export interface AddHoldInvoiceResp {
|
|
/**
|
|
*
|
|
* A bare-bones invoice for a payment within the Lightning Network. With the
|
|
* details of the invoice, the sender has all the data necessary to send a
|
|
* payment to the recipient.
|
|
*
|
|
* @generated from protobuf field: string payment_request = 1
|
|
*/
|
|
paymentRequest: string;
|
|
/**
|
|
*
|
|
* The "add" index of this invoice. Each newly created invoice will increment
|
|
* this index making it monotonically increasing. Callers to the
|
|
* SubscribeInvoices call can use this to instantly get notified of all added
|
|
* invoices with an add_index greater than this one.
|
|
*
|
|
* @generated from protobuf field: uint64 add_index = 2
|
|
*/
|
|
addIndex: bigint;
|
|
/**
|
|
*
|
|
* The payment address of the generated invoice. This is also called
|
|
* the payment secret in specifications (e.g. BOLT 11). This value should
|
|
* be used in all payments for this invoice as we require it for end to end
|
|
* security.
|
|
*
|
|
* @generated from protobuf field: bytes payment_addr = 3
|
|
*/
|
|
paymentAddr: Uint8Array;
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.SettleInvoiceMsg
|
|
*/
|
|
export interface SettleInvoiceMsg {
|
|
/**
|
|
* Externally discovered pre-image that should be used to settle the hold
|
|
* invoice.
|
|
*
|
|
* @generated from protobuf field: bytes preimage = 1
|
|
*/
|
|
preimage: Uint8Array;
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.SettleInvoiceResp
|
|
*/
|
|
export interface SettleInvoiceResp {
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
|
|
*/
|
|
export interface SubscribeSingleInvoiceRequest {
|
|
/**
|
|
* Hash corresponding to the (hold) invoice to subscribe to. When using
|
|
* REST, this field must be encoded as base64url.
|
|
*
|
|
* @generated from protobuf field: bytes r_hash = 2
|
|
*/
|
|
rHash: Uint8Array;
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.LookupInvoiceMsg
|
|
*/
|
|
export interface LookupInvoiceMsg {
|
|
/**
|
|
* @generated from protobuf oneof: invoice_ref
|
|
*/
|
|
invoiceRef: {
|
|
oneofKind: "paymentHash";
|
|
/**
|
|
* When using REST, this field must be encoded as base64.
|
|
*
|
|
* @generated from protobuf field: bytes payment_hash = 1
|
|
*/
|
|
paymentHash: Uint8Array;
|
|
} | {
|
|
oneofKind: "paymentAddr";
|
|
/**
|
|
* @generated from protobuf field: bytes payment_addr = 2
|
|
*/
|
|
paymentAddr: Uint8Array;
|
|
} | {
|
|
oneofKind: "setId";
|
|
/**
|
|
* @generated from protobuf field: bytes set_id = 3
|
|
*/
|
|
setId: Uint8Array;
|
|
} | {
|
|
oneofKind: undefined;
|
|
};
|
|
/**
|
|
* @generated from protobuf field: invoicesrpc.LookupModifier lookup_modifier = 4
|
|
*/
|
|
lookupModifier: LookupModifier;
|
|
}
|
|
/**
|
|
* CircuitKey is a unique identifier for an HTLC.
|
|
*
|
|
* @generated from protobuf message invoicesrpc.CircuitKey
|
|
*/
|
|
export interface CircuitKey {
|
|
/**
|
|
* The id of the channel that the is part of this circuit.
|
|
*
|
|
* @generated from protobuf field: uint64 chan_id = 1
|
|
*/
|
|
chanId: bigint;
|
|
/**
|
|
* The index of the incoming htlc in the incoming channel.
|
|
*
|
|
* @generated from protobuf field: uint64 htlc_id = 2
|
|
*/
|
|
htlcId: bigint;
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.HtlcModifyRequest
|
|
*/
|
|
export interface HtlcModifyRequest {
|
|
/**
|
|
* The invoice the intercepted HTLC is attempting to settle. The HTLCs in
|
|
* the invoice are only HTLCs that have already been accepted or settled,
|
|
* not including the current intercepted HTLC.
|
|
*
|
|
* @generated from protobuf field: lnrpc.Invoice invoice = 1
|
|
*/
|
|
invoice?: Invoice;
|
|
/**
|
|
* The unique identifier of the HTLC of this intercepted HTLC.
|
|
*
|
|
* @generated from protobuf field: invoicesrpc.CircuitKey exit_htlc_circuit_key = 2
|
|
*/
|
|
exitHtlcCircuitKey?: CircuitKey;
|
|
/**
|
|
* The amount in milli-satoshi that the exit HTLC is attempting to pay.
|
|
*
|
|
* @generated from protobuf field: uint64 exit_htlc_amt = 3
|
|
*/
|
|
exitHtlcAmt: bigint;
|
|
/**
|
|
* The absolute expiry height of the exit HTLC.
|
|
*
|
|
* @generated from protobuf field: uint32 exit_htlc_expiry = 4
|
|
*/
|
|
exitHtlcExpiry: number;
|
|
/**
|
|
* The current block height.
|
|
*
|
|
* @generated from protobuf field: uint32 current_height = 5
|
|
*/
|
|
currentHeight: number;
|
|
/**
|
|
* The wire message custom records of the exit HTLC.
|
|
*
|
|
* @generated from protobuf field: map<uint64, bytes> exit_htlc_wire_custom_records = 6
|
|
*/
|
|
exitHtlcWireCustomRecords: {
|
|
[key: string]: Uint8Array;
|
|
};
|
|
}
|
|
/**
|
|
* @generated from protobuf message invoicesrpc.HtlcModifyResponse
|
|
*/
|
|
export interface HtlcModifyResponse {
|
|
/**
|
|
* The circuit key of the HTLC that the client wants to modify.
|
|
*
|
|
* @generated from protobuf field: invoicesrpc.CircuitKey circuit_key = 1
|
|
*/
|
|
circuitKey?: CircuitKey;
|
|
/**
|
|
* The modified amount in milli-satoshi that the exit HTLC is paying. This
|
|
* value can be different from the actual on-chain HTLC amount, in case the
|
|
* HTLC carries other valuable items, as can be the case with custom channel
|
|
* types.
|
|
*
|
|
* @generated from protobuf field: optional uint64 amt_paid = 2
|
|
*/
|
|
amtPaid?: bigint;
|
|
/**
|
|
* This flag indicates whether the HTLCs associated with the invoices should
|
|
* be cancelled. The interceptor client may set this field if some
|
|
* unexpected behavior is encountered. Setting this will ignore the amt_paid
|
|
* field.
|
|
*
|
|
* @generated from protobuf field: bool cancel_set = 3
|
|
*/
|
|
cancelSet: boolean;
|
|
}
|
|
/**
|
|
* @generated from protobuf enum invoicesrpc.LookupModifier
|
|
*/
|
|
export enum LookupModifier {
|
|
/**
|
|
* The default look up modifier, no look up behavior is changed.
|
|
*
|
|
* @generated from protobuf enum value: DEFAULT = 0;
|
|
*/
|
|
DEFAULT = 0,
|
|
/**
|
|
*
|
|
* Indicates that when a look up is done based on a set_id, then only that set
|
|
* of HTLCs related to that set ID should be returned.
|
|
*
|
|
* @generated from protobuf enum value: HTLC_SET_ONLY = 1;
|
|
*/
|
|
HTLC_SET_ONLY = 1,
|
|
/**
|
|
*
|
|
* Indicates that when a look up is done using a payment_addr, then no HTLCs
|
|
* related to the payment_addr should be returned. This is useful when one
|
|
* wants to be able to obtain the set of associated setIDs with a given
|
|
* invoice, then look up the sub-invoices "projected" by that set ID.
|
|
*
|
|
* @generated from protobuf enum value: HTLC_SET_BLANK = 2;
|
|
*/
|
|
HTLC_SET_BLANK = 2
|
|
}
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class CancelInvoiceMsg$Type extends MessageType<CancelInvoiceMsg> {
|
|
constructor() {
|
|
super("invoicesrpc.CancelInvoiceMsg", [
|
|
{ no: 1, name: "payment_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<CancelInvoiceMsg>): CancelInvoiceMsg {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.paymentHash = new Uint8Array(0);
|
|
if (value !== undefined)
|
|
reflectionMergePartial<CancelInvoiceMsg>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CancelInvoiceMsg): CancelInvoiceMsg {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* bytes payment_hash */ 1:
|
|
message.paymentHash = 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: CancelInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* bytes payment_hash = 1; */
|
|
if (message.paymentHash.length)
|
|
writer.tag(1, WireType.LengthDelimited).bytes(message.paymentHash);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceMsg
|
|
*/
|
|
export const CancelInvoiceMsg = new CancelInvoiceMsg$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class CancelInvoiceResp$Type extends MessageType<CancelInvoiceResp> {
|
|
constructor() {
|
|
super("invoicesrpc.CancelInvoiceResp", []);
|
|
}
|
|
create(value?: PartialMessage<CancelInvoiceResp>): CancelInvoiceResp {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
if (value !== undefined)
|
|
reflectionMergePartial<CancelInvoiceResp>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CancelInvoiceResp): CancelInvoiceResp {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
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: CancelInvoiceResp, 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 invoicesrpc.CancelInvoiceResp
|
|
*/
|
|
export const CancelInvoiceResp = new CancelInvoiceResp$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
|
constructor() {
|
|
super("invoicesrpc.AddHoldInvoiceRequest", [
|
|
{ no: 1, name: "memo", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
{ no: 2, name: "hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
{ no: 3, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 4, name: "description_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 6, name: "fallback_addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 8, name: "route_hints", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => RouteHint },
|
|
{ no: 9, name: "private", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<AddHoldInvoiceRequest>): AddHoldInvoiceRequest {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.memo = "";
|
|
message.hash = new Uint8Array(0);
|
|
message.value = 0n;
|
|
message.valueMsat = 0n;
|
|
message.descriptionHash = new Uint8Array(0);
|
|
message.expiry = 0n;
|
|
message.fallbackAddr = "";
|
|
message.cltvExpiry = 0n;
|
|
message.routeHints = [];
|
|
message.private = false;
|
|
if (value !== undefined)
|
|
reflectionMergePartial<AddHoldInvoiceRequest>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddHoldInvoiceRequest): AddHoldInvoiceRequest {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* string memo */ 1:
|
|
message.memo = reader.string();
|
|
break;
|
|
case /* bytes hash */ 2:
|
|
message.hash = reader.bytes();
|
|
break;
|
|
case /* int64 value */ 3:
|
|
message.value = reader.int64().toBigInt();
|
|
break;
|
|
case /* int64 value_msat */ 10:
|
|
message.valueMsat = reader.int64().toBigInt();
|
|
break;
|
|
case /* bytes description_hash */ 4:
|
|
message.descriptionHash = reader.bytes();
|
|
break;
|
|
case /* int64 expiry */ 5:
|
|
message.expiry = reader.int64().toBigInt();
|
|
break;
|
|
case /* string fallback_addr */ 6:
|
|
message.fallbackAddr = reader.string();
|
|
break;
|
|
case /* uint64 cltv_expiry */ 7:
|
|
message.cltvExpiry = reader.uint64().toBigInt();
|
|
break;
|
|
case /* repeated lnrpc.RouteHint route_hints */ 8:
|
|
message.routeHints.push(RouteHint.internalBinaryRead(reader, reader.uint32(), options));
|
|
break;
|
|
case /* bool private */ 9:
|
|
message.private = 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: AddHoldInvoiceRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* string memo = 1; */
|
|
if (message.memo !== "")
|
|
writer.tag(1, WireType.LengthDelimited).string(message.memo);
|
|
/* bytes hash = 2; */
|
|
if (message.hash.length)
|
|
writer.tag(2, WireType.LengthDelimited).bytes(message.hash);
|
|
/* int64 value = 3; */
|
|
if (message.value !== 0n)
|
|
writer.tag(3, WireType.Varint).int64(message.value);
|
|
/* bytes description_hash = 4; */
|
|
if (message.descriptionHash.length)
|
|
writer.tag(4, WireType.LengthDelimited).bytes(message.descriptionHash);
|
|
/* int64 expiry = 5; */
|
|
if (message.expiry !== 0n)
|
|
writer.tag(5, WireType.Varint).int64(message.expiry);
|
|
/* string fallback_addr = 6; */
|
|
if (message.fallbackAddr !== "")
|
|
writer.tag(6, WireType.LengthDelimited).string(message.fallbackAddr);
|
|
/* uint64 cltv_expiry = 7; */
|
|
if (message.cltvExpiry !== 0n)
|
|
writer.tag(7, WireType.Varint).uint64(message.cltvExpiry);
|
|
/* repeated lnrpc.RouteHint route_hints = 8; */
|
|
for (let i = 0; i < message.routeHints.length; i++)
|
|
RouteHint.internalBinaryWrite(message.routeHints[i], writer.tag(8, WireType.LengthDelimited).fork(), options).join();
|
|
/* bool private = 9; */
|
|
if (message.private !== false)
|
|
writer.tag(9, WireType.Varint).bool(message.private);
|
|
/* int64 value_msat = 10; */
|
|
if (message.valueMsat !== 0n)
|
|
writer.tag(10, WireType.Varint).int64(message.valueMsat);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceRequest
|
|
*/
|
|
export const AddHoldInvoiceRequest = new AddHoldInvoiceRequest$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
|
constructor() {
|
|
super("invoicesrpc.AddHoldInvoiceResp", [
|
|
{ no: 1, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
{ no: 2, name: "add_index", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 3, name: "payment_addr", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<AddHoldInvoiceResp>): AddHoldInvoiceResp {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.paymentRequest = "";
|
|
message.addIndex = 0n;
|
|
message.paymentAddr = new Uint8Array(0);
|
|
if (value !== undefined)
|
|
reflectionMergePartial<AddHoldInvoiceResp>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddHoldInvoiceResp): AddHoldInvoiceResp {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* string payment_request */ 1:
|
|
message.paymentRequest = reader.string();
|
|
break;
|
|
case /* uint64 add_index */ 2:
|
|
message.addIndex = reader.uint64().toBigInt();
|
|
break;
|
|
case /* bytes payment_addr */ 3:
|
|
message.paymentAddr = 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: AddHoldInvoiceResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* string payment_request = 1; */
|
|
if (message.paymentRequest !== "")
|
|
writer.tag(1, WireType.LengthDelimited).string(message.paymentRequest);
|
|
/* uint64 add_index = 2; */
|
|
if (message.addIndex !== 0n)
|
|
writer.tag(2, WireType.Varint).uint64(message.addIndex);
|
|
/* bytes payment_addr = 3; */
|
|
if (message.paymentAddr.length)
|
|
writer.tag(3, WireType.LengthDelimited).bytes(message.paymentAddr);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceResp
|
|
*/
|
|
export const AddHoldInvoiceResp = new AddHoldInvoiceResp$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class SettleInvoiceMsg$Type extends MessageType<SettleInvoiceMsg> {
|
|
constructor() {
|
|
super("invoicesrpc.SettleInvoiceMsg", [
|
|
{ no: 1, name: "preimage", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<SettleInvoiceMsg>): SettleInvoiceMsg {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.preimage = new Uint8Array(0);
|
|
if (value !== undefined)
|
|
reflectionMergePartial<SettleInvoiceMsg>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SettleInvoiceMsg): SettleInvoiceMsg {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* bytes preimage */ 1:
|
|
message.preimage = 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: SettleInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* bytes preimage = 1; */
|
|
if (message.preimage.length)
|
|
writer.tag(1, WireType.LengthDelimited).bytes(message.preimage);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceMsg
|
|
*/
|
|
export const SettleInvoiceMsg = new SettleInvoiceMsg$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class SettleInvoiceResp$Type extends MessageType<SettleInvoiceResp> {
|
|
constructor() {
|
|
super("invoicesrpc.SettleInvoiceResp", []);
|
|
}
|
|
create(value?: PartialMessage<SettleInvoiceResp>): SettleInvoiceResp {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
if (value !== undefined)
|
|
reflectionMergePartial<SettleInvoiceResp>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SettleInvoiceResp): SettleInvoiceResp {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
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: SettleInvoiceResp, 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 invoicesrpc.SettleInvoiceResp
|
|
*/
|
|
export const SettleInvoiceResp = new SettleInvoiceResp$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class SubscribeSingleInvoiceRequest$Type extends MessageType<SubscribeSingleInvoiceRequest> {
|
|
constructor() {
|
|
super("invoicesrpc.SubscribeSingleInvoiceRequest", [
|
|
{ no: 2, name: "r_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<SubscribeSingleInvoiceRequest>): SubscribeSingleInvoiceRequest {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.rHash = new Uint8Array(0);
|
|
if (value !== undefined)
|
|
reflectionMergePartial<SubscribeSingleInvoiceRequest>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SubscribeSingleInvoiceRequest): SubscribeSingleInvoiceRequest {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* bytes r_hash */ 2:
|
|
message.rHash = 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: SubscribeSingleInvoiceRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* bytes r_hash = 2; */
|
|
if (message.rHash.length)
|
|
writer.tag(2, WireType.LengthDelimited).bytes(message.rHash);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
|
|
*/
|
|
export const SubscribeSingleInvoiceRequest = new SubscribeSingleInvoiceRequest$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class LookupInvoiceMsg$Type extends MessageType<LookupInvoiceMsg> {
|
|
constructor() {
|
|
super("invoicesrpc.LookupInvoiceMsg", [
|
|
{ no: 1, name: "payment_hash", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
|
|
{ no: 2, name: "payment_addr", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
|
|
{ no: 3, name: "set_id", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
|
|
{ no: 4, name: "lookup_modifier", kind: "enum", T: () => ["invoicesrpc.LookupModifier", LookupModifier] }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<LookupInvoiceMsg>): LookupInvoiceMsg {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.invoiceRef = { oneofKind: undefined };
|
|
message.lookupModifier = 0;
|
|
if (value !== undefined)
|
|
reflectionMergePartial<LookupInvoiceMsg>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LookupInvoiceMsg): LookupInvoiceMsg {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* bytes payment_hash */ 1:
|
|
message.invoiceRef = {
|
|
oneofKind: "paymentHash",
|
|
paymentHash: reader.bytes()
|
|
};
|
|
break;
|
|
case /* bytes payment_addr */ 2:
|
|
message.invoiceRef = {
|
|
oneofKind: "paymentAddr",
|
|
paymentAddr: reader.bytes()
|
|
};
|
|
break;
|
|
case /* bytes set_id */ 3:
|
|
message.invoiceRef = {
|
|
oneofKind: "setId",
|
|
setId: reader.bytes()
|
|
};
|
|
break;
|
|
case /* invoicesrpc.LookupModifier lookup_modifier */ 4:
|
|
message.lookupModifier = 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: LookupInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* bytes payment_hash = 1; */
|
|
if (message.invoiceRef.oneofKind === "paymentHash")
|
|
writer.tag(1, WireType.LengthDelimited).bytes(message.invoiceRef.paymentHash);
|
|
/* bytes payment_addr = 2; */
|
|
if (message.invoiceRef.oneofKind === "paymentAddr")
|
|
writer.tag(2, WireType.LengthDelimited).bytes(message.invoiceRef.paymentAddr);
|
|
/* bytes set_id = 3; */
|
|
if (message.invoiceRef.oneofKind === "setId")
|
|
writer.tag(3, WireType.LengthDelimited).bytes(message.invoiceRef.setId);
|
|
/* invoicesrpc.LookupModifier lookup_modifier = 4; */
|
|
if (message.lookupModifier !== 0)
|
|
writer.tag(4, WireType.Varint).int32(message.lookupModifier);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.LookupInvoiceMsg
|
|
*/
|
|
export const LookupInvoiceMsg = new LookupInvoiceMsg$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class CircuitKey$Type extends MessageType<CircuitKey> {
|
|
constructor() {
|
|
super("invoicesrpc.CircuitKey", [
|
|
{ no: 1, name: "chan_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 2, name: "htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<CircuitKey>): CircuitKey {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.chanId = 0n;
|
|
message.htlcId = 0n;
|
|
if (value !== undefined)
|
|
reflectionMergePartial<CircuitKey>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CircuitKey): CircuitKey {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* uint64 chan_id */ 1:
|
|
message.chanId = reader.uint64().toBigInt();
|
|
break;
|
|
case /* uint64 htlc_id */ 2:
|
|
message.htlcId = 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: CircuitKey, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* uint64 chan_id = 1; */
|
|
if (message.chanId !== 0n)
|
|
writer.tag(1, WireType.Varint).uint64(message.chanId);
|
|
/* uint64 htlc_id = 2; */
|
|
if (message.htlcId !== 0n)
|
|
writer.tag(2, WireType.Varint).uint64(message.htlcId);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.CircuitKey
|
|
*/
|
|
export const CircuitKey = new CircuitKey$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class HtlcModifyRequest$Type extends MessageType<HtlcModifyRequest> {
|
|
constructor() {
|
|
super("invoicesrpc.HtlcModifyRequest", [
|
|
{ no: 1, name: "invoice", kind: "message", T: () => Invoice },
|
|
{ no: 2, name: "exit_htlc_circuit_key", kind: "message", T: () => CircuitKey },
|
|
{ no: 3, name: "exit_htlc_amt", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 4, name: "exit_htlc_expiry", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
|
{ no: 5, name: "current_height", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
|
{ no: 6, name: "exit_htlc_wire_custom_records", kind: "map", K: 4 /*ScalarType.UINT64*/, V: { kind: "scalar", T: 12 /*ScalarType.BYTES*/ } }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<HtlcModifyRequest>): HtlcModifyRequest {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.exitHtlcAmt = 0n;
|
|
message.exitHtlcExpiry = 0;
|
|
message.currentHeight = 0;
|
|
message.exitHtlcWireCustomRecords = {};
|
|
if (value !== undefined)
|
|
reflectionMergePartial<HtlcModifyRequest>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HtlcModifyRequest): HtlcModifyRequest {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* lnrpc.Invoice invoice */ 1:
|
|
message.invoice = Invoice.internalBinaryRead(reader, reader.uint32(), options, message.invoice);
|
|
break;
|
|
case /* invoicesrpc.CircuitKey exit_htlc_circuit_key */ 2:
|
|
message.exitHtlcCircuitKey = CircuitKey.internalBinaryRead(reader, reader.uint32(), options, message.exitHtlcCircuitKey);
|
|
break;
|
|
case /* uint64 exit_htlc_amt */ 3:
|
|
message.exitHtlcAmt = reader.uint64().toBigInt();
|
|
break;
|
|
case /* uint32 exit_htlc_expiry */ 4:
|
|
message.exitHtlcExpiry = reader.uint32();
|
|
break;
|
|
case /* uint32 current_height */ 5:
|
|
message.currentHeight = reader.uint32();
|
|
break;
|
|
case /* map<uint64, bytes> exit_htlc_wire_custom_records */ 6:
|
|
this.binaryReadMap6(message.exitHtlcWireCustomRecords, 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 binaryReadMap6(map: HtlcModifyRequest["exitHtlcWireCustomRecords"], reader: IBinaryReader, options: BinaryReadOptions): void {
|
|
let len = reader.uint32(), end = reader.pos + len, key: keyof HtlcModifyRequest["exitHtlcWireCustomRecords"] | undefined, val: HtlcModifyRequest["exitHtlcWireCustomRecords"][any] | undefined;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case 1:
|
|
key = reader.uint64().toString();
|
|
break;
|
|
case 2:
|
|
val = reader.bytes();
|
|
break;
|
|
default: throw new globalThis.Error("unknown map entry field for invoicesrpc.HtlcModifyRequest.exit_htlc_wire_custom_records");
|
|
}
|
|
}
|
|
map[key ?? "0"] = val ?? new Uint8Array(0);
|
|
}
|
|
internalBinaryWrite(message: HtlcModifyRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* lnrpc.Invoice invoice = 1; */
|
|
if (message.invoice)
|
|
Invoice.internalBinaryWrite(message.invoice, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
/* invoicesrpc.CircuitKey exit_htlc_circuit_key = 2; */
|
|
if (message.exitHtlcCircuitKey)
|
|
CircuitKey.internalBinaryWrite(message.exitHtlcCircuitKey, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
/* uint64 exit_htlc_amt = 3; */
|
|
if (message.exitHtlcAmt !== 0n)
|
|
writer.tag(3, WireType.Varint).uint64(message.exitHtlcAmt);
|
|
/* uint32 exit_htlc_expiry = 4; */
|
|
if (message.exitHtlcExpiry !== 0)
|
|
writer.tag(4, WireType.Varint).uint32(message.exitHtlcExpiry);
|
|
/* uint32 current_height = 5; */
|
|
if (message.currentHeight !== 0)
|
|
writer.tag(5, WireType.Varint).uint32(message.currentHeight);
|
|
/* map<uint64, bytes> exit_htlc_wire_custom_records = 6; */
|
|
for (let k of globalThis.Object.keys(message.exitHtlcWireCustomRecords))
|
|
writer.tag(6, WireType.LengthDelimited).fork().tag(1, WireType.Varint).uint64(k).tag(2, WireType.LengthDelimited).bytes(message.exitHtlcWireCustomRecords[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 invoicesrpc.HtlcModifyRequest
|
|
*/
|
|
export const HtlcModifyRequest = new HtlcModifyRequest$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class HtlcModifyResponse$Type extends MessageType<HtlcModifyResponse> {
|
|
constructor() {
|
|
super("invoicesrpc.HtlcModifyResponse", [
|
|
{ no: 1, name: "circuit_key", kind: "message", T: () => CircuitKey },
|
|
{ no: 2, name: "amt_paid", kind: "scalar", opt: true, T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
{ no: 3, name: "cancel_set", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<HtlcModifyResponse>): HtlcModifyResponse {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.cancelSet = false;
|
|
if (value !== undefined)
|
|
reflectionMergePartial<HtlcModifyResponse>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HtlcModifyResponse): HtlcModifyResponse {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* invoicesrpc.CircuitKey circuit_key */ 1:
|
|
message.circuitKey = CircuitKey.internalBinaryRead(reader, reader.uint32(), options, message.circuitKey);
|
|
break;
|
|
case /* optional uint64 amt_paid */ 2:
|
|
message.amtPaid = reader.uint64().toBigInt();
|
|
break;
|
|
case /* bool cancel_set */ 3:
|
|
message.cancelSet = 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: HtlcModifyResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* invoicesrpc.CircuitKey circuit_key = 1; */
|
|
if (message.circuitKey)
|
|
CircuitKey.internalBinaryWrite(message.circuitKey, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
/* optional uint64 amt_paid = 2; */
|
|
if (message.amtPaid !== undefined)
|
|
writer.tag(2, WireType.Varint).uint64(message.amtPaid);
|
|
/* bool cancel_set = 3; */
|
|
if (message.cancelSet !== false)
|
|
writer.tag(3, WireType.Varint).bool(message.cancelSet);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message invoicesrpc.HtlcModifyResponse
|
|
*/
|
|
export const HtlcModifyResponse = new HtlcModifyResponse$Type();
|
|
/**
|
|
* @generated ServiceType for protobuf service invoicesrpc.Invoices
|
|
*/
|
|
export const Invoices = new ServiceType("invoicesrpc.Invoices", [
|
|
{ name: "SubscribeSingleInvoice", serverStreaming: true, options: {}, I: SubscribeSingleInvoiceRequest, O: Invoice },
|
|
{ name: "CancelInvoice", options: {}, I: CancelInvoiceMsg, O: CancelInvoiceResp },
|
|
{ name: "AddHoldInvoice", options: {}, I: AddHoldInvoiceRequest, O: AddHoldInvoiceResp },
|
|
{ name: "SettleInvoice", options: {}, I: SettleInvoiceMsg, O: SettleInvoiceResp },
|
|
{ name: "LookupInvoiceV2", options: {}, I: LookupInvoiceMsg, O: Invoice },
|
|
{ name: "HtlcModifier", serverStreaming: true, clientStreaming: true, options: {}, I: HtlcModifyResponse, O: HtlcModifyRequest }
|
|
]);
|