各位大神好,小弟剛接觸以太坊開發,費了好大功夫裝好環境,模擬智能合約又除錯不過了,折騰了幾個小時,有沒哪位朋友能幫指點一下錯誤原因嗎?
truffle下unbox的MetaCoin代碼沒修改過,直接compile,mirgaration后在console下執行如下命令,一直提示錯誤。萬分感謝
truffle(ganache)> MetaCoin.deployed().getBalance.call(web3.eth.accounts[0])
Thrown:
evalmachine.<anonymous>:0
MetaCoin.deployed().getBalance.call(web3.eth.accounts[0])
^
TypeError: Cannot read property 'call' of undefined
at evalmachine.<anonymous>:0:31
at Script.runInContext (vm.js:133:20)
at runScript (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:535394:21)
at Console.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:535409:21)
at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:385867:18)
at bound (domain.js:402:14)
at REPLServer.runBound [as eval] (domain.js:415:12)
at REPLServer.onLine (repl.js:642:10)
at REPLServer.emit (events.js:198:13)
at REPLServer.EventEmitter.emit (domain.js:448:20)
uj5u.com熱心網友回復:
論壇太冷清了哈。沒辦法,去翻了truffle官網的說明,應該是實體申明的方式在v5.0下不一樣了,用let instance = await MetaCoin.deployed()后搞定了轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/30145.html
標籤:區塊鏈技術
上一篇:供應鏈的問題
下一篇:智能合約
