Skip to content

Commit

Permalink
Merge pull request #916 from ambrosus/hotfix/imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturHoncharuk authored Dec 19, 2024
2 parents 268f05e + be1d5c5 commit 838a2dd
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
HarborPreViewData
} from '@features/harbor/components/harbor-preview/model';
import { scale } from '@utils';
import { scale } from '@utils/scaling';
import { styles } from './styles';

export const FormTemplate = ({
Expand Down
9 changes: 2 additions & 7 deletions src/features/swap/utils/multi-route.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import {
SWAP_SUPPORTED_TOKENS,
TOKEN_ADDRESSES
} from '@features/swap/entities';
import { SWAP_SUPPORTED_TOKENS } from '@features/swap/entities';
import { environment } from '@utils/environment';
import { wrapNativeAddress } from './wrap-native-address';

export const addresses = TOKEN_ADDRESSES[environment];
import { addresses, wrapNativeAddress } from './wrap-native-address';

export const isMultiHopSwapAvailable = (path: string[]): boolean => {
return !!extractArrayOfMiddleMultiHopAddresses(path).address;
Expand Down
5 changes: 4 additions & 1 deletion src/features/swap/utils/wrap-native-address.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { ethers } from 'ethers';
import Config from '@constants/config';
import { TOKEN_ADDRESSES } from '@features/swap/entities';
import { SwapToken } from '@features/swap/types';
import { addresses } from './multi-route';
import { environment } from '@utils/environment';

export const addresses = TOKEN_ADDRESSES[environment];

export function isNativeWrapped(path: string[]) {
const wrappedPath = Config.SWAP_TOKENS.find(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { AirDAOEventType } from '@appTypes';
import { useNotificationsQuery } from '@hooks';
import useAppFocus from '@hooks/useAppFocused';
import { useAppFocus } from '@hooks/useAppFocused';
import { AirDAOEventDispatcher } from '@lib';
import { Cache, CacheKey } from '@lib/cache';

Expand Down
1 change: 0 additions & 1 deletion src/lib/crypto/AirDAOKeys.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */

import { KeysUtils } from '@utils/keys';
const bip32 = require('bip32');

Expand Down
3 changes: 2 additions & 1 deletion src/lib/crypto/AirDAOKeysStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,5 @@ class AirDAOKeysStorage {
}
}

export const singleAirDAOStorage = new AirDAOKeysStorage();
const singleAirDAOStorage = new AirDAOKeysStorage();
export default singleAirDAOStorage;
2 changes: 1 addition & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './notification';
export * from './event-dispatcher';
export { singleAirDAOStorage } from './crypto/AirDAOKeysStorage';
export { default as AirDAOKeysStorage } from './crypto/AirDAOKeysStorage';
export * from './bridgeSDK';
export { default as PermissionService } from './permission';
export { default as UID } from './UID';
Expand Down
11 changes: 7 additions & 4 deletions src/screens/CreateWallet/screens/CreateWalletStep2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Toast, ToastPosition, ToastType } from '@components/modular';
import { COLORS } from '@constants/colors';
import { useAddWalletStore } from '@features/add-wallet';
import { usePasscodeStore } from '@features/passcode';
import { useAllAccounts } from '@hooks/database';
import { scale, verticalScale, WalletUtils } from '@utils';
import { MnemonicRandom } from './MnemonicRandom';
import { MnemonicSelected } from './MnemonicSelected';
Expand All @@ -20,6 +21,7 @@ export const CreateWalletStep2 = () => {
const { mnemonic } = useAddWalletStore();
const { t } = useTranslation();
const { isPasscodeEnabled } = usePasscodeStore();
const { data: accounts } = useAllAccounts();

const [walletMnemonicSelected, setWalletMnemonicSelected] = useState<
{ word: string; index: number }[]
Expand Down Expand Up @@ -78,17 +80,18 @@ export const CreateWalletStep2 = () => {

try {
setLoading(true);
await WalletUtils.processWallet(mnemonic);
await WalletUtils.processWallet(mnemonic, accounts);
navigateToSetUpSecurity();
} finally {
setLoading(false);
}
}, [
walletMnemonicSelected.length,
walletMnemonicArrayDefault.length,
isMnemonicCorrect,
navigateToSetUpSecurity,
mnemonic,
walletMnemonicArrayDefault.length,
walletMnemonicSelected.length
accounts,
navigateToSetUpSecurity
]);

const onPositionIncorrect = () => {
Expand Down
9 changes: 6 additions & 3 deletions src/screens/Settings/Settings.constants.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react';
import { TelegramSettingsIcon } from '@components/svg/icons';
import MediumIcon from '@components/svg/icons/MediumIcon';

import {
MediumIcon,
XTwitterIcon,
TelegramSettingsIcon
} from '@components/svg/icons';
import {
AboutIcon,
CompassIcon,
Expand All @@ -10,7 +14,6 @@ import {
WalletIcon,
WatchListIcon
} from '@components/svg/icons/v2/settings';
import XTwitterIcon from '@components/svg/icons/XTwitterIcon';
import { COLORS } from '@constants/colors';
import { SettingsMenuItem } from '@screens/Settings/Settings.types';

Expand Down
4 changes: 2 additions & 2 deletions src/screens/Settings/screens/AccessKeys/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import { SettingsTabParamsList } from '@appTypes';
import { Header } from '@components/composite';
import { AnimatedTabs } from '@components/modular';
import { singleAirDAOStorage } from '@lib';
import { AirDAOKeysStorage } from '@lib';
import { AccessKeysMnemonicTab } from '@screens/Settings/screens/AccessKeys/tabs/Mnemonic/AccessKeys.Mnemonic';
import { AccessKeysPrivateTab } from '@screens/Settings/screens/AccessKeys/tabs/Private/AccessKeys.Private';
import { styles } from './styles';
Expand All @@ -20,7 +20,7 @@ export const AccessKeysScreen = ({ route }: Props) => {
(async () => {
setIsMnemonicAvailable(
(
await singleAirDAOStorage.getWalletMnemonic(route.params.walletHash)
await AirDAOKeysStorage.getWalletMnemonic(route.params.walletHash)
).split(' ').length > 1
);
})();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { useTranslation } from 'react-i18next';
import { Spacer, Text } from '@components/base';
import { COLORS } from '@constants/colors';
import { singleAirDAOStorage } from '@lib';
import { AirDAOKeysStorage } from '@lib';
import { scale } from '@utils';
import { styles } from './styles';

Expand All @@ -27,7 +27,7 @@ export const AccessKeysMnemonicTab = ({
if (walletHash) {
(async () => {
const mnemonic = (
await singleAirDAOStorage.getWalletMnemonic(walletHash)
await AirDAOKeysStorage.getWalletMnemonic(walletHash)
).split(' ');
setMnemonicPhrase(mnemonic);
})();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/cashback.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import AirDAOKeysForRef from '@lib/crypto/AirDAOKeysForRef';
import AirDAOKeysForRefStorage from '@lib/crypto/AirDAOKeysForRefStorage';
import { singleAirDAOStorage } from '@lib/crypto/AirDAOKeysStorage';
import singleAirDAOStorage from '@lib/crypto/AirDAOKeysStorage';

const getByHash = async (tmpHash: string) => {
let tmpPublicAndPrivateResult =
Expand Down
3 changes: 2 additions & 1 deletion src/utils/keys.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import bip39 from 'bip39';
// @ts-ignore
import createHmac from 'create-hmac';
import * as Crypto from 'expo-crypto';
import { DEFAULT_WORDS } from '@constants/words';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const bip39 = require('bip39');

interface CreateHmacPDFK2Sizes {
[key: string]: number;
Expand Down
3 changes: 2 additions & 1 deletion src/utils/mnemonics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import bip39 from 'bip39';
import { DEFAULT_WORDS } from '@constants/words';
import { CryptoUtils } from './crypto';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const bip39 = require('bip39');

const generateNewMnemonic = async (size = 256) => {
const random = await CryptoUtils.getRandomBytes(size / 8);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
WalletDBModel
} from '@database';
import AirDAOKeysForRef from '@lib/crypto/AirDAOKeysForRef';
import { singleAirDAOStorage } from '@lib/crypto/AirDAOKeysStorage';
import singleAirDAOStorage from '@lib/crypto/AirDAOKeysStorage';
import {
CustomAppEvents,
sendFirebaseEvent
Expand Down

0 comments on commit 838a2dd

Please sign in to comment.