Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property '2' of undefined #21

Open
GNURub opened this issue Dec 17, 2021 · 8 comments
Open

Cannot read property '2' of undefined #21

GNURub opened this issue Dec 17, 2021 · 8 comments

Comments

@GNURub
Copy link

GNURub commented Dec 17, 2021

I am getting this error. Some idea?

error

@JorisNijkamp1
Copy link

I have the same problem...

@Duality1k
Copy link

that happens because the tx.event doesn't have an args object with the public RPC json response, for me worked using infura mumbai endpoint and changing index.js endpoint to my infura's project endpoint

@bcodus
Copy link

bcodus commented Jan 2, 2022

Same problem here. I got a mumbai network endpoint from alchemy, but still get this error, using:

    mumbai: {
      url: "https://polygon-mumbai.g.alchemy.com/v2/_myendpoinkey",
      accounts: [privateKey]
    },

Any ideas how to fix it?

@kyokosdream
Copy link

kyokosdream commented Jan 6, 2022

Here is the event response for me:

{
    "transactionIndex": 3,
    "blockNumber": 23614582,
    "transactionHash": "0x13ca8c4f671446379bfcf72f0952b21b2b3d90e7133eae8b5579930f2d9949de",
    "address": "0x0000000000000000000000000000000000001010",
    "topics": [
        "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
        "0x0000000000000000000000000000000000000000000000000000000000001010",
        "0x0000000000000000000000004db8d681bbfce98c09edc2be013ae5c9008810b8",
        "0x000000000000000000000000c26880a0af2ea0c7e8130e6ec47af756465452e8"
    ],
    "data": "0x0000000000000000000000000000000000000000000000000000292365481d400000000000000000000000000000000000000000000000000dd066d2fba5ec00000000000000000000000000000000000000000000000446ad73541ed1461d9f0000000000000000000000000000000000000000000000000dd03daf965dcec0000000000000000000000000000000000000000000000446ad737d42368e3adf",
    "logIndex": 10,
    "blockHash": "0xe30e3abd46053ba63c792deb28878b22981bd5b5d0e53b8d6367a48d0a7a8fdf"
}

It seems we need to retrieve the tokenId initially passed by the front-end user in order to list it on the marketplace:

transaction = await contract.createMarketItem(nftaddress, tokenId, price, { value: listingPrice })

As indicated by @CycloneOrg the arguments provided to the transaction are not returned in the event object

I changed my network to an Infura Mumbai testnet endpoint like so:

https://polygon-mumbai.infura.io/v3/INFURA_PROJECT_ID

and I also set the rpcEndpoint in index.js so this but I still can't access this object.

@vvronskyFX
Copy link

Any updates on a solution here?

@ljinkai
Copy link

ljinkai commented Jan 20, 2022

This is the right method to fix the problem.
#30

@slawton3
Copy link

UPDATE, figured out that you need to do the following if you are getting this error.

Restart your hardhat node, Redeploy your contracts (1:38:13 in the Youtube video), update your config.js with new contract addresses. In your Metamask on the connected account, go to settings>advanced>reset account to get the nonce back to 0.

@afrazahmmad
Copy link

Facing same issue.
above change and this repo deploy.js both are returning same addresses of nftaddress and nftmarketaddress.
no difference by applying above change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants