Skip to content

Return only result field from node and wallet API calls

Piotr Batko requested to merge pbatko/result-of into master

Response from wallet after API call looks like this:

  "id": 0,
  "result": [
    <some interesting information>

In the vast majority of cases TestTools users needs only <some interesting information>. So tests contains a lot of boilerplate code:

result0 = wallet.api.some_call()['result']
result1 = wallet.api.some_other_call()['result']

Everytime tester needs to fetch 'result' field. This commit changes default behavior to return only 'result' field. So above code is simplified to following form:

result0 = wallet.api.some_call()
result1 = wallet.api.some_other_call()

If someone will need to read 'id' field, they can do:

id_ = wallet.api.some_call(only_result=False)['id']

Same applies to node's API.

Merge request reports