Skip to content
This repository was archived by the owner on May 18, 2023. It is now read-only.

Commit 798ba61

Browse files
committed
Merge remote-tracking branch 'trident/master'
2 parents 0ba732d + 5c99024 commit 798ba61

File tree

1,060 files changed

+55391
-27634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,060 files changed

+55391
-27634
lines changed

.babelrc

-4
This file was deleted.

.babelrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
presets: ['next/babel'],
3+
plugins: ['macros'],
4+
}

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.env.example

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
NEXT_PUBLIC_TRANSAK_API_KEY=""
2-
NEXT_PUBLIC_ARCHER_API_KEY=""
3-
NEXT_PUBLIC_GOOGLE_ANALYTICS=""
4-
NEXT_PUBLIC_STRAPI_API_URL=https://sushi-strapi.herokuapp.com
1+
NEXT_PUBLIC_TRANSAK_API_KEY=
2+
NEXT_PUBLIC_TRANSAK_ENVIRONMENT=
3+
NEXT_PUBLIC_CLOUDINARY_URL=
4+
NEXT_PUBLIC_GOOGLE_ANALYTICS=
5+
NEXT_PUBLIC_INTO_THE_BLOCK_API_KEY=
6+
NEXT_PUBLIC_SENTRY_DSN=
7+
REDIS_URL=
8+
STORYBOOK_ZEPLIN_TOKEN=
9+
ETHEREUM_ALCHEMY_API_KEY=
10+
KOVAN_ALCHEMY_API_KEY=
11+
TEST_SEED=
12+
TEST_SEED2=
13+
TEST_PASS=
14+
TEST_PKEY=
15+
TEST_BASE_URL=
16+
TEST_PUPPETEER_EXEC_PATH=
17+
TEST_ACCOUNT2_PUB_KEY=
18+
CI=

.eslintrc

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
{
2-
// "extends": ["next", "next/core-web-vitals"]
3-
"extends": ["next"],
2+
"extends": ["next", "next/core-web-vitals"],
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint", "simple-import-sort", "unused-imports"],
45
"rules": {
5-
"react/display-name": "off"
6+
"react/display-name": "off",
7+
"react-hooks/exhaustive-deps": [
8+
"warn",
9+
{
10+
"additionalHooks": "useRecoilCallback|useRecoilTransaction_UNSTABLE"
11+
}
12+
],
13+
"@typescript-eslint/no-unused-vars": "off",
14+
"simple-import-sort/exports": "error",
15+
"simple-import-sort/imports": "error",
16+
"unused-imports/no-unused-imports": "error",
17+
"unused-imports/no-unused-vars": "off"
618
}
719
}

.github/workflows/ci.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Setup NodeJs
15+
uses: actions/setup-node@v2
16+
env:
17+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'
18+
with:
19+
node-version: 14
20+
21+
- name: Install Yarn
22+
run: npm install yarn --global
23+
24+
- name: Install packages
25+
run: yarn
26+
27+
- name: Run Unit tests
28+
run: yarn test:ci
29+
30+
- name: Run E2E tests
31+
uses: mujo-code/puppeteer-headful@v2
32+
env:
33+
CI: 'true'
34+
TEST_PASS: ${{ secrets.TEST_PASS }}
35+
TEST_SEED: ${{ secrets.TEST_SEED }}
36+
with:
37+
args: yarn e2e

.github/workflows/lokalise.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Lokalise
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
types: [closed]
10+
11+
jobs:
12+
lokalise:
13+
if: github.event.pull_request.merged == true
14+
name: Upload english to lokalise
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Setup Lokalise
18+
uses: sudosubin/setup-lokalise-action@v1.0.1
19+
with:
20+
lokalise-version: 'latest' # or specify version (ex. '2.6.3')
21+
- run: 'lokalise2 --version'
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js 14.x
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: 14.x
27+
cache: 'npm'
28+
- run: npm install @babel/core @lingui/cli @lingui/macro @lingui/core @lingui/react @lingui/remote-loader @lingui/loader next
29+
- run: npm run lingui
30+
- run: 'lokalise2 --token ${{ secrets.LOKALISE_TOKEN }} --project-id 18927102617d34a34e1467.51119957 file upload --file locale/en.json --lang-iso en'

.gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ npm-debug.log*
99
yarn-debug.log*
1010
yarn-error.log*
1111

12-
.vscode/
1312
.idea/
1413
.vercel
1514
.next
@@ -19,9 +18,8 @@ public/sw.js.map
1918
public/workbox*.js
2019
public/workbox*.js.map
2120

22-
/locale/_build/
23-
/locale/**/*.js
21+
/locale
2422

2523
.env
2624

27-
lokalise.yaml
25+
coverage

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/erbium
1+
lts/fermium

.storybook/main.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
3+
addons: [
4+
'@storybook/addon-links',
5+
'@storybook/addon-essentials',
6+
'storybook-zeplin/register',
7+
{
8+
name: '@storybook/addon-postcss',
9+
options: {
10+
cssLoaderOptions: {
11+
// When you have splitted your css over multiple files
12+
// and use @import('./other-styles.css')
13+
importLoaders: 1,
14+
},
15+
postcssLoaderOptions: {
16+
// When using postCSS 8
17+
implementation: require('postcss'),
18+
},
19+
},
20+
},
21+
],
22+
}

.storybook/preview.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import '../src/styles/index.css'
2+
import { i18n } from '@lingui/core'
3+
import * as plurals from 'make-plural'
4+
import { I18nProvider } from '@lingui/react'
5+
import Web3ReactManager from '../src/components/Web3ReactManager'
6+
import Web3ProviderNetwork from '../src/components/Web3ProviderNetwork'
7+
import { Web3ReactProvider } from '@web3-react/core'
8+
import getLibrary from '../src/functions/getLibrary'
9+
import store from '../src/state'
10+
import { Provider as ReduxProvider } from 'react-redux'
11+
12+
export const parameters = {
13+
actions: { argTypesRegex: '^on[A-Z].*' },
14+
controls: {
15+
matchers: {
16+
color: /(background|color)$/i,
17+
date: /Date$/,
18+
},
19+
},
20+
}
21+
22+
export const decorators = [
23+
(Story) => {
24+
i18n.loadLocaleData('en', { plurals: plurals['en'] })
25+
i18n.load('en', {})
26+
i18n.activate('en')
27+
28+
return (
29+
<I18nProvider i18n={i18n} forceRenderOnLocaleChange={false}>
30+
<Web3ReactProvider getLibrary={getLibrary}>
31+
<Web3ProviderNetwork getLibrary={getLibrary}>
32+
<Web3ReactManager>
33+
<ReduxProvider store={store}>
34+
<Story />
35+
</ReduxProvider>
36+
</Web3ReactManager>
37+
</Web3ProviderNetwork>
38+
</Web3ReactProvider>
39+
</I18nProvider>
40+
)
41+
},
42+
]

.vscode/extensions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"heybourn.headwind",
6+
"bradlc.vscode-tailwindcss"
7+
]
8+
}

.vscode/launch.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Next.js: debug server-side",
6+
"type": "node-terminal",
7+
"request": "launch",
8+
"command": "npm run dev"
9+
},
10+
{
11+
"name": "Next.js: debug client-side",
12+
"type": "pwa-chrome",
13+
"request": "launch",
14+
"url": "http://localhost:3000"
15+
},
16+
{
17+
"name": "Next.js: debug full stack",
18+
"type": "node-terminal",
19+
"request": "launch",
20+
"command": "npm run dev",
21+
"console": "integratedTerminal",
22+
"serverReadyAction": {
23+
"pattern": "started server on .+, url: (https?://.+)",
24+
"uriFormat": "%s",
25+
"action": "debugWithChrome"
26+
}
27+
},
28+
{
29+
"name": "Jest: Debug Tests",
30+
"type": "node",
31+
"request": "launch",
32+
"runtimeArgs": [
33+
"--inspect-brk",
34+
"${workspaceRoot}/node_modules/jest/bin/jest.js",
35+
"--runInBand"
36+
],
37+
"args": ["--testPathPattern", "${fileBasename}"],
38+
"console": "integratedTerminal",
39+
"internalConsoleOptions": "neverOpen",
40+
"port": 9229,
41+
"skipFiles": [
42+
"<node_internals>/**/*.js",
43+
"${workspaceRoot}/node_modules/**/*.js"
44+
],
45+
}
46+
]
47+
}

