diff --git a/doc/API.v0.md b/doc/API.v0.md index ef8ef32..f7a0f76 100644 --- a/doc/API.v0.md +++ b/doc/API.v0.md @@ -1172,6 +1172,136 @@ Proxy response: } ``` +### Get list of funds in unused outputs and channels from c-lightning + +Calls listfunds from lightningd. Returns the list of unused outputs and funds in open channels + +```http +GET http://cyphernode:8888/ln_listfunds +``` +Proxy response: +```json +{ + outputs: [ + { + txid: 'd3a536efaa706716458528adf576a5831230031119944e80bc8f349a3c326b79', + output: 0, + value: 9551, + amount_msat: '9551000msat', + address: 'tb1qq0q9ass8cufr3y8cs9zqjslpt55tparj9kqze0', + status: 'confirmed', + blockheight: 1715749 + }, + { + ... + } + ], + channels: [ + { + peer_id: '03f60f7369dd4dcff6a13d401b159e0bfc6aca34f05a93a8a897b75c7940a55bb9', + connected: true, + state: 'CHANNELD_NORMAL', + short_channel_id: '1667122x240x0', + channel_sat: 100000, + our_amount_msat: '100000000msat', + channel_total_sat: 100000, + amount_msat: '100000000msat', + funding_txid: '53cf8cd87fc0250954887afe84758b9ffd512f0c623083100c41c2e2b17887b3', + funding_output: 0 + }, + { + ... + } +] +``` +### Get the list of payments made by our node + +Calls listpays from lightningd. Returns history of paid invoices + +```http +GET http://cyphernode:8888/ln_listpays +``` + +Proxy response: + +```json +{ + 'pays': +[ + { + bolt11: 'lntb10n1p0xjw9q.... +tlt0dfszcrlkv26swnt85pkwumkfmgaal8sa2awj2adajuzy82e0v6x8cqpzr2t8a', + status: 'complete', preimage: '1127e1fdb....54cc180e3d7', + amount_sent_msat: '1000msat' + }, + { +...} + +] +} +``` + +### Get an array of nodes that represent a possible route from our node to a given node for a given msatoshi payment amount + +Calls getroute from lightningd. Returns the list of unused outputs and funds in open channels + +```http +GET http://cyphernode:8888/ln_getroute/// +GET http://cyphernode:8888/ln_getroute/0308dbd05278e5802dd36436a41b226824283526eb14a08d334cbbc878243b243c@ln.sifir.io/10000 +GET http://cyphernode:8888/ln_getroute/0308dbd05278e5802dd36436a41b226824283526eb14a08d334cbbc878243b243c@ln.sifir.io/10000/.2 +``` +Proxy response: + +```json +{ route : [ + { + id: '03d5e17a3c213fe490e1b0c389f8cfcfcea08a29717d50a9f453735e0ab2a7c003', + channel: '1669002x86x0', + direction: 0, + msatoshi: 21000, + amount_msat: '21000msat', + delay: 64, + style: 'tlv' + }, + { + id: '038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9', + channel: '1666593x247x1', + direction: 1, + msatoshi: 21000, + amount_msat: '21000msat', + delay: 49, + style: 'tlv' + }, + { + id: '03b4e78b999c4ff29508c5889f51852d9d5f04eae1e829e54010d26b49628b953f', + channel: '1607984x3x1', + direction: 0, + msatoshi: 20000, + amount_msat: '20000msat', + delay: 9, + style: 'tlv' + } +] +} +``` + +### Withdraw funds (outputs) from Lightning to an address of choice + +Calls withdraw from lightningd with address and payment parameters supplied. Returns the transaction as confirmation +Feerate can be any of: 'normal', 'urgent', 'slow', defaults to 'normal' +satoshi: can be either a 8 decimal digit representing the amount in BTC or an integer to represent the amount to withdraw in SATOSHI +all: defaults to false but if set as 'true' will withdraw all funds in the lightning wallet. +```http +POST http://192.168.111.152:8080/ln_withdraw +BODY {"destination":"bc1.....xxx","satoshi":"100000","feerate":"normal",all: false} +``` +Proxy response: +```json +{ + tx: '0200000....7b0f4da35a2e5640e8c625138558093e76b427ba44bc92657238c63012103832d29fb65ebb2a8b48250797a5abf0e0199411e302098b4f3635e68d4e4fee800000000', + txid: '6b38....b0c3b' +} +``` ### Stamp a hash on the Bitcoin blockchain using OTS (called by application) Will stamp the supplied hash to the Bitcoin blockchain using OTS. Cyphernode will curl the callback when the OTS stamping is complete.