[][src]Struct clightningrpc::lightningrpc::LightningRPC

pub struct LightningRPC { /* fields omitted */ }

Structure providing a high-level interface to the c-lightning daemon RPC

Implementations

impl LightningRPC[src]

pub fn new<P: AsRef<Path>>(sockpath: P) -> LightningRPC[src]

Create a new connection from a UNIX socket path.

Arguments

  • sockpath - Path of UNIX socket to connect to, by default lightningd will create a socket named .lightning/lightning-rpc in the home directory of the user running lightningd.

pub fn client(&mut self) -> &mut Client[src]

Get reference to the low-level client connection

pub fn getinfo(&self) -> Result<GetInfo, Error>[src]

Show information about this node.

pub fn feerates(&self, style: &str) -> Result<FeeRates, Error>[src]

Return feerate estimates, either satoshi-per-kw ({style} perkw) or satoshi-per-kb ({style} perkb).

pub fn listnodes(&self, id: Option<&str>) -> Result<ListNodes, Error>[src]

Show node {id} (or all, if no {id}), in our local network view.

pub fn listchannels(
    &self,
    short_channel_id: Option<&str>
) -> Result<ListChannels, Error>
[src]

Show channel {short_channel_id} (or all known channels, if no {short_channel_id}).

pub fn help(&self, command: Option<&str>) -> Result<Help, Error>[src]

List available commands, or give verbose help on one command.

pub fn getlog(&self, level: Option<&str>) -> Result<GetLog, Error>[src]

Show logs, with optional log {level} (info|unusual|debug|io).

pub fn listconfigs(&self, config: Option<&str>) -> Result<ListConfigs, Error>[src]

List all configuration options, or with [config], just that one. Because of the dynamic nature of the returned object, unlike the other methods, this returns a HashMap (from &str to Json) instead of a structure.

pub fn listpeers(
    &self,
    id: Option<&str>,
    level: Option<&str>
) -> Result<ListPeers, Error>
[src]

Show current peers, if {level} is set, include {log}s.

pub fn listinvoices(&self, label: Option<&str>) -> Result<ListInvoices, Error>[src]

Show invoice {label} (or all, if no {label)).

pub fn invoice(
    &self,
    msatoshi: u64,
    label: &str,
    description: &str,
    expiry: Option<u64>
) -> Result<Invoice, Error>
[src]

Create an invoice for {msatoshi} with {label} and {description} with optional {expiry} seconds (default 1 hour).

pub fn delinvoice(&self, label: &str, status: &str) -> Result<DelInvoice, Error>[src]

Create an invoice for {msatoshi} with {label} and {description} with optional {expiry} seconds (default 1 hour).

pub fn delexpiredinvoice(
    &self,
    maxexpirytime: Option<u64>
) -> Result<DelExpiredInvoice, Error>
[src]

Delete all expired invoices that expired as of given {maxexpirytime} (a UNIX epoch time), or all expired invoices if not specified.

pub fn autocleaninvoice(
    &self,
    cycle_seconds: Option<u64>,
    expired_by: Option<u64>
) -> Result<AutoCleanInvoice, Error>
[src]

Set up autoclean of expired invoices. Perform cleanup every {cycle_seconds} (default 3600), or disable autoclean if 0. Clean up expired invoices that have expired for {expired_by} seconds (default 86400).

pub fn waitanyinvoice(
    &self,
    lastpay_index: Option<u64>
) -> Result<WaitAnyInvoice, Error>
[src]

Wait for the next invoice to be paid, after {lastpay_index}. (if supplied)

pub fn waitinvoice(&self, label: &str) -> Result<WaitInvoice, Error>[src]

Wait for an incoming payment matching the invoice with {label}.

