I'm trying to see if an asset has been opted-in by a user on his wallet before performing a transfer of the asset to the user, but I can't seem to find how this is done in the Python algosdk. Any lead would be appreciated.
I expect to be able to call a function that verify if the asset had been opted-in to, or at least a list of all the opted-in assets, so I can check if the asset index is present in the list.
The list of assets that an account is opted in is provided by the
/v2/account/{address}
endpoint.With the Python SDK, it is given by the
account_information
function of the V2 client.Here is an example using the Algoexplorer TestNet API on the account
GD7CZ4NH4PBZ75BSGBNXC76CYGEGEYVXYNGVNNWOYY33S64NV7VEISFGKE
that is opted in asset ID 10458941 but not in asset ID 10 (at least when the post was written):