How to get the owner of a Non-Fungible token by its ID?

  • getOwnerOfTokenId

This function is used to get the owner of an NFT token by its ID.

import { L1XProvider, NFTTokenOwnerOfArg } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
  endpoint: "https://v2-mainnet-rpc.l1x.foundation"
});

let params: NFTTokenOwnerOfArg = {
  contract_address: "4669899603735f7b06645c73fb73376b4a5c6f43",
  token_id: 1,
};

l1xProvider.tokens.NFT.getOwnerOfTokenId(params)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err)); // log error

Parameters:

The attribute for getting the token owner.

{
    "contract_address": "4669899603735f7b06645c73fb73376b4a5c6f43",
    "token_id": 1
}

Returns:

The response contains the token owner's address.

{
  "owner_address": "346fb07c43e88b58c058e8d6c4bf2f5080a01999"
}

Last updated