Add import of raw private key RPCs (#2942)
* Importing an account from raw secret * Add jsapi & jsonrpc for personal_newAccountFromSecret
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { inAddress, inNumber10, inNumber16, inOptions } from '../../format/input';
|
||||
import { inAddress, inHex, inNumber10, inNumber16, inOptions } from '../../format/input';
|
||||
import { outAccountInfo, outAddress, outSignerRequest } from '../../format/output';
|
||||
|
||||
export default class Personal {
|
||||
@@ -73,6 +73,12 @@ export default class Personal {
|
||||
.then(outAddress);
|
||||
}
|
||||
|
||||
newAccountFromSecret (secret, password) {
|
||||
return this._transport
|
||||
.execute('personal_newAccountFromSecret', inHex(secret), password)
|
||||
.then(outAddress);
|
||||
}
|
||||
|
||||
newAccountFromWallet (json, password) {
|
||||
return this._transport
|
||||
.execute('personal_newAccountFromWallet', json, password)
|
||||
|
||||
@@ -141,7 +141,7 @@ export default {
|
||||
},
|
||||
|
||||
newAccountFromPhrase: {
|
||||
desc: 'Creates a new account from a brainwallet passphrase',
|
||||
desc: 'Creates a new account from a recovery passphrase',
|
||||
params: [
|
||||
{
|
||||
type: String,
|
||||
@@ -158,6 +158,24 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
newAccountFromSecret: {
|
||||
desc: 'Creates a new account from a private ethstore secret key',
|
||||
params: [
|
||||
{
|
||||
type: Data,
|
||||
desc: 'Secret, 32-byte hex'
|
||||
},
|
||||
{
|
||||
type: String,
|
||||
desc: 'Password'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: Address,
|
||||
desc: 'The created address'
|
||||
}
|
||||
},
|
||||
|
||||
newAccountFromWallet: {
|
||||
desc: 'Creates a new account from a JSON import',
|
||||
params: [
|
||||
|
||||
Reference in New Issue
Block a user