Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge main #66

Merged
merged 40 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fa4873e
ci: use GITHUB_TOKEN org
Jul 26, 2023
b992617
Merge pull request #61 from AstraProtocol/fix/ci-gh-token
Jul 26, 2023
8fbfaab
style: update margin + mobile left menu header
Jul 27, 2023
81944a1
chore: add GA tracking
Jul 27, 2023
24081c2
fix: phising banner on mobile webapp, and astra app
Jul 27, 2023
b7aff21
Merge pull request #64 from AstraProtocol/fix/phising-banner-mobile-w…
Jul 27, 2023
ced32b5
Merge pull request #63 from AstraProtocol/chore/add-ga-tracking
Jul 27, 2023
36bcebd
ci: missing arg dockerfile
Jul 27, 2023
bf3a808
Merge pull request #65 from AstraProtocol/fix/missing-arg-dockerfile
Jul 27, 2023
ca55c61
fix: update footer
viennguyen2-tiki Aug 2, 2023
3938486
Merge pull request #67 from AstraProtocol/fix/footer
viennguyen2-tiki Aug 2, 2023
56ae797
fix: update UI code syntax view info
Aug 3, 2023
ff10d9f
fix: import Info page
Aug 3, 2023
32a063b
fix: remove wagmi, viem
Aug 3, 2023
3b75c55
fix: edit query to match sub-graph query
Aug 3, 2023
1f5f663
fix: rewrite info component + chart
Aug 3, 2023
1aa76dc
style: fix ClickableColumnHeader text style
Aug 3, 2023
1bbbab1
fix: transactions table radio option
Aug 4, 2023
23ef49c
fix: info navigation
Aug 4, 2023
d700a06
fix: vi locale for date in info table
Aug 7, 2023
669c10b
fix: chart color style
Aug 16, 2023
ef0c95e
fix: logic for info pages
Aug 16, 2023
4e7aa80
fix: remove saved token
Aug 16, 2023
677c50f
fix: token info detail
Aug 17, 2023
b6db4d6
fix: show info page on mobile
Aug 18, 2023
c23983e
refactor: token info page + upgrade swr for 'keepPreviousData' property
Aug 21, 2023
6490203
translation: update text
Aug 23, 2023
5cb3370
fix: candle chart
Aug 23, 2023
8e65ec2
fix: style pair detail page
Aug 23, 2023
64a4422
fix: undefined router address make endless loop getPairPrices
Aug 23, 2023
bd0d40d
fix: show chart info
Aug 23, 2023
d625db7
translation: update translate
Aug 23, 2023
efa7f2b
fix: duplicate candle chart + chart loading
Aug 24, 2023
80c1dac
Merge pull request #68 from AstraProtocol/feat/info-page
ruitran Aug 25, 2023
a5ba356
fix: ci build
Aug 25, 2023
8eb1dc4
fix: error lint buikd
Aug 25, 2023
62305a9
translation: add text translate
Aug 25, 2023
402a694
Merge pull request #69 from AstraProtocol/fix/ci-build
Aug 25, 2023
56abdd9
fix: info page for mainnet
Aug 28, 2023
e2cb90c
Merge pull request #70 from AstraProtocol/feat/info-page
Aug 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
secrets:
secretBuildArgs: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
GITHUB_TOKEN=${{ secrets.GH_AUTH_TOKEN }}
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
with:
namespace: "solarswap-dev"
ingressEnabled: "yes"
Expand All @@ -25,7 +25,7 @@ jobs:
NEXT_PUBLIC_NODE_PRODUCTION=https://rpc.astranaut.dev
NEXT_PUBLIC_HOST=https://defi.astranaut.dev
NEXT_PUBLIC_EXPLORER=http://explorer.astranaut.dev
NEXT_PUBLIC_GTAG=''
NEXT_PUBLIC_GA_MEASUREMENT_ID=''
NEXT_PUBLIC_FEE=100
NEXT_PUBLIC_TITLE=SolarSwap
NEXT_PUBLIC_WALLET_CONNECT_RELAY=relay.walletconnect.com
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/integrationTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
scope: '@astraprotocol'
token: ${{ secrets.GH_AUTH_TOKEN }}
# token: ${{ secrets.PAT_ASTRAPROTOCOL }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -38,17 +37,15 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup npm token
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GH_AUTH_TOKEN}}"
# run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.PAT_ASTRAPROTOCOL}}"
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GITHUB_TOKEN}}"

