Skip to content

Commit

Permalink
CVM: Enable view when caller is empty (#357)
Browse files Browse the repository at this point in the history
* enable cvm view when caller is empty

* address comment
  • Loading branch information
Hyoung-yoon Kim committed Dec 8, 2021
1 parent 4230bea commit e541f2e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion x/cvm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,18 @@ func (q Querier) Account(c context.Context, request *types.QueryAccountRequest)

func (q Querier) View(c context.Context, request *types.QueryViewRequest) (*types.QueryViewResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
caller, err := sdk.AccAddressFromBech32(request.Caller)

var caller sdk.AccAddress
var err error
if request.Caller == "" {
caller = crypto.ZeroAddress.Bytes()
} else {
caller, err = sdk.AccAddressFromBech32(request.Caller)
}
if err != nil {
return nil, err
}

callee, err := sdk.AccAddressFromBech32(request.Callee)
if err != nil {
return nil, err
Expand Down

0 comments on commit e541f2e

Please sign in to comment.