Handle chain id commit bid CLI and update create auction CLI
Some checks failed
Protobuf / lint (pull_request) Successful in 15s
Integration Tests / test-integration (pull_request) Successful in 3m15s
Build / build (pull_request) Successful in 3m17s
E2E Tests / test-e2e (pull_request) Successful in 5m3s
Unit Tests / test-unit (pull_request) Successful in 2m18s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 6m54s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 9m22s
SDK Tests / sdk_tests (pull_request) Failing after 10m12s

This commit is contained in:
Prathamesh Musale 2024-09-25 12:01:13 +05:30
parent ee9b10eb00
commit b8c3531824
2 changed files with 17 additions and 7 deletions

View File

@ -13,7 +13,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper"
wnsUtils "git.vdb.to/cerc-io/laconicd/utils" wnsUtils "git.vdb.to/cerc-io/laconicd/utils"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction" auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
@ -49,6 +48,16 @@ func GetCmdCommitBid() *cobra.Command {
return err return err
} }
// Take chain id passed by user
chainId, _ := cmd.Flags().GetString(flags.FlagChainID)
if chainId == "" {
// Take from config if not provided
chainId = clientCtx.ChainID
if chainId == "" {
return fmt.Errorf("--chain-id required")
}
}
bidAmount, err := sdk.ParseCoinNormalized(args[1]) bidAmount, err := sdk.ParseCoinNormalized(args[1])
if err != nil { if err != nil {
return err return err
@ -59,7 +68,6 @@ func GetCmdCommitBid() *cobra.Command {
return err return err
} }
chainId := viper.GetString("chain-id")
auctionId := args[0] auctionId := args[0]
reveal := map[string]interface{}{ reveal := map[string]interface{}{

View File

@ -81,17 +81,19 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
RpcCommandOptions: []*autocliv1.RpcCommandOptions{ RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{ {
RpcMethod: "CreateAuction", RpcMethod: "CreateAuction",
Use: "create [kind] [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid] [max-price] [num-providers]", Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee]",
Short: "Create an auction", Short: "Create an auction",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{ PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "kind"},
{ProtoField: "commits_duration"}, {ProtoField: "commits_duration"},
{ProtoField: "reveals_duration"}, {ProtoField: "reveals_duration"},
{ProtoField: "commit_fee"}, {ProtoField: "commit_fee"},
{ProtoField: "reveal_fee"}, {ProtoField: "reveal_fee"},
{ProtoField: "minimum_bid"}, },
{ProtoField: "max_price"}, FlagOptions: map[string]*autocliv1.FlagOptions{
{ProtoField: "num_providers"}, "kind": {Name: "kind", DefaultValue: "vickrey", Usage: "Auction kind (vickrey|provider) (default: vickrey)"},
"minimum_bid": {Name: "minimum-bid", Usage: "Minimum bid (required for vickrey auctions)"},
"max_price": {Name: "max-price", Usage: "Max price (required for provider auctions)"},
"num_providers": {Name: "num-providers", Usage: "Number of desired providers (required for provider auctions)"},
}, },
}, },
{ {