I did and the person told me not to use truffle console.
I'm trying to run the MetaCoin example in the console.
I ran the following:
$ truffle migrate
Using network 'development'.
Running migration: 1_initial_migration.js
Deploying Migrations...
... 0x655e6257e6c7c0cc9591196cbb0911e714efeb4896401dcb8b639c4928d82511
Migrations: 0x4a49adb28c75892c95afb4dfec9a8015885495cf
Saving successful migration to network...
... 0x5aab19e268906579904fb8e6a2d0d812984f4bbad67957cbbf9d2748f0ffb3cd
Saving artifacts...
Running migration: 2_deploy_contracts.js
Deploying ConvertLib...
... 0x4df7d8843210070723782d6a5e03d210e901a84b8b53ff0258eea63ab73291ac
ConvertLib: 0xa5bd89df0a8d069899b7ef07d440706bf560c7aa
Linking ConvertLib to MetaCoin
Deploying MetaCoin...
... 0x92008b98116d863f425c18d2b528fd0a426b18e8ea9585d86c2c400f1a956fcd
MetaCoin: 0x17c4ac87f01d993c2789cd07cd97a822c95bb9a1
Saving successful migration to network...
... 0xaf18407fee5da8f497519d4ebb55bfe39c4d808862cc8b0a83141ac8d80b2170
Saving artifacts...
Then, I do:
$ truffle console
truffle(development)>
After that:
truffle(development)> a1 = web3.eth.accounts[1]
'0xd27c63fad1a69420205668cb4c06269d535cc52b'
truffle(development)> MetaCoin.sendCoin(a1, 10)
TypeError: MetaCoin.sendCoin is not a function
at evalmachine.<anonymous>:1:10
at ContextifyScript.Script.runInContext (vm.js:59:29)
at Object.runInContext (vm.js:120:6)
at Console.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:199314:17)
at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:200019:18)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:440:10)
at emitOne (events.js:115:13)
at REPLServer.emit (events.js:210:7)
truffle(development)>
I was expecting that I would be able to send the meta coins to the account.
There is an error.
Solidity v0.4.15 (solc-js)
I believe the correct syntax for calling the sendCoin function is
MetaCoin.deployed().then(function(MetaCoinInstance){
MetaCoinInstance.sendCoin(a1, 10);
});
Thanks for providing the syntax example @asifmallik, and thanks @designium for reminding us that certain use cases are unclear :D
Most helpful comment
I believe the correct syntax for calling the
sendCoinfunction is