-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
884412c
commit 66852ee
Showing
28 changed files
with
4,049 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/sh | ||
|
||
#ignite scaffold message UserCreate newUser:string alias:string | ||
#ignite scaffold message CardSchemeBuy bid:coin --response cardId:uint | ||
#ignite scaffold message CardSaveContent cardId:uint content:string notes:string artist:string balanceAnchor:bool --response airdropClaimed:bool | ||
ignite scaffold message UserCreate newUser:string alias:string | ||
ignite scaffold message CardSchemeBuy bid:coin --response cardId:uint | ||
ignite scaffold message CardSaveContent cardId:uint content:string notes:string artist:string balanceAnchor:bool --response airdropClaimed:bool | ||
ignite scaffold message CardVote vote:SingleVote --response airdropClaimed:bool |
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 |
---|---|---|
@@ -1,7 +1,49 @@ | ||
syntax = "proto3"; | ||
|
||
package decentralcardgame.cardchain.cardchain; | ||
|
||
option go_package = "github.com/DecentralCardGame/cardchain/x/cardchain/types"; | ||
|
||
import "cardchain/cardchain/voting.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
// Msg defines the Msg service. | ||
service Msg {} | ||
service Msg { | ||
rpc UserCreate(MsgUserCreate) returns (MsgUserCreateResponse); | ||
rpc CardSchemeBuy(MsgCardSchemeBuy) returns (MsgCardSchemeBuyResponse); | ||
rpc CardSaveContent(MsgCardSaveContent) returns (MsgCardSaveContentResponse); | ||
rpc CardVote(MsgCardVote) returns (MsgCardVoteResponse); | ||
} | ||
message MsgUserCreate { | ||
string creator = 1; | ||
string newUser = 2; | ||
string alias = 3; | ||
} | ||
|
||
message MsgUserCreateResponse {} | ||
|
||
message MsgCardSchemeBuy { | ||
string creator = 1; | ||
cosmos.base.v1beta1.Coin bid = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message MsgCardSchemeBuyResponse { uint64 cardId = 1; } | ||
|
||
message MsgCardSaveContent { | ||
string creator = 1; | ||
uint64 cardId = 2; | ||
string content = 3; | ||
string notes = 4; | ||
string artist = 5; | ||
bool balanceAnchor = 6; | ||
} | ||
|
||
message MsgCardSaveContentResponse { bool airdropClaimed = 1; } | ||
|
||
message MsgCardVote { | ||
string creator = 1; | ||
SingleVote vote = 2; | ||
} | ||
|
||
message MsgCardVoteResponse { bool airdropClaimed = 1; } |
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,57 @@ | ||
package cli | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/DecentralCardGame/cardchain/x/cardchain/types" | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
"github.com/spf13/cast" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var _ = strconv.Itoa(0) | ||
|
||
func CmdCardSaveContent() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "card-save-content [card-id] [content] [notes] [artist] [balance-anchor]", | ||
Short: "Broadcast message CardSaveContent", | ||
Args: cobra.ExactArgs(5), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
argCardId, err := cast.ToUint64E(args[0]) | ||
if err != nil { | ||
return err | ||
} | ||
argContent := args[1] | ||
argNotes := args[2] | ||
argArtist := args[3] | ||
argBalanceAnchor, err := cast.ToBoolE(args[4]) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := types.NewMsgCardSaveContent( | ||
clientCtx.GetFromAddress().String(), | ||
argCardId, | ||
argContent, | ||
argNotes, | ||
argArtist, | ||
argBalanceAnchor, | ||
) | ||
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,46 @@ | ||
package cli | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/DecentralCardGame/cardchain/x/cardchain/types" | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var _ = strconv.Itoa(0) | ||
|
||
func CmdCardSchemeBuy() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "card-scheme-buy [bid]", | ||
Short: "Broadcast message CardSchemeBuy", | ||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
argBid, err := sdk.ParseCoinNormalized(args[0]) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := types.NewMsgCardSchemeBuy( | ||
clientCtx.GetFromAddress().String(), | ||
argBid, | ||
) | ||
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,48 @@ | ||
package cli | ||
|
||
import ( | ||
"strconv" | ||
|
||
"encoding/json" | ||
"github.com/spf13/cobra" | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
"github.com/DecentralCardGame/cardchain/x/cardchain/types" | ||
) | ||
|
||
var _ = strconv.Itoa(0) | ||
|
||
func CmdCardVote() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "card-vote [vote]", | ||
Short: "Broadcast message CardVote", | ||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
argVote := new(types.SingleVote) | ||
err = json.Unmarshal([]byte(args[0]), argVote) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := types.NewMsgCardVote( | ||
clientCtx.GetFromAddress().String(), | ||
argVote, | ||
|
||
) | ||
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,44 @@ | ||
package cli | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/DecentralCardGame/cardchain/x/cardchain/types" | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var _ = strconv.Itoa(0) | ||
|
||
func CmdUserCreate() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "user-create [new-user] [alias]", | ||
Short: "Broadcast message UserCreate", | ||
Args: cobra.ExactArgs(2), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
argNewUser := args[0] | ||
argAlias := args[1] | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := types.NewMsgUserCreate( | ||
clientCtx.GetFromAddress().String(), | ||
argNewUser, | ||
argAlias, | ||
) | ||
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,17 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/DecentralCardGame/cardchain/x/cardchain/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
func (k msgServer) CardSaveContent(goCtx context.Context, msg *types.MsgCardSaveContent) (*types.MsgCardSaveContentResponse, error) { | ||
ctx := sdk.UnwrapSDKContext(goCtx) | ||
|
||
// TODO: Handling the message | ||
_ = ctx | ||
|
||
return &types.MsgCardSaveContentResponse{}, nil | ||
} |
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,17 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/DecentralCardGame/cardchain/x/cardchain/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
func (k msgServer) CardSchemeBuy(goCtx context.Context, msg *types.MsgCardSchemeBuy) (*types.MsgCardSchemeBuyResponse, error) { | ||
ctx := sdk.UnwrapSDKContext(goCtx) | ||
|
||
// TODO: Handling the message | ||
_ = ctx | ||
|
||
return &types.MsgCardSchemeBuyResponse{}, nil | ||
} |
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,18 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/DecentralCardGame/cardchain/x/cardchain/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
|
||
func (k msgServer) CardVote(goCtx context.Context, msg *types.MsgCardVote) (*types.MsgCardVoteResponse, error) { | ||
ctx := sdk.UnwrapSDKContext(goCtx) | ||
|
||
// TODO: Handling the message | ||
_ = ctx | ||
|
||
return &types.MsgCardVoteResponse{}, nil | ||
} |
Oops, something went wrong.