-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] if actions.data & actions.hex_data provided, use the hex_data in api call get_transaction_id #1280
Merged
+96
−1
Merged
[4.0] if actions.data & actions.hex_data provided, use the hex_data in api call get_transaction_id #1280
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
53a94a6
if actions.data & actions.hex_data provided, use the hex_data
vladtr 167820f
Addresing feedback - tests, asserts
vladtr 40bf6c2
Merge branch 'release/4.0' into GH-1197-get-transaction-id-hex-data
vladtr 6446f4a
Updated exceptions
vladtr a46b8bb
Merge branch 'GH-1197-get-transaction-id-hex-data' of github.com:Ante…
vladtr 72f87b8
use EOS_RETHROW_EXCEPTIONS
vladtr e165ba9
Added two more validation exceptions from cleos
vladtr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,45 @@ parse_params<chain_apis::read_only::get_transaction_status_params, http_params_t | |
} | ||
} | ||
|
||
// if actions.data & actions.hex_data provided, use the hex_data since only currently support unexploded data | ||
template<> | ||
chain_apis::read_only::get_transaction_id_params | ||
parse_params<chain_apis::read_only::get_transaction_id_params, http_params_types::params_required>(const std::string& body) { | ||
if (body.empty()) { | ||
EOS_THROW(chain::invalid_http_request, "A Request body is required"); | ||
} | ||
greg7mdp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
try { | ||
fc::variant trx_var = fc::json::from_string( body ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if( trx_var.is_object() ) { | ||
fc::variant_object& vo = trx_var.get_object(); | ||
if( vo.contains("actions") && vo["actions"].is_array() ) { | ||
fc::mutable_variant_object mvo = vo; | ||
fc::variants& action_variants = mvo["actions"].get_array(); | ||
for( auto& action_v : action_variants ) { | ||
if( action_v.is_object() ) { | ||
greg7mdp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fc::variant_object& action_vo = action_v.get_object(); | ||
if( action_vo.contains( "data" ) && action_vo.contains( "hex_data" ) ) { | ||
fc::mutable_variant_object maction_vo = action_vo; | ||
maction_vo["data"] = maction_vo["hex_data"]; | ||
action_vo = maction_vo; | ||
vo = mvo; | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
throw false; | ||
heifner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
auto trx = trx_var.as<chain_apis::read_only::get_transaction_id_params>(); | ||
if( trx.id() == transaction().id() ) throw false; | ||
return trx; | ||
} catch( ... ) { | ||
EOS_THROW(chain::invalid_http_request, "Invalid transaction"); | ||
} | ||
} | ||
|
||
#define CALL_WITH_400(api_name, api_handle, api_namespace, call_name, http_response_code, params_type) \ | ||
{std::string("/v1/" #api_name "/" #call_name), \ | ||
[api_handle](string&&, string&& body, url_response_callback&& cb) mutable { \ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
.data
in cleos. For cleos, this should be optional as a user may want to prevent cleos from communicating with nodeos. Could support the option of providing abi. See--unpack-action-data
option--abi-file
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a separate issue to include exploded data handling improvements:
#1282