When I invoke a method of web3.eth.personal I receive an error as follows:
> web3.eth.personal.getAccounts().then(console.log);
Promise {
<pending>,
domain:
Domain {
domain: null,
_events:
{ removeListener: [Function: updateExceptionCapture],
newListener: [Function: updateExceptionCapture],
error: [Function: debugDomainError] },
_eventsCount: 3,
_maxListeners: undefined,
members: [] } }
> (node:34481) UnhandledPromiseRejectionWarning: Error: Returned error: Method not found
at Object.ErrorResponse (/home/s/node_modules/web3-core-helpers/src/errors.js:29:16)
at /home/s/node_modules/web3-core-requestmanager/src/index.js:140:36
at XMLHttpRequest.request.onreadystatechange (/home/s/node_modules/web3-providers-http/src/index.js:77:13)
at XMLHttpRequestEventTarget.dispatchEvent (/home/s/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/home/s/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/home/s/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage.<anonymous> (/home/s/node_modules/xhr2/lib/xhr2.js:469:24)
at IncomingMessage.emit (events.js:185:15)
at IncomingMessage.emit (domain.js:440:23)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:178:19)
(node:34481) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:34481) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Do I need to install or define any additional requirements ? Also I have installed web3-eth-personal as follows:
npm install web3-eth-personal
And then I use following commands:
var Personal = require('web3-eth-personal');
var personal = new Personal( new Personal.providers.HttpProvider("http://localhost:8545"));
web3.eth.personal.getAccounts().then(console.log);
PS. I found the solution: I started the Parity with Parity --chain tobalaba --jsonrpc-hosts all --jsonrpc-interface all --jsonrpc-cors '*' --jsonrpc-apis 'web3,eth,net,parity,traces,rpc,parity_set,personal'
and now it works.