Exemplo n.º 1
0
 def open_channel(self, local_funding_amount: int, **kwargs):
     # TODO: implement `lncli openchannel --connect` function
     request = ln.OpenChannelRequest(
         local_funding_amount=local_funding_amount, **kwargs)
     if request.node_pubkey == b'':
         request.node_pubkey = bytes.fromhex(request.node_pubkey_string)
     return self.lightning_stub.OpenChannel(request)
Exemplo n.º 2
0
 def open_channel(self, node_pubkey_string: str, local_funding_amount: int,
                  **kwargs):
     # TODO: mirror `lncli openchannel --connect` function
     request = ln.OpenChannelRequest(
         node_pubkey_string=node_pubkey_string,
         local_funding_amount=local_funding_amount,
         **kwargs)
     if request.node_pubkey == b'':
         request.node_pubkey = bytes.fromhex(node_pubkey_string)
     for response in self.lightning_stub.OpenChannel(request):
         print(response)
Exemplo n.º 3
0
    def open_channel_sync(self, local_funding_amount: int, **kwargs):
        """
        synchronous version of the OpenChannel RPC call. This call is meant to be consumed by
        clients to the REST proxy. As with all other sync calls, all byte slices are intended to be
        populated as hex encoded strings.

        :return: ChannelPoint with 3 attributes: 'funding_txid_bytes', 'funding_tx_str' and
        'output_index'
        """
        request = ln.OpenChannelRequest(
            local_funding_amount=local_funding_amount, **kwargs)
        response = self.lightning_stub.OpenChannelSync(request)
        return response
Exemplo n.º 4
0
 def open_channel_sync(self, node_pubkey_string: str,
                       local_funding_amount: int, **kwargs):
     """
     A synchronous (blocking) version of the 'open_channel()' command
     """
     request = ln.OpenChannelRequest(
         node_pubkey_string=node_pubkey_string,
         local_funding_amount=local_funding_amount,
         **kwargs)
     if not hasattr(request, 'node_pubkey'):
         request.node_pubkey = bytes.fromhex(node_pubkey_string)
     response = self.lightning_stub.OpenChannelSync(request)
     return response
Exemplo n.º 5
0
    def open_channel(self,
                     local_funding_amount: int,
                     timeout: int = None,
                     **kwargs):
        """
        attempts to open a singly funded channel specified in the request to a remote peer. Users
        are able to specify a target number of blocks that the funding transaction should be
        confirmed in, or a manual fee rate to us for the funding transaction. If neither are
        specified, then a lax block confirmation target is used.

        :return: an iterable of OpenChannelStatusUpdates. See the notes on threading and iterables
        in README.md
        """
        # TODO: implement `lncli openchannel --connect` function
        request = ln.OpenChannelRequest(
            local_funding_amount=local_funding_amount, **kwargs)
        if request.node_pubkey == b'':
            request.node_pubkey = bytes.fromhex(request.node_pubkey_string)
        return self.lightning_stub.OpenChannel(request, timeout=timeout)
Exemplo n.º 6
0
 def open_channel_sync(self, local_funding_amount: int, **kwargs):
     request = ln.OpenChannelRequest(
         local_funding_amount=local_funding_amount, **kwargs)
     response = self.lightning_stub.OpenChannelSync(request)
     return response