Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

cleos get transaction_id enhancements #6829

Merged
merged 3 commits into from
Mar 11, 2019
Merged

cleos get transaction_id enhancements #6829

merged 3 commits into from
Mar 11, 2019

Conversation

heifner
Copy link
Contributor

@heifner heifner commented Feb 25, 2019

Change Description

  • Currently cleos get transaction_id only works for un-exploded action data. See Add API and cleos command to get transaction id given transaction #4892 (review) .
  • Also variant from file/string will return a default constructed transaction if file/string does not actually contain json with transaction attributes. Added a check for this case.
  • Automatically use actions.hex_data for actions.data if action.hex_data is provided.
  • In the future, cleos get transaction_id could be improved to support exploded action data if abi is provided.

Consensus Changes

None

API Changes

None

Documentation Additions

  • It should be noted that cleos get transaction_id currently only works for un-exploded action data.

For example:

{
          "expiration": "2019-02-25T13:27:39",
          "ref_block_num": 8695,
          "ref_block_prefix": 3632563554,
          "max_net_usage_words": 0,
          "max_cpu_usage_ms": 0,
          "delay_sec": 0,
          "context_free_actions": [],
          "actions": [
            {
              "account": "eosio.token",
              "name": "transfer",
              "authorization": [
                {
                  "actor": "zjtzjt535353",
                  "permission": "active"
                }
              ],
              "data": {
                "from": "zjtzjt535353",
                "to": "pokereosgame",
                "quantity": "1.2976 EOS",
                "memo": "bet:3244,seed:GWiwC4MTyHKZNCM2YcBC,ref:bitpie4users"
              },
          ],
          "transaction_extensions": []
        }

Will NOT work because data is exploded. However, this will work:

{
          "expiration": "2019-02-25T13:27:39",
          "ref_block_num": 8695,
          "ref_block_prefix": 3632563554,
          "max_net_usage_words": 0,
          "max_cpu_usage_ms": 0,
          "delay_sec": 0,
          "context_free_actions": [],
          "actions": [
            {
              "account": "eosio.token",
              "name": "transfer",
              "authorization": [
                {
                  "actor": "zjtzjt535353",
                  "permission": "active"
                }
              ],
              "data": {
                "from": "zjtzjt535353",
                "to": "pokereosgame",
                "quantity": "1.2976 EOS",
                "memo": "bet:3244,seed:GWiwC4MTyHKZNCM2YcBC,ref:bitpie4users"
              },
              "hex_data": "30ca28a3e4f7f3fba0a46198aaab20adb03200000000000004454f5300000000336265743a333234342c736565643a4757697743344d5479484b5a4e434d32596342432c7265663a626974706965347573657273"
            }
          ],
          "transaction_extensions": []
        }

As get transaction_id now will use actions.hex_data as actions.data if actions.hex_data is provided.

@heifner heifner changed the title Better error handling for cleos get transaction_id cleos get transaction_id enhancements Feb 25, 2019
@heifner heifner merged commit 5b1bf85 into develop Mar 11, 2019
@heifner heifner deleted the trx-id branch March 11, 2019 17:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants