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

@proyecto-didi/didi-blockchain-manager

v3.0.0

Published

Project to abstract the use of multiblockains in DIDI project

Downloads

12

Readme

Blockchain manager

This library is intented to support multiblockchain configuration for the functionalities provided by uPort libraries (here). Based on the received DID and its prefix, it will select the blockchain to connect and support the uPort functions. Below there is a description of how to implement it.

Class Name

BlockchainManagerConfig

Parameters to instanciate the class

The class takes three parameters:

  • config: An object containing: { gasPrice: number, providerConfig: { object: PROVIDER_CONFIG} }
  • gasSafetyValue: A safety value to increment the gas to prevent the estimation getting short (type number)
  • gasPriceSafetyValue: A safety value to increment the gas price for the same reason (type number)

gasPrice: It's the gas price. For testing purposes a value of 10000 can be safely used.

providerConfig: It's a JSON object containing the network configurations to use when receiving the DID. The DIDs follow certain format and it should look like this:

did:ethr:0x0d0fa2cd3813412e94597103dbf715c7afb8c038
The above DID will route to the variable specified in mainnet

did:ethr:lacchain:0x0d0fa2cd3813412e94597103dbf715c7afb8c038
The above DID will route to the variable specified in lacchain

The providerConfig JSON must be similar to this:

PROVIDER_CONFIG = {
  networks: [
    { 
      name: 'mainnet', 
      rpcUrl: BLOCKCHAIN_URL_MAIN, 
      registry: BLOCKCHAIN_CONTRACT_MAIN
    },
    {
      name: 'lacchain',
      rpcUrl: BLOCKCHAIN_URL_LAC,
      registry: BLOCKCHAIN_CONTRACT_LAC
    },
    {
      name: 'bfa',
      rpcUrl: BLOCKCHAIN_URL_BFA,
      registry: BLOCKCHAIN_CONTRACT_BFA
    },
    {
      name: 'rsk',
      rpcUrl: BLOCKCHAIN_URL_RSK,
      registry: BLOCKCHAIN_CONTRACT_RSK
    }
  ]
};

NOTE 1: It is important to put the prefix on the DID, equal to the one in the JSON name attribute in order to route right. (for mainnet, no prefix must be entered)

NOTE 2: All of these variables must be defined in the .env file in the root folder.

Gas Increment value to increase the gas in the transaction for safeguard. By default is 1.1 (10%). This value can be defined in the ENV file as GAS_INCREMENT