1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-14 12:12:21 +00:00

Add send_mode param to tonlib_api msg.message (send_mode=-1 - use default)

This commit is contained in:
tolya-yanot 2021-08-02 23:59:42 +03:00 committed by main
parent 72cf905fd1
commit c1a733c0f0
6 changed files with 10 additions and 3 deletions

View file

@ -36,6 +36,7 @@ class WalletInterface : public SmartContract {
struct Gift {
block::StdAddress destination;
td::int64 gramms;
td::int32 send_mode{-1};
bool is_encrypted{false};
std::string message;

View file

@ -40,6 +40,9 @@ td::Result<td::Ref<vm::Cell>> WalletV3::make_a_gift_message(const td::Ed25519::P
if (gift.gramms == -1) {
send_mode += 128;
}
if (gift.send_mode > -1) {
send_mode = gift.send_mode;
}
cb.store_long(send_mode, 8).store_ref(create_int_message(gift));
}

View file

@ -105,7 +105,7 @@ msg.dataDecrypted proof:bytes data:msg.Data = msg.DataDecrypted;
msg.dataEncryptedArray elements:vector<msg.dataEncrypted> = msg.DataEncryptedArray;
msg.dataDecryptedArray elements:vector<msg.dataDecrypted> = msg.DataDecryptedArray;
msg.message destination:accountAddress public_key:string amount:int64 data:msg.Data = msg.Message;
msg.message destination:accountAddress public_key:string amount:int64 data:msg.Data send_mode:int32 = msg.Message;
//
// DNS

Binary file not shown.

View file

@ -2559,6 +2559,7 @@ class GenericCreateSendGrams : public TonlibQueryActor {
struct Action {
block::StdAddress destination;
td::int64 amount;
td::int32 send_mode{-1};
bool is_encrypted{false};
bool should_encrypt;
@ -2610,6 +2611,7 @@ class GenericCreateSendGrams : public TonlibQueryActor {
auto key = td::Ed25519::PublicKey(td::SecureString(public_key.key));
res.o_public_key = std::move(key);
}
res.send_mode = message.send_mode_;
auto status = downcast_call2<td::Status>(
*message.data_, td::overloaded(
[&](tonlib_api::msg_dataRaw& text) {
@ -3045,6 +3047,7 @@ class GenericCreateSendGrams : public TonlibQueryActor {
auto& destination = destinations_[i];
gift.destination = destinations_[i]->get_address();
gift.gramms = action.amount;
gift.send_mode = action.send_mode;
// Temporary turn off this dangerous transfer
if (false && action.amount == source_->get_balance()) {

View file

@ -1096,7 +1096,7 @@ class TonlibCli : public td::actor::Actor {
std::vector<tonlib_api::object_ptr<tonlib_api::msg_message>> messages;
messages.push_back(
make_object<tonlib_api::msg_message>(channels_[pchan_id].to_address(), "", value,
make_object<tonlib_api::msg_dataRaw>(query->body_, query->init_state_)));
make_object<tonlib_api::msg_dataRaw>(query->body_, query->init_state_), -1));
auto action = make_object<tonlib_api::actionMsg>(std::move(messages), true);
send_query(
make_object<tonlib_api::createQuery>(addr.input_key(), std::move(addr.address), 60, std::move(action), nullptr),
@ -2217,7 +2217,7 @@ class TonlibCli : public td::actor::Actor {
data = make_object<tonlib_api::msg_dataText>(message.str());
}
messages.push_back(
make_object<tonlib_api::msg_message>(std::move(address.address), "", amount.nano, std::move(data)));
make_object<tonlib_api::msg_message>(std::move(address.address), "", amount.nano, std::move(data), -1));
return td::Status::OK();
};