- name: Setup for cypress
run: sudo apt-get update -y && sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb -y

- name: Cypress install
run: yarn install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
# NODE_AUTH_TOKEN: ${{ secrets.PAT_ASTRAPROTOCOL }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: make env
uses: canastro/copy-file-action@master
with:
Expand All @@ -63,7 +60,6 @@ jobs:
wait-on: 'http://localhost:3000'
env:
# pass the Cypress Cloud record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 2 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ jobs:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
scope: '@astraprotocol'
token: ${{ secrets.GH_AUTH_TOKEN }}
# token: ${{ secrets.PAT_ASTRAPROTOCOL }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -45,8 +44,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Setup npm token
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GH_AUTH_TOKEN}}"
# run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.PAT_ASTRAPROTOCOL}}"
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GITHUB_TOKEN}}"

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
NEXT_PUBLIC_NODE_PRODUCTION=https://rpc.astranaut.io
NEXT_PUBLIC_HOST=https://solarswap.io
NEXT_PUBLIC_EXPLORER=http://explorer.astranaut.io
NEXT_PUBLIC_GTAG=G-MK9VVY7GT5
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-MK9VVY7GT5
NEXT_PUBLIC_FEE=100
NEXT_PUBLIC_TITLE=SolarSwap
NEXT_PUBLIC_WALLET_CONNECT_RELAY=wc-relay.astranaut.io
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/testConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ jobs:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
scope: '@astraprotocol'
token: ${{ secrets.GH_AUTH_TOKEN }}
# token: ${{ secrets.PAT_ASTRAPROTOCOL }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -46,8 +45,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup npm token
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GH_AUTH_TOKEN}}"
# run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.PAT_ASTRAPROTOCOL}}"
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GITHUB_TOKEN}}"

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/unitTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ jobs:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
scope: '@astraprotocol'
token: ${{ secrets.GH_AUTH_TOKEN }}
# token: ${{ secrets.PAT_ASTRAPROTOCOL }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -45,8 +44,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Setup npm token
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GH_AUTH_TOKEN}}"
# run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.PAT_ASTRAPROTOCOL}}"
run: npm config set '//npm.pkg.github.com/:_authToken' "${{secrets.GITHUB_TOKEN}}"

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ARG NEXT_PUBLIC_SENTRY_DSN
ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT
ARG NEXT_PUBLIC_GN_INFO_CLIENT
ARG NEXT_PUBLIC_GN_BLOCK_CLIENT
ARG NEXT_PUBLIC_GA_MEASUREMENT_ID

COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/src ./src
Expand All @@ -50,7 +51,7 @@ RUN SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} \
NEXT_PUBLIC_NODE_PRODUCTION=${NEXT_PUBLIC_NODE_PRODUCTION} \
NEXT_PUBLIC_HOST=${NEXT_PUBLIC_HOST} \
NEXT_PUBLIC_EXPLORER=${NEXT_PUBLIC_EXPLORER} \
NEXT_PUBLIC_GTAG=${NEXT_PUBLIC_GTAG} \
NEXT_PUBLIC_GA_MEASUREMENT_ID=${NEXT_PUBLIC_GA_MEASUREMENT_ID} \
NEXT_PUBLIC_FEE=${NEXT_PUBLIC_FEE} \
NEXT_PUBLIC_TITLE=${NEXT_PUBLIC_TITLE} \
NEXT_PUBLIC_WALLET_CONNECT_RELAY=${NEXT_PUBLIC_WALLET_CONNECT_RELAY} \
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@astra-sdk/connector": "^2.0.0",
"@astra-sdk/wallet-connect": "^2.0.0",
"@astra-sdk/walletconnect-connector": "^2.0.0",
"@astraprotocol/astra-ui": "^1.0.44",
"@astraprotocol/astra-ui": "^1.0.46",
"@ethersproject/abi": "^5.5.0",
"@ethersproject/address": "^5.5.0",
"@ethersproject/bignumber": "^5.5.0",
Expand Down Expand Up @@ -77,14 +77,17 @@
"framer-motion": "^4.1.17",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"lightweight-charts": "^3.5.0",
"jotai": "2.2.3",
"lightweight-charts": "^4.0.1",
"lint-staged": "^12.3.4",
"local-storage": "^2.0.0",
"lodash": "^4.17.21",
"multicodec": "^2.0.0",
"multihashes": "^3.0.1",
"next": "^12.1.0",
"next-seo": "6.1.0",
"next-themes": "^0.1.1",
"nextjs-google-analytics": "2.3.3",
"numeral": "^2.0.6",
"react": "^18.2.0",
"react-countup": "^6.4.0",
Expand All @@ -100,7 +103,7 @@
"recharts": "2.7.2",
"redux-persist": "^6.0.0",
"sharp": "^0.31.3",
"swr": "^1.2.2",
"swr": "^2.1.5",
"typescript": "^4.5.4"
},
"devDependencies": {
Expand Down
12 changes: 11 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1608,5 +1608,15 @@
"Error importing list": "Error importing list",
"Enter valid list location": "Enter valid list location",
"Phishing warning: Please make sure you’re visiting": "Phishing warning: Please make sure you’re visiting",
"Check the URL carefully": "Check the URL carefully"
"Check the URL carefully": "Check the URL carefully",
"No pair has been created with this token yet. Create one": "No pair has been created with this token yet. Create one",
"Solarswap Info & Analytics": "Solarswap Info & Analytics",
"Pairs": "Pairs",
"Pair": "Pair",
"Token": "Token",
"Top Pair": "Top Pair",
"All Pairs": "All Pairs",
"Before trading any token, please DYOR, and pay attention to the risk scanner.": "Before trading any token, please DYOR, and pay attention to the risk scanner.",
"The markets for some of the newer and low-cap tokens displayed on the v2 info page are highly volatile, and as a result, token information may not be accurate.": "The markets for some of the newer and low-cap tokens displayed on the v2 info page are highly volatile, and as a result, token information may not be accurate.",
"Search liquidity pairs or tokens": "Search liquidity pairs or tokens"
}
12 changes: 11 additions & 1 deletion public/locales/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1608,5 +1608,15 @@
"Error importing list": "Lỗi khi nhập danh sách",
"Enter valid list location": "Nhập địa chỉ danh sách không hợp lệ",
"Phishing warning: Please make sure you’re visiting": "Cảnh báo lừa đảo: Vui lòng đảm bảo bạn đang truy cập",
"Check the URL carefully": "Hãy kiểm tra URL cẩn thận"
"Check the URL carefully": "Hãy kiểm tra URL cẩn thận",
"No pair has been created with this token yet. Create one": "Chưa có cặp nào được tạo với điểm thưởng này. Hãy tạo một cặp",
"Solarswap Info & Analytics": "Solarswap Thông tin và Phân tích",
"Pairs": "Cặp",
"Pair": "Cặp",
"Token": "Điểm",
"Top Pairs": "Cặp hàng đầu",
"All Pairs": "Toàn bộ cặp",
"Before trading any token, please DYOR, and pay attention to the risk scanner.": "Trước khi giao dịch bất kỳ điểm nào, vui lòng DYOR và chú ý đến trình quét rủi ro.",
"The markets for some of the newer and low-cap tokens displayed on the v2 info page are highly volatile, and as a result, token information may not be accurate.": "Thị trường của một số điểm mới hơn và có vốn hóa thấp được hiển thị trên trang thông tin v2 rất biến động và do đó, thông tin về điểm có thể không chính xác.",
"Search liquidity pairs or tokens": "Tìm kiếm các cặp thanh khoản hoặc điểm"
}
164 changes: 82 additions & 82 deletions src/__tests__/views/info/utils/infoData.test.ts
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
import {
getAmountChange,
getPercentChange,
getChangeForPeriod,
getLpFeesAndApr,
getPercentChange,
} from 'views/Info/utils/infoDataHelpers'

