Fix broken API

This commit is contained in:
Adrian Brink 2018-03-18 17:21:26 +01:00
parent 54b162f5c3
commit 0eed032a75
No known key found for this signature in database
GPG Key ID: F61053D3FBD06353
2 changed files with 22 additions and 4 deletions

View File

@ -39,25 +39,33 @@ type sendCommander struct {
}
func (c sendCommander) sendIBCTransfer(cmd *cobra.Command, args []string) error {
// get the from address
from, err := builder.GetFromAddress()
if err != nil {
return err
}
// build the message
msg, err := buildMsg(from)
if err != nil {
return err
}
fmt.Printf("%+v\n", msg)
// get password
name := viper.GetString(client.FlagName)
buf := client.BufferStdin()
prompt := fmt.Sprintf("Password to sign with '%s':", name)
passphrase, err := client.GetPassword(prompt, buf)
if err != nil {
return err
}
res, err := builder.SignBuildBroadcast(msg, c.cdc)
res, err := builder.SignBuildBroadcast(name, passphrase, msg, c.cdc)
if err != nil {
return err
}
fmt.Printf("Committed at block %d. Hash: %s\n", res.Height, res.Hash.String())
return nil
}

View File

@ -147,12 +147,22 @@ func (c relayCommander) refine(bz []byte, sequence int64) []byte {
panic(err)
}
// get password
name := viper.GetString(client.FlagName)
buf := client.BufferStdin()
prompt := fmt.Sprintf("Password to sign with '%s':", name)
passphrase, err := client.GetPassword(prompt, buf)
if err != nil {
panic(err)
}
msg := ibc.IBCReceiveMsg{
IBCPacket: packet,
Relayer: c.address,
Sequence: sequence,
}
res, err := builder.SignAndBuild(msg, c.cdc)
res, err := builder.SignAndBuild(name, passphrase, msg, c.cdc)
if err != nil {
panic(err)
}