mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-31 09:21:31 +00:00
Add reply parser for ListAddressTransactionCmd.
ok @jrick
This commit is contained in:
parent
3208b7ae75
commit
db5bc2c77c
1 changed files with 13 additions and 1 deletions
14
cmds.go
14
cmds.go
|
@ -36,7 +36,8 @@ func init() {
|
||||||
btcjson.RegisterCustomCmd("getunconfirmedbalance",
|
btcjson.RegisterCustomCmd("getunconfirmedbalance",
|
||||||
parseGetUnconfirmedBalanceCmd, nil, `TODO(jrick) fillmein`)
|
parseGetUnconfirmedBalanceCmd, nil, `TODO(jrick) fillmein`)
|
||||||
btcjson.RegisterCustomCmd("listaddresstransactions",
|
btcjson.RegisterCustomCmd("listaddresstransactions",
|
||||||
parseListAddressTransactionsCmd, nil, `TODO(jrick) fillmein`)
|
parseListAddressTransactionsCmd,
|
||||||
|
parseListAddressTransactionsCmdReply, `TODO(jrick) fillmein`)
|
||||||
btcjson.RegisterCustomCmd("listalltransactions",
|
btcjson.RegisterCustomCmd("listalltransactions",
|
||||||
parseListAllTransactionsCmd, nil, `TODO(jrick) fillmein`)
|
parseListAllTransactionsCmd, nil, `TODO(jrick) fillmein`)
|
||||||
btcjson.RegisterCustomCmd("notifyblocks", parseNotifyBlocksCmd, nil,
|
btcjson.RegisterCustomCmd("notifyblocks", parseNotifyBlocksCmd, nil,
|
||||||
|
@ -1377,6 +1378,17 @@ func parseListAddressTransactionsCmd(r *btcjson.RawCmd) (btcjson.Cmd, error) {
|
||||||
return NewListAddressTransactionsCmd(r.Id, addresses, optArgs...)
|
return NewListAddressTransactionsCmd(r.Id, addresses, optArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parseListAddressTransactionsCmdReply parses a the reply to a
|
||||||
|
// ListAddressTransactionsCmd into a concrete type and returns it packed into
|
||||||
|
// an interface. This is used when registering the custom command with btcjson.
|
||||||
|
func parseListAddressTransactionsCmdReply(message json.RawMessage) (interface{}, error) {
|
||||||
|
var res []btcjson.ListTransactionsResult
|
||||||
|
if err := json.Unmarshal(message, &res); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Id satisifies the Cmd interface by returning the ID of the command.
|
// Id satisifies the Cmd interface by returning the ID of the command.
|
||||||
func (cmd *ListAddressTransactionsCmd) Id() interface{} {
|
func (cmd *ListAddressTransactionsCmd) Id() interface{} {
|
||||||
return cmd.id
|
return cmd.id
|
||||||
|
|
Loading…
Add table
Reference in a new issue