Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate LN protobuf bindings #3951

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jsconfig.json
app/middleware/walletrpc/api_pb.js
app/middleware/walletrpc/api_grpc_pb.js
app/middleware/ln/google/api
app/middleware/ln/rpc_grpc_pb.js
app/middleware/ln/rpc_pb.js
app/middleware/ln/lightning_grpc_pb.js
app/middleware/ln/lightning_pb.js
app/middleware/ln/walletunlocker_grpc_pb.js
app/middleware/ln/walletunlocker_pb.js
app/middleware/ln/wtclient_grpc_pb.js
Expand Down
5 changes: 4 additions & 1 deletion app/actions/LNActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,10 @@ const connectToLNWallet =
} catch (error) {
// An unimplemented error here probably means dcrlnd was just unlocked
// and is currently starting up the services. Wait a bit and try again.
if (error.code !== 12 && error.toString().indexOf("in the process of starting up") == -1) {
if (
error.code !== 12 &&
error.toString().indexOf("in the process of starting up") == -1
) {
// 12 === UNIMPLEMENTED.
throw error;
}
Expand Down
2 changes: 1 addition & 1 deletion app/middleware/ln/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const grpc = require("@grpc/grpc-js");
import fs from "fs";
import { trackClient } from "middleware/grpc/clientTracking";

const proto = require("./rpc_grpc_pb.js");
const proto = require("./lightning_grpc_pb.js");
const services = grpc.loadPackageDefinition(proto).lnrpc;

const wuProto = require("./walletunlocker_grpc_pb.js");
Expand Down
54 changes: 52 additions & 2 deletions app/middleware/ln/invoices.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

import "rpc.proto";
import "lightning.proto";

package invoicesrpc;

Expand Down Expand Up @@ -35,6 +35,12 @@ service Invoices {
settled, this call will succeed.
*/
rpc SettleInvoice (SettleInvoiceMsg) returns (SettleInvoiceResp);

/*
LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
using either its payment hash, payment address, or set ID.
*/
rpc LookupInvoiceV2 (LookupInvoiceMsg) returns (lnrpc.Invoice);
}

message CancelInvoiceMsg {
Expand Down Expand Up @@ -98,11 +104,26 @@ message AddHoldInvoiceRequest {

message AddHoldInvoiceResp {
/*
A bare-bones invoice for a payment within the Lightning Network. With the
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.
*/
string payment_request = 1;

/*
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.
*/
uint64 add_index = 2;

/*
The payment address of the generated invoice. This value should be used
in all payments for this invoice as we require it for end to end
security.
*/
bytes payment_addr = 3;
}

message SettleInvoiceMsg {
Expand All @@ -120,3 +141,32 @@ message SubscribeSingleInvoiceRequest {
// Hash corresponding to the (hold) invoice to subscribe to.
bytes r_hash = 2;
}

enum LookupModifier {
// The default look up modifier, no look up behavior is changed.
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.
*/
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.
*/
HTLC_SET_BLANK = 2;
}

message LookupInvoiceMsg {
oneof invoice_ref {
bytes payment_hash = 1;
bytes payment_addr = 2;
bytes set_id = 3;
}

LookupModifier lookup_modifier = 4;
}
33 changes: 29 additions & 4 deletions app/middleware/ln/invoices_grpc_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'use strict';
var invoices_pb = require('./invoices_pb.js').invoicesrpc;
var rpc_pb = require('./rpc_pb.js');
var lightning_pb = require('./lightning_pb.js');

function serialize_invoicesrpc_AddHoldInvoiceRequest(arg) {
if (!(arg instanceof invoices_pb.AddHoldInvoiceRequest)) {
Expand Down Expand Up @@ -48,6 +48,17 @@ function deserialize_invoicesrpc_CancelInvoiceResp(buffer_arg) {
return invoices_pb.CancelInvoiceResp.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_invoicesrpc_LookupInvoiceMsg(arg) {
if (!(arg instanceof invoices_pb.LookupInvoiceMsg)) {
throw new Error('Expected argument of type invoicesrpc.LookupInvoiceMsg');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_invoicesrpc_LookupInvoiceMsg(buffer_arg) {
return invoices_pb.LookupInvoiceMsg.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_invoicesrpc_SettleInvoiceMsg(arg) {
if (!(arg instanceof invoices_pb.SettleInvoiceMsg)) {
throw new Error('Expected argument of type invoicesrpc.SettleInvoiceMsg');
Expand Down Expand Up @@ -82,14 +93,14 @@ function deserialize_invoicesrpc_SubscribeSingleInvoiceRequest(buffer_arg) {
}

function serialize_lnrpc_Invoice(arg) {
if (!(arg instanceof rpc_pb.Invoice)) {
if (!(arg instanceof lightning_pb.Invoice)) {
throw new Error('Expected argument of type lnrpc.Invoice');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_lnrpc_Invoice(buffer_arg) {
return rpc_pb.Invoice.deserializeBinary(new Uint8Array(buffer_arg));
return lightning_pb.Invoice.deserializeBinary(new Uint8Array(buffer_arg));
}


Expand All @@ -105,7 +116,7 @@ subscribeSingleInvoice: {
requestStream: false,
responseStream: true,
requestType: invoices_pb.SubscribeSingleInvoiceRequest,
responseType: rpc_pb.Invoice,
responseType: lightning_pb.Invoice,
requestSerialize: serialize_invoicesrpc_SubscribeSingleInvoiceRequest,
requestDeserialize: deserialize_invoicesrpc_SubscribeSingleInvoiceRequest,
responseSerialize: serialize_lnrpc_Invoice,
Expand Down Expand Up @@ -154,5 +165,19 @@ settleInvoice: {
responseSerialize: serialize_invoicesrpc_SettleInvoiceResp,
responseDeserialize: deserialize_invoicesrpc_SettleInvoiceResp,
},
//
// LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
// using either its payment hash, payment address, or set ID.
lookupInvoiceV2: {
path: '/invoicesrpc.Invoices/LookupInvoiceV2',
requestStream: false,
responseStream: false,
requestType: invoices_pb.LookupInvoiceMsg,
responseType: lightning_pb.Invoice,
requestSerialize: serialize_invoicesrpc_LookupInvoiceMsg,
requestDeserialize: deserialize_invoicesrpc_LookupInvoiceMsg,
responseSerialize: serialize_lnrpc_Invoice,
responseDeserialize: deserialize_lnrpc_Invoice,
},
};

Loading
Loading