From f65f05270de41ece621deebd9f0718b22e911bbc Mon Sep 17 00:00:00 2001 From: Douglas Daniel Date: Tue, 7 Feb 2023 01:20:31 -0600 Subject: [PATCH] fix(wallet): Reduce Duplicated Strings --- .../browser/brave_wallet_constants.h | 7 ++-- .../page/screens/swap/adapters.ts | 2 +- .../page/screens/swap/swap.tsx | 9 +---- components/resources/wallet_strings.grdp | 7 ++-- package-lock.json | 38 ++++++++++++++----- package.json | 2 +- 6 files changed, 38 insertions(+), 27 deletions(-) diff --git a/components/brave_wallet/browser/brave_wallet_constants.h b/components/brave_wallet/browser/brave_wallet_constants.h index cbd7d63b81c8..4edddf0597eb 100644 --- a/components/brave_wallet/browser/brave_wallet_constants.h +++ b/components/brave_wallet/browser/brave_wallet_constants.h @@ -1099,10 +1099,9 @@ constexpr webui::LocalizedString kLocalizedStrings[] = { {"braveSwapHelpCenter", IDS_BRAVE_SWAP_HELP_CENTER}, {"braveSwapPrivacyPolicy", IDS_BRAVE_SWAP_PRIVACY_POLICY}, {"braveSwapPrivacyDescription", IDS_BRAVE_SWAP_PRIVACY_DESCRIPTION}, - {"braveSwapZeroXDisclaimer", IDS_BRAVE_SWAP_ZERO_EX_DISCLAIMER}, - {"braveSwapJupiterDisclaimer", IDS_BRAVE_SWAP_JUPITER_DISCLAIMER}, - {"braveSwapZeroXPrivacy", IDS_BRAVE_SWAP_ZERO_EX_PRIVACY}, - {"braveSwapJupiterPrivacy", IDS_BRAVE_SWAP_JUPITER_PRIVACY}}; + {"braveSwapV2Disclaimer", IDS_BRAVE_SWAP_V2_DISCLAIMER}, + {"braveSwapV2Privacy", IDS_BRAVE_SWAP_V2_PRIVACY}, + {"braveSwapChangeNetwork", IDS_BRAVE_SWAP_CHANGE_NETWORK}}; // 0x swap constants constexpr char kGoerliSwapBaseAPIURL[] = "https://goerli.api.0x.org/"; diff --git a/components/brave_wallet_ui/page/screens/swap/adapters.ts b/components/brave_wallet_ui/page/screens/swap/adapters.ts index 1e664e016572..5dee9f44e09a 100644 --- a/components/brave_wallet_ui/page/screens/swap/adapters.ts +++ b/components/brave_wallet_ui/page/screens/swap/adapters.ts @@ -82,7 +82,6 @@ export function makeNetworkInfo (network: BraveWallet.NetworkInfo): NetworkInfo export function makeWalletAccount (account: WalletAccountType): WalletAccount { return { - id: account.address, name: account.name, address: account.address, coin: account.coin @@ -307,6 +306,7 @@ export function makeSwitchNetwork () { async function switchNetwork (network: NetworkInfo) { const { jsonRpcService } = getAPIProxy() await jsonRpcService.setNetwork(network.chainId, network.coin) + return undefined } return switchNetwork diff --git a/components/brave_wallet_ui/page/screens/swap/swap.tsx b/components/brave_wallet_ui/page/screens/swap/swap.tsx index 77535338451e..74993bd16731 100644 --- a/components/brave_wallet_ui/page/screens/swap/swap.tsx +++ b/components/brave_wallet_ui/page/screens/swap/swap.tsx @@ -4,7 +4,6 @@ // you can obtain one at https://mozilla.org/MPL/2.0/. import * as React from 'react' -import { useHistory } from 'react-router-dom' import { NetworkInfo, Swap as SwapInterface } from '@brave/swap-interface' import '@brave/swap-interface/dist/style.css' @@ -23,7 +22,7 @@ import { import { useLib } from '../../../common/hooks' // Types -import { BraveWallet, WalletAccountType, WalletRoutes } from '../../../constants/types' +import { BraveWallet, WalletAccountType } from '../../../constants/types' // Components import { BuySendSwapDepositNav } from '../../../components/desktop/buy-send-swap-deposit-nav/buy-send-swap-deposit-nav' @@ -124,11 +123,6 @@ export const Swap = () => { } }, []) - let history = useHistory() - const goBack = React.useCallback(() => { - history.push(WalletRoutes.Portfolio) - }, [history]) - return (
@@ -156,7 +150,6 @@ export const Swap = () => { getTokenPrice={makeGetTokenPrice(defaultFiatCurrency)} supportedNetworks={supportedNetworks} defaultBaseCurrency={defaultFiatCurrency} - routeBackToWallet={goBack} isWalletConnected={true} isReady={!!selectedNetwork} /> diff --git a/components/resources/wallet_strings.grdp b/components/resources/wallet_strings.grdp index c490b2b3beab..ce9261d19d13 100644 --- a/components/resources/wallet_strings.grdp +++ b/components/resources/wallet_strings.grdp @@ -820,10 +820,9 @@ Help Center Privacy Policy This app uses the following third-party APIs: - Brave Swap uses 0x as a DEX aggregator for supported EVM networks. 0x will process the Ethereum wallet address and IP address to fulfill a transaction (including getting quotes). 0x will ONLY use this data for the purposes of processing transactions. - Brave Swap uses Jupiter as a DEX aggregator for Solana network. Jupiter will process the Solana wallet address and IP address to fulfill a transaction (including getting quotes). Jupiter will ONLY use this data for the purposes of processing transactions. - Click here for 0x Privacy Policy. - Click here for Jupiter Privacy Policy. + Brave Swap uses $10x as a DEX aggregator for supported $2EVM networks. $10x will process the $3Ethereum wallet address and IP address to fulfill a transaction (including getting quotes). $10x will ONLY use this data for the purposes of processing transactions. + Click here for $10x Privacy Policy. + Change network Activity Network is required Token name is required diff --git a/package-lock.json b/package-lock.json index 4a11794c90f9..3f6b7336eceb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "devDependencies": { "@babel/core": "7.16.0", "@babel/plugin-proposal-export-namespace-from": "7.16.0", - "@brave/swap-interface": "0.12.6", + "@brave/swap-interface": "0.14.2", "@storybook/addon-essentials": "6.4.13", "@storybook/addon-knobs": "6.4.0", "@storybook/addons": "6.4.13", @@ -3383,13 +3383,12 @@ } }, "node_modules/@brave/swap-interface": { - "version": "0.12.6", - "resolved": "https://registry.npmjs.org/@brave/swap-interface/-/swap-interface-0.12.6.tgz", - "integrity": "sha512-JdwktVw7Plf3n05vFzw0Efh83VHdAbeM1rFQyBZy9tTAnr/c6uRr3ikWl+fRWBQH9J8Aky0flC+YqanezG8ZQg==", + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@brave/swap-interface/-/swap-interface-0.14.2.tgz", + "integrity": "sha512-yUtgqvwWyGNA8aspHzu80W2C/rBQ3wK1UDeXKG76gC7IoLeAmLvf6xr67hpAppB+8pCIsNyZAv+lnoJNtyS0yg==", "dev": true, "dependencies": { "@brave/leo": "github:brave/leo", - "@brave/react-virtualized-auto-sizer": "^1.0.4", "@types/react-window": "^1.8.2", "@types/styled-components": "^5.1.9", "async": "^3.2.4", @@ -3398,6 +3397,7 @@ "postcss-js": "^4.0.0", "react": "^16.14.0", "react-dom": "^16.14.0", + "react-virtualized-auto-sizer": "^1.0.7", "react-window": "^1.8.5", "styled-components": "^5.3.0", "svelte2tsx": "^0.5.20" @@ -24110,6 +24110,19 @@ "react-dom": ">=16.6.0" } }, + "node_modules/react-virtualized-auto-sizer": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/react-virtualized-auto-sizer/-/react-virtualized-auto-sizer-1.0.7.tgz", + "integrity": "sha512-Mxi6lwOmjwIjC1X4gABXMJcKHsOo0xWl3E3ugOgufB8GJU+MqrtY35aBuvCYv/razQ1Vbp7h1gWJjGjoNN5pmA==", + "dev": true, + "engines": { + "node": ">8.0.0" + }, + "peerDependencies": { + "react": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0-rc", + "react-dom": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0-rc" + } + }, "node_modules/react-window": { "version": "1.8.6", "resolved": "https://registry.npmjs.org/react-window/-/react-window-1.8.6.tgz", @@ -33776,13 +33789,12 @@ "requires": {} }, "@brave/swap-interface": { - "version": "0.12.6", - "resolved": "https://registry.npmjs.org/@brave/swap-interface/-/swap-interface-0.12.6.tgz", - "integrity": "sha512-JdwktVw7Plf3n05vFzw0Efh83VHdAbeM1rFQyBZy9tTAnr/c6uRr3ikWl+fRWBQH9J8Aky0flC+YqanezG8ZQg==", + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@brave/swap-interface/-/swap-interface-0.14.2.tgz", + "integrity": "sha512-yUtgqvwWyGNA8aspHzu80W2C/rBQ3wK1UDeXKG76gC7IoLeAmLvf6xr67hpAppB+8pCIsNyZAv+lnoJNtyS0yg==", "dev": true, "requires": { "@brave/leo": "github:brave/leo", - "@brave/react-virtualized-auto-sizer": "^1.0.4", "@types/react-window": "^1.8.2", "@types/styled-components": "^5.1.9", "async": "^3.2.4", @@ -33791,6 +33803,7 @@ "postcss-js": "^4.0.0", "react": "^16.14.0", "react-dom": "^16.14.0", + "react-virtualized-auto-sizer": "^1.0.7", "react-window": "^1.8.5", "styled-components": "^5.3.0", "svelte2tsx": "^0.5.20" @@ -49767,6 +49780,13 @@ "prop-types": "^15.6.2" } }, + "react-virtualized-auto-sizer": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/react-virtualized-auto-sizer/-/react-virtualized-auto-sizer-1.0.7.tgz", + "integrity": "sha512-Mxi6lwOmjwIjC1X4gABXMJcKHsOo0xWl3E3ugOgufB8GJU+MqrtY35aBuvCYv/razQ1Vbp7h1gWJjGjoNN5pmA==", + "dev": true, + "requires": {} + }, "react-window": { "version": "1.8.6", "resolved": "https://registry.npmjs.org/react-window/-/react-window-1.8.6.tgz", diff --git a/package.json b/package.json index 2e46587f3ee3..5d8c437e5159 100644 --- a/package.json +++ b/package.json @@ -274,7 +274,7 @@ "devDependencies": { "@babel/core": "7.16.0", "@babel/plugin-proposal-export-namespace-from": "7.16.0", - "@brave/swap-interface": "0.12.6", + "@brave/swap-interface": "0.14.2", "@storybook/addon-essentials": "6.4.13", "@storybook/addon-knobs": "6.4.0", "@storybook/addons": "6.4.13",