Browse Source

Merge #12077: [Docs] Correct `sendmany` curl example

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"}
  ```

Tree-SHA512: 9be055515175f633d21cbe2f6735e08709af306639b31e9f2bf83d9eb1cf4dbbf807951728649f3c091fde96dbf4ea732ee903dec9589f90ea1e046b832b90d0
0.16
Wladimir J. van der Laan 7 years ago
parent
commit
c04cb48df9
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
  1. 2
      src/wallet/rpcwallet.cpp

2
src/wallet/rpcwallet.cpp

@ -1038,7 +1038,7 @@ UniValue sendmany(const JSONRPCRequest& request)
"\nSend two amounts to two different addresses, subtract fee from amount:\n" "\nSend two amounts to two different addresses, subtract fee from amount:\n"
+ HelpExampleCli("sendmany", "\"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 1 \"\" \"[\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\\\",\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\"]\"") + + HelpExampleCli("sendmany", "\"\" \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\" 1 \"\" \"[\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\\\",\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\"]\"") +
"\nAs a json rpc call\n" "\nAs a json rpc call\n"
+ HelpExampleRpc("sendmany", "\"\", \"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\\\":0.01,\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\", 6, \"testing\"") + HelpExampleRpc("sendmany", "\"\", {\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\":0.01,\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\":0.02}, 6, \"testing\"")
); );
ObserveSafeMode(); ObserveSafeMode();

Loading…
Cancel
Save