{"id":13683772,"url":"https://github.com/interledgerjs/ilp","last_synced_at":"2025-05-05T20:43:46.541Z","repository":{"id":57271836,"uuid":"59520462","full_name":"interledgerjs/ilp","owner":"interledgerjs","description":"ILP client for browsers/Node.js","archived":false,"fork":false,"pushed_at":"2018-10-19T21:01:34.000Z","size":750,"stargazers_count":127,"open_issues_count":4,"forks_count":22,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-18T18:34:16.072Z","etag":null,"topics":["ilp","interledger","ipr","payment-request","psk","spsp"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interledgerjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-23T21:44:52.000Z","updated_at":"2025-01-08T13:43:27.000Z","dependencies_parsed_at":"2022-09-11T13:04:38.317Z","dependency_job_id":null,"html_url":"https://github.com/interledgerjs/ilp","commit_stats":null,"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Filp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interledgerjs","download_url":"https://codeload.github.com/interledgerjs/ilp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252573721,"owners_count":21770271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ilp","interledger","ipr","payment-request","psk","spsp"],"created_at":"2024-08-02T13:02:32.005Z","updated_at":"2025-05-05T20:43:46.522Z","avatar_url":"https://github.com/interledgerjs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://interledger.org\"\u003e\u003cimg src=\"ilp_logo.png\" width=\"150\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  ILP\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\nThe Javascript client library for \u003ca href=\"https://interledger.org\"\u003eInterledger\u003c/a\u003e\n\u003c/h4\u003e\n\n\u003cbr\u003e\n\n[![npm][npm-image]][npm-url] [![standard][standard-image]][standard-url] [![circle][circle-image]][circle-url] [![codecov][codecov-image]][codecov-url] [![snyk][snyk-image]][snyk-url]\n\n[npm-image]: https://img.shields.io/npm/v/ilp.svg?style=flat\n[npm-url]: https://npmjs.org/package/ilp\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat\n[standard-url]: http://standardjs.com/\n[circle-image]: https://img.shields.io/circleci/project/interledgerjs/ilp/master.svg?style=flat\n[circle-url]: https://circleci.com/gh/interledgerjs/ilp\n[codecov-image]: https://img.shields.io/codecov/c/github/interledgerjs/ilp.svg?style=flat\n[codecov-url]: https://codecov.io/gh/interledgerjs/ilp\n[snyk-image]: https://snyk.io/test/npm/ilp/badge.svg\n[snyk-url]: https://snyk.io/test/npm/ilp\n\n#### The ILP module includes:\n\n* [Simple Payment Setup Protocol (SPSP)](#simple-payment-setup-protocol-spsp), a higher level interface for sending ILP payments, which requires the receiver to have an SPSP server.\n* [Interledger Dynamic Configuration Protocol (ILDCP)](#interledger-dynamic-configuration-protocol-ildcp), a protocol for exchanging configuration between nodes.\n* [STREAM](#stream), the recommended Transport Protocol to use for most Interledger applications.\n* [createLogger](#create-logger), a function to create a name spaced logger.\n* [createMiddleware](#create-middleware), a function to create server middleware for an SPSP receiver.\n* [createPlugin](#create-plugin), a function to get an ILP plugin from the environment or testnet.\n* [receive](#receive), a function to create an invoice representing a handle to a STREAM server waiting to receive a specific amount.\n* [pay](#pay), a function to make a STREAM payment to either a Payment Pointer or an ILP Address using appropriate shared secret.\n\n## Installation\n\n`npm install --save ilp`\n\n*Note that [ilp plugins](https://www.npmjs.com/search?q=ilp-plugin) must be installed alongside this module unless you simply use BTP*\n\n## Create Plugin\n\nUsing `ilp.createPlugin` is an alias for the deprecated `ilp-plugin` module. It creates an instance of a BTP plugin that will attempt to connect to a local `moneyd` instance by default. This can be overridden using environment variables.\n\nThe module looks for `ILP_PLUGIN_OPTIONS` (or `ILP_CREDENTIALS` however this is deprecated) and `ILP_PLUGIN`. `ILP_PLUGIN_OPTIONS` must contain a JSON object and will be passed into the constructor of a new plugin instance. The name of the plugin type to instantiate must be stored as a string in the environment variable `ILP_PLUGIN` or it will default to `ilp-plugin-btp`.\n\nBy default (i.e. `ILP_PLUGIN_OPTIONS` and `ILP_PLUGIN` are not set), a random secret will be generated and a new instance of `ilp-plugin-btp` will be configured to connect to btp+ws:\u003csecret\u003e//localhost:7768.\n\n## [Simple Payment Setup Protocol (SPSP)](https://interledger.org/rfcs/0009-simple-payment-setup-protocol/draft-6.html)\n\nIf you are sending to an SPSPv4 receiver using a [Payment Pointer](https://interledger.org/rfcs/0026-payment-pointers), the SPSP module provides a high-level interface to `pay` and `query` the server:\n\n```js\n'use strict'\n\nconst ilp = require('ilp')\n\n;(async function () {\n  await ilp.SPSP.pay(ilp.createPlugin(), {\n    receiver: '$bob.example.com',\n    sourceAmount: '1000'\n  })\n})()\n```\n\n`ilp.SPSP` replaces the deprecated `ilp-protocol-spsp` module and no longer supports payments to servers using PSK2. Only responses from an SPSP server with the content-type of `application/spsp4+json` are accepted.\n\n### Create Middleware\n\nThe `ilp` module provides conveniences functions to create server middleware that can be used to host an SPSP endpoint for receiving payments.\n\nExpress example:\n```js\n const ilp = require('ilp')\n const app = require('express')()\n\n ;(async () =\u003e {\n  const spsp = await ilp.express.createMiddleware({receiver_info:{name: 'Bob Smith'}})\n  app.get('/.well-known/pay', spsp)\n  app.listen(3000)\n })()\n\n```\n\nKOA and HAPI support to come...\n\n## [Interledger Dynamic Configuration Protocol (ILDCP)](https://github.com/interledger/rfcs/blob/master/0031-dynamic-configuration-protocol/0031-dynamic-configuration-protocol.md)\n\nThe ILDCP module allows clients to get their configured address, asset and scale from an upstream parent connector.\n\n```js\n'use strict'\n\nconst ilp = require('ilp')\n\n;(async function () {\n  const plugin = ilp.createPlugin()\n  await plugin.connect()\n  const { clientAddress, assetScale, assetCode } = await ilp.ILDCP.fetch(plugin.sendData.bind(plugin))\n  console.log(`Plugin connected and configured with address ${clientAddress} using asset ${assetCode} and scale ${assetScale}`)\n})()\n```\n\n## [STREAM](https://interledger.org/rfcs/0029-stream/)\n\nThe STREAM module provides an API to use the STREAM protocol to send and receive payments. STREAM is the recommended transport protocol for use with ILP.\n\nThe `ilp` module provides two abstractions over this module that make it simple to send and receive payments.\n\n### Receive\n\n`receive` creates an instance of a STREAM server wrapped around a given plugin (or calls `createPlugin` if none is provided). It returns an `Invoice` object which has an `address` and `secret` that can be shared with a sender, and a `receivePayment()` method to wait for the incoming payment.\n\n### Pay\n\n`pay` will either pay a valid SPSP receiver or an ILP address (assuming there is a STREAM server waiting for connections at that address).\n\nTo pay using an SPSP receiver, pass the payment pointer as the payee in the form of a string:\n\n```js\n'use strict'\n\nconst ilp = require('ilp')\n\n;(async function () {\n  await ilp.pay(100, '$bob.example.com')\n})()\n```\n\nTo pay using a given ILP Address and shared secret pass these in as an object:\n\n```js\n'use strict'\n\nconst ilp = require('ilp')\n\n;(async function () {\n  await ilp.pay(100, { destinationAccount: 'g.bob.1234', sharedSecret: Buffer.from('******', 'base64') })\n})()\n```\n\nExamples are provided in [`example.js`](./example.js).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledgerjs%2Filp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterledgerjs%2Filp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledgerjs%2Filp/lists"}