@talismn/dot-pool-selector
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-pr15.ef0e3c1 • Public • Published

dot-pool-selector

Select the best nomination pools algorithmically

Criteria

The algorithm selects pools based on the following:

  • The root user is verified
  • The root user has skin in the game
  • The pool's validators meet general standards, see more here
  • The pool is in an open state
  • The pool has not reached the max member count
  • The pool has selected an optimal number of validators

Getting started

Install the modules with npm i & run the tests with npm run test.

Usage

// Initialise the polkadot api object 
const { ApiPromise, WsProvider} = require("@polkadot/api");
const api = await ApiPromise.create({ provider: new WsProvider("YOUR_PROVIDER") });

// Initialise the ValidatorSelector
const selector = new ValidatorSelector(api, MAX_COMMISSION, MIN_STAKING, ERA); // set ERA to 0 or undefined if you want to use the current era

// Initialise the PoolSelector
const poolSelector = new PoolSelector(
    validatorSelector, // the initialised ValidatorSelector
    api, // the initialised polkadot.js api object
    options, // see ./src/Types.ts (uses a default object if unset) 
);

// get validator pools meeting the criteria
poolSelector.getPoolsMeetingCriteria();
// sample output
> [{ "pass": true, "poolId": 10, "poolStashAccountId": "F3opxRbN5ZavB4LTn2G7pUpU9FV2tzasBzFYncxp1HdYEdy", "poolRewardAccountId": "F3opxRbN5ZavB4LTn2Xrr2QadvgVT6Tbrvm6jJoGqAMorEE", "depositor": "H1bSKJxoxzxYRCdGQutVqFGeW7xU3AcN6vyEdZBU7Qb1rsZ", "root": "H1bSKJxoxzxYRCdGQutVqFGeW7xU3AcN6vyEdZBU7Qb1rsZ", "nominator": "H1bSKJxoxzxYRCdGQutVqFGeW7xU3AcN6vyEdZBU7Qb1rsZ", "stateToggler": "H1bSKJxoxzxYRCdGQutVqFGeW7xU3AcN6vyEdZBU7Qb1rsZ", "state": "Open", "memberCount": 3 }, ...]

Readme

Keywords

none

Package Sidebar

Install

npm i @talismn/dot-pool-selector

Weekly Downloads

28

Version

0.0.0-pr15.ef0e3c1

License

none

Unpacked Size

36.7 kB

Total Files

22

Last publish

Collaborators

  • chrisling-dev
  • tien-talisman
  • 0xkheops
  • jonpdunne
  • warp_lizard
  • alectalisman