import { getContractAddress as e } from "../../../functions/utils/getContractAddress.mjs";
import { getProviderFromContract as t } from "../../../functions/utils/getSignerFromContract.mjs";
import { AbstractAccessTokenSnapshotService as n } from "../../event-service/evm/AbstractAccessTokenSnapshotService.mjs";
import "../../event-service/index.mjs";
import { SnapshotFetcherService as r } from "../SnapshotFetcherService.mjs";
//#region libs/shared/common/src/data-structures/snapshot/evm-snapshots/ClientAccessTokenSnapshotService.ts
var i = class extends n {
	snapshotsService;
	constructor(e, t) {
		super(e), this.snapshotsService = t;
	}
	async fetchSnapshot() {
		let { contract: n } = this.blockchainEventEmitter, { chainId: i } = await t(n).getNetwork(), a = Number(i);
		this.snapshotsService ||= new r(a, e(n));
		let o = await this.snapshotsService.getAccessTokens();
		if (o.accessTokenContractAddress !== e(n) || o.chainId !== a) throw Error("Commitment Snapshot: incorrect contract or chain id");
		return {
			latestBlockNumber: o.latestBlockNumber,
			merkleTree: o.merkleTree,
			senderAddresses: o.senderAddresses,
			senderAddressIndexMap: o.senderAddressIndexMap
		};
	}
	persistSnapshot(e) {
		return Promise.resolve();
	}
};
//#endregion
export { i as ClientAccessTokenSnapshotService };