pub fn pay(&self, bolt11: &str, options: PayOptions<'_>) -> Result<Pay, Error>[src]

Send a lightning payment.

Arguments

  • bolt11 - A string that holds the payment information in bolt11 format.
  • options - Options for this payment. Use Default::default() to not pass any options.

pub fn sendpay(
    &self,
    route: Vec<RouteItem>,
    payment_hash: &str,
    description: Option<&str>,
    msatoshi: Option<u64>
) -> Result<SendPay, Error>
[src]

Send along {route} in return for preimage of {payment_hash}, with optional {description}.

pub fn waitsendpay(
    &self,
    payment_hash: &str,
    timeout: u64
) -> Result<WaitSendPay, Error>
[src]

Wait for payment attempt on {payment_hash} to succeed or fail, but only up to {timeout} seconds.

pub fn listsendpays(
    &self,
    bolt11: Option<&str>,
    payment_hash: Option<&str>
) -> Result<ListSendPays, Error>
[src]

Show outgoing payments.

pub fn decodepay(
    &self,
    bolt11: &str,
    description: Option<&str>
) -> Result<DecodePay, Error>
[src]

Decode {bolt11}, using {description} if necessary.

pub fn getroute(
    &self,
    id: &str,
    msatoshi: u64,
    riskfactor: f64,
    cltv: Option<u64>,
    fromid: Option<&str>,
    fuzzpercent: Option<f64>,
    seed: Option<&str>
) -> Result<GetRoute, Error>
[src]

Show route to {id} for {msatoshi}, using {riskfactor} and optional {cltv} (default 9). If specified search from {fromid} otherwise use this node as source. Randomize the route with up to {fuzzpercent} (0.0 -> 100.0, default 5.0) using {seed} as an arbitrary-size string seed.

pub fn connect(&self, id: &str, host: Option<&str>) -> Result<Connect, Error>[src]

Connect to {id} at {host} (which can end in ':port' if not default). {id} can also be of the form id@host.

pub fn disconnect(&self, id: &str) -> Result<Disconnect, Error>[src]

Disconnect from peer with {peer_id}.

pub fn fundchannel(
    &self,
    id: &str,
    satoshi: AmountOrAll,
    feerate: Option<u64>
) -> Result<FundChannel, Error>
[src]

Fund a new channel with another lightning node.

Arguments

  • id - Id of node to fund a channel to
  • satoshi - either AmountOrAll::Amount(n) for a given amount in satoshi units, or AmountOrAll::All to spend all available funds
  • feerate - optional feerate to use for Bitcoin transaction

pub fn close(
    &self,
    id: &str,
    force: Option<bool>,
    timeout: Option<u64>
) -> Result<Close, Error>
[src]

Close the channel with {id} (either peer ID, channel ID, or short channel ID). If {force} (default false) is true, force a unilateral close after {timeout} seconds (default 30), otherwise just schedule a mutual close later and fail after timing out.

pub fn ping(
    &self,
    id: &str,
    len: Option<u64>,
    pongbytes: Option<u64>
) -> Result<Ping, Error>
[src]

Send {peerid} a ping of length {len} (default 128) asking for {pongbytes} (default 128).

pub fn listfunds(&self) -> Result<ListFunds, Error>[src]

Show available funds from the internal wallet.

pub fn withdraw(
    &self,
    destination: &str,
    satoshi: AmountOrAll,
    feerate: Option<u64>
) -> Result<Withdraw, Error>
[src]

Send to destination address via Bitcoin transaction.

Arguments

  • destination - Bitcoin address to send to
  • satoshi - either AmountOrAll::Amount(n) for a given amount in satoshi units, or AmountOrAll::All to spend all available funds
  • feerate - optional feerate to use for Bitcoin transaction

pub fn newaddr(&self, addresstype: Option<&str>) -> Result<NewAddr, Error>[src]

Get a new {bech32, p2sh-segwit} address to fund a channel (default is bech32).

pub fn stop(&self) -> Result<Stop, Error>[src]

Shut down the lightningd process.

Trait Implementations

impl Debug for LightningRPC[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.