Skip to content

Commit

Permalink
Add message hash to tonlib response (#1379)
Browse files Browse the repository at this point in the history
* add msg hash

* regenerate tonlib_api.tlo
  • Loading branch information
neodix42 authored Nov 26, 2024
1 parent 8a41ee8 commit 6244410
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tl/generate/scheme/tonlib_api.tl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ton.blockIdExt workchain:int32 shard:int64 seqno:int32 root_hash:bytes file_hash
extraCurrency id:int32 amount:int64 = ExtraCurrency;

raw.fullAccountState balance:int64 extra_currencies:vector<extraCurrency> code:bytes data:bytes last_transaction_id:internal.transactionId block_id:ton.blockIdExt frozen_hash:bytes sync_utime:int53 = raw.FullAccountState;
raw.message source:accountAddress destination:accountAddress value:int64 extra_currencies:vector<extraCurrency> fwd_fee:int64 ihr_fee:int64 created_lt:int64 body_hash:bytes msg_data:msg.Data = raw.Message;
raw.message hash:bytes source:accountAddress destination:accountAddress value:int64 extra_currencies:vector<extraCurrency> fwd_fee:int64 ihr_fee:int64 created_lt:int64 body_hash:bytes msg_data:msg.Data = raw.Message;
raw.transaction address:accountAddress utime:int53 data:bytes transaction_id:internal.transactionId fee:int64 storage_fee:int64 other_fee:int64 in_msg:raw.message out_msgs:vector<raw.message> = raw.Transaction;
raw.transactions transactions:vector<raw.transaction> previous_transaction_id:internal.transactionId = raw.Transactions;

Expand Down
Binary file modified tl/generate/scheme/tonlib_api.tlo
Binary file not shown.
4 changes: 4 additions & 0 deletions tonlib/tonlib/TonlibClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3046,6 +3046,7 @@ struct ToRawTransactions {
}
auto body_cell = vm::CellBuilder().append_cellslice(*body).finalize();
auto body_hash = body_cell->get_hash().as_slice().str();
auto msg_hash = cell->get_hash().as_slice().str();

td::Ref<vm::Cell> init_state_cell;
auto& init_state_cs = message.init.write();
Expand Down Expand Up @@ -3115,6 +3116,7 @@ struct ToRawTransactions {
auto created_lt = static_cast<td::int64>(msg_info.created_lt);

return tonlib_api::make_object<tonlib_api::raw_message>(
msg_hash,
tonlib_api::make_object<tonlib_api::accountAddress>(src),
tonlib_api::make_object<tonlib_api::accountAddress>(std::move(dest)), balance,
std::move(extra_currencies), fwd_fee, ihr_fee, created_lt, std::move(body_hash),
Expand All @@ -3127,6 +3129,7 @@ struct ToRawTransactions {
}
TRY_RESULT(dest, to_std_address(msg_info.dest));
return tonlib_api::make_object<tonlib_api::raw_message>(
msg_hash,
tonlib_api::make_object<tonlib_api::accountAddress>(),
tonlib_api::make_object<tonlib_api::accountAddress>(std::move(dest)), 0,
std::vector<tonlib_api::object_ptr<tonlib_api::extraCurrency>>{}, 0, 0, 0, std::move(body_hash),
Expand All @@ -3140,6 +3143,7 @@ struct ToRawTransactions {
TRY_RESULT(src, to_std_address(msg_info.src));
auto created_lt = static_cast<td::int64>(msg_info.created_lt);
return tonlib_api::make_object<tonlib_api::raw_message>(
msg_hash,
tonlib_api::make_object<tonlib_api::accountAddress>(src),
tonlib_api::make_object<tonlib_api::accountAddress>(), 0,
std::vector<tonlib_api::object_ptr<tonlib_api::extraCurrency>>{}, 0, 0, created_lt, std::move(body_hash),
Expand Down

0 comments on commit 6244410

Please sign in to comment.