Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f53e2b0
tonconnect 2.0 added
antontsitovich Jan 26, 2023
0208c5a
cleanup
antontsitovich Jan 26, 2023
06bb453
fixes
antontsitovich Jan 29, 2023
0f844b3
wip
antontsitovich Jan 29, 2023
6450c17
wip
antontsitovich Jan 29, 2023
42727fc
wip
antontsitovich Jan 29, 2023
2536c63
wip
antontsitovich Jan 29, 2023
84645eb
wip
antontsitovich Jan 29, 2023
e202f4f
wip
antontsitovich Jan 31, 2023
c6db4fe
Merge branch 'master' of github.com:tonswap/tonswap-web into feature/…
antontsitovich Jan 31, 2023
de671b5
wip
antontsitovich Jan 31, 2023
b33a926
bugfixes
antontsitovich Jan 31, 2023
cc83361
bugfixes & translations
antontsitovich Feb 1, 2023
b9aa2d6
button state bugfix
antontsitovich Feb 1, 2023
a1cb46c
transaction status bugfix
antontsitovich Feb 1, 2023
795564b
version raise
antontsitovich Feb 1, 2023
0691485
fixing comments
antontsitovich Feb 1, 2023
dae9eda
fixing comments
antontsitovich Feb 1, 2023
87b01d7
fixed transactions bug
antontsitovich Feb 2, 2023
e0d9d8d
merging with master
antontsitovich Feb 12, 2023
d7000cf
mytonwallet connector added
antontsitovich Feb 12, 2023
329504f
bugfix
antontsitovich Feb 12, 2023
6427f67
merging with master
antontsitovich Feb 14, 2023
d6b82ef
bugfixes
antontsitovich Feb 15, 2023
539c27a
mytonwallet added
antontsitovich Feb 16, 2023
01929f1
tonkeeper relaod bugfix
antontsitovich Feb 16, 2023
9af3752
tonsafe addded, mobile select wallet path styled
antontsitovich Feb 19, 2023
37511e6
bugfix
antontsitovich Feb 19, 2023
50278e9
tonsafe mobile disabled
antontsitovich Feb 19, 2023
32511f8
tonsafe disabled, pending transaction popup added
antontsitovich Feb 20, 2023
b7d1cf1
delay fixed
antontsitovich Feb 20, 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
102 changes: 64 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"@tonconnect/sdk": "^2.0.7",
"@types/jest": "^27.4.1",
"@types/node": "^16.11.26",
"@types/react": "^17.0.41",
Expand All @@ -41,7 +42,6 @@
"react-ga4": "^1.4.1",
"react-i18next": "^11.18.3",
"react-number-format": "^4.9.1",
"react-qr-code": "^2.0.7",
"react-qrcode-logo": "^2.8.0",
"react-redux": "^8.0.2",
"react-router-dom": "^6.2.2",
Expand Down
5 changes: 5 additions & 0 deletions public/tonswap-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "The first decentralized AMM on The Open Network",
"url": "https://tonswap.org",
"iconUrl": "https://tonswap.org/logo192.png"
}
37 changes: 27 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { Box } from "@mui/material";
import { Box, Typography } from '@mui/material'
import AppRoutes from "router/Router";
import { Navbar } from "components";
import { LAYOUT_MAX_WIDTH } from "consts";
import { styled } from "@mui/system";
import SelectWallet from "components/SelectWallet";
import { useWalletActions } from "store/wallet/hooks";
import { useSelectedAdapter, useWalletActions, useWalletStore } from 'store/wallet/hooks'
import { AppGrid } from "styles/styles";
import useEffectOnce from "hooks/useEffectOnce";
import { useWebAppResize } from "store/application/hooks";
import './services/i18next/i18n';
import { useEffect } from 'react'
import { getHttpEndpoint } from '@orbs-network/ton-access'
import { TonClient } from 'ton'
import { setClienT } from 'services/api'
import { useDispatch, useSelector } from 'react-redux'
import { fetchTonConnectWallets } from 'store/wallet/actions'
import { RootState } from 'store/store'
import FullPageLoader from 'components/FullPageLoader'
import { useTokenOperationsStore } from 'store/token-operations/hooks'
import { isMobile } from 'react-device-detect'
import { useTranslation } from 'react-i18next'

