ilp-core
Core ILP module — handles ledger abstraction and quoting
Installation
You need to install this module along with any ledger plugin modules you would like to use, e.g.:
npm install --save ilp-core ilp-plugin-bells
Usage
Setup
const Client = Clientconst Core = Coreconst core =// options for the plugin that Client instantiates.// '_plugin' is the plugin module.const pluginOpts =_plugin:prefix: 'ilpdemo.red.'account: 'https://red.ilpdemo.org/ledger/accounts/alice'password: 'alice'// It is optional to specify clientOpts. It has one field, connectors, which// contains http endpoints for the connectors you wish to use.// These http addresses are used for quoting and getting ILP address information.// If unspecified, Client will get connectors from the plugin's 'getInfo' method.const clientOpts =connectors:'https://a.example:4000''https://b.example:4040''https://c.example:5555''https://d.example:4000'corecore
Sending a Payment
const payment =destinationAccount: 'ilpdemo.blue.bob'destinationAmount: '1'destinationMemo:myKey: 'myValue'executionCondition: 'uzoYx3K6u-Nt6kZjbN6KmH0yARfhkj9e17eQfpSeB7U'expiresAt: Date + 10000const client = coreclientcore
Receiving a Transfer
Note that the receive
event is fired for conditional transfers, so the event does not necessarily indicate that funds have been transferred
core