UNPKG

@biconomy/abstractjs

Version:

SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.

20 lines 1.2 kB
import { semverCompare } from "../../account/utils/getVersion.js"; import { DEFAULT_CONFIGURATIONS_BY_MEE_VERSION } from "../../constants/index.js"; /** * Returns the appropriate configuration based on the SDK version * @param version - The SDK version string (e.g., "0.2.0") * @returns The configuration containing important smart contract addresses: Nexus implementation, validator, factory, and others * @throws Error if the version is not supported */ export function getMEEVersion(meeVersion) { // If the version is explicitly provided in the DEFAULT_CONFIGURATIONS_BY_VERSION mapping if (meeVersion in DEFAULT_CONFIGURATIONS_BY_MEE_VERSION) { return DEFAULT_CONFIGURATIONS_BY_MEE_VERSION[meeVersion]; } // If the version is not explicitly listed, find the closest compatible version // Sort the available versions in descending order const allVersions = Object.keys(DEFAULT_CONFIGURATIONS_BY_MEE_VERSION).sort((a, b) => semverCompare(b, a)); // If no compatible version is found, throw an error throw new Error(`Unsupported MEE version: ${meeVersion}. Compatible versions are: ${allVersions.join(", ")}`); } //# sourceMappingURL=getMeeConfig.js.map