-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to be committed: Initial Base
- Loading branch information
Showing
15 changed files
with
786 additions
and
21 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cli | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/gokulsan/bsn/x/bsn/types" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var _ = strconv.Itoa(0) | ||
|
||
func CmdBsn() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "bsn", | ||
Short: "Query bsn", | ||
Args: cobra.ExactArgs(0), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
queryClient := types.NewQueryClient(clientCtx) | ||
|
||
params := &types.QueryBsnRequest{} | ||
|
||
res, err := queryClient.Bsn(cmd.Context(), params) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return clientCtx.PrintProto(res) | ||
}, | ||
} | ||
|
||
flags.AddQueryFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
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,44 @@ | ||
package cli | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
"github.com/gokulsan/bsn/x/bsn/types" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var _ = strconv.Itoa(0) | ||
|
||
func CmdCreatePost() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "create-post [title] [body]", | ||
Short: "Broadcast message createPost", | ||
Args: cobra.ExactArgs(2), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
argTitle := args[0] | ||
argBody := args[1] | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := types.NewMsgCreatePost( | ||
clientCtx.GetFromAddress().String(), | ||
argTitle, | ||
argBody, | ||
) | ||
if err := msg.ValidateBasic(); err != nil { | ||
return err | ||
} | ||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) | ||
}, | ||
} | ||
|
||
flags.AddTxFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
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,23 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/gokulsan/bsn/x/bsn/types" | ||
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
) | ||
|
||
func (k Keeper) Bsn(goCtx context.Context, req *types.QueryBsnRequest) (*types.QueryBsnResponse, error) { | ||
if req == nil { | ||
return nil, status.Error(codes.InvalidArgument, "invalid request") | ||
} | ||
|
||
ctx := sdk.UnwrapSDKContext(goCtx) | ||
|
||
// TODO: Process the query | ||
_ = ctx | ||
|
||
return &types.QueryBsnResponse{}, nil | ||
} |
Oops, something went wrong.