Python based CLI tool for staking (nominating) in Polkadot
run python StakingManager.py dot -h
- NOTE: because only polkadot is supported, you must give dot
as the first argument.
In the future, when we support additional networks, there will be other options to dot
run python test/endToEndTests.py
- Pretty intuitive ArgParser (see examples.py) for:
- Creating a mnemonic, keypair, getting acct info
- Bonding, unbonding, rebonding, withdrawing
- Nominating (Staking), setting staker requirements
- Validations
- Keep-alive checks (existential deposit)
- https://wiki.polkadot.network/docs/maintain-errors
- Error handling
- TODO
- Tests
- e2e tests (inclusive of CLI commands) in
test/endToEndTests.py
- Tests are major WIP, may fail and exit
- TODO: Setting up and testing on local network (see Testing Tools below)
- e2e tests (inclusive of CLI commands) in
- DOT: https://wiki.polkadot.network/docs/maintain-guides-how-to-nominate-polkadot
- KSM: https://wiki.polkadot.network/docs/maintain-guides-how-to-nominate-kusama
- To run the program, execute StakingManager.py
- Most "unique" logic is in fxn_decorator_implementations folder
- config.py specifies the network (see bottom of config file), right now only Polkadot mainnet and Westend are really functional
- Under the hood:
- SubstrateInterface (py):
- SS58:
- TODO: Testing Tools:
- SOLID - https://gist.github.com/dmmeteo/f630fa04c7a79d3c132b9e9e5d037bfd
- If a filename has a corresponding Utils file, one should not ever need to import the Utils file except in its pair.
- For example, accountManager.py should import accountManagerUtils.py, but no other files should import accountManagerUtils.py. Instead, all other files should only ever have to import accountManager.py.
- Pass "generic" arguements first in a function and more unique arguements subsequently
- For example, in
def __init__(self, logger, accountManager)
,self
andlogic
generic and therefore passed beforeaccountManager
- For example, in
- TODO
- Code for parsing CLI commands is in
/arg_parser
folder - The program "logic" is in
/fxn_decorator_implementations
- accountImplementation contains classes related to accounts
- substrateCallImplementation contains classes related to bonding and nominating
- Improved testing
- Improved validations and error handling, e.g. to avoid existential deposit
- Adding new substrate based chains to stake on
- check TODOs in substrateCallImplementationUtils
- rename code_src > src
- rename all cases of "bounder" to "bonder"