Fixes for compatibility with latest Kusama runtime
Description
I discovered that the list command was returning incorrect values for rewards on Kusama and Westend, but not on Polkadot. Going down the rabbit hole investigating that, I made "some" changes on the code and I include them all in here.
Changes
Added a standard .gitignore for Python projects.
Fixed some commands on the README and made the results be with exact decimals (spoiler: as the tool returns them now).
Bumped the substrate-interface dependency to 13.3
Command list
Accounts don't need decoding now, so we use SS58 formatted addresses for everything
Removed HistoryDepth call, as it's not used (the depth is obtained from the config)
Using ActiveEra instead of CurrentEra to avoid claiming rewards for an unfinished era.
Renamed (only internally) the --unclaimedflag as args.only_unclaimed for readability.
Using f-strings for simpler formatting of strings.
Order results by era in DESC order.
Fixed length of substrate.token_decimals for balances
Fixed typos on paymemt -> payment.
Command pay
Removed HistoryDepth call, as it's not used (the depth is obtained from the config)
Max depth default value is now 84 (previously 82)
Using ActiveEra instead of CurrentEra to avoid claiming rewards for an unfinished era
Step-by-step logging
Checking current account balance of the issuer before submitting a extrinsic, exiting if it's not enough
Keypair generation now also reads from CLI arguments (previously was only from config). Even with this feature now enabled, I think it should be only used for development purposes. Secrets on the CLI may become visible for third parties, better use config files.
Waiting for the batch extrinsic to be in a block before exiting.
Logging the result of the extrinsic, with data such as its hash, the block hash, the fee or whether it was correct.
Mapping from network to ss58_format for correct keypair generation.
Suggestion to bump version
I think these changes don't affect the usage of the tool from the user's perspective, but I would suggest to bump the version of the tool to 1.1.0.
Let me know what you think about this and the changes above, I hope you find them useful :grin:
I just saw that @arjanz has made a PR. I think his changes are also included in this PR so far, but please, take a look at both :)
Fixes for compatibility with latest Kusama runtime
Description
I discovered that the
list
command was returning incorrect values for rewards on Kusama and Westend, but not on Polkadot. Going down the rabbit hole investigating that, I made "some" changes on the code and I include them all in here.Changes
.gitignore
for Python projects.substrate-interface
dependency to13.3
list
HistoryDepth
call, as it's not used (the depth is obtained from the config)ActiveEra
instead ofCurrentEra
to avoid claiming rewards for an unfinished era.--unclaimed
flag asargs.only_unclaimed
for readability.substrate.token_decimals
for balancespaymemt
->payment
.pay
HistoryDepth
call, as it's not used (the depth is obtained from the config)84
(previously82
)ActiveEra
instead ofCurrentEra
to avoid claiming rewards for an unfinished eranetwork
toss58_format
for correct keypair generation.Suggestion to bump version
I think these changes don't affect the usage of the tool from the user's perspective, but I would suggest to bump the version of the tool to
1.1.0
.Let me know what you think about this and the changes above, I hope you find them useful :grin:
I just saw that @arjanz has made a PR. I think his changes are also included in this PR so far, but please, take a look at both :)