aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Feature Request] Get latest owner of aptos-token in contract

Open icodezjb opened this issue 2 years ago • 1 comments

🚀 Feature Request

Currently in aptos-token, unable to get the latest token owner. We hope that aptos-token can provide the following methods:

  • public fun latest_owner_of(token_id: TokenId): Option<address>: Retrieve the latest owner by the token_id.

  • public fun is_latest_owner(account: address, token_id: TokenId): bool: Check if the specified account and the owner of token_id are equal.

Motivation

Re-mint of NFT: Complete both burn and mint of the same NFT in the one contract call.

Pitch

Unfinished PR https://github.com/aptos-labs/aptos-core/pull/4991

icodezjb avatar Oct 21 '22 08:10 icodezjb

This won't be feasible on-chain with the default token. The recommendation would be to create your own harness for doing so. We could eventually look into providing it optionally, but it isn't cheap nor effective to put up a reverse index on chain.

Also because the token can be stored outside of TokenStore, your proposal isn't all that viable.

davidiw avatar Oct 22 '22 21:10 davidiw