import { AbstractSnapshotService as e } from "./AbstractSnapshotService.mjs";
import { ethers as t } from "ethers";
//#region libs/shared/common/src/data-structures/event-service/evm/AbstractNullifierSnapshotService.ts
var n = class extends e {
	constructor(e) {
		super(e, "Nullified");
	}
	_nullifiers;
	get nullifiers() {
		return this._nullifiers;
	}
	serializeSnapshot(e) {
		return {
			nullifiers: Array.from(e.payload.nullifiers).map((e) => e.toString()),
			latestBlockNumber: e.latestBlockNumber
		};
	}
	deserializeSnapshot(e) {
		return {
			latestBlockNumber: e.latestBlockNumber ?? 0,
			payload: { nullifiers: new Set(e.nullifiers ?? []) }
		};
	}
	acceptEvent(e, t) {
		try {
			return this._nullifiers.has(e.nullifier) ? !1 : (this._nullifiers.add(e.nullifier), !0);
		} catch (e) {
			return console.error(e), !1;
		}
	}
	mapEvent(e) {
		let n = e.getArg("nullifier");
		return { nullifier: t.toBeHex(n) };
	}
	getSnapshotPayload() {
		return { nullifiers: this._nullifiers };
	}
	populateSnapshot({ payload: { nullifiers: e } }) {
		this._nullifiers = e;
	}
};
//#endregion
export { n as AbstractNullifierSnapshotService };
