0.0.0-pr15.ef0e3c1 • Published 12 months ago
@talismn/dot-pool-selector v0.0.0-pr15.ef0e3c1
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 }, ...]
0.0.0-pr19.85f1128
12 months ago
0.0.0-pr19.d25970a
12 months ago
0.0.0-snapshot.940501
12 months ago
0.0.0-pr19.76d84b8
12 months ago
0.0.0-snapshot.14e1467
2 years ago
0.0.0-pr18.32c5f55
2 years ago
0.0.0-snapshot.2933904
2 years ago
0.0.0-pr17.24ecc24
2 years ago
0.0.0-pr17.6264223
2 years ago
0.0.0-snapshot.40e280a
2 years ago
0.0.0-pr16.6919c76
2 years ago
0.0.0-snapshot.77d31b3
2 years ago
0.0.0-pr15.ef0e3c1
2 years ago