Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

contract deployed but still getting undefined in truffle console #5168

Closed
pbirbarah opened this issue Jun 2, 2022 Discussed in #5167 · 2 comments
Closed

contract deployed but still getting undefined in truffle console #5168

pbirbarah opened this issue Jun 2, 2022 Discussed in #5167 · 2 comments

Comments

@pbirbarah
Copy link

Discussed in https://github.com/orgs/trufflesuite/discussions/5167

Originally posted by pbirbarah June 2, 2022
I have downloaded truffle extension in visual studio and also downloaded ganache. I was able to deploy a contract on ganache (used truffle migrate successfully) but when I use the truffle console to get info about the contract like const bla = await contract.deployed() I get undefined, can't figure out why
ganache pic

@haltman-at
Copy link
Contributor

Well, note that const bla = await contract.deployed() will return undefined due to the fact that it's a statement, rather than expression, but that doesn't mean that bla itself is undefined; if you enter bla afterward, you should see it defined. Can you confirm whether it works?

(Also, if you simply write bla = await contract.deployed(), then since that's an expression, it ought to return the value assigned to bla; unfortunately, due to issue #3349, currently this will also display undefined. However, even here, the assignment does still occur, and if you enter bla afterward, you should see it defined. Again, can you confirm whether this works?)

Thanks!

@pbirbarah
Copy link
Author

Ok thanks!! It worked!

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

No branches or pull requests

2 participants