Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: replace JSON-RPC by named parameters #894

Merged
merged 90 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
928f73d
integration tests: upgrade to bitcoin 0.17.1
sstone Dec 14, 2018
762e48d
Merge branch 'master' into use-bitcoin-0.17.1
sstone Feb 12, 2019
65bbab9
Bitcoin RPC: use `signrawtransactionwithwallet`
sstone Feb 12, 2019
e3cc72d
Merge branch 'master' into use-bitcoin-0.17.1
sstone Feb 25, 2019
3f8f328
Remove unused travis files
sstone Feb 25, 2019
fabd4d0
Merge branch 'master' into use-bitcoin-0.17.1
sstone Mar 2, 2019
e9fb058
Bitcoin Wallet: cleaner handling of signtransaction errors
sstone Mar 2, 2019
de83752
Check that bitcoind version is 0.17.0 or higher
sstone Mar 3, 2019
3151360
BitcoinCoreWallet: add signing tests with multiple bad inputs
sstone Mar 6, 2019
e52e385
Merge branch 'master' into use-bitcoin-0.17.1
sstone Mar 6, 2019
a752d65
BitcoinCoreWalletSpec: fix formatting issue
sstone Mar 6, 2019
e148fce
[WIP] Migrate to new API service
araspitzu Mar 11, 2019
6bad025
[WIP] wire new service to api socket
araspitzu Mar 11, 2019
134ceeb
Remove swakka
araspitzu Mar 11, 2019
2635e1d
[WIP] port to new service more 'calls'
araspitzu Mar 12, 2019
dd909bf
[WIP] port to new service allupdates calls
araspitzu Mar 12, 2019
848563b
[WIP] port to new service receive/parseinvoice/findroute/send
araspitzu Mar 12, 2019
8aebef5
[WIP] port to new service checkpayment/audit/networkfees/channelStats
araspitzu Mar 12, 2019
1e8c233
[WIP] port to new service the websocket
araspitzu Mar 12, 2019
528f195
[WIP] port to new service the http-basic auth
araspitzu Mar 12, 2019
514cc35
[WIP] port to new service reorg the exception handler to make it work…
araspitzu Mar 12, 2019
36da70e
Add configuration to enable the new APIs
araspitzu Mar 12, 2019
066634f
Use HTTP POST and formParams
araspitzu Mar 13, 2019
7908f5e
Use custom http headers in all API response
araspitzu Mar 13, 2019
af9a969
[WIP] fix eclair-cli to use the new APIs
araspitzu Mar 13, 2019
746a5da
Remove Json4s generic unmarshaller from scope
araspitzu Mar 13, 2019
3b20d1e
[WIP] Update eclair-cli
araspitzu Mar 13, 2019
8ba0e0a
Adjust eclair-cli for the new APIs, output the invoice for /receive e…
araspitzu Mar 13, 2019
1eedeb0
[WIP] eclair-cli
araspitzu Mar 13, 2019
cecb6bc
Fix help command in eclair-cli
araspitzu Mar 13, 2019
c9e573a
Improve error handling via rejections
araspitzu Mar 13, 2019
3b2df4b
Merge remote-tracking branch 'origin/master' into api_revamp
araspitzu Mar 14, 2019
d08ebb6
Rebase with master
araspitzu Mar 14, 2019
f662a6a
Merge branch 'master' into use-bitcoin-0.17.1
sstone Mar 14, 2019
31ce0c6
Fix transactions unit test
sstone Mar 14, 2019
305219d
Finish merging master
araspitzu Mar 14, 2019
837ac03
Accept shortChannelId in /close, finish porting the test from the pre…
araspitzu Mar 14, 2019
b52ba9c
Merge remote-tracking branch 'origin/use-bitcoin-0.17.1' into api_revamp
araspitzu Mar 14, 2019
5ff5042
Add mock file for /help
araspitzu Mar 14, 2019
ec10feb
Do not return Route(s) from the implementation of API methods, add te…
araspitzu Mar 15, 2019
53ec015
Separate Service and EclairApiImpl
araspitzu Mar 15, 2019
8c3d7d8
Fix ClassCastException when mapping the channels responses to ByteVec…
araspitzu Mar 15, 2019
72cf2e8
Re-enable output processing with JQ in eclair-cli
araspitzu Mar 15, 2019
7b6c020
Add ByteVector32 Serializer to JsonSupport scope
araspitzu Mar 15, 2019
1fe65f4
Move out /help from EclairApi
araspitzu Mar 15, 2019
8268e70
Rename config key and make new API enabled by default
araspitzu Mar 15, 2019
e8069d5
Fix usage of the deprecation config key (use-old-api)
araspitzu Mar 15, 2019
6884725
Rework getInfo parameter passing, update the mock for it
araspitzu Mar 15, 2019
9ecda96
Remove default case for non matched routes
araspitzu Mar 15, 2019
2ebec3b
Separate findRoute and send API to remove ambiguity (and improve erro…
araspitzu Mar 15, 2019
f2cea92
Use minFinalCltvExpiry from the invoice when sending a payment
araspitzu Mar 15, 2019
6ab9e03
Formatting
araspitzu Mar 15, 2019
1e79bd1
Timeout response not a json
araspitzu Mar 15, 2019
961bf3c
Remove custom rejections
araspitzu Mar 15, 2019
56f910c
Formatting commands in eclair-cli
araspitzu Mar 18, 2019
db15e2b
Revert "Merge remote-tracking branch 'origin/use-bitcoin-0.17.1' into…
araspitzu Mar 19, 2019
3e285d1
Merge branch 'master' into api_revamp
araspitzu Mar 19, 2019
bd02e8c
Add comment to MetaService
araspitzu Mar 19, 2019
f07741c
Renaming Service -> OldService, NewService -> Service
araspitzu Mar 22, 2019
7092989
Remove MetaService in favor of a shorter syntax
araspitzu Mar 22, 2019
8567979
Remove getInfo parameter from EclairApi, remove 'port' from GetInfoRe…
araspitzu Mar 22, 2019
3bf00fb
Rename EclairApi into Eclair and move it to root package
araspitzu Mar 22, 2019
26cc39e
Standardize method names (all lowercase)
araspitzu Mar 22, 2019
27c2c83
Updated eclair-cli to work with the revamped API
dpad85 Mar 22, 2019
1e15c92
Set blockHeight during test for getinfo
araspitzu Mar 22, 2019
6441590
Merge remote-tracking branch 'origin/api_revamp' into api_revamp
araspitzu Mar 22, 2019
7f63104
Include help response in eclair-cli
araspitzu Mar 22, 2019
7bf1cd8
Merge branch 'master' into api_revamp
araspitzu Mar 22, 2019
4787f0a
Remove 'help' method
araspitzu Mar 22, 2019
d6f2434
Support -h in eclair-cli
araspitzu Mar 22, 2019
6d5a25c
Encapsule errors in a JSON response
araspitzu Mar 22, 2019
e07e9f6
Rename named parameters for better readability
araspitzu Mar 22, 2019
9ca19bc
Rename EclairApiImpl to EclairImpl
araspitzu Mar 22, 2019
00b357a
Wip improving the help message in eclair-cli
dpad85 Mar 22, 2019
e663dbc
Use a mock Eclair in ApiServiceSpec
araspitzu Mar 25, 2019
f3715fd
Removed help, we will instead point to an online documentation
dpad85 Mar 25, 2019
2f37cdc
Formatting
araspitzu Mar 25, 2019
caa056e
Merge remote-tracking branch 'origin/api_revamp' into api_revamp
araspitzu Mar 25, 2019
9c9afe4
Fixed eclair cli error parsing, added commands to eclair cli completion
dpad85 Mar 25, 2019
0078d62
Update README for the new docs and the new api, move old doc in a sep…
araspitzu Mar 26, 2019
976cf16
Added short options to eclair-cli, and removed color option
dpad85 Mar 26, 2019
97e1d89
Add instructions to build/update the doc
araspitzu Mar 26, 2019
bc16315
Merge remote-tracking branch 'origin/api_revamp' into api_revamp
araspitzu Mar 26, 2019
ba63614
Remove writing-to-file part of the regression test for the API
araspitzu Mar 26, 2019
23c3515
Make 'port' optional when using 'connect' API
araspitzu Mar 26, 2019
550347d
Merge branch 'master' into api_revamp
araspitzu Mar 26, 2019
be86927
Merge with master
araspitzu Mar 26, 2019
a8070bb
Update README.md
pm47 Mar 26, 2019
7a94d3c
Correct JSON-RPC to JSON in README.md
araspitzu Mar 26, 2019
52d4be2
Merge remote-tracking branch 'origin/api_revamp' into api_revamp
araspitzu Mar 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ To only build the `eclair-node` module
$ mvn install -pl eclair-node -am -DskipTests
```

# Building the API documentation

## Slate

The API doc is generated via slate and hosted on github pages. To make a change and update the doc follow the steps:

1. git checkout slate-doc
2. Install your local dependencies for slate, more info [here](https://github.com/lord/slate#getting-started-with-slate)
3. Edit `source/index.html.md` and save your changes.
4. Commit all the changes to git, before deploying the repo should be clean.
5. Push your commit to remote.
6. Run `./deploy.sh`
7. Wait a few minutes and the doc should be updated at https://acinq.github.io/eclair
40 changes: 40 additions & 0 deletions OLD-API-DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## JSON-RPC API

:warning: Note this interface is being deprecated.

method | params | description
------------- |----------------------------------------------------------------------------------------|-----------------------------------------------------------
getinfo | | return basic node information (id, chain hash, current block height)
connect | nodeId, host, port | open a secure connection to a lightning node
connect | uri | open a secure connection to a lightning node
open | nodeId, fundingSatoshis, pushMsat = 0, feerateSatPerByte = ?, channelFlags = 0x01 | open a channel with another lightning node, by default push = 0, feerate for the funding tx targets 6 blocks, and channel is announced
updaterelayfee | channelId, feeBaseMsat, feeProportionalMillionths | update relay fee for payments going through this channel
peers | | list existing local peers
channels | | list existing local channels
channels | nodeId | list existing local channels opened with a particular nodeId
channel | channelId | retrieve detailed information about a given channel
channelstats | | retrieves statistics about channel usage (fees, number and average amount of payments)
allnodes | | list all known nodes
allchannels | | list all known channels
allupdates | | list all channels updates
allupdates | nodeId | list all channels updates for this nodeId
receive | description | generate a payment request without a required amount (can be useful for donations)
receive | amountMsat, description | generate a payment request for a given amount
receive | amountMsat, description, expirySeconds | generate a payment request for a given amount that expires after given number of seconds
parseinvoice | paymentRequest | returns node, amount and payment hash in a payment request
findroute | paymentRequest | returns nodes and channels of the route for this payment request if there is any
findroute | paymentRequest, amountMsat | returns nodes and channels of the route for this payment request and amount, if there is any
findroute | nodeId, amountMsat | returns nodes and channels of the route to the nodeId, if there is any
send | amountMsat, paymentHash, nodeId | send a payment to a lightning node
send | paymentRequest | send a payment to a lightning node using a BOLT11 payment request
send | paymentRequest, amountMsat | send a payment to a lightning node using a BOLT11 payment request and a custom amount
checkpayment | paymentHash | returns true if the payment has been received, false otherwise
checkpayment | paymentRequest | returns true if the payment has been received, false otherwise
close | channelId | close a channel
close | channelId, scriptPubKey | close a channel and send the funds to the given scriptPubKey
forceclose | channelId | force-close a channel by publishing the local commitment tx (careful: this is more expensive than a regular close and will incur a delay before funds are spendable)"
audit | | list all send/received/relayed payments
audit | from, to | list send/received/relayed payments in that interval (from <= timestamp < to)
networkfees | | list all network fees paid to the miners, by transaction
networkfees |from, to | list network fees paid to the miners, by transaction, in that interval (from <= timestamp < to)
help | | display available methods
44 changes: 6 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,44 +128,12 @@ Eclair uses [`logback`](https://logback.qos.ch) for logging. To use a different
java -Dlogback.configurationFile=/path/to/logback-custom.xml -jar eclair-node-gui-<version>-<commit_id>.jar
```

## JSON-RPC API

method | params | description
------------- |----------------------------------------------------------------------------------------|-----------------------------------------------------------
getinfo | | return basic node information (id, chain hash, current block height)
connect | nodeId, host, port | open a secure connection to a lightning node
connect | uri | open a secure connection to a lightning node
open | nodeId, fundingSatoshis, pushMsat = 0, feerateSatPerByte = ?, channelFlags = 0x01 | open a channel with another lightning node, by default push = 0, feerate for the funding tx targets 6 blocks, and channel is announced
updaterelayfee | channelId, feeBaseMsat, feeProportionalMillionths | update relay fee for payments going through this channel
peers | | list existing local peers
channels | | list existing local channels
channels | nodeId | list existing local channels opened with a particular nodeId
channel | channelId | retrieve detailed information about a given channel
channelstats | | retrieves statistics about channel usage (fees, number and average amount of payments)
allnodes | | list all known nodes
allchannels | | list all known channels
allupdates | | list all channels updates
allupdates | nodeId | list all channels updates for this nodeId
receive | description | generate a payment request without a required amount (can be useful for donations)
receive | amountMsat, description | generate a payment request for a given amount
receive | amountMsat, description, expirySeconds | generate a payment request for a given amount that expires after given number of seconds
parseinvoice | paymentRequest | returns node, amount and payment hash in a payment request
findroute | paymentRequest | returns nodes and channels of the route for this payment request if there is any
findroute | paymentRequest, amountMsat | returns nodes and channels of the route for this payment request and amount, if there is any
findroute | nodeId, amountMsat | returns nodes and channels of the route to the nodeId, if there is any
send | amountMsat, paymentHash, nodeId | send a payment to a lightning node
send | paymentRequest | send a payment to a lightning node using a BOLT11 payment request
send | paymentRequest, amountMsat | send a payment to a lightning node using a BOLT11 payment request and a custom amount
checkpayment | paymentHash | returns true if the payment has been received, false otherwise
checkpayment | paymentRequest | returns true if the payment has been received, false otherwise
close | channelId | close a channel
close | channelId, scriptPubKey | close a channel and send the funds to the given scriptPubKey
forceclose | channelId | force-close a channel by publishing the local commitment tx (careful: this is more expensive than a regular close and will incur a delay before funds are spendable)"
audit | | list all send/received/relayed payments
audit | from, to | list send/received/relayed payments in that interval (from <= timestamp < to)
networkfees | | list all network fees paid to the miners, by transaction
networkfees |from, to | list network fees paid to the miners, by transaction, in that interval (from <= timestamp < to)
help | | display available methods
## JSON API

Eclair offers a feature rich HTTP API that enables application developers to easily integrate, for the full documentation please visit
the [website](https://acinq.github.io/eclair). If you are still using the old APIs and looking for documentation you can find it [here](https://github.com/ACINQ/eclair/OLD-API-DOCS.md)
but is not maintained anymore.


## Docker

Expand Down
2 changes: 1 addition & 1 deletion contrib/eclair-cli.bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _eclair-cli()
*)
# works fine, but is too slow at the moment.
# allopts=$($eclaircli help 2>&1 | awk '$1 ~ /^"/ { sub(/,/, ""); print $1}' | sed 's/[":]//g')
allopts="connect open peers channels channel allnodes allchannels allupdates receive send close audit findroute updaterelayfee parseinvoice forceclose networkfees channelstats checkpayment getinfo help"
allopts="getinfo connect open close forceclose updaterelayfee peers channels channel allnodes allchannels allupdates receive parseinvoice findroute findroutetonode send sendtonode checkpayment audit networkfees channelstats"

if ! [[ " $allopts " =~ " $prev " ]]; then # prevent double arguments
if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then
Expand Down
Loading