-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client): unify and refactore client package (#2256)
* add metoken client * refactore tx client * metoken queries * add proto.Message validator * use umee client in e2e tests * nil check * add QueryMetokenIndexPrices * lint * rollback change to 20s * fix metoken e2e --------- Co-authored-by: Egor Kostetskiy <[email protected]>
- Loading branch information
1 parent
855f07e
commit da24d25
Showing
16 changed files
with
158 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package client | ||
|
||
import ( | ||
"github.com/umee-network/umee/v6/util/sdkutil" | ||
"github.com/umee-network/umee/v6/x/metoken" | ||
) | ||
|
||
func (c Client) MetokenQClient() metoken.QueryClient { | ||
return metoken.NewQueryClient(c.Query.GrpcConn) | ||
} | ||
|
||
func (c Client) QueryMetokenParams() (metoken.Params, error) { | ||
ctx, cancel := c.NewQCtx() | ||
defer cancel() | ||
|
||
resp, err := c.MetokenQClient().Params(ctx, &metoken.QueryParams{}) | ||
if err != nil { | ||
return metoken.Params{}, err | ||
} | ||
return resp.Params, err | ||
} | ||
|
||
func (c Client) QueryMetokenIndexBalances(denom string) (*metoken.QueryIndexBalancesResponse, error) { | ||
ctx, cancel := c.NewQCtx() | ||
defer cancel() | ||
|
||
msg := &metoken.QueryIndexBalances{MetokenDenom: denom} | ||
if err := sdkutil.ValidateProtoMsg(msg); err != nil { | ||
return nil, err | ||
} | ||
return c.MetokenQClient().IndexBalances(ctx, msg) | ||
} | ||
|
||
func (c Client) QueryMetokenIndexes(denom string) (*metoken.QueryIndexesResponse, error) { | ||
ctx, cancel := c.NewQCtx() | ||
defer cancel() | ||
|
||
msg := &metoken.QueryIndexes{MetokenDenom: denom} | ||
if err := sdkutil.ValidateProtoMsg(msg); err != nil { | ||
return nil, err | ||
} | ||
return c.MetokenQClient().Indexes(ctx, msg) | ||
} | ||
|
||
func (c Client) QueryMetokenIndexPrices(denom string) (*metoken.QueryIndexPricesResponse, error) { | ||
ctx, cancel := c.NewQCtx() | ||
defer cancel() | ||
|
||
msg := &metoken.QueryIndexPrices{MetokenDenom: denom} | ||
if err := sdkutil.ValidateProtoMsg(msg); err != nil { | ||
return nil, err | ||
} | ||
return c.MetokenQClient().IndexPrices(ctx, msg) | ||
} | ||
|
||
// | ||
// Tx | ||
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.