Skip to content

Commit

Permalink
Basic merge done, buch of conflicts resolved
Browse files Browse the repository at this point in the history
Not in a working state yet

Merge remote-tracking branch 'uniswap/main' into 2440/uni-merge
  • Loading branch information
Leandro committed Mar 1, 2022
2 parents 588ccf2 + ad08047 commit 7900f01
Show file tree
Hide file tree
Showing 470 changed files with 27,854 additions and 14,075 deletions.
33 changes: 28 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,48 @@
"jsx": true
}
},
"ignorePatterns": ["node_modules/**/*", ".github/*", "src/components/RateToggle/index.tsx"],
"settings": {
"react": {
"version": "detect"
}
},
"ignorePatterns": [
"node_modules/**/*",
".github/*",
"src/components/RateToggle/index.tsx",
"src/types/v3",
"src/abis/types",
"src/locales/**/*.js",
"src/locales/**/en-US.po",
"src/state/data/generated.ts",
"node_modules",
"coverage",
"build",
"dist",
".DS_Store",
".env.local",
".env.development.local",
".env.test.local",
".env.production.local",
".idea/",
".vscode/",
"package-lock.json",
"yarn.lock"
],
"extends": [
"react-app",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:jsx-a11y/recommended"
],
"plugins": ["simple-import-sort", "unused-imports"],
"rules": {
"unused-imports/no-unused-imports": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"prettier/prettier": "error",
"@typescript-eslint/no-explicit-any": "off",
Expand All @@ -35,10 +62,6 @@
"error",
{
"paths": [
{
"name": "lodash",
"message": "Please import from 'lodash/module' directly to support tree-shaking."
},
{
"name": "ethers",
"message": "Please import from '@ethersproject/module' directly to support tree-shaking."
Expand Down
7 changes: 3 additions & 4 deletions .github/uniswap-original/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
integration-tests:
name: Cypress
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -38,15 +38,14 @@ jobs:
run: yarn install --frozen-lockfile

- run: yarn cypress install

- run: yarn build
env:
CI: false
REACT_APP_NETWORK_URL: "https://mainnet.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847"
REACT_APP_NETWORK_URL: 'https://mainnet.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847'
REACT_APP_SERVICE_WORKER: false

- run: yarn integration-test
env:
CYPRESS_INTEGRATION_TEST_PRIVATE_KEY: ${{ secrets.CYPRESS_INTEGRATION_TEST_PRIVATE_KEY }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}


4 changes: 4 additions & 0 deletions .github/uniswap-original/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ jobs:
eslint: true
eslint_extensions: js,jsx,ts,tsx,json
auto_fix: true

- name: Run eslint
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
run: yarn eslint .
40 changes: 40 additions & 0 deletions .github/workflows/bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Widgets
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn widgets:build
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# generated contract types
/src/types/v3
/src/abis/types
/src/lib/locales/**/*.js
/src/lib/locales/**/en-US.po
/src/lib/locales/**/pseudo.po
/src/locales/**/*.js
/src/locales/**/*.ts
/src/locales/**/*.json
/src/locales/**/en-US.po
/src/locales/**/pseudo.po
/src/state/data/generated.ts

# dependencies
Expand All @@ -15,11 +19,10 @@
# testing
/coverage

# production
# builds
/build

# bundle
/dist
/dts

# misc
.DS_Store
Expand Down
File renamed without changes.
13 changes: 8 additions & 5 deletions cosmos.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"staticPath": "public",
"watchDirs": ["src"],
"watchDirs": [
"src"
],
"webpack": {
"configPath": "./cosmos.webpack.config"
}
}
"configPath": "react-scripts/config/webpack.config",
"overridePath": "cosmos.override.js"
},
"port": 5001
}
26 changes: 26 additions & 0 deletions cosmos.override.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { DefinePlugin } = require('webpack')

// Renders the cosmos fixtures in isolation, instead of using public/index.html.
module.exports = (webpackConfig) => ({
...webpackConfig,
plugins: webpackConfig.plugins.map((plugin) => {
if (plugin instanceof HtmlWebpackPlugin) {
return new HtmlWebpackPlugin({
templateContent: '<body></body>',
})
}
if (plugin instanceof DefinePlugin) {
return new DefinePlugin({
...plugin.definitions,
'process.env': {
...plugin.definitions['process.env'],
REACT_APP_IS_WIDGET: true,
REACT_APP_LOCALES: '"../locales"',
},
})
}
return plugin
}),
})
7 changes: 6 additions & 1 deletion cypress/fixtures/feeTierDistribution.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
}
},
"asToken0": [
{
"feeTier": "100",
"totalValueLockedToken0": "0",
"totalValueLockedToken1": "3"
},
{
"feeTier": "500",
"totalValueLockedToken0": "0",
Expand All @@ -13,7 +18,7 @@
{
"feeTier": "3000",
"totalValueLockedToken0": "0",
"totalValueLockedToken1": "7"
"totalValueLockedToken1": "4"
},
{
"feeTier": "10000",
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/add-liquidity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Add Liquidity', () => {
cy.wait('@feeTierDistributionQuery')

cy.get('#add-liquidity-selected-fee .selected-fee-label').should('contain.text', '0.3% fee tier')
cy.get('#add-liquidity-selected-fee .selected-fee-percentage').should('contain.text', '70%')
cy.get('#add-liquidity-selected-fee .selected-fee-percentage').should('contain.text', '40%')
})
})
})
20 changes: 17 additions & 3 deletions cypress/integration/swap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,32 @@ describe('Swap', () => {
beforeEach(() => {
cy.visit('/swap')
})

// TODO: add something similar
it.skip('starts with an ETH/USDC swap and quotes it', () => {
cy.get('#swap-currency-input .token-amount-input').should('have.value', '1')
cy.get('#swap-currency-input .token-symbol-container').should('contain.text', 'ETH')
cy.get('#swap-currency-output .token-amount-input').should('not.have.value', '')
cy.get('#swap-currency-output .token-symbol-container').should('contain.text', 'USDC')
})

it('can enter an amount into input', () => {
cy.get('#swap-currency-input .token-amount-input').type('0.001', { delay: 200 }).should('have.value', '0.001')
cy.get('#swap-currency-input .token-amount-input')
.clear()
.type('0.001', { delay: 200 })
.should('have.value', '0.001')
})

// TODO: enable it?
it.skip('zero swap amount', () => {
cy.get('#swap-currency-input .token-amount-input').type('0.0', { delay: 200 }).should('have.value', '0.0')
cy.get('#swap-currency-input .token-amount-input').clear().type('0.0', { delay: 200 }).should('have.value', '0.0')
})

it('invalid swap amount', () => {
cy.get('#swap-currency-input .token-amount-input').type('\\', { delay: 200 }).should('have.value', '')
cy.get('#swap-currency-input .token-amount-input').clear().type('\\', { delay: 200 }).should('have.value', '')
})

// TODO: enable it?
it.skip('can enter an amount into output', () => {
cy.get('#swap-currency-output .token-amount-input').type('0.001', { delay: 200 }).should('have.value', '0.001')
})
Expand Down
1 change: 1 addition & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class CustomizedBridge extends Eip1193Bridge {
}

// sets up the injected provider to be a mock ethereum provider with the given mnemonic/index
// eslint-disable-next-line no-undef
Cypress.Commands.overwrite('visit', (original, url, options) => {
return original(url.startsWith('/') && url.length > 2 && !url.startsWith('/#') ? `/#${url}` : url, {
...options,
Expand Down
7 changes: 6 additions & 1 deletion lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
const linguiConfig = {
catalogs: [
{
path: '<rootDir>/src/locales/{locale}',
Expand Down Expand Up @@ -40,14 +40,19 @@ export default {
// 'ru-RU',
// 'sr-SP',
// 'sv-SE',
// 'sw-TZ',
// 'tr-TR',
// 'uk-UA',
// 'vi-VN',
// 'zh-CN',
// 'zh-TW',
'pseudo',
],
orderBy: 'messageId',
rootDir: '.',
runtimeConfigModule: ['@lingui/core', 'i18n'],
sourceLocale: 'en-US',
pseudoLocale: 'pseudo',
}

export default linguiConfig
Loading

0 comments on commit 7900f01

Please sign in to comment.