Calling get_esdt_token_data for account that does not have the esdt

Considering that get_esdt_token_data(address: &ManagedAddress, token_id: &TokenIdentifier, nonce: u64) -> EsdtTokenData<Self::Api> always returns an EsdtTokenData rather than an option. What will this object look like if the address does not own the specified token?


Solution 1:

The execution will fail as the VM will not return anything to the smart contract if it doesn't find the token.

The typical usage for this function is to get the data for the payment tokens the smart contract receives from the caller. If you're trying to use it freely, you might get into this situation, so this type of "free" usage is not really advised.