Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
25,287 changes: 9,389 additions & 15,898 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.7",
"@types/node": "^22.4.0",
"@types/react": "^18.2.25",
"@types/react-dom": "^18.2.11",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@types/socket.io-client": "^1.4.36",
"@types/uuid": "^9.0.2",
"@types/w3c-web-usb": "^1.0.10",
Expand Down Expand Up @@ -99,23 +99,29 @@
"*.{ts,tsx}": "eslint --cache --fix",
"*.{ts,tsx,css,md}": "prettier --write"
},
"overrides": {
"@tanstack/react-query": {
"react": "19.1.0",
"react-dom": "19.1.0"
}
},
"dependencies": {
"@download/blockies": "^1.0.3",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/hdnode": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"@noble/ed25519": "^2.2.3",
"@react-spring/web": "^9.7.3",
"@react-spring/web": "^10.0.1",
"@solana/spl-token": "^0.4.13",
"@solana/wallet-standard-features": "^1.3.0",
"@solana/web3.js": "^1.98.0",
"@store-unit/react": "^1.0.4",
"@tanstack/react-query": "^4.35.3",
"@tanstack/react-virtual": "^3.2.0",
"@tanstack/react-query": "^4.40.0",
"@tanstack/react-virtual": "^3.13.12",
"@walletconnect/jsonrpc-provider": "^1.0.13",
"@walletconnect/jsonrpc-utils": "^1.0.8",
"@zeriontech/components": "^1.1.0",
"@zeriontech/components": "^2.0.1",
"@zeriontech/hardware-wallet-connection": "^1.0.11",
"@zeriontech/solana-wallet-standard": "^1.0.0-alpha.2",
"@zeriontech/transactions": "^0.4.2",
Expand All @@ -129,7 +135,7 @@
"chart.js": "^4.4.8",
"classnames": "^2.3.2",
"dayjs": "^1.11.9",
"defi-sdk": "^0.1.9",
"defi-sdk": "^0.2.0",
"downshift": "^7.6.0",
"ed25519-hd-key": "^1.3.0",
"ethers": "^6.14.0",
Expand All @@ -146,9 +152,9 @@
"nanoid": "^4.0.2",
"normalize.css": "^8.0.1",
"normalized-contains": "^1.0.0",
"react": "^18.2.0",
"react": "^19.1.0",
"react-area": "^0.1.1-alpha.6",
"react-dom": "^18.2.0",
"react-dom": "^19.1.0",
"react-qrcode-logo": "^2.9.0",
"react-router-dom": "^6.18.0",
"rlp": "^3.0.0",
Expand Down
10 changes: 10 additions & 0 deletions src/shared/type-utils/PropsWithAs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type {
ComponentPropsWithoutRef,
ComponentPropsWithRef,
ElementType,
} from 'react';

export type PropsWithAs<As extends ElementType> = {
as?: As;
} & ComponentPropsWithoutRef<As> &
Partial<Pick<ComponentPropsWithRef<As>, 'ref'>>;
10 changes: 5 additions & 5 deletions src/ui/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ function SomeKindOfResolver({
notAuthenticated,
authenticated,
}: {
noUser: JSX.Element;
noWallet: JSX.Element;
notAuthenticated: JSX.Element;
authenticated: JSX.Element;
noUser: React.ReactNode;
noWallet: React.ReactNode;
notAuthenticated: React.ReactNode;
authenticated: React.ReactNode;
}) {
const { isLoading, isAuthenticated, existingUser, hasWallet } =
useAuthState();
Expand All @@ -149,7 +149,7 @@ function SomeKindOfResolver({
return authenticated;
}

function RequireAuth({ children }: { children: JSX.Element }) {
function RequireAuth({ children }: { children: React.ReactNode }) {
const location = useLocation();
const { isLoading, isAuthenticated, existingUser } = useAuthState();

Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/AssetIcon/AssetIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export function AssetIcon({
symbol={nft.symbol}
/>
) : (
(fallback as JSX.Element)
(fallback as React.ReactNode)
);
}
2 changes: 1 addition & 1 deletion src/ui/components/Background/Background.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ export function Background({
};
}, [backgroundColor, uiScrollRootElement.style]);

return children as JSX.Element;
return children as React.ReactNode;
}
2 changes: 1 addition & 1 deletion src/ui/components/CopyButton/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Props {
tooltipContent?: React.ReactNode;
tooltipPosition?: 'right' | 'center-bottom';
size?: number;
buttonRef?: React.RefObject<HTMLButtonElement>;
buttonRef?: React.RefObject<HTMLButtonElement | null>;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/DappIconFetcher/DappIconFetcher.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useFetchDappIcon } from './useFetchDappIcon';

type IconRenderer = (src: string | null) => JSX.Element;
type IconRenderer = (src: string | null) => React.ReactNode;

interface Props {
url: string;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/DelayedRender/DelayedRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function DelayedRender({
const render = useRenderDelay(delay);

if (render) {
return children as JSX.Element;
return children as React.ReactNode;
} else {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/PseudoRoute/PseudoRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function PseudoRoute({
component,
}: {
when: boolean;
component: JSX.Element;
component: React.ReactNode;
}) {
if (when) {
return component;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/VerifyUser/WithPasswordSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ export function WithPasswordSession({
</Background>
);
} else {
return children as JSX.Element;
return children as React.ReactNode;
}
}
2 changes: 1 addition & 1 deletion src/ui/components/VersionUpgrade/VersionUpgrade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export function VersionUpgrade({ children }: React.PropsWithChildren) {
</FillView>
);
} else {
return children as JSX.Element;
return children as React.ReactNode;
}
}
7 changes: 7 additions & 0 deletions src/ui/jsx-fix.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare global {
namespace JSX {
export type Element = React.JSX.Element;
}
}

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function SelectMoreWalletsDialog({
wallets: DerivedWallets | null;
existingAddressesSet: Set<string>;
activeWallets: Record<string, { active: boolean }>;
dialogRef: React.RefObject<HTMLDialogElementInterface>;
dialogRef: React.RefObject<HTMLDialogElementInterface | null>;
onSubmit: (values: Set<string>) => void;
}) {
const groupedByEcosystem = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function OnMount({
useEffect(() => {
onMountRef.current();
}, []);
return children as JSX.Element;
return children as React.ReactNode;
}

const ANIMATION_DURATION = 1500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function CancelTxContent({
[chainGasPrices]
);

const feeValueCommonRef = useRef<string>(); /** for analytics only */
const feeValueCommonRef = useRef<string>(null); /** for analytics only */
const handleFeeValueCommonReady = useCallback((value: string) => {
feeValueCommonRef.current = value;
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function SpeedUp({
[chainGasPrices]
);

const feeValueCommonRef = useRef<string>(); /** for analytics only */
const feeValueCommonRef = useRef<string>(null); /** for analytics only */
const handleFeeValueCommonReady = useCallback((value: string) => {
feeValueCommonRef.current = value;
}, []);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/Overview/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function RewardsLinkIcon({

function DevelopmentOnly({ children }: React.PropsWithChildren) {
if (process.env.NODE_ENV === 'development') {
return children as JSX.Element;
return children as React.ReactNode;
} else {
return null;
}
Expand Down
10 changes: 5 additions & 5 deletions src/ui/pages/Overview/Positions/Positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -705,10 +705,10 @@ function MultiChainPositions({
const groupedPositions = groupPositionsByDapp(items);

if (isLoading) {
return renderLoadingView() as JSX.Element;
return renderLoadingView() as React.ReactNode;
}
if (!items || items.length === 0) {
return renderEmptyView() as JSX.Element;
return renderEmptyView() as React.ReactNode;
}

const chainTotalValue =
Expand Down Expand Up @@ -786,13 +786,13 @@ function RawChainPositions({
if (isError) {
return renderErrorView(
networks?.getChainName(chain) || chainValue
) as JSX.Element;
) as React.ReactNode;
}
if (isLoading) {
return renderLoadingView() as JSX.Element;
return renderLoadingView() as React.ReactNode;
}
if (!addressPositions || !addressPositions.length) {
return renderEmptyView() as JSX.Element;
return renderEmptyView() as React.ReactNode;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/SendTransaction/SendTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ function SendTransactionContent({
advancedDialogRef.current?.showModal();
}, []);

const feeValueCommonRef = useRef<string>(); /** for analytics only */
const feeValueCommonRef = useRef<string>(null); /** for analytics only */
const handleFeeValueCommonReady = useCallback((value: string) => {
feeValueCommonRef.current = value;
}, []);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/shared/forms/useCustomValidity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function useCustomValidity({
ref,
customValidity,
}: {
ref: React.RefObject<HTMLInputElement>;
ref: React.RefObject<HTMLInputElement | null>;
customValidity: string;
}) {
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export function ChainValue({
value || 0,
'en',
currency
) as React.ReactNode as JSX.Element;
) as React.ReactNode as React.ReactNode;
}
2 changes: 1 addition & 1 deletion src/ui/shared/requests/PortfolioValue/PortfolioValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function PortfolioValue({
}: {
address: string;
enabled?: boolean;
render: (value: ReturnType<typeof useWalletPortfolio>) => JSX.Element;
render: (value: ReturnType<typeof useWalletPortfolio>) => React.ReactNode;
}) {
const { currency } = useCurrency();
const query = useWalletPortfolio(
Expand Down
4 changes: 3 additions & 1 deletion src/ui/shared/requests/useIsConnectedToActiveTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export function IsConnectedToActiveTab({
render,
}: {
address: string;
render: (value: ReturnType<typeof useIsConnectedToActiveTab>) => JSX.Element;
render: (
value: ReturnType<typeof useIsConnectedToActiveTab>
) => React.ReactElement;
}) {
return render(useIsConnectedToActiveTab(address));
}
2 changes: 1 addition & 1 deletion src/ui/shared/useStaleTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from 'react';
export function useStaleTime(value: unknown, staleTime: number) {
const [isStale, setIsStale] = useState(false);

const debouncedRef = useRef<() => void>();
const debouncedRef = useRef<() => void>(null);
if (!debouncedRef.current) {
debouncedRef.current = debounce(() => {
setIsStale(true);
Expand Down
33 changes: 11 additions & 22 deletions src/ui/ui-kit/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type {
ComponentPropsWithoutRef,
ComponentPropsWithRef,
ElementType,
} from 'react';
import type { ElementType } from 'react';
import React from 'react';
import cx from 'classnames';
import type { PropsWithAs } from 'src/shared/type-utils/PropsWithAs';
import { UIText } from '../UIText';
import * as styles from './styles.module.css';

Expand Down Expand Up @@ -50,25 +47,19 @@ interface Props {
size?: Size;
}

const ButtonElement = <As extends ElementType = 'button'>(
{
style,
as,
kind = 'primary',
size = 44,
children,
className,
...props
}: Props & { as?: As } & ComponentPropsWithoutRef<As> & {
ref?: ComponentPropsWithRef<As>['ref'];
},
ref: React.Ref<ComponentPropsWithRef<As>['ref']>
) => {
export const Button = <As extends ElementType = 'button'>({
style,
as,
kind = 'primary',
size = 44,
children,
className,
...props
}: Props & PropsWithAs<As>) => {
const isButton = as == null || as === 'button';
return (
<UIText
as={as || 'button'}
ref={ref}
kind="small/accent"
className={cx(className, styles[kind], styles.button, {
[styles.asButton]: !isButton,
Expand All @@ -90,5 +81,3 @@ const ButtonElement = <As extends ElementType = 'button'>(
</UIText>
);
};

export const Button = React.forwardRef(ButtonElement) as typeof ButtonElement;
Loading