import "../../constants/chains.constants.mjs";
import { ContractType as e } from "../../types/ethereum-network.types.mjs";
import { toBigInt as t } from "./amounts.utils.mjs";
import "../../types/index.mjs";
import { caseInsensitiveEqual as n } from "./caseInsensitive.utils.mjs";
import "../../data-structures/crypto-keys/keys.mjs";
import { getContractAddress as r } from "./getContractAddress.mjs";
import "../../data-structures/crypto-keys/encryptDecryptUtxo.mjs";
import { decodeUtxo as i } from "../../data-structures/crypto-keys/decodeUTXO.mjs";
import "ethers";
//#region libs/shared/common/src/functions/utils/getUtxosFromReceipt.utils.ts
var a = (a, o, s, c) => {
	let l = o.getContractWithFetcher(s, e.HinkalContract), u = l.interface, d = o.userKeys.getShieldedPrivateKey(), f = r(l);
	return a.logs.filter((e) => n(e.address, f)).map((e) => {
		try {
			let r = u.parseLog(e);
			if (r?.name === "NewCommitment") {
				let { encryptedOutput: e, index: a } = r.args;
				if (t(a) < 0n) {
					let t = i(e, d, s);
					if (n(t.erc20TokenAddress, c)) return t;
				}
			}
		} catch {
			return null;
		}
		return null;
	}).filter((e) => e !== null);
};
//#endregion
export { a as getOnChainUtxosFromReceipt };
