[Supplier] Just scaffold the Supplier module with a few params #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Ran the following command:
Summary generated by Reviewpad on 09 Oct 23 16:42 UTC
This pull request introduces several changes across multiple files:
A new file has been added that contains code for querying parameters in the supplier module. It imports necessary packages such as
context
,sdk
,codes
,status
, andtypes
. TheParams
function takes a context and a request object as parameters and returns a response object and an error. It checks for a valid request and unwraps the SDK context before returning the parameters from the keeper.A new file "genesis.proto" has been added to the "proto/pocket/supplier" directory. This file is written in proto3 syntax and belongs to the "pocket.supplier" package. It imports "gogoproto/gogo.proto" and "pocket/supplier/params.proto". The go package option is set to "pocket/x/supplier/types". The file defines a message called GenesisState that has a nested message called Params. The Params message is required (not nullable).
A new file called
module.go
has been added in thesupplier
package. The file contains the implementation of thesupplier
module, which is a Cosmos SDK module. It includes methods for registering the module's legacy amino codec, registering interface types, returning the default genesis state, validating the genesis state, registering gRPC Gateway routes, and getting the root Tx and query commands for the module. The file also defines theBeginBlock
andEndBlock
methods.A new file named
genesis_test.go
has been added in thex/supplier
package. It defines a test functionTestGenesis
that tests the genesis state of thesupplier
module. It initializes a genesis state usingtypes.DefaultParams()
, initializes the supplier keeper and context usingkeepertest.SupplierKeeper(t)
, and callssupplier.InitGenesis
andsupplier.ExportGenesis
functions. Finally, it asserts that the exported genesis state is not nil usingrequire.NotNil(t, got)
.A new file named "params.proto" has been added in the "pocket/supplier" directory. It defines a protocol buffer message named "Params" with several fields and options. The file also imports "gogoproto/gogo.proto" and sets the Go package name to "pocket/x/supplier/types".
A new file named
params_test.go
has been added. It defines a test functionTestGetParams
that tests the retrieval of parameters in thesupplier
module. It sets up aSupplierKeeper
and context, calls theGetParams
function, and performs assertions to verify the correctness of the returned parameters.A new file named
codec.go
has been added to thex/supplier/types
package. It defines functions for registering a codec and interfaces, as well as variables for the codec and module CDC.A new file named
query_params.go
has been added in thex/supplier/client/cli
directory. It contains a command for querying and displaying the parameters of the module.Changes have been made to various files to integrate the
supplier
module, including importing the module, adding it to lists of modules, initializing theSupplierKeeper
, and defining and implementing specific module functions.Additional changes include the addition of new files, such as
types.go
,keys.go
,genesis_test.go
,helpers.go
,msg_server_test.go
,params.go
,query.go
,tx.go
,errors.go
, andparams.go
, with various implementations and functionalities specific to thesupplier
module.Please review the individual summaries for more details on each file.
Issue
Part of #7
Type of change
Select one or more:
Testing
make test_all_unit
Sanity Checklist