import { chainIds as e, isSolanaLike as t } from "../../constants/chains.constants.mjs";
import { getStateKey as n } from "../../functions/utils/string.utils.mjs";
import { alchemyPublicTokensDB as r } from "./AlchemyPublicTokensDB.mjs";
import { eventsPublicTokensDB as i } from "./EventsPublicTokensDB.mjs";
import { arcPublicTokensDB as a } from "./ArcPublicTokensDB.mjs";
//#region libs/shared/common/src/data-structures/TokenDBs/PublicTokensDB.ts
var o = class {
	useAlternativeDB = {};
	async getPublicTokens(t, o) {
		let s = n(o, t);
		return t === e.arcTestnet ? a.getPublicTokens(o) : this.useAlternativeDB[s] ? i.getPublicTokens(t, o) : r.getPublicTokens(t, o);
	}
	getFetchedTokens(t, o) {
		let s = n(o, t);
		return t === e.arcTestnet ? a.getFetchedTokens(o) : this.useAlternativeDB[s] ? i.getFetchedTokens(t, o) : r.getFetchedTokens(t, o);
	}
	async fetchAndUpdatePublicTokens(o, s) {
		let c = n(o, s);
		try {
			s === e.arcTestnet ? await a.fetchAndUpdatePublicTokens(o) : (await r.fetchAndUpdatePublicTokens(o, s), this.useAlternativeDB[c] = !1);
		} catch {
			if (t(s)) return;
			await i.fetchAndUpdatePublicTokens(o, s), this.useAlternativeDB[c] = !0;
		}
	}
};
new o();
//#endregion
export { o as PublicTokensDB };
