Skip to content

Commit

Permalink
Merge PR #3734: Gentx workflow for offline keys
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnya97 authored and jackzampolin committed Feb 27, 2019
1 parent e2baa38 commit e78a6da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ decoded automatically.
* [\#3670] CLI support for showing bech32 addresses in Ledger devices
* [\#3711] Update `tx sign` to use `--from` instead of the deprecated `--name`
CLI flag.
* [\#3730](https://github.com/cosmos/cosmos-sdk/issues/3730) Improve workflow for `gaiad gentx` with offline public keys, by outputting stdtx file that needs to be signed.

### Gaia

Expand Down
13 changes: 13 additions & 0 deletions cmd/gaia/init/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/utils"
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
"github.com/cosmos/cosmos-sdk/codec"
kbkeys "github.com/cosmos/cosmos-sdk/crypto/keys"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
Expand Down Expand Up @@ -129,9 +130,20 @@ following delegation and commission default parameters:
return err
}

info, err := txBldr.Keybase().Get(name)
if err != nil {
return err
}

if info.GetType() == kbkeys.TypeOffline {
fmt.Println("Offline key passed in. Use `gaiacli tx sign` command to sign:")
return utils.PrintUnsignedStdTx(txBldr, cliCtx, []sdk.Msg{msg}, true)
}

// write the unsigned transaction to the buffer
w := bytes.NewBuffer([]byte{})
cliCtx = cliCtx.WithOutput(w)

if err = utils.PrintUnsignedStdTx(txBldr, cliCtx, []sdk.Msg{msg}, true); err != nil {
return err
}
Expand Down Expand Up @@ -163,6 +175,7 @@ following delegation and commission default parameters:

fmt.Fprintf(os.Stderr, "Genesis transaction written to %q\n", outputDocument)
return nil

},
}

Expand Down

0 comments on commit e78a6da

Please sign in to comment.