PatrickAlphaC / nft-mix

MIT License
825 stars 414 forks source link

No matter however I run, it shows The number of tokens you've deployed is: 0 #86

Open the-lost-kite opened 2 years ago

PatrickAlphaC commented 2 years ago

Please add a detailed list of steps you took to get here.

haverstein commented 2 years ago

I was also having the same output but after putting time.sleep(300) after calling the createCollectible function has solved the issue.

def createCollectible():
    dev = accounts.add(config["wallets"]["from_key"])
    advanced_collectible = AdvancedCollectible[len(AdvancedCollectible) - 1]
    fund_with_link(advanced_collectible.address)
    transaction = advanced_collectible.createCollectible("None", {"from": dev})
    print("Waiting on second transaction...")
    # wait for the 2nd transaction
    transaction.wait(1)
    time.sleep(300)
    requestId = transaction.events["requestedCollectible"]["requestId"]
    token_id = advanced_collectible.requestIdToTokenId(requestId)
    breed = get_breed(advanced_collectible.tokenIdToBreed(token_id))
    print("Dog breed of tokenId {} is {}".format(token_id, breed))
    return transaction
PatrickAlphaC commented 2 years ago

I just pushed some updates, could you pull and try again?

We now listen for events instead of just doing time.sleep

https://github.com/PatrickAlphaC/nft-mix/blob/54e8c7c16a206bf1ea1ae20c0b359595128b26b4/scripts/advanced_collectible/create_collectible.py#L16