feature/implement vault allocation (#11)

* feat: add authentication middleware

* feat: add REST API endpoints for database interactions

* refactor: move DiscoveryDocument Pkl schema to oidc module

* fix: replace sonrd with test_node.sh

* feat: use NFT keeper to mint DID namespace NFT

* refactor: move NFT class configuration to types

* feat: add GlobalIntegrity genesis state

* fix: ensure GlobalIntegrity is initialized in genesis

* refactor: update all references to transactions module

* refactor: improve genesis state struct

* chore(did): update discovery endpoint to reflect base url

* feat: remove unused context cache and client code

* refactor: remove middleware dependency from keeper

* feat: Add new query handlers for DID module

* feat: Implement unimplemented params queries

* feat: add support for first-party caveats

* refactor: move motr command to cmd directory

* feat: add support for GitHub releases

* fix(motr): build app.wasm for motr package

* feat: add card component

* feat: add IndexedDB support for persistent storage

* feat: Add Row and Column components

* feat: add  and  components

* refactor: improve button component

* refactor: remove unnecessary button parameter in renderButton

* feat: add vault service endpoint

* feat: add input component
This commit is contained in:
Prad Nukala
2024-09-14 12:47:25 -04:00
committed by GitHub
parent bbfe2a2329
commit b593245fe6
133 changed files with 13352 additions and 4247 deletions
+18 -26
View File
@@ -4,13 +4,14 @@ import (
"context"
"encoding/json"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
abci "github.com/cometbft/cometbft/abci/types"
"cosmossdk.io/client/v2/autocli"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/x/nft"
nftkeeper "cosmossdk.io/x/nft/keeper"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
@@ -24,17 +25,15 @@ import (
)
const (
// ConsensusVersion defines the current x/did module consensus version.
ConsensusVersion = 1
// this line is used by starport scaffolding # simapp/module/const
)
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleGenesis = AppModule{}
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleGenesis = AppModule{}
_ module.AppModule = AppModule{}
_ autocli.HasAutoCLIConfig = AppModule{}
)
@@ -46,17 +45,20 @@ type AppModuleBasic struct {
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
keeper keeper.Keeper
nftKeeper nftkeeper.Keeper
}
// NewAppModule constructor
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
nftKeeper nftkeeper.Keeper,
) *AppModule {
return &AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
keeper: keeper,
nftKeeper: nftKeeper,
}
}
@@ -66,7 +68,8 @@ func (a AppModuleBasic) Name() string {
func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(&types.GenesisState{
Params: types.DefaultParams(),
GlobalIntegrity: types.DefaultGlobalIntegrity(),
Params: types.DefaultParams(),
})
}
@@ -82,28 +85,13 @@ func (a AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, _ client.TxEn
return nil
}
func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {
// same behavior as in cosmos-sdk
panic(err)
}
}
// Disable in favor of autocli.go. If you wish to use these, it will override AutoCLI methods.
/*
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}
func (a AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}
*/
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
}
@@ -113,11 +101,15 @@ func (a AppModuleBasic) RegisterInterfaces(r codectypes.InterfaceRegistry) {
}
func (a AppModule) InitGenesis(ctx sdk.Context, marshaler codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate {
genesisState := types.DefaultGenesis()
if err := a.keeper.Params.Set(ctx, genesisState.Params); err != nil {
didGenesisState := types.DefaultGenesis()
if err := a.keeper.Params.Set(ctx, didGenesisState.Params); err != nil {
panic(err)
}
nftGenesisState := nft.DefaultGenesisState()
if err := types.DefaultNFTClasses(nftGenesisState); err != nil {
panic(err)
}
a.nftKeeper.InitGenesis(ctx, nftGenesisState)
return nil
}