import type { FormattedQuoteResponse } from "@hooks/apis/common/quote/types";
import { SOLANA_CHAIN_ID } from "./constants";

export const getPairsNetworkFromRoute = (route: FormattedQuoteResponse) => {
	const inputChainId = route.primaryInput.token.chainId;
	const outputChainId = route.primaryOutput.token.chainId;

	const inputNetwork = inputChainId === SOLANA_CHAIN_ID ? "solana" : "ethereum";
	const outputNetwork = outputChainId === SOLANA_CHAIN_ID ? "solana" : "ethereum";

	return {
		inputNetwork,
		outputNetwork,
		isSingleNetwork: inputNetwork === outputNetwork,
	} as const;
};
