Skip to content

Formatters from cli_wallet functions are extended

Mariusz Trela requested to merge mt-formatters-fix into develop

This work is also related to issue: #219 (closed)

It was introduced a new argument in command line in cli_wallet (--format-type). Possible values: textformat, jsonformat, noformat.

Methods help, gethelp, list_my_accounts, get_account_history, get_open_orders, get_order_book, get_withdraw_routes react to this new argument.

  • textformat: result the same like in cli_wallet in interactive mode.
  • jsonformat: result the same like in cli_wallet in interactive mode, but in json format( new possibility )
  • noformat: result the same like in wallet_api

Example: For {"jsonrpc":"2.0", "method":"get_account_history", "params":[ "initminer", 100, 1 ], "id":1}

  • --format-type=="textformat"
{
  "jsonrpc": "2.0",
  "result": "#        BLOCK #    TRX ID                                             OPERATION            DETAILS                                           \n---------------------------------------------------------------------------------------------------\n100      74         0000000000000000000000000000000000000000           producer_reward      {\"producer\":\"initminer\",\"vesting_shares\":\"0.186382 VESTS\"}\n",
  "id": 1
}
  • --format-type=="jsonformat"
{
  "jsonrpc": "2.0",
  "result": {
    "ops": [
      {
        "pos": 100,
        "block": 74,
        "id": "0000000000000000000000000000000000000000",
        "op": {
          "type": "producer_reward_operation",
          "value": {
            "producer": "initminer",
            "vesting_shares": {
              "amount": "186382",
              "precision": 6,
              "nai": "@@000000037"
            }
          }
        }
      }
    ]
  },
  "id": 1
}
  • --format-type=="noformat"
{
  "jsonrpc": "2.0",
  "result": [
    [
      100,
      {
        "trx_id": "0000000000000000000000000000000000000000",
        "block": 74,
        "trx_in_block": 4294967295,
        "op_in_trx": 1,
        "virtual_op": true,
        "timestamp": "2022-03-08T10:52:51",
        "op": [
          "producer_reward",
          {
            "producer": "initminer",
            "vesting_shares": "0.186382 VESTS"
          }
        ],
        "operation_id": 0
      }
    ]
  ],
  "id": 1
}
Edited by Mariusz Trela

Merge request reports