[wip] refactor

This commit is contained in:
Roy Crihfield 2024-10-27 19:55:57 +08:00
parent f85ec5ca1f
commit 8241f964b0
5 changed files with 6 additions and 22 deletions

View File

@ -228,7 +228,7 @@ func (app *LaconicApp) InterfaceRegistry() coreserver.InterfaceRegistry {
}
// GetKey returns the KVStoreKey for the provided store key.
func (app *LaconicApp) GetStore() store.RootStore {
func (app *LaconicApp) Store() store.RootStore {
return app.store
}

View File

@ -29,7 +29,7 @@ func (app *LaconicApp) ExportAppStateAndValidators(
return exportedApp, err
}
readerMap, err := app.GetStore().StateAt(latestHeight)
readerMap, err := app.Store().StateAt(latestHeight)
if err != nil {
return exportedApp, err
}

View File

@ -138,7 +138,7 @@ func txCommand() *cobra.Command {
}
func newApp(logger log.Logger, viper *viper.Viper) serverv2.AppI[app.AppTx] {
viper.Set(serverv2.FlagHome, app.DefaultNodeHome)
// viper.Set(serverv2.FlagHome, app.DefaultNodeHome)
lacapp, err := app.NewLaconicApp(logger, viper, true)
if err != nil {
panic(err)
@ -146,22 +146,6 @@ func newApp(logger log.Logger, viper *viper.Viper) serverv2.AppI[app.AppTx] {
return serverv2.AppI[app.AppTx](lacapp)
}
// // newApp is an appCreator
// func newApp(
// logger log.Logger,
// db corestore.KVStoreWithBatch,
// traceStore io.Writer,
// appOpts servertypes.AppOptions,
// ) *app.LaconicApp {
// var _ = db
// // baseappOptions := server.DefaultBaseappOptions(appOpts)
// app, err := app.NewLaconicApp(logger, viper, true)
// if err != nil {
// panic(err)
// }
// return app
// }
// appExport creates a new simapp (optionally at a given height) and exports state.
func appExport(
ctx context.Context,

View File

@ -69,7 +69,7 @@ func initServerConfig() serverv2.ServerConfig {
// own app.toml to override, or use this default value.
//
// In simapp, we set the min gas prices to 0.
serverCfg.MinGasPrices = "0stake"
// serverCfg.MinGasPrices = "0stake"
return serverCfg
}

View File

@ -81,14 +81,14 @@ func NewRootCmd() *cobra.Command {
return err
}
clientCtx, err = config.ReadFromClientConfig(clientCtx)
clientCtx, err = config.CreateClientConfig(clientCtx, "", nil)
if err != nil {
return err
}
// sign mode textual is only available in online mode
if !clientCtx.Offline {
// This needs to go after ReadFromClientConfig, as that function ets the RPC client needed for SIGN_MODE_TEXTUAL.
// This needs to happen after initializing the client context so the RPC client is set
txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx)
txConfigWithTextual, err := tx.NewTxConfigWithOptions(