title: How can I make my NFT visible in the NEAR wallet (AssemblyScript)?
body: <p>I'm trying to implement my own NFT-contract, <a href="https://docs.near.org/docs/tutorials/contracts/nfts/minting" rel="nofollow noreferrer">following this tutorial on NEAR</a>, and the <a href="https://nomicon.io/Standards/NonFungibleToken/Core.html#nft-interface" rel="nofollow noreferrer">Non-Fungible Token (NEP-171) specifications</a>. The tutorial is in <code>Rust</code>, but I'm trying to do something similar with <code>AssemblyScript</code>. I thought if I implemented the methods with the correct names and signature, it would be possible for the NEAR wallet to call the respective methods (e.g. <code>nft_tokens_for_owner</code>) on my NFT-contract. I'm just wondering if I'm missing something, or if I have the wrong understanding on how it's suppose to work.</p>
  <p>I have minted one NFT-token, using the <code>nft_mint</code> method in my contract, using my own testnet account. The transaction can be found <a href="https://explorer.testnet.near.org/transactions/5HKBByzHR7PckmAqLpZdtmuwuL9rtJJ3pSzDETFSWMSs" rel="nofollow noreferrer">here</a>. However, the NFT is not displayed in the &quot;Collectibles&quot; tab in my testnet wallet.</p>
  <p>My contract (index.ts) looks like this:</p>
  <pre class="lang-as prettyprint-override"><code>import { PersistentMap } from 'near-sdk-as';
  import { Token, TokenMetadata } from './reit-token';
  
  @nearBindgen
  class NFTContractMetadata {
    spec: string; // required, essentially a version like &quot;nft-1.0.0&quot;
    name: string; // required, ex. &quot;Mochi Rising — Digital Edition&quot; or &quot;Metaverse 3&quot;
    symbol: string; // required, ex. &quot;MOCHI&quot;
    icon: string | null; // Data URL
    base_uri: string | null; // Centralized gateway known to have reliable access to decentralized storage assets referenced by `reference` or `media` URLs
    reference: string | null; // URL to a JSON file with more info
    reference_hash: string | null; // Base64-encoded sha256 hash of JSON from reference field. Required if `reference` is included.
  }
  
  @nearBindgen
  export class Contract {
    //keeps track of the metadata for the contract
    metadata: NFTContractMetadata = {
      spec: 'reit-token-0.0.0',
      name: 'Reit Token',
      symbol: 'REIT',
      icon: null,
      base_uri: null,
      reference: null,
      reference_hash: null,
    };
  
    //contract owner
    owner_id: string; // Not sure if this is relevant for the contract itself
  
    //keeps track of all the token IDs for a given account
    tokens_per_owner: PersistentMap&lt;string, Array&lt;string&gt;&gt; = new PersistentMap&lt;
      string,
      Array&lt;string&gt;
    &gt;('tokens_pr_owner');
  
    //keeps track of the token struct for a given token ID
    tokens_by_id: PersistentMap&lt;string, Token&gt; = new PersistentMap&lt;string, Token&gt;(
      'tokens_by_id'
    );
  
    //keeps track of the token metadata for a given token ID
    token_metadata_by_id: PersistentMap&lt;string, TokenMetadata&gt; =
      new PersistentMap&lt;string, TokenMetadata&gt;('token_metadata_by_id');
  
    nft_tokens_for_owner(account_id: string): Array&lt;Token&gt; {
      const tokenIds: string[] = this.tokens_per_owner.getSome(account_id);
  
      const tokens: Array&lt;Token&gt; = new Array&lt;Token&gt;();
      for (let i = 0; i &lt; tokenIds.length; ++i) {
        const token: Token = this.tokens_by_id.getSome(tokenIds[i]);
        tokens.push(token);
      }
      return tokens;
    }
  
    nft_mint(
      token_id: string,
      metadata: TokenMetadata,
      receiver_id: string
    ): void {
      // assert(
      //   this.tokens_by_id.contains(token_id),
      //   'ID is already taken, create new ID'
      // );
      const token = new Token(token_id, metadata, receiver_id);
      const tokens: Array&lt;string&gt; = new Array&lt;string&gt;();
      tokens.push(token_id);
      this.tokens_per_owner.set(receiver_id, tokens);
      this.tokens_by_id.set(token_id, token);
      this.token_metadata_by_id.set(token_id, token.metadata);
    }
  </code></pre>
  <p>Inside reit-token.ts</p>
  <pre class="lang-as prettyprint-override"><code>import { ContractPromise } from 'near-sdk-as';
  // implementation based on NEP-171
  // https://nomicon.io/Standards/NonFungibleToken/Core.html
  
  @nearBindgen
  export class TokenMetadata {
    title: string; // ex. &quot;Arch Nemesis: Mail Carrier&quot; or &quot;Parcel #5055&quot;
    description: string; // free-form description
    media: string; // URL to associated media, preferably to decentralized, content-addressed storage
    media_hash: string; // Base64-encoded sha256 hash of content referenced by the `media` field. Required if `media` is included.
    copies: number; // number of copies of this set of metadata in existence when token was minted.
    issued_at: number; // When token was issued or minted, Unix epoch in milliseconds
    expires_at: number; // When token expires, Unix epoch in milliseconds
    starts_at: number; // When token starts being valid, Unix epoch in milliseconds
    updated_at: number; // When token was last updated, Unix epoch in milliseconds
    extra: string; // anything extra the NFT wants to store on-chain. Can be stringified JSON.
    reference: string; // URL to an off-chain JSON file with more info.
    reference_hash: string; // Base64-encoded sha256 hash of JSON from reference field. Required if `reference` is included.
  }
  
  @nearBindgen
  export class Token {
    id: string;
    owner_id: string;
    metadata: TokenMetadata;
    constructor(token_id: string, metadata: TokenMetadata, receiver_id: string) {
      this.id = token_id;
      this.metadata = metadata;
      this.owner_id = receiver_id;
    }
  }
  
  @nearBindgen
  export class ReitToken {
    token: Token;
  
    constructor(token_id: string, metadata: TokenMetadata, receiver_id: string) {
      this.token = { id: token_id, metadata: metadata, owner_id: receiver_id };
    }
    // --- view methods --- //
  
    nft_token(): Token {
      return this.token;
    }
  
    // --- change methods --- //
  
    nft_transfer(
      receiver_id: string,
      token_id: string,
      approval_id: number,
      memo: string
    ): void {
      // assert(false, 'nft_transfer not implemented');
    }
  
    nft_transfer_call(
      receiver_id: string,
      token_id: string,
      approval_id: number,
      memo: string,
      msg: string
    ): ContractPromise {
      // assert(false, 'nft_transfer_call not implemented');
      return ContractPromise.create('', '', {}, 1);
    }
  }
  </code></pre>