dcrjson: Add VerifySeedCmd.
This commit is contained in:
parent
71500c80f2
commit
fd99f572cf
6
Gopkg.lock
generated
6
Gopkg.lock
generated
@ -87,7 +87,7 @@
|
||||
branch = "master"
|
||||
name = "github.com/decred/base58"
|
||||
packages = ["."]
|
||||
revision = "229e657bc9be5d592855a910428907f851950ed5"
|
||||
revision = "56c501706f00d9e1cfacee19a27117e12da24734"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/jessevdk/go-flags"
|
||||
@ -114,7 +114,7 @@
|
||||
"ripemd160",
|
||||
"ssh/terminal"
|
||||
]
|
||||
revision = "beaf6a35706e5032ae4c3fcf342c663c069f44d2"
|
||||
revision = "88942b9c40a4c9d203b82b3731787b672d6e809b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@ -123,7 +123,7 @@
|
||||
"unix",
|
||||
"windows"
|
||||
]
|
||||
revision = "f6cff0780e542efa0c8e864dc8fa522808f6a598"
|
||||
revision = "13d03a9a82fba647c21a0ef8fba44a795d0f0835"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2014 The btcsuite developers
|
||||
// Copyright (c) 2015-2016 The Decred developers
|
||||
// Copyright (c) 2015-2018 The Decred developers
|
||||
// Use of this source code is governed by an ISC
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@ -524,6 +524,24 @@ func NewSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKey
|
||||
}
|
||||
}
|
||||
|
||||
// VerifySeedCmd defines the verifyseed JSON-RPC command.
|
||||
type VerifySeedCmd struct {
|
||||
Seed string
|
||||
Account *uint32
|
||||
}
|
||||
|
||||
// NewVerifySeedCmd returns a new instance which can be used to issue a
|
||||
// walletlock JSON-RPC command.
|
||||
//
|
||||
// The parameters which are pointers indicate that they are optional. Passing
|
||||
// nil for the optional parameters will use the default value.
|
||||
func NewVerifySeedCmd(seed string, account *uint32) *VerifySeedCmd {
|
||||
return &VerifySeedCmd{
|
||||
Seed: seed,
|
||||
Account: account,
|
||||
}
|
||||
}
|
||||
|
||||
// WalletLockCmd defines the walletlock JSON-RPC command.
|
||||
type WalletLockCmd struct{}
|
||||
|
||||
@ -597,6 +615,7 @@ func init() {
|
||||
MustRegisterCmd("settxfee", (*SetTxFeeCmd)(nil), flags)
|
||||
MustRegisterCmd("signmessage", (*SignMessageCmd)(nil), flags)
|
||||
MustRegisterCmd("signrawtransaction", (*SignRawTransactionCmd)(nil), flags)
|
||||
MustRegisterCmd("verifyseed", (*VerifySeedCmd)(nil), flags)
|
||||
MustRegisterCmd("walletlock", (*WalletLockCmd)(nil), flags)
|
||||
MustRegisterCmd("walletpassphrase", (*WalletPassphraseCmd)(nil), flags)
|
||||
MustRegisterCmd("walletpassphrasechange", (*WalletPassphraseChangeCmd)(nil), flags)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2014 The btcsuite developers
|
||||
// Copyright (c) 2015-2016 The Decred developers
|
||||
// Copyright (c) 2015-2018 The Decred developers
|
||||
// Use of this source code is governed by an ISC
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@ -1071,6 +1071,35 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||
Flags: dcrjson.String("ALL"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "verifyseed",
|
||||
newCmd: func() (interface{}, error) {
|
||||
return dcrjson.NewCmd("verifyseed", "abc")
|
||||
},
|
||||
staticCmd: func() interface{} {
|
||||
return dcrjson.NewVerifySeedCmd("abc", nil)
|
||||
},
|
||||
marshalled: `{"jsonrpc":"1.0","method":"verifyseed","params":["abc"],"id":1}`,
|
||||
unmarshalled: &dcrjson.VerifySeedCmd{
|
||||
Seed: "abc",
|
||||
Account: nil,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "verifyseed optional",
|
||||
newCmd: func() (interface{}, error) {
|
||||
return dcrjson.NewCmd("verifyseed", "abc", 5)
|
||||
},
|
||||
staticCmd: func() interface{} {
|
||||
account := dcrjson.Uint32(5)
|
||||
return dcrjson.NewVerifySeedCmd("abc", account)
|
||||
},
|
||||
marshalled: `{"jsonrpc":"1.0","method":"verifyseed","params":["abc",5],"id":1}`,
|
||||
unmarshalled: &dcrjson.VerifySeedCmd{
|
||||
Seed: "abc",
|
||||
Account: dcrjson.Uint32(5),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "walletlock",
|
||||
newCmd: func() (interface{}, error) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2014 The btcsuite developers
|
||||
// Copyright (c) 2015-2016 The Decred developers
|
||||
// Copyright (c) 2015-2018 The Decred developers
|
||||
// Use of this source code is governed by an ISC
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@ -187,6 +187,13 @@ type SignRawTransactionResult struct {
|
||||
Errors []SignRawTransactionError `json:"errors,omitempty"`
|
||||
}
|
||||
|
||||
// VerifySeedResult models the data returned by the wallet server verify
|
||||
// seed command.
|
||||
type VerifySeedResult struct {
|
||||
Result bool `json:"keyresult"`
|
||||
CoinType uint32 `json:"cointype"`
|
||||
}
|
||||
|
||||
// ValidateAddressWalletResult models the data returned by the wallet server
|
||||
// validateaddress command.
|
||||
type ValidateAddressWalletResult struct {
|
||||
|
||||
@ -287,6 +287,7 @@ var rpcAskWallet = map[string]struct{}{
|
||||
"signrawtransaction": {},
|
||||
"sweepaccount": {},
|
||||
"stakepooluserinfo": {},
|
||||
"verifyseed": {},
|
||||
"walletinfo": {},
|
||||
"walletlock": {},
|
||||
"walletpassphrase": {},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user