diff --git a/.gitignore b/.gitignore index d16c4a23aa..f5f5405d3a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ docs/node_modules # Data - ideally these don't exist baseapp/data/* client/lcd/keys/* -cmd/wasmcli/statik/statik.go mytestnet # Testing diff --git a/Dockerfile b/Dockerfile index 8b2daa13f4..1180a966e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,12 +39,9 @@ RUN LEDGER_ENABLED=false BUILD_TAGS=muslc make build-gaiaflex FROM alpine:3.12 COPY --from=go-builder /code/build/wasmd /usr/bin/wasmd -COPY --from=go-builder /code/build/wasmcli /usr/bin/wasmcli # testnet -COPY --from=go-builder /code/build/coral /usr/bin/coral COPY --from=go-builder /code/build/corald /usr/bin/corald -COPY --from=go-builder /code/build/gaiaflex /usr/bin/gaiaflex COPY --from=go-builder /code/build/gaiaflexd /usr/bin/gaiaflexd COPY docker/* /opt/ diff --git a/Makefile b/Makefile index 564365c102..60dfb735da 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,6 @@ build_tags_comma_sep := $(subst $(empty),$(comma),$(build_tags)) ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=wasm \ -X github.com/cosmos/cosmos-sdk/version.AppName=wasmd \ - -X github.com/CosmWasm/wasmd/cmd/wasmcli/version.ClientName=wasmcli \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" @@ -67,10 +66,8 @@ ldflags := $(strip $(ldflags)) coral_ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=coral \ -X github.com/cosmos/cosmos-sdk/version.AppName=corald \ - -X github.com/CosmWasm/wasmd/cmd/wasmcli/version.ClientName=coral \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ - -X github.com/CosmWasm/wasmd/app.CLIDir=.coral \ -X github.com/CosmWasm/wasmd/app.NodeDir=.corald \ -X github.com/CosmWasm/wasmd/app.Bech32Prefix=coral \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" @@ -82,11 +79,9 @@ coral_ldflags := $(strip $(coral_ldflags)) flex_ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=gaiaflex \ -X github.com/cosmos/cosmos-sdk/version.AppName=gaiaflexd \ - -X github.com/CosmWasm/wasmd/cmd/wasmcli/version.ClientName=gaiaflex \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X github.com/CosmWasm/wasmd/app.ProposalsEnabled=true \ - -X github.com/CosmWasm/wasmd/app.CLIDir=.gaiaflex \ -X github.com/CosmWasm/wasmd/app.NodeDir=.gaiaflexd \ -X github.com/CosmWasm/wasmd/app.Bech32Prefix=cosmos \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" @@ -102,29 +97,23 @@ all: install lint test build: go.sum ifeq ($(OS),Windows_NT) - # wasmd nodes not supported on windows, maybe the cli? - go build -mod=readonly $(BUILD_FLAGS) -o build/wasmcli.exe ./cmd/wasmcli + exit 1 else go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd ./cmd/wasmd - go build -mod=readonly $(BUILD_FLAGS) -o build/wasmcli ./cmd/wasmcli endif build-coral: go.sum ifeq ($(OS),Windows_NT) - # wasmd nodes not supported on windows, maybe the cli? - go build -mod=readonly $(CORAL_BUILD_FLAGS) -o build/coral.exe ./cmd/wasmcli + exit 1 else go build -mod=readonly $(CORAL_BUILD_FLAGS) -o build/corald ./cmd/wasmd - go build -mod=readonly $(CORAL_BUILD_FLAGS) -o build/coral ./cmd/wasmcli endif build-gaiaflex: go.sum ifeq ($(OS),Windows_NT) - # wasmd nodes not supported on windows, maybe the cli? - go build -mod=readonly $(FLEX_BUILD_FLAGS) -o build/gaiaflex.exe ./cmd/wasmcli + exit 1 else go build -mod=readonly $(FLEX_BUILD_FLAGS) -o build/gaiaflexd ./cmd/wasmd - go build -mod=readonly $(FLEX_BUILD_FLAGS) -o build/gaiaflex ./cmd/wasmcli endif build-linux: go.sum @@ -139,7 +128,6 @@ endif install: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd - go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmcli ######################################## ### Tools & dependencies diff --git a/README.md b/README.md index eed4372c88..b5a3f07de4 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ docker run --rm -it \ --mount type=volume,source=wasmd_data,target=/root \ cosmwasm/wasmd:latest ./setup_wasmd.sh cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 -# This will start both wasmd and wasmcli rest-server, only wasmcli output is shown on the screen +# This will start both wasmd and rest-server, only rest-serve output is shown on the screen docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \ --mount type=volume,source=wasmd_data,target=/root \ cosmwasm/wasmd:latest ./run_all.sh @@ -126,7 +126,7 @@ sudo chown -R $(id -u):$(id -g) ./template # bind to non-/root and pass an argument to run.sh to copy the template into /root # we need wasmd_data volume mount not just for restart, but also to view logs docker volume rm -f wasmd_data -docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \ +docker run --rm -it -p 26657:26657 -p 26656:26656 -p 9090:9090 \ --mount type=bind,source=$(pwd)/template,target=/template \ --mount type=volume,source=wasmd_data,target=/root \ cosmwasm/wasmd:latest ./run_all.sh /template @@ -150,7 +150,7 @@ to the configuration. Available flags: -* `-X github.com/CosmWasm/wasmd/app.CLIDir=.coral` - set the config directory for the cli (default `~/.wasmcli`) + * `-X github.com/CosmWasm/wasmd/app.NodeDir=.corald` - set the config/data directory for the node (default `~/.wasmd`) * `-X github.com/CosmWasm/wasmd/app.Bech32Prefix=coral` - set the bech32 prefix for all accounts (default `cosmos`) * `-X github.com/CosmWasm/wasmd/app.ProposalsEnabled=true` - enable all x/wasm governance proposals (default `false`) diff --git a/api_migration.md b/api_migration.md index 888dc10d4f..c9aedd89c5 100644 --- a/api_migration.md +++ b/api_migration.md @@ -17,9 +17,9 @@ A list of ContractCodeHistoryEntries with following fields: * 404 - for an unknown contract ### CLI -`wasmcli query wasm contract-history [bech32_address] to print all the code changes.` +`wasmd query wasm contract-history [bech32_address] to print all the code changes.` Example: -`wasmcli query wasm contract-history cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c` +`wasmd query wasm contract-history cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c` ```json [ { diff --git a/app/app.go b/app/app.go index 3072d5110d..204aa6ac91 100644 --- a/app/app.go +++ b/app/app.go @@ -95,7 +95,6 @@ const appName = "WasmApp" // We pull these out so we can set them with LDFLAGS in the Makefile var ( - CLIDir = ".wasmcli" NodeDir = ".wasmd" Bech32Prefix = sdk.Bech32MainPrefix @@ -129,8 +128,6 @@ func GetEnabledProposals() []wasm.ProposalType { // These are the ones we will want to use in the code, based on // any overrides above var ( - // DefaultCLIHome default home directories for wasmcli - DefaultCLIHome = os.ExpandEnv("$HOME/") + CLIDir // DefaultNodeHome default home directories for wasmd DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir diff --git a/cmd/wasmcli/main.go b/cmd/wasmcli/main.go deleted file mode 100644 index 9663b15594..0000000000 --- a/cmd/wasmcli/main.go +++ /dev/null @@ -1,164 +0,0 @@ -package main - -import ( - "context" - "fmt" - "os" - - "github.com/CosmWasm/wasmd/app" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - vestingcli "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli" - bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/spf13/cobra" - "github.com/tendermint/tendermint/libs/cli" -) - -// ClientName is set via build process -const ClientName = "wasmcli" - -func main() { - // Configure cobra to sort commands - cobra.EnableCommandSorting = false - - // Read in the configuration file for the sdk - config := sdk.GetConfig() - config.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) - config.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub) - config.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) - config.Seal() - - // TODO: setup keybase, viper object, etc. to be passed into - // the below functions and eliminate global vars, like we do - // with the cdc - - encodingConfig := app.MakeEncodingConfig() - - initClientCtx := client.Context{}. - WithJSONMarshaler(encodingConfig.Marshaler). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(authtypes.AccountRetriever{}). - WithBroadcastMode(flags.BroadcastBlock). - WithHomeDir(app.DefaultCLIHome) - - rootCmd := &cobra.Command{ - Use: ClientName, - Short: "Command line interface for interacting with " + version.AppName, - PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { - return err - } - - return server.InterceptConfigsPreRunHandler(cmd) - }, - } - - // Construct Root Command - rootCmd.AddCommand( - rpc.StatusCommand(), - queryCommand(), - txCommand(), - flags.LineBreak, - flags.LineBreak, - keys.Commands(app.DefaultNodeHome), - flags.LineBreak, - //version.Cmd, - cli.NewCompletionCmd(rootCmd, true), - ) - - // Create and set a client.Context on the command's Context. During the pre-run - // of the root command, a default initialized client.Context is provided to - // seed child command execution with values such as AccountRetriver, Keyring, - // and a Tendermint RPC. This requires the use of a pointer reference when - // getting and setting the client.Context. Ideally, we utilize - // https://github.com/spf13/cobra/pull/1118. - ctx := context.Background() - ctx = context.WithValue(ctx, client.ClientContextKey, &client.Context{}) - ctx = context.WithValue(ctx, server.ServerContextKey, server.NewDefaultContext()) - - executor := cli.PrepareBaseCmd(rootCmd, "WM", app.DefaultCLIHome) - err := executor.ExecuteContext(ctx) - - if err != nil { - fmt.Printf("Failed executing CLI command: %s, exiting...\n", err) - os.Exit(1) - } -} - -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - cmd.AddCommand( - authcmd.GetAccountCmd(), - flags.LineBreak, - rpc.ValidatorCommand(), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(), - authcmd.QueryTxCmd(), - flags.LineBreak, - ) - - app.ModuleBasics.AddQueryCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -func txCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - bankcmd.NewSendTxCmd(), - flags.LineBreak, - authcmd.GetSignCommand(), - authcmd.GetSignBatchCommand(), - authcmd.GetMultiSignCommand(), - authcmd.GetValidateSignaturesCommand(), - flags.LineBreak, - authcmd.GetBroadcastCommand(), - authcmd.GetEncodeCommand(), - authcmd.GetDecodeCommand(), - flags.LineBreak, - vestingcli.GetTxCmd(), - ) - - // add modules' tx commands - app.ModuleBasics.AddTxCommands(cmd) - - // remove auth and bank commands as they're mounted under the root tx command - var cmdsToRemove []*cobra.Command - - for _, cmd := range cmd.Commands() { - if cmd.Use == authtypes.ModuleName || cmd.Use == banktypes.ModuleName { - cmdsToRemove = append(cmdsToRemove, cmd) - } - } - - cmd.RemoveCommand(cmdsToRemove...) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} diff --git a/cmd/wasmd/root.go b/cmd/wasmd/root.go index 541b47e6cc..487bd6b2f1 100644 --- a/cmd/wasmd/root.go +++ b/cmd/wasmd/root.go @@ -7,6 +7,9 @@ import ( "path/filepath" "github.com/CosmWasm/wasmd/x/wasm" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + vestingcli "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli" + bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" "github.com/spf13/cast" "github.com/spf13/cobra" tmcli "github.com/tendermint/tendermint/libs/cli" @@ -27,7 +30,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" authclient "github.com/cosmos/cosmos-sdk/x/auth/client" - "github.com/cosmos/cosmos-sdk/x/auth/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" @@ -50,7 +53,7 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) { WithTxConfig(encodingConfig.TxConfig). WithLegacyAmino(encodingConfig.Amino). WithInput(os.Stdin). - WithAccountRetriever(types.AccountRetriever{}). + WithAccountRetriever(authtypes.AccountRetriever{}). WithBroadcastMode(flags.BroadcastBlock). WithHomeDir(app.DefaultNodeHome) @@ -82,7 +85,7 @@ func Execute(rootCmd *cobra.Command) error { srvCtx := server.NewDefaultContext() ctx := context.Background() ctx = context.WithValue(ctx, client.ClientContextKey, &client.Context{}) - ctx = context.WithValue(ctx, server.ServerContextKey, server.NewDefaultContext()) + ctx = context.WithValue(ctx, server.ServerContextKey, srvCtx) rootCmd.PersistentFlags().String("log_level", srvCtx.Config.LogLevel, "The logging level in the format of :,...") @@ -110,6 +113,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) { // add keybase, auxiliary RPC, query, and tx child commands rootCmd.AddCommand( rpc.StatusCommand(), + queryCommand(), + txCommand(), keys.Commands(app.DefaultNodeHome), ) } @@ -119,6 +124,73 @@ func addModuleInitFlags(startCmd *cobra.Command) { wasm.AddModuleInitFlags(startCmd) } +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + cmd.AddCommand( + authcmd.GetAccountCmd(), + flags.LineBreak, + rpc.ValidatorCommand(), + rpc.BlockCommand(), + authcmd.QueryTxsByEventsCmd(), + authcmd.QueryTxCmd(), + flags.LineBreak, + ) + + app.ModuleBasics.AddQueryCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + bankcmd.NewSendTxCmd(), + flags.LineBreak, + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetValidateSignaturesCommand(), + flags.LineBreak, + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + flags.LineBreak, + vestingcli.GetTxCmd(), + ) + + // add modules' tx commands + app.ModuleBasics.AddTxCommands(cmd) + + // remove auth and bank commands as they're mounted under the root tx command + var cmdsToRemove []*cobra.Command + + for _, cmd := range cmd.Commands() { + if cmd.Use == authtypes.ModuleName || cmd.Use == banktypes.ModuleName { + cmdsToRemove = append(cmdsToRemove, cmd) + } + } + + cmd.RemoveCommand(cmdsToRemove...) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { var cache sdk.MultiStorePersistentCache diff --git a/contrib/local/01-accounts.sh b/contrib/local/01-accounts.sh index 547021debe..3b8c2665ab 100755 --- a/contrib/local/01-accounts.sh +++ b/contrib/local/01-accounts.sh @@ -1,18 +1,18 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -BASE_ACCOUNT=$(wasmcli keys show validator -a) -wasmcli q account "$BASE_ACCOUNT" -o json | jq +BASE_ACCOUNT=$(wasmd keys show validator -a) +wasmd q account "$BASE_ACCOUNT" -o json | jq echo "## Add new account" -wasmcli keys add fred +wasmd keys add fred echo "## Check balance" -NEW_ACCOUNT=$(wasmcli keys show fred -a) -wasmcli q bank balances "$NEW_ACCOUNT" -o json || true +NEW_ACCOUNT=$(wasmd keys show fred -a) +wasmd q bank balances "$NEW_ACCOUNT" -o json || true echo "## Transfer tokens" -wasmcli tx send validator "$NEW_ACCOUNT" 1ustake --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b block | jq +wasmd tx send validator "$NEW_ACCOUNT" 1ustake --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b block | jq echo "## Check balance again" -wasmcli q bank balances "$NEW_ACCOUNT" -o json | jq +wasmd q bank balances "$NEW_ACCOUNT" -o json | jq diff --git a/contrib/local/02-contracts.sh b/contrib/local/02-contracts.sh index 0f37cab486..663cafa111 100755 --- a/contrib/local/02-contracts.sh +++ b/contrib/local/02-contracts.sh @@ -5,80 +5,80 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" echo "-----------------------" echo "## Add new CosmWasm contract" -RESP=$(wasmcli tx wasm store "$DIR/../../x/wasm/internal/keeper/testdata/hackatom.wasm" \ +RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/internal/keeper/testdata/hackatom.wasm" \ --from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b block) CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[0].attributes[-1].value') echo "* Code id: $CODE_ID" echo "* Download code" -TMPDIR=$(mktemp -t wasmcliXXXX) -wasmcli q wasm code "$CODE_ID" "$TMPDIR" +TMPDIR=$(mktemp -t wasmdXXXX) +wasmd q wasm code "$CODE_ID" "$TMPDIR" rm -f "$TMPDIR" echo "-----------------------" echo "## List code" -wasmcli query wasm list-code --node=http://localhost:26657 --chain-id=testing | jq +wasmd query wasm list-code --node=http://localhost:26657 --chain-id=testing | jq echo "-----------------------" echo "## Create new contract instance" -INIT="{\"verifier\":\"$(wasmcli keys show validator -a)\", \"beneficiary\":\"$(wasmcli keys show fred -a)\"}" -wasmcli tx wasm instantiate "$CODE_ID" "$INIT" --admin=$(wasmcli keys show validator -a) \ +INIT="{\"verifier\":\"$(wasmd keys show validator -a)\", \"beneficiary\":\"$(wasmd keys show fred -a)\"}" +wasmd tx wasm instantiate "$CODE_ID" "$INIT" --admin=$(wasmd keys show validator -a) \ --from validator --amount="100ustake" --label "local0.1.0" \ --gas 1000000 -y --chain-id=testing -b block | jq -CONTRACT=$(wasmcli query wasm list-contract-by-code "$CODE_ID" -o json | jq -r '.[0].address') +CONTRACT=$(wasmd query wasm list-contract-by-code "$CODE_ID" -o json | jq -r '.[0].address') echo "* Contract address: $CONTRACT" echo "### Query all" -RESP=$(wasmcli query wasm contract-state all "$CONTRACT" -o json) +RESP=$(wasmd query wasm contract-state all "$CONTRACT" -o json) echo "$RESP" echo "### Query smart" -wasmcli query wasm contract-state smart "$CONTRACT" '{"verifier":{}}' -o json | jq +wasmd query wasm contract-state smart "$CONTRACT" '{"verifier":{}}' -o json | jq echo "### Query raw" KEY=$(echo "$RESP" | jq -r ".[0].key") -wasmcli query wasm contract-state raw "$CONTRACT" "$KEY" -o json +wasmd query wasm contract-state raw "$CONTRACT" "$KEY" -o json echo "-----------------------" echo "## Execute contract $CONTRACT" MSG='{"release":{}}' -wasmcli tx wasm execute "$CONTRACT" "$MSG" \ +wasmd tx wasm execute "$CONTRACT" "$MSG" \ --from validator \ --gas 1000000 -y --chain-id=testing -b block | jq echo "-----------------------" echo "## Set new admin" -echo "### Query old admin: $(wasmcli q wasm contract $CONTRACT -o json | jq -r '.admin')" +echo "### Query old admin: $(wasmd q wasm contract $CONTRACT -o json | jq -r '.admin')" echo "### Update contract" -wasmcli tx wasm set-contract-admin "$CONTRACT" $(wasmcli keys show fred -a) \ +wasmd tx wasm set-contract-admin "$CONTRACT" $(wasmd keys show fred -a) \ --from validator -y --chain-id=testing -b block | jq -echo "### Query new admin: $(wasmcli q wasm contract $CONTRACT -o json | jq -r '.admin')" +echo "### Query new admin: $(wasmd q wasm contract $CONTRACT -o json | jq -r '.admin')" echo "-----------------------" echo "## Migrate contract" echo "### Upload new code" -RESP=$(wasmcli tx wasm store "$DIR/../../x/wasm/internal/keeper/testdata/burner.wasm" \ +RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/internal/keeper/testdata/burner.wasm" \ --from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b block) BURNER_CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[0].attributes[-1].value') echo "### Migrate to code id: $BURNER_CODE_ID" -DEST_ACCOUNT=$(wasmcli keys show fred -a) -wasmcli tx wasm migrate "$CONTRACT" "$BURNER_CODE_ID" "{\"payout\": \"$DEST_ACCOUNT\"}" --from fred \ +DEST_ACCOUNT=$(wasmd keys show fred -a) +wasmd tx wasm migrate "$CONTRACT" "$BURNER_CODE_ID" "{\"payout\": \"$DEST_ACCOUNT\"}" --from fred \ --chain-id=testing -b block -y | jq echo "### Query destination account: $BURNER_CODE_ID" -wasmcli q bank balances "$DEST_ACCOUNT" -o json | jq +wasmd q bank balances "$DEST_ACCOUNT" -o json | jq echo "### Query contract meta data: $CONTRACT" -wasmcli q wasm contract "$CONTRACT" -o json | jq +wasmd q wasm contract "$CONTRACT" -o json | jq echo "### Query contract meta history: $CONTRACT" -wasmcli q wasm contract-history "$CONTRACT" -o json | jq +wasmd q wasm contract-history "$CONTRACT" -o json | jq echo "-----------------------" echo "## Clear contract admin" -echo "### Query old admin: $(wasmcli q wasm contract $CONTRACT -o json | jq -r '.admin')" +echo "### Query old admin: $(wasmd q wasm contract $CONTRACT -o json | jq -r '.admin')" echo "### Update contract" -wasmcli tx wasm clear-contract-admin "$CONTRACT" \ +wasmd tx wasm clear-contract-admin "$CONTRACT" \ --from fred -y --chain-id=testing -b block | jq -echo "### Query new admin: $(wasmcli q wasm contract $CONTRACT -o json | jq -r '.admin')" +echo "### Query new admin: $(wasmd q wasm contract $CONTRACT -o json | jq -r '.admin')" diff --git a/contrib/local/setup_wasmd.sh b/contrib/local/setup_wasmd.sh index 34c581d65f..e5536c7037 100755 --- a/contrib/local/setup_wasmd.sh +++ b/contrib/local/setup_wasmd.sh @@ -11,8 +11,8 @@ wasmd init --chain-id "$CHAIN_ID" "$MONIKER" # staking/governance token is hardcoded in config, change this ## OSX requires: -i. sed -i. "s/\"stake\"/\"$STAKE\"/" "$HOME"/.wasmd/config/genesis.json -if ! wasmcli keys show validator; then - (echo "$PASSWORD"; echo "$PASSWORD") | wasmcli keys add validator +if ! wasmd keys show validator; then + (echo "$PASSWORD"; echo "$PASSWORD") | wasmd keys add validator fi # hardcode the validator account for this instance echo "$PASSWORD" | wasmd add-genesis-account validator "1000000000$STAKE,1000000000$FEE" diff --git a/docker/logs.sh b/docker/logs.sh deleted file mode 100755 index f016b8deaf..0000000000 --- a/docker/logs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -tail -f /root/log/wasmd.log \ No newline at end of file diff --git a/docker/run_rest_server.sh b/docker/run_rest_server.sh deleted file mode 100755 index cc65fa8ecc..0000000000 --- a/docker/run_rest_server.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -#set -euo pipefail - -wasmcli rest-server --laddr tcp://0.0.0.0:1317 --trust-node --unsafe-cors diff --git a/docker/run_wasmd.sh b/docker/run_wasmd.sh index db08a94938..7f751d0aad 100755 --- a/docker/run_wasmd.sh +++ b/docker/run_wasmd.sh @@ -3,7 +3,6 @@ if test -n "$1"; then # need -R not -r to copy hidden files cp -R "$1/.wasmd" /root - cp -R "$1/.wasmcli" /root fi mkdir -p /root/log diff --git a/docker/setup_wasmd.sh b/docker/setup_wasmd.sh index 5ef10c612b..c9703d89e1 100755 --- a/docker/setup_wasmd.sh +++ b/docker/setup_wasmd.sh @@ -10,8 +10,8 @@ MONIKER=${MONIKER:-node001} wasmd init --chain-id "$CHAIN_ID" "$MONIKER" # staking/governance token is hardcoded in config, change this sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.wasmd/config/genesis.json -if ! wasmcli keys show validator; then - (echo "$PASSWORD"; echo "$PASSWORD") | wasmcli keys add validator +if ! wasmd keys show validator; then + (echo "$PASSWORD"; echo "$PASSWORD") | wasmd keys add validator fi # hardcode the validator account for this instance echo "$PASSWORD" | wasmd add-genesis-account validator "1000000000$STAKE,1000000000$FEE" diff --git a/x/wasm/Governance.md b/x/wasm/Governance.md index fdce6ff74d..5be058497d 100644 --- a/x/wasm/Governance.md +++ b/x/wasm/Governance.md @@ -76,7 +76,7 @@ As gov proposals bypass the existing authorzation policy they are diabled and re ## CLI ```shell script - wasmcli tx gov submit-proposal [command] + wasmd tx gov submit-proposal [command] Available Commands: wasm-store Submit a wasm binary proposal