Package jrpc.clightning
Class CLightningRPC
- java.lang.Object
-
- jrpc.clightning.CLightningRPC
-
public class CLightningRPC extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected CommandRPCMediator
mediatorCommand
protected java.lang.String
path
protected CLightningSocket
socket
-
Constructor Summary
Constructors Constructor Description CLightningRPC()
Create a client where the configuration it is taken from a config file.CLightningRPC(java.lang.String path)
Create a client where with a connection with the unix socket at the specified path.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
autoCleanInvoice()
java.lang.String
autoCleanInvoice(java.lang.String cycleSeconds, java.lang.String expiredBy)
CLightningBitcoinTx
close(java.lang.String channelId)
CLightningBitcoinTx
close(java.lang.String channelId, java.lang.String unilateralTimeout, java.lang.String feeNegotiationStep, java.lang.String wrongFunding)
CLightningConnect
connect(java.lang.String id)
CLightningConnect
connect(java.lang.String id, java.lang.String host, java.lang.String port)
CLightningDecodePay
decodePay(java.lang.String bolt11)
CLightningDecodePay
decodePay(java.lang.String bolt11, java.lang.String description)
CLightningInvoice
delInvoice(java.lang.String label, java.lang.String status)
boolean
disconnect(java.lang.String id)
boolean
disconnect(java.lang.String id, boolean force)
CLightningFeeRate
feeRate(FeeRateStyle style)
CLightningBitcoinTx
fundChannel(java.lang.String id, java.lang.String amount)
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)
CLightningFundPSBT
fundPSBT(java.lang.String satoshi, int feeRate, int startWeight)
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)
CLightningGetInfo
getInfo()
static CLightningRPC
getInstance()
Deprecated.CLightningGetRoutes
getRoute(java.lang.String id, java.lang.String mSatoshi, float riskFactor)
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)
boolean
hasCommand(ICommandKey key)
boolean
hasCommand(ICommandKey key, boolean custom)
CLightningHelp
help()
CLightningInvoice
invoice(java.lang.String milliSatoshi, java.lang.String label, java.lang.String description)
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)
CLightningListChannels
listChannels()
CLightningListChannels
listChannels(java.lang.String shortIdChannel, java.lang.String source, java.lang.String destination)
CLightningListConfigs
listConfigs()
CLightningListConfigs
listConfigs(java.lang.String config)
CLightningListFunds
listFunds()
CLightningListInvoices
listInvoices()
CLightningListInvoices
listInvoices(java.lang.String label)
CLightningListNodes
listNodes()
CLightningListNodes
listNodes(java.lang.String nodeId)
CLightningListPays
listPays()
CLightningListPays
listPays(java.lang.String bolt11, java.lang.String paymentHash)
CLightningListPeers
listPeers()
CLightningListPeers
listPeers(java.lang.String id, java.lang.String level)
CLightningListSendPays
listSendPays()
CLightningListSendPays
listSendPays(java.lang.String bolt11, java.lang.String paymentHash)
CLightningListTransactions
listTransactions()
java.lang.String
newAddress(AddressType type)
CLightningPayResult
pay(java.lang.String bolt11)
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)
CLightningPing
ping(java.lang.String nodeId)
CLightningPing
ping(java.lang.String nodeId, int len, int pongBytes)
java.lang.String
rawCommand(java.lang.String commandName)
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.java.lang.String
rawCommand(java.lang.String commandName, java.util.Map<java.lang.String,java.lang.Object> params)
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.<T> void
registerCommand(ICommandKey key, IRPCCommand<T> command)
CLightningReserveInputs
reserveInputs(java.lang.String pdbt)
CLightningReserveInputs
reserveInputs(java.lang.String psbt, boolean exclusive)
<T> T
runRegisterCommand(java.lang.String key, java.util.HashMap<java.lang.String,java.lang.Object> payload)
<T> T
runRegisterCommand(ICommandKey key, java.util.HashMap<java.lang.String,java.lang.Object> payload)
CLightningTransaction
sendPSBT(java.lang.String psbt)
CLightningPSBT
signPSBT(java.lang.String psbt)
boolean
stop()
CLightningBitcoinTx
txDiscard(java.lang.String txId)
CLightningBitcoinTx
txPrepare(java.util.List<BitcoinDestination> bitcoinOutputs)
CLightningBitcoinTx
txPrepare(java.util.List<BitcoinDestination> bitcoinOutputs, java.lang.String feeRate, int minConf, java.util.List<BitcoinUTXO> utxos)
void
unregisterCommand(ICommandKey key)
CLightningReserveInputs
unReserveInputs(java.lang.String psbt)
CLightningInvoice
waitInvoice(java.lang.String label)
CLightningSendPay
waitSendPay(java.lang.String paymentHash)
CLightningSendPay
waitSendPays(java.lang.String paymentHash, int timeout, int partid)
CLightningBitcoinTx
withdraw(java.lang.String destination, java.lang.String satoshi)
CLightningBitcoinTx
withdraw(java.lang.String destination, java.lang.String satoshi, java.lang.String feeRate, int minConf, java.util.List<BitcoinUTXO> utxos)
-
-
-
Field Detail
-
path
protected java.lang.String path
-
socket
protected CLightningSocket socket
-
mediatorCommand
protected CommandRPCMediator mediatorCommand
-
-
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.
-
feeRate
public CLightningFeeRate feeRate(FeeRateStyle style)
-
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)
-
getInfo
public CLightningGetInfo getInfo()
-
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)
-
listInvoices
public CLightningListInvoices listInvoices()
-
listInvoices
public CLightningListInvoices listInvoices(java.lang.String label)
-
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)
-
txPrepare
public CLightningBitcoinTx txPrepare(java.util.List<BitcoinDestination> bitcoinOutputs, java.lang.String feeRate, int minConf, java.util.List<BitcoinUTXO> utxos)
-
txPrepare
public CLightningBitcoinTx txPrepare(java.util.List<BitcoinDestination> bitcoinOutputs)
-
txDiscard
public CLightningBitcoinTx txDiscard(java.lang.String txId)
-
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)
-
close
public CLightningBitcoinTx close(java.lang.String channelId)
-
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)
-
listFunds
public CLightningListFunds listFunds()
-
connect
public CLightningConnect connect(java.lang.String id, java.lang.String host, java.lang.String port)
-
connect
public CLightningConnect connect(java.lang.String id)
-
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)
-
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()
-
listSendPays
public CLightningListSendPays listSendPays(java.lang.String bolt11, java.lang.String paymentHash)
-
listChannels
public CLightningListChannels listChannels()
-
listChannels
public CLightningListChannels listChannels(java.lang.String shortIdChannel, java.lang.String source, java.lang.String destination)
-
listPeers
public CLightningListPeers listPeers()
-
listPeers
public CLightningListPeers listPeers(java.lang.String id, java.lang.String level)
-
decodePay
public CLightningDecodePay decodePay(java.lang.String bolt11)
-
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)
-
listPays
public CLightningListPays listPays()
-
waitInvoice
public CLightningInvoice waitInvoice(java.lang.String label)
-
waitSendPay
public CLightningSendPay waitSendPay(java.lang.String paymentHash)
-
waitSendPays
public CLightningSendPay waitSendPays(java.lang.String paymentHash, int timeout, int partid)
-
listNodes
public CLightningListNodes listNodes(java.lang.String nodeId)
-
listNodes
public CLightningListNodes listNodes()
-
ping
public CLightningPing ping(java.lang.String nodeId, int len, int pongBytes)
-
ping
public CLightningPing ping(java.lang.String nodeId)
-
listTransactions
public CLightningListTransactions listTransactions()
-
help
public CLightningHelp help()
-
fundPSBT
public CLightningFundPSBT fundPSBT(java.lang.String satoshi, int feeRate, int startWeight)
-
reserveInputs
public CLightningReserveInputs reserveInputs(java.lang.String pdbt)
-
reserveInputs
public CLightningReserveInputs reserveInputs(java.lang.String psbt, boolean exclusive)
-
signPSBT
public CLightningPSBT signPSBT(java.lang.String psbt)
-
sendPSBT
public CLightningTransaction sendPSBT(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)
-
unReserveInputs
public CLightningReserveInputs unReserveInputs(java.lang.String psbt)
-
listConfigs
public CLightningListConfigs listConfigs(java.lang.String config)
-
listConfigs
public CLightningListConfigs listConfigs()
-
registerCommand
public <T> void registerCommand(ICommandKey key, IRPCCommand<T> command)
-
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
-
-