import "../../constants/protocol.constants.mjs";
import { getEncryptedOutputsAccountPublicKey as e, getProofAccountPart1PublicKey as t, getProofAccountPart2PublicKey as n } from "./solana.mjs";
import { sendV0Transaction as r } from "./sendV0Transaction.mjs";
//#region libs/shared/common/src/functions/pre-transaction/store-proof.ts
var i = async (i, a, o, s, c, l, u, d, f, p) => {
	let m = e(a.programId, s, o.publicKey, c), h = l.length;
	await Promise.all(l.map(async (e, t) => r(i, [await a.methods.storeEncryptedOutputs(Number(c), Buffer.from(e), t, h).accounts({
		originalDeployer: s,
		signer: o.publicKey,
		encryptedOutputsAccount: m
	}).instruction()], o, [o])));
	let g = t(a.programId, s, o.publicKey, c);
	await r(i, [await a.methods.storeProofPart1(Number(c), u, d, f, p.slice(0, 15)).accounts({
		originalDeployer: s,
		signer: o.publicKey,
		proofAccountPart1: g
	}).instruction()], o, [o]);
	let _ = n(a.programId, s, o.publicKey, c);
	return await r(i, [await a.methods.storeProofPart2(Number(c), p.slice(15)).accounts({
		originalDeployer: s,
		signer: o.publicKey,
		proofAccountPart2: _
	}).instruction()], o, [o]), {
		proofAccountPart1: g,
		proofAccountPart2: _,
		encryptedOutputsAccount: m
	};
};
//#endregion
export { i as storeProof };
