Skip to content

Commit b30d99f

Browse files
author
nashqueue
committed
ignite cli scaffold module wordle
1 parent d9c1191 commit b30d99f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+9454
-1
lines changed

app/app.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ import (
9999
monitoringptypes "github.com/tendermint/spn/x/monitoringp/types"
100100

101101
"github.com/YazzyYaz/wordle/docs"
102+
wordlemodule "github.com/YazzyYaz/wordle/x/wordle"
103+
wordlemodulekeeper "github.com/YazzyYaz/wordle/x/wordle/keeper"
104+
wordlemoduletypes "github.com/YazzyYaz/wordle/x/wordle/types"
102105
// this line is used by starport scaffolding # stargate/app/moduleImport
103106
)
104107

@@ -153,6 +156,7 @@ var (
153156
transfer.AppModuleBasic{},
154157
vesting.AppModuleBasic{},
155158
monitoringp.AppModuleBasic{},
159+
wordlemodule.AppModuleBasic{},
156160
// this line is used by starport scaffolding # stargate/app/moduleBasic
157161
)
158162

@@ -165,6 +169,7 @@ var (
165169
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
166170
govtypes.ModuleName: {authtypes.Burner},
167171
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
172+
wordlemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
168173
// this line is used by starport scaffolding # stargate/app/maccPerms
169174
}
170175
)
@@ -225,6 +230,7 @@ type App struct {
225230
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
226231
ScopedMonitoringKeeper capabilitykeeper.ScopedKeeper
227232

233+
WordleKeeper wordlemodulekeeper.Keeper
228234
// this line is used by starport scaffolding # stargate/app/keeperDeclaration
229235

230236
// mm is the module manager
@@ -261,6 +267,7 @@ func New(
261267
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
262268
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
263269
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, monitoringptypes.StoreKey,
270+
wordlemoduletypes.StoreKey,
264271
// this line is used by starport scaffolding # stargate/app/storeKey
265272
)
266273
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
@@ -382,6 +389,16 @@ func New(
382389
)
383390
monitoringModule := monitoringp.NewAppModule(appCodec, app.MonitoringKeeper)
384391

392+
app.WordleKeeper = *wordlemodulekeeper.NewKeeper(
393+
appCodec,
394+
keys[wordlemoduletypes.StoreKey],
395+
keys[wordlemoduletypes.MemStoreKey],
396+
app.GetSubspace(wordlemoduletypes.ModuleName),
397+
398+
app.BankKeeper,
399+
)
400+
wordleModule := wordlemodule.NewAppModule(appCodec, app.WordleKeeper, app.AccountKeeper, app.BankKeeper)
401+
385402
// this line is used by starport scaffolding # stargate/app/keeperDefinition
386403

387404
// Create static IBC router, add transfer route, then set and seal it
@@ -423,6 +440,7 @@ func New(
423440
params.NewAppModule(app.ParamsKeeper),
424441
transferModule,
425442
monitoringModule,
443+
wordleModule,
426444
// this line is used by starport scaffolding # stargate/app/appModule
427445
)
428446

@@ -450,6 +468,7 @@ func New(
450468
feegrant.ModuleName,
451469
paramstypes.ModuleName,
452470
monitoringptypes.ModuleName,
471+
wordlemoduletypes.ModuleName,
453472
// this line is used by starport scaffolding # stargate/app/beginBlockers
454473
)
455474

@@ -473,6 +492,7 @@ func New(
473492
ibchost.ModuleName,
474493
ibctransfertypes.ModuleName,
475494
monitoringptypes.ModuleName,
495+
wordlemoduletypes.ModuleName,
476496
// this line is used by starport scaffolding # stargate/app/endBlockers
477497
)
478498

@@ -501,6 +521,7 @@ func New(
501521
ibctransfertypes.ModuleName,
502522
feegrant.ModuleName,
503523
monitoringptypes.ModuleName,
524+
wordlemoduletypes.ModuleName,
504525
// this line is used by starport scaffolding # stargate/app/initGenesis
505526
)
506527

@@ -525,6 +546,7 @@ func New(
525546
ibc.NewAppModule(app.IBCKeeper),
526547
transferModule,
527548
monitoringModule,
549+
wordleModule,
528550
// this line is used by starport scaffolding # stargate/app/appModule
529551
)
530552
app.sm.RegisterStoreDecoders()
@@ -714,6 +736,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
714736
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
715737
paramsKeeper.Subspace(ibchost.ModuleName)
716738
paramsKeeper.Subspace(monitoringptypes.ModuleName)
739+
paramsKeeper.Subspace(wordlemoduletypes.ModuleName)
717740
// this line is used by starport scaffolding # stargate/app/paramSubspace
718741

719742
return paramsKeeper

docs/static/openapi.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30433,6 +30433,42 @@ paths:
3043330433
additionalProperties: {}
3043430434
tags:
3043530435
- Query
30436+
/YazzyYaz/wordle/wordle/params:
30437+
get:
30438+
summary: Parameters queries the parameters of the module.
30439+
operationId: YazzyyazWordleWordleParams
30440+
responses:
30441+
'200':
30442+
description: A successful response.
30443+
schema:
30444+
type: object
30445+
properties:
30446+
params:
30447+
description: params holds all the parameters of this module.
30448+
type: object
30449+
description: >-
30450+
QueryParamsResponse is response type for the Query/Params RPC
30451+
method.
30452+
default:
30453+
description: An unexpected error response.
30454+
schema:
30455+
type: object
30456+
properties:
30457+
code:
30458+
type: integer
30459+
format: int32
30460+
message:
30461+
type: string
30462+
details:
30463+
type: array
30464+
items:
30465+
type: object
30466+
properties:
30467+
'@type':
30468+
type: string
30469+
additionalProperties: {}
30470+
tags:
30471+
- Query
3043630472
definitions:
3043730473
cosmos.auth.v1beta1.Params:
3043830474
type: object
@@ -51891,3 +51927,13 @@ definitions:
5189151927
title: >-
5189251928
SignatureCounts contains information about signature reporting for a
5189351929
number of blocks
51930+
yazzyyaz.wordle.wordle.Params:
51931+
type: object
51932+
description: Params defines the parameters for the module.
51933+
yazzyyaz.wordle.wordle.QueryParamsResponse:
51934+
type: object
51935+
properties:
51936+
params:
51937+
description: params holds all the parameters of this module.
51938+
type: object
51939+
description: QueryParamsResponse is response type for the Query/Params RPC method.

go.mod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ go 1.16
55
require (
66
github.com/cosmos/cosmos-sdk v0.45.4
77
github.com/cosmos/ibc-go/v3 v3.0.0
8+
github.com/gogo/protobuf v1.3.3
9+
github.com/golang/protobuf v1.5.2
10+
github.com/gorilla/mux v1.8.0
11+
github.com/grpc-ecosystem/grpc-gateway v1.16.0
812
github.com/ignite/cli v0.22.2
913
github.com/spf13/cast v1.5.0
14+
github.com/spf13/cobra v1.5.0
1015
github.com/stretchr/testify v1.8.0
1116
github.com/tendermint/spn v0.2.1-0.20220610090138-44b136f042c4
1217
github.com/tendermint/tendermint v0.34.19
1318
github.com/tendermint/tm-db v0.6.7
1419
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
1520
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
1621
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
17-
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
22+
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc
23+
google.golang.org/grpc v1.48.0
24+
gopkg.in/yaml.v2 v2.4.0
1825
)
1926

2027
replace (

proto/wordle/genesis.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
syntax = "proto3";
2+
package yazzyyaz.wordle.wordle;
3+
4+
import "gogoproto/gogo.proto";
5+
import "wordle/params.proto";
6+
// this line is used by starport scaffolding # genesis/proto/import
7+
8+
option go_package = "github.com/YazzyYaz/wordle/x/wordle/types";
9+
10+
// GenesisState defines the wordle module's genesis state.
11+
message GenesisState {
12+
Params params = 1 [(gogoproto.nullable) = false];
13+
// this line is used by starport scaffolding # genesis/proto/state
14+
}

proto/wordle/params.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
syntax = "proto3";
2+
package yazzyyaz.wordle.wordle;
3+
4+
import "gogoproto/gogo.proto";
5+
6+
option go_package = "github.com/YazzyYaz/wordle/x/wordle/types";
7+
8+
// Params defines the parameters for the module.
9+
message Params {
10+
option (gogoproto.goproto_stringer) = false;
11+
12+
}

proto/wordle/query.proto

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
syntax = "proto3";
2+
package yazzyyaz.wordle.wordle;
3+
4+
import "gogoproto/gogo.proto";
5+
import "google/api/annotations.proto";
6+
import "cosmos/base/query/v1beta1/pagination.proto";
7+
import "wordle/params.proto";
8+
// this line is used by starport scaffolding # 1
9+
10+
option go_package = "github.com/YazzyYaz/wordle/x/wordle/types";
11+
12+
// Query defines the gRPC querier service.
13+
service Query {
14+
// Parameters queries the parameters of the module.
15+
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
16+
option (google.api.http).get = "/YazzyYaz/wordle/wordle/params";
17+
}
18+
// this line is used by starport scaffolding # 2
19+
}
20+
21+
// QueryParamsRequest is request type for the Query/Params RPC method.
22+
message QueryParamsRequest {}
23+
24+
// QueryParamsResponse is response type for the Query/Params RPC method.
25+
message QueryParamsResponse {
26+
// params holds all the parameters of this module.
27+
Params params = 1 [(gogoproto.nullable) = false];
28+
}
29+
30+
// this line is used by starport scaffolding # 3

proto/wordle/tx.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
syntax = "proto3";
2+
package yazzyyaz.wordle.wordle;
3+
4+
// this line is used by starport scaffolding # proto/tx/import
5+
6+
option go_package = "github.com/YazzyYaz/wordle/x/wordle/types";
7+
8+
// Msg defines the Msg service.
9+
service Msg {
10+
// this line is used by starport scaffolding # proto/tx/rpc
11+
}
12+
13+
// this line is used by starport scaffolding # proto/tx/message

testutil/keeper/wordle.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package keeper
2+
3+
import (
4+
"testing"
5+
6+
"github.com/YazzyYaz/wordle/x/wordle/keeper"
7+
"github.com/YazzyYaz/wordle/x/wordle/types"
8+
"github.com/cosmos/cosmos-sdk/codec"
9+
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
10+
"github.com/cosmos/cosmos-sdk/store"
11+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
12+
sdk "github.com/cosmos/cosmos-sdk/types"
13+
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
14+
"github.com/stretchr/testify/require"
15+
"github.com/tendermint/tendermint/libs/log"
16+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
17+
tmdb "github.com/tendermint/tm-db"
18+
)
19+
20+
func WordleKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
21+
storeKey := sdk.NewKVStoreKey(types.StoreKey)
22+
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)
23+
24+
db := tmdb.NewMemDB()
25+
stateStore := store.NewCommitMultiStore(db)
26+
stateStore.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db)
27+
stateStore.MountStoreWithDB(memStoreKey, sdk.StoreTypeMemory, nil)
28+
require.NoError(t, stateStore.LoadLatestVersion())
29+
30+
registry := codectypes.NewInterfaceRegistry()
31+
cdc := codec.NewProtoCodec(registry)
32+
33+
paramsSubspace := typesparams.NewSubspace(cdc,
34+
types.Amino,
35+
storeKey,
36+
memStoreKey,
37+
"WordleParams",
38+
)
39+
k := keeper.NewKeeper(
40+
cdc,
41+
storeKey,
42+
memStoreKey,
43+
paramsSubspace,
44+
nil,
45+
)
46+
47+
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())
48+
49+
// Initialize params
50+
k.SetParams(ctx, types.DefaultParams())
51+
52+
return k, ctx
53+
}

0 commit comments

Comments
 (0)