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

get_raw_abi #5375

Merged
merged 3 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/chain_api_plugin/chain_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void chain_api_plugin::plugin_startup() {
CHAIN_RO_CALL(get_code_hash, 200),
CHAIN_RO_CALL(get_abi, 200),
CHAIN_RO_CALL(get_raw_code_and_abi, 200),
CHAIN_RO_CALL(get_raw_abi, 200),
CHAIN_RO_CALL(get_table_rows, 200),
CHAIN_RO_CALL(get_table_by_scope, 200),
CHAIN_RO_CALL(get_currency_balance, 200),
Expand Down
14 changes: 14 additions & 0 deletions plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,20 @@ read_only::get_raw_code_and_abi_results read_only::get_raw_code_and_abi( const g
return result;
}

read_only::get_raw_abi_results read_only::get_raw_abi( const get_raw_abi_params& params )const {
get_raw_abi_results result;
result.account_name = params.account_name;

const auto& d = db.db();
const auto& accnt = d.get<account_object,by_name>(params.account_name);
result.abi_hash = fc::sha256::hash( accnt.abi.data(), accnt.abi.size() );
result.code_hash = fc::sha256::hash( accnt.code.data(), accnt.code.size() );
if( !params.abi_hash || *params.abi_hash != result.abi_hash )
result.abi = blob{{accnt.abi.begin(), accnt.abi.end()}};

return result;
}

read_only::get_account_results read_only::get_account( const get_account_params& params )const {
get_account_results result;
result.account_name = params.account_name;
Expand Down
15 changes: 15 additions & 0 deletions plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,24 @@ class read_only {
name account_name;
};

struct get_raw_abi_params {
name account_name;
optional<fc::sha256> abi_hash;
};

struct get_raw_abi_results {
name account_name;
fc::sha256 code_hash;
fc::sha256 abi_hash;
optional<chain::blob> abi;
};


get_code_results get_code( const get_code_params& params )const;
get_code_hash_results get_code_hash( const get_code_hash_params& params )const;
get_abi_results get_abi( const get_abi_params& params )const;
get_raw_code_and_abi_results get_raw_code_and_abi( const get_raw_code_and_abi_params& params)const;
get_raw_abi_results get_raw_abi( const get_raw_abi_params& params)const;



Expand Down Expand Up @@ -685,6 +698,8 @@ FC_REFLECT( eosio::chain_apis::read_only::get_code_hash_params, (account_name) )
FC_REFLECT( eosio::chain_apis::read_only::get_abi_params, (account_name) )
FC_REFLECT( eosio::chain_apis::read_only::get_raw_code_and_abi_params, (account_name) )
FC_REFLECT( eosio::chain_apis::read_only::get_raw_code_and_abi_results, (account_name)(wasm)(abi) )
FC_REFLECT( eosio::chain_apis::read_only::get_raw_abi_params, (account_name)(abi_hash) )
FC_REFLECT( eosio::chain_apis::read_only::get_raw_abi_results, (account_name)(code_hash)(abi_hash)(abi) )
FC_REFLECT( eosio::chain_apis::read_only::producer_info, (producer_name) )
FC_REFLECT( eosio::chain_apis::read_only::abi_json_to_bin_params, (code)(action)(args) )
FC_REFLECT( eosio::chain_apis::read_only::abi_json_to_bin_result, (binargs) )
Expand Down