From 613515e32c11982db0795a1a4cfca5eb7ced3deb Mon Sep 17 00:00:00 2001 From: fudongbai <296179868@qq.com> Date: Wed, 21 Aug 2019 14:35:43 +0800 Subject: [PATCH] change interface of get timelock --- client/rpc/dex_client.go | 18 ++++-------------- go.sum | 2 ++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/client/rpc/dex_client.go b/client/rpc/dex_client.go index 34bdd2aa..3f0fad1b 100644 --- a/client/rpc/dex_client.go +++ b/client/rpc/dex_client.go @@ -29,8 +29,8 @@ type DexClient interface { GetDepth(tradePair string, level int) (*types.OrderBook, error) GetProposals(status types.ProposalStatus, numLatest int64) ([]types.Proposal, error) GetProposal(proposalId int64) (types.Proposal, error) - GetTimelocks(address string) ([]types.TimeLockRecord, error) - GetTimelock(address string, recordID int64) (types.TimeLockRecord, error) + GetTimelocks(addr types.AccAddress) ([]types.TimeLockRecord, error) + GetTimelock(addr types.AccAddress, recordID int64) (types.TimeLockRecord, error) } func (c *HTTP) TxInfoSearch(query string, prove bool, page, perPage int) ([]tx.Info, error) { @@ -246,12 +246,7 @@ func (c *HTTP) GetDepth(tradePair string, level int) (*types.OrderBook, error) { return &ob, nil } -func (c *HTTP) GetTimelocks(address string) ([]types.TimeLockRecord, error) { - - addr, err := types.AccAddressFromBech32(address) - if err != nil { - return nil, err - } +func (c *HTTP) GetTimelocks(addr types.AccAddress) ([]types.TimeLockRecord, error) { params := types.QueryTimeLocksParams{ Account: addr, @@ -281,12 +276,7 @@ func (c *HTTP) GetTimelocks(address string) ([]types.TimeLockRecord, error) { } -func (c *HTTP) GetTimelock(address string, recordID int64) (types.TimeLockRecord, error) { - - addr, err := types.AccAddressFromBech32(address) - if err != nil { - return types.TimeLockRecord{}, err - } +func (c *HTTP) GetTimelock(addr types.AccAddress, recordID int64) (types.TimeLockRecord, error) { params := types.QueryTimeLockParams{ Account: addr, diff --git a/go.sum b/go.sum index 0112e64c..59b31fca 100644 --- a/go.sum +++ b/go.sum @@ -76,6 +76,7 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -83,6 +84,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=