describe('info/utils/infoDataHelpers', () => {
test.todo('Add test back')
it.each`
valueNow | valueBefore | expected
${undefined} | ${undefined} | ${0}
${1234} | ${undefined} | ${1234}
${1000} | ${11} | ${989}
${1234} | ${123} | ${1111}
${1234.69} | ${123.45} | ${1111.24}
${200} | ${350} | ${-150}
`('getAmountChange returns $expected for $valueNow and $valueBefore', ({ valueNow, valueBefore, expected }) => {
const actual = getAmountChange(valueNow, valueBefore)
expect(actual).toBe(expected)
})
it.each`
valueNow | valueBefore | expected
${undefined} | ${undefined} | ${0}
${1234} | ${undefined} | ${1234}
${1000} | ${11} | ${989}
${1234} | ${123} | ${1111}
${1234.69} | ${123.45} | ${1111.24}
${200} | ${350} | ${-150}
`('getAmountChange returns $expected for $valueNow and $valueBefore', ({ valueNow, valueBefore, expected }) => {
const actual = getAmountChange(valueNow, valueBefore)
expect(actual).toBe(expected)
})

it.each`
valueNow | valueBefore | expected
${undefined} | ${undefined} | ${0}
${1234} | ${undefined} | ${0}
${100} | ${50} | ${100}
${100} | ${80} | ${25}
${100} | ${200} | ${-50}
${100} | ${400} | ${-75}
${100} | ${100} | ${0}
`('getPercentChange returns $expected for $valueNow and $valueBefore', ({ valueNow, valueBefore, expected }) => {
const actual = getPercentChange(valueNow, valueBefore)
expect(actual).toBe(expected)
})
it.each`
valueNow | valueBefore | expected
${undefined} | ${undefined} | ${0}
${1234} | ${undefined} | ${0}
${100} | ${50} | ${100}
${100} | ${80} | ${25}
${100} | ${200} | ${-50}
${100} | ${400} | ${-75}
${100} | ${100} | ${0}
`('getPercentChange returns $expected for $valueNow and $valueBefore', ({ valueNow, valueBefore, expected }) => {
const actual = getPercentChange(valueNow, valueBefore)
expect(actual).toBe(expected)
})

it.each`
valueNow | valueOnePeriodAgo | valueTwoPeriodsAgo | expected
${undefined} | ${undefined} | ${undefined} | ${[0, 0]}
${100} | ${undefined} | ${undefined} | ${[100, 0]}
${100} | ${50} | ${undefined} | ${[50, 0]}
${100} | ${20} | ${undefined} | ${[80, 300]}
${100} | ${20} | ${10} | ${[80, 700]}
${100} | ${90} | ${70} | ${[10, -50]}
`(
'getChangeForPeriod returns $expected for $valueNow, $valueOnePeriodAgo and $valueTwoPeriodsAgo',
({ valueNow, valueOnePeriodAgo, valueTwoPeriodsAgo, expected }) => {
const actual = getChangeForPeriod(valueNow, valueOnePeriodAgo, valueTwoPeriodsAgo)
expect(actual).toStrictEqual(expected)
},
)
it.each`
valueNow | valueOnePeriodAgo | valueTwoPeriodsAgo | expected
${undefined} | ${undefined} | ${undefined} | ${[0, 0]}
${100} | ${undefined} | ${undefined} | ${[100, 0]}
${100} | ${50} | ${undefined} | ${[50, 0]}
${100} | ${20} | ${undefined} | ${[80, 300]}
${100} | ${20} | ${10} | ${[80, 700]}
${100} | ${90} | ${70} | ${[10, -50]}
`(
'getChangeForPeriod returns $expected for $valueNow, $valueOnePeriodAgo and $valueTwoPeriodsAgo',
({ valueNow, valueOnePeriodAgo, valueTwoPeriodsAgo, expected }) => {
const actual = getChangeForPeriod(valueNow, valueOnePeriodAgo, valueTwoPeriodsAgo)
expect(actual).toStrictEqual(expected)
},
)

it.each`
volumeUSD | volumeUSDWeek | liquidityUSD | expected
${0} | ${0} | ${0} | ${{
totalFees24h: 0,
totalFees7d: 0,
lpFees24h: 0,
lpFees7d: 0,
lpApr7d: 0,
}}
${100} | ${0} | ${0} | ${{
totalFees24h: 1,
totalFees7d: 0,
lpFees24h: 0.7,
lpFees7d: 0,
lpApr7d: 0,
}}
${100} | ${1000} | ${0} | ${{
totalFees24h: 1,
totalFees7d: 10,
lpFees24h: 0.7,
lpFees7d: 7,
lpApr7d: 0,
}}
${1000} | ${10000} | ${1000} | ${{
totalFees24h: 10,
totalFees7d: 100,
lpFees24h: 7,
lpFees7d: 70,
lpApr7d: 365,
}}
`(
'getLpFeesAndApr returns expected fees and APR for $volumeUSD, $volumeUSDWeek and $liquidityUSD',
({ volumeUSD, volumeUSDWeek, liquidityUSD, expected }) => {
const actual = getLpFeesAndApr(volumeUSD, volumeUSDWeek, liquidityUSD)
// Round actual to avoid rounding errors during comparison
Object.keys(actual).forEach(key => {
actual[key] = parseFloat(actual[key].toFixed(2))
})
expect(actual).toStrictEqual(expected)
},
)
it.each`
volumeUSD | volumeUSDWeek | liquidityUSD | expected
${0} | ${0} | ${0} | ${{
totalFees24h: 0,
totalFees7d: 0,
lpFees24h: 0,
lpFees7d: 0,
lpApr7d: 0,
}}
${100} | ${0} | ${0} | ${{
totalFees24h: 1,
totalFees7d: 0,
lpFees24h: 0.7,
lpFees7d: 0,
lpApr7d: 0,
}}
${100} | ${1000} | ${0} | ${{
totalFees24h: 1,
totalFees7d: 10,
lpFees24h: 0.7,
lpFees7d: 7,
lpApr7d: 0,
}}
${1000} | ${10000} | ${1000} | ${{
totalFees24h: 10,
totalFees7d: 100,
lpFees24h: 7,
lpFees7d: 70,
lpApr7d: 365,
}}
`(
'getLpFeesAndApr returns expected fees and APR for $volumeUSD, $volumeUSDWeek and $liquidityUSD',
({ volumeUSD, volumeUSDWeek, liquidityUSD, expected }) => {
const actual = getLpFeesAndApr(volumeUSD, volumeUSDWeek, liquidityUSD)
// Round actual to avoid rounding errors during comparison
Object.keys(actual).forEach(key => {
actual[key] = parseFloat(actual[key].toFixed(2))
})
expect(actual).toStrictEqual(expected)
},
)
})
2 changes: 1 addition & 1 deletion src/__tests__/views/info/utils/infoQueryHelpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDeltaTimestamps } from 'views/Info/utils/infoQueryHelpers'
import { getDeltaTimestamps } from 'utils/getDeltaTimestamps'

const UTC_NOW_UNDER_TEST = 1624809600

Expand Down
Loading
Loading