import { poseidonFunction as e } from "../../crypto/poseidon.mjs";
import { PublicKey as t } from "@solana/web3.js";
import { BN as n } from "@coral-xyz/anchor";
//#region libs/shared/common/src/functions/pre-transaction/solana.ts
var r = (e) => new TextEncoder().encode(e), i = (e) => {
	let t = [], n = e;
	for (; n > 0n;) t.unshift(Number(n % 256n)), n /= 256n;
	for (; t.length < 32;) t.unshift(0);
	return t;
}, a = (e) => ({
	extraRandomization: i(e.extraRandomization),
	stealthAddress: i(e.stealthAddress),
	h0: i(e.H0),
	h1: i(e.H1)
}), o = (e, n, a) => {
	let o = i(e), s = [
		r("hinkal_nullifier"),
		n.toBytes(),
		new Uint8Array(o)
	], [c] = t.findProgramAddressSync(s, a);
	return c;
}, s = (e, n) => {
	let i = [r("hinkal"), n.toBytes()], [a] = t.findProgramAddressSync(i, e);
	return a;
}, c = (e, n) => {
	let i = [r("hinkal_merkle"), n.toBytes()], [a] = t.findProgramAddressSync(i, e);
	return a;
}, l = (e, i, a) => {
	let o = [
		r("hinkal_swapper"),
		i.toBytes(),
		new Uint8Array(new n(a.toString()).toArray("be", 32))
	], [s] = t.findProgramAddressSync(o, e);
	return s;
}, u = (t, n, r) => l(t, n, e(r)), d = (e, n) => {
	let i = [r("hinkal_vault"), n.toBytes()], [a] = t.findProgramAddressSync(i, e);
	return a;
}, f = (e, i, a, o) => {
	let s = [
		r("hinkal_proof_part1"),
		i.toBytes(),
		a.toBytes(),
		new Uint8Array(new n(o.toString()).toArray("be", 4))
	], [c] = t.findProgramAddressSync(s, e);
	return c;
}, p = (e, i, a, o) => {
	let s = [
		r("hinkal_proof_part2"),
		i.toBytes(),
		a.toBytes(),
		new Uint8Array(new n(o.toString()).toArray("be", 4))
	], [c] = t.findProgramAddressSync(s, e);
	return c;
}, m = (e, i, a, o) => {
	let s = [
		r("hinkal_encrypted_outputs"),
		i.toBytes(),
		a.toBytes(),
		new Uint8Array(new n(o.toString()).toArray("be", 4))
	], [c] = t.findProgramAddressSync(s, e);
	return c;
}, h = (e, i, a, o) => {
	let s = [
		r("hinkal_instructions"),
		i.toBytes(),
		a.toBytes(),
		new Uint8Array(new n(o.toString()).toArray("be", 4))
	], [c] = t.findProgramAddressSync(s, e);
	return c;
};
//#endregion
export { a as buildAnchorStealthAddressStructure, i as encodeToByte32Array, m as getEncryptedOutputsAccountPublicKey, h as getInstructionsAccountPublicKey, c as getMerkleAccountPublicKey, o as getNullifierAccount, f as getProofAccountPart1PublicKey, p as getProofAccountPart2PublicKey, s as getStorageAccountPublicKey, d as getStorageVaultPublicKey, l as getSwapperAccountPublicKey, u as getSwapperAccountPublicKeyFromSalt };
