Skip to content

Commit

Permalink
feat(Account): Adjust printing and json serialization for `sign-messa…
Browse files Browse the repository at this point in the history
…ge` result
  • Loading branch information
nduchak committed Apr 1, 2020
1 parent d05e611 commit 7399377
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bin/commands/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ async function signMessage (walletPath, data = [], options) {
await handleApiError(async () => {
const signedMessage = await client.signMessage(dataForSign)
const address = await client.address()
const result = {
data: dataForSign,
address,
signature: Array.from(signedMessage),
signatureHex: Buffer.from(signedMessage).toString('hex')
}
if (json) {
print({ signedMessage, address })
print(result)
} else {
printUnderscored('Signing account address', address)
printUnderscored('Unsigned', dataForSign)
printUnderscored('Signed', signedMessage)
printUnderscored('Unsigned', result.data)
printUnderscored('Signing account address', result.address)
printUnderscored('Signature', result.signature)
printUnderscored('Signature Hex', result.signatureHex)
}
exit()
})
Expand Down

0 comments on commit 7399377

Please sign in to comment.