From 7a2ade35eee70b6e4ab53d967ab2210c0cf48c3e Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Mon, 23 Dec 2024 12:10:11 -0500 Subject: [PATCH 1/2] Fix broken backups e2e (#6365) * fix broken testID for backups and condiiton that prevents manually backed up wallets from being marked as backed up * fix path for serial and parallel * E2E improvements (#6369) * goodbye hardhat => hello anvil * replace usage of IS_TESTING in favor of IS_TEST * fix detox config * more refactor * anvil already installed in CI machines * fix anvil shutdown * retry per file so we can handle anvil separately * fix inverse logic --------- Co-authored-by: Bruno Barbieri Co-authored-by: Bruno Barbieri <1247834+brunobar79@users.noreply.github.com> --- .detoxrc.js | 2 + .github/workflows/macstadium-tests.yml | 11 +- ... anvilTransactionFlowSendAndWC.disable.js} | 12 +- ... => anvilTransactionFlowSwaps.disabled.js} | 14 +- e2e/Disabled/registerENSFlow.disabled.js | 10 +- e2e/Disabled/sendSheetFlow.disabled.ts | 14 +- e2e/Disabled/swapSheetFlow1.disabled.js | 12 +- e2e/Disabled/swapSheetFlow2.disabled.js | 18 +- e2e/helpers.ts | 25 +- e2e/init.js | 2 +- .../1_importAndWatchWalletsFlow.spec.ts | 4 +- e2e/parallel/2_newWalletFlow.spec.ts | 4 +- e2e/parallel/3_homeScreen.spec.ts | 4 +- e2e/parallel/4_discoverSheetFlow.spec.ts | 4 +- ...watchedWalletCollectionActionsFlow.spec.ts | 4 +- .../6_maliciousDappConnection.spec.ts | 4 +- e2e/parallel/7_manualBackup.spec.ts | 4 +- e2e/serial/1_sendSheetFlowContacts.spec.ts | 10 +- e2e/serial/2_swaps.spec.ts | 10 +- globals.d.ts | 4 +- hardhat.config.js | 17 - package.json | 11 +- scripts/anvil.sh | 3 + scripts/hardhat.sh | 3 - scripts/run-parallel-e2e.sh | 21 +- scripts/run-serial-e2e.sh | 82 +- .../screens/Swap/providers/swap-provider.tsx | 8 +- .../Swap/resources/assets/userAssets.ts | 10 +- src/analytics/index.ts | 9 +- src/components/ContactRowInfoButton.js | 5 +- src/components/Discover/DiscoverHome.tsx | 2 +- src/components/FeesPanel.tsx | 15 +- src/components/GweiInputPill.tsx | 5 +- src/components/Spinner.tsx | 4 +- src/components/animations/ShimmerAnimation.js | 4 +- src/components/asset-list/AssetListHeader.js | 4 +- .../FastCurrencySelectionRow.tsx | 4 +- src/components/coin-row/CoinRowAddButton.js | 4 +- .../coin-row/CoinRowFavoriteButton.js | 4 +- .../RegistrationAvatar/RegistrationAvatar.tsx | 7 +- .../check-fns/hasNonZeroTotalBalance.ts | 4 +- src/components/skeleton/Skeleton.tsx | 4 +- src/components/toasts/OfflineToast.js | 6 +- src/components/toasts/TestnetToast.js | 10 +- src/config/defaultDebug.ts | 2 +- src/handlers/swap.ts | 4 +- src/handlers/web3.ts | 12 +- src/helpers/RainbowContext.tsx | 24 +- src/hooks/useENSRegistrationStepHandler.tsx | 22 +- src/hooks/useRefreshAccountData.ts | 10 +- src/hooks/useWatchPendingTxs.ts | 12 +- src/languages/ar_AR.json | 4 +- src/languages/en_US.json | 4 +- src/languages/es_419.json | 4 +- src/languages/fr_FR.json | 4 +- src/languages/hi_IN.json | 4 +- src/languages/id_ID.json | 4 +- src/languages/ja_JP.json | 4 +- src/languages/ko_KR.json | 4 +- src/languages/pt_BR.json | 4 +- src/languages/ru_RU.json | 4 +- src/languages/th_TH.json | 4 +- src/languages/tr_TR.json | 4 +- src/languages/zh_CN.json | 4 +- src/model/migrations.ts | 6 +- src/performance/tracking/index.ts | 5 +- src/raps/actions/ens.ts | 4 +- src/redux/gas.ts | 8 +- .../{hardhatAssets.ts => anvilAssets.ts} | 16 +- src/screens/ENSIntroSheet.tsx | 5 +- .../components/Backups/WalletsAndBackup.tsx | 2 +- .../SettingsSheet/components/DevSection.tsx | 28 +- src/screens/SettingsSheet/utils.ts | 8 +- src/state/backendNetworks/backendNetworks.ts | 14 +- src/state/backendNetworks/types.ts | 38 +- src/state/connectedToAnvil/index.ts | 27 + src/state/connectedToHardhat/index.ts | 27 - src/utils/branch.ts | 4 +- src/utils/reviewAlert.ts | 4 +- yarn.lock | 1060 +---------------- 80 files changed, 418 insertions(+), 1394 deletions(-) rename e2e/Disabled/{hardhatTransactionFlowSendAndWC.disable.js => anvilTransactionFlowSendAndWC.disable.js} (97%) rename e2e/Disabled/{hardhatTransactionFlowSwaps.disabled.js => anvilTransactionFlowSwaps.disabled.js} (98%) delete mode 100644 hardhat.config.js create mode 100644 scripts/anvil.sh delete mode 100644 scripts/hardhat.sh rename src/resources/assets/{hardhatAssets.ts => anvilAssets.ts} (85%) create mode 100644 src/state/connectedToAnvil/index.ts delete mode 100644 src/state/connectedToHardhat/index.ts diff --git a/.detoxrc.js b/.detoxrc.js index 0b5b837895f..dae464e8324 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -4,6 +4,8 @@ module.exports = { args: { config: 'e2e/jest.e2e.config.js', _: ['e2e'], + bail: true, + forceExit: true, }, }, devices: { diff --git a/.github/workflows/macstadium-tests.yml b/.github/workflows/macstadium-tests.yml index b4dfe0d643e..4748f7b8df8 100644 --- a/.github/workflows/macstadium-tests.yml +++ b/.github/workflows/macstadium-tests.yml @@ -154,7 +154,7 @@ jobs: run: | rm -rf /Users/administrator/.cocoapods/repos/cocoapods/.git/index.lock yarn install-bundle && yarn install-pods - + - uses: irgaly/xcode-cache@v1 with: key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }} @@ -164,11 +164,12 @@ jobs: run: | sed -i'' -e "s/IS_TESTING=false/IS_TESTING=true/" .env && rm -f .env-e yarn detox build --configuration ios.sim.release + - name: Detox iOS e2e tests serial + run: | + ./scripts/run-serial-e2e.sh 3 - name: Detox iOS e2e tests parallel run: | - ./scripts/run-parallel-e2e.sh 3 + ./scripts/run-parallel-e2e.sh - - name: Detox iOS e2e tests serial - run: | - ./scripts/run-serial-e2e.sh 3 + diff --git a/e2e/Disabled/hardhatTransactionFlowSendAndWC.disable.js b/e2e/Disabled/anvilTransactionFlowSendAndWC.disable.js similarity index 97% rename from e2e/Disabled/hardhatTransactionFlowSendAndWC.disable.js rename to e2e/Disabled/anvilTransactionFlowSendAndWC.disable.js index 078e7ef09d2..d31a2bd1c3d 100644 --- a/e2e/Disabled/hardhatTransactionFlowSendAndWC.disable.js +++ b/e2e/Disabled/anvilTransactionFlowSendAndWC.disable.js @@ -40,11 +40,11 @@ const getOnchainBalance = async (address, tokenContractAddress) => { }; beforeAll(async () => { - await Helpers.startHardhat(); + await Helpers.startAnvil(); await Helpers.startIosSimulator(); }); -describe.skip('Hardhat Transaction Flow', () => { +describe.skip('Anvil Transaction Flow', () => { it('Should show the welcome screen', async () => { await Helpers.checkIfVisible('welcome-screen'); }); @@ -85,9 +85,9 @@ describe.skip('Hardhat Transaction Flow', () => { await Helpers.sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { - await Helpers.waitAndTap('dev-button-hardhat'); - await Helpers.checkIfVisible('testnet-toast-Hardhat'); + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { + await Helpers.waitAndTap('dev-button-anvil'); + await Helpers.checkIfVisible('testnet-toast-Anvil'); }); it('Should open send sheet after tapping send fab', async () => { @@ -392,6 +392,6 @@ describe.skip('Hardhat Transaction Flow', () => { await connector?.killSession(); connector = null; await device.clearKeychain(); - await Helpers.killHardhat(); + await Helpers.killAnvil(); }); }); diff --git a/e2e/Disabled/hardhatTransactionFlowSwaps.disabled.js b/e2e/Disabled/anvilTransactionFlowSwaps.disabled.js similarity index 98% rename from e2e/Disabled/hardhatTransactionFlowSwaps.disabled.js rename to e2e/Disabled/anvilTransactionFlowSwaps.disabled.js index 1ff90c981af..7564b4a96ca 100644 --- a/e2e/Disabled/hardhatTransactionFlowSwaps.disabled.js +++ b/e2e/Disabled/anvilTransactionFlowSwaps.disabled.js @@ -6,7 +6,7 @@ const ios = device.getPlatform() === 'ios'; const android = device.getPlatform() === 'android'; beforeAll(async () => { - await Helpers.startHardhat(); + await Helpers.startAnvil(); await Helpers.startIosSimulator(); }); @@ -29,11 +29,11 @@ const checkIfSwapCompleted = async (assetName, amount) => { }; // FIXME: Mainnet DAI doesn't show up in the swap search results -// This might be related to @Jin's latest work on changes to hardhat as +// This might be related to @Jin's latest work on changes to anvil as // part of the addy's REST API migration // // marking the test as SKIP for now -describe.skip('Hardhat Transaction Flow', () => { +describe.skip('Anvil Transaction Flow', () => { it('Should show the welcome screen', async () => { await Helpers.checkIfVisible('welcome-screen'); }); @@ -74,9 +74,9 @@ describe.skip('Hardhat Transaction Flow', () => { await Helpers.sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { - await Helpers.waitAndTap('dev-button-hardhat'); - await Helpers.checkIfVisible('testnet-toast-Hardhat'); + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { + await Helpers.waitAndTap('dev-button-anvil'); + await Helpers.checkIfVisible('testnet-toast-Anvil'); }); it.skip('Should deposit DAI (via Compound)', async () => { @@ -414,6 +414,6 @@ describe.skip('Hardhat Transaction Flow', () => { await connector?.killSession(); connector = null; await device.clearKeychain(); - await Helpers.killHardhat(); + await Helpers.killAnvil(); }); }); diff --git a/e2e/Disabled/registerENSFlow.disabled.js b/e2e/Disabled/registerENSFlow.disabled.js index a177ab85c65..a6677f74b85 100644 --- a/e2e/Disabled/registerENSFlow.disabled.js +++ b/e2e/Disabled/registerENSFlow.disabled.js @@ -110,7 +110,7 @@ const validatePrimaryName = async name => { }; beforeAll(async () => { - await Helpers.startHardhat(); + await Helpers.startAnvil(); await Helpers.startIosSimulator(); }); @@ -155,9 +155,9 @@ describe.skip('Register ENS Flow', () => { await Helpers.sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { - await Helpers.waitAndTap('dev-button-hardhat'); - await Helpers.checkIfVisible('testnet-toast-Hardhat'); + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { + await Helpers.waitAndTap('dev-button-anvil'); + await Helpers.checkIfVisible('testnet-toast-Anvil'); }); it('Should navigate to the Discover sheet screen after swiping left', async () => { @@ -637,6 +637,6 @@ describe.skip('Register ENS Flow', () => { afterAll(async () => { // Reset the app state await device.clearKeychain(); - await Helpers.killHardhat(); + await Helpers.killAnvil(); }); }); diff --git a/e2e/Disabled/sendSheetFlow.disabled.ts b/e2e/Disabled/sendSheetFlow.disabled.ts index 93b50f7091a..8c18386033e 100644 --- a/e2e/Disabled/sendSheetFlow.disabled.ts +++ b/e2e/Disabled/sendSheetFlow.disabled.ts @@ -1,7 +1,7 @@ import { device } from 'detox'; import { - startHardhat, - killHardhat, + startAnvil, + killAnvil, importWalletFlow, sendETHtoTestWallet, waitAndTap, @@ -16,11 +16,11 @@ import { describe.skip('Send Sheet Interaction Flow', () => { beforeAll(async () => { await device.reloadReactNative(); - await startHardhat(); + await startAnvil(); }); afterAll(async () => { await device.clearKeychain(); - await killHardhat(); + await killAnvil(); }); it('Import a wallet and go to welcome', async () => { @@ -31,9 +31,9 @@ describe.skip('Send Sheet Interaction Flow', () => { await sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { - await waitAndTap('dev-button-hardhat'); - await checkIfVisible('testnet-toast-Hardhat'); + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { + await waitAndTap('dev-button-anvil'); + await checkIfVisible('testnet-toast-Anvil'); }); it('Should open send sheet after tapping send button', async () => { diff --git a/e2e/Disabled/swapSheetFlow1.disabled.js b/e2e/Disabled/swapSheetFlow1.disabled.js index a7ed282b8dc..f9e77663162 100644 --- a/e2e/Disabled/swapSheetFlow1.disabled.js +++ b/e2e/Disabled/swapSheetFlow1.disabled.js @@ -9,11 +9,11 @@ const android = device.getPlatform() === 'android'; describe.skip('Swap Sheet Interaction Flow', () => { beforeAll(async () => { - await Helpers.startHardhat(); + await Helpers.startAnvil(); }); afterAll(async () => { await device.clearKeychain(); - await Helpers.killHardhat(); + await Helpers.killAnvil(); }); it('Import a wallet and go to welcome', async () => { @@ -24,14 +24,14 @@ describe.skip('Swap Sheet Interaction Flow', () => { await Helpers.sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { await Helpers.delayTime('very-long'); - await Helpers.waitAndTap('dev-button-hardhat'); - await Helpers.checkIfVisible('testnet-toast-Hardhat'); + await Helpers.waitAndTap('dev-button-anvil'); + await Helpers.checkIfVisible('testnet-toast-Anvil'); }); // FIXME: Mainnet DAI doesn't show up in the swap search results - // This might be related to @Jin's latest work on changes to hardhat as + // This might be related to @Jin's latest work on changes to anvil as // part of the addy's REST API migration // // marking the test as SKIP for now diff --git a/e2e/Disabled/swapSheetFlow2.disabled.js b/e2e/Disabled/swapSheetFlow2.disabled.js index 7c91840a432..97b13a821d8 100644 --- a/e2e/Disabled/swapSheetFlow2.disabled.js +++ b/e2e/Disabled/swapSheetFlow2.disabled.js @@ -2,14 +2,14 @@ import * as Helpers from '../helpers'; import { device } from 'detox'; beforeAll(async () => { - await Helpers.startHardhat(); + await Helpers.startAnvil(); }); const ios = device.getPlatform() === 'ios'; const android = device.getPlatform() === 'android'; // FIXME: Mainnet DAI doesn't show up in the swap search results -// This might be related to @Jin's latest work on changes to hardhat as +// This might be related to @Jin's latest work on changes to anvil as // part of the addy's REST API migration // // marking the test as SKIP for now @@ -54,14 +54,14 @@ describe.skip('Swap Sheet Interaction Flow', () => { await Helpers.sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { // need to wait for balances to be fetched await Helpers.delay(10000); - await Helpers.waitAndTap('dev-button-hardhat'); - await Helpers.checkIfVisible('testnet-toast-Hardhat'); + await Helpers.waitAndTap('dev-button-anvil'); + await Helpers.checkIfVisible('testnet-toast-Anvil'); }); - it('Should connect to hardhat', async () => { + it('Should connect to anvil', async () => { await Helpers.swipe('wallet-screen', 'right', 'slow'); await Helpers.checkIfVisible('profile-screen'); await Helpers.waitAndTap('settings-button'); @@ -69,8 +69,8 @@ describe.skip('Swap Sheet Interaction Flow', () => { await Helpers.scrollTo('settings-menu-container', 'bottom'); await Helpers.waitAndTap('developer-section'); await Helpers.swipeUntilVisible('alert-section', 'developer-settings-sheet', 'up'); - await Helpers.waitAndTap('hardhat-section'); - await Helpers.checkIfVisible('testnet-toast-Hardhat'); + await Helpers.waitAndTap('anvil-section'); + await Helpers.checkIfVisible('testnet-toast-Anvil'); await Helpers.swipe('profile-screen', 'left', 'slow'); }); @@ -474,6 +474,6 @@ describe.skip('Swap Sheet Interaction Flow', () => { afterAll(async () => { // Reset the app state await device.clearKeychain(); - await Helpers.killHardhat(); + await Helpers.killAnvil(); }); }); diff --git a/e2e/helpers.ts b/e2e/helpers.ts index 441a9d0144d..2b0a39e880a 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -4,7 +4,7 @@ import { exec } from 'child_process'; import { JsonRpcProvider } from '@ethersproject/providers'; import { Wallet } from '@ethersproject/wallet'; import { expect, device, element, by, waitFor } from 'detox'; -import { parseEther } from '@ethersproject/units'; +import { formatEther, parseEther } from '@ethersproject/units'; import { IosElementAttributes, AndroidElementAttributes } from 'detox/detox'; const TESTING_WALLET = '0x3637f053D542E6D00Eee42D656dD7C59Fa33a62F'; @@ -20,12 +20,12 @@ interface ProviderFunction { _instance?: JsonRpcProvider; } -export async function startHardhat() { +export async function startAnvil() { await delayTime('short'); - exec('yarn hardhat'); + exec('yarn anvil'); } -export async function killHardhat() { +export async function killAnvil() { await delayTime('short'); exec('kill $(lsof -t -i:8545)'); } @@ -53,14 +53,14 @@ export async function importWalletFlow(customSeed?: string) { await checkIfVisible('wallet-screen'); } -export async function beforeAllcleanApp({ hardhat }: { hardhat?: boolean }) { +export async function beforeAllcleanApp({ anvil }: { anvil?: boolean }) { jest.resetAllMocks(); - hardhat && (await startHardhat()); + anvil && (await startAnvil()); } -export async function afterAllcleanApp({ hardhat }: { hardhat?: boolean }) { +export async function afterAllcleanApp({ anvil }: { anvil?: boolean }) { await device.clearKeychain(); - hardhat && (await killHardhat()); + anvil && (await killAnvil()); } export async function tap(elementId: string | RegExp) { @@ -467,16 +467,23 @@ export const getProvider: ProviderFunction = () => { }; export async function sendETHtoTestWallet() { + console.log('getting provider'); const provider = getProvider(); - // Hardhat account 0 that has 10000 ETH + console.log('got provider', provider); + // anvil account 0 that has 10000 ETH const wallet = new Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', provider); + console.log('got wallet', wallet); // Sending 20 ETH so we have enough to pay the tx fees even when the gas is too high + console.log('sending eth'); await wallet.sendTransaction({ to: TESTING_WALLET, value: parseEther('20'), }); + console.log('sent eth'); await delayTime('long'); + console.log('checking balance'); const balance = await provider.getBalance(TESTING_WALLET); + console.log('got balance', formatEther(balance)); if (balance.lt(parseEther('20'))) { throw Error('Error sending ETH to test wallet'); } diff --git a/e2e/init.js b/e2e/init.js index a8567e849b3..86d68eb47ad 100644 --- a/e2e/init.js +++ b/e2e/init.js @@ -8,7 +8,7 @@ beforeAll(async () => { if (device.getPlatform() === 'android') { // connecting to metro await device.reverseTcpPort(8081); - // connecting to hardhat + // connecting to anvil await device.reverseTcpPort(8545); // TODO: WIP for android connecting in dev // make sure we don't have gesture navigation what might cause collisions diff --git a/e2e/parallel/1_importAndWatchWalletsFlow.spec.ts b/e2e/parallel/1_importAndWatchWalletsFlow.spec.ts index 0e9b30cdaab..2259062c196 100644 --- a/e2e/parallel/1_importAndWatchWalletsFlow.spec.ts +++ b/e2e/parallel/1_importAndWatchWalletsFlow.spec.ts @@ -16,10 +16,10 @@ const android = device.getPlatform() === 'android'; describe('Import from private key flow', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: false }); + await beforeAllcleanApp({ anvil: false }); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: false }); + await afterAllcleanApp({ anvil: false }); }); it('with 0x - Should show the welcome screen', async () => { await checkIfVisible('welcome-screen'); diff --git a/e2e/parallel/2_newWalletFlow.spec.ts b/e2e/parallel/2_newWalletFlow.spec.ts index 241dcb4e5d1..5db07d964f6 100644 --- a/e2e/parallel/2_newWalletFlow.spec.ts +++ b/e2e/parallel/2_newWalletFlow.spec.ts @@ -5,10 +5,10 @@ const android = device.getPlatform() === 'android'; describe('New Wallet flow', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: false }); + await beforeAllcleanApp({ anvil: false }); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: false }); + await afterAllcleanApp({ anvil: false }); }); it('should show the welcome screen', async () => { diff --git a/e2e/parallel/3_homeScreen.spec.ts b/e2e/parallel/3_homeScreen.spec.ts index 1e32821ace8..8f78e63cfb5 100644 --- a/e2e/parallel/3_homeScreen.spec.ts +++ b/e2e/parallel/3_homeScreen.spec.ts @@ -14,10 +14,10 @@ const RAINBOW_TEST_WALLET = 'rainbowtestwallet.eth'; describe('Home Screen', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: false }); + await beforeAllcleanApp({ anvil: false }); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: false }); + await afterAllcleanApp({ anvil: false }); }); it('imports wallet', async () => { diff --git a/e2e/parallel/4_discoverSheetFlow.spec.ts b/e2e/parallel/4_discoverSheetFlow.spec.ts index 0e2f9d632a3..5af4b8abd7c 100644 --- a/e2e/parallel/4_discoverSheetFlow.spec.ts +++ b/e2e/parallel/4_discoverSheetFlow.spec.ts @@ -17,10 +17,10 @@ const ios = device.getPlatform() === 'ios'; describe('Discover Screen Flow', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: false }); + await beforeAllcleanApp({ anvil: false }); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: false }); + await afterAllcleanApp({ anvil: false }); }); it('Should import wallet and go to wallet screen', async () => { await importWalletFlow(); diff --git a/e2e/parallel/5_watchedWalletCollectionActionsFlow.spec.ts b/e2e/parallel/5_watchedWalletCollectionActionsFlow.spec.ts index 03fa4a5ab3e..b2c56b8656f 100644 --- a/e2e/parallel/5_watchedWalletCollectionActionsFlow.spec.ts +++ b/e2e/parallel/5_watchedWalletCollectionActionsFlow.spec.ts @@ -13,10 +13,10 @@ import { describe('Watched showcase and hidden actions flow', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: false }); + await beforeAllcleanApp({ anvil: false }); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: false }); + await afterAllcleanApp({ anvil: false }); }); it('watches a wallet and loads wallet screen', async () => { diff --git a/e2e/parallel/6_maliciousDappConnection.spec.ts b/e2e/parallel/6_maliciousDappConnection.spec.ts index ad13c226403..2a3e1b890b9 100644 --- a/e2e/parallel/6_maliciousDappConnection.spec.ts +++ b/e2e/parallel/6_maliciousDappConnection.spec.ts @@ -15,11 +15,11 @@ import { WALLET_VARS } from '../testVariables'; describe('Check malicious dapp warning', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: false }); + await beforeAllcleanApp({ anvil: false }); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: false }); + await afterAllcleanApp({ anvil: false }); }); it('Should be able to watch a wallet and load the wallet screen', async () => { diff --git a/e2e/parallel/7_manualBackup.spec.ts b/e2e/parallel/7_manualBackup.spec.ts index 680e042fc4d..9fd08830bca 100644 --- a/e2e/parallel/7_manualBackup.spec.ts +++ b/e2e/parallel/7_manualBackup.spec.ts @@ -14,10 +14,10 @@ import { describe('Backups', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: false }); + await beforeAllcleanApp({ anvil: false }); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: false }); + await afterAllcleanApp({ anvil: false }); }); it('Imports wallet', async () => { diff --git a/e2e/serial/1_sendSheetFlowContacts.spec.ts b/e2e/serial/1_sendSheetFlowContacts.spec.ts index ece0ee36771..005173d66a3 100644 --- a/e2e/serial/1_sendSheetFlowContacts.spec.ts +++ b/e2e/serial/1_sendSheetFlowContacts.spec.ts @@ -18,10 +18,10 @@ const android = device.getPlatform() === 'android'; describe('Send Sheet Interaction Flow Contacts', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: true }); + await beforeAllcleanApp({}); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: true }); + await afterAllcleanApp({}); }); it('Import a wallet and go to welcome', async () => { @@ -32,9 +32,9 @@ describe('Send Sheet Interaction Flow Contacts', () => { await sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { - await waitAndTap('dev-button-hardhat'); - await checkIfVisible('testnet-toast-Hardhat'); + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { + await waitAndTap('dev-button-anvil'); + await checkIfVisible('testnet-toast-Anvil'); }); it('Should open send sheet after tapping send fab', async () => { diff --git a/e2e/serial/2_swaps.spec.ts b/e2e/serial/2_swaps.spec.ts index 9a4e3ed972c..f18f2c87fab 100644 --- a/e2e/serial/2_swaps.spec.ts +++ b/e2e/serial/2_swaps.spec.ts @@ -30,10 +30,10 @@ import { WALLET_VARS } from '../testVariables'; describe('Swap Sheet Interaction Flow', () => { beforeAll(async () => { - await beforeAllcleanApp({ hardhat: true }); + await beforeAllcleanApp({}); }); afterAll(async () => { - await afterAllcleanApp({ hardhat: true }); + await afterAllcleanApp({}); }); it('Import a wallet and go to welcome', async () => { @@ -45,9 +45,9 @@ describe('Swap Sheet Interaction Flow', () => { await sendETHtoTestWallet(); }); - it('Should show Hardhat Toast after pressing Connect To Hardhat', async () => { - await tap('dev-button-hardhat'); - await checkIfVisible('testnet-toast-Hardhat'); + it('Should show Anvil Toast after pressing Connect To Anvil', async () => { + await tap('dev-button-anvil'); + await checkIfVisible('testnet-toast-Anvil'); // doesn't work atm // validate it has the expected funds of 20 eth diff --git a/globals.d.ts b/globals.d.ts index bd6bee49caa..3c401e51846 100644 --- a/globals.d.ts +++ b/globals.d.ts @@ -49,8 +49,8 @@ declare module 'react-native-dotenv' { export const NFT_API_KEY: string; export const NFT_API_URL: string; export const ETHERSCAN_API_KEY: string; - export const HARDHAT_URL_ANDROID: string; - export const HARDHAT_URL_IOS: string; + export const ANVIL_URL_ANDROID: string; + export const ANVIL_URL_IOS: string; export const RAINBOW_MASTER_KEY: string; export const SECURE_WALLET_HASH_KEY: string; export const TEST_SEEDS: string; diff --git a/hardhat.config.js b/hardhat.config.js deleted file mode 100644 index b7aecb87c58..00000000000 --- a/hardhat.config.js +++ /dev/null @@ -1,17 +0,0 @@ -require('@nomiclabs/hardhat-waffle'); - -// You need to export an object to set up your config -// Go to https://hardhat.org/config/ to learn more - -/** - * @type import('hardhat/config').HardhatUserConfig - */ -module.exports = { - networks: { - hardhat: { - chainId: 1, - initialBaseFeePerGas: 100000000, // 0.1 gwei - }, - }, - solidity: '0.8.4', -}; diff --git a/package.json b/package.json index c7bd68d69cf..016bfd20be7 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "ds": "cd src/design-system/docs && yarn dev", "fast": "yarn install && yarn setup && yarn install-pods-fast", "gradle": "cd android && ./gradlew", - "hardhat": "sh ./scripts/hardhat.sh", + "anvil": "sh ./scripts/anvil.sh", "install-all": "yarn install && yarn setup && yarn install-pods", "install-all-no-flipper": "yarn install && yarn setup && yarn install-pods-no-flipper", "install-bundle": "cd ios && bundle install && cd ..", @@ -329,8 +329,6 @@ "@babel/preset-env": "7.22.0", "@babel/runtime": "7.22.0", "@lavamoat/allow-scripts": "3.0.1", - "@nomiclabs/hardhat-ethers": "2.2.3", - "@nomiclabs/hardhat-waffle": "2.0.6", "@react-native/babel-preset": "0.74.83", "@react-native/typescript-config": "0.74.83", "@rnx-kit/align-deps": "2.2.4", @@ -365,7 +363,6 @@ "eslint": "8.22.0", "eslint-config-rainbow": "4.3.0", "graphql": "15.3.0", - "hardhat": "2.18.1", "husky": "8.0.1", "image-size": "1.0.0", "jest": "29.7.0", @@ -479,16 +476,14 @@ "detox>bunyan>dtrace-provider": false, "detox>ws>bufferutil": false, "detox>ws>utf-8-validate": false, - "hardhat>@ethereumjs/vm>core-js-pure": false, "ethereumjs-util>ethereum-cryptography>secp256k1": false, - "hardhat>@nomicfoundation/ethereumjs-blockchain>level>classic-level": false, - "hardhat>keccak": false, "react-native-storage": false, "react-native-storage>opencollective>babel-polyfill>core-js": false, "viem>ws>bufferutil": false, "viem>ws>utf-8-validate": false, "@types/detox>detox": false, - "react-native-bootsplash>sharp": false + "react-native-bootsplash>sharp": false, + "ethereumjs-util>ethereum-cryptography>keccak": false } }, "lint-staged": { diff --git a/scripts/anvil.sh b/scripts/anvil.sh new file mode 100644 index 00000000000..9ec2c5e7956 --- /dev/null +++ b/scripts/anvil.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source .env +anvil --fork-url $ETHEREUM_MAINNET_RPC_DEV diff --git a/scripts/hardhat.sh b/scripts/hardhat.sh deleted file mode 100644 index 1ef0a0e1ce3..00000000000 --- a/scripts/hardhat.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -source .env -npx hardhat node --fork $ETHEREUM_MAINNET_RPC_DEV \ No newline at end of file diff --git a/scripts/run-parallel-e2e.sh b/scripts/run-parallel-e2e.sh index 71961395466..3932bdcf69a 100755 --- a/scripts/run-parallel-e2e.sh +++ b/scripts/run-parallel-e2e.sh @@ -1,17 +1,14 @@ #!/bin/bash -max_retries="$1" -count=0 -until (( count >= max_retries )) -do - ./node_modules/.bin/detox test parallel/ -c ios.sim.release --maxWorkers 2 -- --forceExit --bail 1 - ret_val=$? - if [ $ret_val -eq 0 ]; then - exit 0 - fi - ((count++)) - echo "Test failed, attempt $count/$max_retries..." -done +# 0) Read build type from first argument; default to "release" if not specified +BUILD_TYPE=${1:-release} # can be "debug" or "release" +# 0.1) Decide Detox config based on BUILD_TYPE +if [ "$BUILD_TYPE" = "debug" ]; then + DETOX_CONFIG="ios.sim.debug" +else + DETOX_CONFIG="ios.sim.release" +fi +./node_modules/.bin/detox test ./e2e/parallel/ -c "$DETOX_CONFIG" --maxWorkers 2 --R 3 diff --git a/scripts/run-serial-e2e.sh b/scripts/run-serial-e2e.sh index dc1a1f6640e..922729eaeaf 100755 --- a/scripts/run-serial-e2e.sh +++ b/scripts/run-serial-e2e.sh @@ -1,18 +1,72 @@ #!/bin/bash +MAX_RETRIES=${1:-3} # number of times that a test should be retried in case of failure. default to 3 if not specified +BUILD_TYPE=${2:-release} # can be "debug" or "release". default to "release" if not specified -max_retries="$1" -count=0 - -until (( count >= max_retries )) -do - ./node_modules/.bin/detox test serial/ -c ios.sim.release --maxWorkers 1 -- --forceExit --bail 1 - ret_val=$? - if [ $ret_val -eq 0 ]; then - exit 0 - fi - ((count++)) - echo "Test failed, attempt $count/$max_retries..." + +# 0.1) Decide Detox config based on BUILD_TYPE +if [ "$BUILD_TYPE" = "debug" ]; then + DETOX_CONFIG="ios.sim.debug" +else + DETOX_CONFIG="ios.sim.release" +fi + +SUCCESS=false + +# Loop through each file in the ./e2e/serial/ directory +for test_file in ./e2e/serial/*.ts; do + COUNT=0 + until (( $COUNT >= MAX_RETRIES )) + do + echo "=====================================" + echo "Running test file: $test_file (attempt ${COUNT+1}/$MAX_RETRIES)" + echo "=====================================" + + echo "Starting anvil..." + # 1) Start Anvil in the background (show logs in terminal + save to file) + yarn anvil 2>&1 | grep -v "eth_" | tee anvil.log & + ANVIL_PID=$! + echo "Anvil started (PID: $ANVIL_PID)" + + # 2) Wait for Anvil to initialize + sleep 5 + + # 3) Run Detox for this single file with retries + ./node_modules/.bin/detox test "$test_file" -c "$DETOX_CONFIG" --maxWorkers 1 + ret_val=$? + + # 4) Kill the Anvil process + echo "Killing Anvil (PID: $ANVIL_PID)" + kill "$ANVIL_PID" 2>/dev/null || true + # kill any other processes using port 8545 + kill $(lsof -t -i:8545) 2>/dev/null || true + + # 5) Remove the Anvil log file + rm -rf anvil.log + + + # 6) Decide what to do if Detox failed or succeeded + if [ $ret_val -eq 0 ]; then + echo "✅ Tests passed for $test_file" + SUCCESS=true + break + fi + ((COUNT++)) + echo "❌ Test failed, attempt $COUNT/$MAX_RETRIES..." + + if(($COUNT >= MAX_RETRIES)) + then + SUCCESS=false + fi + done + + if [ "$SUCCESS" = "false" ]; then + echo "❌ Tests failed after $MAX_RETRIES attempts. Bailing out!" + exit 1 + fi done -echo "Tests failed after $max_retries attempts." -exit 1 \ No newline at end of file +echo "✅ All tests passed for every file!" +exit 0 + + + diff --git a/src/__swaps__/screens/Swap/providers/swap-provider.tsx b/src/__swaps__/screens/Swap/providers/swap-provider.tsx index 3aca6f27d6c..c7ef1482127 100644 --- a/src/__swaps__/screens/Swap/providers/swap-provider.tsx +++ b/src/__swaps__/screens/Swap/providers/swap-provider.tsx @@ -56,7 +56,7 @@ import { useSwapOutputQuotesDisabled } from '../hooks/useSwapOutputQuotesDisable import { SyncGasStateToSharedValues, SyncQuoteSharedValuesToState } from './SyncSwapStateAndSharedValues'; import { performanceTracking, Screens, TimeToSignOperation } from '@/state/performance/performance'; import { getRemoteConfig } from '@/model/remoteConfig'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { useBackendNetworksStore, getChainsNativeAssetWorklet } from '@/state/backendNetworks/backendNetworks'; import { getSwapsNavigationParams } from '../navigateToSwaps'; import { LedgerSigner } from '@/handlers/LedgerSigner'; @@ -226,7 +226,7 @@ export const SwapProvider = ({ children }: SwapProviderProps) => { NotificationManager?.postNotification('rapInProgress'); const provider = getProvider({ chainId: parameters.chainId }); - const connectedToHardhat = useConnectedToHardhatStore.getState().connectedToHardhat; + const connectedToAnvil = useConnectedToAnvilStore.getState().connectedToAnvil; const isBridge = swapsStore.getState().inputAsset?.mainnetAddress === swapsStore.getState().outputAsset?.mainnetAddress; const isDegenModeEnabled = swapsStore.getState().degenMode; @@ -286,7 +286,7 @@ export const SwapProvider = ({ children }: SwapProviderProps) => { }; } - const chainId = connectedToHardhat ? ChainId.hardhat : parameters.chainId; + const chainId = connectedToAnvil ? ChainId.anvil : parameters.chainId; const nonce = await getNextNonce({ address: parameters.quote.from, chainId }); const { errorMessage } = await performanceTracking.getState().executeFn({ @@ -345,7 +345,7 @@ export const SwapProvider = ({ children }: SwapProviderProps) => { userAssetsQueryKey({ address: parameters.quote.from, currency: nativeCurrency, - testnetMode: connectedToHardhat, + testnetMode: connectedToAnvil, }) ); diff --git a/src/__swaps__/screens/Swap/resources/assets/userAssets.ts b/src/__swaps__/screens/Swap/resources/assets/userAssets.ts index 6c2e0611f70..429b6c4f745 100644 --- a/src/__swaps__/screens/Swap/resources/assets/userAssets.ts +++ b/src/__swaps__/screens/Swap/resources/assets/userAssets.ts @@ -14,9 +14,9 @@ import { parseUserAsset } from '@/__swaps__/utils/assets'; import { greaterThan } from '@/helpers/utilities'; import { fetchUserAssetsByChain } from './userAssetsByChain'; -import { fetchHardhatBalancesByChainId } from '@/resources/assets/hardhatAssets'; +import { fetchAnvilBalancesByChainId } from '@/resources/assets/anvilAssets'; import { useBackendNetworksStore } from '@/state/backendNetworks/backendNetworks'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { staleBalancesStore } from '@/state/staleBalances'; import { IS_TEST } from '@/env'; import store from '@/redux/store'; @@ -106,7 +106,7 @@ async function userAssetsQueryFunction({ return {}; } if (testnetMode) { - const { assets, chainIdsInResponse } = await fetchHardhatBalancesByChainId(address); + const { assets, chainIdsInResponse } = await fetchAnvilBalancesByChainId(address); const parsedAssets: Array<{ asset: ZerionAsset; quantity: string; @@ -258,8 +258,8 @@ export function useUserAssets( { address, currency }: UserAssetsArgs, config: QueryConfigWithSelect = {} ) { - const { connectedToHardhat } = useConnectedToHardhatStore(); - return useQuery(userAssetsQueryKey({ address, currency, testnetMode: connectedToHardhat }), userAssetsQueryFunction, { + const { connectedToAnvil } = useConnectedToAnvilStore(); + return useQuery(userAssetsQueryKey({ address, currency, testnetMode: connectedToAnvil }), userAssetsQueryFunction, { ...config, enabled: !!address && !!currency, refetchInterval: USER_ASSETS_REFETCH_INTERVAL, diff --git a/src/analytics/index.ts b/src/analytics/index.ts index 222cf513b34..89aaa0a696a 100644 --- a/src/analytics/index.ts +++ b/src/analytics/index.ts @@ -1,13 +1,12 @@ import rudderClient from '@rudderstack/rudder-sdk-react-native'; -import { REACT_NATIVE_RUDDERSTACK_WRITE_KEY, RUDDERSTACK_DATA_PLANE_URL, IS_TESTING } from 'react-native-dotenv'; +import { REACT_NATIVE_RUDDERSTACK_WRITE_KEY, RUDDERSTACK_DATA_PLANE_URL } from 'react-native-dotenv'; import { EventProperties, event } from '@/analytics/event'; import { UserProperties } from '@/analytics/userProperties'; import { logger, RainbowError } from '@/logger'; import { device } from '@/storage'; import { WalletContext } from './utils'; - -const isTesting = IS_TESTING === 'true'; +import { IS_TEST } from '@/env'; export class Analytics { client: typeof rudderClient; @@ -19,8 +18,8 @@ export class Analytics { constructor() { this.client = rudderClient; - this.disabled = isTesting || !!device.get(['doNotTrack']); - if (isTesting) { + this.disabled = IS_TEST || !!device.get(['doNotTrack']); + if (IS_TEST) { logger.debug('[Analytics]: disabled for testing'); } else { logger.debug('[Analytics]: client initialized'); diff --git a/src/components/ContactRowInfoButton.js b/src/components/ContactRowInfoButton.js index 28ce8a1f159..fd93f487012 100644 --- a/src/components/ContactRowInfoButton.js +++ b/src/components/ContactRowInfoButton.js @@ -2,7 +2,6 @@ import lang from 'i18n-js'; import { startCase } from 'lodash'; import React from 'react'; import { View } from 'react-native'; -import { IS_TESTING } from 'react-native-dotenv'; import { ContextMenuButton } from 'react-native-ios-context-menu'; import RadialGradient from 'react-native-radial-gradient'; import { ButtonPressAnimation } from './animations'; @@ -12,7 +11,7 @@ import { Text } from './text'; import { useClipboard } from '@/hooks'; import styled from '@/styled-thing'; import { fonts, fontWithWidth, padding } from '@/styles'; - +import { IS_TEST } from '@/env'; import { abbreviations, ethereumUtils, haptics, showActionSheetWithOptions } from '@/utils'; const InfoButton = styled(Centered)({ @@ -27,7 +26,7 @@ const InfoButton = styled(Centered)({ ...padding.object(0, 0), }); -const Circle = styled(IS_TESTING === 'true' ? View : RadialGradient).attrs(({ theme: { colors } }) => ({ +const Circle = styled(IS_TEST ? View : RadialGradient).attrs(({ theme: { colors } }) => ({ center: [0, 15], colors: colors.gradients.lightestGrey, }))({ diff --git a/src/components/Discover/DiscoverHome.tsx b/src/components/Discover/DiscoverHome.tsx index 8da0ba974af..cb9fd14fed0 100644 --- a/src/components/Discover/DiscoverHome.tsx +++ b/src/components/Discover/DiscoverHome.tsx @@ -86,7 +86,7 @@ export default function DiscoverHome() { )} - {/* FIXME: IS_TESTING disables nftOffers this makes some DETOX tests hang forever at exit - investigate */} + {/* FIXME: IS_TEST disables nftOffers this makes some DETOX tests hang forever at exit - investigate */} {!IS_TEST && nftOffersEnabled && } {/* We have both flags here to be able to override the remote flag and show the card anyway in Dev*/} {featuredResultsEnabled && ( diff --git a/src/components/FeesPanel.tsx b/src/components/FeesPanel.tsx index fd458b62ffb..b9d387759e7 100644 --- a/src/components/FeesPanel.tsx +++ b/src/components/FeesPanel.tsx @@ -3,7 +3,6 @@ import { useIsFocused, useNavigation, useRoute } from '@react-navigation/native' import { upperFirst } from 'lodash'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { InteractionManager, Keyboard, KeyboardAvoidingView } from 'react-native'; -import { IS_TESTING } from 'react-native-dotenv'; import { Alert } from '@/components/alerts'; import { useTheme } from '@/theme/ThemeContext'; import { ButtonPressAnimation } from '@/components/animations'; @@ -15,7 +14,7 @@ import { gweiToWei, parseGasFeeParam } from '@/parsers'; import Routes from '@/navigation/routesNames'; import { gasUtils } from '@/utils'; import { Box, Inline, Inset, Row, Rows, Text } from '@/design-system'; -import { IS_ANDROID } from '@/env'; +import { IS_ANDROID, IS_TEST } from '@/env'; import { isL2Chain } from '@/handlers/web3'; const MAX_TEXT_WIDTH = 210; @@ -370,7 +369,7 @@ export default function FeesPanel({ currentGasTrend, colorForAsset, setCanGoBack stopBaseFeeTimeout(); startBaseFeeTimeout(async () => { // there's an e2e modifying this panel so I needed values that aren't dependent on the network conditions - const maxBaseFeeToValidate = IS_TESTING === 'true' ? 100 : currentBaseFee; + const maxBaseFeeToValidate = IS_TEST ? 100 : currentBaseFee; if (!maxBaseFee || isZero(maxBaseFee) || greaterThan(multiply(0.1, maxBaseFeeToValidate), maxBaseFee)) { setMaxBaseFeeError({ @@ -404,10 +403,7 @@ export default function FeesPanel({ currentGasTrend, colorForAsset, setCanGoBack } // there's an e2e modifying this panel so I needed values that aren't dependant on the network conditions if ( - greaterThan( - multiply(MINER_TIP_RANGE[0], IS_TESTING === 'true' ? 1 : gasFeeParamsBySpeed?.[NORMAL]?.maxPriorityFeePerGas?.gwei), - maxPriorityFee - ) + greaterThan(multiply(MINER_TIP_RANGE[0], IS_TEST ? 1 : gasFeeParamsBySpeed?.[NORMAL]?.maxPriorityFeePerGas?.gwei), maxPriorityFee) ) { setMaxPriorityFeeWarning({ message: lang.t('gas.lower_than_suggested'), @@ -415,10 +411,7 @@ export default function FeesPanel({ currentGasTrend, colorForAsset, setCanGoBack }); } else if ( // there's an e2e modifying this panel so I needed values that aren't dependant on the network conditions - greaterThan( - maxPriorityFee, - multiply(MINER_TIP_RANGE[1], IS_TESTING === 'true' ? 1 : gasFeeParamsBySpeed?.[URGENT]?.maxPriorityFeePerGas?.gwei) - ) + greaterThan(maxPriorityFee, multiply(MINER_TIP_RANGE[1], IS_TEST ? 1 : gasFeeParamsBySpeed?.[URGENT]?.maxPriorityFeePerGas?.gwei)) ) { setMaxPriorityFeeWarning({ message: lang.t('gas.higher_than_suggested'), diff --git a/src/components/GweiInputPill.tsx b/src/components/GweiInputPill.tsx index a1f9657de32..2c61642f224 100644 --- a/src/components/GweiInputPill.tsx +++ b/src/components/GweiInputPill.tsx @@ -1,5 +1,4 @@ import React, { useCallback } from 'react'; -import { IS_TESTING } from 'react-native-dotenv'; import LinearGradient from 'react-native-linear-gradient'; // @ts-expect-error - no declaration file import TextInputMask from 'react-native-text-input-mask'; @@ -9,7 +8,7 @@ import { buildTextStyles, margin, padding } from '@/styles'; import { useTheme } from '@/theme'; import { TextInput } from 'react-native'; import { Box, Inline, Inset, Text } from '@/design-system'; -import { IS_ANDROID } from '@/env'; +import { IS_ANDROID, IS_TEST } from '@/env'; const ANDROID_EXTRA_LINE_HEIGHT = 6; @@ -98,7 +97,7 @@ function GweiInputPill( testID={testID} value={value} /> - {IS_TESTING !== 'true' && ( + {!IS_TEST && ( Gwei diff --git a/src/components/Spinner.tsx b/src/components/Spinner.tsx index d33af18643b..9e32d25576e 100644 --- a/src/components/Spinner.tsx +++ b/src/components/Spinner.tsx @@ -1,12 +1,12 @@ import React from 'react'; import { StyleProp, ViewStyle } from 'react-native'; -import { IS_TESTING } from 'react-native-dotenv'; import SpinnerImageSource from '../assets/spinner.png'; import { useTheme } from '../theme/ThemeContext'; import { SpinAnimation } from './animations'; import { Centered } from './layout'; import { ImgixImage } from '@/components/images'; import { position } from '@/styles'; +import { IS_TEST } from '@/env'; type SpinnerProps = { color?: string; @@ -32,7 +32,7 @@ const Spinner = ({ color = '', duration = 1500, size = 20, ...props }: SpinnerPr return ( - {IS_TESTING !== 'true' && ( + {!IS_TEST && ( diff --git a/src/components/animations/ShimmerAnimation.js b/src/components/animations/ShimmerAnimation.js index 7d17fdbf480..c988721f6c8 100644 --- a/src/components/animations/ShimmerAnimation.js +++ b/src/components/animations/ShimmerAnimation.js @@ -3,7 +3,7 @@ import LinearGradient from 'react-native-linear-gradient'; import Animated, { Easing, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated'; import styled from '@/styled-thing'; import { position } from '@/styles'; -import { IS_TESTING } from 'react-native-dotenv'; +import { IS_TEST } from '@/env'; const timingConfig = { duration: 2500, @@ -59,7 +59,7 @@ export default function ShimmerAnimation({ transform: [{ translateX: positionX.value }], })); - if (IS_TESTING === 'true') { + if (IS_TEST) { return null; } diff --git a/src/components/asset-list/AssetListHeader.js b/src/components/asset-list/AssetListHeader.js index 7e1013861be..6d6203ba608 100644 --- a/src/components/asset-list/AssetListHeader.js +++ b/src/components/asset-list/AssetListHeader.js @@ -1,5 +1,4 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { IS_TESTING } from 'react-native-dotenv'; import LinearGradient from 'react-native-linear-gradient'; import { abbreviations, magicMemo, measureText } from '../../utils'; import { ButtonPressAnimation } from '../animations'; @@ -17,6 +16,7 @@ import { fonts, position } from '@/styles'; import { useTheme } from '@/theme'; import * as lang from '@/languages'; import { useUserAssetsStore } from '@/state/assets/userAssets'; +import { IS_TEST } from '@/env'; export const AssetListHeaderHeight = ListHeaderHeight; @@ -82,7 +82,7 @@ const WalletSelectButton = ({ accountName, onChangeWallet, deviceWidth, textWidt {truncatedAccountName ? ( - {IS_TESTING !== 'true' && ( + {!IS_TEST && ( ({ +const Circle = styled(IS_TEST ? View : RadialGradient).attrs(({ theme: { colors } }) => ({ center: [0, 15], colors: colors.gradients.lightestGrey, }))({ diff --git a/src/components/coin-row/CoinRowFavoriteButton.js b/src/components/coin-row/CoinRowFavoriteButton.js index 303b2efd735..007434274c5 100644 --- a/src/components/coin-row/CoinRowFavoriteButton.js +++ b/src/components/coin-row/CoinRowFavoriteButton.js @@ -1,6 +1,5 @@ import React from 'react'; import { View } from 'react-native'; -import { IS_TESTING } from 'react-native-dotenv'; import { BaseButton } from 'react-native-gesture-handler'; import RadialGradient from 'react-native-radial-gradient'; import { useTheme } from '../../theme/ThemeContext'; @@ -10,6 +9,7 @@ import { CoinRowHeight } from './CoinRow'; import styled from '@/styled-thing'; import { padding } from '@/styles'; import { magicMemo } from '@/utils'; +import { IS_TEST } from '@/env'; const FavoriteButtonPadding = 19; @@ -24,7 +24,7 @@ const FavoriteButton = styled(Centered)({ width: 68, }); -const Circle = styled(IS_TESTING === 'true' ? View : RadialGradient).attrs(({ isFavorited, theme: { colors, isDarkMode } }) => ({ +const Circle = styled(IS_TEST ? View : RadialGradient).attrs(({ isFavorited, theme: { colors, isDarkMode } }) => ({ center: [0, 15], colors: isFavorited ? [colors.alpha('#FFB200', isDarkMode ? 0.15 : 0), colors.alpha('#FFB200', isDarkMode ? 0.05 : 0.2)] diff --git a/src/components/ens-registration/RegistrationAvatar/RegistrationAvatar.tsx b/src/components/ens-registration/RegistrationAvatar/RegistrationAvatar.tsx index 603f8258d6c..80a2afcfb47 100644 --- a/src/components/ens-registration/RegistrationAvatar/RegistrationAvatar.tsx +++ b/src/components/ens-registration/RegistrationAvatar/RegistrationAvatar.tsx @@ -1,6 +1,5 @@ import ConditionalWrap from 'conditional-wrap'; import React, { useCallback, useEffect, useState } from 'react'; -import { IS_TESTING } from 'react-native-dotenv'; import { Image } from 'react-native-image-crop-picker'; import { atom, useSetRecoilState } from 'recoil'; import ButtonPressAnimation from '../../animations/ButtonPressAnimation'; @@ -13,6 +12,7 @@ import { useENSModifiedRegistration, useENSRegistration, useENSRegistrationForm, import { ImgixImage } from '@/components/images'; import { magicMemo, stringifyENSNFTRecord } from '@/utils'; import { ENS_RECORDS } from '@/helpers/ens'; +import { IS_TEST } from '@/env'; export const avatarMetadataAtom = atom({ default: undefined, @@ -20,7 +20,6 @@ export const avatarMetadataAtom = atom({ }); const size = 70; -const isTesting = IS_TESTING === 'true'; const RegistrationAvatar = ({ hasSeenExplainSheet, @@ -131,11 +130,11 @@ const RegistrationAvatar = ({ ) : ( {children}} > diff --git a/src/components/remote-promo-sheet/check-fns/hasNonZeroTotalBalance.ts b/src/components/remote-promo-sheet/check-fns/hasNonZeroTotalBalance.ts index e2f68b89723..0a8414475a0 100644 --- a/src/components/remote-promo-sheet/check-fns/hasNonZeroTotalBalance.ts +++ b/src/components/remote-promo-sheet/check-fns/hasNonZeroTotalBalance.ts @@ -1,7 +1,7 @@ import { selectorFilterByUserChains, selectUserAssetsList } from '@/__swaps__/screens/Swap/resources/_selectors/assets'; import { userAssetsFetchQuery } from '@/__swaps__/screens/Swap/resources/assets/userAssets'; import store from '@/redux/store'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; export const hasNonZeroTotalBalance = async (): Promise => { const { accountAddress, nativeCurrency } = store.getState().settings; @@ -9,7 +9,7 @@ export const hasNonZeroTotalBalance = async (): Promise => { const userAssetsDictByChain = await userAssetsFetchQuery({ address: accountAddress, currency: nativeCurrency, - testnetMode: useConnectedToHardhatStore.getState().connectedToHardhat, + testnetMode: useConnectedToAnvilStore.getState().connectedToAnvil, }); const assets = selectorFilterByUserChains({ data: userAssetsDictByChain, selector: selectUserAssetsList }); diff --git a/src/components/skeleton/Skeleton.tsx b/src/components/skeleton/Skeleton.tsx index 628090fc8a6..afd02fa4532 100644 --- a/src/components/skeleton/Skeleton.tsx +++ b/src/components/skeleton/Skeleton.tsx @@ -1,7 +1,6 @@ import MaskedView from '@react-native-masked-view/masked-view'; import React from 'react'; import { View, ViewProps } from 'react-native'; -import { IS_TESTING } from 'react-native-dotenv'; import { ThemeContextProps, withThemeContext } from '../../theme/ThemeContext'; import { deviceUtils } from '../../utils'; import { ShimmerAnimation } from '../animations'; @@ -9,6 +8,7 @@ import { CoinRowHeight } from '../coin-row'; import { Row } from '../layout'; import styled from '@/styled-thing'; import { position } from '@/styles'; +import { IS_TEST } from '@/env'; export const AssetListItemSkeletonHeight = CoinRowHeight; @@ -75,7 +75,7 @@ function Skeleton({ skeletonColor?: string; width?: number; }) { - if (animated && IS_TESTING !== 'true') { + if (animated && !IS_TEST) { return ( {children}} style={{ flex: 1 }}> diff --git a/src/components/toasts/OfflineToast.js b/src/components/toasts/OfflineToast.js index 053791ce854..266455625ca 100644 --- a/src/components/toasts/OfflineToast.js +++ b/src/components/toasts/OfflineToast.js @@ -3,13 +3,13 @@ import React from 'react'; import Toast from './Toast'; import { useAccountSettings, useInternetStatus } from '@/hooks'; import { ChainId } from '@/state/backendNetworks/types'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; const OfflineToast = () => { const isConnected = useInternetStatus(); const { chainId } = useAccountSettings(); - const { connectedToHardhat } = useConnectedToHardhatStore(); - const isMainnet = chainId === ChainId.mainnet && !connectedToHardhat; + const { connectedToAnvil } = useConnectedToAnvilStore(); + const isMainnet = chainId === ChainId.mainnet && !connectedToAnvil; return ; }; diff --git a/src/components/toasts/TestnetToast.js b/src/components/toasts/TestnetToast.js index 5618d0706d4..136fc021d78 100644 --- a/src/components/toasts/TestnetToast.js +++ b/src/components/toasts/TestnetToast.js @@ -4,11 +4,11 @@ import { Nbsp, Text } from '../text'; import Toast from './Toast'; import { useInternetStatus } from '@/hooks'; import { ChainId } from '@/state/backendNetworks/types'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { useBackendNetworksStore } from '@/state/backendNetworks/backendNetworks'; const TestnetToast = ({ chainId }) => { - const { connectedToHardhat } = useConnectedToHardhatStore(); + const { connectedToAnvil } = useConnectedToAnvilStore(); const isConnected = useInternetStatus(); const nativeAsset = useBackendNetworksStore.getState().getChainsNativeAsset()[chainId]; const name = useBackendNetworksStore.getState().getChainsName()[chainId]; @@ -18,9 +18,9 @@ const TestnetToast = ({ chainId }) => { useEffect(() => { if (chainId === ChainId.mainnet) { - if (connectedToHardhat) { + if (connectedToAnvil) { setVisible(true); - setNetworkName('Hardhat'); + setNetworkName('Anvil'); } else { setVisible(false); } @@ -28,7 +28,7 @@ const TestnetToast = ({ chainId }) => { setVisible(true); setNetworkName(name + (isConnected ? '' : ' (offline)')); } - }, [isConnected, chainId, connectedToHardhat, name]); + }, [isConnected, chainId, connectedToAnvil, name]); const { colors, isDarkMode } = useTheme(); diff --git a/src/config/defaultDebug.ts b/src/config/defaultDebug.ts index e3e349d1203..e39b0a01b45 100644 --- a/src/config/defaultDebug.ts +++ b/src/config/defaultDebug.ts @@ -9,7 +9,7 @@ export const debugLayoutAnimations = false; export const alwaysRequireApprove = false; export const showReloadButton = false; export const showSwitchModeButton = false; -export const showConnectToHardhatButton = false; +export const showConnectToAnvilButton = false; export const parseAllTxnsOnReceive = false; export const reactNativeDisableYellowBox = true; export const showNetworkRequests = false; diff --git a/src/handlers/swap.ts b/src/handlers/swap.ts index 7d811afc0d4..877dc315e40 100644 --- a/src/handlers/swap.ts +++ b/src/handlers/swap.ts @@ -3,7 +3,6 @@ import { Block, StaticJsonRpcProvider } from '@ethersproject/providers'; import { CrosschainQuote, getQuoteExecutionDetails, getRainbowRouterContractAddress, Quote } from '@rainbow-me/swaps'; import { Contract } from '@ethersproject/contracts'; import { MaxUint256 } from '@ethersproject/constants'; -import { IS_TESTING } from 'react-native-dotenv'; import { Token } from '../entities/tokens'; import { estimateGasWithPadding, getProvider, toHexNoLeadingZeros } from './web3'; import { getRemoteConfig } from '@/model/remoteConfig'; @@ -13,6 +12,7 @@ import { erc20ABI, ethUnits } from '@/references'; import { ethereumUtils } from '@/utils'; import { logger, RainbowError } from '@/logger'; import { ChainId } from '@/state/backendNetworks/types'; +import { IS_TEST } from '@/env'; export enum Field { INPUT = 'INPUT', @@ -191,7 +191,7 @@ export const estimateCrosschainSwapGasLimit = async ({ } try { if (requiresApprove) { - if (CHAIN_IDS_WITH_TRACE_SUPPORT.includes(chainId) && IS_TESTING !== 'true') { + if (CHAIN_IDS_WITH_TRACE_SUPPORT.includes(chainId) && !IS_TEST) { try { const gasLimitWithFakeApproval = await getSwapGasLimitWithFakeApproval(chainId, provider, tradeDetails); logger.debug('[swap]: Got gasLimitWithFakeApproval!', { diff --git a/src/handlers/web3.ts b/src/handlers/web3.ts index 96f099109a2..1e5c7ae00d8 100644 --- a/src/handlers/web3.ts +++ b/src/handlers/web3.ts @@ -24,9 +24,9 @@ import { import { ethereumUtils } from '@/utils'; import { logger, RainbowError } from '@/logger'; import { IS_IOS, RPC_PROXY_API_KEY, RPC_PROXY_BASE_URL } from '@/env'; -import { ChainId, chainHardhat } from '@/state/backendNetworks/types'; +import { ChainId, chainAnvil } from '@/state/backendNetworks/types'; import { useBackendNetworksStore } from '@/state/backendNetworks/backendNetworks'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; export enum TokenStandard { ERC1155 = 'ERC1155', @@ -111,8 +111,8 @@ export const getCachedProviderForNetwork = (chainId: ChainId = ChainId.mainnet): }; export const getBatchedProvider = ({ chainId = ChainId.mainnet }: { chainId?: number }): JsonRpcBatchProvider => { - if (useConnectedToHardhatStore.getState().connectedToHardhat) { - const provider = new JsonRpcBatchProvider(chainHardhat.rpcUrls.default.http[0], ChainId.mainnet); + if (useConnectedToAnvilStore.getState().connectedToAnvil) { + const provider = new JsonRpcBatchProvider(chainAnvil.rpcUrls.default.http[0], ChainId.mainnet); chainsBatchProviders.set(chainId, provider); return provider; @@ -131,8 +131,8 @@ export const getBatchedProvider = ({ chainId = ChainId.mainnet }: { chainId?: nu }; export const getProvider = ({ chainId = ChainId.mainnet }: { chainId?: number }): StaticJsonRpcProvider => { - if (useConnectedToHardhatStore.getState().connectedToHardhat) { - const provider = new StaticJsonRpcProvider(chainHardhat.rpcUrls.default.http[0], ChainId.mainnet); + if (useConnectedToAnvilStore.getState().connectedToAnvil) { + const provider = new StaticJsonRpcProvider(chainAnvil.rpcUrls.default.http[0], ChainId.mainnet); chainsProviders.set(chainId, provider); return provider; diff --git a/src/helpers/RainbowContext.tsx b/src/helpers/RainbowContext.tsx index 5fe0d9f4f38..3a0f90586fa 100644 --- a/src/helpers/RainbowContext.tsx +++ b/src/helpers/RainbowContext.tsx @@ -3,17 +3,17 @@ import { MMKV } from 'react-native-mmkv'; import { useSharedValue } from 'react-native-reanimated'; import DevButton from '../components/dev-buttons/DevButton'; import Emoji from '../components/text/Emoji'; -import { showReloadButton, showSwitchModeButton, showConnectToHardhatButton } from '../config/debug'; +import { showReloadButton, showSwitchModeButton, showConnectToAnvilButton } from '../config/debug'; import { defaultConfig } from '@/config/experimental'; import { useDispatch } from 'react-redux'; import { useTheme } from '../theme/ThemeContext'; import { STORAGE_IDS } from '@/model/mmkv'; -import { IS_TESTING } from 'react-native-dotenv'; import { logger, RainbowError } from '@/logger'; import { Navigation } from '@/navigation'; import Routes from '@rainbow-me/routes'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; +import { IS_TEST } from '@/env'; export type RainbowContextType = { config: Record; @@ -37,7 +37,7 @@ export default function RainbowContextWrapper({ children }: PropsWithChildren) { // This value is hold here to prevent JS VM from shutting down // on unmounting all shared values. useSharedValue(0); - const { setConnectedToHardhat } = useConnectedToHardhatStore(); + const { setConnectedToAnvil } = useConnectedToAnvilStore(); const [config, setConfig] = useState>( Object.entries(defaultConfig).reduce((acc, [key, { value }]) => ({ ...acc, [key]: value }), {}) ); @@ -71,26 +71,26 @@ export default function RainbowContextWrapper({ children }: PropsWithChildren) { const dispatch = useDispatch(); - const connectToHardhat = useCallback(async () => { + const connectToAnvil = useCallback(async () => { try { - setConnectedToHardhat(true); - logger.debug('connected to hardhat'); + setConnectedToAnvil(true); + logger.debug('connected to anvil'); } catch (e: any) { - setConnectedToHardhat(false); - logger.error(new RainbowError('error connecting to hardhat'), { + setConnectedToAnvil(false); + logger.error(new RainbowError('error connecting to anvil'), { message: e.message, }); } Navigation.handleAction(Routes.WALLET_SCREEN, {}); - }, [dispatch, setConnectedToHardhat]); + }, [dispatch, setConnectedToAnvil]); return ( {children} {/* @ts-expect-error ts-migrate(2741) FIXME: Property 'color' is missing in type... Remove this comment to see the full error message */} {showReloadButton && __DEV__ && } - {((showConnectToHardhatButton && __DEV__) || IS_TESTING === 'true') && ( - + {((showConnectToAnvilButton && __DEV__) || IS_TEST) && ( + {/* @ts-ignore */} 👷 diff --git a/src/hooks/useENSRegistrationStepHandler.tsx b/src/hooks/useENSRegistrationStepHandler.tsx index d99183c9bec..8072546ac9d 100644 --- a/src/hooks/useENSRegistrationStepHandler.tsx +++ b/src/hooks/useENSRegistrationStepHandler.tsx @@ -15,16 +15,16 @@ import { } from '@/helpers/ens'; import { updateTransactionRegistrationParameters } from '@/redux/ensRegistration'; import { ChainId } from '@/state/backendNetworks/types'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; const checkRegisterBlockTimestamp = async ({ registrationParameters, secondsSinceCommitConfirmed, - connectedToHardhat, + connectedToAnvil, }: { registrationParameters: RegistrationParameters; secondsSinceCommitConfirmed: number; - connectedToHardhat: boolean; + connectedToAnvil: boolean; }) => { try { const provider = getProvider({ chainId: ChainId.mainnet }); @@ -35,7 +35,7 @@ const checkRegisterBlockTimestamp = async ({ (secs > ENS_SECONDS_WAIT_WITH_PADDING && secondsSinceCommitConfirmed > ENS_SECONDS_WAIT_WITH_PADDING) || // sometimes the provider.getBlock('latest) takes a long time to update to newest block secondsSinceCommitConfirmed > ENS_SECONDS_WAIT_PROVIDER_PADDING || - connectedToHardhat + connectedToAnvil ) { return true; } @@ -62,12 +62,12 @@ export default function useENSRegistrationStepHandler(observer = true) { -1 ); - const { connectedToHardhat } = useConnectedToHardhatStore(); + const { connectedToAnvil } = useConnectedToAnvilStore(); const [readyToRegister, setReadyToRegister] = useState(secondsSinceCommitConfirmed > ENS_SECONDS_WAIT); // flag to wait 10 secs before we get the tx block, to be able to simulate not confirmed tx when testing - const shouldLoopForConfirmation = useRef(connectedToHardhat); + const shouldLoopForConfirmation = useRef(connectedToAnvil); const registrationStep = useMemo(() => { if (mode === REGISTRATION_MODES.EDIT) return REGISTRATION_STEPS.EDIT; @@ -100,8 +100,8 @@ export default function useENSRegistrationStepHandler(observer = true) { if (!shouldLoopForConfirmation.current && block?.timestamp) { const now = Date.now(); const msBlockTimestamp = getBlockMsTimestamp(block); - // hardhat block timestamp is behind - const timeDifference = connectedToHardhat ? now - msBlockTimestamp : 0; + // anvil block timestamp is behind + const timeDifference = connectedToAnvil ? now - msBlockTimestamp : 0; const commitTransactionConfirmedAt = msBlockTimestamp + timeDifference; const secs = differenceInSeconds(now, commitTransactionConfirmedAt); setSecondsSinceCommitConfirmed(secondsSinceCommitConfirmed < 0 ? 0 : secs); @@ -115,7 +115,7 @@ export default function useENSRegistrationStepHandler(observer = true) { shouldLoopForConfirmation.current = false; } return confirmed; - }, [observer, commitTransactionHash, connectedToHardhat, secondsSinceCommitConfirmed, dispatch]); + }, [observer, commitTransactionHash, connectedToAnvil, secondsSinceCommitConfirmed, dispatch]); const startPollingWatchCommitTransaction = useCallback(async () => { if (observer) return; @@ -168,7 +168,7 @@ export default function useENSRegistrationStepHandler(observer = true) { if (!observer && secondsSinceCommitConfirmed % 2 === 0 && secondsSinceCommitConfirmed >= ENS_SECONDS_WAIT && !readyToRegister) { const checkIfReadyToRegister = async () => { const readyToRegister = await checkRegisterBlockTimestamp({ - connectedToHardhat, + connectedToAnvil, registrationParameters, secondsSinceCommitConfirmed, }); @@ -176,7 +176,7 @@ export default function useENSRegistrationStepHandler(observer = true) { }; checkIfReadyToRegister(); } - }, [connectedToHardhat, observer, readyToRegister, registrationParameters, secondsSinceCommitConfirmed]); + }, [connectedToAnvil, observer, readyToRegister, registrationParameters, secondsSinceCommitConfirmed]); useEffect( () => () => { diff --git a/src/hooks/useRefreshAccountData.ts b/src/hooks/useRefreshAccountData.ts index fd2ffbb4b87..d38b57ac45b 100644 --- a/src/hooks/useRefreshAccountData.ts +++ b/src/hooks/useRefreshAccountData.ts @@ -13,14 +13,14 @@ import { Address } from 'viem'; import { addysSummaryQueryKey } from '@/resources/summary/summary'; import useWallets from './useWallets'; import { claimablesQueryKey } from '@/resources/addys/claimables/query'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; export default function useRefreshAccountData() { const dispatch = useDispatch(); const { accountAddress, nativeCurrency } = useAccountSettings(); const [isRefreshing, setIsRefreshing] = useState(false); const profilesEnabled = useExperimentalFlag(PROFILES); - const { connectedToHardhat } = useConnectedToHardhatStore(); + const { connectedToAnvil } = useConnectedToAnvilStore(); const { wallets } = useWallets(); @@ -34,9 +34,7 @@ export default function useRefreshAccountData() { queryClient.invalidateQueries(positionsQueryKey({ address: accountAddress as Address, currency: nativeCurrency })); queryClient.invalidateQueries(claimablesQueryKey({ address: accountAddress, currency: nativeCurrency })); queryClient.invalidateQueries(addysSummaryQueryKey({ addresses: allAddresses, currency: nativeCurrency })); - queryClient.invalidateQueries( - userAssetsQueryKey({ address: accountAddress, currency: nativeCurrency, testnetMode: connectedToHardhat }) - ); + queryClient.invalidateQueries(userAssetsQueryKey({ address: accountAddress, currency: nativeCurrency, testnetMode: connectedToAnvil })); try { const getWalletNames = dispatch(fetchWalletNames()); @@ -50,7 +48,7 @@ export default function useRefreshAccountData() { logger.error(new RainbowError(`[useRefreshAccountData]: Error refreshing data: ${error}`)); throw error; } - }, [accountAddress, allAddresses, connectedToHardhat, dispatch, nativeCurrency, profilesEnabled]); + }, [accountAddress, allAddresses, connectedToAnvil, dispatch, nativeCurrency, profilesEnabled]); const refresh = useCallback(async () => { if (isRefreshing) return; diff --git a/src/hooks/useWatchPendingTxs.ts b/src/hooks/useWatchPendingTxs.ts index 517185d1407..4c90fcfa16c 100644 --- a/src/hooks/useWatchPendingTxs.ts +++ b/src/hooks/useWatchPendingTxs.ts @@ -10,7 +10,7 @@ import { invalidateAddressNftsQueries } from '@/resources/nfts'; import { usePendingTransactionsStore } from '@/state/pendingTransactions'; import { Address } from 'viem'; import { staleBalancesStore } from '@/state/staleBalances'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { useBackendNetworksStore } from '@/state/backendNetworks/backendNetworks'; export const useWatchPendingTransactions = ({ address }: { address: string }) => { @@ -18,7 +18,7 @@ export const useWatchPendingTransactions = ({ address }: { address: string }) => storePendingTransactions: state.pendingTransactions, setPendingTransactions: state.setPendingTransactions, })); - const { connectedToHardhat } = useConnectedToHardhatStore(); + const { connectedToAnvil } = useConnectedToAnvilStore(); const pendingTransactions = useMemo(() => storePendingTransactions[address] || [], [address, storePendingTransactions]); @@ -31,12 +31,12 @@ export const useWatchPendingTransactions = ({ address }: { address: string }) => userAssetsQueryKey({ address, currency: nativeCurrency, - testnetMode: connectedToHardhat, + testnetMode: connectedToAnvil, }) ); invalidateAddressNftsQueries(address); }, - [address, connectedToHardhat, nativeCurrency] + [address, connectedToAnvil, nativeCurrency] ); const processSupportedNetworkTransaction = useCallback( @@ -115,7 +115,7 @@ export const useWatchPendingTransactions = ({ address }: { address: string }) => }); queryClient.refetchQueries({ - queryKey: userAssetsQueryKey({ address, currency: nativeCurrency, testnetMode: connectedToHardhat }), + queryKey: userAssetsQueryKey({ address, currency: nativeCurrency, testnetMode: connectedToAnvil }), }); const supportedMainnetChainIds = useBackendNetworksStore.getState().getSupportedMainnetChainIds(); @@ -143,7 +143,7 @@ export const useWatchPendingTransactions = ({ address }: { address: string }) => address, pendingTransactions: newPendingTransactions, }); - }, [address, connectedToHardhat, nativeCurrency, pendingTransactions, processPendingTransaction, setPendingTransactions]); + }, [address, connectedToAnvil, nativeCurrency, pendingTransactions, processPendingTransaction, setPendingTransactions]); return { watchPendingTransactions }; }; diff --git a/src/languages/ar_AR.json b/src/languages/ar_AR.json index 581387865ed..680154a854b 100644 --- a/src/languages/ar_AR.json +++ b/src/languages/ar_AR.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "مسح ذاكرة التخزين المؤقت لبيانات الصور", "clear_local_storage": "مسح التخزين المحلي", "clear_mmkv_storage": "مسح التخزين MMKV", - "connect_to_hardhat": "الاتصال بـ hardhat", - "disconnect_to_hardhat": "افصل عن Hardhat", + "connect_to_anvil": "الاتصال بـ anvil", + "disconnect_to_anvil": "افصل عن Anvil", "crash_app_render_error": "تعطيل التطبيق (خطأ في التصيير)", "enable_testnets": "تمكين شبكات الاختبار", "installing_update": "تثبيت التحديث", diff --git a/src/languages/en_US.json b/src/languages/en_US.json index 5865734fece..66bdb0dec0d 100644 --- a/src/languages/en_US.json +++ b/src/languages/en_US.json @@ -523,8 +523,8 @@ "clear_image_metadata_cache": "Clear Image Metadata Cache", "clear_local_storage": "Clear local storage", "clear_mmkv_storage": "Clear MMKV storage", - "connect_to_hardhat": "Connect to hardhat", - "disconnect_to_hardhat": "Disconnect from hardhat", + "connect_to_anvil": "Connect to anvil", + "disconnect_to_anvil": "Disconnect from anvil", "crash_app_render_error": "Crash app (render error)", "enable_testnets": "Enable Testnets", "installing_update": "Installing update", diff --git a/src/languages/es_419.json b/src/languages/es_419.json index e75f3ecab54..be671fb2e61 100644 --- a/src/languages/es_419.json +++ b/src/languages/es_419.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "Borrar Cache de Metadatos de Imagen", "clear_local_storage": "Borrar almacenamiento local", "clear_mmkv_storage": "Borrar almacenamiento de MMKV", - "connect_to_hardhat": "Conectar a Hardhat", - "disconnect_to_hardhat": "Desconectar de hardhat", + "connect_to_anvil": "Conectar a Anvil", + "disconnect_to_anvil": "Desconectar de anvil", "crash_app_render_error": "Crash de la aplicación (error de renderización)", "enable_testnets": "Habilitar Testnets", "installing_update": "Instalando actualización", diff --git a/src/languages/fr_FR.json b/src/languages/fr_FR.json index 5219996ea32..2d36b80ad5e 100644 --- a/src/languages/fr_FR.json +++ b/src/languages/fr_FR.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "Effacer le cache des métadonnées d'image", "clear_local_storage": "Effacer le stockage local", "clear_mmkv_storage": "Effacer le stockage MMKV", - "connect_to_hardhat": "Se connecter à hardhat", - "disconnect_to_hardhat": "Déconnecter de hardhat", + "connect_to_anvil": "Se connecter à anvil", + "disconnect_to_anvil": "Déconnecter de anvil", "crash_app_render_error": "Crash app (render error) :)", "enable_testnets": "Activer Testnets", "installing_update": "Installation de la mise à jour", diff --git a/src/languages/hi_IN.json b/src/languages/hi_IN.json index 9f1e63ce207..6225599e370 100644 --- a/src/languages/hi_IN.json +++ b/src/languages/hi_IN.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "छवि मेटाडाटा कैश साफ करें", "clear_local_storage": "लोकल स्टोरेज को साफ करें", "clear_mmkv_storage": "MMKV स्टोरेज को साफ करें", - "connect_to_hardhat": "Hardhat से कनेक्ट करें", - "disconnect_to_hardhat": "हार्डहैट से डिस्कनेक्ट करें", + "connect_to_anvil": "Anvil से कनेक्ट करें", + "disconnect_to_anvil": "हार्डहैट से डिस्कनेक्ट करें", "crash_app_render_error": "ऐप्र्प्लिकेशन क्रैश करें (रेंडर त्रुटि)", "enable_testnets": "टेस्टनेट्स सक्षम करें", "installing_update": "अद्यतन स्थापित कर रहा है", diff --git a/src/languages/id_ID.json b/src/languages/id_ID.json index 2d46f0dc67e..33f73e497d8 100644 --- a/src/languages/id_ID.json +++ b/src/languages/id_ID.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "Hapus Cache Metadata Gambar", "clear_local_storage": "Hapus penyimpanan lokal", "clear_mmkv_storage": "Hapus penyimpanan MMKV", - "connect_to_hardhat": "Hubungkan ke hardhat", - "disconnect_to_hardhat": "Putuskan hubungan dari hardhat", + "connect_to_anvil": "Hubungkan ke anvil", + "disconnect_to_anvil": "Putuskan hubungan dari anvil", "crash_app_render_error": "Aplikasi crash (kesalahan render)", "enable_testnets": "Aktifkan Testnets", "installing_update": "Menginstal pembaruan", diff --git a/src/languages/ja_JP.json b/src/languages/ja_JP.json index 0087d9cc208..a9df28a7a1d 100644 --- a/src/languages/ja_JP.json +++ b/src/languages/ja_JP.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "クリアイメージメタデータキャッシュ", "clear_local_storage": "ローカルストレージをクリア", "clear_mmkv_storage": "MMKVストレージをクリア", - "connect_to_hardhat": "Hardhatに接続する", - "disconnect_to_hardhat": "hardhatから切断する", + "connect_to_anvil": "Anvilに接続する", + "disconnect_to_anvil": "anvilから切断する", "crash_app_render_error": "アプリをクラッシュさせる(レンダーエラー)", "enable_testnets": "テストネットを有効にする", "installing_update": "アップデートをインストール中", diff --git a/src/languages/ko_KR.json b/src/languages/ko_KR.json index 90da37af11c..4e9d0b3ac39 100644 --- a/src/languages/ko_KR.json +++ b/src/languages/ko_KR.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "이미지 메타데이터 캐시 지우기", "clear_local_storage": "로컬 저장소 지우기", "clear_mmkv_storage": "MMKV 저장소 지우기", - "connect_to_hardhat": "하드햇에 연결", - "disconnect_to_hardhat": "hardhat 연결 해제", + "connect_to_anvil": "하드햇에 연결", + "disconnect_to_anvil": "anvil 연결 해제", "crash_app_render_error": "애플리케이션 종료 (렌더링 오류)", "enable_testnets": "테스트넷 활성화", "installing_update": "업데이트 설치 중", diff --git a/src/languages/pt_BR.json b/src/languages/pt_BR.json index 2216e16b584..38db975c1f1 100644 --- a/src/languages/pt_BR.json +++ b/src/languages/pt_BR.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "Limpar Cache de Metadados da Imagem", "clear_local_storage": "Limpar Armazenamento Local", "clear_mmkv_storage": "Limpar Armazenamento MMKV", - "connect_to_hardhat": "Conectar ao Hardhat", - "disconnect_to_hardhat": "Desconectar do hardhat", + "connect_to_anvil": "Conectar ao Anvil", + "disconnect_to_anvil": "Desconectar do anvil", "crash_app_render_error": "Crash no app (erro de renderização)", "enable_testnets": "Ativar Testnets", "installing_update": "Instalando atualização", diff --git a/src/languages/ru_RU.json b/src/languages/ru_RU.json index 2867e9180ef..2bc33887870 100644 --- a/src/languages/ru_RU.json +++ b/src/languages/ru_RU.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "Очистить кэш метаданных изображения", "clear_local_storage": "Очистить локальное хранилище", "clear_mmkv_storage": "Очистить хранилище MMKV", - "connect_to_hardhat": "Подключиться к hardhat", - "disconnect_to_hardhat": "Отключиться от hardhat", + "connect_to_anvil": "Подключиться к anvil", + "disconnect_to_anvil": "Отключиться от anvil", "crash_app_render_error": "Падение приложения (ошибка отображения)", "enable_testnets": "Включить тестовые сети", "installing_update": "Установка обновления", diff --git a/src/languages/th_TH.json b/src/languages/th_TH.json index 80714c9a455..343029d2ee7 100644 --- a/src/languages/th_TH.json +++ b/src/languages/th_TH.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "ล้างแคชข้อมูลภาพ", "clear_local_storage": "ล้าง local storage", "clear_mmkv_storage": "ล้าง MMKV storage", - "connect_to_hardhat": "เชื่อมต่อกับ hardhat", - "disconnect_to_hardhat": "ตัดการเชื่อมต่อจาก Hardhat", + "connect_to_anvil": "เชื่อมต่อกับ anvil", + "disconnect_to_anvil": "ตัดการเชื่อมต่อจาก Anvil", "crash_app_render_error": "คว่ำ app (render error)", "enable_testnets": "เปิดใช้งาน Testnets", "installing_update": "กำลังติดตั้งการอัปเดต", diff --git a/src/languages/tr_TR.json b/src/languages/tr_TR.json index d7233d4a4ae..ffaa85ee5a8 100644 --- a/src/languages/tr_TR.json +++ b/src/languages/tr_TR.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "Resim Metaveri Önbelleğini Temizle", "clear_local_storage": "Yerel depolamayı temizle", "clear_mmkv_storage": "MMKV depolamasını temizle", - "connect_to_hardhat": "Hardhat'a bağlan", - "disconnect_to_hardhat": "Hardhat'tan bağlantıyı kes", + "connect_to_anvil": "Anvil'a bağlan", + "disconnect_to_anvil": "Anvil'tan bağlantıyı kes", "crash_app_render_error": "Uygulamayı çökert (render hatası)", "enable_testnets": "Testnetleri Etkinleştir", "installing_update": "Güncelleme Yükleniyor", diff --git a/src/languages/zh_CN.json b/src/languages/zh_CN.json index 92b9ff64e78..0d2540fa6e0 100644 --- a/src/languages/zh_CN.json +++ b/src/languages/zh_CN.json @@ -503,8 +503,8 @@ "clear_image_metadata_cache": "清除图片内元数据缓存", "clear_local_storage": "清除本地存储", "clear_mmkv_storage": "清除MMKV存储", - "connect_to_hardhat": "连接到hardhat", - "disconnect_to_hardhat": "断开硬帽连接", + "connect_to_anvil": "连接到anvil", + "disconnect_to_anvil": "断开硬帽连接", "crash_app_render_error": "崩溃应用程序(渲染错误)", "enable_testnets": "启用Testnets", "installing_update": "正在安装更新", diff --git a/src/model/migrations.ts b/src/model/migrations.ts index bfd41f7b887..a30d22d401a 100644 --- a/src/model/migrations.ts +++ b/src/model/migrations.ts @@ -42,7 +42,7 @@ import { getAddressAndChainIdFromUniqueId, getUniqueId, getUniqueIdNetwork } fro import { ParsedAssetsDictByChain, ParsedSearchAsset, UniqueId } from '@/__swaps__/types/assets'; import { userAssetsStore } from '@/state/assets/userAssets'; import { userAssetsQueryKey } from '@/__swaps__/screens/Swap/resources/assets/userAssets'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { selectorFilterByUserChains, selectUserAssetsList } from '@/__swaps__/screens/Swap/resources/_selectors/assets'; import { UnlockableAppIconKey, unlockableAppIcons } from '@/appIcons/appIcons'; import { unlockableAppIconStorage } from '@/featuresToUnlock/unlockableAppIconCheck'; @@ -728,8 +728,8 @@ export default async function runMigrations() { for (const wallet of Object.values(wallets)) { for (const { address } of (wallet as RainbowWallet).addresses) { - const { connectedToHardhat } = useConnectedToHardhatStore.getState(); - const queryKey = userAssetsQueryKey({ address, currency: nativeCurrency, testnetMode: connectedToHardhat }); + const { connectedToAnvil } = useConnectedToAnvilStore.getState(); + const queryKey = userAssetsQueryKey({ address, currency: nativeCurrency, testnetMode: connectedToAnvil }); const queryData: ParsedAssetsDictByChain | undefined = queryClient.getQueryData(queryKey); if (!queryData) continue; diff --git a/src/performance/tracking/index.ts b/src/performance/tracking/index.ts index 81b8fb5e73a..a0b3ebbcf3a 100644 --- a/src/performance/tracking/index.ts +++ b/src/performance/tracking/index.ts @@ -1,15 +1,16 @@ -import { IS_TESTING, SENTRY_ENVIRONMENT } from 'react-native-dotenv'; +import { SENTRY_ENVIRONMENT } from 'react-native-dotenv'; import { PerformanceMetricData } from './types/PerformanceMetricData'; import { PerformanceMetricsType } from './types/PerformanceMetrics'; import { PerformanceTagsType } from './types/PerformanceTags'; import { analytics } from '@/analytics'; +import { IS_TEST } from '@/env'; /* This will be a version for all performance tracking events. If we make breaking changes we will be able to take it into consideration when doing analytics */ const performanceTrackingVersion = 2; const shouldLogToConsole = __DEV__ || SENTRY_ENVIRONMENT === 'LocalRelease'; -const shouldReportMeasurement = IS_TESTING === 'false' && !__DEV__ && SENTRY_ENVIRONMENT !== 'LocalRelease'; +const shouldReportMeasurement = !IS_TEST && !__DEV__ && SENTRY_ENVIRONMENT !== 'LocalRelease'; const logTag = '[PERFORMANCE]: '; function logDurationIfAppropriate(metric: PerformanceMetricsType, durationInMs: number, ...additionalArgs: any[]) { diff --git a/src/raps/actions/ens.ts b/src/raps/actions/ens.ts index e4e315c98a4..ca380e1d0da 100644 --- a/src/raps/actions/ens.ts +++ b/src/raps/actions/ens.ts @@ -1,5 +1,4 @@ import { Signer } from '@ethersproject/abstract-signer'; -import { IS_TESTING } from 'react-native-dotenv'; import { ENSActionParameters, ENSRap, ENSRapActionType, RapENSAction, RapENSActionParameters } from '@/raps/common'; import { analytics } from '@/analytics'; import { ENSRegistrationRecords, NewTransaction, TransactionGasParamAmounts, TransactionStatus } from '@/entities'; @@ -23,6 +22,7 @@ import { } from '../registerENS'; import { Logger } from '@ethersproject/logger'; import { performanceTracking, Screens, TimeToSignOperation } from '@/state/performance/performance'; +import { IS_TEST } from '@/env'; export interface ENSRapActionResponse { baseNonce?: number | null; @@ -327,7 +327,7 @@ const ensAction = async ( // (MULTICALL || SET_TEXT) it's going to fail if we put the account address // since the account doesn't have the ENS yet const notUseOwnerAddress = - IS_TESTING !== 'true' && + !IS_TEST && mode === REGISTRATION_MODES.CREATE && (type === ENSRegistrationTransactionType.MULTICALL || type === ENSRegistrationTransactionType.SET_TEXT); diff --git a/src/redux/gas.ts b/src/redux/gas.ts index 496bec67a67..3ef75dbe5db 100644 --- a/src/redux/gas.ts +++ b/src/redux/gas.ts @@ -1,7 +1,6 @@ import { Mutex } from 'async-mutex'; import BigNumber from 'bignumber.js'; import { isEmpty } from 'lodash'; -import { IS_TESTING } from 'react-native-dotenv'; import { AppDispatch, AppGetState } from './store'; import { analytics } from '@/analytics'; import { logger, RainbowError } from '@/logger'; @@ -37,10 +36,11 @@ import { import { ethUnits } from '@/references'; import { ethereumUtils, gasUtils } from '@/utils'; import { ChainId } from '@/state/backendNetworks/types'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { useBackendNetworksStore } from '@/state/backendNetworks/backendNetworks'; import { MeteorologyLegacyResponse, MeteorologyResponse } from '@/entities/gas'; import { addBuffer } from '@/helpers/utilities'; +import { IS_TEST } from '@/env'; const { CUSTOM, NORMAL, URGENT } = gasUtils; @@ -368,9 +368,9 @@ export const gasPricesStartPolling = meteorologyGasParams as MeterologyGasParams; // Set a really gas estimate to guarantee that we're gonna be over - // the basefee at the time we fork mainnet during our hardhat tests + // the basefee at the time we fork mainnet during our anvil tests let baseFee = baseFeePerGas; - if (chainId === ChainId.mainnet && IS_TESTING === 'true' && useConnectedToHardhatStore.getState().connectedToHardhat) { + if (chainId === ChainId.mainnet && IS_TEST && useConnectedToAnvilStore.getState().connectedToAnvil) { baseFee = parseGasFeeParam(gweiToWei(1000)); } diff --git a/src/resources/assets/hardhatAssets.ts b/src/resources/assets/anvilAssets.ts similarity index 85% rename from src/resources/assets/hardhatAssets.ts rename to src/resources/assets/anvilAssets.ts index 409a3ee1a1c..e14963668a9 100644 --- a/src/resources/assets/hardhatAssets.ts +++ b/src/resources/assets/anvilAssets.ts @@ -13,7 +13,7 @@ import { useBackendNetworksStore } from '@/state/backendNetworks/backendNetworks const MAINNET_BALANCE_CHECKER = '0x4dcf4562268dd384fe814c00fad239f06c2a0c2b'; -const fetchHardhatBalancesWithBalanceChecker = async ( +const fetchAnvilBalancesWithBalanceChecker = async ( tokens: string[], address: string ): Promise<{ [tokenAddress: string]: string } | null> => { @@ -32,19 +32,19 @@ const fetchHardhatBalancesWithBalanceChecker = async ( }); return balances; } catch (e) { - logger.error(new RainbowError(`[hardhatAssets]: Error fetching balances from balanceCheckerContract: ${e}`)); + logger.error(new RainbowError(`[anvilAssets]: Error fetching balances from balanceCheckerContract: ${e}`)); return null; } }; /** * @deprecated - to be removed once rest of the app is converted to new userAssetsStore - * Fetches the balances of the hardhat assets for the given account address and network. + * Fetches the balances of the anvil assets for the given account address and network. * @param accountAddress - The address of the account to fetch the balances for. * @param network - The network to fetch the balances for. - * @returns The balances of the hardhat assets for the given account address and network. + * @returns The balances of the anvil assets for the given account address and network. */ -export const fetchHardhatBalances = async (accountAddress: string, chainId: ChainId = ChainId.mainnet): Promise => { +export const fetchAnvilBalances = async (accountAddress: string, chainId: ChainId = ChainId.mainnet): Promise => { const chainAssetsMap = keyBy( chainAssets[`${chainId}` as keyof typeof chainAssets], ({ asset }) => `${asset.asset_code}_${asset.chainId}` @@ -53,7 +53,7 @@ export const fetchHardhatBalances = async (accountAddress: string, chainId: Chai const tokenAddresses = Object.values(chainAssetsMap).map(({ asset: { asset_code } }) => asset_code === ETH_ADDRESS ? AddressZero : asset_code.toLowerCase() ); - const balances = await fetchHardhatBalancesWithBalanceChecker(tokenAddresses, accountAddress); + const balances = await fetchAnvilBalancesWithBalanceChecker(tokenAddresses, accountAddress); if (!balances) return {}; const updatedAssets = mapValues(chainAssetsMap, chainAsset => { @@ -70,7 +70,7 @@ export const fetchHardhatBalances = async (accountAddress: string, chainId: Chai return updatedAssets; }; -export const fetchHardhatBalancesByChainId = async ( +export const fetchAnvilBalancesByChainId = async ( accountAddress: string, chainId: ChainId = ChainId.mainnet ): Promise<{ @@ -88,7 +88,7 @@ export const fetchHardhatBalancesByChainId = async ( asset.asset_code === ETH_ADDRESS ? AddressZero : asset.asset_code.toLowerCase() ); - const balances = await fetchHardhatBalancesWithBalanceChecker(tokenAddresses, accountAddress); + const balances = await fetchAnvilBalancesWithBalanceChecker(tokenAddresses, accountAddress); if (!balances) return { assets: {}, diff --git a/src/screens/ENSIntroSheet.tsx b/src/screens/ENSIntroSheet.tsx index edcd087e44f..c9d82e6b9f3 100644 --- a/src/screens/ENSIntroSheet.tsx +++ b/src/screens/ENSIntroSheet.tsx @@ -1,6 +1,5 @@ import MaskedView from '@react-native-masked-view/masked-view'; import { useRoute } from '@react-navigation/native'; -import { IS_TESTING } from 'react-native-dotenv'; import lang from 'i18n-js'; import React, { useCallback, useMemo } from 'react'; import { InteractionManager, View } from 'react-native'; @@ -16,7 +15,7 @@ import { REGISTRATION_MODES } from '@/helpers/ens'; import { useAccountENSDomains, useDimensions, useENSAvatar, useENSRecords, useENSRegistration } from '@/hooks'; import Routes from '@/navigation/routesNames'; import { useTheme } from '@/theme'; -import { IS_ANDROID } from '@/env'; +import { IS_ANDROID, IS_TEST } from '@/env'; import ContextMenu from '@/components/context-menu/ContextMenu.android'; enum AnotherENSEnum { @@ -187,7 +186,7 @@ export default function ENSIntroSheet() { - {IS_TESTING !== 'true' && } + {!IS_TEST && } diff --git a/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx b/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx index 74ec4a4e969..f1a38d7ec24 100644 --- a/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx +++ b/src/screens/SettingsSheet/components/Backups/WalletsAndBackup.tsx @@ -348,7 +348,7 @@ export const WalletsAndBackup = () => { > {!isBackedUp && ( diff --git a/src/screens/SettingsSheet/components/DevSection.tsx b/src/screens/SettingsSheet/components/DevSection.tsx index 78bcdecae6b..f6919041c0f 100644 --- a/src/screens/SettingsSheet/components/DevSection.tsx +++ b/src/screens/SettingsSheet/components/DevSection.tsx @@ -33,7 +33,7 @@ import { isAuthenticated } from '@/utils/authentication'; import { getFCMToken } from '@/notifications/tokens'; import { nonceStore } from '@/state/nonces'; import { pendingTransactionsStore } from '@/state/pendingTransactions'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { addDefaultNotificationGroupSettings } from '@/notifications/settings/initialization'; import { unsubscribeAllNotifications } from '@/notifications/settings/settings'; @@ -41,7 +41,7 @@ const DevSection = () => { const { navigate } = useNavigation(); const { config, setConfig } = useContext(RainbowContext) as any; const { wallets } = useWallets(); - const setConnectedToHardhat = useConnectedToHardhatStore.getState().setConnectedToHardhat; + const setConnectedToAnvil = useConnectedToAnvilStore.getState().setConnectedToAnvil; const dispatch = useDispatch(); const [loadingStates, setLoadingStates] = useState({ @@ -61,17 +61,17 @@ const DevSection = () => { [config, setConfig] ); - const connectToHardhat = useCallback(async () => { + const connectToAnvil = useCallback(async () => { try { - const connectToHardhat = useConnectedToHardhatStore.getState().connectedToHardhat; - setConnectedToHardhat(!connectToHardhat); - logger.debug(`[DevSection] connected to hardhat`); + const connectToAnvil = useConnectedToAnvilStore.getState().connectedToAnvil; + setConnectedToAnvil(!connectToAnvil); + logger.debug(`[DevSection] connected to anvil`); } catch (e) { - setConnectedToHardhat(false); - logger.error(new RainbowError(`[DevSection] error connecting to hardhat: ${e}`)); + setConnectedToAnvil(false); + logger.error(new RainbowError(`[DevSection] error connecting to anvil: ${e}`)); } navigate(Routes.PROFILE_SCREEN); - }, [dispatch, navigate, setConnectedToHardhat]); + }, [dispatch, navigate, setConnectedToAnvil]); const checkAlert = useCallback(async () => { try { @@ -291,15 +291,15 @@ const DevSection = () => { /> } - onPress={connectToHardhat} + onPress={connectToAnvil} size={52} - testID="hardhat-section" + testID="anvil-section" titleComponent={ } diff --git a/src/screens/SettingsSheet/utils.ts b/src/screens/SettingsSheet/utils.ts index 0fb1d26faff..cda0da5ef72 100644 --- a/src/screens/SettingsSheet/utils.ts +++ b/src/screens/SettingsSheet/utils.ts @@ -103,14 +103,14 @@ export const titleForBackupState: Partial> = { }; export const isWalletBackedUpForCurrentAccount = ({ backupType, backedUp, backupFile }: Partial) => { - if (!backupType || !backupFile) { - return false; - } - if (IS_IOS || backupType === WalletBackupTypes.manual) { return backedUp; } + if (!backupType || !backupFile) { + return false; + } + // NOTE: For Android, we also need to check if the current google account has the matching backup file if (!backupFile) { return false; diff --git a/src/state/backendNetworks/backendNetworks.ts b/src/state/backendNetworks/backendNetworks.ts index 64ddb85185b..585af6ee71f 100644 --- a/src/state/backendNetworks/backendNetworks.ts +++ b/src/state/backendNetworks/backendNetworks.ts @@ -6,9 +6,9 @@ import { createRainbowStore } from '@/state/internal/createRainbowStore'; import { Chain } from 'viem/chains'; import { transformBackendNetworksToChains } from '@/state/backendNetworks/utils'; import { IS_TEST } from '@/env'; -import { BackendNetwork, BackendNetworkServices, chainHardhat, chainHardhatOptimism, ChainId } from '@/state/backendNetworks/types'; +import { BackendNetwork, BackendNetworkServices, chainAnvil, chainAnvilOptimism, ChainId } from '@/state/backendNetworks/types'; import { GasSpeed } from '@/__swaps__/types/gas'; -import { useConnectedToHardhatStore } from '@/state/connectedToHardhat'; +import { useConnectedToAnvilStore } from '@/state/connectedToAnvil'; import { colors as globalColors } from '@/styles'; const INITIAL_BACKEND_NETWORKS = queryClient.getQueryData(backendNetworksQueryKey()) ?? buildTimeNetworks; @@ -76,7 +76,7 @@ export const useBackendNetworksStore = createRainbowStore( getSupportedChains: () => { const backendChains = get().getBackendChains(); - return IS_TEST ? [...backendChains, chainHardhat, chainHardhatOptimism] : backendChains; + return IS_TEST ? [...backendChains, chainAnvil, chainAnvilOptimism] : backendChains; }, getSortedSupportedChainIds: () => { @@ -363,8 +363,8 @@ export const useBackendNetworksStore = createRainbowStore( const defaultChains = get().getDefaultChains(); switch (chainId) { case ChainId.mainnet: - return useConnectedToHardhatStore.getState().connectedToHardhat - ? chainHardhat.rpcUrls.default.http[0] + return useConnectedToAnvilStore.getState().connectedToAnvil + ? chainAnvil.rpcUrls.default.http[0] : defaultChains[ChainId.mainnet].rpcUrls.default.http[0]; default: return defaultChains[chainId].rpcUrls.default.http[0]; @@ -391,7 +391,7 @@ export const getBackendChainsWorklet = (backendNetworks: SharedValue) => { 'worklet'; const backendChains = getBackendChainsWorklet(backendNetworks); - return IS_TEST ? [...backendChains, chainHardhat, chainHardhatOptimism] : backendChains; + return IS_TEST ? [...backendChains, chainAnvil, chainAnvilOptimism] : backendChains; }; export const getDefaultChainsWorklet = (backendNetworks: SharedValue) => { @@ -660,7 +660,7 @@ export const getChainDefaultRpcWorklet = (backendNetworks: SharedValue void; + + connectedToAnvilOp: boolean; + setConnectedToAnvilOp: (connectedToAnvilOp: boolean) => void; +} + +export const useConnectedToAnvilStore = createRainbowStore( + set => ({ + connectedToAnvil: false, + setConnectedToAnvil: connectedToAnvil => { + set({ connectedToAnvil }); + }, + + connectedToAnvilOp: false, + setConnectedToAnvilOp: connectedToAnvilOp => { + set({ connectedToAnvilOp }); + }, + }), + { + storageKey: 'connectedToAnvil', + version: 0, + } +); diff --git a/src/state/connectedToHardhat/index.ts b/src/state/connectedToHardhat/index.ts deleted file mode 100644 index 362d70e577e..00000000000 --- a/src/state/connectedToHardhat/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createRainbowStore } from '../internal/createRainbowStore'; - -export interface ConnectedToHardhatState { - connectedToHardhat: boolean; - setConnectedToHardhat: (connectedToHardhat: boolean) => void; - - connectedToHardhatOp: boolean; - setConnectedToHardhatOp: (connectedToHardhatOp: boolean) => void; -} - -export const useConnectedToHardhatStore = createRainbowStore( - set => ({ - connectedToHardhat: false, - setConnectedToHardhat: connectedToHardhat => { - set({ connectedToHardhat }); - }, - - connectedToHardhatOp: false, - setConnectedToHardhatOp: connectedToHardhatOp => { - set({ connectedToHardhatOp }); - }, - }), - { - storageKey: 'connectedToHardhat', - version: 0, - } -); diff --git a/src/utils/branch.ts b/src/utils/branch.ts index c0d47bdaa77..c44d0c8ca01 100644 --- a/src/utils/branch.ts +++ b/src/utils/branch.ts @@ -2,10 +2,10 @@ import pako from 'pako'; import qs from 'qs'; import branch from 'react-native-branch'; -import { IS_TESTING } from 'react-native-dotenv'; import { analyticsV2 } from '@/analytics'; import * as ls from '@/storage'; import { logger, RainbowError } from '@/logger'; +import { IS_TEST } from '@/env'; const isEmpty = (obj: T | undefined): obj is undefined => !obj || Object.keys(obj).length === 0; @@ -86,7 +86,7 @@ export const branchListener = async (handleOpenLinkingURL: (url: string) => void */ logger.debug(`[branchListener]: handling event where no link was opened`, {}, logger.DebugContext.deeplinks); - if (IS_TESTING === 'true' && !!uri) { + if (IS_TEST && !!uri) { handleOpenLinkingURL(uri); } } else if (params.uri && typeof params.uri === 'string') { diff --git a/src/utils/reviewAlert.ts b/src/utils/reviewAlert.ts index dfbda01e918..767b305e2ba 100644 --- a/src/utils/reviewAlert.ts +++ b/src/utils/reviewAlert.ts @@ -3,8 +3,8 @@ import * as ls from '@/storage'; import { WrappedAlert as Alert } from '@/helpers/alert'; import { ReviewPromptAction } from '@/storage/schema'; import { logger, RainbowError } from '@/logger'; -import { IS_TESTING } from 'react-native-dotenv'; import * as StoreReview from 'expo-store-review'; +import { IS_TEST } from '@/env'; export const AppleReviewAddress = 'itms-apps://itunes.apple.com/us/app/appName/id1457119021?mt=8&action=write-review'; @@ -29,7 +29,7 @@ export const numberOfTimesBeforePrompt: { export const handleReviewPromptAction = async (action: ReviewPromptAction) => { logger.debug(`[reviewAlert]: handleReviewPromptAction: ${action}`); - if (IS_TESTING === 'true') { + if (IS_TEST) { return; } diff --git a/yarn.lock b/yarn.lock index b5fbcfce5a1..0c47a4cd051 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2240,52 +2240,6 @@ __metadata: languageName: node linkType: hard -"@chainsafe/as-sha256@npm:^0.3.1": - version: 0.3.1 - resolution: "@chainsafe/as-sha256@npm:0.3.1" - checksum: 10c0/72561fc6552a53e4d1fc28880b7f82ecb7a997670568333cb479f323db9482a6a59dd9d0f915210703e51c3a4ca2701ccdb4c66a0202abab4872d81184c9212e - languageName: node - linkType: hard - -"@chainsafe/persistent-merkle-tree@npm:^0.4.2": - version: 0.4.2 - resolution: "@chainsafe/persistent-merkle-tree@npm:0.4.2" - dependencies: - "@chainsafe/as-sha256": "npm:^0.3.1" - checksum: 10c0/9533e478a1a990e8cf8710a2eeb84c6f08c7b61726a43dbe2165316256839c29a2ff17923bce5e5effec446d832de8b0a5bc896ef5db80bce059af5d1bd20d8d - languageName: node - linkType: hard - -"@chainsafe/persistent-merkle-tree@npm:^0.5.0": - version: 0.5.0 - resolution: "@chainsafe/persistent-merkle-tree@npm:0.5.0" - dependencies: - "@chainsafe/as-sha256": "npm:^0.3.1" - checksum: 10c0/73c7a7536f49aceab61870fcc1dafef8a8be2ae0bfff2614846bb4b57a21939da75bca7bc5d1959cd312a5133be0acaf0e30fb323410c57592e9ec384758efe0 - languageName: node - linkType: hard - -"@chainsafe/ssz@npm:^0.10.0": - version: 0.10.2 - resolution: "@chainsafe/ssz@npm:0.10.2" - dependencies: - "@chainsafe/as-sha256": "npm:^0.3.1" - "@chainsafe/persistent-merkle-tree": "npm:^0.5.0" - checksum: 10c0/be427eba9f9c4a542326f9f3c20eb704c1c2500c4f124ba18febf6ffd5bb7bd5755228d99326bf6c4e4d969daa4b6ff2efb743688ec36ef86f20c0c673c0e967 - languageName: node - linkType: hard - -"@chainsafe/ssz@npm:^0.9.2": - version: 0.9.4 - resolution: "@chainsafe/ssz@npm:0.9.4" - dependencies: - "@chainsafe/as-sha256": "npm:^0.3.1" - "@chainsafe/persistent-merkle-tree": "npm:^0.4.2" - case: "npm:^1.6.3" - checksum: 10c0/4ce4b867c60dbee98772fe075037c7ef9a7894f97a4fb04f3cfd57e11fa683b8c23a4d80b53592d10fbd4e2abac43c9099181cfaee587619366f49091b9e5fcb - languageName: node - linkType: hard - "@coinbase/mobile-wallet-protocol-host@npm:0.1.7": version: 0.1.7 resolution: "@coinbase/mobile-wallet-protocol-host@npm:0.1.7" @@ -2517,7 +2471,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/abi@npm:5.7.0, @ethersproject/abi@npm:^5.0.1, @ethersproject/abi@npm:^5.1.2, @ethersproject/abi@npm:^5.5.0, @ethersproject/abi@npm:^5.7.0": +"@ethersproject/abi@npm:5.7.0, @ethersproject/abi@npm:^5.0.1, @ethersproject/abi@npm:^5.5.0, @ethersproject/abi@npm:^5.7.0": version: 5.7.0 resolution: "@ethersproject/abi@npm:5.7.0" dependencies: @@ -2772,7 +2726,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/providers@npm:5.7.2, @ethersproject/providers@npm:^5.7.1, @ethersproject/providers@npm:^5.7.2": +"@ethersproject/providers@npm:5.7.2": version: 5.7.2 resolution: "@ethersproject/providers@npm:5.7.2" dependencies: @@ -3411,13 +3365,6 @@ __metadata: languageName: node linkType: hard -"@fastify/busboy@npm:^2.0.0": - version: 2.1.1 - resolution: "@fastify/busboy@npm:2.1.1" - checksum: 10c0/6f8027a8cba7f8f7b736718b013f5a38c0476eea67034c94a0d3c375e2b114366ad4419e6a6fa7ffc2ef9c6d3e0435d76dd584a7a1cbac23962fda7650b579e3 - languageName: node - linkType: hard - "@flatten-js/interval-tree@npm:^1.1.2": version: 1.1.3 resolution: "@flatten-js/interval-tree@npm:1.1.3" @@ -4315,19 +4262,6 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-sig-util@npm:^4.0.0": - version: 4.0.1 - resolution: "@metamask/eth-sig-util@npm:4.0.1" - dependencies: - ethereumjs-abi: "npm:^0.6.8" - ethereumjs-util: "npm:^6.2.1" - ethjs-util: "npm:^0.1.6" - tweetnacl: "npm:^1.0.3" - tweetnacl-util: "npm:^0.15.1" - checksum: 10c0/957fa16e8f0454ad45203a8416e77181853de1c9e33697f1a1582d46f18da1cca26c803a4e08bee7091a697609fc8916f399210fd5d3d2fccc34bfd0a58715f0 - languageName: node - linkType: hard - "@metamask/superstruct@npm:^3.0.0, @metamask/superstruct@npm:^3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" @@ -4468,13 +4402,6 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.2.0, @noble/hashes@npm:~1.2.0": - version: 1.2.0 - resolution: "@noble/hashes@npm:1.2.0" - checksum: 10c0/8bd3edb7bb6a9068f806a9a5a208cc2144e42940a21c049d8e9a0c23db08bef5cf1cfd844a7e35489b5ab52c6fa6299352075319e7f531e0996d459c38cfe26a - languageName: node - linkType: hard - "@noble/hashes@npm:1.3.2": version: 1.3.2 resolution: "@noble/hashes@npm:1.3.2" @@ -4510,13 +4437,6 @@ __metadata: languageName: node linkType: hard -"@noble/secp256k1@npm:1.7.1, @noble/secp256k1@npm:~1.7.0": - version: 1.7.1 - resolution: "@noble/secp256k1@npm:1.7.1" - checksum: 10c0/48091801d39daba75520012027d0ff0b1719338d96033890cfe0d287ad75af00d82769c0194a06e7e4fbd816ae3f204f4a59c9e26f0ad16b429f7e9b5403ccd5 - languageName: node - linkType: hard - "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -4544,266 +4464,6 @@ __metadata: languageName: node linkType: hard -"@nomicfoundation/ethereumjs-block@npm:5.0.2": - version: 5.0.2 - resolution: "@nomicfoundation/ethereumjs-block@npm:5.0.2" - dependencies: - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-trie": "npm:6.0.2" - "@nomicfoundation/ethereumjs-tx": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - ethereum-cryptography: "npm:0.1.3" - ethers: "npm:^5.7.1" - checksum: 10c0/9bbf524706c86b3741eab42a82bce723ef413f2ecd85bc96b6353f619559780995bc21fcf765558a3a7ab5eca5c77926ae7440fe2467774d896f67ec9bfcd63e - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-blockchain@npm:7.0.2": - version: 7.0.2 - resolution: "@nomicfoundation/ethereumjs-blockchain@npm:7.0.2" - dependencies: - "@nomicfoundation/ethereumjs-block": "npm:5.0.2" - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-ethash": "npm:3.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-trie": "npm:6.0.2" - "@nomicfoundation/ethereumjs-tx": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - abstract-level: "npm:^1.0.3" - debug: "npm:^4.3.3" - ethereum-cryptography: "npm:0.1.3" - level: "npm:^8.0.0" - lru-cache: "npm:^5.1.1" - memory-level: "npm:^1.0.0" - checksum: 10c0/388f938288396669108e6513c531e81d02d994dabcbf96261dd6672a882dfd4966cf9e05fd0c98d50c7aef847335a588b21dd0acba9d923cc734f4f61a7a77ba - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-common@npm:4.0.2": - version: 4.0.2 - resolution: "@nomicfoundation/ethereumjs-common@npm:4.0.2" - dependencies: - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - crc-32: "npm:^1.2.0" - checksum: 10c0/ce12038b8b3245a2a20b8a11fe19b4454a8179b7a1bb9185cd42a85b5a17f7fceacf0bf69517d095b52e3cede4eeda71a45044a5a8976f3f37e2d501f0adaea3 - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-ethash@npm:3.0.2": - version: 3.0.2 - resolution: "@nomicfoundation/ethereumjs-ethash@npm:3.0.2" - dependencies: - "@nomicfoundation/ethereumjs-block": "npm:5.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - abstract-level: "npm:^1.0.3" - bigint-crypto-utils: "npm:^3.0.23" - ethereum-cryptography: "npm:0.1.3" - checksum: 10c0/0a19f9243e9cc348e13bff0b0ec5ec9612c275550c5b0a3028b466f39e0959dd8c0eeeae7fc0c9af920023143658dbb18d87107167af344de92e76aaf683dcc4 - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-evm@npm:2.0.2": - version: 2.0.2 - resolution: "@nomicfoundation/ethereumjs-evm@npm:2.0.2" - dependencies: - "@ethersproject/providers": "npm:^5.7.1" - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-tx": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - debug: "npm:^4.3.3" - ethereum-cryptography: "npm:0.1.3" - mcl-wasm: "npm:^0.7.1" - rustbn.js: "npm:~0.2.0" - checksum: 10c0/a5711952d8afe1c61c3e8275217b7c3bd600de839ad784848ff556c498fee4d0c0a29834aa2c666263915ed6123a3191297c109bad8e50c135dd9de33d101cd7 - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-rlp@npm:5.0.2": - version: 5.0.2 - resolution: "@nomicfoundation/ethereumjs-rlp@npm:5.0.2" - bin: - rlp: bin/rlp - checksum: 10c0/46c7d317f59690973c41786b7a3ef3abe456efd085d55a0b202f6ead792e34e1a0749815911ab558b83f508c4ae5a6cba4d994aeae9c77c14ce0516f284ed34b - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-statemanager@npm:2.0.2": - version: 2.0.2 - resolution: "@nomicfoundation/ethereumjs-statemanager@npm:2.0.2" - dependencies: - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - debug: "npm:^4.3.3" - ethereum-cryptography: "npm:0.1.3" - ethers: "npm:^5.7.1" - js-sdsl: "npm:^4.1.4" - checksum: 10c0/d3b184adb1b8aaf4c87299194746fc343a94df6f500d677f04a36914f7673eee19c344eb88a6f78718dcb4ae15d63c2c3e87cb9a5076950b67843e5bf9321ace - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-trie@npm:6.0.2": - version: 6.0.2 - resolution: "@nomicfoundation/ethereumjs-trie@npm:6.0.2" - dependencies: - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - "@types/readable-stream": "npm:^2.3.13" - ethereum-cryptography: "npm:0.1.3" - readable-stream: "npm:^3.6.0" - checksum: 10c0/188c5d0a5793fb4512916091bde498e52ec6ecb374963213602f32e98c301d4d62f2daefd4ebefc0944d6d5b8346f104156fa544c0fc26ded488884a0424b2cc - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-tx@npm:5.0.2": - version: 5.0.2 - resolution: "@nomicfoundation/ethereumjs-tx@npm:5.0.2" - dependencies: - "@chainsafe/ssz": "npm:^0.9.2" - "@ethersproject/providers": "npm:^5.7.2" - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - ethereum-cryptography: "npm:0.1.3" - checksum: 10c0/327c093656b4f6e845c3ef543b6ab54f6699436d95e18d0fca9df930dd2ddb975374b2499b3f98070cae4e6f54005b0484c1b40ff1838326cf5a631710116def - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-util@npm:9.0.2": - version: 9.0.2 - resolution: "@nomicfoundation/ethereumjs-util@npm:9.0.2" - dependencies: - "@chainsafe/ssz": "npm:^0.10.0" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - ethereum-cryptography: "npm:0.1.3" - checksum: 10c0/34b5b73f2e23bd883e53fd4d6810954d08451c84887b3d7c8910c093825686c499fe0edbb865db8d064c6790b447ce10f1aea030073befd64dbe62b75126dac6 - languageName: node - linkType: hard - -"@nomicfoundation/ethereumjs-vm@npm:7.0.2": - version: 7.0.2 - resolution: "@nomicfoundation/ethereumjs-vm@npm:7.0.2" - dependencies: - "@nomicfoundation/ethereumjs-block": "npm:5.0.2" - "@nomicfoundation/ethereumjs-blockchain": "npm:7.0.2" - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-evm": "npm:2.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-statemanager": "npm:2.0.2" - "@nomicfoundation/ethereumjs-trie": "npm:6.0.2" - "@nomicfoundation/ethereumjs-tx": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - debug: "npm:^4.3.3" - ethereum-cryptography: "npm:0.1.3" - mcl-wasm: "npm:^0.7.1" - rustbn.js: "npm:~0.2.0" - checksum: 10c0/759c16d471429e06b8a191b3b87c140690e6334586b5467587e7397e7e40dc0ec6aea4a73cea68a1ace125552beefc23624a6e667387031f5379000e56f83018 - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer-darwin-arm64@npm:0.1.2": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer-darwin-arm64@npm:0.1.2" - checksum: 10c0/ef3b13bb2133fea6621db98f991036a3a84d2b240160edec50beafa6ce821fe2f0f5cd4aa61adb9685aff60cd0425982ffd15e0b868b7c768e90e26b8135b825 - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer-darwin-x64@npm:0.1.2": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer-darwin-x64@npm:0.1.2" - checksum: 10c0/3cb6a00cd200b94efd6f59ed626c705c6f773b92ccf8b90471285cd0e81b35f01edb30c1aa5a4633393c2adb8f20fd34e90c51990dc4e30658e8a67c026d16c9 - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer-linux-arm64-gnu@npm:0.1.2": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer-linux-arm64-gnu@npm:0.1.2" - checksum: 10c0/cb9725e7bdc3ba9c1feaef96dbf831c1a59c700ca633a9929fd97debdcb5ce06b5d7b4e6dbc076279978707214d01e2cd126d8e3f4cabc5c16525c031a47b95c - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer-linux-arm64-musl@npm:0.1.2": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer-linux-arm64-musl@npm:0.1.2" - checksum: 10c0/82a90b1d09ad266ddc510ece2e397f51fdaf29abf7263d2a3a85accddcba2ac24cceb670a3120800611cdcc552eed04919d071e259fdda7564818359ed541f5d - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer-linux-x64-gnu@npm:0.1.2": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer-linux-x64-gnu@npm:0.1.2" - checksum: 10c0/d1f20d4d55683bd041ead957e5461b2e43a39e959f905e8866de1d65f8d96118e9b861e994604d9002cb7f056be0844e36c241a6bb531c336b399609977c0998 - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer-linux-x64-musl@npm:0.1.2": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer-linux-x64-musl@npm:0.1.2" - checksum: 10c0/6c17f9af3aaf184c0a217cf723076051c502d85e731dbc97f34b838f9ae1b597577abac54a2af49b3fd986b09131c52fa21fd5393b22d05e1ec7fee96a8249c2 - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer-win32-x64-msvc@npm:0.1.2": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer-win32-x64-msvc@npm:0.1.2" - checksum: 10c0/da198464f5ee0d19b6decdfaa65ee0df3097b8960b8483bb7080931968815a5d60f27191229d47a198955784d763d5996f0b92bfde3551612ad972c160b0b000 - languageName: node - linkType: hard - -"@nomicfoundation/solidity-analyzer@npm:^0.1.0": - version: 0.1.2 - resolution: "@nomicfoundation/solidity-analyzer@npm:0.1.2" - dependencies: - "@nomicfoundation/solidity-analyzer-darwin-arm64": "npm:0.1.2" - "@nomicfoundation/solidity-analyzer-darwin-x64": "npm:0.1.2" - "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "npm:0.1.2" - "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "npm:0.1.2" - "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "npm:0.1.2" - "@nomicfoundation/solidity-analyzer-linux-x64-musl": "npm:0.1.2" - "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "npm:0.1.2" - dependenciesMeta: - "@nomicfoundation/solidity-analyzer-darwin-arm64": - optional: true - "@nomicfoundation/solidity-analyzer-darwin-x64": - optional: true - "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": - optional: true - "@nomicfoundation/solidity-analyzer-linux-arm64-musl": - optional: true - "@nomicfoundation/solidity-analyzer-linux-x64-gnu": - optional: true - "@nomicfoundation/solidity-analyzer-linux-x64-musl": - optional: true - "@nomicfoundation/solidity-analyzer-win32-x64-msvc": - optional: true - checksum: 10c0/e4f503e9287e18967535af669ca7e26e2682203c45a34ea85da53122da1dee1278f2b8c76c20c67fadd7c1b1a98eeecffd2cbc136860665e3afa133817c0de54 - languageName: node - linkType: hard - -"@nomiclabs/hardhat-ethers@npm:2.2.3": - version: 2.2.3 - resolution: "@nomiclabs/hardhat-ethers@npm:2.2.3" - peerDependencies: - ethers: ^5.0.0 - hardhat: ^2.0.0 - checksum: 10c0/cae46d1966108ab02b50fabe7945c8987fa1e9d5d0a7a06f79afc274ff1abc312e8a82375191a341b28571b897c22433d3a2826eb30077ed88d5983d01e381d0 - languageName: node - linkType: hard - -"@nomiclabs/hardhat-waffle@npm:2.0.6": - version: 2.0.6 - resolution: "@nomiclabs/hardhat-waffle@npm:2.0.6" - peerDependencies: - "@nomiclabs/hardhat-ethers": ^2.0.0 - "@types/sinon-chai": ^3.2.3 - ethereum-waffle: "*" - ethers: ^5.0.0 - hardhat: ^2.0.0 - checksum: 10c0/9614ab1e76959cfccc586842d990de4c2aa74cea8e82a838d017d91d4c696df931af4a77af9c16325e037ec8438a8c98c9bae5d9e4d0d0fcdaa147c86bce01b5 - languageName: node - linkType: hard - "@notifee/react-native@npm:7.8.2": version: 7.8.2 resolution: "@notifee/react-native@npm:7.8.2" @@ -6431,17 +6091,6 @@ __metadata: languageName: node linkType: hard -"@scure/bip32@npm:1.1.5": - version: 1.1.5 - resolution: "@scure/bip32@npm:1.1.5" - dependencies: - "@noble/hashes": "npm:~1.2.0" - "@noble/secp256k1": "npm:~1.7.0" - "@scure/base": "npm:~1.1.0" - checksum: 10c0/d0521f6de28278e06f2d517307b4de6c9bcb3dbdf9a5844bb57a6e4916a180e4136129ccab295c27bd1196ef77757608255afcd7cf927e03baec4479b3df74fc - languageName: node - linkType: hard - "@scure/bip32@npm:1.3.2": version: 1.3.2 resolution: "@scure/bip32@npm:1.3.2" @@ -6475,16 +6124,6 @@ __metadata: languageName: node linkType: hard -"@scure/bip39@npm:1.1.1": - version: 1.1.1 - resolution: "@scure/bip39@npm:1.1.1" - dependencies: - "@noble/hashes": "npm:~1.2.0" - "@scure/base": "npm:~1.1.0" - checksum: 10c0/821dc9d5be8362a32277390526db064860c2216a079ba51d63def9289c2b290599e93681ebbeebf0e93540799eec35784c1dfcf5167d0b280ef148e5023ce01b - languageName: node - linkType: hard - "@scure/bip39@npm:1.2.1": version: 1.2.1 resolution: "@scure/bip39@npm:1.2.1" @@ -6681,19 +6320,6 @@ __metadata: languageName: node linkType: hard -"@sentry/core@npm:5.30.0": - version: 5.30.0 - resolution: "@sentry/core@npm:5.30.0" - dependencies: - "@sentry/hub": "npm:5.30.0" - "@sentry/minimal": "npm:5.30.0" - "@sentry/types": "npm:5.30.0" - "@sentry/utils": "npm:5.30.0" - tslib: "npm:^1.9.3" - checksum: 10c0/6407b9c2a6a56f90c198f5714b3257df24d89d1b4ca6726bd44760d0adabc25798b69fef2c88ccea461c7e79e3c78861aaebfd51fd3cb892aee656c3f7e11801 - languageName: node - linkType: hard - "@sentry/core@npm:7.119.0": version: 7.119.0 resolution: "@sentry/core@npm:7.119.0" @@ -6714,17 +6340,6 @@ __metadata: languageName: node linkType: hard -"@sentry/hub@npm:5.30.0": - version: 5.30.0 - resolution: "@sentry/hub@npm:5.30.0" - dependencies: - "@sentry/types": "npm:5.30.0" - "@sentry/utils": "npm:5.30.0" - tslib: "npm:^1.9.3" - checksum: 10c0/386c91d06aa44be0465fc11330d748a113e464d41cd562a9e1d222a682cbcb14e697a3e640953e7a0239997ad8a02b223a0df3d9e1d8816cb823fd3613be3e2f - languageName: node - linkType: hard - "@sentry/hub@npm:7.119.0": version: 7.119.0 resolution: "@sentry/hub@npm:7.119.0" @@ -6760,34 +6375,6 @@ __metadata: languageName: node linkType: hard -"@sentry/minimal@npm:5.30.0": - version: 5.30.0 - resolution: "@sentry/minimal@npm:5.30.0" - dependencies: - "@sentry/hub": "npm:5.30.0" - "@sentry/types": "npm:5.30.0" - tslib: "npm:^1.9.3" - checksum: 10c0/34ec05503de46d01f98c94701475d5d89cc044892c86ccce30e01f62f28344eb23b718e7cf573815e46f30a4ac9da3129bed9b3d20c822938acfb40cbe72437b - languageName: node - linkType: hard - -"@sentry/node@npm:^5.18.1": - version: 5.30.0 - resolution: "@sentry/node@npm:5.30.0" - dependencies: - "@sentry/core": "npm:5.30.0" - "@sentry/hub": "npm:5.30.0" - "@sentry/tracing": "npm:5.30.0" - "@sentry/types": "npm:5.30.0" - "@sentry/utils": "npm:5.30.0" - cookie: "npm:^0.4.1" - https-proxy-agent: "npm:^5.0.0" - lru_map: "npm:^0.3.3" - tslib: "npm:^1.9.3" - checksum: 10c0/c50db7c81ace57cac17692245c2ab3c84a6149183f81d5f2dfd157eaa7b66eb4d6a727dd13a754bb129c96711389eec2944cd94126722ee1d8b11f2b627b830d - languageName: node - linkType: hard - "@sentry/react-native@npm:5.35.0": version: 5.35.0 resolution: "@sentry/react-native@npm:5.35.0" @@ -6841,26 +6428,6 @@ __metadata: languageName: node linkType: hard -"@sentry/tracing@npm:5.30.0": - version: 5.30.0 - resolution: "@sentry/tracing@npm:5.30.0" - dependencies: - "@sentry/hub": "npm:5.30.0" - "@sentry/minimal": "npm:5.30.0" - "@sentry/types": "npm:5.30.0" - "@sentry/utils": "npm:5.30.0" - tslib: "npm:^1.9.3" - checksum: 10c0/46830265bc54a3203d7d9f0d8d9f2f7d9d2c6a977e07ccdae317fa3ea29c388b904b3bef28f7a0ba9c074845d67feab63c6d3c0ddce9aeb275b6c966253fb415 - languageName: node - linkType: hard - -"@sentry/types@npm:5.30.0": - version: 5.30.0 - resolution: "@sentry/types@npm:5.30.0" - checksum: 10c0/99c6e55c0a82c8ca95be2e9dbb35f581b29e4ff7af74b23bc62b690de4e35febfa15868184a2303480ef86babd4fea5273cf3b5ddf4a27685b841a72f13a0c88 - languageName: node - linkType: hard - "@sentry/types@npm:7.119.0": version: 7.119.0 resolution: "@sentry/types@npm:7.119.0" @@ -6875,16 +6442,6 @@ __metadata: languageName: node linkType: hard -"@sentry/utils@npm:5.30.0": - version: 5.30.0 - resolution: "@sentry/utils@npm:5.30.0" - dependencies: - "@sentry/types": "npm:5.30.0" - tslib: "npm:^1.9.3" - checksum: 10c0/ca8eebfea7ac7db6d16f6c0b8a66ac62587df12a79ce9d0d8393f4d69880bb8d40d438f9810f7fb107a9880fe0d68bbf797b89cbafd113e89a0829eb06b205f8 - languageName: node - linkType: hard - "@sentry/utils@npm:7.119.0": version: 7.119.0 resolution: "@sentry/utils@npm:7.119.0" @@ -7666,13 +7223,6 @@ __metadata: languageName: node linkType: hard -"@types/lru-cache@npm:^5.1.0": - version: 5.1.1 - resolution: "@types/lru-cache@npm:5.1.1" - checksum: 10c0/1f17ec9b202c01a89337cc5528198a690be6b61a6688242125fbfb7fa17770e453e00e4685021abf5ae605860ca0722209faac5c254b780d0104730bb0b9e354 - languageName: node - linkType: hard - "@types/minimatch@npm:^3.0.3": version: 3.0.5 resolution: "@types/minimatch@npm:3.0.5" @@ -7854,16 +7404,6 @@ __metadata: languageName: node linkType: hard -"@types/readable-stream@npm:^2.3.13": - version: 2.3.15 - resolution: "@types/readable-stream@npm:2.3.15" - dependencies: - "@types/node": "npm:*" - safe-buffer: "npm:~5.1.1" - checksum: 10c0/789e0948a8fd2f2cbf880a0f8c95601ac2fd8782a5a8fe653f68fad7fc3a74f44e8559484e331c1ff5d5b00fa467bec97557bb683aa833a3b29a69506f7aee59 - languageName: node - linkType: hard - "@types/scheduler@npm:*": version: 0.23.0 resolution: "@types/scheduler@npm:0.23.0" @@ -9182,8 +8722,6 @@ __metadata: "@ledgerhq/hw-app-eth": "npm:6.39.0" "@ledgerhq/react-native-hw-transport-ble": "npm:6.33.4" "@metamask/eth-sig-util": "npm:7.0.2" - "@nomiclabs/hardhat-ethers": "npm:2.2.3" - "@nomiclabs/hardhat-waffle": "npm:2.0.6" "@notifee/react-native": "npm:7.8.2" "@rainbow-me/provider": "npm:0.1.1" "@rainbow-me/react-native-animated-number": "npm:0.0.2" @@ -9296,7 +8834,6 @@ __metadata: graphql-request: "npm:5.0.0" graphql-tag: "npm:2.11.0" gretchen: "npm:1.5.0" - hardhat: "npm:2.18.1" https-browserify: "npm:0.0.1" husky: "npm:8.0.1" i18n-js: "npm:3.8.0" @@ -9509,21 +9046,6 @@ __metadata: languageName: node linkType: hard -"abstract-level@npm:^1.0.0, abstract-level@npm:^1.0.2, abstract-level@npm:^1.0.3, abstract-level@npm:^1.0.4": - version: 1.0.4 - resolution: "abstract-level@npm:1.0.4" - dependencies: - buffer: "npm:^6.0.3" - catering: "npm:^2.1.0" - is-buffer: "npm:^2.0.5" - level-supports: "npm:^4.0.0" - level-transcoder: "npm:^1.0.1" - module-error: "npm:^1.0.1" - queue-microtask: "npm:^1.2.3" - checksum: 10c0/e89fad8924888b597ca84e6d003a424a670f225fd595ad1f4c2e2d38a5cea3c92877a44f5104cdede1717eb262dd6e7fbf7ef2375569c7395066521170b8d761 - languageName: node - linkType: hard - "abstract-leveldown@npm:2.6.1": version: 2.6.1 resolution: "abstract-leveldown@npm:2.6.1" @@ -9588,13 +9110,6 @@ __metadata: languageName: node linkType: hard -"adm-zip@npm:^0.4.16": - version: 0.4.16 - resolution: "adm-zip@npm:0.4.16" - checksum: 10c0/c56c6e138fd19006155fc716acae14d54e07c267ae19d78c8a8cdca04762bf20170a71a41aa8d8bad2f13b70d4f3e9a191009bafa5280e05a440ee506f871a55 - languageName: node - linkType: hard - "aes-js@npm:3.0.0": version: 3.0.0 resolution: "aes-js@npm:3.0.0" @@ -9699,7 +9214,7 @@ __metadata: languageName: node linkType: hard -"ansi-colors@npm:^4.1.1, ansi-colors@npm:^4.1.3": +"ansi-colors@npm:^4.1.1": version: 4.1.3 resolution: "ansi-colors@npm:4.1.3" checksum: 10c0/ec87a2f59902f74e61eada7f6e6fe20094a628dab765cfdbd03c3477599368768cffccdb5d3bb19a1b6c99126783a143b1fee31aab729b31ffe5836c7e5e28b9 @@ -10784,13 +10299,6 @@ __metadata: languageName: node linkType: hard -"bigint-crypto-utils@npm:^3.0.23": - version: 3.3.0 - resolution: "bigint-crypto-utils@npm:3.3.0" - checksum: 10c0/7d06fa01d63e8e9513eee629fe8a426993276b1bdca5aefd0eb3188cee7026334d29e801ef6187a5bc6105ebf26e6e79e6fab544a7da769ccf55b913e66d2a14 - languageName: node - linkType: hard - "bignumber.js@npm:9.0.1": version: 9.0.1 resolution: "bignumber.js@npm:9.0.1" @@ -10992,18 +10500,6 @@ __metadata: languageName: node linkType: hard -"browser-level@npm:^1.0.1": - version: 1.0.1 - resolution: "browser-level@npm:1.0.1" - dependencies: - abstract-level: "npm:^1.0.2" - catering: "npm:^2.1.1" - module-error: "npm:^1.0.2" - run-parallel-limit: "npm:^1.1.0" - checksum: 10c0/10f874b05fb06092c4dc3f7b02c1bcff9b01b8eee2a7066837a10c4b0179d40dd9ecef03bfecb9acbd0b61abf67ccd250766ee18b48464cd9a4eeddda1b069b9 - languageName: node - linkType: hard - "browser-process-hrtime@npm:^1.0.0": version: 1.0.0 resolution: "browser-process-hrtime@npm:1.0.0" @@ -11011,13 +10507,6 @@ __metadata: languageName: node linkType: hard -"browser-stdout@npm:^1.3.1": - version: 1.3.1 - resolution: "browser-stdout@npm:1.3.1" - checksum: 10c0/c40e482fd82be872b6ea7b9f7591beafbf6f5ba522fe3dade98ba1573a1c29a11101564993e4eb44e5488be8f44510af072df9a9637c739217eb155ceb639205 - languageName: node - linkType: hard - "browserify-aes@npm:^1.0.4, browserify-aes@npm:^1.2.0": version: 1.2.0 resolution: "browserify-aes@npm:1.2.0" @@ -11312,13 +10801,6 @@ __metadata: languageName: node linkType: hard -"bytes@npm:3.1.2": - version: 3.1.2 - resolution: "bytes@npm:3.1.2" - checksum: 10c0/76d1c43cbd602794ad8ad2ae94095cddeb1de78c5dddaa7005c51af10b0176c69971a6d88e805a90c2b6550d76636e43c40d8427a808b8645ede885de4a0358e - languageName: node - linkType: hard - "cacache@npm:^16.1.0": version: 16.1.3 resolution: "cacache@npm:16.1.3" @@ -11478,20 +10960,6 @@ __metadata: languageName: node linkType: hard -"case@npm:^1.6.3": - version: 1.6.3 - resolution: "case@npm:1.6.3" - checksum: 10c0/43fcbb1dff1c4add94dd2bc98bd923d6616f10bff6959adf686d192c3db7d7ced35410761e1ac94cc4a1f5c41c86406ad79d390805539e421e8a77e553f67223 - languageName: node - linkType: hard - -"catering@npm:^2.1.0, catering@npm:^2.1.1": - version: 2.1.1 - resolution: "catering@npm:2.1.1" - checksum: 10c0/a69f946f82cba85509abcb399759ed4c39d2cc9e33ba35674f242130c1b3c56673da3c3e85804db6898dfd966c395aa128ba484b31c7b906cc2faca6a581e133 - languageName: node - linkType: hard - "centra@npm:^2.7.0": version: 2.7.0 resolution: "centra@npm:2.7.0" @@ -11597,7 +11065,7 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^3.4.0, chokidar@npm:^3.5.3, chokidar@npm:^3.6.0": +"chokidar@npm:^3.6.0": version: 3.6.0 resolution: "chokidar@npm:3.6.0" dependencies: @@ -11731,20 +11199,6 @@ __metadata: languageName: node linkType: hard -"classic-level@npm:^1.2.0": - version: 1.4.1 - resolution: "classic-level@npm:1.4.1" - dependencies: - abstract-level: "npm:^1.0.2" - catering: "npm:^2.1.0" - module-error: "npm:^1.0.1" - napi-macros: "npm:^2.2.2" - node-gyp: "npm:latest" - node-gyp-build: "npm:^4.3.0" - checksum: 10c0/ba769e0b558ab466cef9468f7494b67d8f0139768630ba184d67b33201e67aad274718f3b1b78aaf3c5f5ab4cc526971edf82c7060741031bbad357952e7304d - languageName: node - linkType: hard - "classnames@npm:^2.2.6": version: 2.5.1 resolution: "classnames@npm:2.5.1" @@ -12074,13 +11528,6 @@ __metadata: languageName: node linkType: hard -"commander@npm:3.0.2": - version: 3.0.2 - resolution: "commander@npm:3.0.2" - checksum: 10c0/8a279b4bacde68f03664086260ccb623122d2bdae6f380a41c9e06b646e830372c30a4b88261238550e0ad69d53f7af8883cb705d8237fdd22947e84913b149c - languageName: node - linkType: hard - "commander@npm:^10.0.1": version: 10.0.1 resolution: "commander@npm:10.0.1" @@ -12271,13 +11718,6 @@ __metadata: languageName: node linkType: hard -"cookie@npm:^0.4.1": - version: 0.4.2 - resolution: "cookie@npm:0.4.2" - checksum: 10c0/beab41fbd7c20175e3a2799ba948c1dcc71ef69f23fe14eeeff59fc09f50c517b0f77098db87dbb4c55da802f9d86ee86cdc1cd3efd87760341551838d53fca2 - languageName: node - linkType: hard - "copy-descriptor@npm:^0.1.0": version: 0.1.1 resolution: "copy-descriptor@npm:0.1.1" @@ -12824,7 +12264,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:~4.3.1, debug@npm:~4.3.2": +"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:~4.3.1, debug@npm:~4.3.2": version: 4.3.5 resolution: "debug@npm:4.3.5" dependencies: @@ -13416,13 +12856,6 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.2.0": - version: 5.2.0 - resolution: "diff@npm:5.2.0" - checksum: 10c0/aed0941f206fe261ecb258dc8d0ceea8abbde3ace5827518ff8d302f0fc9cc81ce116c4d8f379151171336caf0516b79e01abdc1ed1201b6440d895a66689eb4 - languageName: node - linkType: hard - "diffie-hellman@npm:^5.0.0": version: 5.0.3 resolution: "diffie-hellman@npm:5.0.3" @@ -13836,7 +13269,7 @@ __metadata: languageName: node linkType: hard -"enquirer@npm:^2.3.0, enquirer@npm:^2.3.5, enquirer@npm:^2.3.6": +"enquirer@npm:^2.3.5, enquirer@npm:^2.3.6": version: 2.4.1 resolution: "enquirer@npm:2.4.1" dependencies: @@ -14556,7 +13989,7 @@ __metadata: languageName: node linkType: hard -"ethereum-cryptography@npm:0.1.3, ethereum-cryptography@npm:^0.1.3": +"ethereum-cryptography@npm:^0.1.3": version: 0.1.3 resolution: "ethereum-cryptography@npm:0.1.3" dependencies: @@ -14579,18 +14012,6 @@ __metadata: languageName: node linkType: hard -"ethereum-cryptography@npm:^1.0.3": - version: 1.2.0 - resolution: "ethereum-cryptography@npm:1.2.0" - dependencies: - "@noble/hashes": "npm:1.2.0" - "@noble/secp256k1": "npm:1.7.1" - "@scure/bip32": "npm:1.1.5" - "@scure/bip39": "npm:1.1.1" - checksum: 10c0/93e486a4a8b266dc2f274b69252e751345ef47551163371939b01231afb7b519133e2572b5975bb9cb4cc77ac54ccd36002c7c759a72488abeeaf216e4d55b46 - languageName: node - linkType: hard - "ethereum-cryptography@npm:^2.0.0, ethereum-cryptography@npm:^2.1.2": version: 2.2.1 resolution: "ethereum-cryptography@npm:2.2.1" @@ -14603,17 +14024,7 @@ __metadata: languageName: node linkType: hard -"ethereumjs-abi@npm:^0.6.8": - version: 0.6.8 - resolution: "ethereumjs-abi@npm:0.6.8" - dependencies: - bn.js: "npm:^4.11.8" - ethereumjs-util: "npm:^6.0.0" - checksum: 10c0/a7ff1917625e3c812cb3bca6c1231fc0ece282cc7d202d60545a9c31cd379fd751bfed5ff78dae4279cb1ba4d0e8967f9fdd4f135a334a38dbf04e7afd0c4bcf - languageName: node - linkType: hard - -"ethereumjs-util@npm:6.2.1, ethereumjs-util@npm:^6.0.0, ethereumjs-util@npm:^6.2.1": +"ethereumjs-util@npm:6.2.1": version: 6.2.1 resolution: "ethereumjs-util@npm:6.2.1" dependencies: @@ -14657,7 +14068,7 @@ __metadata: languageName: node linkType: hard -"ethers@npm:5.7.2, ethers@npm:^5.7.1": +"ethers@npm:5.7.2": version: 5.7.2 resolution: "ethers@npm:5.7.2" dependencies: @@ -15416,15 +14827,6 @@ __metadata: languageName: node linkType: hard -"find-up@npm:^2.1.0": - version: 2.1.0 - resolution: "find-up@npm:2.1.0" - dependencies: - locate-path: "npm:^2.0.0" - checksum: 10c0/c080875c9fe28eb1962f35cbe83c683796a0321899f1eed31a37577800055539815de13d53495049697d3ba313013344f843bb9401dd337a1b832be5edfc6840 - languageName: node - linkType: hard - "find-up@npm:^3.0.0": version: 3.0.0 resolution: "find-up@npm:3.0.0" @@ -15539,7 +14941,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.12.1, follow-redirects@npm:^1.15.6": +"follow-redirects@npm:^1.15.6": version: 1.15.6 resolution: "follow-redirects@npm:1.15.6" peerDependenciesMeta: @@ -15636,20 +15038,6 @@ __metadata: languageName: node linkType: hard -"fp-ts@npm:1.19.3": - version: 1.19.3 - resolution: "fp-ts@npm:1.19.3" - checksum: 10c0/a016cfc98ad5e61564ab2d53a5379bbb8254642b66df13ced47e8c1d8d507abf4588d8bb43530198dfe1907211d8bae8f112cab52ba0ac6ab055da9168a6e260 - languageName: node - linkType: hard - -"fp-ts@npm:^1.0.0": - version: 1.19.5 - resolution: "fp-ts@npm:1.19.5" - checksum: 10c0/2a330fa1779561307740c26a7255fdffeb1ca2d0c7448d4dc094b477b772b0c8f7da1dfc88569b6f13f6958169b63b5df7361e514535b46b2e215bbf03a3722d - languageName: node - linkType: hard - "fragment-cache@npm:^0.2.1": version: 0.2.1 resolution: "fragment-cache@npm:0.2.1" @@ -15740,19 +15128,6 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:^0.30.0": - version: 0.30.0 - resolution: "fs-extra@npm:0.30.0" - dependencies: - graceful-fs: "npm:^4.1.2" - jsonfile: "npm:^2.1.0" - klaw: "npm:^1.0.0" - path-is-absolute: "npm:^1.0.0" - rimraf: "npm:^2.2.8" - checksum: 10c0/24f3c966018c7bf436bf38ca3a126f1d95bf0f82598302195c4f0c8887767f045dae308f92c53a39cead74631dabbc30fcf1c71dbe96f1f0148f6de8edd114bc - languageName: node - linkType: hard - "fs-extra@npm:^11.0.0": version: 11.2.0 resolution: "fs-extra@npm:11.2.0" @@ -15764,17 +15139,6 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:^7.0.1": - version: 7.0.1 - resolution: "fs-extra@npm:7.0.1" - dependencies: - graceful-fs: "npm:^4.1.2" - jsonfile: "npm:^4.0.0" - universalify: "npm:^0.1.0" - checksum: 10c0/1943bb2150007e3739921b8d13d4109abdc3cc481e53b97b7ea7f77eda1c3c642e27ae49eac3af074e3496ea02fde30f411ef410c760c70a38b92e656e5da784 - languageName: node - linkType: hard - "fs-extra@npm:^8.1.0, fs-extra@npm:~8.1.0": version: 8.1.0 resolution: "fs-extra@npm:8.1.0" @@ -16122,20 +15486,6 @@ __metadata: languageName: node linkType: hard -"glob@npm:7.2.0": - version: 7.2.0 - resolution: "glob@npm:7.2.0" - dependencies: - fs.realpath: "npm:^1.0.0" - inflight: "npm:^1.0.4" - inherits: "npm:2" - minimatch: "npm:^3.0.4" - once: "npm:^1.3.0" - path-is-absolute: "npm:^1.0.0" - checksum: 10c0/478b40e38be5a3d514e64950e1e07e0ac120585add6a37c98d0ed24d72d9127d734d2a125786073c8deb687096e84ae82b641c441a869ada3a9cc91b68978632 - languageName: node - linkType: hard - "glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.4.2": version: 10.4.5 resolution: "glob@npm:10.4.5" @@ -16179,7 +15529,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^8.0.1, glob@npm:^8.0.3, glob@npm:^8.1.0": +"glob@npm:^8.0.1, glob@npm:^8.0.3": version: 8.1.0 resolution: "glob@npm:8.1.0" dependencies: @@ -16311,7 +15661,7 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": +"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.11 resolution: "graceful-fs@npm:4.2.11" checksum: 10c0/386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2 @@ -16421,72 +15771,6 @@ __metadata: languageName: node linkType: hard -"hardhat@npm:2.18.1": - version: 2.18.1 - resolution: "hardhat@npm:2.18.1" - dependencies: - "@ethersproject/abi": "npm:^5.1.2" - "@metamask/eth-sig-util": "npm:^4.0.0" - "@nomicfoundation/ethereumjs-block": "npm:5.0.2" - "@nomicfoundation/ethereumjs-blockchain": "npm:7.0.2" - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-evm": "npm:2.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-statemanager": "npm:2.0.2" - "@nomicfoundation/ethereumjs-trie": "npm:6.0.2" - "@nomicfoundation/ethereumjs-tx": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - "@nomicfoundation/ethereumjs-vm": "npm:7.0.2" - "@nomicfoundation/solidity-analyzer": "npm:^0.1.0" - "@sentry/node": "npm:^5.18.1" - "@types/bn.js": "npm:^5.1.0" - "@types/lru-cache": "npm:^5.1.0" - adm-zip: "npm:^0.4.16" - aggregate-error: "npm:^3.0.0" - ansi-escapes: "npm:^4.3.0" - chalk: "npm:^2.4.2" - chokidar: "npm:^3.4.0" - ci-info: "npm:^2.0.0" - debug: "npm:^4.1.1" - enquirer: "npm:^2.3.0" - env-paths: "npm:^2.2.0" - ethereum-cryptography: "npm:^1.0.3" - ethereumjs-abi: "npm:^0.6.8" - find-up: "npm:^2.1.0" - fp-ts: "npm:1.19.3" - fs-extra: "npm:^7.0.1" - glob: "npm:7.2.0" - immutable: "npm:^4.0.0-rc.12" - io-ts: "npm:1.10.4" - keccak: "npm:^3.0.2" - lodash: "npm:^4.17.11" - mnemonist: "npm:^0.38.0" - mocha: "npm:^10.0.0" - p-map: "npm:^4.0.0" - raw-body: "npm:^2.4.1" - resolve: "npm:1.17.0" - semver: "npm:^6.3.0" - solc: "npm:0.7.3" - source-map-support: "npm:^0.5.13" - stacktrace-parser: "npm:^0.1.10" - tsort: "npm:0.0.1" - undici: "npm:^5.14.0" - uuid: "npm:^8.3.2" - ws: "npm:^7.4.6" - peerDependencies: - ts-node: "*" - typescript: "*" - peerDependenciesMeta: - ts-node: - optional: true - typescript: - optional: true - bin: - hardhat: internal/cli/bootstrap.js - checksum: 10c0/9d6186ea9f91fe63b46b6ae9009eea2bdf4edbf722c71becb7477f73a6824bf5b227b77107cc3dcc4915a3ce38c68706fd76a3537753923d9443016c8087af85 - languageName: node - linkType: hard - "has-ansi@npm:^2.0.0": version: 2.0.0 resolution: "has-ansi@npm:2.0.0" @@ -16642,7 +15926,7 @@ __metadata: languageName: node linkType: hard -"he@npm:1.2.0, he@npm:^1.2.0": +"he@npm:1.2.0": version: 1.2.0 resolution: "he@npm:1.2.0" bin: @@ -16882,7 +16166,7 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.17": +"iconv-lite@npm:^0.4.17": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" dependencies: @@ -16992,13 +16276,6 @@ __metadata: languageName: node linkType: hard -"immutable@npm:^4.0.0-rc.12": - version: 4.3.6 - resolution: "immutable@npm:4.3.6" - checksum: 10c0/7d0952a768b4fadcee47230ed86dc9505a4517095eceaf5a47e65288571c42400c6e4a2ae21eca4eda957cb7bc50720213135b62cf6a181639111f8acae128c3 - languageName: node - linkType: hard - "import-fresh@npm:^2.0.0": version: 2.0.0 resolution: "import-fresh@npm:2.0.0" @@ -17169,15 +16446,6 @@ __metadata: languageName: node linkType: hard -"io-ts@npm:1.10.4": - version: 1.10.4 - resolution: "io-ts@npm:1.10.4" - dependencies: - fp-ts: "npm:^1.0.0" - checksum: 10c0/9370988a7e17fc23c194115808168ccd1ccf7b7ebe92c39c1cc2fd91c1dc641552a5428bb04fe28c01c826fa4f230e856eb4f7d27c774a1400af3fecf2936ab5 - languageName: node - linkType: hard - "ip-address@npm:^9.0.5": version: 9.0.5 resolution: "ip-address@npm:9.0.5" @@ -17294,13 +16562,6 @@ __metadata: languageName: node linkType: hard -"is-buffer@npm:^2.0.5": - version: 2.0.5 - resolution: "is-buffer@npm:2.0.5" - checksum: 10c0/e603f6fced83cf94c53399cff3bda1a9f08e391b872b64a73793b0928be3e5f047f2bcece230edb7632eaea2acdbfcb56c23b33d8a20c820023b230f1485679a - languageName: node - linkType: hard - "is-callable@npm:^1.1.3, is-callable@npm:^1.1.4, is-callable@npm:^1.2.7": version: 1.2.7 resolution: "is-callable@npm:1.2.7" @@ -18512,13 +17773,6 @@ __metadata: languageName: node linkType: hard -"js-sdsl@npm:^4.1.4": - version: 4.4.2 - resolution: "js-sdsl@npm:4.4.2" - checksum: 10c0/50707728fc31642164f4d83c8087f3750aaa99c450b008b19e236a1f190c9e48f9fc799615c341f9ca2c0803b15ab6f48d92a9cc3e6ffd20065cba7d7e742b92 - languageName: node - linkType: hard - "js-sha256@npm:^0.9.0": version: 0.9.0 resolution: "js-sha256@npm:0.9.0" @@ -18882,7 +18136,7 @@ __metadata: languageName: node linkType: hard -"keccak@npm:^3.0.0, keccak@npm:^3.0.2, keccak@npm:^3.0.3": +"keccak@npm:^3.0.0, keccak@npm:^3.0.3": version: 3.0.4 resolution: "keccak@npm:3.0.4" dependencies: @@ -18967,18 +18221,6 @@ __metadata: languageName: node linkType: hard -"klaw@npm:^1.0.0": - version: 1.3.1 - resolution: "klaw@npm:1.3.1" - dependencies: - graceful-fs: "npm:^4.1.9" - dependenciesMeta: - graceful-fs: - optional: true - checksum: 10c0/da994768b02b3843cc994c99bad3cf1c8c67716beb4dd2834133c919e9e9ee788669fbe27d88ab0ad9a3991349c28280afccbde01c2318229b662dd7a05e4728 - languageName: node - linkType: hard - "kleur@npm:^3.0.3": version: 3.0.3 resolution: "kleur@npm:3.0.3" @@ -19074,34 +18316,6 @@ __metadata: languageName: node linkType: hard -"level-supports@npm:^4.0.0": - version: 4.0.1 - resolution: "level-supports@npm:4.0.1" - checksum: 10c0/a94aa591786845d17c9c62ad075ae33e0fce5be714baa6e16305ed14e2d3638d09e724247fa3f63951e36de57ffd168d63e159e79d03944ee648054b8c7c1684 - languageName: node - linkType: hard - -"level-transcoder@npm:^1.0.1": - version: 1.0.1 - resolution: "level-transcoder@npm:1.0.1" - dependencies: - buffer: "npm:^6.0.3" - module-error: "npm:^1.0.1" - checksum: 10c0/25936330676325f22c5143aff5c7fe3f1db156db99f9efb07a2642045c2c6ee565fcbfccbadc0600b3abf8bbe595632cacc3dd334009214069d1857daa57987e - languageName: node - linkType: hard - -"level@npm:^8.0.0": - version: 8.0.1 - resolution: "level@npm:8.0.1" - dependencies: - abstract-level: "npm:^1.0.4" - browser-level: "npm:^1.0.1" - classic-level: "npm:^1.2.0" - checksum: 10c0/52e3c18a3372f22b7c0c96a998a24099454f51952ba2b8f25eabc72b1f7bbc15a3ab480c92c94d3c931be370be5a235b804b16e565b73b22bea52cca4029a625 - languageName: node - linkType: hard - "levelup@npm:^0.18.2": version: 0.18.6 resolution: "levelup@npm:0.18.6" @@ -19363,16 +18577,6 @@ __metadata: languageName: node linkType: hard -"locate-path@npm:^2.0.0": - version: 2.0.0 - resolution: "locate-path@npm:2.0.0" - dependencies: - p-locate: "npm:^2.0.0" - path-exists: "npm:^3.0.0" - checksum: 10c0/24efa0e589be6aa3c469b502f795126b26ab97afa378846cb508174211515633b770aa0ba610cab113caedab8d2a4902b061a08aaed5297c12ab6f5be4df0133 - languageName: node - linkType: hard - "locate-path@npm:^3.0.0": version: 3.0.0 resolution: "locate-path@npm:3.0.0" @@ -19558,13 +18762,6 @@ __metadata: languageName: node linkType: hard -"lru_map@npm:^0.3.3": - version: 0.3.3 - resolution: "lru_map@npm:0.3.3" - checksum: 10c0/d861f14a142a4a74ebf8d3ad57f2e768a5b820db4100ae53eed1a64eb6350912332e6ebc87cb7415ad6d0cd8f3ce6d20beab9a5e6042ccb5996ea0067a220448 - languageName: node - linkType: hard - "ltgt@npm:^2.1.3": version: 2.2.1 resolution: "ltgt@npm:2.2.1" @@ -19757,13 +18954,6 @@ __metadata: languageName: node linkType: hard -"mcl-wasm@npm:^0.7.1": - version: 0.7.9 - resolution: "mcl-wasm@npm:0.7.9" - checksum: 10c0/12acd074621741ac61f4b3d36d72da6317320b5db02734abaaf77c0c7886ced14926de2f637ca9ab70a458419200d7edb8e0a4f9f02c85feb8d5bbbe430e60ad - languageName: node - linkType: hard - "md5-file@npm:^3.2.3": version: 3.2.3 resolution: "md5-file@npm:3.2.3" @@ -19860,24 +19050,6 @@ __metadata: languageName: node linkType: hard -"memory-level@npm:^1.0.0": - version: 1.0.0 - resolution: "memory-level@npm:1.0.0" - dependencies: - abstract-level: "npm:^1.0.0" - functional-red-black-tree: "npm:^1.0.1" - module-error: "npm:^1.0.1" - checksum: 10c0/b926b6ddc43065282c240cd7c0bf44abcfe43d556f6bb3d43d21f5f514b0095abcd8f9ba26b31ffdefa4ce4931afb937a1eaea1f15c45e76d7061086dbcf9148 - languageName: node - linkType: hard - -"memorystream@npm:^0.3.1": - version: 0.3.1 - resolution: "memorystream@npm:0.3.1" - checksum: 10c0/4bd164657711d9747ff5edb0508b2944414da3464b7fe21ac5c67cf35bba975c4b446a0124bd0f9a8be54cfc18faf92e92bd77563a20328b1ccf2ff04e9f39b9 - languageName: node - linkType: hard - "merge-deep@npm:^3.0.2": version: 3.0.3 resolution: "merge-deep@npm:3.0.3" @@ -20312,7 +19484,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^5.0.1, minimatch@npm:^5.1.0, minimatch@npm:^5.1.6": +"minimatch@npm:^5.0.1, minimatch@npm:^5.1.0": version: 5.1.6 resolution: "minimatch@npm:5.1.6" dependencies: @@ -20550,46 +19722,6 @@ __metadata: languageName: node linkType: hard -"mnemonist@npm:^0.38.0": - version: 0.38.5 - resolution: "mnemonist@npm:0.38.5" - dependencies: - obliterator: "npm:^2.0.0" - checksum: 10c0/a73a2718f88cd12c3b108ecc530619a1b0f2783d479c7f98e7367375102cc3a28811bab384e17eb731553dc8d7ee9d60283d694a9f676af5f306104e75027d4f - languageName: node - linkType: hard - -"mocha@npm:^10.0.0": - version: 10.6.0 - resolution: "mocha@npm:10.6.0" - dependencies: - ansi-colors: "npm:^4.1.3" - browser-stdout: "npm:^1.3.1" - chokidar: "npm:^3.5.3" - debug: "npm:^4.3.5" - diff: "npm:^5.2.0" - escape-string-regexp: "npm:^4.0.0" - find-up: "npm:^5.0.0" - glob: "npm:^8.1.0" - he: "npm:^1.2.0" - js-yaml: "npm:^4.1.0" - log-symbols: "npm:^4.1.0" - minimatch: "npm:^5.1.6" - ms: "npm:^2.1.3" - serialize-javascript: "npm:^6.0.2" - strip-json-comments: "npm:^3.1.1" - supports-color: "npm:^8.1.1" - workerpool: "npm:^6.5.1" - yargs: "npm:^16.2.0" - yargs-parser: "npm:^20.2.9" - yargs-unparser: "npm:^2.0.0" - bin: - _mocha: bin/_mocha - mocha: bin/mocha.js - checksum: 10c0/30b2f810014af6b5701563c6ee6ee78708dcfefc1551801c70018682bc6ca9327a6a27e93c101905a355d130a1ffe1f990975d51459c289bfcb72726ea5f7a50 - languageName: node - linkType: hard - "module-definition@npm:^3.0.0, module-definition@npm:^3.3.0": version: 3.4.0 resolution: "module-definition@npm:3.4.0" @@ -20602,13 +19734,6 @@ __metadata: languageName: node linkType: hard -"module-error@npm:^1.0.1, module-error@npm:^1.0.2": - version: 1.0.2 - resolution: "module-error@npm:1.0.2" - checksum: 10c0/584a43a1bb2720c6c6c771e257a308af4f042a17c17b1472a2c855130a1ad93ba516a82ae7ac2ce2d03062e521cc53c03ec0ce153795d895312d7747fb3bb99b - languageName: node - linkType: hard - "module-lookup-amd@npm:^6.1.0": version: 6.2.0 resolution: "module-lookup-amd@npm:6.2.0" @@ -20664,7 +19789,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1, ms@npm:^2.1.3": +"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 @@ -20857,13 +19982,6 @@ __metadata: languageName: node linkType: hard -"napi-macros@npm:^2.2.2": - version: 2.2.2 - resolution: "napi-macros@npm:2.2.2" - checksum: 10c0/cc85daaf82a4f585d30561047cef0f3e702be769b5cf2ffadc6242bc5a1033f6b8269012e54178baf66f022bd18aa9ebb619f1b530cc19c1f9b96f9689affd50 - languageName: node - linkType: hard - "napi-wasm@npm:^1.1.0": version: 1.1.0 resolution: "napi-wasm@npm:1.1.0" @@ -21043,7 +20161,7 @@ __metadata: languageName: node linkType: hard -"node-gyp-build@npm:^4.2.0, node-gyp-build@npm:^4.3.0": +"node-gyp-build@npm:^4.2.0": version: 4.8.1 resolution: "node-gyp-build@npm:4.8.1" bin: @@ -21453,13 +20571,6 @@ __metadata: languageName: node linkType: hard -"obliterator@npm:^2.0.0": - version: 2.0.4 - resolution: "obliterator@npm:2.0.4" - checksum: 10c0/ff2c10d4de7d62cd1d588b4d18dfc42f246c9e3a259f60d5716f7f88e5b3a3f79856b3207db96ec9a836a01d0958a21c15afa62a3f4e73a1e0b75f2c2f6bab40 - languageName: node - linkType: hard - "octal@npm:^1.0.0": version: 1.0.0 resolution: "octal@npm:1.0.0" @@ -21733,15 +20844,6 @@ __metadata: languageName: node linkType: hard -"p-limit@npm:^1.1.0": - version: 1.3.0 - resolution: "p-limit@npm:1.3.0" - dependencies: - p-try: "npm:^1.0.0" - checksum: 10c0/5c1b1d53d180b2c7501efb04b7c817448e10efe1ba46f4783f8951994d5027e4cd88f36ad79af50546682594c4ebd11702ac4b9364c47f8074890e2acad0edee - languageName: node - linkType: hard - "p-limit@npm:^2.0.0, p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -21760,15 +20862,6 @@ __metadata: languageName: node linkType: hard -"p-locate@npm:^2.0.0": - version: 2.0.0 - resolution: "p-locate@npm:2.0.0" - dependencies: - p-limit: "npm:^1.1.0" - checksum: 10c0/82da4be88fb02fd29175e66021610c881938d3cc97c813c71c1a605fac05617d57fd5d3b337494a6106c0edb2a37c860241430851411f1b265108cead34aee67 - languageName: node - linkType: hard - "p-locate@npm:^3.0.0": version: 3.0.0 resolution: "p-locate@npm:3.0.0" @@ -21812,13 +20905,6 @@ __metadata: languageName: node linkType: hard -"p-try@npm:^1.0.0": - version: 1.0.0 - resolution: "p-try@npm:1.0.0" - checksum: 10c0/757ba31de5819502b80c447826fac8be5f16d3cb4fbf9bc8bc4971dba0682e84ac33e4b24176ca7058c69e29f64f34d8d9e9b08e873b7b7bb0aa89d620fa224a - languageName: node - linkType: hard - "p-try@npm:^2.0.0": version: 2.2.0 resolution: "p-try@npm:2.2.0" @@ -22074,7 +21160,7 @@ __metadata: languageName: node linkType: hard -"path-parse@npm:^1.0.5, path-parse@npm:^1.0.6, path-parse@npm:^1.0.7": +"path-parse@npm:^1.0.5, path-parse@npm:^1.0.7": version: 1.0.7 resolution: "path-parse@npm:1.0.7" checksum: 10c0/11ce261f9d294cc7a58d6a574b7f1b935842355ec66fba3c3fd79e0f036462eaf07d0aa95bb74ff432f9afef97ce1926c720988c6a7451d8a584930ae7de86e1 @@ -22889,7 +21975,7 @@ __metadata: languageName: node linkType: hard -"queue-microtask@npm:^1.2.2, queue-microtask@npm:^1.2.3": +"queue-microtask@npm:^1.2.2": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" checksum: 10c0/900a93d3cdae3acd7d16f642c29a642aea32c2026446151f0778c62ac089d4b8e6c986811076e1ae180a694cedf077d453a11b58ff0a865629a4f82ab558e102 @@ -22952,18 +22038,6 @@ __metadata: languageName: node linkType: hard -"raw-body@npm:^2.4.1": - version: 2.5.2 - resolution: "raw-body@npm:2.5.2" - dependencies: - bytes: "npm:3.1.2" - http-errors: "npm:2.0.0" - iconv-lite: "npm:0.4.24" - unpipe: "npm:1.0.0" - checksum: 10c0/b201c4b66049369a60e766318caff5cb3cc5a900efd89bdac431463822d976ad0670912c931fdbdcf5543207daf6f6833bca57aa116e1661d2ea91e12ca692c4 - languageName: node - linkType: hard - "rc@npm:^1.2.7, rc@npm:~1.2.7": version: 1.2.8 resolution: "rc@npm:1.2.8" @@ -24492,7 +23566,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"require-from-string@npm:^2.0.0, require-from-string@npm:^2.0.2": +"require-from-string@npm:^2.0.2": version: 2.0.2 resolution: "require-from-string@npm:2.0.2" checksum: 10c0/aaa267e0c5b022fc5fd4eef49d8285086b15f2a1c54b28240fdf03599cbd9c26049fee3eab894f2e1f6ca65e513b030a7c264201e3f005601e80c49fb2937ce2 @@ -24634,15 +23708,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"resolve@npm:1.17.0": - version: 1.17.0 - resolution: "resolve@npm:1.17.0" - dependencies: - path-parse: "npm:^1.0.6" - checksum: 10c0/4e6c76cc1a7b08bff637b092ce035d7901465067915605bc5a23ac0c10fe42ec205fc209d5d5f7a5f27f37ce71d687def7f656bbb003631cd46a8374f55ec73d - languageName: node - linkType: hard - "resolve@npm:1.22.8, resolve@npm:^1.11.1, resolve@npm:^1.14.2, resolve@npm:^1.20.0, resolve@npm:^1.22.0, resolve@npm:^1.22.2, resolve@npm:^1.22.3, resolve@npm:^1.22.4, resolve@npm:^1.22.8": version: 1.22.8 resolution: "resolve@npm:1.22.8" @@ -24678,15 +23743,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"resolve@patch:resolve@npm%3A1.17.0#optional!builtin": - version: 1.17.0 - resolution: "resolve@patch:resolve@npm%3A1.17.0#optional!builtin::version=1.17.0&hash=c3c19d" - dependencies: - path-parse: "npm:^1.0.6" - checksum: 10c0/e072e52be3c3dbfd086761115db4a5136753e7aefc0e665e66e7307ddcd9d6b740274516055c74aee44921625e95993f03570450aa310b8d73b1c9daa056c4cd - languageName: node - linkType: hard - "resolve@patch:resolve@npm%3A1.22.8#optional!builtin, resolve@patch:resolve@npm%3A^1.11.1#optional!builtin, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.2#optional!builtin, resolve@patch:resolve@npm%3A^1.22.3#optional!builtin, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin, resolve@patch:resolve@npm%3A^1.22.8#optional!builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d" @@ -24871,15 +23927,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"run-parallel-limit@npm:^1.1.0": - version: 1.1.0 - resolution: "run-parallel-limit@npm:1.1.0" - dependencies: - queue-microtask: "npm:^1.2.2" - checksum: 10c0/9c78eb77e788d0ed803a7e80921412f6f6accfb2006de8c21699d9ebf7696df9cefaa313fe14d6169a3fc9f564b34fe91bfd9948cc3a58e2d24136a2390523ae - languageName: node - linkType: hard - "run-parallel@npm:^1.1.2, run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0" @@ -24889,13 +23936,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"rustbn.js@npm:~0.2.0": - version: 0.2.0 - resolution: "rustbn.js@npm:0.2.0" - checksum: 10c0/be2d55d4a53465cfd5c7900153cfae54c904f0941acd30191009cf473cacbfcf45082ffd8dc473a354c8e3dcfe2c2bdf5d7ea9cc9b188d892b4aa8d012b94701 - languageName: node - linkType: hard - "rx@npm:^4.1.0": version: 4.1.0 resolution: "rx@npm:4.1.0" @@ -25231,7 +24271,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"serialize-javascript@npm:^6.0.1, serialize-javascript@npm:^6.0.2": +"serialize-javascript@npm:^6.0.1": version: 6.0.2 resolution: "serialize-javascript@npm:6.0.2" dependencies: @@ -25677,25 +24717,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"solc@npm:0.7.3": - version: 0.7.3 - resolution: "solc@npm:0.7.3" - dependencies: - command-exists: "npm:^1.2.8" - commander: "npm:3.0.2" - follow-redirects: "npm:^1.12.1" - fs-extra: "npm:^0.30.0" - js-sha3: "npm:0.8.0" - memorystream: "npm:^0.3.1" - require-from-string: "npm:^2.0.0" - semver: "npm:^5.5.0" - tmp: "npm:0.0.33" - bin: - solcjs: solcjs - checksum: 10c0/28405adfba1f55603dc5b674630383bfbdbfab2d36deba2ff0a90c46cbc346bcabf0ed6175e12ae3c0b751ef082d0405ab42dcc24f88603a446e097a925d7425 - languageName: node - linkType: hard - "sonic-boom@npm:^2.2.1": version: 2.8.0 resolution: "sonic-boom@npm:2.8.0" @@ -25761,7 +24782,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"source-map-support@npm:^0.5.13, source-map-support@npm:^0.5.16, source-map-support@npm:~0.5.20, source-map-support@npm:~0.5.21": +"source-map-support@npm:^0.5.16, source-map-support@npm:~0.5.20, source-map-support@npm:~0.5.21": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: @@ -26423,7 +25444,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"supports-color@npm:^8.0.0, supports-color@npm:^8.1.1": +"supports-color@npm:^8.0.0": version: 8.1.1 resolution: "supports-color@npm:8.1.1" dependencies: @@ -26857,7 +25878,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"tmp@npm:0.0.33, tmp@npm:^0.0.33": +"tmp@npm:^0.0.33": version: 0.0.33 resolution: "tmp@npm:0.0.33" dependencies: @@ -27130,7 +26151,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"tslib@npm:1.14.1, tslib@npm:^1.8.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3": +"tslib@npm:1.14.1, tslib@npm:^1.8.1, tslib@npm:^1.9.0": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: 10c0/69ae09c49eea644bc5ebe1bca4fa4cc2c82b7b3e02f43b84bd891504edf66dbc6b2ec0eef31a957042de2269139e4acff911e6d186a258fb14069cd7f6febce2 @@ -27144,13 +26165,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"tsort@npm:0.0.1": - version: 0.0.1 - resolution: "tsort@npm:0.0.1" - checksum: 10c0/ea3d034ab341dd9282c972710496e98539408d77f1cd476ad0551a9731f40586b65ab917b39745f902bf32037a3161eee3821405f6ab15bcd2ce4cc0a52d1da6 - languageName: node - linkType: hard - "tsutils@npm:3, tsutils@npm:^3.17.1, tsutils@npm:^3.21.0": version: 3.21.0 resolution: "tsutils@npm:3.21.0" @@ -27501,15 +26515,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"undici@npm:^5.14.0": - version: 5.28.4 - resolution: "undici@npm:5.28.4" - dependencies: - "@fastify/busboy": "npm:^2.0.0" - checksum: 10c0/08d0f2596553aa0a54ca6e8e9c7f45aef7d042c60918564e3a142d449eda165a80196f6ef19ea2ef2e6446959e293095d8e40af1236f0d67223b06afac5ecad7 - languageName: node - linkType: hard - "unenv@npm:^1.9.0": version: 1.10.0 resolution: "unenv@npm:1.10.0" @@ -27648,7 +26653,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"unpipe@npm:1.0.0, unpipe@npm:~1.0.0": +"unpipe@npm:~1.0.0": version: 1.0.0 resolution: "unpipe@npm:1.0.0" checksum: 10c0/193400255bd48968e5c5383730344fbb4fa114cdedfab26e329e50dd2d81b134244bb8a72c6ac1b10ab0281a58b363d06405632c9d49ca9dfd5e90cbd7d0f32c @@ -28499,13 +27504,6 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"workerpool@npm:^6.5.1": - version: 6.5.1 - resolution: "workerpool@npm:6.5.1" - checksum: 10c0/58e8e969782292cb3a7bfba823f1179a7615250a0cefb4841d5166234db1880a3d0fe83a31dd8d648329ec92c2d0cd1890ad9ec9e53674bb36ca43e9753cdeac - languageName: node - linkType: hard - "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -28657,7 +27655,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"ws@npm:^7, ws@npm:^7.0.0, ws@npm:^7.4.6, ws@npm:^7.5.1": +"ws@npm:^7, ws@npm:^7.0.0, ws@npm:^7.5.1": version: 7.5.10 resolution: "ws@npm:7.5.10" peerDependencies: @@ -28882,7 +27880,7 @@ react-native-safe-area-view@rainbow-me/react-native-safe-area-view: languageName: node linkType: hard -"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.9": +"yargs-parser@npm:^20.2.2": version: 20.2.9 resolution: "yargs-parser@npm:20.2.9" checksum: 10c0/0685a8e58bbfb57fab6aefe03c6da904a59769bd803a722bb098bd5b0f29d274a1357762c7258fb487512811b8063fb5d2824a3415a0a4540598335b3b086c72 From 5e92d8eb35cf9082ef7d8918cc49db26f0bc5814 Mon Sep 17 00:00:00 2001 From: Christian Baroni <7061887+christianbaroni@users.noreply.github.com> Date: Mon, 23 Dec 2024 13:16:06 -0500 Subject: [PATCH 2/2] Trending tokens / network switcher cleanup (#6372) --- src/components/Discover/TrendingTokens.tsx | 188 +++----- src/components/NetworkSwitcher.tsx | 534 ++++++++++++--------- src/languages/en_US.json | 3 +- 3 files changed, 372 insertions(+), 353 deletions(-) diff --git a/src/components/Discover/TrendingTokens.tsx b/src/components/Discover/TrendingTokens.tsx index 223a8041981..d8a597c8208 100644 --- a/src/components/Discover/TrendingTokens.tsx +++ b/src/components/Discover/TrendingTokens.tsx @@ -17,10 +17,8 @@ import { FarcasterUser, TrendingToken, useTrendingTokens } from '@/resources/tre import { useNavigationStore } from '@/state/navigation/navigationStore'; import { swapsStore } from '@/state/swaps/swapsStore'; import { sortFilters, timeFilters, useTrendingTokensStore } from '@/state/trendingTokens/trendingTokens'; -import { colors } from '@/styles'; -import { darkModeThemeColors } from '@/styles/colors'; import { useCallback, useEffect, useMemo } from 'react'; -import React, { Dimensions, FlatList, View } from 'react-native'; +import React, { FlatList, View } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import Animated, { runOnJS, useSharedValue } from 'react-native-reanimated'; import { ButtonPressAnimation } from '../animations'; @@ -31,6 +29,7 @@ import { useAccountSettings } from '@/hooks'; import { getColorWorklet, getMixedColor, opacity } from '@/__swaps__/utils/swaps'; import { THICK_BORDER_WIDTH } from '@/__swaps__/screens/Swap/constants'; import { IS_IOS } from '@/env'; +import { DEVICE_WIDTH } from '@/utils/deviceUtils'; const t = i18n.l.trending_tokens; @@ -72,18 +71,24 @@ function FilterButton({ end={{ x: 0.5, y: 1 }} start={{ x: 0.5, y: 0 }} style={{ - flexDirection: 'row', alignItems: 'center', + borderColor, + borderRadius: 18, + borderWidth: THICK_BORDER_WIDTH, + flexDirection: 'row', gap: 4, height: 36, paddingHorizontal: 12 - THICK_BORDER_WIDTH, - borderRadius: 18, - borderWidth: THICK_BORDER_WIDTH, - borderColor, }} > {typeof icon === 'string' ? ( - + {icon} ) : ( @@ -209,7 +214,7 @@ function CategoryFilterButton({ @@ -240,15 +245,16 @@ function FriendPfp({ pfp_url }: { pfp_url: string }) { const backgroundColor = useBackgroundColor('surfacePrimary'); return ( ); @@ -259,18 +265,18 @@ function FriendHolders({ friends }: { friends: FarcasterUser[] }) { const separator = howManyOthers === 1 && friends.length === 2 ? ` ${i18n.t(t.and)} ` : ', '; return ( - - + + {friends[1] && } - - + + {friends[0].username} {friends[1] && ( <> - + {separator} {friends[1].username} @@ -278,7 +284,7 @@ function FriendHolders({ friends }: { friends: FarcasterUser[] }) { )} {friends.length > 2 && ( - + {' '} {i18n.t(t.and_others[howManyOthers === 1 ? 'one' : 'other'], { count: howManyOthers })} @@ -289,75 +295,21 @@ function FriendHolders({ friends }: { friends: FarcasterUser[] }) { } function TrendingTokenLoadingRow() { - const backgroundColor = useBackgroundColor('surfacePrimary'); - const { isDarkMode } = useColorMode(); return ( - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - + + + @@ -371,7 +323,7 @@ function getPriceChangeColor(priceChange: number) { } function TrendingTokenRow({ token }: { token: TrendingToken }) { - const separatorColor = useForegroundColor('separator'); + const separatorSecondary = useForegroundColor('separatorSecondary'); const price = formatCurrency(token.price); const marketCap = formatNumber(token.marketCap, { useOrderSuffix: true, decimals: 1, style: '$' }); @@ -400,7 +352,15 @@ function TrendingTokenRow({ token }: { token: TrendingToken }) { return ( - + 0 ? 48 : 40, + alignItems: 'center', + }} + > - + {token.name} - + {token.symbol} - + {price} @@ -445,20 +405,18 @@ function TrendingTokenRow({ token }: { token: TrendingToken }) { VOL - + {volume} - - | - + MCAP - + {marketCap} @@ -512,16 +470,14 @@ function NoResults() { } function NetworkFilter() { - const { isDarkMode } = useColorMode(); - - const selected = useSharedValue(undefined); const chainId = useTrendingTokensStore(state => state.chainId); + const selected = useSharedValue(chainId); + + const chainColor = useBackendNetworksStore(state => state.getColorsForChainId(chainId || ChainId.mainnet, false)); const setChainId = useTrendingTokensStore(state => state.setChainId); const { icon, label, lightenedNetworkColor } = useMemo(() => { if (!chainId) return { icon: '􀤆', label: i18n.t(t.all), lightenedNetworkColor: undefined }; - const lightenedNetworkColor = useBackendNetworksStore.getState().getColorsForChainId(chainId, isDarkMode); - return { icon: ( @@ -529,11 +485,9 @@ function NetworkFilter() { ), label: useBackendNetworksStore.getState().getChainsLabel()[chainId], - lightenedNetworkColor: lightenedNetworkColor - ? getMixedColor(lightenedNetworkColor, globalColors.white100, isDarkMode ? 0.55 : 0.6) - : undefined, + lightenedNetworkColor: chainColor ? getMixedColor(chainColor, globalColors.white100, 0.6) : undefined, }; - }, [chainId, isDarkMode]); + }, [chainColor, chainId]); const setSelected = useCallback( (chainId: ChainId | undefined) => { @@ -564,7 +518,7 @@ function NetworkFilter() { function TimeFilter() { const timeframe = useTrendingTokensStore(state => state.timeframe); - const shouldAbbreviate = timeframe === Timeframe.H24 || timeframe === Timeframe.H12; + const shouldAbbreviate = timeframe === Timeframe.H12 || timeframe === Timeframe.H24; return ( state.sort); const selected = sort !== TrendingSort.Recommended; - const iconColor = useForegroundColor(selected ? 'labelSecondary' : 'labelTertiary'); + const iconColor = getColorWorklet(selected ? 'labelSecondary' : 'labelTertiary', selected ? false : isDarkMode); const sortLabel = useMemo(() => { if (sort === TrendingSort.Recommended) return i18n.t(t.filters.sort.RECOMMENDED.label); @@ -621,9 +575,15 @@ function SortFilter() { highlightedBackgroundColor={undefined} label={sortLabel} icon={ - + 􀄬 - + } /> @@ -634,7 +594,7 @@ function TrendingTokensLoader() { const { trending_tokens_limit } = useRemoteConfig(); return ( - + {Array.from({ length: trending_tokens_limit }).map((_, index) => ( ))} @@ -648,8 +608,8 @@ function TrendingTokenData() { return ( } data={trendingTokens} renderItem={({ item }) => } diff --git a/src/components/NetworkSwitcher.tsx b/src/components/NetworkSwitcher.tsx index 2b385abb1fe..c4dbaaf2490 100644 --- a/src/components/NetworkSwitcher.tsx +++ b/src/components/NetworkSwitcher.tsx @@ -1,12 +1,22 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ +import { BlurView } from '@react-native-community/blur'; import { opacity } from '@/__swaps__/utils/swaps'; import { useBackendNetworksStore } from '@/state/backendNetworks/backendNetworks'; import { ChainId } from '@/state/backendNetworks/types'; -import { AnimatedBlurView } from '@/components/AnimatedComponents/AnimatedBlurView'; import { ButtonPressAnimation } from '@/components/animations'; import { SPRING_CONFIGS, TIMING_CONFIGS } from '@/components/animations/animationConfigs'; import { ChainImage } from '@/components/coin-icon/ChainImage'; -import { AnimatedText, Box, DesignSystemProvider, globalColors, Separator, Text, useBackgroundColor, useColorMode } from '@/design-system'; +import { + AnimatedText, + Box, + DesignSystemProvider, + globalColors, + Inset, + Separator, + Text, + TextShadow, + useBackgroundColor, + useColorMode, +} from '@/design-system'; import { useForegroundColor } from '@/design-system/color/useForegroundColor'; import * as i18n from '@/languages'; import deviceUtils, { DEVICE_WIDTH } from '@/utils/deviceUtils'; @@ -28,7 +38,7 @@ import Animated, { useAnimatedStyle, useDerivedValue, useSharedValue, - withDelay, + withClamp, withSequence, withSpring, withTiming, @@ -48,14 +58,15 @@ import { noop } from 'lodash'; import { TapToDismiss } from './DappBrowser/control-panel/ControlPanel'; import { THICK_BORDER_WIDTH } from '@/__swaps__/screens/Swap/constants'; import { GestureHandlerButton } from '@/__swaps__/screens/Swap/components/GestureHandlerButton'; -import { useTheme } from '@/theme'; +import { triggerHaptics } from 'react-native-turbo-haptics'; +import { AnimatedTextIcon } from './AnimatedComponents/AnimatedTextIcon'; const t = i18n.l.network_switcher; const translations = { edit: i18n.t(t.edit), done: i18n.t(i18n.l.done), - networks: i18n.t(t.networks), + network: i18n.t(t.network), more: i18n.t(t.more), show_more: i18n.t(t.show_more), show_less: i18n.t(t.show_less), @@ -74,23 +85,13 @@ function EditButton({ editing }: { editing: SharedValue }) { 'worklet'; editing.value = !editing.value; }} - scaleTo={0.95} - style={{ - borderColor, - borderCurve: 'continuous', - borderRadius: 14, - borderWidth: THICK_BORDER_WIDTH, - height: 28, - justifyContent: 'center', - overflow: 'hidden', - paddingHorizontal: 10, - position: 'absolute', - right: 0, - }} + style={[sx.editButton, { borderColor }]} > - - {text} - + + + {text} + + ); } @@ -100,27 +101,15 @@ function Header({ editing }: { editing: SharedValue }) { const fill = useForegroundColor('fill'); const title = useDerivedValue(() => { - return editing.value ? translations.edit : translations.networks; + return editing.value ? translations.edit : translations.network; }); return ( - - - - + + - - + + {title} @@ -130,6 +119,8 @@ function Header({ editing }: { editing: SharedValue }) { ); } +const BANNER_HEIGHT = 75; + const CustomizeNetworksBanner = !shouldShowCustomizeNetworksBanner(customizeNetworksBannerStore.getState().dismissedAt) ? () => null : function CustomizeNetworksBanner({ editing }: { editing: SharedValue }) { @@ -143,19 +134,14 @@ const CustomizeNetworksBanner = !shouldShowCustomizeNetworksBanner(customizeNetw const dismissedAt = customizeNetworksBannerStore(s => s.dismissedAt); if (!shouldShowCustomizeNetworksBanner(dismissedAt)) return null; - const height = 75; const blue = '#268FFF'; return ( - + + } > - - - - + + + + 􀍱 @@ -212,14 +174,14 @@ const CustomizeNetworksBanner = !shouldShowCustomizeNetworksBanner(customizeNetw - + ); }; -const BADGE_BORDER_COLORS = { +const ALL_BADGE_BORDER_COLORS = { default: { dark: globalColors.white10, light: '#F2F3F4', @@ -230,7 +192,7 @@ const BADGE_BORDER_COLORS = { }, }; -const useNetworkOptionStyle = (isSelected: SharedValue, color?: string) => { +const useNetworkOptionStyle = (isSelected: SharedValue, color?: string, disableScale = false) => { const { isDarkMode } = useColorMode(); const label = useForegroundColor('labelTertiary'); @@ -253,11 +215,11 @@ const useNetworkOptionStyle = (isSelected: SharedValue, color?: string) const scale = useSharedValue(1); useAnimatedReaction( - () => isSelected.value, + () => (disableScale ? false : isSelected.value), (current, prev) => { if (current === true && prev === false) { scale.value = withSequence( - withTiming(0.9, { duration: 120, easing: Easing.bezier(0.25, 0.46, 0.45, 0.94) }), + withTiming(0.93, { duration: 110, easing: Easing.bezier(0.25, 0.46, 0.45, 0.94) }), withTiming(1, TIMING_CONFIGS.fadeConfig) ); } @@ -291,115 +253,89 @@ function AllNetworksOption({ const blue = useForegroundColor('blue'); const isSelected = useDerivedValue(() => selected.value === undefined); - const { animatedStyle } = useNetworkOptionStyle(isSelected, blue); + const { animatedStyle } = useNetworkOptionStyle(isSelected, blue, true); const overlappingBadge = useAnimatedStyle(() => { return { borderColor: isSelected.value - ? BADGE_BORDER_COLORS.selected[isDarkMode ? 'dark' : 'light'] - : BADGE_BORDER_COLORS.default[isDarkMode ? 'dark' : 'light'], + ? ALL_BADGE_BORDER_COLORS.selected[isDarkMode ? 'dark' : 'light'] + : ALL_BADGE_BORDER_COLORS.default[isDarkMode ? 'dark' : 'light'], }; }); return ( { 'worklet'; setSelected(undefined); }} - scaleTo={0.95} + scaleTo={0.94} + style={[sx.allNetworksButton, animatedStyle]} > - - - - - - - - - - - - - - - - - {i18n.t(t.all_networks)} - - + + + + + + + + + + + + + + + + {i18n.t(t.all_networks)} + ); } function AllNetworksSection({ editing, - setSelected, selected, + setSelected, }: { editing: SharedValue; - setSelected: (chainId: ChainId | undefined) => void; selected: SharedValue; + setSelected: (chainId: ChainId | undefined) => void; }) { - const style = useAnimatedStyle(() => ({ - opacity: editing.value ? withTiming(0, TIMING_CONFIGS.fastFadeConfig) : withTiming(1, TIMING_CONFIGS.fastFadeConfig), - height: withTiming( - editing.value ? 0 : ITEM_HEIGHT + 14, // 14 is the gap to the separator - TIMING_CONFIGS.fastFadeConfig + const animatedStyle = useAnimatedStyle(() => ({ + height: withClamp( + { min: 0, max: ITEM_HEIGHT + 14 * 2 }, + withSpring( + editing.value ? 0 : ITEM_HEIGHT + 14 * 2, // 14 is the gap to the separator + SPRING_CONFIGS.springConfig + ) ), - marginTop: editing.value ? 0 : 14, + opacity: editing.value ? withSpring(0, SPRING_CONFIGS.snappierSpringConfig) : withTiming(1, TIMING_CONFIGS.slowerFadeConfig), pointerEvents: editing.value ? 'none' : 'auto', })); + return ( - + - + + + ); } function NetworkOption({ chainId, selected }: { chainId: ChainId; selected: SharedValue }) { const { isDarkMode } = useColorMode(); - const getColorsForChainId = useBackendNetworksStore(state => state.getColorsForChainId); + const chainColor = useBackendNetworksStore.getState().getColorsForChainId(chainId, isDarkMode); const chainName = useBackendNetworksStore.getState().getChainsLabel()[chainId]; - const chainColor = getColorsForChainId(chainId, isDarkMode); const isSelected = useDerivedValue(() => selected.value === chainId); const { animatedStyle } = useNetworkOptionStyle(isSelected, chainColor); return ( - + - + {chainName} @@ -407,11 +343,12 @@ function NetworkOption({ chainId, selected }: { chainId: ChainId; selected: Shar } const SHEET_OUTER_INSET = 8; -const SHEET_INNER_PADDING = 16; -const GAP = 12; -const ITEM_WIDTH = (DEVICE_WIDTH - SHEET_INNER_PADDING * 2 - SHEET_OUTER_INSET * 2 - GAP) / 2; +const SHEET_INNER_PADDING = 18; +const ITEM_GAP = 12; +const ITEM_WIDTH = (DEVICE_WIDTH - SHEET_INNER_PADDING * 2 - SHEET_OUTER_INSET * 2 - ITEM_GAP) / 2; const ITEM_HEIGHT = 48; const SEPARATOR_HEIGHT = 68; +const SEPARATOR_HEIGHT_NETWORK_CHIP = 18; const ALL_NETWORKS_BADGE_SIZE = 16; const THICKER_BORDER_WIDTH = 5 / 3; @@ -451,33 +388,29 @@ function Draggable({ const itemIndex = networks.value[section].indexOf(chainId); const slotPosition = positionFromIndex(itemIndex, sectionsOffsets.value[section]); - const opacity = - section === Section.unpinned && isUnpinnedHidden.value - ? withTiming(0, TIMING_CONFIGS.fastFadeConfig) - : withDelay(100, withTiming(1, TIMING_CONFIGS.fadeConfig)); - const isBeingDragged = dragging.value?.chainId === chainId; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const position = isBeingDragged ? dragging.value!.position : slotPosition; return { - opacity, - zIndex: zIndex.value, + opacity: withSpring(section === Section.unpinned && isUnpinnedHidden.value ? 0 : 1, SPRING_CONFIGS.snappierSpringConfig), transform: [ - { scale: withSpring(isBeingDragged ? 1.05 : 1, SPRING_CONFIGS.springConfig) }, { translateX: isBeingDragged ? position.x : withSpring(position.x, SPRING_CONFIGS.springConfig) }, { translateY: isBeingDragged ? position.y : withSpring(position.y, SPRING_CONFIGS.springConfig) }, + { scale: withSpring(isBeingDragged ? 1.075 : 1, SPRING_CONFIGS.springConfig) }, ], + zIndex: zIndex.value, }; }); - return {children}; + return {children}; } const indexFromPosition = (x: number, y: number, offset: { y: number }) => { 'worklet'; const yoffsets = y > offset.y ? offset.y : 0; - const column = x > ITEM_WIDTH + GAP / 2 ? 1 : 0; - const row = Math.floor((y - yoffsets) / (ITEM_HEIGHT + GAP)); + const column = x > ITEM_WIDTH + ITEM_GAP / 2 ? 1 : 0; + const row = Math.floor((y - yoffsets) / (ITEM_HEIGHT + ITEM_GAP)); const index = row * 2 + column; return index < 0 ? 0 : index; // row can be negative if the dragged item is above the first row }; @@ -486,7 +419,7 @@ const positionFromIndex = (index: number, offset: { y: number }) => { 'worklet'; const column = index % 2; const row = Math.floor(index / 2); - const position = { x: column * (ITEM_WIDTH + GAP), y: row * (ITEM_HEIGHT + GAP) + offset.y }; + const position = { x: column * (ITEM_WIDTH + ITEM_GAP), y: row * (ITEM_HEIGHT + ITEM_GAP) + offset.y }; return position; }; @@ -497,22 +430,21 @@ type DraggingState = { }; function SectionSeparator({ - sectionsOffsets, editing, expanded, networks, + sectionsOffsets, + showExpandButtonAsNetworkChip, }: { - sectionsOffsets: SharedValue>; editing: SharedValue; expanded: SharedValue; networks: SharedValue>; + sectionsOffsets: SharedValue>; + showExpandButtonAsNetworkChip: SharedValue; }) { + const { isDarkMode } = useColorMode(); const pressed = useSharedValue(false); - const showExpandButtonAsNetworkChip = useDerivedValue(() => { - return !expanded.value && !editing.value && networks.value[Section.pinned].length % 2 !== 0; - }); - const visible = useDerivedValue(() => { return networks.value[Section.unpinned].length > 0 || editing.value; }); @@ -523,8 +455,12 @@ function SectionSeparator({ pressed.value = true; }) .onEnd(() => { - pressed.value = false; + triggerHaptics('selection'); expanded.value = !expanded.value; + pressed.value = false; + }) + .onFinalize(() => { + if (pressed.value) pressed.value = false; }); const text = useDerivedValue(() => { @@ -534,13 +470,13 @@ function SectionSeparator({ }); const unpinnedNetworksLength = useDerivedValue(() => networks.value[Section.unpinned].length.toString()); + const showMoreOrLessIcon = useDerivedValue(() => (expanded.value ? '􀆇' : '􀆈')); + + const showMoreOrLessIconStyle = useAnimatedStyle(() => ({ opacity: editing.value ? 0 : 1 })); const showMoreAmountStyle = useAnimatedStyle(() => ({ - opacity: expanded.value || editing.value ? 0 : 1, + opacity: withSpring(expanded.value || editing.value ? 0 : 1, SPRING_CONFIGS.snappierSpringConfig), + width: expanded.value ? 0 : parseFloat(unpinnedNetworksLength.value) >= 10 ? 30 : 24, })); - const showMoreOrLessIcon = useDerivedValue(() => (expanded.value ? '􀆇' : '􀆈') as string); - const showMoreOrLessIconStyle = useAnimatedStyle(() => ({ opacity: editing.value ? 0 : 1 })); - - const { isDarkMode } = useColorMode(); const separatorContainerStyles = useAnimatedStyle(() => { if (showExpandButtonAsNetworkChip.value) { @@ -549,87 +485,68 @@ function SectionSeparator({ backgroundColor: isDarkMode ? globalColors.white10 : globalColors.grey20, borderColor: '#F5F8FF05', height: ITEM_HEIGHT, - width: ITEM_WIDTH, - flexDirection: 'row', - alignItems: 'center', - borderRadius: 24, - borderWidth: THICK_BORDER_WIDTH, + opacity: visible.value ? 1 : 0, transform: [{ translateX: position.x }, { translateY: position.y }], + width: ITEM_WIDTH, }; } return { backgroundColor: 'transparent', + borderColor: 'transparent', + height: SEPARATOR_HEIGHT, opacity: visible.value ? 1 : 0, - transform: [{ translateY: sectionsOffsets.value[Section.separator].y }, { scale: withTiming(pressed.value ? 0.95 : 1) }], - position: 'absolute', + transform: [ + { translateY: sectionsOffsets.value[Section.separator].y }, + { scale: withTiming(pressed.value ? 0.925 : 1, TIMING_CONFIGS.buttonPressConfig) }, + ], width: '100%', - height: SEPARATOR_HEIGHT, }; }); return ( - - - + + + {unpinnedNetworksLength} - + {text} - - - {showMoreOrLessIcon} - - + + {showMoreOrLessIcon} + ); } function EmptyUnpinnedPlaceholder({ - sectionsOffsets, - networks, isUnpinnedHidden, + networks, + sectionsOffsets, }: { - sectionsOffsets: SharedValue>; - networks: SharedValue>; isUnpinnedHidden: SharedValue; + networks: SharedValue>; + sectionsOffsets: SharedValue>; }) { - const styles = useAnimatedStyle(() => { + const { isDarkMode } = useColorMode(); + const animatedStyle = useAnimatedStyle(() => { const isVisible = networks.value[Section.unpinned].length === 0 && !isUnpinnedHidden.value; return { - opacity: isVisible ? withTiming(1, { duration: 800 }) : 0, + opacity: withSpring(isVisible ? 0.5 : 0, SPRING_CONFIGS.snappierSpringConfig), transform: [{ translateY: sectionsOffsets.value[Section.unpinned].y }], }; }); - const { isDarkMode } = useColorMode(); + return ( - - {i18n.t(t.drag_here_to_unpin)} + + {i18n.t(t.drop_here_to_unpin)} ); @@ -637,12 +554,12 @@ function EmptyUnpinnedPlaceholder({ function NetworksGrid({ editing, - setSelected, selected, + setSelected, }: { editing: SharedValue; - setSelected: (chainId: ChainId | undefined) => void; selected: SharedValue; + setSelected: (chainId: ChainId | undefined) => void; }) { const initialPinned = networkSwitcherStore.getState().pinnedNetworks; const sortedSupportedChainIds = useBackendNetworksStore.getState().getSortedSupportedChainIds(); @@ -662,33 +579,38 @@ function NetworksGrid({ }, [networks]); const expanded = useSharedValue(false); + const dragging = useSharedValue(null); const isUnpinnedHidden = useDerivedValue(() => !expanded.value && !editing.value); - const dragging = useSharedValue(null); + const showExpandButtonAsNetworkChip = useDerivedValue(() => { + return !expanded.value && !editing.value && networks.value[Section.pinned].length % 2 !== 0; + }); const sectionsOffsets = useDerivedValue(() => { - const pinnedHeight = Math.ceil(networks.value[Section.pinned].length / 2) * (ITEM_HEIGHT + GAP) - GAP; + const pinnedHeight = Math.ceil(networks.value[Section.pinned].length / 2) * (ITEM_HEIGHT + ITEM_GAP) - ITEM_GAP; return { [Section.pinned]: { y: 0 }, [Section.separator]: { y: pinnedHeight }, - [Section.unpinned]: { y: pinnedHeight + SEPARATOR_HEIGHT }, + [Section.unpinned]: { y: pinnedHeight + (showExpandButtonAsNetworkChip.value ? SEPARATOR_HEIGHT_NETWORK_CHIP : SEPARATOR_HEIGHT) }, }; }); + const containerHeight = useDerivedValue(() => { const length = networks.value[Section.unpinned].length; - const paddingBottom = 32; + const paddingBottom = 18; const unpinnedHeight = isUnpinnedHidden.value ? length === 0 ? -SEPARATOR_HEIGHT + paddingBottom : 0 : length === 0 ? ITEM_HEIGHT + paddingBottom - : Math.ceil((length + 1) / 2) * (ITEM_HEIGHT + GAP) - GAP + paddingBottom; + : Math.ceil((length + (editing.value ? 1 : 0)) / 2) * (ITEM_HEIGHT + ITEM_GAP) - ITEM_GAP + paddingBottom; const height = sectionsOffsets.value[Section.unpinned].y + unpinnedHeight; return height; }); + const containerStyle = useAnimatedStyle(() => ({ - height: withDelay(expanded.value ? 0 : 25, withTiming(containerHeight.value, TIMING_CONFIGS.slowerFadeConfig)), + height: withSpring(containerHeight.value, SPRING_CONFIGS.springConfig), })); const dragNetwork = Gesture.Pan() @@ -711,6 +633,7 @@ function NetworksGrid({ } const position = positionFromIndex(index, sectionOffset); + triggerHaptics('soft'); dragging.value = { chainId, position }; }) .onChange(e => { @@ -732,6 +655,7 @@ function NetworksGrid({ networks[Section.unpinned] = sortedSupportedChainIds.filter(chainId => !networks[Section.pinned].includes(chainId)); } else if (section === Section.pinned && newIndex !== currentIndex) { // Reorder + triggerHaptics('selection'); networks[Section.pinned].splice(currentIndex, 1); networks[Section.pinned].splice(newIndex, 0, chainId); } @@ -758,6 +682,7 @@ function NetworksGrid({ const chainId = networks.value[section][index]; if (!chainId) return; + triggerHaptics('selection'); setSelected(chainId); }); @@ -779,7 +704,13 @@ function NetworksGrid({ ))} - + @@ -840,33 +771,160 @@ export function NetworkSelector() { return ( - - + + ); } const sx = StyleSheet.create({ + allNetworksButton: { + alignItems: 'center', + borderCurve: 'continuous', + borderRadius: 24, + borderWidth: THICK_BORDER_WIDTH, + flexDirection: 'row', + height: ITEM_HEIGHT, + overflow: 'hidden', + paddingHorizontal: 12, + }, + allNetworksCoinIcons: { + alignItems: 'center', + flexDirection: 'row', + marginLeft: 20, + position: 'absolute', + }, + allNetworksContainer: { + gap: 14, + justifyContent: 'flex-end', + }, + banner: { + left: 0, + position: 'absolute', + right: 0, + top: -(BANNER_HEIGHT + 14), + }, + bannerBlurView: { + height: BANNER_HEIGHT, + }, + bannerContent: { + alignItems: 'center', + flex: 1, + flexDirection: 'row', + gap: 12, + height: 68, + marginTop: 68 - BANNER_HEIGHT, + padding: 16 + 12, + }, + bannerGradient: { + alignItems: 'center', + backgroundColor: '#268FFF14', + borderColor: '#268FFF0D', + borderRadius: 10, + borderWidth: 1, + height: 36, + justifyContent: 'center', + width: 36, + }, + editButton: { + borderCurve: 'continuous', + borderRadius: 14, + borderWidth: THICK_BORDER_WIDTH, + height: 28, + justifyContent: 'center', + overflow: 'hidden', + paddingHorizontal: 10 - THICK_BORDER_WIDTH, + position: 'absolute', + right: 4, + top: IS_IOS ? 0 : -14, + }, + emptyUnpinnedPlaceholder: { + alignItems: 'center', + borderColor: '#F5F8FF05', + borderRadius: 24, + borderWidth: THICK_BORDER_WIDTH, + flexDirection: 'row', + height: 48, + paddingHorizontal: 12, + width: '100%', + }, + flex: { + flex: 1, + }, + headerContainer: { + alignItems: 'center', + borderBottomWidth: 1, + height: 66, + paddingTop: 20, + width: '100%', + }, + headerContent: { + alignItems: 'center', + flexDirection: 'row', + height: 28, + justifyContent: 'center', + }, + networkCountBadge: { + alignItems: 'center', + borderRadius: 12, + height: 24, + justifyContent: 'center', + width: 24, + }, + networkOption: { + alignItems: 'center', + borderCurve: 'continuous', + borderRadius: 24, + borderWidth: THICK_BORDER_WIDTH, + flexDirection: 'row', + height: ITEM_HEIGHT, + overflow: 'hidden', + paddingHorizontal: 12, + width: ITEM_WIDTH, + }, overlappingBadge: { - borderWidth: THICKER_BORDER_WIDTH, borderRadius: ALL_NETWORKS_BADGE_SIZE, + borderWidth: THICKER_BORDER_WIDTH, + height: ALL_NETWORKS_BADGE_SIZE + THICKER_BORDER_WIDTH * 2, marginLeft: -9, width: ALL_NETWORKS_BADGE_SIZE + THICKER_BORDER_WIDTH * 2, - height: ALL_NETWORKS_BADGE_SIZE + THICKER_BORDER_WIDTH * 2, + }, + positionAbsolute: { + position: 'absolute', + }, + sectionSeparatorContainer: { + alignItems: 'center', + borderRadius: 24, + borderWidth: THICK_BORDER_WIDTH, + flexDirection: 'row', + gap: 8, + justifyContent: 'center', + paddingHorizontal: 12, + position: 'absolute', }, sheet: { - flex: 1, - width: deviceUtils.dimensions.width - 16, + borderCurve: 'continuous', + borderRadius: 42, + borderWidth: THICK_BORDER_WIDTH, bottom: Math.max(safeAreaInsetValues.bottom + 5, IS_IOS ? 8 : 30), + flex: 1, + left: 8, + overflow: 'hidden', + paddingHorizontal: 16, pointerEvents: 'box-none', position: 'absolute', - zIndex: 30000, - left: 8, right: 8, - paddingHorizontal: 16, + width: deviceUtils.dimensions.width - 16, + zIndex: 30000, + }, + sheetHandle: { + alignSelf: 'center', borderCurve: 'continuous', - borderRadius: 42, - borderWidth: THICK_BORDER_WIDTH, + borderRadius: 3, + height: 5, overflow: 'hidden', + position: 'absolute', + top: 6, + width: 36, }, }); diff --git a/src/languages/en_US.json b/src/languages/en_US.json index 66bdb0dec0d..c8ad721b68a 100644 --- a/src/languages/en_US.json +++ b/src/languages/en_US.json @@ -3076,8 +3076,9 @@ "tap_the": "Tap the", "button_to_set_up": "button below to set up" }, - "drag_here_to_unpin": "Drop Here to Unpin", + "drop_here_to_unpin": "Drop Here to Unpin", "edit": "Edit", + "network": "Network", "networks": "Networks", "drag_to_rearrange": "Drag to Rearrange", "show_less": "Show Less",