import { Env } from '@lombard.finance/sdk-common'; import type { Meta, StoryObj } from '@storybook/react'; import { Button, ErrorDisplay, ResultDisplay } from '../stories/components'; import { functionType } from '../stories/decorators/function-type'; import useQuery from '../stories/hooks/useQuery'; import { getOftAmountCanBeSent } from './getOftAmountCanBeSent'; interface GetOftAmountStoryArgs { env: Env; destinationEid: number; } export const StoryView = ({ env, destinationEid }: GetOftAmountStoryArgs) => { const request = async () => { if (!destinationEid) throw new Error('Destination EID is required.'); try { const amount = await getOftAmountCanBeSent({ env, destinationLzEndpointId: destinationEid, }); return amount.toString(); } catch (err) { console.error('Fetch Amount Error:', err); throw err; } }; const { data: result, error, isLoading, refetch: handleFetch, } = useQuery(request, [env, destinationEid], false); return ( <>