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

Find all strategies from one token #1590

Merged
merged 45 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b2fb22c
remove useKeyPress
GrandSchtroumpf Nov 29, 2024
0361773
Remove Sentry Replay
GrandSchtroumpf Nov 29, 2024
283da4b
use button instead of Link in suggestionList
GrandSchtroumpf Nov 28, 2024
50d8210
reorganize suggestion list
GrandSchtroumpf Dec 2, 2024
ee77cca
fix filtering with no value
GrandSchtroumpf Dec 3, 2024
5985b6b
add content-visibility: auto
GrandSchtroumpf Dec 3, 2024
9192401
merge listbox & empty into one dialog panel
GrandSchtroumpf Dec 3, 2024
eee8653
store keyname in the dataset (faster than textContent)
GrandSchtroumpf Dec 3, 2024
f7832a0
memorize PairLogoName
GrandSchtroumpf Dec 4, 2024
cd60036
Use virtual scroll
GrandSchtroumpf Dec 4, 2024
599abf0
[CI] Update Screenshots
GrandSchtroumpf Dec 4, 2024
ca83d78
remvoe comment
GrandSchtroumpf Dec 5, 2024
242c612
query all strategies for one token
GrandSchtroumpf Dec 4, 2024
fd0cb17
remove uniqBy
GrandSchtroumpf Dec 4, 2024
56fd30c
remove Voucher from useContract
GrandSchtroumpf Dec 4, 2024
865db74
initialize trade pair if this is a pair
GrandSchtroumpf Dec 5, 2024
227d32e
Do not wait for the SDK to be initialized
GrandSchtroumpf Dec 5, 2024
5637a4e
lazy load each card when in the viewport
GrandSchtroumpf Dec 5, 2024
a7e1355
query tokenListCache from LS only once
GrandSchtroumpf Dec 5, 2024
0176190
prevent duplicated calls to get missing tokens
GrandSchtroumpf Dec 9, 2024
29592cd
filter with pagination
GrandSchtroumpf Dec 9, 2024
d824558
update placeholder
GrandSchtroumpf Dec 9, 2024
7568560
improve keyboard navigation
GrandSchtroumpf Dec 9, 2024
e42b3cc
add animations
GrandSchtroumpf Dec 9, 2024
6664033
fix animation
GrandSchtroumpf Dec 9, 2024
20766cf
fix for HOLD token
GrandSchtroumpf Dec 9, 2024
bfa8d80
wait for all marketprice to be loaded
GrandSchtroumpf Dec 10, 2024
326da97
reduce layout shifting
GrandSchtroumpf Dec 10, 2024
800cc1d
improve trade page
GrandSchtroumpf Dec 10, 2024
d846c8e
fix build
GrandSchtroumpf Dec 10, 2024
44265d9
preload fonts from the header
GrandSchtroumpf Dec 10, 2024
6ffb69d
improve font loading
GrandSchtroumpf Dec 10, 2024
6c86c05
request changes
GrandSchtroumpf Dec 11, 2024
35b6b80
improve UI
GrandSchtroumpf Dec 11, 2024
ebf46f9
Merge remote-tracking branch 'origin/main' into issue-#1589
GrandSchtroumpf Dec 11, 2024
8f5f0cc
[CI] Update Screenshots
GrandSchtroumpf Dec 11, 2024
7b10a1d
increase height
GrandSchtroumpf Dec 11, 2024
f750ecd
remove () for (s)
GrandSchtroumpf Dec 11, 2024
6601b9c
[CI] Update Screenshots
GrandSchtroumpf Dec 11, 2024
bb385bd
request changes
GrandSchtroumpf Dec 12, 2024
0de3067
[CI] Update Screenshots
GrandSchtroumpf Dec 12, 2024
4b90e1b
remove keyboard description
GrandSchtroumpf Dec 16, 2024
32f3d5b
[CI] Update Screenshots
GrandSchtroumpf Dec 16, 2024
ae63ae1
remove "Token / Pair" in search
GrandSchtroumpf Dec 16, 2024
4b97255
[CI] Update Screenshots
GrandSchtroumpf Dec 16, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/simulator/recurring/Recurring_range_limit/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/simulator/recurring/Recurring_range_range/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/create/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/deposit/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/undercut/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/withdraw/form.png
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<meta name="twitter:title" content="Carbon DeFi - Automated trading strategies">
<meta name="twitter:description" content="Carbon DeFi is an advanced onchain trading protocol enabling automated limit orders, efficiently adjustable w/ custom price ranges, grid trading like recurring orders, works like a DEX trading bot.">
<meta name="twitter:image" content="https://framerusercontent.com/images/7YeuJPKg50bkh0m7b1yRwhCNIoE.png">

