Are there any examples online for where I can see some examples of deferred transactions being created?
It's super simple, from your contract just call the below code:
transaction out{};
out.actions.emplace_back(permission_level{_self, N(active)}, N(pet), N(feedpet), std::make_tuple(pet.id));
out.delay_sec = 10;
out.send(pet.id, _self);
It's basically wrap an action on a transaction object (so you must import eoslib/transaction.hpp
on your header) and you set the quantity of seconds to defer the transaction, in the above case it's 10 seconds.
-
2is that possible to stop deferred transaction which having been pushed in a contract ? – Harry Ma May 23 '18 at 2:31
-
1
-
yes it's possible to stop a deferred transaction, check
cleos system
... the first parameter oftransaction.send
is the id of the transaction you want to create – Leo Ribeiro May 25 '18 at 13:19 -
are deferred transactions visible the second they are sent? I want to use them to hide some information but reveal at a later time. – Jacques Whales Aug 3 '18 at 12:16
-
6who will pay for CPU in case of a deferred or inline action, the contract or the initial caller? – kasper Taeymans Aug 27 '18 at 0:25