bitcoin/doc/release-notes-19762.md
Ryan Ofsky d8b12a75db rpc: Allow named and positional arguments to be used together
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:

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

Can be shortened to:

    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.
2022-11-05 05:32:39 -04:00

549 B

JSON-RPC

All JSON-RPC methods accept a new named parameter called args that can contain positional parameter values. This is a convenience to allow some parameter values to be passed by name without having to name every value. The python test framework and bitcoin-cli tool both take advantage of this, so for example:

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

Can now be shortened to:

bitcoin-cli -named createwallet mywallet load_on_startup=1