Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcrjson: Add pay to contract hash support. #1260

Merged
merged 1 commit into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions dcrjson/walletsvrcmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,17 @@ func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd {
}
}

// GetContratHashCmd defines the getcontracthash JSON-RPC command.
type GetContractHashCmd struct {
FilePath []string
}

// NewGetBalanceCmd returns a new instance which can be used to issue a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewGetContractHashCmd

// getcontracthash JSON-RPC command.
func NewGetContractHashCmd(filepaths []string) *GetContractHashCmd {
return &GetContractHashCmd{FilePath: filepaths}
}

// GetMasterPubkeyCmd is a type handling custom marshaling and unmarshaling of
// getmasterpubkey JSON wallet extension commands.
type GetMasterPubkeyCmd struct {
Expand Down Expand Up @@ -360,6 +371,19 @@ func NewGetNewAddressCmd(account *string, gapPolicy *string) *GetNewAddressCmd {
}
}

// GetPayToContractHashCmd defines the getpaytocontracthash JSON-RPC command.
davecgh marked this conversation as resolved.
Show resolved Hide resolved
type GetPayToContractAddressCmd struct {
FilePath []string
}

// NewGetPayToContractAddressCmd returns a new instance which can be used to issue a
// getpaytocontractaddress JSON-RPC command.
func NewGetPayToContractAddressCmd(filepaths []string) *GetPayToContractAddressCmd {
return &GetPayToContractAddressCmd{
FilePath: filepaths,
}
}

// GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command.
type GetRawChangeAddressCmd struct {
Account *string
Expand Down Expand Up @@ -1277,9 +1301,11 @@ func init() {
MustRegisterCmd("getaccountaddress", (*GetAccountAddressCmd)(nil), flags)
MustRegisterCmd("getaddressesbyaccount", (*GetAddressesByAccountCmd)(nil), flags)
MustRegisterCmd("getbalance", (*GetBalanceCmd)(nil), flags)
MustRegisterCmd("getcontracthash", (*GetContractHashCmd)(nil), flags)
MustRegisterCmd("getmasterpubkey", (*GetMasterPubkeyCmd)(nil), flags)
MustRegisterCmd("getmultisigoutinfo", (*GetMultisigOutInfoCmd)(nil), flags)
MustRegisterCmd("getnewaddress", (*GetNewAddressCmd)(nil), flags)
MustRegisterCmd("getpaytocontractaddress", (*GetPayToContractAddressCmd)(nil), flags)
MustRegisterCmd("getrawchangeaddress", (*GetRawChangeAddressCmd)(nil), flags)
MustRegisterCmd("getreceivedbyaccount", (*GetReceivedByAccountCmd)(nil), flags)
MustRegisterCmd("getreceivedbyaddress", (*GetReceivedByAddressCmd)(nil), flags)
Expand Down
11 changes: 11 additions & 0 deletions dcrjson/walletsvrresults.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ type GetBestBlockResult struct {
Height int64 `json:"height"`
}

// GetContractHashResult models the data from the getcontracthash command.
type GetContractHashResult struct {
ContractHash string `json:"contracthash"`
}

// GetMultisigOutInfoResult models the data returned from the getmultisigoutinfo
// command.
type GetMultisigOutInfoResult struct {
Expand All @@ -58,6 +63,12 @@ type GetMultisigOutInfoResult struct {
Amount float64 `json:"amount"`
}

// GetPayToContractHashResult models the data returned from the getpaytocontracthash
// command.
type GetPayToContractHashResult struct {
Address string `json:"address"`
}

// GetStakeInfoResult models the data returned from the getstakeinfo
// command.
type GetStakeInfoResult struct {
Expand Down