1

I have a mapping with the key as an address and the value as an array of addresses. How do I return the array of addresses? In older solidity versions it works. In newer compiler versions I have to declare memory. Is this producing the problem in my example? Is there a workaround for? Here is a code snippet:

mapping(address => address[]) wallets;

    function getWallets(address _user) 
        public
        view
        returns(address[] memory)
    {
        return wallets[_user];
    }
  • 1
    Your code looks fine. What problem are you having? – smarx Jan 5 at 10:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.