diff --git a/.eslintrc.js b/.eslintrc.js index 34c0f18238..511cc535f7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,12 @@ // This is a non-ESM JS file, so this rule can't be followed. /* eslint-disable @typescript-eslint/no-var-requires */ +const { + rules: { + "@typescript-eslint/naming-convention": + airbnbTypeScriptNamingConventionRules, + }, +} = require("eslint-config-airbnb-typescript/lib/shared") + const { rules: { "no-param-reassign": airbnbNoParamReassignRules }, } = require("eslint-config-airbnb-base/rules/best-practices") @@ -28,6 +35,22 @@ module.exports = { // The rule is also mostly irrelevant to this codebase due to TypeScript // usage (where .tsx is required). "react/jsx-filename-extension": [0], + "@typescript-eslint/naming-convention": [ + ...airbnbTypeScriptNamingConventionRules, + // Allow underscore-only identifiers to indicate ignored positional variables. + { + selector: "variable", + format: null, + filter: { + regex: "^_+$", + match: true, + }, + custom: { + regex: "^_+$", + match: true, + }, + }, + ], // TypeScript allows us to declare props that are non-optional internally // but are interpreted as optional externally if they have defaultProps // defined; the following two adjustments disable eslint-plugin-react diff --git a/background/redux-slices/accounts.ts b/background/redux-slices/accounts.ts index 21ae6552cb..4b70aef961 100644 --- a/background/redux-slices/accounts.ts +++ b/background/redux-slices/accounts.ts @@ -17,7 +17,7 @@ export const enum AccountType { ReadOnly = "read-only", Imported = "imported", Ledger = "ledger", - NewSeed = "newSeed", + Internal = "internal", } const availableDefaultNames = [ diff --git a/background/redux-slices/keyrings.ts b/background/redux-slices/keyrings.ts index 65c5ae40a6..7e2195a0f4 100644 --- a/background/redux-slices/keyrings.ts +++ b/background/redux-slices/keyrings.ts @@ -7,7 +7,7 @@ import { Keyring, KeyringMetadata } from "../services/keyring/index" type KeyringsState = { keyrings: Keyring[] - keyringMetadata: { [keyringId: string]: { source: "import" | "newSeed" } } + keyringMetadata: { [keyringId: string]: { source: "import" | "internal" } } importing: false | "pending" | "done" status: "locked" | "unlocked" | "uninitialized" keyringToVerify: { @@ -36,7 +36,7 @@ export const emitter = new Emittery() interface ImportKeyring { mnemonic: string - source: "newSeed" | "import" + source: "internal" | "import" path?: string } diff --git a/background/redux-slices/selectors/accountsSelectors.ts b/background/redux-slices/selectors/accountsSelectors.ts index 2a6f86893a..639803fdca 100644 --- a/background/redux-slices/selectors/accountsSelectors.ts +++ b/background/redux-slices/selectors/accountsSelectors.ts @@ -196,7 +196,7 @@ const getAccountType = ( address: string, signingMethod: SigningMethod, addressSources: { - [address: string]: "import" | "newSeed" + [address: string]: "import" | "internal" } ): AccountType => { if (signingMethod == null) { @@ -208,7 +208,7 @@ const getAccountType = ( if (addressSources[address] === "import") { return AccountType.Imported } - return AccountType.NewSeed + return AccountType.Internal } export const selectAccountTotalsByCategory = createSelector( diff --git a/background/redux-slices/selectors/keyringsSelectors.ts b/background/redux-slices/selectors/keyringsSelectors.ts index fb7f218c40..20112e07f5 100644 --- a/background/redux-slices/selectors/keyringsSelectors.ts +++ b/background/redux-slices/selectors/keyringsSelectors.ts @@ -33,7 +33,7 @@ export const selectSourcesByAddress = createSelector( keyrings, keyringMetadata ): { - [keyringId: string]: "import" | "newSeed" + [keyringId: string]: "import" | "internal" } => Object.fromEntries( keyrings diff --git a/background/services/keyring/index.ts b/background/services/keyring/index.ts index 2c54c4f3bb..ac29b571d8 100644 --- a/background/services/keyring/index.ts +++ b/background/services/keyring/index.ts @@ -35,7 +35,7 @@ export type Keyring = { } export interface KeyringMetadata { - source: "import" | "newSeed" + source: "import" | "internal" } interface SerializedKeyringData { @@ -311,7 +311,7 @@ export default class KeyringService extends BaseService { */ async importKeyring( mnemonic: string, - source: "import" | "newSeed", + source: "import" | "internal", path?: string ): Promise { this.requireUnlocked() diff --git a/provider-bridge-shared/runtime-typechecks.ts b/provider-bridge-shared/runtime-typechecks.ts index 1d5237041c..38bbc16de3 100644 --- a/provider-bridge-shared/runtime-typechecks.ts +++ b/provider-bridge-shared/runtime-typechecks.ts @@ -62,10 +62,10 @@ export function isPortResponseEvent(arg: unknown): arg is PortResponseEvent { } export const AllowedQueryParamPage = { - signTransaction: "/signTransaction", - dappPermission: "/dappPermission", - signData: "/signData", - personalSignData: "/personalSign", + signTransaction: "/sign-transaction", + dappPermission: "/dapp-permission", + signData: "/sign-data", + personalSignData: "/personal-sign", } as const export type AllowedQueryParamPageType = diff --git a/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx b/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx index 7a7111ab9a..78dbe88fc1 100644 --- a/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx +++ b/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx @@ -32,7 +32,7 @@ const walletTypeDetails: { [key in AccountType]: WalletTypeInfo } = { title: "Import", icon: "./images/imported@2x.png", }, - [AccountType.NewSeed]: { + [AccountType.Internal]: { title: "Tally", icon: "./images/tally_reward@2x.png", // FIXME: Icon is cut off - we should get a better one }, @@ -171,7 +171,7 @@ export default function AccountsNotificationPanelAccounts({ }, [onCurrentAddressChange, pendingSelectedAddress, selectedAccountAddress]) const accountTypes = [ - AccountType.NewSeed, + AccountType.Internal, AccountType.Imported, AccountType.ReadOnly, ] @@ -211,7 +211,7 @@ export default function AccountsNotificationPanelAccounts({ accountType={accountType} walletNumber={idx + 1} onClickAddAddress={ - accountType === "imported" || accountType === "newSeed" + accountType === "imported" || accountType === "internal" ? () => { if (accountTotalsByKeyringId[0].keyringId) { dispatch( @@ -261,7 +261,7 @@ export default function AccountsNotificationPanelAccounts({ icon="plus" iconSize="medium" iconPosition="left" - linkTo="/onboarding/addWallet" + linkTo="/onboarding/add-wallet" > Add Wallet diff --git a/ui/components/HiddenDevPanel/HiddenDevPanel.tsx b/ui/components/HiddenDevPanel/HiddenDevPanel.tsx index 3664250eb1..7b8a1afcf4 100644 --- a/ui/components/HiddenDevPanel/HiddenDevPanel.tsx +++ b/ui/components/HiddenDevPanel/HiddenDevPanel.tsx @@ -15,7 +15,7 @@ export default function HiddenDevPanel(): ReactElement { icon="arrow_right" iconSize="large" onClick={() => { - history.push("/onboarding/infoIntro") + history.push("/onboarding/info-intro") }} > Enter Onboarding diff --git a/ui/components/Onboarding/OnboardingDerivationPathSelect.tsx b/ui/components/Onboarding/OnboardingDerivationPathSelect.tsx index 28eb0d6bbf..aa3f7ceb50 100644 --- a/ui/components/Onboarding/OnboardingDerivationPathSelect.tsx +++ b/ui/components/Onboarding/OnboardingDerivationPathSelect.tsx @@ -11,7 +11,14 @@ import SharedModal from "../Shared/SharedModal" import SharedSelect from "../Shared/SharedSelect" // TODO make this network specific -const initialDerivationPaths: { value: string; label: string }[] = [ +const initialDerivationPaths: { + value: string + label: string +}[] = [ + { + value: "m/44'/60'/x'/0/0", + label: "Ledger Live", + }, { value: "m/44'/60'/0'/0", label: "Ethereum", diff --git a/ui/components/Shared/SharedAssetInput.tsx b/ui/components/Shared/SharedAssetInput.tsx index 44c73b0287..1b3acaceed 100644 --- a/ui/components/Shared/SharedAssetInput.tsx +++ b/ui/components/Shared/SharedAssetInput.tsx @@ -125,7 +125,7 @@ function SelectAssetMenuContent(
-
    +
      {sortedFilteredAssets.map((assetWithOptionalAmount) => { const { asset } = assetWithOptionalAmount return ( @@ -180,7 +180,12 @@ function SelectAssetMenuContent( width: 384px; border-bottom: 1px solid var(--hunter-green); margin-top: 15px; - margin-bottom: 8.5px; + } + .assets_list { + display: block; + overflow: scroll; + height: calc(100% - 98px); + width: 100%; } `} diff --git a/ui/components/Swap/SwapQuote.tsx b/ui/components/Swap/SwapQuote.tsx index cc25ad39c0..e184c7e828 100644 --- a/ui/components/Swap/SwapQuote.tsx +++ b/ui/components/Swap/SwapQuote.tsx @@ -63,7 +63,7 @@ export default function SwapQuote({ gasPrice, }) ) - history.push("/signTransaction") + history.push("/sign-transaction") }, [ finalQuote, dispatch, diff --git a/ui/pages/EarnDeposit.tsx b/ui/pages/EarnDeposit.tsx index 411cfeb5c1..eeaa6c867a 100644 --- a/ui/pages/EarnDeposit.tsx +++ b/ui/pages/EarnDeposit.tsx @@ -178,7 +178,7 @@ export default function EarnDeposit(): ReactElement { type="primary" size="large" isDisabled={hasError} - linkTo={!isApproved ? "/signTransaction" : "/signData"} + linkTo={!isApproved ? "/sign-transaction" : "/sign-data"} onClick={!isApproved ? approve : enable} > {!isApproved ? "Approve" : "Enable"} diff --git a/ui/pages/Ledger/LedgerImportAccounts.tsx b/ui/pages/Ledger/LedgerImportAccounts.tsx index efcb31f6e4..e74c54d1d8 100644 --- a/ui/pages/Ledger/LedgerImportAccounts.tsx +++ b/ui/pages/Ledger/LedgerImportAccounts.tsx @@ -35,7 +35,12 @@ function usePageData({ const firstIndex = pageIndex * addressesPerPage const lastIndex = (pageIndex + 1) * addressesPerPage - 1 for (let i = firstIndex; i <= lastIndex; i += 1) { - paths.push(`${parentPath}/${i}`) + if (parentPath.includes("x")) { + const formattedString = parentPath.slice().replace("x", `${i}`) + paths.push(formattedString) + } else { + paths.push(`${parentPath}/${i}`) + } } const items = paths.map((path) => { diff --git a/ui/pages/Onboarding/OnboardingAddWallet.tsx b/ui/pages/Onboarding/OnboardingAddWallet.tsx index 89943c8074..a281b6a9ed 100644 --- a/ui/pages/Onboarding/OnboardingAddWallet.tsx +++ b/ui/pages/Onboarding/OnboardingAddWallet.tsx @@ -26,7 +26,7 @@ export default function OnboardingStartTheHunt(): ReactElement { Preview an address @@ -39,7 +39,7 @@ export default function OnboardingStartTheHunt(): ReactElement { Import recovery phrase @@ -70,7 +70,7 @@ export default function OnboardingStartTheHunt(): ReactElement { Create new wallet diff --git a/ui/pages/Onboarding/OnboardingInfoIntro.tsx b/ui/pages/Onboarding/OnboardingInfoIntro.tsx index 3ea3e24332..da99ebac9b 100644 --- a/ui/pages/Onboarding/OnboardingInfoIntro.tsx +++ b/ui/pages/Onboarding/OnboardingInfoIntro.tsx @@ -55,7 +55,7 @@ export default function OnboardingInfoIntro(): ReactElement { const [redirectToAddWallet, setRedirectToAddWallet] = useState(false) if (redirectToAddWallet) { - return + return } return ( diff --git a/ui/pages/Onboarding/OnboardingInterstitialCreatePhrase.tsx b/ui/pages/Onboarding/OnboardingInterstitialCreatePhrase.tsx index 1629357227..5f9ad2be58 100644 --- a/ui/pages/Onboarding/OnboardingInterstitialCreatePhrase.tsx +++ b/ui/pages/Onboarding/OnboardingInterstitialCreatePhrase.tsx @@ -13,7 +13,7 @@ export default function OnboardingInterstitialCreatePhrase(): ReactElement { async function generateThenContinue() { if (areKeyringsUnlocked) { await dispatch(generateNewKeyring()) - history.push("/onboarding/saveSeed") + history.push("/onboarding/save-seed") } }, [areKeyringsUnlocked, dispatch, history] diff --git a/ui/pages/Onboarding/OnboardingSaveSeed.tsx b/ui/pages/Onboarding/OnboardingSaveSeed.tsx index df8894ceaf..8d9bc51eb9 100644 --- a/ui/pages/Onboarding/OnboardingSaveSeed.tsx +++ b/ui/pages/Onboarding/OnboardingSaveSeed.tsx @@ -60,7 +60,7 @@ export default function OnboardingSaveSeed(): ReactElement { size="medium" icon="arrow_right" iconSize="large" - linkTo="/onboarding/verifySeed" + linkTo="/onboarding/verify-seed" > I wrote it down diff --git a/ui/pages/Onboarding/OnboardingVerifySeed.tsx b/ui/pages/Onboarding/OnboardingVerifySeed.tsx index c2b4caeaba..a1ae80834a 100644 --- a/ui/pages/Onboarding/OnboardingVerifySeed.tsx +++ b/ui/pages/Onboarding/OnboardingVerifySeed.tsx @@ -20,7 +20,10 @@ function SuccessMessage({ mnemonic }: { mnemonic: string[] }) { type="primary" onClick={async () => { await dispatch( - importKeyring({ mnemonic: mnemonic.join(" "), source: "newSeed" }) + importKeyring({ + mnemonic: mnemonic.join(" "), + source: "internal", + }) ) history.push("/") }} diff --git a/ui/pages/Popup.tsx b/ui/pages/Popup.tsx index 5d5b61e79e..4d1e0c9f02 100644 --- a/ui/pages/Popup.tsx +++ b/ui/pages/Popup.tsx @@ -73,7 +73,7 @@ export function Main(): ReactElement { function saveHistoryEntries(routeHistoryEntities: Location[]) { const isNotOnKeyringRelatedPage = routeHistoryEntities[routeHistoryEntities.length - 1].pathname !== - "/signTransaction" && + "/sign-transaction" && !routeHistoryEntities[routeHistoryEntities.length - 1].pathname.includes( "/keyring/" ) @@ -187,12 +187,6 @@ export function Main(): ReactElement { <>