Skip to content

Commit

Permalink
feat(wallet): improve imports.
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Panteleymonchuk <[email protected]>
  • Loading branch information
panteleymonchuk committed Aug 12, 2024
1 parent 3769d01 commit 44c7a27
Show file tree
Hide file tree
Showing 136 changed files with 344 additions and 366 deletions.
4 changes: 2 additions & 2 deletions apps/wallet/src/background/account-sources/AccountSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import { type Serializable } from '_src/shared/cryptography/keystore';

import { getDB } from '_src/background/db';
import { getDB } from '../db';
import {
clearEphemeralValue,
getEphemeralValue,
setEphemeralValue,
} from '_src/background/session-ephemeral-values';
} from '../session-ephemeral-values';

export enum AccountSourceType {
Mnemonic = 'mnemonic',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ import { bytesToHex } from '@noble/hashes/utils';
import Dexie from 'dexie';

import { getAccountSources } from '.';
import { getAllAccounts } from '_src/background/accounts';
import {
MnemonicAccount,
type MnemonicSerializedAccount,
} from '_src/background/accounts/MnemonicAccount';
import { setupAutoLockAlarm } from '_src/background/auto-lock-accounts';
import { backupDB, getDB } from '_src/background/db';
import { makeUniqueKey } from '_src/background/storage-utils';
import { getAllAccounts } from '../accounts';
import { MnemonicAccount, type MnemonicSerializedAccount } from '../accounts/MnemonicAccount';
import { setupAutoLockAlarm } from '../auto-lock-accounts';
import { backupDB, getDB } from '../db';
import { makeUniqueKey } from '../storage-utils';
import {
AccountSource,
AccountSourceType,
Expand Down
10 changes: 5 additions & 5 deletions apps/wallet/src/background/account-sources/SeedAccountSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { bytesToHex } from '@noble/hashes/utils';
import Dexie from 'dexie';

import { getAccountSources } from '.';
import { getAllAccounts } from '_src/background/accounts';
import { SeedAccount, type SeedSerializedAccount } from '_src/background/accounts/SeedAccount';
import { setupAutoLockAlarm } from '_src/background/auto-lock-accounts';
import { backupDB, getDB } from '_src/background/db';
import { makeUniqueKey } from '_src/background/storage-utils';
import { getAllAccounts } from '../accounts';
import { SeedAccount, type SeedSerializedAccount } from '../accounts/SeedAccount';
import { setupAutoLockAlarm } from '../auto-lock-accounts';
import { backupDB, getDB } from '../db';
import { makeUniqueKey } from '../storage-utils';
import {
AccountSource,
AccountSourceType,
Expand Down
4 changes: 2 additions & 2 deletions apps/wallet/src/background/account-sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
type MethodPayload,
} from '_src/shared/messaging/messages/payloads/MethodPayload';

import { type UiConnection } from '_src/background/connections/UiConnection';
import { getDB } from '_src/background/db';
import { type UiConnection } from '../connections/UiConnection';
import { getDB } from '../db';
import { AccountSourceType, type AccountSourceSerialized } from './AccountSource';
import { MnemonicAccountSource } from './MnemonicAccountSource';
import { SeedAccountSource } from './SeedAccountSource';
Expand Down
6 changes: 3 additions & 3 deletions apps/wallet/src/background/accounts/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
} from '@iota/iota.js/cryptography';
import { blake2b } from '@noble/hashes/blake2b';

import { setupAutoLockAlarm } from '_src/background/auto-lock-accounts';
import { getDB } from '_src/background/db';
import { setupAutoLockAlarm } from '../auto-lock-accounts';
import { getDB } from '../db';
import {
clearEphemeralValue,
getEphemeralValue,
setEphemeralValue,
} from '_src/background/session-ephemeral-values';
} from '../session-ephemeral-values';
import { accountsEvents } from './events';

