import { createFormContext } from "react-hook-form-context"; import { OTCConvertQuoteResponseVM, RequestError, UserBankResponseVM, } from "../../services"; export interface BuySellFormProps { fromAmount?: string | null; fromAsset: string | undefined; toAmount?: string | null; toAsset: string | undefined; lastChangedField: "from" | "to"; shouldCharge?: boolean; chargeAmount?: number; showChargeMessage?: boolean; selectedBank?: UserBankResponseVM | null | undefined; isPreviewOpen?: boolean; } export type BuySellProps = { onSuccess?: (data: OTCConvertQuoteResponseVM) => void; onError?: (error: RequestError | Error | null) => void; onNavigateNative?: (link: string) => void; validityDurationInSecond?: number; }; const buySellInitialValues: BuySellFormProps = { fromAmount: "", toAmount: "", fromAsset: undefined, toAsset: undefined, lastChangedField: "from", shouldCharge: false, chargeAmount: undefined, selectedBank: null, showChargeMessage: false, isPreviewOpen: false, }; const BuySellContext = createFormContext(buySellInitialValues); const BuySellProvider = BuySellContext.Provider; export { BuySellContext, BuySellProvider };