Utility library for calculating routes and routing tables in Interledger
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/lib
test
.eslintrc
.gitignore
CONTRIBUTING.md
LICENSE
README.md
circle.yml
index.js
npmrc-env
package.json

README.md

ilp-routing

ILP routing table implementation

npm circle codecov

API Reference

Route

RouteData refers to the Routes schema 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