Skip to content

Add a getter for an array of tokens held by an owner #1512

Description

@chebykin

Problem

I want to inherit ERC721Full.sol contract and add an extra getter for an array of tokens held by a given user.

Expected behaviour

In previous versions it was possible by adding an extra function and accessing an internal _ownedTokens mapping:

function tokensOfOwner(address _owner) external view returns (uint256[]) {
    return ownedTokens[_owner];
}

Current behaviour

In version 2.x it is impossible to access a private _ownedTokens mapping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contractsSmart contract code.featureNew contracts, functions, or helpers.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions