Skip to content

Commit

Permalink
adding address generation command
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Oct 23, 2024
1 parent 93f0010 commit 5a0fd39
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
1 change: 1 addition & 0 deletions cmd/canined/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
// testnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
config.Cmd(),
AddressGenerationCommand(),

storage.CmdProvider(),
)
Expand Down
38 changes: 21 additions & 17 deletions cmd/canined/utils.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
package main

import "fmt"

const (
UptimeLeftKey = "UPTL-"
FileKey = "FILE-"
DowntimeKey = "DWNT-"
import (
"fmt"
"github.com/jackalLabs/canine-chain/v4/x/storage/types"
"github.com/spf13/cobra"
)

//nolint:unused
func makeUptimeKey(cid string) []byte {
return []byte(fmt.Sprintf("%s%s", UptimeLeftKey, cid))
}
func AddressGenerationCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "get-address [value]",
Short: "Generate an address from text, the same system used to generate protocol owned accounts.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

Check failure on line 14 in cmd/canined/utils.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)

//nolint:unused
func makeFileKey(cid string) []byte {
return []byte(fmt.Sprintf("%s%s", FileKey, cid))
}
acc, err := types.GetAccount(args[0])
if err != nil {
return err
}

fmt.Printf("'%s' becomes: '%s'", args[0], acc.String())

return nil
},
}

//nolint:unused
func makeDowntimeKey(cid string) []byte {
return []byte(fmt.Sprintf("%s%s", DowntimeKey, cid))
return cmd
}

0 comments on commit 5a0fd39

Please sign in to comment.