Skip to content

Commit

Permalink
fix: add 0x prefix to the sig output
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Jan 11, 2024
1 parent 7d23589 commit 17f6bb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions plugins/migrate/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ func SignAndPrint(ctx context.CLIContext, builder authtxb.TxBuilder, bscOperator

fmt.Printf("TX JSON: %s\n", json)
fmt.Println("Sign Message: ", string(stdMsg.Bytes()))
fmt.Println("Sign Message Hash: ", hex.EncodeToString(crypto.Sha256(stdMsg.Bytes())))
fmt.Println("Sign Message Hash: ", "0x"+hex.EncodeToString(crypto.Sha256(stdMsg.Bytes())))
sig := tx.GetSignatures()[0]
fmt.Printf("Signature: %s\n", hex.EncodeToString(sig.Signature))
fmt.Printf("Signature: %s\n", "0x"+hex.EncodeToString(sig.Signature))
var originPubKey secp256k1.PubKeySecp256k1
err = builder.Codec.UnmarshalBinaryBare(sig.PubKey.Bytes(), &originPubKey)
if err != nil {
return err
}
fmt.Printf("PubKey: %s\n", hex.EncodeToString(originPubKey))
fmt.Printf("PubKey: %s\n", "0x"+hex.EncodeToString(originPubKey))
return nil
}
6 changes: 3 additions & 3 deletions plugins/recover/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ func SignAndPrint(ctx context.CLIContext, builder authtxb.TxBuilder, msg sdk.Msg

fmt.Printf("TX JSON: %s\n", json)
fmt.Println("Sign Message: ", string(stdMsg.Bytes()))
fmt.Println("Sign Message Hash: ", hex.EncodeToString(crypto.Sha256(stdMsg.Bytes())))
fmt.Println("Sign Message Hash: ", "0x"+hex.EncodeToString(crypto.Sha256(stdMsg.Bytes())))
sig := tx.GetSignatures()[0]
fmt.Printf("Signature: %s\n", hex.EncodeToString(sig.Signature))
fmt.Printf("Signature: %s\n", "0x"+hex.EncodeToString(sig.Signature))
var originPubKey secp256k1.PubKeySecp256k1
err = builder.Codec.UnmarshalBinaryBare(sig.PubKey.Bytes(), &originPubKey)
if err != nil {
return err
}
fmt.Printf("PubKey: %s\n", hex.EncodeToString(originPubKey))
fmt.Printf("PubKey: %s\n", "0x"+hex.EncodeToString(originPubKey))
return nil
}

0 comments on commit 17f6bb4

Please sign in to comment.