Exemplo n.º 1
0
 def send_payment_sync(self, **kwargs):
     # Use payment request as first choice
     if 'payment_request' in kwargs:
         request = ln.SendRequest(payment_request=kwargs['payment_request'])
     else:
         request = ln.SendRequest(**kwargs)
     response = self.lightning_stub.SendPaymentSync(request)
     return response
Exemplo n.º 2
0
 def send_request_generator(**kwargs):
     # i = 0
     #while True:
     if kwargs['payment_request']:
         request = ln.SendRequest(payment_request=kwargs['payment_request'])
     else:
         request = ln.SendRequest(**kwargs)
     yield request
Exemplo n.º 3
0
 def send_payment_sync(self, **kwargs):
     if kwargs['payment_request']:
         request = ln.SendRequest(payment_request=kwargs['payment_request'])
     else:
         kwargs['payment_hash'] = bytes.fromhex(
             kwargs['payment_hash_string'])
         kwargs['dest'] = bytes.fromhex(kwargs['dest_string'])
         request = ln.SendRequest(**kwargs)
     response = self.lightning_stub.SendPaymentSync(request)
     return response
Exemplo n.º 4
0
 def send_request_generator(**kwargs):
     # Commented out to complement the magic sleep below...
     # while True:
     request = ln.SendRequest(**kwargs)
     yield request
     # Magic sleep which tricks the response to the send_payment() method to actually
     # contain data...
     time.sleep(5)
Exemplo n.º 5
0
    def send_payment_sync(self, **kwargs):
        """
         synchronous non-streaming version of SendPayment. This RPC is intended to be consumed by
         clients of the REST proxy. Additionally, this RPC expects the destination’s public key and
         the payment hash (if any) to be encoded as hex strings.

        :return: SendResponse with up to 4 attributes: 'payment_error' (conditional),
        'payment_preimage', 'payment_route' and 'payment_hash'
        """
        # Use payment request as first choice
        if 'payment_request' in kwargs:
            params = {'payment_request': kwargs['payment_request']}
            if 'amt' in kwargs:
                params['amt'] = kwargs['amt']
            request = ln.SendRequest(**params)
        else:
            request = ln.SendRequest(**kwargs)
        response = self.lightning_stub.SendPaymentSync(request)
        return response
Exemplo n.º 6
0
    def send_request_generator(**kwargs):
        """
        Creates the SendRequest object for the synchronous streaming send_payment() as a generator

        :return: generator object for the request
        """
        # Commented out to complement the magic sleep below...
        # while True:
        request = ln.SendRequest(**kwargs)
        yield request
        # Magic sleep which tricks the response to the send_payment() method to actually
        # contain data...
        time.sleep(5)