npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

interblockchain-validator-lib

v0.0.22

Published

**Interblockchain Validator Lib**

Downloads

1

Readme

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