title: Empty Events Array on UI but works on Test | Need TokenId from Transaction
body: <p>I'm working on an app that allows the user to create NFTs and list them on a market place. When I try to create the token on the UI using metamask, a <code>createToken</code> function is being called. The resolved promise of <code>createToken</code> is an object for which I expect an events key with 2 events (I'm able to confirm this by running <code>npx hardhat test</code>. However I don't actually see these events emitted to the UI... I need these events to get the <code>tokenId</code>. If someone knows an alternative way to get the <code>tokenId</code> I'm open to that as well.</p>
  <p><code>createToken</code>:</p>
  <pre><code>contract NFT is ERC721URIStorage {
      using Counters for Counters.Counter;
      Counters.Counter private _tokenIds;
      address contractAddress;
  
      constructor(address marketplaceAddress) ERC721(&quot;Metaverse&quot;, &quot;METT&quot;) {
          contractAddress = marketplaceAddress;
      }
  
      function createToken(string memory tokenURI) public returns (uint256) {
          _tokenIds.increment();
          uint256 newItemId = _tokenIds.current();
  
          _mint(msg.sender, newItemId);
          _setTokenURI(newItemId, tokenURI);
          // Not emitting this event to the UI but it works in the test
          setApprovalForAll(contractAddress, true);
          return newItemId;
      }
  }
  </code></pre>
  <p>The function on the UI looks like below where <code>createSale</code> creates a listing on the marketplace:</p>
  <pre><code>  async function createSale(url) {
      const web3Modal = new Web3Modal();
      const connection = await web3Modal.connect();
      const provider = new ethers.providers.Web3Provider(connection);
      const signer = provider.getSigner();
  
      /* next, create the item */
      let contract = new ethers.Contract(nftAddress, NFT.abi, signer);
      let transaction = await contract.createToken(url);
      let tx = await transaction.wait();
  
      // Seeing a successful transaction
      console.log(&quot;tx ==&gt; &quot;, tx);
      let event = tx.events[0];
      // Breaks here sine event[0] is `undefined`
      let value = event.args[2];
      let tokenId = value.toNumber();
  
      const price = ethers.utils.parseUnits(formInput.price, &quot;ether&quot;);
  
      /* then list the item for sale on the marketplace */
      contract = new ethers.Contract(nftMarketAddress, Market.abi, signer);
      let listingPrice = await contract.getListingPrice();
      listingPrice = listingPrice.toString();
  
      transaction = await contract.createMarketItem(nftAddress, tokenId, price, {
        value: listingPrice,
      });
      await transaction.wait();
      router.push(&quot;/&quot;);
    }
  
  </code></pre>
  <p>Below is a screenshot of the resolved promise with the empty events array:
  <a href="https://i.stack.imgur.com/ogoV7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ogoV7.png" alt="enter image description here" /></a></p>