0

I am trying to mint an NFT as a reward for player via the smart contract, here is my code.

eosio::action mint_action = eosio::action(
 eosio::permission_level(_self, eosio::name("active")),
 "atomicassets"_n,
 "mintasset"_n,
 std::make_tuple(_self, collection_name, schema_name, template_id, recipient, [],  [],  []));

mint_action.send();

I am encountering this problem:

error: expected body of lambda expression
            std::make_tuple(_self, collection_name, schema_name, template_id, recipient, [],  [],  []));

So the last 3 parameters for minting on atomicassets are to be filled with empty arrays but the problem is I can't put empty arrays here. I'm not really good at C++ so excuse me if this is a very newb problem.

Thank you.

1

The very kind and helpful includenull has answered my question on the wax discord but I'll post the answer here for anyone who had the same issues.

action(
  permission_level(get_self(), "active"_n),
  "atomicassets"_n,
  "mintasset"_n,
  std::make_tuple(
    get_self(), // authorized_minter
    "collection"_n, // collection_name
    "schema"_n, // schema_name
    123456, // template_id
    "account"_n, // new_asset_owner
    std::map<std::string, atomicassets::ATOMIC_ATTRIBUTE>(), // immutable_data
    std::map<std::string, atomicassets::ATOMIC_ATTRIBUTE>(), // mutable_data
    std::vector<asset>(), // tokens_to_back
  )
).send();

You should also include the atomicassets header file if you have not already https://github.com/pinknetworkx/atomicassets-contract/blob/master/include/atomicassets-interface.hpp

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.