Skip to content

Commit

Permalink
dcrjson: additions for pay to contract hash
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsands committed Jun 5, 2018
1 parent b730f98 commit 4b650c2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
23 changes: 23 additions & 0 deletions dcrjson/walletsvrcmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd {
}
}

type GetContractHashCmd struct {
FilePath []string
}

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 +368,19 @@ func NewGetNewAddressCmd(account *string, gapPolicy *string) *GetNewAddressCmd {
}
}

// GetPayToContractHashCmd defines the getpaytocontracthash JSON-RPC command.
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 +1298,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"`
}

// GetContractHash 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

0 comments on commit 4b650c2

Please sign in to comment.