Skip to content

Commit

Permalink
set time_pref (optimize for fees only)
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Otto committed May 3, 2024
1 parent 70c4856 commit dbd6bde
Show file tree
Hide file tree
Showing 8 changed files with 2,689 additions and 17,847 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.iml
venv/
grpc_generated/*.proto
**/__pycache__
**/__pycache__
*.proto
449 changes: 31 additions & 418 deletions grpc_generated/invoices_pb2.py

Large diffs are not rendered by default.

206 changes: 184 additions & 22 deletions grpc_generated/invoices_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,55 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from grpc_generated import invoices_pb2 as invoices__pb2
from grpc_generated import lightning_pb2 as lightning__pb2

GRPC_GENERATED_VERSION = '1.63.0'
GRPC_VERSION = grpc.__version__
EXPECTED_ERROR_RELEASE = '1.65.0'
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
_version_not_supported = False

try:
from grpc._utilities import first_version_is_lower
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
_version_not_supported = True

if _version_not_supported:
warnings.warn(
f'The grpc package installed is at version {GRPC_VERSION},'
+ f' but the generated code in invoices_pb2_grpc.py depends on'
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
RuntimeWarning
)


class InvoicesStub(object):
"""Invoices is a service that can be used to create, accept, settle and cancel
"""
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
Invoices is a service that can be used to create, accept, settle and cancel
invoices.
"""

Expand All @@ -21,26 +63,48 @@ def __init__(self, channel):
'/invoicesrpc.Invoices/SubscribeSingleInvoice',
request_serializer=invoices__pb2.SubscribeSingleInvoiceRequest.SerializeToString,
response_deserializer=lightning__pb2.Invoice.FromString,
)
_registered_method=True)
self.CancelInvoice = channel.unary_unary(
'/invoicesrpc.Invoices/CancelInvoice',
request_serializer=invoices__pb2.CancelInvoiceMsg.SerializeToString,
response_deserializer=invoices__pb2.CancelInvoiceResp.FromString,
)
_registered_method=True)
self.AddHoldInvoice = channel.unary_unary(
'/invoicesrpc.Invoices/AddHoldInvoice',
request_serializer=invoices__pb2.AddHoldInvoiceRequest.SerializeToString,
response_deserializer=invoices__pb2.AddHoldInvoiceResp.FromString,
)
_registered_method=True)
self.SettleInvoice = channel.unary_unary(
'/invoicesrpc.Invoices/SettleInvoice',
request_serializer=invoices__pb2.SettleInvoiceMsg.SerializeToString,
response_deserializer=invoices__pb2.SettleInvoiceResp.FromString,
)
_registered_method=True)
self.LookupInvoiceV2 = channel.unary_unary(
'/invoicesrpc.Invoices/LookupInvoiceV2',
request_serializer=invoices__pb2.LookupInvoiceMsg.SerializeToString,
response_deserializer=lightning__pb2.Invoice.FromString,
_registered_method=True)


class InvoicesServicer(object):
"""Invoices is a service that can be used to create, accept, settle and cancel
"""
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
Invoices is a service that can be used to create, accept, settle and cancel
invoices.
"""

Expand All @@ -55,7 +119,7 @@ def SubscribeSingleInvoice(self, request, context):
raise NotImplementedError('Method not implemented!')

def CancelInvoice(self, request, context):
"""
"""lncli: `cancelinvoice`
CancelInvoice cancels a currently open invoice. If the invoice is already
canceled, this call will succeed. If the invoice is already settled, it will
fail.
Expand All @@ -65,7 +129,7 @@ def CancelInvoice(self, request, context):
raise NotImplementedError('Method not implemented!')

def AddHoldInvoice(self, request, context):
"""
"""lncli: `addholdinvoice`
AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
supplied in the request.
"""
Expand All @@ -74,14 +138,23 @@ def AddHoldInvoice(self, request, context):
raise NotImplementedError('Method not implemented!')

def SettleInvoice(self, request, context):
"""
"""lncli: `settleinvoice`
SettleInvoice settles an accepted invoice. If the invoice is already
settled, this call will succeed.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def LookupInvoiceV2(self, request, context):
"""
LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
using either its payment hash, payment address, or set ID.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_InvoicesServicer_to_server(servicer, server):
rpc_method_handlers = {
Expand All @@ -105,6 +178,11 @@ def add_InvoicesServicer_to_server(servicer, server):
request_deserializer=invoices__pb2.SettleInvoiceMsg.FromString,
response_serializer=invoices__pb2.SettleInvoiceResp.SerializeToString,
),
'LookupInvoiceV2': grpc.unary_unary_rpc_method_handler(
servicer.LookupInvoiceV2,
request_deserializer=invoices__pb2.LookupInvoiceMsg.FromString,
response_serializer=lightning__pb2.Invoice.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'invoicesrpc.Invoices', rpc_method_handlers)
Expand All @@ -113,7 +191,24 @@ def add_InvoicesServicer_to_server(servicer, server):

# This class is part of an EXPERIMENTAL API.
class Invoices(object):
"""Invoices is a service that can be used to create, accept, settle and cancel
"""
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
Invoices is a service that can be used to create, accept, settle and cancel
invoices.
"""

Expand All @@ -128,11 +223,21 @@ def SubscribeSingleInvoice(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/invoicesrpc.Invoices/SubscribeSingleInvoice',
return grpc.experimental.unary_stream(
request,
target,
'/invoicesrpc.Invoices/SubscribeSingleInvoice',
invoices__pb2.SubscribeSingleInvoiceRequest.SerializeToString,
lightning__pb2.Invoice.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def CancelInvoice(request,
Expand All @@ -145,11 +250,21 @@ def CancelInvoice(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/invoicesrpc.Invoices/CancelInvoice',
return grpc.experimental.unary_unary(
request,
target,
'/invoicesrpc.Invoices/CancelInvoice',
invoices__pb2.CancelInvoiceMsg.SerializeToString,
invoices__pb2.CancelInvoiceResp.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def AddHoldInvoice(request,
Expand All @@ -162,11 +277,21 @@ def AddHoldInvoice(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/invoicesrpc.Invoices/AddHoldInvoice',
return grpc.experimental.unary_unary(
request,
target,
'/invoicesrpc.Invoices/AddHoldInvoice',
invoices__pb2.AddHoldInvoiceRequest.SerializeToString,
invoices__pb2.AddHoldInvoiceResp.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def SettleInvoice(request,
Expand All @@ -179,8 +304,45 @@ def SettleInvoice(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/invoicesrpc.Invoices/SettleInvoice',
return grpc.experimental.unary_unary(
request,
target,
'/invoicesrpc.Invoices/SettleInvoice',
invoices__pb2.SettleInvoiceMsg.SerializeToString,
invoices__pb2.SettleInvoiceResp.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def LookupInvoiceV2(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(
request,
target,
'/invoicesrpc.Invoices/LookupInvoiceV2',
invoices__pb2.LookupInvoiceMsg.SerializeToString,
lightning__pb2.Invoice.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
15,181 changes: 658 additions & 14,523 deletions grpc_generated/lightning_pb2.py

Large diffs are not rendered by default.

Loading

0 comments on commit dbd6bde

Please sign in to comment.