-
Notifications
You must be signed in to change notification settings - Fork 551
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
.deployed() is not a function #33
Comments
you may want to check that. My version does not have that error. |
I was having issues with the deployed() function as well. I was using Brave but after switching to Chrome it worked. `
}, As well as the contract definition
I think a good test is simply if you see the results of the following in the Console then your contract is definitely on the block chain. The error you are getting is environment related, likely a browser issue.
|
I was also using Brave. I will try this and let you know. Thanks for the
response !
On Thu, Jun 2, 2022 at 12:43 PM Rami Sorikh ***@***.***> wrote:
I was having issues with the deployed() function as well.
I was using Brave but after switching to Chrome it worked.
Here is a copy of my code
` loadContract: async () => {
// Create a JavaScript version of the smart contract
// which allows us to call the functions in the contract (interact with it)
const todoList = await $.getJSON('TodoList.json')
console.log(todoList)
App.contracts.TodoList = TruffleContract(todoList)
App.contracts.TodoList.setProvider(App.web3Provider)
// Hydrate the smart contract with values from the blockchain
// This makes it live and accessible
App.todoList = await App.contracts.TodoList.deployed()
}`
As well as the contract definition
contracts: {}, // create empty contract object
I think a good test is simply if you see the results of the following in
the Console then your contract is definitely on the block chain. The error
you are getting is environment related, likely a browser issue.
Brave is great, but I have come across a number of "issues" with it. I
would stick to Chrome for all dev purposes.
console.log(todoList)
—
Reply to this email directly, view it on GitHub
<#33 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFK6BWCEIZ2HIJDQS4LG4WDVNDQBPANCNFSM5XHJLI5Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Thank you,
Dan Colantonio
|
No worries. Hope it works. Note: Might be worth noting to save you time that the code I provided above is pretty much the original give or take my comments. |
@ramiware no luck with this, deployed is not a function, task count is not a function either |
Can you share your TodoList.sol file contents? |
It occured to me too, apparently I did not migrate my code |
async function main() { //ignore this line. //await token.deploy(); //try to print token.address => you will get object. But the key is not address . address is within runner key . So you have to access it with token.runner.address instead of token.address. // console.log(token.address); // We recommend this pattern to be able to use async/await everywhere |
async function main() { //just like in above example i am using BRRAVE browser |
I had the same issue and found the answer: "waitForDeployment" just like this:
|
code:
error:
TypeError: App.contracts.TodoList.deployed is not a function
did anyone run into this problem or does anyone know a fix/workaround?
The text was updated successfully, but these errors were encountered: