Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

interblockchain-validator-lib

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interblockchain-validator-lib

**Interblockchain Validator Lib**

  • 0.0.22
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Interblockchain Validator Lib

Responsibility

This library regroup common business logic used by many other interblockchain services.

Those other service are among others:

  • Client Move Token (Transfer)
  • Client Move Token (Auditor)
  • Payment processing
  • Reconciliator

Basically this library allow each client to

  1. Connect to augmented node
  2. Watch confirmation on different network
  3. Get wether a transaction or transfer request is valid following the interblockchain rule

Build

You can build 2 versions of this library one for node and the other for the browser

Browser

Run npm run build:browser

This will produce a single js file called validator-lib.js in in the browser folder

Node

Run npm run build

This will produce many file in the dist folder which can then be imported in your node project

Note: Your project is not forced to use typescript to use this artifact

Usage

Browser

const validatorLib = require('@interblockchain/validation/browser')

const wp = new validatorLib.WatcherProxy() // Proxied Watcher proxy
const validator = new validatorLib.Validator(wp)

Server

const validatorLib = require('@interblockchain/validation')

const wp = new validatorLib.WatcherProxy() // Standard Watcher proxy
const validator = new validatorLib.Validator(wp)

Core concept

Watcher proxy The watcher proxy responsibility is to abstract the connexion to augmented node

A watcher proxy manage the connexions to the augmented node and offer a reliable way of dealing with it It can also abstract other mecanism such as augmented node server routing (If we want to use different one) or caching

This library contains three implementation of watcher proxy

Proxied watcher proxy

This implementation is intended to be use on the browser side as it is fully compatible with it. In order to be use in the browser in make use of the websocket proxy

Standard watcher proxy

This implementation is a node/electron one it is driven by the ws library and can't be use on the browser But it offers a direct connexion whereas the proxied watcher proxy can't.

This implementation is preferable to the proxied one

Mock watcher proxy This implemented is intended for testing purpose it will emultate the augmented node behavior and don't require any connexion to it

The watcher proxy also as a concept of decorator which can add behavior to any of the implementation above

Cached watcher proxy

This decorator will take care of reusing the same event stream for identical request, by default this behavior is not enforced by any implementation

Combined watcher proxy

This decorator allow to combine multiple instance of watcher proxy and route to different watcher proxy depending on a predicate.

This is useful to abstract this routing logic.

Validator

The validator class is the one that encapsulate all the interblockchain business logic with regards to Transfer Request validation and Transaction validation

The validator use a watcher proxy to connect to the augmented node and produce a stream of TransferRequest or AddressValidation depending on it's task

It also manage timeout duration and unsubscription to augmented node

Basically as a client you simply create a watcher proxy and you pass it as a prameter to your validator. Then you call validate/validateSingleTransaction on the validator instance and you will receive a stream of TransferRequest object that give you detailed insight on the state on the transfer request

This data include if the transfer request is completed or valid in the interblockchain sens, also you can access all the information related to the transfer request

FAQs

Package last updated on 28 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc