1

Using cleos -f adds a context_fee_action to the TX like so:

  "context_free_actions": [{
      "account": "eosio.null",
      "name": "nonce",
      "authorization": [],
      "data": "1277571574850500"
    }
  ],

Adding a context_free_action to the vector of the TX in the SC gives me an error.

Error Details: context free actions are not currently allowed in generated transactions

Is there a good way to add the nonce? I tried adding it to the packed data tuple after the all needed data but the nonce seem to be ignored. I do not want to adjust the action that I am calling withing the deferred action.

0

Michael Yeates gave a good suggestions on Telegram. Simply add an action instead of a context_free_action.

A code example would look like this:

auto nonce = getNextId();
txn.actions.emplace_back(eosio::permission_level{_self, "active"_n},
                         "eosio.null"_n,
                         "nonce"_n,
                         std::make_tuple(nonce));
txn.actions.emplace_back(eosio::permission_level{_self, "active"_n},
                         _self,
                         "myaction"_n,
                         std::make_tuple(myarg1, myarg2...));
txn.send(nonce, _self, false);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.