Nft game -minting / empty array (part 5)

//////////////////////////// DISREGARDE PROBLEM A - I FOUND THE ANSWER /////////////////////////////////////////////////////////////////////////

Hello, I am in the academy and there seems to be missing the course to mint the Crypto Kitties into a catalogue which I found in this tutorial.

I have two issues but one is greater than the other other one.

A) When I mint the Pets in the Migration file, I see the array in console.log but it’s empty. I input two Pets to be minted and console.log still returns an empty array

here is the migration code

const Token = artifacts.require("Token");

module.exports = async function (deployer) {
  await deployer.deploy(Token, "NFT GAME", "NFTG");
  let tokenInstance = await Token.deployed();
  await, 200, 100000); // token id 0
  await, 100, 100000); // token id 1
  let pet = await tokenInstance.getTokenDetails(0);

B) The second issue is with the block.timestamp. I have to add more seconds in the Main.js / JSON file in order to not have time in the 1970 or the present which is bad because the function is meant to add seconds during the Migration process so as to have extra time to feed the Pet.
…like so

let deathTime = new Date(parseInt(data.lastMeal) + parseInt(data.endurance) * 16256800);

Problem A is more important. If I can get help, I would greatly appreciate it.
my Github link to this project down below and…

When I use balanceOf in the terminal - it seems to show there are two tokens in the array.

truffle(development)> tokenInstance.balanceOf(accounts[0])
BN { negative: 0, words: [ 2, <1 empty item> ], length: 1, red: null }
truffle(development)> tokenInstance.ownerOf(0)

But when I use the custom get function, I get an empty array

truffle(development)> tokenInstance.getAllTokensForUser(accounts[0])

So I found the answer to my problem A… my fault entirely
getAllTokensForUser function was simply missing return statment

return result;
1 Like

Hey @RorLor

Great job! :mage: