import { useConfig } from "@hooks/useConfig";

export enum USER_OPERATIONS {
	CHAIN_SWITCH = "chain-switch",
	APPROVAL = "token-approval",
	APPROVAL_CHECK = "approval-check",
	SIGNATURE = "sign-typed-data",
	TRANSACTION = "transaction",
	ADD_TOKEN = "add-token",
}

export const useLogError = () => {
	const { eventHandlers } = useConfig();

	const logError = (error: unknown, context?: Record<string, unknown>) => {
		if (eventHandlers?.logError) {
			eventHandlers.logError(error, context);
		}
	};

	return {
		logError,
	};
};
