Page MenuHomePhabricator

[backport#12077] [Docs] Correct `sendmany` curl example
ClosedPublic

Authored by majcosta on Oct 29 2020, 00:23.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABCe85b7bfe5bf0: [backport#12077] [Docs] Correct `sendmany` curl example
Summary

0d663f8 Fixes issue #12067 sendmany curl example is wrong. (251)

Pull request description:

The example curl command in the `sendmany` RPC help results in an error:
```
{"result":null,"error":{"code":-1,"message":"JSON value is not an object as expected"},"id":"curltest"}
```
because - as reported in #12067 - the second element in the `params` array should be a JSON object.

This PR removes the escaped backslash and quote characters that serialize the JSON object to a string and make it a plain JSON object:

```
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendmany", "params": ["", {"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX":0.01,"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz":0.02}, 6, "testing"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
```

which (when executed with valid addresses) yields the expected result:

```
{"result":"c446213f06ee4489660ed5dc47d65daca27345d0b5fc5bd344ebca78b2d87356","error":null,"id":"curltest"}
```

Backport of Core PR12077

Test Plan
ninja all check check-functional

Run:

curl --user bitcoinrpc --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendmany", "params": ["", {"bchtest:qplljx455cznj2yrtdhj0jcm7syxlzqnaqt0ku5kjl":0.01,"bchtest:qzmnuh8t24yrxq4mvjakt84r7j3f9tunlvm2p7qef9":0.02}, 6, "testing"] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/

and get:

{"result":"d7844d45ca4f54b165976a7477c89def1352f8d17d2f148c0b07a660a6f9c25e","error":null,"id":"curltest"}

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable