Skip to content

Commit

Permalink
feat: remove network configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM committed Jun 27, 2024
1 parent d0a7b4d commit c7e9d0b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 243 deletions.
8 changes: 1 addition & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ var (
Usage: "Configuration `FILE`",
Required: true,
}
networkFlag = cli.StringFlag{
Name: config.FlagNetwork,
Aliases: []string{"net"},
Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `custom`]",
Required: true,
}
customNetworkFlag = cli.StringFlag{
Name: config.FlagCustomNetwork,
Aliases: []string{"net-file"},
Expand Down Expand Up @@ -78,7 +72,7 @@ func main() {
Aliases: []string{},
Usage: "Run the cdk client",
Action: start,
Flags: append(flags, &networkFlag, &customNetworkFlag),
Flags: append(flags, &customNetworkFlag),
},
}

Expand Down
4 changes: 1 addition & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ const (
FlagYes = "yes"
// FlagCfg is the flag for cfg.
FlagCfg = "cfg"
// FlagNetwork is the flag for the network name. Valid values: ["testnet", "mainnet", "custom"].
FlagNetwork = "network"
// FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom
// FlagCustomNetwork is the flag for the custom network file.
FlagCustomNetwork = "custom-network-file"
// FlagAmount is the flag for amount.
FlagAmount = "amount"
Expand Down
107 changes: 0 additions & 107 deletions config/mainnetgenesis.go

This file was deleted.

24 changes: 6 additions & 18 deletions config/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ type network string
type leafType uint8

const (
mainnet network = "mainnet"
testnet network = "testnet"
custom network = "custom"
custom network = "custom"
// LeafTypeBalance specifies that leaf stores Balance
LeafTypeBalance leafType = 0
// LeafTypeNonce specifies that leaf stores Nonce
Expand Down Expand Up @@ -69,22 +67,12 @@ type genesisAccountFromJSON struct {
}

func (cfg *Config) loadNetworkConfig(ctx *cli.Context) {
var networkJSON string
switch ctx.String(FlagNetwork) {
case string(mainnet):
networkJSON = MainnetNetworkConfigJSON
case string(testnet):
networkJSON = TestnetNetworkConfigJSON
case string(custom):
var err error
cfgPath := ctx.String(FlagCustomNetwork)
networkJSON, err = LoadGenesisFileAsString(cfgPath)
if err != nil {
panic(err.Error())
}
default:
log.Fatalf("unsupported --network value. Must be one of: [%s, %s, %s]", mainnet, testnet, custom)
cfgPath := ctx.String(FlagCustomNetwork)
networkJSON, err := LoadGenesisFileAsString(cfgPath)
if err != nil {
panic(err.Error())
}

config, err := LoadGenesisFromJSONString(networkJSON)
if err != nil {
panic(fmt.Errorf("failed to load genesis configuration from file. Error: %v", err))
Expand Down
108 changes: 0 additions & 108 deletions config/testnetgenesis.go

This file was deleted.

0 comments on commit c7e9d0b

Please sign in to comment.