Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Sharafian
authored and
dappelt
committed
Mar 7, 2018
1 parent
55e11fe
commit 933c038
Showing
11 changed files
with
2,735 additions
and
2,270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/node_modules/ | ||
/coverage/ | ||
/.nyc_output/ | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,52 @@ | ||
# ilp-plugin-xrp-paychan | ||
|
||
Uses payment channels on ripple to do fast ILP transactions between you and a | ||
peer. Current in-flight payments are at risk (your peer can choose not to give | ||
you claims for them), but if the amount in-flight exceeds your `inFlightLimit`, | ||
you won't acknowledge incoming transfers until you're paid. | ||
peer. Current in-flight payments are at risk (your peer can choose not to give | ||
you claims for them), but are secured against the ledger as soon as you get a | ||
claim. | ||
|
||
**Warning: This plugin is still in a development state, and should not be used with | ||
live accounts.** | ||
**Warning: This plugin is still in a development state.** | ||
|
||
# Example | ||
|
||
This is how to instantiate a plugin: | ||
|
||
```js | ||
const PluginRipple = require('ilp-plugin-xrp-paychan') | ||
const PluginXrpPaychan = require('ilp-plugin-xrp-paychan') | ||
const Store = require('ilp-plugin-payment-channel-framework/test/helpers/objStore') | ||
|
||
const plugin = new PluginRipple({ | ||
// This is the server that ripple-lib submits transactions to. You can | ||
// configure this to point at the altnet or to point at the live net. | ||
rippledServer: 'wss://s.altnet.rippletest.net:51233', | ||
const plugin = new PluginXrpPaychan({ | ||
|
||
// Your ripple address and secret | ||
address: 'r33L6z6LMD8Lk39iEQhyXeSWqNN7pFVaM6', | ||
secret: 'ssyFYib1wv4tKrYfQEARxGREH6T3b', | ||
// If you want your peer to connect to you as a ws client (which doesn't | ||
// change the nature of the liquidity relationship) set the `listener` | ||
// argument in the constructor. | ||
listener: { | ||
port: 666, | ||
secret: 'its_a_secret' // this is the token that your peer must authenticate with. | ||
}, | ||
|
||
// The peer you want to start a payment channel with | ||
peerAddress: 'rhxcezvTxiANA3TkxBWpx923M5zQ4RZ9gJ', | ||
// If you wish to connect to your peer as a ws client, specify the server option. | ||
// You may specify both the server and client options; in that case it is not deterministic | ||
// which peer will end up as the ws client. | ||
server: 'btp+ws://:its_a_secret@localhost:666', | ||
|
||
// limit of how much can be owed in-flight to you at once before you stop | ||
// accepting more incoming transfers. (in XRP drops) | ||
maxUnsecured: '50000', | ||
// Specify the server that you submit XRP transactions to. | ||
xrpServer: 'wss://s.altnet.rippletest.net:51233', | ||
|
||
// how much to fund your payment channel. (in XRP drops) | ||
maxAmount: '10000000', | ||
// XRP address and secret | ||
secret: 's...', | ||
address: 'r...', | ||
|
||
// highest balance allowed | ||
maxBalance: 'Infinity', | ||
// Peer's XRP address | ||
peerAddress: 'r...', | ||
|
||
// Our peer's BTP server address. | ||
server: 'btp+ws://alice:password@mypeer.example', | ||
|
||
// store is used to keep local state, which is necessary because the plugin | ||
// works based on off-chain payment channel claims. `get`, `put`, and `del` | ||
// are asynchronous functions for accessing a key-value store. See | ||
// https://github.com/interledger/rfcs/blob/master/0004-ledger-plugin-interface/0004-ledger-plugin-interface.md#class-pluginoptions | ||
// Store in which to save claims and channel details. This will be passed in | ||
// automatically if you're using the ILP connector. | ||
_store: new Store() | ||
}) | ||
|
||
plugin.connect().then(() => { | ||
// do something with your plugin | ||
return plugin.sendData(/* ... */) | ||
}) | ||
``` | ||
|
||
For an example of how to send a payment refer to [examples/send-payment.js](https://github.com/ripple/ilp-plugin-xrp-paychan/blob/master/examples/send-payment.js). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ machine: | |
services: | ||
- docker | ||
node: | ||
version: 7.7.1 | ||
version: 8.9.4 | ||
|
||
dependencies: | ||
pre: | ||
|
Oops, something went wrong.