Skip to content

Commit

Permalink
🧑‍💻(lld): remove all ununsed functions
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasWerey committed Oct 7, 2024
1 parent ad56ac2 commit acbbed3
Show file tree
Hide file tree
Showing 48 changed files with 11 additions and 601 deletions.
5 changes: 0 additions & 5 deletions apps/ledger-live-desktop/src/config/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ export const LanguageLocaleIds = {
*/
export type Language = (typeof LanguageIds)[number];

/**
* This is the Language Locale type.
*/
export type LanguageLocale = (typeof LanguageLocaleIds)[keyof typeof LanguageLocaleIds][number];

/**
* This is the Locale type.
*/
Expand Down
13 changes: 0 additions & 13 deletions apps/ledger-live-desktop/src/internal/types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
import { TraceContext } from "@ledgerhq/logs";

export type MessageTypes =
| "transport:open"
| "transport:exchange"
| "transport:exchangeBulk"
| "transport:exchangeBulk:unsubscribe"
| "transport:listen"
| "transport:listen:unsubscribe"
| "transport:close"
| "sentryLogsChanged"
| "set-sentry-tags"
| "internalCrashTest"
| "setEnv";

/**
* Types of messages received on the internal thread.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import crypto from "crypto";
import path from "path";
import fsPromises from "fs/promises";
import fs from "fs";
import { UpdateFetchFileFail } from "@ledgerhq/errors";
import network from "@ledgerhq/live-network/network";
Expand All @@ -27,15 +25,6 @@ export default async ({ feedURL, info }: { feedURL: string; info: UpdateDownload
});
};

// read the electron-updater file. we basically only need the filename here,
// because the hash file contains hashes for all platforms (better to have
// only 1 file to sign lel)
export async function readUpdateInfos(updateFolder: string) {
const updateInfoPath = path.resolve(updateFolder, "update-info.json");
const updateInfoContent = await fsPromises.readFile(updateInfoPath, "utf-8");
return JSON.parse(updateInfoContent);
}

// compute hash for given path.
export function sha512sumPath(path: string): Promise<string> {
return new Promise((resolve, reject) => {
Expand Down
6 changes: 0 additions & 6 deletions apps/ledger-live-desktop/src/main/updater/sslHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,3 @@ export async function verify(msgContent: string, sigContent: Buffer, pubKeyConte
throw new UpdateIncorrectSig();
}
}
export async function sign(msgContent: string, privKeyContent: string) {
const sign = crypto.createSign("sha256");
sign.update(msgContent);
const signature = sign.sign(privKeyContent);
return signature;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ export type BaseNftsProps = {
nfts: (ProtoNFT | NFT)[];
account: Account;
};

export type Status = "error" | "success" | "pending";
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
export enum Chains {
POLYGON = "POL",
ETHEREUM = "ETH",
BITCOIN = "BTC",
UTXO = "UTXO",
}

export enum ChainsEnum {
POLYGON = "polygon",
ETHEREUM = "ethereum",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@ export enum CollectibleTypeEnum {
RareSat = "RareSat",
Inscriptions = "Inscriptions",
}

export enum TanStackStatus {
Error = "error",
Success = "success",
Pending = "pending",
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import {
walletSyncStepSelector,
} from "~/renderer/reducers/walletSync";

export type HookProps = {
flow?: Flow;
};

export const FlowOptions: Record<
Flow,
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export type ManageBackupStepProps = {
goToDeleteBackup: () => void;
};

export type DeleteBackupStepProps = {
cancel: () => void;
};
Expand Down
4 changes: 0 additions & 4 deletions apps/ledger-live-desktop/src/renderer/actions/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ export type SetCurrentDevice = (a: Device | null) => {
type: string;
payload: Device | null;
};
export const setCurrentDevice: SetCurrentDevice = payload => ({
type: "SET_CURRENT_DEVICE",
payload,
});
type AddDevice = (a: Device) => {
type: string;
payload: Device;
Expand Down
40 changes: 0 additions & 40 deletions apps/ledger-live-desktop/src/renderer/actions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Feature,
DeviceInfo,
} from "@ledgerhq/types-live";
import { Currency } from "@ledgerhq/types-cryptoassets";
import { setEnvOnAllThreads } from "~/helpers/env";
import {
SettingsState as Settings,
Expand Down Expand Up @@ -65,10 +64,6 @@ export const setSentryLogs = (sentryLogs: boolean) =>
saveSettings({
sentryLogs,
});
export const setFullNodeEnabled = (fullNodeEnabled: boolean) =>
saveSettings({
fullNodeEnabled,
});
export const setShareAnalytics = (shareAnalytics: boolean) =>
saveSettings({
shareAnalytics,
Expand Down Expand Up @@ -105,10 +100,6 @@ export const setEnablePlatformDevTools = (enablePlatformDevTools: boolean) =>
saveSettings({
enablePlatformDevTools,
});
export const setCatalogProvider = (catalogProvider: string) =>
saveSettings({
catalogProvider,
});
export const setEnableLearnPageStagingUrl = (enableLearnPageStagingUrl: boolean) =>
saveSettings({
enableLearnPageStagingUrl,
Expand Down Expand Up @@ -240,10 +231,6 @@ export const clearLastSeenCustomImage = () => ({
imageHash: "",
},
});
export const swapAcceptProvider = (providerId: string) => ({
type: "ACCEPT_SWAP_PROVIDER",
payload: providerId,
});
export const showToken = (tokenId: string) => ({
type: "SHOW_TOKEN",
payload: tokenId,
Expand All @@ -263,22 +250,6 @@ export const fetchSettings: FetchSettings = (settings: SettingsState) => dispatc
payload: settings,
});
};

type ExchangePairs = Array<{
from: Currency;
to: Currency;
exchange: string | undefined | null;
}>;

type SetExchangePairs = (a: ExchangePairs) => {
type: "SETTINGS_SET_PAIRS";
payload: ExchangePairs;
};

export const setExchangePairsAction: SetExchangePairs = pairs => ({
type: "SETTINGS_SET_PAIRS",
payload: pairs,
});
export const dismissBanner = (bannerKey: string) => ({
type: "SETTINGS_DISMISS_BANNER",
payload: bannerKey,
Expand Down Expand Up @@ -315,17 +286,6 @@ export const setDeepLinkUrl = (url?: string | null) => ({
type: "SET_DEEPLINK_URL",
payload: url,
});
export const setFirstTimeLend = () => ({
type: "SET_FIRST_TIME_LEND",
});
export const setSwapSelectableCurrencies = (selectableCurrencies: string[]) => ({
type: "SET_SWAP_SELECTABLE_CURRENCIES",
payload: selectableCurrencies,
});
export const setSwapHasAcceptedIPSharing = (hasAcceptedIPSharing: boolean) => ({
type: "SET_SWAP_ACCEPTED_IP_SHARING",
payload: hasAcceptedIPSharing,
});
export const setOverriddenFeatureFlag = (featureFlag: {
key: FeatureId;
value: Feature | undefined;
Expand Down
26 changes: 0 additions & 26 deletions apps/ledger-live-desktop/src/renderer/actions/swap.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
import { Transaction } from "@ledgerhq/live-common/generated/types";
import { Account } from "@ledgerhq/types-live";
import memoize from "lodash/memoize";
import { createAction } from "redux-actions";
import { createSelector } from "reselect";
import { State } from "~/renderer/reducers";
import { SwapStateType } from "~/renderer/reducers/swap";
import { ExchangeRate, Pair } from "@ledgerhq/live-common/exchange/swap/types";

type UPDATE_PROVIDERS_TYPE = {
payload: SwapStateType["providers"];
};

/* ACTIONS */
export const updateProvidersAction =
createAction<UPDATE_PROVIDERS_TYPE["payload"]>("SWAP/UPDATE_PROVIDERS");

export const updateTransactionAction = createAction<Transaction | undefined | null>(
"SWAP/UPDATE_TRANSACTION",
);

export const updateRateAction = createAction<ExchangeRate | undefined | null>("SWAP/UPDATE_RATE");
export const resetSwapAction = createAction("SWAP/RESET_STATE");

/* SELECTORS */
export const providersSelector = createSelector(
(state: State) => state.swap,
swap => swap.providers,
);

export const filterAvailableToAssets = (pairs: Pair[] | null | undefined, fromId?: string) => {
if (pairs === null || pairs === undefined) return null;
Expand All @@ -39,11 +23,6 @@ export const filterAvailableToAssets = (pairs: Pair[] | null | undefined, fromId
return [...new Set(toAssets)];
};

export const toSelector = createSelector(
(state: State) => state.swap.pairs,
pairs => memoize((fromId?: string) => filterAvailableToAssets(pairs, fromId)),
);

// Put disabled accounts and subaccounts at the bottom of the list while preserving the parent/children position.
export function sortAccountsByStatus(accounts: (Account & { disabled: boolean })[]) {
let activeAccounts: Account[] = [];
Expand Down Expand Up @@ -89,8 +68,3 @@ export const rateSelector = createSelector(
(state: State) => state.swap,
swap => swap.exchangeRate,
);

export const rateExpirationSelector = createSelector(
(state: State) => state.swap,
swap => swap.exchangeRateExpiration,
);
9 changes: 0 additions & 9 deletions apps/ledger-live-desktop/src/renderer/actions/walletSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ export const addInstance = (payload: TrustchainMember) => ({
payload,
});

export const removeInstance = (payload: TrustchainMember) => ({
type: "WALLET_SYNC_CHANGE_REMOVE_INSTANCE",
payload,
});

export const removeAllInstances = () => ({
type: "WALLET_SYNC_CHANGE_CLEAN_INSTANCES",
});

export const resetWalletSync = () => ({
type: "WALLET_SYNC_RESET",
});
Expand Down
7 changes: 0 additions & 7 deletions apps/ledger-live-desktop/src/renderer/analytics/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,6 @@ export const start = async (store: ReduxStore) => {
context: getContext(),
});
};
export const stop = () => {
logger.analyticsStop();
storeInstance = null;
const analytics = getAnalytics();
if (!analytics) return;
analytics.reset();
};
type Properties = Error | Record<string, unknown> | null;
export type LoggableEvent = {
eventName: string;
Expand Down
12 changes: 0 additions & 12 deletions apps/ledger-live-desktop/src/renderer/components/Chart/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,3 @@ type EnrichedItem = {
export type Data = Item[];

export type EnrichedData = EnrichedItem[];

export type CTX = {
NODES: object;
MARGINS: object;
COLORS: object;
INVALIDATED: object;
HEIGHT: number;
WIDTH: number;
DATA: EnrichedData;
x: Function;
y: Function;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ImageDimensions } from "./types";

export function createCanvas(image?: HTMLImageElement): {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D | null;
Expand Down Expand Up @@ -28,10 +26,3 @@ export function rotateSize(width: number, height: number, rotationDeg: number) {
height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height),
};
}

export function scaleDimensions(dimensions: ImageDimensions, scale: number) {
return {
width: dimensions.width * scale,
height: dimensions.height * scale,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,3 @@ export type ImageBase64Data = {
// */
// imageFileUri: string;
// };

export type ImageUrl = {
/**
* Image URL locating an image on the internet.
* e.g: "https://example.com/an_image.png"
*/
imageUrl: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export const Notes = styled(Box).attrs(() => ({
font-weight: 700;
}
`;
export const Terms = Notes;
type Props = {
children: string;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
import React from "react";
import { useTranslation } from "react-i18next";
import styled, { DefaultTheme, StyledComponent } from "styled-components";
import { Box, Text, Flex, Icon, Switch } from "@ledgerhq/react-ui";
import { Text, Flex, Icon, Switch } from "@ledgerhq/react-ui";
import { BoxProps } from "@ledgerhq/react-ui/components/layout/Box/index";
import { SwitchProps } from "@ledgerhq/react-ui/components/form/Switch/Switch";
import { TextProps } from "@ledgerhq/react-ui/components/asorted/Text";

export const WaveContainer: StyledComponent<"div", DefaultTheme, BoxProps> = styled(Box).attrs({
position: "absolute",
left: "0",
right: "0",
top: "0",
height: "500px",
})`
pointer-events: none;
`;

export const AnimationContainer: StyledComponent<"div", DefaultTheme, BoxProps> = styled(Flex)`
overflow-x: clip;
width: 324px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@ export const OptionRowDesc = styled(Box).attrs(() => ({
grow: true,
pl: 2,
}))``;
export const IconOptionRow = styled(Box).attrs(p => ({
ff: "Inter|Regular",
fontSize: 14,
color: p.color || "wallet",
}))``;

export default OptionRow;
Loading

0 comments on commit acbbed3

Please sign in to comment.