Skip to content

chore: token audit #2357

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion packages/onchainkit/src/buy/components/BuyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export function BuyButton() {
}, [statusName, isDropdownOpen]);

if (!isDisabled && !address) {
return <ConnectWallet text="Buy" className="h-12 w-24 min-w-24" />;
return (
<ConnectWallet disconnectedLabel="Buy" className="h-12 w-24 min-w-24" />
);
}

return (
Expand Down
10 changes: 0 additions & 10 deletions packages/onchainkit/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ export type IsBaseOptions = {
isMainnetOnly?: boolean;
};

/**
* @deprecated Use IsBaseOptions instead
*/
export type isBaseOptions = IsBaseOptions;

/**
* Note: exported as public Type
*/
Expand All @@ -78,11 +73,6 @@ export type IsEthereumOptions = {
isMainnetOnly?: boolean;
};

/**
* @deprecated Use IsEthereumOptions instead
*/
export type isEthereumOptions = IsEthereumOptions;

export type Mode = 'auto' | 'light' | 'dark';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/onchainkit/src/earn/components/DepositButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function DepositButton({ className }: DepositButtonReact) {
return (
<ConnectWallet
className={cn('w-full', className)}
text="Connect to deposit"
disconnectedLabel="Connect to deposit"
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/onchainkit/src/earn/components/WithdrawButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function WithdrawButton({ className }: WithdrawButtonReact) {
return (
<ConnectWallet
className={cn('w-full', className)}
text="Connect to withdraw"
disconnectedLabel="Connect to withdraw"
/>
);
}
Expand Down
2 changes: 0 additions & 2 deletions packages/onchainkit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export type {
IsEthereumOptions,
OnchainKitConfig,
OnchainKitContextType,
isBaseOptions,
isEthereumOptions,
} from './core/types';

export type { OnchainKitProviderReact } from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ describe('NFTCardDefault', () => {
<NFTCardDefault contractAddress="0x123" tokenId="1" />,
);

expect(getByTestId('nft-media')).toBeInTheDocument();
expect(getByTestId('nft-title')).toBeInTheDocument();
expect(getByTestId('nft-owner')).toBeInTheDocument();
expect(getByTestId('nft-last-sold-price')).toBeInTheDocument();
expect(getByTestId('nft-network')).toBeInTheDocument();
expect(getByTestId('nft-card')).toBeInTheDocument();
});
});
15 changes: 1 addition & 14 deletions packages/onchainkit/src/nft/components/NFTCardDefault.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
'use client';
import type { NFTCardDefaultReact } from '@/nft/types';
import { NFTCard } from './NFTCard';
import {
NFTLastSoldPrice,
NFTMedia,
NFTNetwork,
NFTOwner,
NFTTitle,
} from './view';

/**
* @deprecated Use the `NFTCard` component instead with no 'children' props.
Expand All @@ -28,12 +21,6 @@ export function NFTCardDefault({
onStatus={onStatus}
onSuccess={onSuccess}
onError={onError}
>
<NFTMedia />
<NFTTitle />
<NFTOwner />
<NFTLastSoldPrice />
<NFTNetwork />
</NFTCard>
/>
);
}
4 changes: 2 additions & 2 deletions packages/onchainkit/src/token/components/TokenChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useTheme } from '../../internal/hooks/useTheme';
import { background, cn, pressable, text } from '../../styles/theme';
import type { TokenChipReact } from '../types';
import type { TokenChipProps } from '../types';
import { TokenImage } from './TokenImage';

/**
Expand All @@ -16,7 +16,7 @@ export function TokenChip({
onClick,
className,
isPressable = true,
}: TokenChipReact) {
}: TokenChipProps) {
const componentTheme = useTheme();

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/onchainkit/src/token/components/TokenImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { useMemo } from 'react';
import { cn } from '../../styles/theme';
import type { TokenImageReact } from '../types';
import type { TokenImageProps } from '../types';
import { getTokenImageColor } from '../utils/getTokenImageColor';

export function TokenImage({ className, size = 24, token }: TokenImageReact) {
export function TokenImage({ className, size = 24, token }: TokenImageProps) {
const { image, name } = token;

const styles = useMemo(() => {
Expand Down
5 changes: 2 additions & 3 deletions packages/onchainkit/src/token/components/TokenRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { memo } from 'react';
import { useTheme } from '../../internal/hooks/useTheme';
import { cn, color, pressable, text } from '../../styles/theme';
import type { TokenRowReact } from '../types';
import type { TokenRowProps } from '../types';
import { formatAmount } from '../utils/formatAmount';
import { TokenImage } from './TokenImage';

Expand All @@ -14,9 +14,8 @@ export const TokenRow = memo(function TokenRow({
onClick,
hideImage,
hideSymbol,
}: TokenRowReact) {
}: TokenRowProps) {
const componentTheme = useTheme();

return (
<button
data-testid="ockTokenRow_Container"
Expand Down
57 changes: 0 additions & 57 deletions packages/onchainkit/src/token/components/TokenSearch.test.tsx

This file was deleted.

57 changes: 0 additions & 57 deletions packages/onchainkit/src/token/components/TokenSearch.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { type ForwardedRef, forwardRef } from 'react';
import { caretDownSvg } from '../../internal/svg/caretDownSvg';
import { caretUpSvg } from '../../internal/svg/caretUpSvg';
import { border, cn, color, pressable, text } from '../../styles/theme';
import type { TokenSelectButtonReact } from '../types';
import type { TokenSelectButtonProps } from '../types';
import { TokenImage } from './TokenImage';

export const TokenSelectButton = forwardRef(function TokenSelectButton(
{ onClick, token, isOpen, className }: TokenSelectButtonReact,
{ onClick, token, isOpen, className }: TokenSelectButtonProps,
ref: ForwardedRef<HTMLButtonElement>,
) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import { useCallback, useRef, useState } from 'react';
import { DropdownMenu } from '../../internal/components/DropdownMenu';
import { background, border, cn, color } from '../../styles/theme';
import type { TokenSelectDropdownReact } from '../types';
import type { TokenSelectDropdownProps } from '../types';
import { TokenRow } from './TokenRow';
import { TokenSelectButton } from './TokenSelectButton';

export function TokenSelectDropdown({
options,
setToken,
token,
}: TokenSelectDropdownReact) {
}: TokenSelectDropdownProps) {
const [isOpen, setIsOpen] = useState(false);
const buttonRef = useRef<HTMLButtonElement>(null);

Expand All @@ -36,6 +36,7 @@ export function TokenSelectDropdown({
isOpen={isOpen}
onClose={closeDropdown}
align="end"
aria-label="Select token"
>
<div
data-testid="ockTokenSelectDropdown_List"
Expand Down
Loading