Skip to content
This repository was archived by the owner on Nov 15, 2021. It is now read-only.

Conversation

@jseagrave21
Copy link
Contributor

What current issue(s) does this address, or what feature is it adding?

How did you solve this problem?
Trial and Error

How did you make sure your solution works?
Unittest

Are there any special changes in the code that we should be aware of?

Please check the following, if applicable:

  • Did you add any tests?
  • Did you run make lint?
  • Did you run make test?
  • Are you making a PR to a feature branch or development rather than master?
  • Did you add an entry to CHANGELOG.rst? (if not, please do)

Merge CoZ refactor-prompt into jseagrave21 refactor-prompt
- add CommandShow and CommandSearch to prompt
revert changes
Merge CoZ refactor-prompt with jseagrave21 refactor-prompt
- add the remaining show methods
- add tests for remaining show methods
add ShowAllAssets
- add a test for ShowAllAssets
- add ShowAllAssets
def __init__(self):
super().__init__()

def execute(self, arguments):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neo> show notifications -1
Could not parse block height can't convert negative int to unsigned

neo> show notifications bla
Could not parse block height invalid literal for int() with base 10: 'bla'

neo> show notifications
Could not execute command: object of type 'NoneType' has no len()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 884, in _bootstrap
    self._bootstrap_inner()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/
and then some

unfriendly error message for an invalid arguments

similar errors are also present for show contract 234 and show asset 234. I stopped reviewing at this point. Please do some manual testing, as these can be captured before PR'ing. Thanks!

- add tests for updated Show.py
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 84.502% when pulling 6696ff0 on jseagrave21:refactor-CommandShow-pt2 into cfefd13 on CityOfZion:refactor-prompt.

@coveralls
Copy link

coveralls commented Dec 8, 2018

Coverage Status

Coverage increased (+0.4%) to 84.69% when pulling 594074c on jseagrave21:refactor-CommandShow-pt2 into cfefd13 on CityOfZion:refactor-prompt.

@jseagrave21
Copy link
Contributor Author

Not sure what is going on with coveralls but clicking on the latest coveralls comment here shows accurate coverage of Show.py. However, I don't understand the "uncovered" lines, I don't think that is accurate.

@ixje @LysanderGG I think this PR is ready for another review.

Copy link
Member

@ixje ixje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality wise all seems to work 👍

Just a couple of aesthetic changes for a nicer user experience:

Usage: show contract {hash/all}

hash/all        - the scripthash of the contract, or "all" shows all contracts
Usage: show asset {name/assetId/all}

name/assetId/all - the name or assetId of the asset, or "all" shows all assets
Usage: show notifications {block_index/address/contract_hash}

block_index/address/contract_hash - the block, address, or contract to show notifications for

As you see the above doesn't look really clean. Meaning; too many words and repetition of the same information. It seems to be a reoccurring theme where we have 1 param that accepts multiple formats. I'd like to replace the ParamDesc().name with a 1 word identifier (as the docs say 😉), such that it looks more compact/cleaner and the ParamDesc().description gives the details.

I'm looking for a word that would neatly express a group of possible input options. I don't think args is a good fit. My current best idea is specifier or identifier but it doesn't feel smooth or accurate. I'm hoping for ideas from you :)

The end result could then be e.g.

Usage: show notifications {identifier}

identifier - the block, address, or contract to show notifications for

PS: We might have to go back and see what previous merged commands also face this issue and clean them up.

@jseagrave21
Copy link
Contributor Author

I'm looking for a word that would neatly express a group of possible input options. I don't think args is a good fit. My current best idea is specifier or identifier but it doesn't feel smooth or accurate. I'm hoping for ideas from you :)

I am thinking "attribute" which is in line with Python

@ixje
Copy link
Member

ixje commented Dec 12, 2018

I am thinking "attribute" which is in line with Python

Let's do it!

- update per review
- update tests to match review updates
@jseagrave21
Copy link
Contributor Author

jseagrave21 commented Dec 12, 2018

Note to self (cc @ixje): Prior to merging remember to

@ixje
Copy link
Member

ixje commented Dec 12, 2018

#750 is merged, I approved the new changes. Let me know when you think it's ready.

@jseagrave21
Copy link
Contributor Author

@ixje I think this PR should be good to go 👍

@ixje
Copy link
Member

ixje commented Dec 12, 2018

💯

