Skip to content

Commit

Permalink
feat: Apply autocli
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed May 9, 2024
1 parent a263595 commit fad4908
Show file tree
Hide file tree
Showing 28 changed files with 378 additions and 1,867 deletions.
84 changes: 84 additions & 0 deletions x/coinswap/autocli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package coinswap

import (
"fmt"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
"github.com/cosmos/cosmos-sdk/version"

coinswapv1 "github.com/Canto-Network/Canto/v7/api/canto/coinswap/v1"
"github.com/Canto-Network/Canto/v7/x/coinswap/types"
)

// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: &autocliv1.ServiceCommandDescriptor{
Service: coinswapv1.Query_ServiceDesc.ServiceName,
EnhanceCustomCommand: false,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Params",
Use: "params",
Short: "Query the current coinswap parameters information",
Example: fmt.Sprintf("%s query %s params", version.AppName, types.ModuleName),
},
{
RpcMethod: "LiquidityPool",
Use: "liquidity-pool [liquidity pool denom]",
Short: "Query proposals with optional filters",
Example: fmt.Sprintf("%s query %s liquidity-pool lpt-1", version.AppName, types.ModuleName),
},
{
RpcMethod: "LiquidityPools",
Use: "liquidity-pools",
Short: "query all liquidity pools",
Example: fmt.Sprintf("%s query %s liquidity-pools", version.AppName, types.ModuleName),
},
},
},
Tx: &autocliv1.ServiceCommandDescriptor{
Service: coinswapv1.Msg_ServiceDesc.ServiceName,
EnhanceCustomCommand: false,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "AddLiquidity",
Use: "add-liquidity [max-coin] [standard-coin-amount] [minimum-liquidity] [duration]",
Short: "Add liquidity to a pool",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "max_token"},
{ProtoField: "exact_standard_amt"},
{ProtoField: "min_liquidity"},
{ProtoField: "deadline"},
},
},
{
RpcMethod: "RemoveLiquidity",
Use: "remove-liquidity [min output coin amount] [liquidity coin to withdraw] [min output standard coin amount] [duration]",
Short: "Remove liquidity from a pair",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "withdraw_liquidity"},
{ProtoField: "min_token"},
{ProtoField: "min_standard_amt"},
{ProtoField: "deadline"},
},
},
{
RpcMethod: "SwapCoin",
Use: "swap [input coin] [output coin] [isBuyOrder] [duration]",
Short: "Remove liquidity from a pair",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "input"},
{ProtoField: "output"},
{ProtoField: "deadline"},
{ProtoField: "is_buy_order"},
},
},
{
RpcMethod: "UpdateParams",
Skip: true,
},
},
},
}
}
155 changes: 0 additions & 155 deletions x/coinswap/client/cli/query.go

This file was deleted.

Loading

0 comments on commit fad4908

Please sign in to comment.