https://github.com/interledger-deprecated/ilp-routing
Utility library for calculating routes and routing tables in Interledger
https://github.com/interledger-deprecated/ilp-routing
Last synced: 5 months ago
JSON representation
Utility library for calculating routes and routing tables in Interledger
- Host: GitHub
- URL: https://github.com/interledger-deprecated/ilp-routing
- Owner: interledger-deprecated
- License: other
- Created: 2016-04-02T17:38:40.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-11T23:51:51.000Z (almost 9 years ago)
- Last Synced: 2025-08-09T06:29:31.931Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 146 KB
- Stars: 2
- Watchers: 5
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ilp-routing
> ILP routing table implementation
[![npm][npm-image]][npm-url] [![circle][circle-image]][circle-url] [![codecov][codecov-image]][codecov-url]
[npm-image]: https://img.shields.io/npm/v/ilp-routing.svg?style=flat
[npm-url]: https://npmjs.org/package/ilp-routing
[circle-image]: https://circleci.com/gh/interledgerjs/ilp-routing.svg?style=shield
[circle-url]: https://circleci.com/gh/interledgerjs/ilp-routing
[codecov-image]: https://codecov.io/gh/interledgerjs/ilp-routing/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/interledgerjs/ilp-routing
## API Reference
### Route
`RouteData` refers to the [Routes schema](https://github.com/interledgerjs/five-bells-shared/blob/master/schemas/Routes.json) in five-bells-shared.
#### `new Route(curve, hops, info)`
#### `Route.fromData(routeData) ⇒ Route`
#### `route.getPoints(y) ⇒ Point[]`
#### `route.combine(alternateRoute) ⇒ Route`
Combine two parallel routes, generating a new curve consisting of the best segments of each.
#### `route.join(tailRoute) ⇒ Route`
Compose two routes end-to-end: `A→B.join(B→C)` becomes `A→C`.
#### `route.shiftX(dx) ⇒ Route`
Shift a route's curve left or right.
#### `route.shiftY(dy) ⇒ Route`
Shift a route's curve up or down.
#### `route.simplify(maxPoints) ⇒ Route`
Simplify a route.
#### `route.isExpired() ⇒ Boolean`
Check if a route has expired.
#### `route.toJSON() ⇒ RouteData`
### RoutingTables
#### `new RoutingTables(baseURI, localRoutes, expiryDuration)`
#### `tables.addLocalRoutes(localRouteObjects)`
#### `tables.addRoute(routeObject) ⇒ Boolean`
Returns whether or not a new route was created (updates don't count).
#### `tables.removeLedger(ledger)`
#### `tables.removeExpiredRoutes()`
#### `tables.toJSON(maxPoints) ⇒ RouteData[]`
#### `tables.getLocalRoute(ledgerA, ledgerB) ⇒ Route`
#### `tables.findBestHopForDestinationAmount(ledgerA, ledgerC, finalAmount) ⇒ Hop`
#### `tables.findBestHopForSourceAmount(ledgerA, ledgerC, sourceAmount) ⇒ Hop`