Page MenuHomePhabricator

RPC: Accept options as named-only parameters
ClosedPublic

Authored by Fabien on Jun 7 2024, 20:55.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABC4e817a92a1a9: RPC: Accept options as named-only parameters
Summary
Allow RPC methods which take an options parameter (importmulti, listunspent, fundrawtransaction, bumpfee, send, sendall, walletcreatefundedpsbt, simulaterawtransaction), to accept the options as named parameters, without the need for nested JSON objects.

This makes it possible to make calls like:

src/bitcoin-cli -named bumpfee txid fee_rate=10

instead of

src/bitcoin-cli -named bumpfee txid options='{"fee_rate": 10}'

RPC help is also updated to show options as top level named arguments instead of as nested objects.
`

Backport of core#26485.

Depends on D16315.

Test Plan
ninja all check-all

Event Timeline

Fabien requested review of this revision.Jun 7 2024, 20:55
PiRK requested changes to this revision.Jun 10 2024, 06:47
PiRK added a subscriber: PiRK.
PiRK added inline comments.
doc/release-notes.md
29–30 ↗(On Diff #48197)
33–41 ↗(On Diff #48197)

It is probably better to use an RPC command that actually exists in Bitcoin ABC.

For instance

sh
src/bitcoin-cli -named fundrawtransaction <raw tx> feeRate=100
This revision now requires changes to proceed.Jun 10 2024, 06:47
This revision is now accepted and ready to land.Jun 10 2024, 07:46
This revision was landed with ongoing or failed builds.Jun 10 2024, 08:00
This revision was automatically updated to reflect the committed changes.