const StyledAppContainer = styled(Box)({
display: "flex",
Expand All @@ -32,24 +37,36 @@ const StyledRoutesContainer = styled(AppGrid)({
});

const App = () => {
const { restoreSession } = useWalletActions();
const { restoreSession, restoreAdapter } = useWalletActions();
const { adapterId } = useWalletStore();
const wallets = useSelector((state: RootState) => state.wallet.allWallets)
const walletsLength = wallets?.length
const dispatch = useDispatch<any>()
const { txPending } = useTokenOperationsStore();
const adapter = useSelectedAdapter()
const {t} = useTranslation()
useWebAppResize();

useEffectOnce(() => {
restoreSession();
});

useEffect(() => {
(async () => {
const _client = new TonClient({
endpoint: "https://mainnet.tonhubapi.com/jsonRPC",
});
setClienT(_client)
})();
dispatch(fetchTonConnectWallets())
restoreSession();
}, [])

useEffect(() => {
adapterId && walletsLength && restoreAdapter(adapterId)
}, [walletsLength, adapterId])

return (
<>
<FullPageLoader open={txPending && !isMobile}>
<Typography>{t('pending-transaction', {adapter: adapter?.name || ''})}</Typography>
</FullPageLoader>
<StyledAppContainer>
<Navbar />
<SelectWallet />
Expand All @@ -61,4 +78,4 @@ const App = () => {
);
};

export default App;
export default App;
22 changes: 5 additions & 17 deletions src/components/FullPageLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import Backdrop from "@mui/material/Backdrop";
import CircularProgress from "@mui/material/CircularProgress";
import { styled, Typography } from "@mui/material";
import { Box } from "@mui/system";
import { ReactNode } from "react";
import { isMobile } from "react-device-detect";
import { Adapters } from "services/wallets/types";
import { useWalletStore } from "store/wallet/hooks";
import { useTranslation } from "react-i18next";
import Backdrop from '@mui/material/Backdrop'
import CircularProgress from '@mui/material/CircularProgress'
import { styled } from '@mui/material'
import { Box } from '@mui/system'
import { ReactNode } from 'react'

interface Props {
open: boolean;
Expand All @@ -21,9 +17,6 @@ const StyledContainer = styled(Box)({
});

function FullPageLoader({ open, children }: Props) {
const { adapterId } = useWalletStore();
const { t } = useTranslation();
const showReminderInLoader = !isMobile && adapterId === Adapters.TON_HUB;

return (
<Backdrop
Expand All @@ -37,11 +30,6 @@ function FullPageLoader({ open, children }: Props) {
<StyledContainer>
<CircularProgress color="inherit" />
{children}
{showReminderInLoader && (
<Typography>
{t('check-tonhub')}
</Typography>
)}
</StyledContainer>
</Backdrop>
);
Expand Down
6 changes: 5 additions & 1 deletion src/components/Navbar/LogoWithText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ROUTES } from "router/routes";
import useNavigateWithParams from "hooks/useNavigateWithParams";
import { useApplicationStore } from "store/application/hooks";
import { OperationType } from "store/application/reducer";
import { APP_VERSION } from 'consts'

const StyledText = styled(Typography)(({ theme }) => ({
fontSize: 18,
Expand All @@ -17,6 +18,8 @@ const StyledText = styled(Typography)(({ theme }) => ({
},
}));

const showVersionPlug = () => (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes('netlify.app') || window.location.hostname.includes('ngrok.io')) ? APP_VERSION : ''

const LogoWithText = () => {
const classes = useStyles();
const { selectedToken } = useTokenOperationsStore();
Expand Down Expand Up @@ -45,7 +48,8 @@ const LogoWithText = () => {
>
<img className={classes.logo} src={TonLogo} alt="" />
<StyledText>
<strong>Ton</strong>Swap
<strong>Ton</strong>Swap{' '}
<span style={{fontSize: 11}}>{showVersionPlug()}</span>
</StyledText>
</Box>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/Navbar/Menu/WalletAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useTranslation } from "react-i18next";
import { isMobile } from "react-device-detect";
import SelectLanguage from "./SelectLanguage";
import { isTelegramWebApp } from "utils";
import { disconnectTC } from 'services/wallets/adapters/TonConnectAdapter'

const StyledIconButton = styled("button")({
cursor: "pointer",
Expand Down Expand Up @@ -51,6 +52,7 @@ const WalletAddress = observer(() => {

const onDisconnect = () => {
resetWallet();
disconnectTC();
setShowDisconnect(false);
gaAnalytics.disconnect();
};
Expand Down
Loading