export enum AccountType {
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/background/accounts/MnemonicAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { fromExportedKeypair } from '_src/shared/utils';
import { type Keypair } from '@iota/iota.js/cryptography';

import { MnemonicAccountSource } from '_src/background/account-sources/MnemonicAccountSource';
import { MnemonicAccountSource } from '../account-sources/MnemonicAccountSource';
import {
Account,
AccountType,
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/background/accounts/SeedAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { fromExportedKeypair } from '_src/shared/utils';
import { type Keypair } from '@iota/iota.js/cryptography';

import { SeedAccountSource } from '_src/background/account-sources/SeedAccountSource';
import { SeedAccountSource } from '../account-sources/SeedAccountSource';
import {
Account,
AccountType,
Expand Down
14 changes: 7 additions & 7 deletions apps/wallet/src/background/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { type WalletStatusChange } from '_src/shared/messaging/messages/payloads
import { fromB64 } from '@iota/iota.js/utils';
import Dexie from 'dexie';

import { getAccountSourceByID } from '_src/background/account-sources';
import { accountSourcesEvents } from '_src/background/account-sources/events';
import { MnemonicAccountSource } from '_src/background/account-sources/MnemonicAccountSource';
import { SeedAccountSource } from '_src/background/account-sources/SeedAccountSource';
import { type UiConnection } from '_src/background/connections/UiConnection';
import { backupDB, getDB } from '_src/background/db';
import { makeUniqueKey } from '_src/background/storage-utils';
import { getAccountSourceByID } from '../account-sources';
import { accountSourcesEvents } from '../account-sources/events';
import { MnemonicAccountSource } from '../account-sources/MnemonicAccountSource';
import { SeedAccountSource } from '../account-sources/SeedAccountSource';
import { type UiConnection } from '../connections/UiConnection';
import { backupDB, getDB } from '../db';
import { makeUniqueKey } from '../storage-utils';
import {
AccountType,
isKeyPairExportableAccount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import { type SignedTransaction } from '_src/ui/app/WalletSigner';
import { type IotaTransactionBlockResponse } from '@iota/iota.js/client';
import type { Runtime } from 'webextension-polyfill';

import { getAccountsStatusData } from '_src/background/accounts';
import NetworkEnv from '_src/background/NetworkEnv';
import { getAccountsStatusData } from '../accounts';
import NetworkEnv from '../NetworkEnv';
import { Connection } from './Connection';

export class ContentScriptConnection extends Connection {
Expand Down
30 changes: 13 additions & 17 deletions apps/wallet/src/background/connections/UiConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,26 @@ import {
accountSourcesHandleUIMessage,
getAccountSourceByID,
getAllSerializedUIAccountSources,
} from '_src/background/account-sources';
import { accountSourcesEvents } from '_src/background/account-sources/events';
import { MnemonicAccountSource } from '_src/background/account-sources/MnemonicAccountSource';
} from '../account-sources';
import { accountSourcesEvents } from '../account-sources/events';
import { MnemonicAccountSource } from '../account-sources/MnemonicAccountSource';
import {
accountsHandleUIMessage,
addNewAccounts,
getAccountsByAddress,
getAllSerializedUIAccounts,
} from '_src/background/accounts';
import { accountsEvents } from '_src/background/accounts/events';
import {
getAutoLockMinutes,
notifyUserActive,
setAutoLockMinutes,
} from '_src/background/auto-lock-accounts';
import { backupDB, getDB, SETTINGS_KEYS } from '_src/background/db';
import { clearStatus, doMigration, getStatus } from '_src/background/storage-migration';
import NetworkEnv from '_src/background/NetworkEnv';
} from '../accounts';
import { accountsEvents } from '../accounts/events';
import { getAutoLockMinutes, notifyUserActive, setAutoLockMinutes } from '../auto-lock-accounts';
import { backupDB, getDB, SETTINGS_KEYS } from '../db';
import { clearStatus, doMigration, getStatus } from '../storage-migration';
import NetworkEnv from '../NetworkEnv';
import { Connection } from './Connection';
import { SeedAccountSource } from '_src/background/account-sources/SeedAccountSource';
import { AccountSourceType } from '_src/background/account-sources/AccountSource';
import { SeedAccountSource } from '../account-sources/SeedAccountSource';
import { AccountSourceType } from '../account-sources/AccountSource';
import { isDeriveBipPathAccountsFinder, isPersistAccountsFinder } from '_payloads/accounts-finder';
import type { SerializedAccount } from '_src/background/accounts/Account';
import { LedgerAccount } from '_src/background/accounts/LedgerAccount';
import type { SerializedAccount } from '../accounts/Account';
import { LedgerAccount } from '../accounts/LedgerAccount';

export class UiConnection extends Connection {
public static readonly CHANNEL: PortChannelName = 'iota_ui<->background';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { type IotaClient } from '@iota/iota.js/client';
import type { SerializedSignature } from '@iota/iota.js/cryptography';

import type { BackgroundClient } from '.';
import { WalletSigner } from '../WalletSigner';
import { WalletSigner } from '_app/WalletSigner';

export class BackgroundServiceSigner extends WalletSigner {
readonly #account: SerializedUIAccount;
Expand Down
8 changes: 4 additions & 4 deletions apps/wallet/src/ui/app/background-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import { toB64 } from '@iota/iota.js/utils';
import { type QueryKey } from '@tanstack/react-query';
import { lastValueFrom, map, take } from 'rxjs';

import { growthbook } from '../experimentation/feature-gating';
import { ACCOUNTS_QUERY_KEY } from '../helpers/query-client-keys';
import { queryClient } from '../helpers/queryClient';
import { ACCOUNT_SOURCES_QUERY_KEY } from '../hooks/useAccountSources';
import { growthbook } from '_app/experimentation/feature-gating';
import { ACCOUNTS_QUERY_KEY } from '_app/helpers/query-client-keys';
import { queryClient } from '_app/helpers/queryClient';
import { ACCOUNT_SOURCES_QUERY_KEY } from '_app/hooks/useAccountSources';
import { AccountSourceType } from '_src/background/account-sources/AccountSource';
import {
type DeriveBipPathAccountsFinder,
Expand Down
6 changes: 3 additions & 3 deletions apps/wallet/src/ui/app/components/DAppInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { getValidDAppUrl } from '_src/shared/utils';
import { CheckFill16 } from '@iota/icons';
import cn from 'clsx';

import { useAccountByAddress } from '../hooks/useAccountByAddress';
import { Heading } from '../shared/heading';
import { Link } from '../shared/Link';
import { useAccountByAddress } from '_app/hooks/useAccountByAddress';
import { Heading } from '_app/shared/heading';
import { Link } from '_app/shared/Link';
import { AccountIcon } from './accounts/AccountIcon';
import { AccountItem } from './accounts/AccountItem';
import { LockUnlockButton } from './accounts/LockUnlockButton';
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/DAppPermissionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type { PermissionType } from '_messages/payloads/permissions';
import { CheckFill12 } from '@iota/icons';

import { Text } from '../shared/text';
import { Text } from '_app/shared/text';

export interface DAppPermissionsListProps {
permissions: PermissionType[];
Expand Down
6 changes: 3 additions & 3 deletions apps/wallet/src/ui/app/components/HideShowDisplayBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { Copy16, EyeClose16, EyeOpen16 } from '@iota/icons';
import { cx } from 'class-variance-authority';
import { useEffect, useState } from 'react';

import { useCopyToClipboard } from '../hooks/useCopyToClipboard';
import { Link } from '../shared/Link';
import { Text } from '../shared/text';
import { useCopyToClipboard } from '_app/hooks/useCopyToClipboard';
import { Link } from '_app/shared/Link';
import { Text } from '_app/shared/text';

const AUTO_HIDE_INTERVAL = 3 * 60 * 1000;

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { cva, type VariantProps } from 'class-variance-authority';

import { ButtonOrLink, type ButtonOrLinkProps } from '../shared/utils/ButtonOrLink';
import { ButtonOrLink, type ButtonOrLinkProps } from '_app/shared/utils/ButtonOrLink';

interface IconButtonProps extends ButtonOrLinkProps, VariantProps<typeof buttonStyles> {
icon: JSX.Element;
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/SectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { Text } from '../shared/text';
import { Text } from '_app/shared/text';

interface SectionHeaderProps {
title: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/SummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import clsx from 'clsx';
import type { ReactNode } from 'react';

import { Text } from '../shared/text';
import { Text } from '_app/shared/text';

export interface SummaryCardProps {
header?: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/wallet/src/ui/app/components/WalletListSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import { cx } from 'class-variance-authority';
import { useMemo } from 'react';

import { useAccounts } from '../hooks/useAccounts';
import { Link } from '../shared/Link';
import { useAccounts } from '_app/hooks/useAccounts';
import { Link } from '_app/shared/Link';
import { SummaryCard } from './SummaryCard';
import { WalletListSelectItem, type WalletListSelectItemProps } from './WalletListSelectItem';

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/WalletListSelectItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { formatAddress } from '@iota/iota.js/utils';
import { cva, cx, type VariantProps } from 'class-variance-authority';
import { useEffect, useRef } from 'react';

import { Text } from '../shared/text';
import { Text } from '_app/shared/text';

const styles = cva('transition flex flex-row flex-nowrap items-center gap-3 py-2 cursor-pointer', {
variants: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import { Copy12 } from '@iota/icons';
import { Text } from '_src/ui/app/shared/text';
import { formatAddress } from '@iota/iota.js/utils';
import { useCopyToClipboard } from '../../hooks/useCopyToClipboard';
import { IconButton } from '../IconButton';
import { useCopyToClipboard } from '_app/hooks/useCopyToClipboard';
import { IconButton } from '_components/IconButton';
import { type SerializedUIAccount } from '_src/background/accounts/Account';
import { useBalance, useFormatCoin } from '@iota/core';

Expand Down
10 changes: 5 additions & 5 deletions apps/wallet/src/ui/app/components/accounts/AccountItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { formatAddress } from '@iota/iota.js/utils';
import cn from 'clsx';
import { forwardRef, type ReactNode } from 'react';

import { useAccounts } from '../../hooks/useAccounts';
import { useCopyToClipboard } from '../../hooks/useCopyToClipboard';
import { useExplorerLink } from '../../hooks/useExplorerLink';
import { ExplorerLinkType } from '../explorer-link/ExplorerLinkType';
import { IconButton } from '../IconButton';
import { useAccounts } from '_app/hooks/useAccounts';
import { useCopyToClipboard } from '_app/hooks/useCopyToClipboard';
import { useExplorerLink } from '_app/hooks/useExplorerLink';
import { ExplorerLinkType } from '_components/explorer-link/ExplorerLinkType';
import { IconButton } from '_components/IconButton';
import { EditableAccountName } from './EditableAccountName';

interface AccountItemProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { type SerializedUIAccount } from '_src/background/accounts/Account';

import { useActiveAccount } from '../../hooks/useActiveAccount';
import { useActiveAccount } from '_app/hooks/useActiveAccount';
import { AccountIcon } from './AccountIcon';
import { AccountItem } from './AccountItem';
import { LockUnlockButton } from './LockUnlockButton';
Expand Down
8 changes: 4 additions & 4 deletions apps/wallet/src/ui/app/components/accounts/AccountsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { Filter16, Plus12 } from '@iota/icons';
import * as ToggleGroup from '@radix-ui/react-toggle-group';
import { useMemo, useState } from 'react';

import { useAccountGroups } from '../../hooks/useAccountGroups';
import { useActiveAccount } from '../../hooks/useActiveAccount';
import { useBackgroundClient } from '../../hooks/useBackgroundClient';
import { Heading } from '../../shared/heading';
import { useAccountGroups } from '_app/hooks/useAccountGroups';
import { useActiveAccount } from '_app/hooks/useActiveAccount';
import { useBackgroundClient } from '_app/hooks/useBackgroundClient';
import { Heading } from '_app/shared/heading';
import { AccountListItem } from './AccountListItem';
import { FooterLink } from './FooterLink';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { useEffect } from 'react';
import { useFormContext } from 'react-hook-form';
import { z } from 'zod';

import { CheckboxField } from '../../shared/forms/CheckboxField';
import { Input } from '../../shared/forms/controls/Input';
import FormField from '../../shared/forms/FormField';
import { SelectField } from '../../shared/forms/SelectField';
import { CheckboxField } from '_app/shared/forms/CheckboxField';
import { Input } from '_app/shared/forms/controls/Input';
import FormField from '_app/shared/forms/FormField';
import { SelectField } from '_app/shared/forms/SelectField';

const LOCK_INTERVALS = [
{ id: 'day', label: 'Day' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { forwardRef, useRef } from 'react';
import toast from 'react-hot-toast';
import { z } from 'zod';

import { useBackgroundClient } from '../../hooks/useBackgroundClient';
import { Form } from '../../shared/forms/Form';
import { useBackgroundClient } from '_app/hooks/useBackgroundClient';
import { Form } from '_app/shared/forms/Form';

interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'className'> {}

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/accounts/FooterLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { forwardRef } from 'react';

import { Link, type LinkProps } from '../../shared/Link';
import { Link, type LinkProps } from '_app/shared/Link';

interface FooterLinkProps extends LinkProps {
icon?: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { type SubmitHandler } from 'react-hook-form';
import { useNavigate } from 'react-router-dom';
import { z } from 'zod';

import { privateKeyValidation } from '../../helpers/validation/privateKeyValidation';
import { Form } from '../../shared/forms/Form';
import { TextAreaField } from '../../shared/forms/TextAreaField';
import Alert from '../alert';
import { privateKeyValidation } from '_app/helpers/validation/privateKeyValidation';
import { Form } from '_app/shared/forms/Form';
import { TextAreaField } from '_app/shared/forms/TextAreaField';
import Alert from '_components/alert';

const formSchema = z.object({
privateKey: privateKeyValidation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { type SubmitHandler } from 'react-hook-form';
import { useNavigate } from 'react-router-dom';
import { z } from 'zod';

import Alert from '../alert';
import Alert from '_components/alert';

const RECOVERY_PHRASE_WORD_COUNT = 24;

Expand Down
Loading

0 comments on commit 44c7a27

Please sign in to comment.