From afc1b7687d9fe5857820a21f6d5e75be05e19c7e Mon Sep 17 00:00:00 2001 From: Nikola Glumac Date: Thu, 13 Dec 2018 11:59:30 +0100 Subject: [PATCH 1/2] [DDW-526] Fix Ada redemption Api calls --- CHANGELOG.md | 2 +- source/renderer/app/stores/AdaRedemptionStore.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c99e40c26d..f5df8d5289 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ Changelog - Improved the loading UX ([PR 723](https://github.com/input-output-hk/daedalus/pull/723)) - Improved the NTP check handling ([PR 1086](https://github.com/input-output-hk/daedalus/pull/1086), [PR 1149](https://github.com/input-output-hk/daedalus/pull/1149), [PR 1158](https://github.com/input-output-hk/daedalus/pull/1158), [PR 1194](https://github.com/input-output-hk/daedalus/pull/1194), [PR 1213](https://github.com/input-output-hk/daedalus/pull/1213)) - Improved the transaction details text selection ([PR 1073](https://github.com/input-output-hk/daedalus/pull/1073), [PR 1095](https://github.com/input-output-hk/daedalus/pull/1095)) -- Integrated Cardano V1 API endpoints ([PR 1018](https://github.com/input-output-hk/daedalus/pull/1018), [PR 1031](https://github.com/input-output-hk/daedalus/pull/1031), [PR 1037](https://github.com/input-output-hk/daedalus/pull/1037), [PR 1042](https://github.com/input-output-hk/daedalus/pull/1042), [PR 1045](https://github.com/input-output-hk/daedalus/pull/1045), [PR 1070](https://github.com/input-output-hk/daedalus/pull/1070), [PR 1078](https://github.com/input-output-hk/daedalus/pull/1078), [PR 1079](https://github.com/input-output-hk/daedalus/pull/1079), [PR 1080](https://github.com/input-output-hk/daedalus/pull/1080), [PR 1088](https://github.com/input-output-hk/daedalus/pull/1088)) +- Integrated Cardano V1 API endpoints ([PR 1018](https://github.com/input-output-hk/daedalus/pull/1018), [PR 1031](https://github.com/input-output-hk/daedalus/pull/1031), [PR 1037](https://github.com/input-output-hk/daedalus/pull/1037), [PR 1042](https://github.com/input-output-hk/daedalus/pull/1042), [PR 1045](https://github.com/input-output-hk/daedalus/pull/1045), [PR 1070](https://github.com/input-output-hk/daedalus/pull/1070), [PR 1078](https://github.com/input-output-hk/daedalus/pull/1078), [PR 1079](https://github.com/input-output-hk/daedalus/pull/1079), [PR 1080](https://github.com/input-output-hk/daedalus/pull/1080), [PR 1088](https://github.com/input-output-hk/daedalus/pull/1088), [PR 1220](https://github.com/input-output-hk/daedalus/pull/1220)) - Refactored and improved `NetworkStatus` store to use V1 API data ([PR 1081](https://github.com/input-output-hk/daedalus/pull/1081)) ### Fixes diff --git a/source/renderer/app/stores/AdaRedemptionStore.js b/source/renderer/app/stores/AdaRedemptionStore.js index 8c9cda0756..1e442fda09 100644 --- a/source/renderer/app/stores/AdaRedemptionStore.js +++ b/source/renderer/app/stores/AdaRedemptionStore.js @@ -6,7 +6,6 @@ import Store from './lib/Store'; import Request from './lib/LocalizedRequest'; import WalletTransaction from '../domains/WalletTransaction'; import { Logger } from '../../../common/logging'; -import { encryptPassphrase } from '../api/utils'; import { matchRoute } from '../utils/routing'; import { PARSE_REDEMPTION_CODE } from '../../../common/ipc-api'; import { @@ -216,9 +215,10 @@ export default class AdaRedemptionStore extends Store { try { const transaction: WalletTransaction = await this.redeemAdaRequest.execute({ + walletId, accountIndex, - redemptionCode: this.redemptionCode, - spendingPassword: spendingPassword && encryptPassphrase(spendingPassword) + spendingPassword, + redemptionCode: this.redemptionCode }); this._reset(); this.actions.adaRedemption.adaSuccessfullyRedeemed.trigger({ @@ -242,10 +242,11 @@ export default class AdaRedemptionStore extends Store { try { const transaction: WalletTransaction = await this.redeemPaperVendedAdaRequest.execute({ - mnemonics: this.passPhrase && this.passPhrase.split(' '), + walletId, accountIndex, + spendingPassword, redemptionCode: shieldedRedemptionKey, - spendingPassword: spendingPassword && encryptPassphrase(spendingPassword) + mnemonics: this.passPhrase && this.passPhrase.split(' ') }); this._reset(); this.actions.adaRedemption.adaSuccessfullyRedeemed.trigger({ From 79f034a5e8fcea0ec1c21b84099d3664c4708238 Mon Sep 17 00:00:00 2001 From: Nikola Glumac Date: Thu, 13 Dec 2018 13:26:30 +0100 Subject: [PATCH 2/2] [DDW-526] Fix Ada redemption API endpoints config --- source/renderer/app/api/api.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/renderer/app/api/api.js b/source/renderer/app/api/api.js index aa091a4023..e33c1e9f52 100644 --- a/source/renderer/app/api/api.js +++ b/source/renderer/app/api/api.js @@ -579,7 +579,9 @@ export default class AdaApi { } }; - async redeemAda(request: RedeemAdaParams): Promise { + redeemAda = async ( + request: RedeemAdaParams + ): Promise => { Logger.debug('AdaApi::redeemAda called'); const { spendingPassword: passwordString } = request; const spendingPassword = passwordString ? encryptPassphrase(passwordString) : ''; @@ -596,11 +598,11 @@ export default class AdaApi { } throw new RedeemAdaError(); } - } + }; - async redeemPaperVendedAda( + redeemPaperVendedAda = async ( request: RedeemPaperVendedAdaParams - ): Promise { + ): Promise => { Logger.debug('AdaApi::redeemAdaPaperVend called'); const { spendingPassword: passwordString } = request; const spendingPassword = passwordString ? encryptPassphrase(passwordString) : ''; @@ -617,7 +619,7 @@ export default class AdaApi { } throw new RedeemAdaError(); } - } + }; async sendBugReport(requestFormData: SendBugReportRequest): Promise { Logger.debug('AdaApi::sendBugReport called: ' + stringifyData(requestFormData));