Skip to content

Commit

Permalink
fix(assets): deprecate StakerExoCoreAddr
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMustermann2 committed May 30, 2024
1 parent 0649300 commit 64287b2
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 252 deletions.
10 changes: 5 additions & 5 deletions proto/exocore/assets/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ service Query {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/exocore/assets/v1/QueStakerSpecifiedAssetAmount";
}
// StakerExCoreAddr queries the staker exocore address.
rpc QueStakerExoCoreAddr(QueryStakerExCoreAddr) returns (QueryStakerExCoreAddrResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/exocore/assets/v1/QueStakerExoCoreAddr/{staker}";
}
// // StakerExCoreAddr queries the staker exocore address.
// rpc QueStakerExoCoreAddr(QueryStakerExCoreAddr) returns (QueryStakerExCoreAddrResponse) {
// option (cosmos.query.v1.module_query_safe) = true;
// option (google.api.http).get = "/exocore/assets/v1/QueStakerExoCoreAddr/{staker}";
// }
}

66 changes: 33 additions & 33 deletions x/assets/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,36 +332,36 @@ func QueOperatorSpecifiedAssetAmount() *cobra.Command {
return cmd
}

// QueStakerExoCoreAddr queries staker ExoCore address
func QueStakerExoCoreAddr() *cobra.Command {
cmd := &cobra.Command{
Use: "QueStakerExoCoreAddr stakerID",
Short: "Get staker ExoCore address",
Long: "Get staker ExoCore address",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

stakerID := args[0]
if _, _, err := types.ValidateID(stakerID, false, false); err != nil {
return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error())
}

queryClient := types.NewQueryClient(clientCtx)
req := &types.QueryStakerExCoreAddr{
Staker: strings.ToLower(stakerID),
}
res, err := queryClient.QueStakerExoCoreAddr(context.Background(), req)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// // QueStakerExoCoreAddr queries staker ExoCore address
// func QueStakerExoCoreAddr() *cobra.Command {
// cmd := &cobra.Command{
// Use: "QueStakerExoCoreAddr stakerID",
// Short: "Get staker ExoCore address",
// Long: "Get staker ExoCore address",
// Args: cobra.ExactArgs(1),
// RunE: func(cmd *cobra.Command, args []string) error {
// clientCtx, err := client.GetClientQueryContext(cmd)
// if err != nil {
// return err
// }

// stakerID := args[0]
// if _, _, err := types.ValidateID(stakerID, false, false); err != nil {
// return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error())
// }

// queryClient := types.NewQueryClient(clientCtx)
// req := &types.QueryStakerExCoreAddr{
// Staker: strings.ToLower(stakerID),
// }
// res, err := queryClient.QueStakerExoCoreAddr(context.Background(), req)
// if err != nil {
// return err
// }
// return clientCtx.PrintProto(res)
// },
// }

// flags.AddQueryFlagsToCmd(cmd)
// return cmd
// }
18 changes: 9 additions & 9 deletions x/assets/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ func (k Keeper) QueOperatorSpecifiedAssetAmount(ctx context.Context, req *assets
return k.GetOperatorSpecifiedAssetInfo(c, addr, req.AssetID)
}

// QueStakerExoCoreAddr outdated,will be deprecated
func (k Keeper) QueStakerExoCoreAddr(ctx context.Context, req *assetstype.QueryStakerExCoreAddr) (*assetstype.QueryStakerExCoreAddrResponse, error) {
c := sdk.UnwrapSDKContext(ctx)
exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.Staker)
if err != nil {
return nil, err
}
return &assetstype.QueryStakerExCoreAddrResponse{ExoCoreAddr: exoCoreAddr}, nil
}
// // QueStakerExoCoreAddr outdated,will be deprecated
// func (k Keeper) QueStakerExoCoreAddr(ctx context.Context, req *assetstype.QueryStakerExCoreAddr) (*assetstype.QueryStakerExCoreAddrResponse, error) {
// c := sdk.UnwrapSDKContext(ctx)
// exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.Staker)
// if err != nil {
// return nil, err
// }
// return &assetstype.QueryStakerExCoreAddrResponse{ExoCoreAddr: exoCoreAddr}, nil
// }
Loading

0 comments on commit 64287b2

Please sign in to comment.