bitcoin/src/rpc
Andrew Chow a63192afb8
Merge bitcoin/bitcoin#19762: rpc: Allow named and positional arguments to be used together
d8b12a75db rpc: Allow named and positional arguments to be used together (Ryan Ofsky)

Pull request description:

  It's nice to be able to use named options and positional arguments together.

  Most shell tools accept both, and python functions combine options and arguments allowing them to be passed with even more flexibility. This change adds support for python's approach so as a motivating example:

  ```sh
  bitcoin-cli -named createwallet wallet_name=mywallet load_on_startup=1
  ```

  Can be shortened to:

  ```sh
  bitcoin-cli -named createwallet mywallet load_on_startup=1
  ```

  JSON-RPC standard doesn't have a convention for passing named and positional parameters together, so this implementation makes one up and interprets any unused `"args"` named parameter as a positional parameter array.

  This change is backwards compatible. It doesn't change the interpretation of any previously valid calls, just treats some previously invalid calls as valid.

  Another use case even if you only occasionally use named arguments is that you can define an alias:

  ```
  alias bcli='bitcoin-cli -named'
  ```

  And now use both named named and unnamed arguments from the same alias without having to manually add `-named` option for named arguments or see annoying error "No '=' in named argument... this needs to be present for every argument (even if it is empty)`" for unnamed arguments

ACKs for top commit:
  achow101:
    ACK d8b12a75db
  stickies-v:
    re-ACK d8b12a75d
  aureleoules:
    re-ACK d8b12a75db

Tree-SHA512: 0cff8b50f584bcbbd376624adccf40536566ed8d1bcd6c88ad565dbc208f19d5e7a48c994efd6329d42b560149340d330397278f08a2912af5f3418d8c8837a9
2022-11-29 18:37:55 -05:00
..
blockchain.cpp RPC/blockchain: scan{blocks,txoutset>: Further doc improvements 2022-11-16 00:43:11 +00:00
blockchain.h scripted-diff: rename CChainState -> Chainstate 2022-09-09 11:47:27 -04:00
client.cpp rpc: Allow named and positional arguments to be used together 2022-11-05 05:32:39 -04:00
client.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
external_signer.cpp Remove not needed clang-format off comments 2022-04-25 10:55:07 +02:00
fees.cpp rpc: remove unneeded RPCTypeCheckArgument checks 2022-09-15 10:45:18 -03:00
mempool.cpp refactor: Move CTxMemPoolEntry class to its own module 2022-11-16 20:16:07 +00:00
mempool.h rpc: Move mempool RPCs to new file 2022-03-11 17:46:58 +01:00
mining.cpp Merge bitcoin/bitcoin#26118: log: Use steady clock for bench logging 2022-10-10 12:00:34 +02:00
mining.h rpc: create rpc/mining.h, hoist default max tries values to constant 2020-06-01 15:08:36 +02:00
net.cpp Merge bitcoin/bitcoin#26109: rpc, doc: getpeerinfo updates 2022-10-13 11:07:33 -04:00
node.cpp scripted-diff: Replace NullUniValue with UniValue::VNULL 2022-07-25 17:27:53 +02:00
output_script.cpp doc: add tr() descriptor example to deriveaddresses 2022-11-23 10:17:29 -05:00
protocol.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
rawtransaction.cpp Merge bitcoin/bitcoin#25858: psbt: Only include PSBT_OUT_TAP_TREE when the output has a script path 2022-10-13 09:40:27 -04:00
rawtransaction_util.cpp Merge bitcoin/bitcoin#25707: refactor: Make const references to avoid unnecessarily copying objects and enable two clang-tidy checks 2022-08-19 17:11:06 +02:00
rawtransaction_util.h rpc: Default rbf enabled 2022-07-15 11:46:34 -04:00
register.h scripted-diff: Rename rpc/misc.cpp to rpc/node.cpp 2022-05-03 09:05:15 +02:00
request.cpp Merge bitcoin/bitcoin#24675: util: Use ArgsManager::GetPathArg more widely 2022-08-04 16:58:01 +01:00
request.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server.cpp rpc: Allow named and positional arguments to be used together 2022-11-05 05:32:39 -04:00
server.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server_util.cpp Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
server_util.h Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
signmessage.cpp rpc: Move signmessage RPC util to new file 2022-04-28 11:19:29 +02:00
txoutproof.cpp scripted-diff: rename CChainState -> Chainstate 2022-09-09 11:47:27 -04:00
util.cpp Adjust RPCTypeCheckObj error string 2022-10-10 18:08:00 -03:00
util.h rpc: Set RPCArg options with designated initializers 2022-09-13 18:37:15 +02:00