Hello,
I am trying to familiarize with 'truffle console' by doing the tutorial at:
$truffle migrate
Compiling your contracts...
Compiling ./contracts/SimpleContract.sol : : 2_deploy_contracts.js =====================
Deploying 'SimpleContract' --------------------------
transaction hash: 0xd92a66361f9145398ec0ce5e2a90e2a97f5c10015475b3d2cabcba75eec14e5c Blocks: 0 Seconds: 0 contract address: 0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f block number: 5 block timestamp: 1610603088 account: 0x47FBfdC7eC99871c2D9fFDdd3D77e6c70F727556
`truffle(development)> SimpleContract.at ('0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f');`
> > TruffleContract { constructor: { [Function: TruffleContract] _constructorMethods: { configureNetwork: [Function: configureNetwork], /more/
> >
> > source: '//SPDX-License-Identifier: MIT\npragma solidity >= 0.5.0 < 0.7.0;\n \ncontract SimpleContract {\n string public name;\n constructor() public {\n name = 'my name'; \n }\n function getName() public view returns(string memory) {\n return (name);\n }\n function changeName(string memory _name) public {\n name = _name;\n }\n}\n', :
> >
> > /*more */
Note the above command is showing that the getName() is a function in the source part but still I am getting error with getName().
truffle(development)> SimpleContract.at('0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f').getName();
Thrown: evalmachine.:0 SimpleContract.at('0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f').getName(); ^
TypeError: SimpleContract.at(...).getName is not a function at evalmachine.:0:65 at sigintHandlersWrap (vm.js:288:15) at Script.runInContext (vm.js:130:14) at runScript (/home/zulfi/.nvm/versions/node/v10.22.0/lib/node_modules/truffle/build/cli.bundled.js:494964:21) at Console.interpret (/home/zulfi/.nvm/versions/node/v10.22.0/lib/node_modules/truffle/build/cli.bundled.js:494979:21) at ReplManager.interpret (/home/zulfi/.nvm/versions/node/v10.22.0/lib/node_modules/truffle/build/cli.bundled.js:304740: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) truffle(development)>
Somebody please guide me how to invoke functions using 'truffle console'? Sorry I can't correct the formatting for last paragraph.
Zulfi.