import { ButtonHTMLType } from "antd/lib/button/button"; import { CSSProperties, ReactNode } from "react"; import { Dispatch, SetStateAction } from "react"; import { FetchBaseQueryError } from "@reduxjs/toolkit/query"; export type ICurrencyType = "USDC" | "SOL" | "$IVRY" | "USDT"; export interface IPropsSupportedCurrency { currency: ICurrencyType; } export type IVRYButtonProps = { children: string; className?: string; onClick?: () => void; loading?: boolean; disabled?: boolean; style?: CSSProperties; type?: ButtonHTMLType; icon?: ReactNode; }; export type ITypeModalProps = { show: boolean; onCancel: () => void; title: string; onConfirm?: (values: unknown) => void; loading?: boolean; }; export type ISwapCoinModalProps = { show: boolean; onCancel: () => void; title: string; onConfirm?: (values: unknown) => void; loading?: boolean; currencyType: ICurrencyType; setShowSuccess: Dispatch>; }; export type IConfirmationModalProps = { show: boolean; onCancel: () => void; title: string; loading?: boolean; initiateAgain: () => void; setSelectedWallet: Dispatch< SetStateAction<"solana" | "wallet-connect" | "checkout"> >; transaction: ITransactionResponse; redirect: string | null; successMessage: string | null; }; export type IProductCheckoutProps = { setSelectedWallet: Dispatch< SetStateAction<"solana" | "wallet-connect" | "checkout"> >; makePayment: (arg: "solana" | "wallet-connect", check: boolean) => void; redirect: string | null; successMessage: string | null; }; export interface IvoryCustomInputProps { type?: string; placeholder?: string; onChange?: (e: React.ChangeEvent) => void; className?: string; value?: string | number; max?: number; //defaultValue?: string | number; disabled?: boolean; name?: string; hasValue?: boolean; suffix?: React.ReactNode; prefix?: React.ReactNode | string; bordered?: boolean; onBlur?: (e: any) => void; } export interface ValidatedPaymentLink { success: boolean; message: string; data: PaymentLinkResponseType; } export interface PaymentLinkResponseType { amount: number | string; baseFiat: string; businessId: string; customerId: null | string; description: string; environment: "TEST" | "LIVE"; name: string; redirectLink: string | null; reference: string; status: "UNUSED" | "USED"; successMessage: null | string; userId: string; uuid: string; imageFilePath?: string; isActive: 1 | 0; } export function isFetchBaseQueryError( error: unknown ): error is FetchBaseQueryError { return typeof error === "object" && error != null && "status" in error; } export function isErrorWithMessage( error: unknown ): error is { message: string } { return ( typeof error === "object" && error != null && "message" in error && typeof (error as any).message === "string" ); } export interface IvoryError { message: string; errors: Array; } export interface ITransactionResponse { address: string; baseFiat: string; baseFiatToUSDRate: number; crypto: ICurrencyType; expectedAmountInUSD: number | string; reference: string; expectedAmountInCrypto: number; expectedAmountWithFeeInCrypto: number; feeInCrypto: number; usdToCryptoRate: number; imageFilePath?: string; email?: string; }