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

feat: add genesis command suite #1252

Merged
merged 14 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions gno.land/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ rundep=go run -modfile ../misc/devdeps/go.mod
gnoland.start:; go run ./cmd/gnoland start

.PHONY: build
build: build.gnoland build.gnokey build.gnoweb build.gnofaucet build.gnotxsync
build: build.gnoland build.gnokey build.gnoweb build.gnofaucet build.gnotxsync build.genesis

build.gnoland:; go build -o build/gnoland ./cmd/gnoland
build.gnoweb:; go build -o build/gnoweb ./cmd/gnoweb
build.gnofaucet:; go build -o build/gnofaucet ./cmd/gnofaucet
build.gnokey:; go build -o build/gnokey ./cmd/gnokey
build.gnotxsync:; go build -o build/gnotxsync ./cmd/gnotxsync
build.genesis:; go build -o build/genesis ./cmd/genesis

.PHONY: install
install: install.gnoland install.gnoweb install.gnofaucet install.gnokey install.gnotxsync
install: install.gnoland install.gnoweb install.gnofaucet install.gnokey install.gnotxsync install.genesis

install.gnoland:; go install ./cmd/gnoland
install.gnoweb:; go install ./cmd/gnoweb
install.gnofaucet:; go install ./cmd/gnofaucet
install.gnokey:; go install ./cmd/gnokey
install.gnotxsync:; go install ./cmd/gnotxsync
install.genesis:; go install ./cmd/genesis

.PHONY: fclean
fclean: clean
Expand Down
43 changes: 43 additions & 0 deletions gno.land/cmd/genesis/balances.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import (
"flag"

"github.com/gnolang/gno/tm2/pkg/commands"
)

type balancesCfg struct {
genesisPath string
}

// newBalancesCmd creates the genesis balances subcommand
func newBalancesCmd(io *commands.IO) *commands.Command {
cfg := &balancesCfg{}

cmd := commands.NewCommand(
commands.Metadata{
Name: "balances",
ShortUsage: "balances <subcommand> [flags]",
LongHelp: "Manipulates the initial genesis.json account balances (pre-mines)",
ShortHelp: "Manages genesis.json account balances",
},
cfg,
commands.HelpExec,
)

cmd.AddSubCommands(
newBalancesAddCmd(cfg, io),
newBalancesRemoveCmd(cfg, io),
)

return cmd
}

func (c *balancesCfg) RegisterFlags(fs *flag.FlagSet) {
fs.StringVar(
&c.genesisPath,
"genesis-path",
"./genesis.json",
"the path to the genesis.json",
)
}
Loading
Loading