Parity/light.js personal_signTransaction method not found -32601
RichardQin918 opened this issue · 2 comments
RichardQin918 commented
I am trying to run parity-light and use parity/light.js to make my send calls (through post$)
I first import my account as keystore file with passphrase and unlocked it under parity's keystore dir
The JSON-RPC apis calls works fine when I follow https://wiki.parity.io/JSONRPC-personal-module.html#personal_sendtransaction.
curl --data '{"method":"personal_unlockAccount","params":["0x4308C4533006420aCf64430442caa4653D2F2355","abc123",null],"id":3,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
curl --data '{"method":"personal_sendTransaction","params":[{"from":"0x4308C4533006420aCf64430442caa4653D2F2355","to":"0x9Df27e38f7eEB3f3e06De1b2Aea027CdCEf346aa","data":"0x41cd5add4fd13aedd64521e363ea279923575ff39718065d38bd46f0e6632e8e","value":"0x186a0"},"abc123"],"id":3,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
However the light.js post$ returns me error as stated in the title. I wonder if I am calling it correct or it is a issue that has not been solved
import React from 'react';
import ReactDOM from 'react-dom';
import light, { blockNumber$, balanceOf$, post$, makeContract, defaultAccount$ } from '@parity/light.js';
import App from './App';
import provider from './provider';
import { map, filter, switchMap } from 'rxjs/operators';
import Web3 from 'web3'
const myAddress = '0x4308C4533006420aCf64430442caa4653D2F2355'
const secondAddress = '0x9Df27e38f7eEB3f3e06De1b2Aea027CdCEf346aa'
......
post$({
from: myAddress,
to: secondAddress,
value: 100 * 1e15 // value in wei
}, {
passphrase: 'abc123'
}).subscribe(console.log);
error:
personal_signTransaction([{"from":"0x4308c4533006420acf64430442caa4653d2f2355","to":"0x9df27e38f7eeb3f3e06de1b2aea027cdcef346aa","value":"0x16345785d8a0000"},"abc123"]): -32601: Method not found
Running parity-light
parity --light --chain=ropsten --mode=active -l sync=debug --unfe-expose --jsonrpc-apis=all --max-peers=10
library ver
"@parity/api": "^5.1.7",
"@parity/contracts": "^5.1.7",
"@parity/light.js": "^5.1.7",
amaury1729 commented
The personal
namespace isn't open by default, you could:
- either run parity with
--ws-apis=all
- or, when you do
light.setApi
/light.setProvider
, pass in a secure token (which then automatically opens thepersonal
namespace)
RichardQin918 commented
@amaurymartiny Thank you for the fast reply! It worked after I added --ws option in parity-light.