Skip to content

Commit

Permalink
add pulsar module config to appconfig and fix import not exist for mo…
Browse files Browse the repository at this point in the history
…dule v1
  • Loading branch information
Pantani committed Jun 18, 2023
1 parent 2c1d178 commit eb88671
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ignite/templates/module/create/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ func appConfigModify(replacer placeholder.Replacer, opts *CreateOptions) genny.R

// Import
template := `%[2]vmoduletypes "%[3]v/x/%[2]v/types"
%[2]vmodulev1 "%[3]v/api/%[4]v/%[2]v/module"
%[1]v`
replacement := fmt.Sprintf(template, module.PlaceholderSgAppModuleImport, opts.ModuleName, opts.ModulePath)
replacement := fmt.Sprintf(template, module.PlaceholderSgAppModuleImport, opts.ModuleName, opts.ModulePath, opts.AppName)
content := replacer.Replace(fConfig.String(), module.PlaceholderSgAppModuleImport, replacement)

// Init genesis
Expand All @@ -110,6 +111,13 @@ func appConfigModify(replacer placeholder.Replacer, opts *CreateOptions) genny.R
replacement = fmt.Sprintf(template, module.PlaceholderSgAppEndBlockers, opts.ModuleName)
content = replacer.Replace(content, module.PlaceholderSgAppEndBlockers, replacement)

template = `{
Name: %[2]vmoduletypes.ModuleName,
Config: appconfig.WrapAny(&%[2]vmodulev1.Module{}),
},`
replacement = fmt.Sprintf(template, module.PlaceholderSgAppModuleConfig, opts.ModuleName, opts.ModulePath)
content = replacer.Replace(content, module.PlaceholderSgAppModuleConfig, replacement)

newFile := genny.NewFileS(configPath, content)

return r.File(newFile)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package module
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

// this line is used by starport scaffolding # 1

// modulev1 "<%= modulePath %>/api/<%= appName %>/<%= moduleName %>/module"
modulev1 "<%= modulePath %>/api/<%= appName %>/<%= moduleName %>/module"
"<%= modulePath %>/x/<%= moduleName %>/client/cli"
"<%= modulePath %>/x/<%= moduleName %>/keeper"
"<%= modulePath %>/x/<%= moduleName %>/types"
Expand Down
1 change: 1 addition & 0 deletions ignite/templates/module/placeholders.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
PlaceholderSgAppScopedKeeper = "// this line is used by starport scaffolding # stargate/app/scopedKeeper"
PlaceholderSgAppBeforeInitReturn = "// this line is used by starport scaffolding # stargate/app/beforeInitReturn"
PlaceholderSgAppMaccPerms = "// this line is used by starport scaffolding # stargate/app/maccPerms"
PlaceholderSgAppModuleConfig = "// this line is used by starport scaffolding # stargate/app/moduleConfig"

// Placeholders in app.go for wasm
PlaceholderSgWasmAppEnabledProposals = "// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals"
Expand Down

0 comments on commit eb88671

Please sign in to comment.