@ixje ixje merged commit 70e78d1 into CityOfZion:refactor-prompt Dec 12, 2018
@jseagrave21 jseagrave21 deleted the refactor-CommandShow-pt2 branch December 12, 2018 22:27
jseagrave21 added a commit to jseagrave21/neo-python that referenced this pull request Dec 22, 2018
- update `show_asset_state` and `show_contract_state` per changes in CityOfZion#741 and CityOfZion#739
ixje added a commit that referenced this pull request Jan 10, 2019
* Add the bases for making prompt commands plugin based (#720)

* WIP make prompt commands plugin based

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Merge ixje:refactor-prompt

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Handle help detection in prompt.py

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Use CommandBase for subcommands to be able to have N levels of commands.

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Move "create wallet" command into "wallet"

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Improve CommandBase.register_sub_command to use the subcommand's CommandDesc.command as an id. (#725)

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Fix 1 word commands (#727)

* Improve CommandBase.register_sub_command to use the subcommand's CommandDesc.command as an id.

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Fix exception when a command was used without arguments (for example "wallet")

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Add support for `wallet` `send`, `sendmany`, `sign`, `open`, and `close` (#726)

* Prompt cleanup (#730)

* Update description and clarify debug logs

* Make return's explicit, clarify multi-sig help message

* cleanup prompt

* remove colour from initial help, sort commands alphabetically, cleanup descriptions

* fix linting

* process feedback

* [refactor-prompt] Prompt fixes (#732)

* Improve CommandBase.register_sub_command to use the subcommand's CommandDesc.command as an id.

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Fix CommandWalletCreateAddress missing parameter desc

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Fix missing words for autocompletion

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* [refactor-prompt] Add missing tests for wallet create, verbose and create_addr (#733)

* Add missing tests for wallet create, verbose and create_addr

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* fix reviews

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* [refactor prompt] Add support for search method group (#739)

* [refactor prompt] Add support for show method group (pt 1) (#738)

* Fix NodeLeader was not reset between test cases. (#742)

This would lead to some problems when the blockchain is reset but the NodeLeader instance members are not.
Transactions were still considered as known.

Some members were not reset in NodeLeader.Setup()
Also removed unsued member NodeLeader.MissionsGlobal

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Migrate command: wallet rebuild (#747)

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* remove deprecated migrate command

* remove deprecated migrate command (#748)

* [refactor prompt] Add support for show method group (pt 2) (#741)

* [refactor-prompt] Implement CommandWalletClaimGas (#740)

* [refactor-prompt] Add wallet token base + delete (#757)

* [refactor-prompt] Migrate command: wallet delete_addr (#752)

* Migrate command: wallet delete_addr

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* UserWallet.DeleteAddress now returns False on error + proper handling of invalid addresses in CommandWalletDeleteAddress

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Migrate command: wallet alias (#753)

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* [refactor-prompt] Add wallet token send (#758)

* remove deprecated migrate command

* Add wallet token send

* Update requirements and use isValidPublicAddress from new neo-python-core version

* - fix send token description
- process feedback

* fix doc string typo

* [refactor prompt] Add support for config group pt1 (#759)

* add wallet import nep2/wif (#765)

* [refactor-prompt] add wallet token history (#763)

* Add wallet token history

* process feedback

* fix broken test after base branch merge

* [refactor-prompt] add wallet export commands (#764)

* add wallet export commands

* Fix export nep2 to ask for passwords to prevent pw leaking to logs

* process feedback

* [refactor-prompt] add wallet import watchaddr (#766)

* [refactor-prompt] add token sendfrom (#761)

* [refactor-prompt] add import multisig_addr (#767)

* add import multsig address

* remove obsolete function

* [refactor-prompt] Migrate command: wallet unspent (#760)

* migrate command: wallet unspent

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* wallet unspent - add tests

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* fix arguments names and missing doc

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Handle review: add feedback when there is no asset matching the arguments + use neocore.Utils.isValidPublicAddress

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* [refactor prompt] Add support for config maxpeers (#762)

* add token approve and token allowance (#769)

* add config nep8 (#771)

* [refactor-prompt] Migrate command: wallet split (#770)

* Migrate command wallet split

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Fix some comments

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Fix command desc + remove print() calls committed by mistake

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Add tests for CommandWalletSplit

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Review: test_wallet_split use string arguments instead of ints

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Handle Reviews - handle negative fees, improve error messages

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* add token mint (#773)

* [refactor prompt] Fix `search asset` and `search contract` (#774)

* Update prompt.py

- add CommandShow and CommandSearch to prompt

* Update prompt.py

revert changes

* Update Search.py

- update `search contract` and `search asset` per #623 (comment)

* Update test_search_commands.py

- add tests in case no search parameter is provided

* add token register (#775)

* [refactor-prompt] Migrate command: wallet import token (#772)

* test_wallet_commands.py: Move tests of non commands at the end

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Add wallet import token

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Review: return None implicitly where possible

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Add a few tests for SplitUnspentCoin()

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* CommandWalletImportToken - Handle review: better validation of contract_hash

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* Add wallet import contract_addr (#777)

Signed-off-by: Guillaume George <lysandergc@gmail.com>

* split prompt wallet into multiple files (#782)

* [refactor-prompt] add support for the sc group including build, build_run, and load_run (#779)

* [refactor-prompt] cleanup 2 (#783)

* make base command response consistent

* fix plurality

* check input parameters before closing wallet

* streamline missing arguments response
streamline accepted boolean options for config

* process feedback

* [refactor-prompt] add debugstorage command (#784)

* add debugstorage command (and fix auto save linting error)

* correct comments

* [refactor-prompt] add sc deploy (#785)

* add sc deploy (previously known as; import contract)

* process feedback

* [refactor-prompt] add sc invoke (#786)

* add sc invoke (previously known as testinvoke)

* process feedback

* streamline parameter descriptions (#787)

* add wallet password checking before exporting (#790)

* fix exception in help if command has no params (#792)

* [refactor-prompt] enforce pw prompt send (#791)

* remove password bypass

* remove unused import

* [refactor-prompt] update docs (#789)

* update global readme

* update docs

* process feedback

* update show contract output

* [refactor-prompt] restore theming support (#788)

* re-store theming support

* fix comment

* improve wallet usage help (#794)

* clarify insufficient funds error message due to not enough unspent outputs (#793)

* fix prompt printer for lists and other possible objects (#795)

* Fix send/sendmany default wallet source address for tx (#796)

* [refactor-prompt] Improve send & sendmany (third try) (#799)

* Update Send.py

* Update test_send_command.py

* rename test_send_command.py as test_send_commands.py

* [refactor-prompt] Fix #800 (#802)

* Update prompt.py

- add CommandShow and CommandSearch to prompt

* Update prompt.py

revert changes

* Fix #800

- adds support for contracts not requiring params

* fix calculation of change value when using alternating asset inputs (#803)

* test print fix

* oops

* test again

* update makefile

* update changelog to trigger stuck build
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants