Tx CLI proto module interface (#5989)
* WIP * WIP * WIP on removing x/auth dependency from client/tx * Revert unneeded changes * Simplify cli tx UX * Wire up bank tx REST routes * Fix assignment issue * Wire up bank NewSendTxCmd * fix lint * revert file * revert file * fix simcli * Refactor AccountRetriever * Fix build * Fix build * Fix build * Fix integration tests * Fix tests * Docs, linting * Linting * WIP on all modules * Implement other module new tx cmd's * Fix cmd's * Refactor existing GetTxCmd * Fix cmd * Removing deprecated code * Update ADR 020 & CHANGELOG * Lint * Lint * Lint * Lint * Lint * Lint * Lint * Fix client/tx tests * Fix mocks * Fix tests * Lint fixes * REST tx migration * Wire up REST * Linting * Update CHANGELOG, docs * Fix tests * lint * Address review feedback * Update CHANGELOG.md Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * Update CHANGELOG.md Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * group vars Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexander Bezobchuk
parent
970e009653
commit
850419fffd
@@ -52,7 +52,7 @@ type AppModuleBasic interface {
|
||||
|
||||
// client functionality
|
||||
RegisterRESTRoutes(context.CLIContext, *mux.Router)
|
||||
GetTxCmd(*codec.Codec) *cobra.Command
|
||||
GetTxCmd(context.CLIContext) *cobra.Command
|
||||
GetQueryCmd(*codec.Codec) *cobra.Command
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ func (bm BasicManager) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Route
|
||||
}
|
||||
|
||||
// AddTxCommands adds all tx commands to the rootTxCmd
|
||||
func (bm BasicManager) AddTxCommands(rootTxCmd *cobra.Command, cdc *codec.Codec) {
|
||||
func (bm BasicManager) AddTxCommands(rootTxCmd *cobra.Command, ctx context.CLIContext) {
|
||||
for _, b := range bm {
|
||||
if cmd := b.GetTxCmd(cdc); cmd != nil {
|
||||
if cmd := b.GetTxCmd(ctx); cmd != nil {
|
||||
rootTxCmd.AddCommand(cmd)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ func TestBasicManager(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
cdc := codec.New()
|
||||
ctx := context.CLIContext{}
|
||||
ctx = ctx.WithCodec(cdc)
|
||||
wantDefaultGenesis := map[string]json.RawMessage{"mockAppModuleBasic1": json.RawMessage(``)}
|
||||
|
||||
mockAppModuleBasic1 := mocks.NewMockAppModuleBasic(mockCtrl)
|
||||
@@ -33,7 +35,7 @@ func TestBasicManager(t *testing.T) {
|
||||
mockAppModuleBasic1.EXPECT().ValidateGenesis(gomock.Eq(cdc), gomock.Eq(wantDefaultGenesis["mockAppModuleBasic1"])).Times(1).Return(errFoo)
|
||||
mockAppModuleBasic1.EXPECT().RegisterRESTRoutes(gomock.Eq(context.CLIContext{}), gomock.Eq(&mux.Router{})).Times(1)
|
||||
mockAppModuleBasic1.EXPECT().RegisterCodec(gomock.Eq(cdc)).Times(1)
|
||||
mockAppModuleBasic1.EXPECT().GetTxCmd(cdc).Times(1).Return(nil)
|
||||
mockAppModuleBasic1.EXPECT().GetTxCmd(ctx).Times(1).Return(nil)
|
||||
mockAppModuleBasic1.EXPECT().GetQueryCmd(cdc).Times(1).Return(nil)
|
||||
|
||||
mm := module.NewBasicManager(mockAppModuleBasic1)
|
||||
@@ -51,7 +53,7 @@ func TestBasicManager(t *testing.T) {
|
||||
mm.RegisterRESTRoutes(context.CLIContext{}, &mux.Router{})
|
||||
|
||||
mockCmd := &cobra.Command{Use: "root"}
|
||||
mm.AddTxCommands(mockCmd, cdc)
|
||||
mm.AddTxCommands(mockCmd, ctx)
|
||||
|
||||
mm.AddQueryCommands(mockCmd, cdc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user