Giter Site home page Giter Site logo

pinkdiamond1 / ilp-plugin-virtual Goto Github PK

View Code? Open in Web Editor NEW

This project forked from interledger-deprecated/ilp-plugin-virtual

0.0 0.0 0.0 390 KB

ILP virtual ledger plugin for directly transacting connectors

License: Other

JavaScript 100.00%

ilp-plugin-virtual's Introduction

ilp-plugin-virtual npm circle codecov

ILP virtual ledger plugin for directly transacting connectors

NOTE:

The current version of ilp-plugin-virtual is designed to be used in ILP Kit. An HTTP server is required in order to pass RPC calls to the plugin, and to perform authorization on RPC calls.

Installation

npm install --save ilp-plugin-virtual

Usage

You can test out the ledger plugin by running npm test on your machine. To include debug information during the test, run DEBUG=ilp* npm test.

When instantiating the plugin, make sure to pass in an object with the right fields:

{
  "maxBalance": "highest balance allowed",
  "prefix": "prefix for ilp address",
  "secret": "your secret. your peer must know the corresponding public key.",
  "peerPublicKey": "base64url encoded public key of your peer",
  "rpcUri": "https://example.com/rpc", // this is used to communicate with your peer (see below)
  "_store": { /* this object will be created by the connector */ },
  "info": { /* the object to be returned by getInfo */ }
}

Receiving RPC calls

In order to use plugin virtual, you need an HTTP endpoint that passes calls to the plugin. The url must take one query parameter (method), as well as a JSON body. The method parameter and parsed body must be passed to the plugin like so:

plugin.receive(method, body)

Generate a trustline prefix

If you want to generate a trustline prefix from a secret key, peer's public key, and currency, you can access the method through the token class:

const Token = require('ilp-plugin-virtual/src/util/token')
const prefix = Token.prefix({
  secretKey: 'o9Lt0oZFek1ArM_A0HUAq8M8edRuoSeLjX8i10sVUiY',
  peerPublicKey: 'KRixgcBCBdyQln7IBYiopjuNO78QSFtXgOwP1sbsCSk',
  currency: 'USD'
})

ilp-plugin-virtual's People

Contributors

adrianhopebailie avatar emschwartz avatar greenkeeperio-bot avatar justmoon avatar michielbdejong avatar sentientwaffle avatar sharafian avatar vhpoet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.