JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q36166F
  • License ISC

> A generic handle to ILP

Package Exports

  • ilp-plugin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ilp-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ILP Plugin

A generic handle to ILP

The script below (also in ./examples/info.js) will magically get ILP credentials with no setup whatsoever. Set DEBUG=* node ./examples/info.js to see behind the scenes.

const plugin = require('ilp-plugin')()

async function run () {
  await plugin.connect()
  console.log("Got plugin with info:", plugin.getInfo())
  console.log("Got balance:", await plugin.getBalance())
  process.exit(0)
}

run()

First, the script checks whether ILP_CREDENTIALS is defined in the environment. ILP_CREDENTIALS must contain a JSON object with the options passed into the constructor of ilp-plugin-xrp-escrow or the module name in ILP_PLUGIN. If you want to acquire testnet credentials and load them into your environment, try this script.

If ILP_CREDENTIALS is not defined, the existence of ./.ilprc.json is checked. If it exists, it will be loaded and the module name in the plugin field will be required. The options in credentials are passed into this constructor, and the resultant plugin is returned.

If ./.ilprc.json does not exist, ~/.ilprc.json is checked in the same way.

If none of these is specified, the plugin will ask the XRP test net faucet for some XRP credentials. On connection of the returned plugin, the faucet is queried and the results are stored in ~/.ilprc.json. The connect function will resolve when the faucet completes account setup. From that point on, the plugin is an ordinary instance of ilp-plugin-xrp-escrow.