1.0.5 • Published 2 years ago

@chronotech/laborx.listeners.change.nodes v1.0.5

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
2 years ago

LaborX change blockchains nodes

How to use

Create app

const ChangeNodesApp = require('@chronotech/laborx.listeners.change.nodes');
/**
* @type app {express}
*/
const app = new ChangeNodesApp(
    express(), // express lib
    ApplicationStateService, // microservice ApplicationStateService instance
    config, // your microservice config, see below
    mongoose, // initialized mongoose instance
    [blockchainName1, blockchainName2], // array of microservice listening blockchains (etherium, binance, polygon, tron)
    new MyLogger() // any logger instance
);
app.createRoutes();

This code creates express app with routes:

GET /nodes/get - returns current nodes config

POST /nodes/change - validate and persist new nodes config

Get nodes

await app.getNodes();

Returns example:

{
    "binance": [
        {
            "uri": "https://bsc-dataseed.binance.org/fsdfdsf",
            "keys": [],
            "isActive": 1
        }
    ]
}

config Your microservice config, see below

mongoose Initialized mongoose instance

About config

Required sections

{
  nodesChangesSettings: {
    authToken: 'my_super_token',
    defaultNodes: {
      nodes: {
        binance: [
          {
            uri: 'https://bsc-dataseed.binance.org/',
            keys: [],
            isActive: 1
          }
        ]
      }
    }
  }
}

authToken - Auth token to get access to this app rotes

defaultNodes - Default nodes config. Persist at the first start

Tests

npm run test - to run tests

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago