diff --git a/Makefile b/Makefile index ddb46b01f1..6398cd70a9 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,7 @@ check-evm-chain-id: @echo "note: EVM_CHAIN_ID is $(EVM_CHAIN_ID)" update-swagger-docs: statik proto-swagger-gen - $(BINDIR)/statik -src=lite/swagger-ui -dest=lite -f -m + $(BINDIR)/statik -src=client/lite/swagger-ui -dest=lite -f -m @if [ -n "$(git status --porcelain)" ]; then \ echo "\033[91mSwagger docs are out of sync!!!\033[0m";\ exit 1;\ diff --git a/ante/ante.go b/app/ante/ante.go similarity index 100% rename from ante/ante.go rename to app/ante/ante.go diff --git a/ante/decorators.go b/app/ante/decorators.go similarity index 100% rename from ante/decorators.go rename to app/ante/decorators.go diff --git a/ante/handler_options.go b/app/ante/handler_options.go similarity index 100% rename from ante/handler_options.go rename to app/ante/handler_options.go diff --git a/ante/reject_msgs.go b/app/ante/reject_msgs.go similarity index 100% rename from ante/reject_msgs.go rename to app/ante/reject_msgs.go diff --git a/ante/sigverify.go b/app/ante/sigverify.go similarity index 100% rename from ante/sigverify.go rename to app/ante/sigverify.go diff --git a/app/app.go b/app/app.go index 57e0951682..e2c11016b1 100644 --- a/app/app.go +++ b/app/app.go @@ -35,11 +35,11 @@ import ( srvflags "github.com/evmos/ethermint/server/flags" - irishubante "github.com/irisnet/irishub/v2/ante" + irishubante "github.com/irisnet/irishub/v2/app/ante" "github.com/irisnet/irishub/v2/app/keepers" "github.com/irisnet/irishub/v2/app/params" - "github.com/irisnet/irishub/v2/lite" - "github.com/irisnet/irishub/v2/rpc" + "github.com/irisnet/irishub/v2/app/rpc" + "github.com/irisnet/irishub/v2/client/lite" iristypes "github.com/irisnet/irishub/v2/types" ) @@ -326,7 +326,7 @@ func (app *IrisApp) RegisterServices() { } if m.Name() == authtypes.ModuleName { - rpc.RegisterAuthServices(app.configurator, + rpc.OverrideAuthServices(app.configurator, app.GetKey(authtypes.StoreKey), app.AccountKeeper, app.GetSubspace(authtypes.ModuleName)) @@ -371,7 +371,6 @@ func (app *IrisApp) DefaultGenesis() map[string]json.RawMessage { } // Init initializes the IrisApp. -// func (app *IrisApp) Init() { iristypes.Init(app.legacyAmino, app.interfaceRegistry) } diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index b4bdba635d..0c27af24be 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -105,7 +105,6 @@ import ( tokentypes "github.com/irisnet/irismod/modules/token/types" tokenv1 "github.com/irisnet/irismod/modules/token/types/v1" - "github.com/irisnet/irishub/v2/address" guardiankeeper "github.com/irisnet/irishub/v2/modules/guardian/keeper" guardiantypes "github.com/irisnet/irishub/v2/modules/guardian/types" "github.com/irisnet/irishub/v2/modules/internft" @@ -240,7 +239,7 @@ func New( appKeepers.keys[authtypes.StoreKey], ethermint.ProtoAccount, maccPerms, - address.Bech32PrefixAccAddr, + iristypes.Bech32PrefixAccAddr, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/rpc/auth.go b/app/rpc/auth.go similarity index 97% rename from rpc/auth.go rename to app/rpc/auth.go index a52aabef0c..6494fdf150 100644 --- a/rpc/auth.go +++ b/app/rpc/auth.go @@ -28,10 +28,12 @@ type authQueryServer struct { k authkeeper.AccountKeeper } -func RegisterAuthServices(cfg module.Configurator, +// OverrideAuthServices overrides auth query service +func OverrideAuthServices(cfg module.Configurator, key storetypes.StoreKey, k authkeeper.AccountKeeper, - ls paramstypes.Subspace) { + ls paramstypes.Subspace, +) { types.RegisterMsgServer(cfg.MsgServer(), authkeeper.NewMsgServerImpl(k)) types.RegisterQueryServer(cfg.QueryServer(), authQueryServer{key, k}) diff --git a/keystore/keys.go b/client/keystore/keys.go similarity index 100% rename from keystore/keys.go rename to client/keystore/keys.go diff --git a/keystore/keys_test.go b/client/keystore/keys_test.go similarity index 100% rename from keystore/keys_test.go rename to client/keystore/keys_test.go diff --git a/keystore/keystore.go b/client/keystore/keystore.go similarity index 100% rename from keystore/keystore.go rename to client/keystore/keystore.go diff --git a/lite/config.json b/client/lite/config.json similarity index 100% rename from lite/config.json rename to client/lite/config.json diff --git a/lite/statik/statik.go b/client/lite/statik/statik.go similarity index 100% rename from lite/statik/statik.go rename to client/lite/statik/statik.go diff --git a/lite/swagger-ui/favicon-16x16.png b/client/lite/swagger-ui/favicon-16x16.png similarity index 100% rename from lite/swagger-ui/favicon-16x16.png rename to client/lite/swagger-ui/favicon-16x16.png diff --git a/lite/swagger-ui/favicon-32x32.png b/client/lite/swagger-ui/favicon-32x32.png similarity index 100% rename from lite/swagger-ui/favicon-32x32.png rename to client/lite/swagger-ui/favicon-32x32.png diff --git a/lite/swagger-ui/index.html b/client/lite/swagger-ui/index.html similarity index 100% rename from lite/swagger-ui/index.html rename to client/lite/swagger-ui/index.html diff --git a/lite/swagger-ui/swagger-ui-bundle.js b/client/lite/swagger-ui/swagger-ui-bundle.js similarity index 100% rename from lite/swagger-ui/swagger-ui-bundle.js rename to client/lite/swagger-ui/swagger-ui-bundle.js diff --git a/lite/swagger-ui/swagger-ui-standalone-preset.js b/client/lite/swagger-ui/swagger-ui-standalone-preset.js similarity index 100% rename from lite/swagger-ui/swagger-ui-standalone-preset.js rename to client/lite/swagger-ui/swagger-ui-standalone-preset.js diff --git a/lite/swagger-ui/swagger-ui.css b/client/lite/swagger-ui/swagger-ui.css similarity index 100% rename from lite/swagger-ui/swagger-ui.css rename to client/lite/swagger-ui/swagger-ui.css diff --git a/lite/swagger-ui/swagger.yaml b/client/lite/swagger-ui/swagger.yaml similarity index 100% rename from lite/swagger-ui/swagger.yaml rename to client/lite/swagger-ui/swagger.yaml diff --git a/lite/swagger.go b/client/lite/swagger.go similarity index 89% rename from lite/swagger.go rename to client/lite/swagger.go index cf13546a9c..e34ff6d298 100644 --- a/lite/swagger.go +++ b/client/lite/swagger.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" - _ "github.com/irisnet/irishub/v2/lite/statik" + _ "github.com/irisnet/irishub/v2/client/lite/statik" ) // RegisterSwaggerAPI registers swagger route with API Server diff --git a/cmd/iris/cmd/keys.go b/cmd/iris/cmd/keys.go index 99d89a6643..5a4e6a06bc 100644 --- a/cmd/iris/cmd/keys.go +++ b/cmd/iris/cmd/keys.go @@ -3,7 +3,7 @@ package cmd import ( "bufio" "encoding/json" - "io/ioutil" + "os" cosmoshd "github.com/cosmos/cosmos-sdk/crypto/hd" etherminthd "github.com/evmos/ethermint/crypto/hd" @@ -18,7 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/input" "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/irisnet/irishub/v2/keystore" + "github.com/irisnet/irishub/v2/client/keystore" ) // Commands registers a sub-tree of commands to interact with @@ -101,7 +101,7 @@ func importKeyCommand() *cobra.Command { return err } - bz, err := ioutil.ReadFile(args[1]) + bz, err := os.ReadFile(args[1]) if err != nil { return err } diff --git a/cmd/iris/main.go b/cmd/iris/main.go index d56ba05f89..57f02870dd 100644 --- a/cmd/iris/main.go +++ b/cmd/iris/main.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + _ "github.com/irisnet/irishub/v2/client/lite/statik" "github.com/irisnet/irishub/v2/cmd/iris/cmd" - _ "github.com/irisnet/irishub/v2/lite/statik" "github.com/irisnet/irishub/v2/types" ) diff --git a/modules/guardian/types/msgs_test.go b/modules/guardian/types/msgs_test.go index 21b3294533..7801eeb553 100644 --- a/modules/guardian/types/msgs_test.go +++ b/modules/guardian/types/msgs_test.go @@ -10,7 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/irisnet/irishub/v2/address" + "github.com/irisnet/irishub/v2/types" ) // nolint: deadcode unused @@ -24,7 +24,7 @@ var ( ) func init() { - address.ConfigureBech32Prefix() + types.ConfigureBech32Prefix() } // ---------------------------------------------- diff --git a/simapp/app.go b/simapp/app.go index b7a337d19b..f6e8801cd5 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -70,14 +70,14 @@ import ( tokentypes "github.com/irisnet/irismod/modules/token/types" tokenv1 "github.com/irisnet/irismod/modules/token/types/v1" - "github.com/irisnet/irishub/v2/address" - "github.com/irisnet/irishub/v2/lite" + "github.com/irisnet/irishub/v2/client/lite" "github.com/irisnet/irishub/v2/modules/guardian" guardiankeeper "github.com/irisnet/irishub/v2/modules/guardian/keeper" guardiantypes "github.com/irisnet/irishub/v2/modules/guardian/types" "github.com/irisnet/irishub/v2/modules/mint" mintkeeper "github.com/irisnet/irishub/v2/modules/mint/keeper" minttypes "github.com/irisnet/irishub/v2/modules/mint/types" + iristypes "github.com/irisnet/irishub/v2/types" tibcmttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer" tibcnfttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer" @@ -176,7 +176,7 @@ type SimApp struct { func init() { // set bech32 prefix - address.ConfigureBech32Prefix() + iristypes.ConfigureBech32Prefix() // set coin denom regexs sdk.SetCoinDenomRegex(DefaultCoinDenomRegex) @@ -310,7 +310,7 @@ func NewSimApp( keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, - address.Bech32PrefixAccAddr, + iristypes.Bech32PrefixAccAddr, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -662,8 +662,8 @@ func (app *SimApp) TxConfig() client.TxConfig { } // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. -func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { - return ModuleBasics.DefaultGenesis(a.AppCodec()) +func (app *SimApp) DefaultGenesis() map[string]json.RawMessage { + return ModuleBasics.DefaultGenesis(app.AppCodec()) } // AppCodec returns IrisApp's app codec. @@ -750,6 +750,7 @@ func (app *SimApp) RegisterTendermintService(clientCtx client.Context) { ) } +// RegisterNodeService registers the node gRPC service. func (app *SimApp) RegisterNodeService(clientCtx client.Context) { nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) } diff --git a/address/address.go b/types/address.go similarity index 99% rename from address/address.go rename to types/address.go index 81ed9db174..f563f9218c 100644 --- a/address/address.go +++ b/types/address.go @@ -1,4 +1,4 @@ -package address +package types import sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/types/runtime.go b/types/runtime.go index 77b9600478..8b0c025279 100644 --- a/types/runtime.go +++ b/types/runtime.go @@ -16,8 +16,6 @@ import ( tokentypes "github.com/irisnet/irismod/modules/token/types" tokenv1 "github.com/irisnet/irismod/modules/token/types/v1" - - "github.com/irisnet/irishub/v2/address" ) const ( @@ -43,7 +41,7 @@ func Init(legacyAmino *codec.LegacyAmino, interfaceRegistry types.InterfaceRegis func initApp() { // set bech32 prefix - address.ConfigureBech32Prefix() + ConfigureBech32Prefix() // set coin denom regexs sdk.SetCoinDenomRegex(func() string {