.vscode/settings.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"eslint.enable": true,
3+
"eslint.validate": [
4+
"javascript",
5+
"javascriptreact",
6+
"typescript",
7+
"typescriptreact"
8+
],
9+
"editor.defaultFormatter": "esbenp.prettier-vscode",
10+
"editor.formatOnPaste": false,
11+
"editor.formatOnSave": false,
12+
"[javascript]": {
13+
"editor.defaultFormatter": "esbenp.prettier-vscode",
14+
"editor.formatOnSave": true
15+
},
16+
"[typescript]": {
17+
"editor.defaultFormatter": "esbenp.prettier-vscode",
18+
"editor.formatOnSave": true,
19+
},
20+
"[typescriptreact]": {
21+
"editor.defaultFormatter": "esbenp.prettier-vscode",
22+
"editor.formatOnSave": true
23+
}
24+
}

Dockerfile.hardhat

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM node:16
2+
3+
WORKDIR /app
4+
5+
RUN git clone https://github.com/sushiswap/trident .
6+
RUN yarn
7+
RUN npx hardhat compile
8+
CMD npx hardhat node

commitlint.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['@commitlint/config-conventional']
3-
};
2+
extends: ['@commitlint/config-conventional'],
3+
}

docs/DEVELOPMENT.md

+1-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
11
# Development
22

3-
## Linking the SDK
4-
5-
The SushiSwap SDK is used heavily throughout the Sushi Interface. You might like to clone this library and link it for various reasons, such as debugging, extracting, or even further developing the SDK.
6-
7-
```sh
8-
git clone https://github.com/sushiswap/sushiswap-sdk.git && cd sushiswap-sdk && git checkout canary && yarn link
9-
```
10-
11-
In the Sushi Interface repository you'd link this package by running this command.
12-
13-
```sh
14-
yarn link @sushiswap/sdk
15-
```
16-
17-
If actively developing the SDK, you might like to run the watcher. You can do this by running this command in the root of the sdk repository once linked, and changes will be picked up by the interface in real-time.
18-
19-
```sh
20-
yarn watch
21-
```
3+
...

jest.config.ts

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { Config } from '@jest/types'
2+
3+
const config: Config.InitialOptions = {
4+
verbose: true,
5+
collectCoverageFrom: ['**/*.{ts,tsx}', '!**/*.d.ts', '!**/node_modules/**'],
6+
coveragePathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
7+
moduleNameMapper: {
8+
'^app/(.*)$': '<rootDir>/src/$1',
9+
'^functions/(.*)$': '<rootDir>/src/functions/$1',
10+
'^config/(.*)$': '<rootDir>/src/config/$1',
11+
'^features/(.*)$': '<rootDir>/src/features/$1',
12+
'^enums/(.*)$': '<rootDir>/src/enums/$1',
13+
'^enums': '<rootDir>/src/enums',
14+
/* Handle CSS imports (with CSS modules)
15+
https://jestjs.io/docs/webpack#mocking-css-modules */
16+
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
17+
18+
// Handle CSS imports (without CSS modules)
19+
'^.+\\.(css|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',
20+
21+
/* Handle image imports
22+
https://jestjs.io/docs/webpack#handling-static-assets */
23+
'^.+\\.(jpg|jpeg|png|gif|webp|svg)$': '<rootDir>/__mocks__/fileMock.js',
24+
},
25+
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/', '<rootDir>/src/pages/api/test.ts'],
26+
testEnvironment: '<rootDir>/test/unit/custom-test-env.ts',
27+
transform: {
28+
/* Use babel-jest to transpile tests with the next/babel preset
29+
https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object */
30+
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }],
31+
},
32+
transformIgnorePatterns: ['/node_modules/', '^.+\\.module\\.(css|sass|scss)$'],
33+
testTimeout: 600000,
34+
}
35+
36+
export default config

0 commit comments

Comments
 (0)