Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension points to the CLI #477

Merged
merged 3 commits into from
Mar 31, 2021
Merged

Add extension points to the CLI #477

merged 3 commits into from
Mar 31, 2021

Conversation

alpe
Copy link
Contributor

@alpe alpe commented Mar 30, 2021

CLI was not on my list before for extension points but this may become handy for people working with CLI genesis messages:

// GenesisReader reads genesis data. Extension point for custom genesis state readers.
type GenesisReader interface {
	ReadWasmGenesis(cmd *cobra.Command) (*GenesisData, error)
}

// GenesisMutator extension point to modify the wasm module genesis state
type GenesisMutator interface {
	// AlterModuleState loads the genesis from the default or set home dir,
	// unmarshalls the wasm module section into the object representation
	// calls the callback function to modify it
	// and marshals the modified state back into the genesis file
	AlterWasmModuleState(cmd *cobra.Command, callback func(state *types.GenesisState, appState map[string]json.RawMessage) error) error
}

@alpe alpe added the extension point Makes the system easier to extend or test label Mar 30, 2021
@alpe alpe requested a review from ethanfrey March 30, 2021 14:39
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Confused by one level of indirection which may be unneeded. Otherwise great

x/wasm/client/cli/genesis_msg.go Show resolved Hide resolved
x/wasm/client/cli/genesis_msg.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 31, 2021

Codecov Report

Merging #477 (6c89f4f) into master (d9ca5d8) will increase coverage by 0.01%.
The diff coverage is 78.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #477      +/-   ##
==========================================
+ Coverage   56.81%   56.83%   +0.01%     
==========================================
  Files          41       41              
  Lines        4390     4392       +2     
==========================================
+ Hits         2494     2496       +2     
  Misses       1686     1686              
  Partials      210      210              
Impacted Files Coverage Δ
x/wasm/client/cli/genesis_msg.go 72.18% <78.26%> (+0.21%) ⬆️

@alpe alpe merged commit 8109bba into master Mar 31, 2021
@alpe alpe deleted the extendable_cli branch March 31, 2021 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension point Makes the system easier to extend or test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants