Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WalletCmd = &cobra.Command{ Use: "wallet [create|inspect]", Short: "Create or inspect BIP39(ish) wallets.", Long: usage, RunE: func(cmd *cobra.Command, args []string) error { mode := args[0] var err error var mnemonic string if mode == "inspect" { mnemonic, err = getFileOrFlag(inputMnemonicFile, inputMnemonic) if err != nil { return err } } else { mnemonic, err = hdwallet.NewMnemonic(*inputWords, *inputLang) if err != nil { return err } } password, err := getFileOrFlag(inputPasswordFile, inputPassword) if err != nil { return err } pw, err := hdwallet.NewPolyWallet(mnemonic, password) if err != nil { return err } err = pw.SetPath(*inputPath) if err != nil { return err } err = pw.SetIterations(*inputKDFIterations) if err != nil { return err } err = pw.SetUseRawEntropy(*inputUseRawEntropy) if err != nil { return err } if *inputRootOnly { var key *hdwallet.PolyWalletExport key, err = pw.ExportRootAddress() if err != nil { return err } out, _ := json.MarshalIndent(key, " ", " ") fmt.Println(string(out)) return nil } key, err := pw.ExportHDAddresses(int(*inputAddressesToGenerate)) if err != nil { return err } out, _ := json.MarshalIndent(key, " ", " ") fmt.Println(string(out)) return nil }, Args: func(cmd *cobra.Command, args []string) error { if len(args) != 1 { return fmt.Errorf("expected exactly one argument: create or inspect") } if args[0] != "create" && args[0] != "inspect" { return fmt.Errorf("expected argument to be create or inspect. Got: %s", args[0]) } return nil }, }
WalletCmd represents the wallet command
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.