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

ability to specify one or more local abi files for cleos for serialzation/deserialization offline #10823

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

taokayan
Copy link
Contributor

@taokayan taokayan commented Oct 21, 2021

similar to #10821, this PR for develop branch

Change Description

cleos: Add ability to specify one or more local abi files for cleos for serialzation/deserialization offline, which doesn't require nodeos RPC endpoint

new parameter:
--abi-file: In form of <contract name>:<abi file path>, use a local abi file for serialization and deserialization instead of getting the abi data from the blockchain; repeat this option to pass multiple abi files for different contracts

example:

action binary data => json data

./cleos --abi-file eosio.token:../eosio.contracts/build/contracts/eosio.token/eosio.token.abi convert unpack_action_data eosio.token transfer 0000000000ea30554008218410420831a086010000000000045359530000000000
{
  "from": "eosio",
  "to": "a44444444444",
  "quantity": "10.0000 SYS",
  "memo": ""
}

json data => binary:

./cleos --abi-file eosio.token:../eosio.contracts/build/contracts/eosio.token/eosio.token.abi convert pack_action_data eosio.token transfer '{"from":"aaa","to":"bbb","quantity":"10.0000 SYS","memo":"hello"}'
0000000000008c31000000000000ce39a08601000000000004535953000000000568656c6c6f

@taokayan taokayan requested a review from heifner October 21, 2021 03:01
Copy link
Collaborator

@bogniq bogniq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and works well. Is there some usage example with multiple --abi-file options?

@taokayan
Copy link
Contributor Author

taokayan commented Oct 26, 2021

@bogniq yes, this is a multi abi-file use case as follows:, if you add --print-request you'll notice that the /v1/chain/get_raw_abi request will no longer be sent by cleos


./cleos --abi-file eosio:../eosio.contracts/build/contracts/eosio.abi --abi-file eosio.token:../eosio.contracts/build/contracts/eosio.token/eosio.token.abi push action eosio.token transfer '{"from":"eosio","to":"a123","quantity":"0.0001 SYS","memo":""}' -p eosio -f

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.

3 participants