|
1 | 1 | import { to } from 'await-to-js';
|
2 | 2 | import { cryptography } from '@liskhq/lisk-client';
|
3 |
| -import { signMessageUsingHW } from '@wallet/utils/signMessage'; |
| 3 | +import { signMessageUsingHW, signClaimMessageUsingHW } from '@wallet/utils/signMessage'; |
4 | 4 | import {
|
5 | 5 | signMessageWithPrivateKey,
|
6 | 6 | signClaimMessageWithPrivateKey,
|
@@ -46,6 +46,28 @@ export const signMessage =
|
46 | 46 | export const signClaimMessage =
|
47 | 47 | ({ nextStep, portalMessage, privateKey, currentAccount }) =>
|
48 | 48 | async () => {
|
| 49 | + if (currentAccount?.hw) { |
| 50 | + const [error, signature] = await to( |
| 51 | + signClaimMessageUsingHW({ |
| 52 | + account: currentAccount, |
| 53 | + message: getUnsignedNonProtocolMessage(portalMessage), |
| 54 | + }) |
| 55 | + ); |
| 56 | + |
| 57 | + if (error) { |
| 58 | + return nextStep({ error, portalMessage }); |
| 59 | + } |
| 60 | + |
| 61 | + const portalSignature = { |
| 62 | + data: { |
| 63 | + pubKey: currentAccount.metadata.pubkey, |
| 64 | + r: `0x${signature.substring(0, 64)}`, |
| 65 | + s: `0x${signature.substring(64)}`, |
| 66 | + }, |
| 67 | + }; |
| 68 | + |
| 69 | + return nextStep({ signature: portalSignature, portalMessage }); |
| 70 | + } |
49 | 71 | const signature = signClaimMessageWithPrivateKey({
|
50 | 72 | message: portalMessage,
|
51 | 73 | privateKey,
|
|
0 commit comments