import { isSolanaLike as e, isTronLike as t, networkRegistry as n } from "../../../constants/chains.constants.mjs";
import { ContractType as r } from "../../../types/ethereum-network.types.mjs";
import { getAccessTokenAccountPublicKey as i } from "../../pre-transaction/solana.mjs";
import "../../../types/index.mjs";
import { PublicKey as a } from "@solana/web3.js";
//#region libs/shared/common/src/functions/web3/functionCalls/accessTokenCalls.ts
var o = async (e, t, n) => {
	let i = n ?? e.userKeys.getAccessKey();
	return (await e.getContractWithFetcher(t, r.AccessTokenContract).hasToken(i))[0];
}, s = async (e, t, r) => {
	let o = r ?? e.userKeys.getAccessKey(), { hinkalIdl: s, originalDeployer: c } = n[t].contractData;
	if (!s || !c) throw Error("missing hinkal data");
	let l = new a(c), u = e.getSolanaProgram(s), d = i(BigInt(o), u.programId, l);
	if (!await u.provider.connection.getAccountInfo(d)) return !1;
	let { isAdded: f } = await u.account.accesskeyAccount.fetch(d);
	return f;
}, c = async (n, r, i) => t(r) ? !0 : e(r) ? s(n, r, i) : o(n, r, i);
//#endregion
export { c as checkHinkalAccessToken };
