'Metamask API to know list of tokens

I have created a smart contract with erc-721 and erc-1155 tokens standards and then deployed these on Ropsten, rinkeby and polygon mumbai testnet,

I want to know the list of tokens that my account of metamask has.

Is there any API that i can make use of?

As i want the value in a script. So I am in need of a function that would do this task for me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source