i want to write a small smart contract game where players will be able to send Characters (NFTs, atomicassets) into a battlefield. On that battlefield they have a chance to die. Which means that asset will be burned.
I know how the burning process works generally (https://github.com/pinknetworkx/atomicassets-contract/wiki/Actions#burnasset). But for the burnasset action the authorization of the Owner of the NFT is needed.
I know that I can check via require_auth( permission_level {X, Y } ) if the player has the required authorization. But is there a way that the user passes that authorization to the smart contract action?
If try to call the action with the given player name for the permission like:
action(
permission_level{player, "active"_n},
"atomicassets"_n,
"burnasset"_n,
std::tuple{ player, assetId }
).send();
I get the following exception when calling my smart contract action:
transaction declares authority '{"actor":"<<player>>","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [{"actor":"<<smartContract>>","permission":"eosio.code"}], provided keys [], and a delay max limit of 3888000000 ms
And if I try to call the action with the smart contract for permission like:
action(
permission_level{get_self(), "active"_n},
"atomicassets"_n,
"burnasset"_n,
std::tuple{ player, assetId }
).send();
I get the exception of missing authority of the player:
missing authority of <<player>>
Can anyone help me with that? Help is a lot appreciated.
Thanks in advance and greetings.
TLDR: Is there a way to give a smart contract action the permission to call an inline action with the authorization of the smart contract caller?