Class CLightningRPC


  • public class CLightningRPC
    extends java.lang.Object
    • Constructor Detail

      • CLightningRPC

        public CLightningRPC()
        Create a client where the configuration it is taken from a config file. TODO: Give the opportunity to use also the os env.
      • CLightningRPC

        public CLightningRPC​(java.lang.String path)
        Create a client where with a connection with the unix socket at the specified path.
        Parameters:
        path - : String that contains the path where the socket it is located
    • Method Detail

      • getInstance

        @Deprecated
        public static CLightningRPC getInstance()
        Deprecated.
      • getRoute

        public CLightningGetRoutes getRoute​(java.lang.String id,
                                            java.lang.String mSatoshi,
                                            float riskFactor)
      • getRoute

        public CLightningGetRoutes getRoute​(java.lang.String id,
                                            java.lang.String mSatoshi,
                                            float riskFactor,
                                            int cltv,
                                            java.lang.String fromId,
                                            java.lang.String fuzzPercent,
                                            int maxHops,
                                            ExcludeChannel... exclude)
      • newAddress

        public java.lang.String newAddress​(AddressType type)
      • invoice

        public CLightningInvoice invoice​(java.lang.String milliSatoshi,
                                         java.lang.String label,
                                         java.lang.String description)
      • invoice

        public CLightningInvoice invoice​(java.lang.String milliSatoshi,
                                         java.lang.String label,
                                         java.lang.String description,
                                         java.lang.String expiry,
                                         java.lang.String[] fallbacks,
                                         java.lang.String preImage,
                                         boolean exposePrivateChannels)
      • delInvoice

        public CLightningInvoice delInvoice​(java.lang.String label,
                                            java.lang.String status)
      • autoCleanInvoice

        public java.lang.String autoCleanInvoice()
      • autoCleanInvoice

        public java.lang.String autoCleanInvoice​(java.lang.String cycleSeconds,
                                                 java.lang.String expiredBy)
      • withdraw

        public CLightningBitcoinTx withdraw​(java.lang.String destination,
                                            java.lang.String satoshi,
                                            java.lang.String feeRate,
                                            int minConf,
                                            java.util.List<BitcoinUTXO> utxos)
      • withdraw

        public CLightningBitcoinTx withdraw​(java.lang.String destination,
                                            java.lang.String satoshi)
      • close

        public CLightningBitcoinTx close​(java.lang.String channelId,
                                         java.lang.String unilateralTimeout,
                                         java.lang.String feeNegotiationStep,
                                         java.lang.String wrongFunding)
      • fundChannel

        public CLightningBitcoinTx fundChannel​(java.lang.String id,
                                               java.lang.String amount)
      • fundChannel

        public CLightningBitcoinTx fundChannel​(java.lang.String id,
                                               java.lang.String amount,
                                               java.lang.String feeRate,
                                               boolean announce,
                                               int minConf,
                                               java.util.List<BitcoinUTXO> utxos,
                                               java.lang.String pushMilliSat,
                                               java.lang.String closeTo)
      • connect

        public CLightningConnect connect​(java.lang.String id,
                                         java.lang.String host,
                                         java.lang.String port)
      • disconnect

        public boolean disconnect​(java.lang.String id)
      • disconnect

        public boolean disconnect​(java.lang.String id,
                                  boolean force)
      • pay

        public CLightningPayResult pay​(java.lang.String bolt11,
                                       java.lang.String milliSatoshi,
                                       java.lang.String label,
                                       float riskFactor,
                                       java.lang.String maxFeePercent,
                                       int retryFor,
                                       java.lang.String maxDelay,
                                       java.lang.String exemptfee)
      • listSendPays

        public CLightningListSendPays listSendPays​(java.lang.String bolt11,
                                                   java.lang.String paymentHash)
      • listChannels

        public CLightningListChannels listChannels​(java.lang.String shortIdChannel,
                                                   java.lang.String source,
                                                   java.lang.String destination)
      • listPeers

        public CLightningListPeers listPeers​(java.lang.String id,
                                             java.lang.String level)
      • decodePay

        public CLightningDecodePay decodePay​(java.lang.String bolt11,
                                             java.lang.String description)
      • stop

        public boolean stop()
      • listPays

        public CLightningListPays listPays​(java.lang.String bolt11,
                                           java.lang.String paymentHash)
      • waitSendPay

        public CLightningSendPay waitSendPay​(java.lang.String paymentHash)
      • waitSendPays

        public CLightningSendPay waitSendPays​(java.lang.String paymentHash,
                                              int timeout,
                                              int partid)
      • ping

        public CLightningPing ping​(java.lang.String nodeId,
                                   int len,
                                   int pongBytes)
      • fundPSBT

        public CLightningFundPSBT fundPSBT​(java.lang.String satoshi,
                                           int feeRate,
                                           int startWeight)
      • signPSBT

        public CLightningPSBT signPSBT​(java.lang.String psbt)
      • fundsPSBT

        public CLightningFundPSBT fundsPSBT​(java.lang.String satoshi,
                                            int feeRate,
                                            int startWeight,
                                            int minConf,
                                            boolean reserve,
                                            java.math.BigInteger lockTime,
                                            java.math.BigInteger minWitnessWeight,
                                            java.lang.Boolean excessAsChange)
      • unregisterCommand

        public void unregisterCommand​(ICommandKey key)
      • runRegisterCommand

        public <T> T runRegisterCommand​(ICommandKey key,
                                        java.util.HashMap<java.lang.String,​java.lang.Object> payload)
      • runRegisterCommand

        public <T> T runRegisterCommand​(java.lang.String key,
                                        java.util.HashMap<java.lang.String,​java.lang.Object> payload)
      • hasCommand

        public boolean hasCommand​(ICommandKey key)
      • hasCommand

        public boolean hasCommand​(ICommandKey key,
                                  boolean custom)
      • rawCommand

        public java.lang.String rawCommand​(java.lang.String commandName,
                                           java.util.Map<java.lang.String,​java.lang.Object> params)
                                    throws java.io.IOException
        Run any command directly over the UNIX socket, this command is faster, but the final user need to manage the JSON string received from the Socket.
        Parameters:
        commandName - : The c-lightning command name.
        params - : The c-lightning command parameter, if any.
        Returns:
        the raw JSON string received from the UNIX socket.
        Throws:
        java.io.IOException - Throw an exception that the UNIX socket generate in case of error
      • rawCommand

        public java.lang.String rawCommand​(java.lang.String commandName)
                                    throws java.io.IOException
        Run any command directly over the UNIX socket, this command is faster, but the final user need to manage the JSON string received from the Socket.
        Parameters:
        commandName - : The c-lightning command name.
        Returns:
        the raw JSON string received from the UNIX socket.
        Throws:
        java.io.IOException - Throw an exception that the UNIX socket generate in case of error