EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

how to get raw abi ? #436

Closed anlebcoder closed 5 years ago

anlebcoder commented 5 years ago

Hello Master:

Why do I ask this question, because I want to get the historical version of ABI.

I know th original value of ABI can be obtained through HTTP request. For Example: getAbi.

Now how do I get the ABI binary to the original ABI?

Example:

"data": {
    "account": "silver123451",
    "abi": "0e656f7....more"
}

In C++ code:

 static bool to_abi(const Vec& abi_vec, abi_def& abi)
   {
      if( !is_empty_abi(abi_vec) ) { /// 4 == packsize of empty Abi
         fc::datastream<const char*> ds( abi_vec.data(), abi_vec.size() );
         fc::raw::unpack( ds, abi );
         return true;
      }
      return false;
   }

Now, how to use eosjs ?

anlebcoder commented 5 years ago

resloved:

eos.modules.Fcbuffer.fromBuffer(ctx.fc.structs.abi_def, Buffer.from(abi, 'hex'));