Skip to content

Commit

Permalink
Migrate to dpos-offline@v3 #230
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiaszCudnik committed Jun 11, 2019
1 parent 8b91261 commit 83f981d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/stores/ledger.ts
Expand Up @@ -168,7 +168,7 @@ export default class LedgerStore {

const account = await this.getAccountUnsafe(accountSlot, false);

unsignedTx.senderPublicKey = Buffer.from(
unsignedTx.senderPubData = Buffer.from(
account.publicKey,
'hex'
) as Buffer & As<'publicKey'>;
Expand All @@ -179,7 +179,7 @@ export default class LedgerStore {
try {
log('confirming on the ledger, check the device');
const signature = await comm.signTX(accountPath, txBytes);
unsignedTx.signature = signature as Buffer & As<'signature'>;
unsignedTx.signatures = [signature as Buffer & As<'signature'>];
signedTx = Rise.txs.toPostable(unsignedTx);
} catch (e) {
log('LedgerConfirmError', e);
Expand Down
4 changes: 2 additions & 2 deletions src/stores/wallet.test.ts
Expand Up @@ -356,8 +356,8 @@ describe('transactions', () => {
const amount = 1000000;
const tx = await wallet.createSendTx(recipientID, new RawAmount(amount));
const signedTx = wallet.signTransaction(tx, 'foo bar baz', 'test');
expect(signedTx.senderPublicKey).toEqual(wallet.selectedAccount.publicKey);
expect(signedTx.signSignature).toBeTruthy();
expect(signedTx.senderPubData).toEqual(wallet.selectedAccount.publicKey);
expect(signedTx.signatures).toBeTruthy();
});
});

Expand Down
4 changes: 4 additions & 0 deletions src/stores/wallet.ts
Expand Up @@ -408,6 +408,7 @@ export default class WalletStore {
// TODO fix types in dpos-offline
return Rise.txs.transform({
kind: 'second-signature-v2',
// @ts-ignore TODO
publicKey: wallet2.publicKey,
sender: account.toSenderObject()
});
Expand All @@ -425,6 +426,7 @@ export default class WalletStore {

return Rise.txs.transform({
kind: 'send-v2',
// @ts-ignore TODO
amount: amount.toString(),
recipient: recipientId as RecipientId,
sender: account.toSenderObject()
Expand Down Expand Up @@ -454,6 +456,7 @@ export default class WalletStore {
return Rise.txs.transform({
kind: 'vote-v2',
sender: account.toSenderObject(),
// @ts-ignore TODO
preferences: [
...(account.votedDelegate
? [
Expand Down Expand Up @@ -503,6 +506,7 @@ export default class WalletStore {
return Rise.txs.transform({
kind: 'register-delegate-v2',
sender: account.toSenderObject(),
// @ts-ignore TODO
identifier: username as string & As<'delegateName'>
});
}
Expand Down

0 comments on commit 83f981d

Please sign in to comment.