Skip to content

Commit a202af5

Browse files
[LW-10570] Code cleanup
1 parent ab4905a commit a202af5

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

source/renderer/app/stores/HardwareWalletsStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export default class HardwareWalletsStore extends Store {
263263
@observable
264264
transportDevice: TransportDevice | null | undefined = null;
265265
@observable
266-
signedTransaction: string | null | undefined = null;
266+
signedTx: string | null | undefined = null;
267267
@observable
268268
isTransactionPending = false;
269269
@observable
@@ -2652,7 +2652,7 @@ export default class HardwareWalletsStore extends Store {
26522652
const signedTx = await getTxCBOR(txBody, txWitnesses, txAuxiliaryData);
26532653
runInAction('HardwareWalletsStore:: set Transaction verified', () => {
26542654
this.hwDeviceStatus = HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED;
2655-
this.signedTx = signedTx; // TODO - change flag name
2655+
this.signedTx = signedTx;
26562656
this.activeDevicePath = null;
26572657
});
26582658
} catch (error) {

source/renderer/app/utils/dataSerialization.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// addr_test1qrujg5s2ws0ntmrgykm8ecfwx5n3xgt4zc0hzpg5ek5l78u8558mf5hyh6j38p9zmdmrdphndlls6p3jq3f702ms2awsj5gd95
2-
1+
import { map } from 'lodash';
32
import blakejs from 'blakejs';
43
import { encode } from 'borc';
54
import { utils } from '@cardano-foundation/ledgerjs-hw-app-cardano';
@@ -10,6 +9,7 @@ import {
109
groupTokensByPolicyId,
1110
} from './hardwareWalletUtils';
1211

12+
import type { AddressStyle } from '../api/addresses/types';
1313
import type {
1414
CoinSelectionInput,
1515
CoinSelectionWithdrawal,
@@ -167,7 +167,7 @@ export const toTxOutputAssets = (assets: CoinSelectionAssetsType) => {
167167
const assetMap = new Map<Buffer, number>();
168168

169169
// @ts-ignore ts-migrate(2769) FIXME: No overload matches this call.
170-
_.map(tokens, (token) => {
170+
map(tokens, (token) => {
171171
// @ts-ignore ts-migrate(2339) FIXME: Property 'assetName' does not exist on type 'unkno... Remove this comment to see the full error message
172172
assetMap.set(Buffer.from(token.assetName, 'hex'), token.quantity);
173173
});
@@ -217,7 +217,7 @@ export const toTxWithdrawal = (withdrawals: Array<CoinSelectionWithdrawal>) => {
217217
function encodeCBOR(encoder: any) {
218218
const withdrawalMap = new Map();
219219

220-
_.map(withdrawals, (withdrawal) => {
220+
map(withdrawals, (withdrawal) => {
221221
const rewardAccount = utils.bech32_decodeAddress(withdrawal.stakeAddress);
222222
const coin = withdrawal.amount.quantity;
223223
withdrawalMap.set(rewardAccount, coin);
@@ -340,7 +340,16 @@ export const toTxBody = ({
340340
withdrawals,
341341
txAuxiliaryData,
342342
txAuxiliaryDataHash,
343-
}: TxBodyType) => {
343+
}: {
344+
txInputs: Array<TxInputType>;
345+
txOutputs: Array<TxOutputType>;
346+
txAuxiliaryData?: TxAuxiliaryData;
347+
txAuxiliaryDataHash?: string;
348+
fee: number;
349+
ttl: number;
350+
certificates: Array<Certificate | null | undefined>;
351+
withdrawals: TxWithdrawalsType | null | undefined;
352+
}) => {
344353
const txFee = toTxFee(fee);
345354
const txTtl = toTxTtl(ttl);
346355
const txCerts = certificates;

source/renderer/app/utils/hardwareWalletUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import _ from 'lodash';
22
import { bech32 } from 'bech32';
33
import { str_to_path } from '@cardano-foundation/ledgerjs-hw-app-cardano/dist/utils/address';
4+
import { HexString } from '@cardano-foundation/ledgerjs-hw-app-cardano/dist/types/internal';
45
import { utils } from '@cardano-foundation/ledgerjs-hw-app-cardano';
56
import { deriveXpubChannel } from '../ipc/getHardwareWalletChannel';
67
import { HARDENED } from '../config/hardwareWalletsConfig';

source/renderer/app/utils/shelleyLedger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import type {
2626
CoinSelectionWithdrawal,
2727
CoinSelectionAssetsType,
2828
} from '../api/transactions/types';
29+
import { TxAuxiliaryData } from './dataSerialization';
2930

3031
export const toTokenBundle = (assets: CoinSelectionAssetsType) => {
3132
const tokenObject = groupTokensByPolicyId(assets);

0 commit comments

Comments
 (0)