<!-- Preload fonts that are the most likely to be used quickly -->
<link rel="preload" href="assets/font/title/medium.woff2" as="font" type="font/woff2"/>
<link rel="preload" href="assets/font/text/medium.woff2" as="font" type="font/woff2"/>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@babel/core": "^7.0.0-0",
"@bancor/carbon-sdk": "0.0.99-DEV",
"@bancor/carbon-sdk": "0.0.103-DEV",
"@cloudflare/workers-types": "^4.20230717.0",
"@ethersproject/abi": "^5.0.0",
"@ethersproject/bytes": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const App = () => {
<>
<NotificationAlerts />
<MainMenu />
<main className="mb-16 mt-80 grid flex-grow">
<main className="mb-16 grid flex-grow">
<MainContent />
</main>
<Footer />
Expand Down
4 changes: 2 additions & 2 deletions src/components/activity/useActivityQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const useActivityQuery = (
params: QueryActivityParams = {},
config: ActivityQueryConfig = {}
) => {
const { tokensMap, isPending, importToken } = useTokens();
const { tokensMap, isPending, importTokens } = useTokens();
const { Token } = useContract();
const validParams = isValidParams(params);

Expand All @@ -100,7 +100,7 @@ export const useActivityQuery = (
return fetchTokenData(Token, address);
});
const tokens = await Promise.all(getTokens);
tokens.forEach((data) => importToken(data));
importTokens(tokens);
};

return useQuery({
Expand Down
34 changes: 29 additions & 5 deletions src/components/common/PairLogoName.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
import { TokensOverlap } from 'components/common/tokensOverlap';
import { WarningWithTooltip } from 'components/common/WarningWithTooltip/WarningWithTooltip';
import { TradePair } from 'libs/modals/modals/ModalTradeTokenList';
import { FC } from 'react';
import { Token } from 'libs/tokens';
import { FC, memo } from 'react';
import { TokenLogo } from './imager/Imager';

const suspiciousTokenTooltipMsg =
'This token is not part of any known token list. Always conduct your own research before trading.';

interface Props {
interface TokenProps {
token: Token;
}
export const _TokenLogoName: FC<TokenProps> = ({ token }) => {
return (
<>
<TokenLogo token={token} size={30} />
{token.symbol}
{token.isSuspicious && (
<WarningWithTooltip tooltipContent={suspiciousTokenTooltipMsg} />
)}
</>
);
};
export const TokenLogoName = memo(_TokenLogoName, (a, b) => {
return a.token.address === b.token.address;
});

interface PairProps {
pair: TradePair;
}

export const PairLogoName: FC<Props> = ({
pair: { baseToken, quoteToken },
}) => {
const _PairLogoName: FC<PairProps> = ({ pair: { baseToken, quoteToken } }) => {
return (
<>
<TokensOverlap tokens={[baseToken, quoteToken]} size={30} />
Expand All @@ -30,3 +48,9 @@ export const PairLogoName: FC<Props> = ({
</>
);
};
export const PairLogoName = memo(_PairLogoName, (a, b) => {
return (
a.pair.baseToken.address === b.pair.baseToken.address &&
a.pair.quoteToken.address === b.pair.quoteToken.address
);
});
2 changes: 1 addition & 1 deletion src/components/common/Toaster/Toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const Toaster: FC = () => {
return (
<ul
id="toaster"
className="fixed bottom-16 right-16 z-10 flex min-w-[250px] flex-col gap-8"
className="fixed bottom-16 right-24 z-10 flex min-w-[250px] flex-col gap-8"
>
{toaster.toasts.map((toast) => (
<ToastItem key={toast.id} {...toast} />
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/imager/Imager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const Imager = ({
...props
}: ImageProps) => {
const { source } = useImager(src, fallbackSrc);

return (
<img
{...props}
Expand All @@ -90,7 +89,7 @@ export const TokenLogo = ({ token, size, className }: TokenLogoProps) => {
src={token.logoURI}
alt={token.name ?? token.symbol}
title={token.symbol}
className={className}
className={cn(className, 'border border-black bg-black')}
/>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/core/menu/mainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MainMenuRight } from 'components/core/menu/mainMenu/MainMenuRight';

export const MainMenu: FC = () => {
return (
<header className="fixed top-0 z-40 w-full" data-testid="main-menu">
<header className="sticky top-0 z-40 w-full" data-testid="main-menu">
<div className="main-menu">
<MainMenuLeft />
<MainMenuRight />
Expand Down
8 changes: 4 additions & 4 deletions src/components/debug/DebugTransferNFT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button } from 'components/common/button';
import { Input, InputUserAccount, Label } from 'components/common/inputField';
import { useWagmi } from 'libs/wagmi';
import { QueryKey, useQueryClient } from 'libs/queries';
import { useContract } from 'hooks/useContract';
import { useVoucher } from 'hooks/useContract';

export const DebugTransferNFT = () => {
const { user } = useWagmi();
Expand All @@ -13,7 +13,7 @@ export const DebugTransferNFT = () => {
const [isSuccess, setIsSuccess] = useState(false);
const [isError, setIsError] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const { Voucher } = useContract();
const { data: Voucher } = useVoucher();

const handleOnClick = async () => {
setIsSuccess(false);
Expand All @@ -25,12 +25,12 @@ export const DebugTransferNFT = () => {
setIsLoading(true);

try {
const tx = await Voucher.write.transferFrom(
const tx = await Voucher?.write.transferFrom(
user,
inputRecipient,
inputId
);
await tx.wait();
await tx?.wait();
await cache.invalidateQueries({ queryKey: QueryKey.strategies(user) });
setIsSuccess(true);
} catch (e) {
Expand Down
11 changes: 1 addition & 10 deletions src/components/explorer/ExplorerSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ export const _ExplorerSearch: FC = () => {
setSearch,
};

const suggestionProps = {
pairMap: pairs.map,
nameMap: pairs.names,
search,
setSearch,
};

return (
<div className="relative">
<form
Expand Down Expand Up @@ -136,9 +129,7 @@ export const _ExplorerSearch: FC = () => {
</div>
<div role="separator" className="h-20 w-1 bg-white/40"></div>
<div className="flex w-full flex-grow items-center md:relative">
{type === 'token-pair' && (
<ExplorerSearchSuggestions {...suggestionProps} />
)}
{type === 'token-pair' && <ExplorerSearchSuggestions />}
{type === 'wallet' && <ExplorerSearchInput {...inputProps} />}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/explorer/ExplorerSearchDropdownButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const ExplorerSearchDropdownButton = forwardRef<
{type === 'token-pair' && (
<>
<IconTokenPair className="size-18 text-primary" />
<span className="hidden md:inline">Token Pair</span>
<span className="hidden md:inline">Token / Pair</span>
</>
)}
<IconChevron className="size-16 text-white/40" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/explorer/ExplorerSearchDropdownItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const ExplorerSearchDropdownItems: FC<Props> = ({ setSearch }) => {
},
{
type: 'token-pair' as const,
label: 'Token Pair',
label: 'Token / Pair',
active: currentType === 'token-pair',
},
];
Expand All @@ -36,7 +36,7 @@ export const ExplorerSearchDropdownItems: FC<Props> = ({ setSearch }) => {
active && 'flex items-center justify-between'
)}
>
<span> {label}</span>
<span>{label}</span>
<IconCheck className={cn('w-14', !active && 'hidden')} />
</Link>
))}
Expand Down
Loading