Interledger (ILP) JavaScript Ledger plug-in interface version 2__java

Source: Internet
Author: User
Tags value store
JavaScript Ledger Plug-in interface version 2

The Interledger protocol is a suite of protocols that are used to pay across multiple different settlement systems.

The specification defines a JavaScript ledger abstraction interface for Interledger clients and connectors for communication and routing payments across different ledger protocols. Although the exact methods and events defined here are specific to JavaScript implementations, it can be used as a guide to ledger abstraction in other languages.

To send a ILP payment through a new ledger, a ledger plug-in must be implemented, which exposes the following defined interfaces. This can be used with ILP clients and connectors and should be used directly.

This specification depends on the ILP specification. class: Ledgerplugin

Class Ledgerplugin Method

name
New Ledgerplugin (OPTS,API)
Connect (options) ⇒promise.<undefined>
Disconnect () ⇒promise.<undefined>
IsConnected () ⇒boolean
SendData (Options) ⇒promise.<buffer>
Sendmoney (amount) ⇒promise.<undefined>
Registerdatahandler (DataHandler) ⇒undefined
Deregisterdatahandler () ⇒undefined
Registermoneyhandler (Moneyhandler) ⇒undefined
Deregistermoneyhandler () ⇒undefined
Constants
name
Static Version = 2
Activities
name Processor
Connect () ⇒
Connect () ⇒
Error () ⇒
Instance Management the new Ledgerplugin

New Ledgerplugin (Opts:object, API?: pluginservices)

Creates a new instance of a plug-in. Each instance usually corresponds to a different ledger. However, some plug-ins may deviate from a strict one-to-one relationship and may act as a virtual connector for more than one opponent internally.

The first parameter, opts, is a configuration object whose shape is unique to each plug-in. Plug-ins are typically configured through environment variables, so it is recommended that opts should use JSON serialization. However, Plug-ins may use a value that is not serializable to provide advanced functionality.

The second parameter API is optional, which is used to pass an additional ambient service to a plug-in, such as a logger or key-value store. Most plug-ins should work, even if this parameter is undefined, but may provide less functionality (for example, no persistence).

Invalidfieldserror throws a opts if the constructor is given an incorrect argument. Throws TypeError if OPTs is not an object or is defined by an API instead of an object. Throw Invalidserviceserror If service is required, but does not provide through API. Parameters

name type Description
OPTS Pluginoptions An object that contains ledger-related settings. May contain plug-in-specific fields.
cases
const ledgerplugin = new Ledgerplugin ({//AUTH parameters are defined by Plug-ins _store: {//May require some ledger plug-ins for persistence internal Use///(for example, when there is a reduced standby in the system Forget recording function, we can only put the value under the Memo (ID)//Storage key: (Key,value) => {//return promise. <undefined>}, Get: (key) => {//return promise. <Object>},//Press to delete a value del: (
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.