From: oysheng <33340252+oysheng@users.noreply.github.com> Date: Tue, 7 Aug 2018 03:05:47 +0000 (+0800) Subject: add control-program for list-addresses (#1235) X-Git-Tag: v1.0.5-alpha~40 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3290c6283caca77306eb9fe6724f00af49c3645e;p=bytom%2Fbytom-spv.git add control-program for list-addresses (#1235) --- diff --git a/api/accounts.go b/api/accounts.go index cc01c0a7..4901c058 100644 --- a/api/accounts.go +++ b/api/accounts.go @@ -2,6 +2,7 @@ package api import ( "context" + "encoding/hex" "sort" log "github.com/sirupsen/logrus" @@ -81,11 +82,12 @@ func (a *API) validateAddress(ctx context.Context, ins struct { } type addressResp struct { - AccountAlias string `json:"account_alias"` - AccountID string `json:"account_id"` - Address string `json:"address"` - Change bool `json:"change"` - KeyIndex uint64 `json:"-"` + AccountAlias string `json:"account_alias"` + AccountID string `json:"account_id"` + Address string `json:"address"` + ControlProgram string `json:"control_program"` + Change bool `json:"change"` + KeyIndex uint64 `json:"-"` } // SortByIndex implements sort.Interface for addressResp slices @@ -128,11 +130,12 @@ func (a *API) listAddresses(ctx context.Context, ins struct { continue } addresses = append(addresses, addressResp{ - AccountAlias: target.Alias, - AccountID: cp.AccountID, - Address: cp.Address, - Change: cp.Change, - KeyIndex: cp.KeyIndex, + AccountAlias: target.Alias, + AccountID: cp.AccountID, + Address: cp.Address, + ControlProgram: hex.EncodeToString(cp.ControlProgram), + Change: cp.Change, + KeyIndex: cp.KeyIndex, }) }