Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] RPC-Console support nested commands and simple value queries #2282

Merged
merged 3 commits into from
Apr 7, 2021

Conversation

random-zebra
Copy link

Backports a pretty cool feature for the GUI rpc-console from bitcoin#7783, which makes testing much faster, removing the need for copying/pasting the outputs of the commands.

Commands can be executed with bracket syntax, example: getwalletinfo().
Commands can be nested, example: sendtoaddress(getnewaddress(), 10).
Simple queries are possible: listunspent()[0][txid]
Object values are accessed with a non-quoted string, example: [txid].

Fully backward compatible. generate 101 is identical to generate(101)
Result value queries indicated with [] require the new brackets syntax.
Comma as argument separator is now also possible: sendtoaddress,<address>,<amount>
Space as argument separator works also with the bracket syntax, example: `sendtoaddress(getnewaddress() 10)

No dept limitation, complex commands are possible:
decoderawtransaction(getrawtransaction(getblock(getbestblockhash())[tx][0]))[vout][0][value]


Commands can be executed with bracket syntax, example:
`getwalletinfo()`.
Commands can be nested, example: `sendtoaddress(getnewaddress(), 10)`.
Simple queries are possible: `listunspent()[0][txid]`
Object values are accessed with a non-quoted string, example: [txid].

Fully backward compatible.
`generate 101` is identical to `generate(101)`
Result value queries indicated with `[]` require the new brackets
syntax.
Comma as argument separator is now also possible:
`sendtoaddress,<address>,<amount>`
Space as argument separator works also with the bracket syntax, example:
`sendtoaddress(getnewaddress() 10)

No dept limitation, complex commands are possible:
`decoderawtransaction(getrawtransaction(getblock(getbestblockhash())[tx][0]))[vout][0][value]`
Fuzzbawls
Fuzzbawls previously approved these changes Apr 4, 2021
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK d763267, but some further cleanup because of your second commit is possible.

Feel free to cherry-pick Fuzzbawls@d9e530d, or i can PR it after this is merged

@Fuzzbawls Fuzzbawls added the Needs Release Notes Placeholder tag for anything needing mention in the "Notable Changes" section of release notes label Apr 4, 2021
With the GUI's RPC execution code being now de-duplicated, we can do
some additional cleanup for CMake builds and a no-longer-needed
`rpcconsole.moc` include.
@random-zebra
Copy link
Author

Feel free to cherry-pick Fuzzbawls@d9e530d, or i can PR it after this is merged

Yup, nice 👍 Cherry-picked.

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 4fc2594

@furszy
Copy link

furszy commented Apr 7, 2021

Nice PR, and even nicer code duplication refactoring! ☕ . Only for devs hehe.

Have been playing with it a bit, something that would be great to add is a proper "Method not found" error description. For example, typing getblock(getbestblock()) returns "method not found" without stating which command name is wrong.
-- we can do it in another PR ofc --

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

ACK 4fc2594

@furszy furszy merged commit cb4e939 into PIVX-Project:master Apr 7, 2021
random-zebra added a commit that referenced this pull request Apr 9, 2021
7f4b2a4 [RPC] Return method name with 'Method not found' errors (random-zebra)

Pull request description:

  Simple change, to address the feature requested by @furszy here: #2282 (comment)

  ![Screenshot from 2021-04-08 14-03-33](https://user-images.githubusercontent.com/18186894/114023746-8bdb5400-9873-11eb-9d35-bd9ac4ce84c8.png)

ACKs for top commit:
  furszy:
    Code review ACK 7f4b2a4
  Fuzzbawls:
    ACK 7f4b2a4

Tree-SHA512: fdc6e62c469995931b996edbc325e96f7fa485b1a001b291a411582b2799df91bf711a5d913a2d3bbaacdb1776ddf0b837ac2ae2f41b6e53419871d4d811ecee
@random-zebra random-zebra removed the Needs Release Notes Placeholder tag for anything needing mention in the "Notable Changes" section of release notes label May 9, 2021
random-zebra added a commit that referenced this pull request May 11, 2021
d8fe6bf [Doc] Add new GUI RPC-console syntax to release notes (random-zebra)
eced57b Add help-console command to Qt debug console (Luke Mlsna)

Pull request description:

  Follow up to #2282

  First commit backports bitcoin#11698, adding:
  - a line to the initial message text at the top of the debug console
  - a pseudo-command `help-console` which is hooked after parsing the request, but before executing the RPC thread

  Second commit updates the release notes.

ACKs for top commit:
  furszy:
    utACK d8fe6bf
  Fuzzbawls:
    ACK d8fe6bf

Tree-SHA512: df415a27acb587535dfdc8775bacb231d435566bdfb18ea71863212999cf78d139b9b1eaceead5c573ace5203416d2f9392f9179ccd56b3eda1e2ab9fc3ad772
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants