import { forwardRef, useImperativeHandle, useRef, useState } from 'react' import { BottomSheet } from '../BottomSheet/BottomSheet.js' import type { BottomSheetBase } from '../BottomSheet/types.js' import { TokenDetailsSheetContent } from './TokenDetailsSheetContent.js' import type { TokenDetailsSheetBase } from './types.js' export const TokenDetailsSheet = forwardRef((_, ref) => { const bottomSheetRef = useRef(null) const [tokenAddress, setTokenAddress] = useState( undefined ) const [chainId, setChainId] = useState(undefined) const [withoutContractAddress, setWithoutContractAddress] = useState(false) useImperativeHandle( ref, () => ({ isOpen: () => bottomSheetRef.current?.isOpen(), open: (address: string, noContractAddress: boolean, chainId: number) => { setTokenAddress(address) setWithoutContractAddress(noContractAddress) setChainId(chainId) bottomSheetRef.current?.open() }, close: () => { bottomSheetRef.current?.close() }, }), [] ) return ( ) })