@umbra-privacy/sdk 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{addresses-BIzQplvu.d.ts → addresses-B7HybtbJ.d.ts} +1 -1
  2. package/dist/{addresses-Djkrs22V.d.cts → addresses-CTVY1oi7.d.cts} +1 -1
  3. package/dist/{chunk-JPDF7BIT.cjs → chunk-3LS5P32X.cjs} +3 -3
  4. package/dist/{chunk-JPDF7BIT.cjs.map → chunk-3LS5P32X.cjs.map} +1 -1
  5. package/dist/{chunk-D5MWU3TV.js → chunk-KH3YTDKA.js} +3 -3
  6. package/dist/{chunk-D5MWU3TV.js.map → chunk-KH3YTDKA.js.map} +1 -1
  7. package/dist/{chunk-RVUYPKKD.js → chunk-KMRROOME.js} +3 -3
  8. package/dist/{chunk-RVUYPKKD.js.map → chunk-KMRROOME.js.map} +1 -1
  9. package/dist/{chunk-ZPSWMSXL.js → chunk-OFDWNWCL.js} +3 -3
  10. package/dist/{chunk-ZPSWMSXL.js.map → chunk-OFDWNWCL.js.map} +1 -1
  11. package/dist/{chunk-DQ25W34A.cjs → chunk-UEI7SYH6.cjs} +3 -3
  12. package/dist/{chunk-DQ25W34A.cjs.map → chunk-UEI7SYH6.cjs.map} +1 -1
  13. package/dist/{chunk-GXCRPFTT.cjs → chunk-YEZBTYCP.cjs} +3 -3
  14. package/dist/{chunk-GXCRPFTT.cjs.map → chunk-YEZBTYCP.cjs.map} +1 -1
  15. package/dist/{client-BmzzZ8qS.d.cts → client-DkVBHMWb.d.cts} +5 -5
  16. package/dist/{client-CQytBtEn.d.ts → client-V4AF6Bz9.d.ts} +5 -5
  17. package/dist/common/pda/index.cjs +35 -35
  18. package/dist/common/pda/index.d.cts +2 -2
  19. package/dist/common/pda/index.d.ts +2 -2
  20. package/dist/common/pda/index.js +2 -2
  21. package/dist/constants/index.cjs +1 -1
  22. package/dist/constants/index.d.cts +3 -3
  23. package/dist/constants/index.d.ts +3 -3
  24. package/dist/constants/index.js +1 -1
  25. package/dist/crypto/index.cjs +145 -145
  26. package/dist/crypto/index.d.cts +13 -13
  27. package/dist/crypto/index.d.ts +13 -13
  28. package/dist/crypto/index.js +4 -4
  29. package/dist/{cryptography-Dk1cBuym.d.ts → cryptography-BFSJcvi6.d.ts} +1 -1
  30. package/dist/{cryptography-BJ5sCytb.d.cts → cryptography-D6tPDh-Y.d.cts} +1 -1
  31. package/dist/{index-Ckj9PfBk.d.cts → index-BG0yjL7C.d.cts} +8 -8
  32. package/dist/{index-DAO_47xr.d.ts → index-ByynoyBO.d.ts} +8 -8
  33. package/dist/index.cjs +564 -564
  34. package/dist/index.d.cts +18 -18
  35. package/dist/index.d.ts +18 -18
  36. package/dist/index.js +10 -10
  37. package/dist/interfaces/index.d.cts +12 -12
  38. package/dist/interfaces/index.d.ts +12 -12
  39. package/dist/{interfaces-CpZDActo.d.cts → interfaces-43cReBcS.d.cts} +4 -4
  40. package/dist/{interfaces-CxrUtnVG.d.ts → interfaces-B8xKNl_6.d.ts} +2 -2
  41. package/dist/{interfaces-2b_ySL0r.d.cts → interfaces-D2NO6kDD.d.cts} +2 -2
  42. package/dist/{interfaces-C-N3oLgJ.d.ts → interfaces-z_xYJlgV.d.ts} +4 -4
  43. package/dist/math/index.cjs +8 -8
  44. package/dist/math/index.d.cts +4 -4
  45. package/dist/math/index.d.ts +4 -4
  46. package/dist/math/index.js +2 -2
  47. package/dist/{networks-B3pArLLR.d.ts → networks-RMd3abPE.d.ts} +1 -1
  48. package/dist/{networks-Bkl2oP0q.d.cts → networks-yAoO8peQ.d.cts} +1 -1
  49. package/dist/solana/index.d.cts +7 -7
  50. package/dist/solana/index.d.ts +7 -7
  51. package/dist/{temporal-B3yk1YkA.d.ts → temporal-BbRaEPoO.d.ts} +1 -1
  52. package/dist/{temporal-BHMGDS-0.d.cts → temporal-oUj7iCaq.d.cts} +1 -1
  53. package/dist/{transaction-forwarder-BODYfi-S.d.ts → transaction-forwarder-5mAMTjw6.d.ts} +2 -2
  54. package/dist/{transaction-forwarder-DwAK9whb.d.cts → transaction-forwarder-C6gMUG7a.d.cts} +2 -2
  55. package/dist/types/index.d.cts +8 -8
  56. package/dist/types/index.d.ts +8 -8
  57. package/dist/{types-2UHG9wC-.d.cts → types-BohhvPth.d.cts} +1 -1
  58. package/dist/{types-C42QtYXI.d.ts → types-CW0oTT0j.d.ts} +1 -1
  59. package/dist/{types-CM3nVKl2.d.ts → types-C_V_CaKK.d.cts} +1 -1
  60. package/dist/{types-CM3nVKl2.d.cts → types-C_V_CaKK.d.ts} +1 -1
  61. package/dist/{types-BrQv82ne.d.ts → types-Ca7frykr.d.ts} +2 -2
  62. package/dist/{types-4rAlbodI.d.cts → types-CuKeoI19.d.cts} +2 -2
  63. package/dist/{types-gNnLmOsz.d.ts → types-CxfTIpN9.d.ts} +2 -2
  64. package/dist/{types-DfmTaW3z.d.ts → types-D1jDUjfN.d.ts} +1 -1
  65. package/dist/{types-KMWXIyOY.d.ts → types-DKEDUlH9.d.ts} +2 -2
  66. package/dist/{types-i26vVlXf.d.cts → types-EKuIfxTz.d.cts} +2 -2
  67. package/dist/{types-BYBfXNV_.d.cts → types-IMGYmlv-.d.cts} +1 -1
  68. package/dist/{types-C8HrYlDv.d.cts → types-PwNLi_2k.d.cts} +2 -2
  69. package/dist/utils/index.cjs +120 -120
  70. package/dist/utils/index.d.cts +5 -5
  71. package/dist/utils/index.d.ts +5 -5
  72. package/dist/utils/index.js +2 -2
  73. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/math/bn254/operations.ts"],"names":["__name","BN254_FIELD_PRIME","CryptographyError","assertBn254FieldElement"],"mappings":"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","file":"chunk-GXCRPFTT.cjs","sourcesContent":["/**\n * BN254 Field Operations Module\n *\n * This module provides higher-level arithmetic operations over the BN254 scalar\n * field F_r, including modular exponentiation, multiplicative inverse computation,\n * and the basic field operations (add, subtract, multiply). These functions build\n * on the branded type system defined in `types.ts` and are intended for use in\n * cryptographic protocols such as Groth16 proof generation, Fiat-Shamir challenges,\n * and ZK circuit witness computation.\n *\n * @remarks\n * ## BN254 and the Scalar Field\n *\n * The BN254 curve (also known as alt_bn128 or bn256) is a pairing-friendly\n * elliptic curve whose scalar field has prime order:\n * ```\n * r = 21888242871839275222246405745257275088548364400416034343698204186575808495617\n * ```\n * All operations in this module reduce their results modulo `r`, ensuring that\n * outputs are always valid field elements in the range `[0, r-1]`.\n *\n * ## Performance Characteristics\n *\n * - `bn254Add`, `bn254Sub`, `bn254Mul`: O(1) — single BigInt operation + reduction\n * - `bn254ModuloPow`: O(log exp) squarings and multiplications via square-and-multiply\n * - `computeBn254ModularInverse`: O(log p) — Fermat exponentiation with p-2 as exponent\n * - `computeBn254LimbwiseSumInverse`: O(log p) — three additions followed by inversion\n *\n * ## Security Note\n *\n * The inverse functions use Fermat's Little Theorem (`a^(p-2) mod p`) rather than\n * the Extended Euclidean Algorithm. This choice trades a small performance overhead\n * for a simpler, more auditable implementation. The underlying `modulePow` helper\n * is intentionally non-constant-time (uses the `bigint` `%` operator internally);\n * for constant-time arithmetic, use the functions in `field-arithmetic.ts`.\n *\n * @see {@link ./field-arithmetic} Constant-time field arithmetic\n * @see {@link ./types} BN254 field element types and validation\n *\n * @packageDocumentation\n * @module math/bn254/operations\n */\n\nimport { type Bn254FieldElement, assertBn254FieldElement, BN254_FIELD_PRIME } from \"./types\";\nimport type { Base85Limb } from \"../../crypto/poseidon/types\";\nimport { CryptographyError } from \"../../crypto/errors\";\n\n/**\n * Computes modular exponentiation: `base^exp mod modulus` using the\n * square-and-multiply (binary exponentiation) algorithm.\n *\n * @remarks\n * This is a general-purpose helper used internally by the BN254-specific\n * exported functions. It handles negative bases by first normalizing to the\n * canonical representative in `[0, modulus - 1]` via `((base % modulus) + modulus) % modulus`.\n *\n * ## Algorithm: Square-and-Multiply\n *\n * The square-and-multiply algorithm achieves O(log exp) multiplications by\n * processing the bits of the exponent from least significant to most significant:\n * ```\n * result = 1\n * while exp > 0:\n * if exp is odd: result = result * base mod modulus\n * exp = exp >> 1\n * base = base * base mod modulus\n * ```\n *\n * ## Special Case\n *\n * When `modulus === 1n`, all values are congruent to 0 modulo 1, so the function\n * immediately returns `0n`.\n *\n * @param base - The base value (any integer; negative values are normalized)\n * @param exp - The exponent (must be a non-negative `bigint`)\n * @param modulus - The modulus (must be a positive `bigint`)\n * @returns `base^exp mod modulus`, always in the range `[0, modulus - 1]`\n *\n * @example\n * ```typescript\n * // Internal usage — not exported. Used by bn254ModuloPow and the inverse functions.\n * const result = modulePow(2n, 10n, 1000n); // 1024 mod 1000 = 24\n * const fermat = modulePow(7n, BN254_FIELD_PRIME - 2n, BN254_FIELD_PRIME); // 7^-1 mod p\n * ```\n *\n * @internal\n */\nfunction modulePow(base: bigint, exp: bigint, modulus: bigint): bigint {\n if (modulus === 1n) {\n return 0n;\n }\n let result = 1n;\n base = ((base % modulus) + modulus) % modulus;\n while (exp > 0n) {\n if (exp % 2n === 1n) {\n result = (result * base) % modulus;\n }\n exp = exp >> 1n;\n base = (base * base) % modulus;\n }\n return result;\n}\n\n/**\n * Computes the multiplicative inverse of a BN254 field element using\n * Fermat's Little Theorem.\n *\n * @remarks\n * ## Mathematical Background\n *\n * For a prime field F_p, every non-zero element `a` has a unique multiplicative\n * inverse `a^(-1)` satisfying:\n * ```\n * a * a^(-1) ≡ 1 (mod p)\n * ```\n *\n * By Fermat's Little Theorem, for prime `p` and `a != 0 (mod p)`:\n * ```\n * a^(p-1) ≡ 1 (mod p)\n * ```\n * Multiplying both sides by `a^(-1)`:\n * ```\n * a^(p-2) ≡ a^(-1) (mod p)\n * ```\n *\n * This function evaluates `a^(p-2) mod p` via the square-and-multiply algorithm\n * in O(log p) field multiplications (approximately 254 squarings for BN254).\n *\n * ## Input Normalization\n *\n * The input is first normalized to its canonical representative in `[0, p-1]`\n * via double reduction. If the normalized value is `0n`, there is no inverse and\n * a `CryptographyError` is thrown.\n *\n * ## Complexity\n *\n * O(log p) ≈ O(254) field multiplications (squarings and multiplications via\n * the square-and-multiply algorithm on a 254-bit exponent `p-2`).\n *\n * @param value - The BN254 field element to invert. Must be non-zero in the field.\n * @returns The multiplicative inverse of `value` in `[1, BN254_FIELD_PRIME - 1]`.\n *\n * @throws {CryptographyError} If `value` is congruent to zero modulo the field prime,\n * because zero has no multiplicative inverse in any field.\n *\n * @example\n * ```typescript\n * import {\n * computeBn254ModularInverse,\n * bn254Mul,\n * BN254_FIELD_PRIME,\n * } from \"@umbra/sdk\";\n * import { assertBn254FieldElement } from \"@umbra/sdk\";\n *\n * const a = 12345n;\n * assertBn254FieldElement(a, \"a\");\n *\n * const aInv = computeBn254ModularInverse(a);\n *\n * // Verify: a * a^(-1) = 1 (mod p)\n * const product = bn254Mul(a, aInv);\n * console.log(product === 1n); // true\n *\n * // Division by a: b / a = b * a^(-1) mod p\n * const b = 99999n;\n * assertBn254FieldElement(b, \"b\");\n * const quotient = bn254Mul(b, aInv); // b / a mod p\n * ```\n *\n * @see {@link bn254ModuloPow} For general modular exponentiation in the BN254 field\n * @see {@link computeBn254LimbwiseSumInverse} For the inverse of a Base85 limb sum\n *\n * @public\n */\nexport function computeBn254ModularInverse(value: Bn254FieldElement): Bn254FieldElement {\n // Ensure the value is in the field\n const normalizedValue =\n ((BigInt(value) % BN254_FIELD_PRIME) + BN254_FIELD_PRIME) % BN254_FIELD_PRIME;\n\n if (normalizedValue === 0n) {\n throw new CryptographyError(\"Cannot compute inverse of zero in BN254 field\");\n }\n\n // Use Fermat's Little Theorem: a^(-1) = a^(p-2) mod p\n const inverse = modulePow(normalizedValue, BN254_FIELD_PRIME - 2n, BN254_FIELD_PRIME);\n\n assertBn254FieldElement(inverse, \"inverse\");\n return inverse;\n}\n\n/**\n * Computes the multiplicative inverse of the sum of three Base85 limbs in the\n * BN254 scalar field.\n *\n * @remarks\n * ## Context: Base85 Limb Representation\n *\n * In ZK circuits that use the Circom/Groth16 toolchain, 255-bit field element\n * inputs are commonly represented as three 85-bit limbs (sometimes called\n * \"Base85 limbs\") to allow efficient constraint generation. Each limb holds\n * a 85-bit chunk of the full value:\n * ```\n * full_value = limbs[0] + limbs[1] * 2^85 + limbs[2] * 2^170\n * ```\n *\n * ## Circuit Non-Zero Validation\n *\n * Proving that a value is non-zero in a ZK circuit requires the circuit to\n * supply the multiplicative inverse of that value as an auxiliary witness.\n * When the value is represented in limbwise form, the circuit sometimes needs\n * the inverse of the *sum of the limbs* rather than the inverse of the\n * reconstructed value. This function computes exactly that:\n * ```\n * sum = (limbs[0] + limbs[1] + limbs[2]) mod p\n * result = sum^(-1) mod p\n * ```\n *\n * ## Why Limbwise Sum Instead of Reconstructed Value?\n *\n * The sum `limbs[0] + limbs[1] + limbs[2]` is a cheaper operation in\n * the circuit compared to the full positional reconstruction\n * `limbs[0] + limbs[1]*2^85 + limbs[2]*2^170`. The sum-based non-zero check\n * works because if all three limbs are zero, their sum is also zero; otherwise\n * the sum is guaranteed to be non-zero (given the limb range constraints enforced\n * by the circuit).\n *\n * @param limbs - A tuple of three `Base85Limb` values: `[low, middle, high]`.\n * Each limb must be in the range `[0, 2^85 - 1]`.\n * @returns The multiplicative inverse of `(limbs[0] + limbs[1] + limbs[2]) mod p`\n * as a `Bn254FieldElement` in the range `[1, BN254_FIELD_PRIME - 1]`.\n *\n * @throws {CryptographyError} If the sum of all three limbs is congruent to zero\n * modulo the BN254 field prime, meaning no inverse exists.\n *\n * @example\n * ```typescript\n * import {\n * computeBn254LimbwiseSumInverse,\n * BN254_FIELD_PRIME,\n * } from \"@umbra/sdk\";\n * import { assertBase85Limb } from \"@umbra/sdk\";\n *\n * const low = 0x1234n;\n * const mid = 0x5678n;\n * const high = 0x9ABCn;\n * assertBase85Limb(low, \"low\");\n * assertBase85Limb(mid, \"mid\");\n * assertBase85Limb(high, \"high\");\n *\n * const inverse = computeBn254LimbwiseSumInverse([low, mid, high]);\n *\n * // Verify: (low + mid + high) * inverse ≡ 1 (mod p)\n * const sum = (low + mid + high) % BN254_FIELD_PRIME;\n * const check = (sum * inverse) % BN254_FIELD_PRIME;\n * console.log(check === 1n); // true\n * ```\n *\n * @see {@link computeBn254ModularInverse} For inverting a single field element\n * @see {@link Base85Limb} The branded limb type from `crypto/poseidon/types`\n *\n * @public\n */\nexport function computeBn254LimbwiseSumInverse(\n limbs: [Base85Limb, Base85Limb, Base85Limb],\n): Bn254FieldElement {\n // Sum the limbs\n const sum = (BigInt(limbs[0]) + BigInt(limbs[1]) + BigInt(limbs[2])) % BN254_FIELD_PRIME;\n\n if (sum === 0n) {\n throw new CryptographyError(\"Cannot compute inverse: sum of limbs is zero\");\n }\n\n // Compute the inverse\n const inverse = modulePow(sum, BN254_FIELD_PRIME - 2n, BN254_FIELD_PRIME);\n\n assertBn254FieldElement(inverse, \"inverse\");\n return inverse;\n}\n\n/**\n * Computes modular exponentiation in the BN254 scalar field: `base^exp mod p`.\n *\n * @remarks\n * This is a type-safe wrapper around the internal `modulePow` helper that\n * constrains both the input and output to the BN254 scalar field. It delegates\n * to the square-and-multiply algorithm with O(log exp) multiplications.\n *\n * ## Typical Use Cases\n *\n * - Computing powers of a Fiat-Shamir challenge scalar\n * - Evaluating polynomial commitments at a challenge point\n * - Batch inversion via exponentiation (less efficient than Extended GCD but simpler)\n *\n * ## Exponent Sign\n *\n * The exponent must be a non-negative `bigint`. Negative exponents are not supported;\n * use `computeBn254ModularInverse` for `base^(-1)` and compose with `bn254ModuloPow`\n * for general negative powers.\n *\n * @param base - The base field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param exp - The non-negative integer exponent (a plain `bigint`, not necessarily in the field).\n * @returns `base^exp mod BN254_FIELD_PRIME` as a `Bn254FieldElement`.\n *\n * @example\n * ```typescript\n * import { bn254ModuloPow, assertBn254FieldElement } from \"@umbra/sdk\";\n *\n * const challenge = 999n;\n * assertBn254FieldElement(challenge, \"challenge\");\n *\n * // Compute challenge^3 mod p (evaluating a cubic polynomial coefficient)\n * const cubed = bn254ModuloPow(challenge, 3n);\n *\n * // Compute challenge^0 = 1 (identity)\n * const identity = bn254ModuloPow(challenge, 0n);\n * console.log(identity === 1n); // true\n * ```\n *\n * @see {@link computeBn254ModularInverse} For the special case exp = -1\n * @see {@link bn254Mul} For a single multiplication\n *\n * @public\n */\nexport function bn254ModuloPow(base: Bn254FieldElement, exp: bigint): Bn254FieldElement {\n const result = modulePow(BigInt(base), exp, BN254_FIELD_PRIME);\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n\n/**\n * Computes the sum of two BN254 scalar field elements modulo the field prime.\n *\n * @remarks\n * ## Formula\n *\n * ```\n * result = (a + b) mod BN254_FIELD_PRIME\n * ```\n *\n * Because both `a` and `b` are in `[0, p-1]`, their sum is in `[0, 2p-2]`,\n * which requires at most one modular reduction step. This is implemented directly\n * via JavaScript's `%` operator on `bigint`.\n *\n * ## Overflow Behavior\n *\n * JavaScript `bigint` arithmetic is arbitrary precision, so there is no risk of\n * overflow. The modular reduction always yields a result in `[0, p-1]`.\n *\n * @param a - First summand, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param b - Second summand, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @returns `(a + b) mod BN254_FIELD_PRIME` as a `Bn254FieldElement`.\n *\n * @example\n * ```typescript\n * import { bn254Add, assertBn254FieldElement, BN254_FIELD_PRIME } from \"@umbra/sdk\";\n *\n * const a = 10n;\n * const b = 20n;\n * assertBn254FieldElement(a, \"a\");\n * assertBn254FieldElement(b, \"b\");\n *\n * const sum = bn254Add(a, b);\n * console.log(sum === 30n); // true\n *\n * // Demonstrates wraparound at the field boundary\n * const nearPrime = BN254_FIELD_PRIME - 1n;\n * assertBn254FieldElement(nearPrime, \"nearPrime\");\n * const wrapped = bn254Add(nearPrime, b);\n * // (p - 1 + 20) mod p = 19\n * console.log(wrapped === 19n); // true\n * ```\n *\n * @see {@link bn254Sub} For modular subtraction\n * @see {@link bn254Mul} For modular multiplication\n *\n * @public\n */\nexport function bn254Add(a: Bn254FieldElement, b: Bn254FieldElement): Bn254FieldElement {\n const result = (BigInt(a) + BigInt(b)) % BN254_FIELD_PRIME;\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n\n/**\n * Computes the difference of two BN254 scalar field elements modulo the field prime.\n *\n * @remarks\n * ## Formula\n *\n * ```\n * result = (a - b) mod BN254_FIELD_PRIME\n * ```\n *\n * Because `a - b` can be negative when `b > a`, the result is obtained by\n * adding the prime before taking the modulo to ensure canonicalization into\n * `[0, p-1]`:\n * ```\n * diff = a - b\n * result = ((diff % p) + p) % p\n * ```\n *\n * This pattern handles both the case where `a >= b` (no wrap-around needed)\n * and the case where `a < b` (wrap-around by adding `p`).\n *\n * @param a - Minuend, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param b - Subtrahend, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @returns `(a - b) mod BN254_FIELD_PRIME` as a `Bn254FieldElement` in `[0, p-1]`.\n *\n * @example\n * ```typescript\n * import { bn254Sub, assertBn254FieldElement, BN254_FIELD_PRIME } from \"@umbra/sdk\";\n *\n * const a = 30n;\n * const b = 10n;\n * assertBn254FieldElement(a, \"a\");\n * assertBn254FieldElement(b, \"b\");\n *\n * const diff = bn254Sub(a, b);\n * console.log(diff === 20n); // true\n *\n * // Underflow wraps around the field prime\n * const small = 5n;\n * assertBn254FieldElement(small, \"small\");\n * const wrapped = bn254Sub(small, b);\n * // (5 - 10 + p) mod p = p - 5\n * console.log(wrapped === BN254_FIELD_PRIME - 5n); // true\n * ```\n *\n * @see {@link bn254Add} For modular addition\n * @see {@link bn254Mul} For modular multiplication\n *\n * @public\n */\nexport function bn254Sub(a: Bn254FieldElement, b: Bn254FieldElement): Bn254FieldElement {\n const diff = BigInt(a) - BigInt(b);\n const result = ((diff % BN254_FIELD_PRIME) + BN254_FIELD_PRIME) % BN254_FIELD_PRIME;\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n\n/**\n * Computes the product of two BN254 scalar field elements modulo the field prime.\n *\n * @remarks\n * ## Formula\n *\n * ```\n * result = (a * b) mod BN254_FIELD_PRIME\n * ```\n *\n * Because both `a` and `b` are approximately 254-bit values, their product is\n * approximately 508 bits before reduction. JavaScript's `bigint` type handles\n * arbitrary precision arithmetic natively, so no overflow occurs. The result\n * is reduced to `[0, p-1]` via a single `%` operation.\n *\n * ## Performance Note\n *\n * This function uses JavaScript's built-in `bigint` multiplication, which is not\n * constant-time. For cryptographic contexts where timing side-channels are a\n * concern (e.g., secret-key operations), use `bn254ModuloMul` from\n * `field-arithmetic.ts` which uses constant-time Montgomery multiplication.\n *\n * @param a - First factor, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param b - Second factor, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @returns `(a * b) mod BN254_FIELD_PRIME` as a `Bn254FieldElement`.\n *\n * @example\n * ```typescript\n * import { bn254Mul, assertBn254FieldElement, BN254_FIELD_PRIME } from \"@umbra/sdk\";\n *\n * const a = 7n;\n * const b = 8n;\n * assertBn254FieldElement(a, \"a\");\n * assertBn254FieldElement(b, \"b\");\n *\n * const product = bn254Mul(a, b);\n * console.log(product === 56n); // true\n *\n * // Product of two large field elements wraps around\n * const large = BN254_FIELD_PRIME - 1n;\n * assertBn254FieldElement(large, \"large\");\n * const result = bn254Mul(large, 2n as unknown as typeof large);\n * // (p - 1) * 2 mod p = p - 2\n * console.log(result === BN254_FIELD_PRIME - 2n); // true\n * ```\n *\n * @see {@link bn254Add} For modular addition\n * @see {@link bn254Sub} For modular subtraction\n * @see {@link computeBn254ModularInverse} For multiplicative inverse (division)\n *\n * @public\n */\nexport function bn254Mul(a: Bn254FieldElement, b: Bn254FieldElement): Bn254FieldElement {\n const result = (BigInt(a) * BigInt(b)) % BN254_FIELD_PRIME;\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n"]}
1
+ {"version":3,"sources":["../src/math/bn254/operations.ts"],"names":["__name","BN254_FIELD_PRIME","CryptographyError","assertBn254FieldElement"],"mappings":";;;;;;;AAuFA,SAAS,SAAA,CAAU,IAAA,EAAc,GAAA,EAAa,OAAA,EAAyB;AACrE,EAAA,IAAI,YAAY,EAAA,EAAI;AAClB,IAAA,OAAO,EAAA;AAAA,EACT;AACA,EAAA,IAAI,MAAA,GAAS,EAAA;AACb,EAAA,IAAA,GAAA,CAAS,IAAA,GAAO,UAAW,OAAA,IAAW,OAAA;AACtC,EAAA,OAAO,MAAM,EAAA,EAAI;AACf,IAAA,IAAI,GAAA,GAAM,OAAO,EAAA,EAAI;AACnB,MAAA,MAAA,GAAU,SAAS,IAAA,GAAQ,OAAA;AAAA,IAC7B;AACA,IAAA,GAAA,GAAM,GAAA,IAAO,EAAA;AACb,IAAA,IAAA,GAAQ,OAAO,IAAA,GAAQ,OAAA;AAAA,EACzB;AACA,EAAA,OAAO,MAAA;AACT;AAdSA,wBAAA,CAAA,SAAA,EAAA,WAAA,CAAA;AAuFF,SAAS,2BAA2B,KAAA,EAA6C;AAEtF,EAAA,MAAM,eAAA,GAAA,CACF,MAAA,CAAO,KAAK,CAAA,GAAIC,sCAAqBA,mCAAA,IAAqBA,mCAAA;AAE9D,EAAA,IAAI,oBAAoB,EAAA,EAAI;AAC1B,IAAA,MAAM,IAAIC,oCAAkB,+CAA+C,CAAA;AAAA,EAC7E;AAGA,EAAA,MAAM,OAAA,GAAU,SAAA,CAAU,eAAA,EAAiBD,mCAAA,GAAoB,IAAIA,mCAAiB,CAAA;AAEpF,EAAAE,yCAAA,CAAwB,SAAS,SAAS,CAAA;AAC1C,EAAA,OAAO,OAAA;AACT;AAdgBH,wBAAA,CAAA,0BAAA,EAAA,4BAAA,CAAA;AAwFT,SAAS,+BACd,KAAA,EACmB;AAEnB,EAAA,MAAM,GAAA,GAAA,CAAO,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,IAAKC,mCAAA;AAEvE,EAAA,IAAI,QAAQ,EAAA,EAAI;AACd,IAAA,MAAM,IAAIC,oCAAkB,8CAA8C,CAAA;AAAA,EAC5E;AAGA,EAAA,MAAM,OAAA,GAAU,SAAA,CAAU,GAAA,EAAKD,mCAAA,GAAoB,IAAIA,mCAAiB,CAAA;AAExE,EAAAE,yCAAA,CAAwB,SAAS,SAAS,CAAA;AAC1C,EAAA,OAAO,OAAA;AACT;AAfgBH,wBAAA,CAAA,8BAAA,EAAA,gCAAA,CAAA;AA6DT,SAAS,cAAA,CAAe,MAAyB,GAAA,EAAgC;AACtF,EAAA,MAAM,SAAS,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA,EAAG,KAAKC,mCAAiB,CAAA;AAC7D,EAAAE,yCAAA,CAAwB,QAAQ,QAAQ,CAAA;AACxC,EAAA,OAAO,MAAA;AACT;AAJgBH,wBAAA,CAAA,cAAA,EAAA,gBAAA,CAAA;AAsDT,SAAS,QAAA,CAAS,GAAsB,CAAA,EAAyC;AACtF,EAAA,MAAM,UAAU,MAAA,CAAO,CAAC,CAAA,GAAI,MAAA,CAAO,CAAC,CAAA,IAAKC,mCAAA;AACzC,EAAAE,yCAAA,CAAwB,QAAQ,QAAQ,CAAA;AACxC,EAAA,OAAO,MAAA;AACT;AAJgBH,wBAAA,CAAA,QAAA,EAAA,UAAA,CAAA;AAwDT,SAAS,QAAA,CAAS,GAAsB,CAAA,EAAyC;AACtF,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,CAAC,CAAA,GAAI,OAAO,CAAC,CAAA;AACjC,EAAA,MAAM,MAAA,GAAA,CAAW,IAAA,GAAOC,mCAAA,GAAqBA,mCAAA,IAAqBA,mCAAA;AAClE,EAAAE,yCAAA,CAAwB,QAAQ,QAAQ,CAAA;AACxC,EAAA,OAAO,MAAA;AACT;AALgBH,wBAAA,CAAA,QAAA,EAAA,UAAA,CAAA;AA2DT,SAAS,QAAA,CAAS,GAAsB,CAAA,EAAyC;AACtF,EAAA,MAAM,SAAU,MAAA,CAAO,CAAC,CAAA,GAAI,MAAA,CAAO,CAAC,CAAA,GAAKC,mCAAA;AACzC,EAAAE,yCAAA,CAAwB,QAAQ,QAAQ,CAAA;AACxC,EAAA,OAAO,MAAA;AACT;AAJgBH,wBAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"chunk-YEZBTYCP.cjs","sourcesContent":["/**\n * BN254 Field Operations Module\n *\n * This module provides higher-level arithmetic operations over the BN254 scalar\n * field F_r, including modular exponentiation, multiplicative inverse computation,\n * and the basic field operations (add, subtract, multiply). These functions build\n * on the branded type system defined in `types.ts` and are intended for use in\n * cryptographic protocols such as Groth16 proof generation, Fiat-Shamir challenges,\n * and ZK circuit witness computation.\n *\n * @remarks\n * ## BN254 and the Scalar Field\n *\n * The BN254 curve (also known as alt_bn128 or bn256) is a pairing-friendly\n * elliptic curve whose scalar field has prime order:\n * ```\n * r = 21888242871839275222246405745257275088548364400416034343698204186575808495617\n * ```\n * All operations in this module reduce their results modulo `r`, ensuring that\n * outputs are always valid field elements in the range `[0, r-1]`.\n *\n * ## Performance Characteristics\n *\n * - `bn254Add`, `bn254Sub`, `bn254Mul`: O(1) — single BigInt operation + reduction\n * - `bn254ModuloPow`: O(log exp) squarings and multiplications via square-and-multiply\n * - `computeBn254ModularInverse`: O(log p) — Fermat exponentiation with p-2 as exponent\n * - `computeBn254LimbwiseSumInverse`: O(log p) — three additions followed by inversion\n *\n * ## Security Note\n *\n * The inverse functions use Fermat's Little Theorem (`a^(p-2) mod p`) rather than\n * the Extended Euclidean Algorithm. This choice trades a small performance overhead\n * for a simpler, more auditable implementation. The underlying `modulePow` helper\n * is intentionally non-constant-time (uses the `bigint` `%` operator internally);\n * for constant-time arithmetic, use the functions in `field-arithmetic.ts`.\n *\n * @see {@link ./field-arithmetic} Constant-time field arithmetic\n * @see {@link ./types} BN254 field element types and validation\n *\n * @packageDocumentation\n * @module math/bn254/operations\n */\n\nimport { type Bn254FieldElement, assertBn254FieldElement, BN254_FIELD_PRIME } from \"./types\";\nimport type { Base85Limb } from \"../../crypto/poseidon/types\";\nimport { CryptographyError } from \"../../crypto/errors\";\n\n/**\n * Computes modular exponentiation: `base^exp mod modulus` using the\n * square-and-multiply (binary exponentiation) algorithm.\n *\n * @remarks\n * This is a general-purpose helper used internally by the BN254-specific\n * exported functions. It handles negative bases by first normalizing to the\n * canonical representative in `[0, modulus - 1]` via `((base % modulus) + modulus) % modulus`.\n *\n * ## Algorithm: Square-and-Multiply\n *\n * The square-and-multiply algorithm achieves O(log exp) multiplications by\n * processing the bits of the exponent from least significant to most significant:\n * ```\n * result = 1\n * while exp > 0:\n * if exp is odd: result = result * base mod modulus\n * exp = exp >> 1\n * base = base * base mod modulus\n * ```\n *\n * ## Special Case\n *\n * When `modulus === 1n`, all values are congruent to 0 modulo 1, so the function\n * immediately returns `0n`.\n *\n * @param base - The base value (any integer; negative values are normalized)\n * @param exp - The exponent (must be a non-negative `bigint`)\n * @param modulus - The modulus (must be a positive `bigint`)\n * @returns `base^exp mod modulus`, always in the range `[0, modulus - 1]`\n *\n * @example\n * ```typescript\n * // Internal usage — not exported. Used by bn254ModuloPow and the inverse functions.\n * const result = modulePow(2n, 10n, 1000n); // 1024 mod 1000 = 24\n * const fermat = modulePow(7n, BN254_FIELD_PRIME - 2n, BN254_FIELD_PRIME); // 7^-1 mod p\n * ```\n *\n * @internal\n */\nfunction modulePow(base: bigint, exp: bigint, modulus: bigint): bigint {\n if (modulus === 1n) {\n return 0n;\n }\n let result = 1n;\n base = ((base % modulus) + modulus) % modulus;\n while (exp > 0n) {\n if (exp % 2n === 1n) {\n result = (result * base) % modulus;\n }\n exp = exp >> 1n;\n base = (base * base) % modulus;\n }\n return result;\n}\n\n/**\n * Computes the multiplicative inverse of a BN254 field element using\n * Fermat's Little Theorem.\n *\n * @remarks\n * ## Mathematical Background\n *\n * For a prime field F_p, every non-zero element `a` has a unique multiplicative\n * inverse `a^(-1)` satisfying:\n * ```\n * a * a^(-1) ≡ 1 (mod p)\n * ```\n *\n * By Fermat's Little Theorem, for prime `p` and `a != 0 (mod p)`:\n * ```\n * a^(p-1) ≡ 1 (mod p)\n * ```\n * Multiplying both sides by `a^(-1)`:\n * ```\n * a^(p-2) ≡ a^(-1) (mod p)\n * ```\n *\n * This function evaluates `a^(p-2) mod p` via the square-and-multiply algorithm\n * in O(log p) field multiplications (approximately 254 squarings for BN254).\n *\n * ## Input Normalization\n *\n * The input is first normalized to its canonical representative in `[0, p-1]`\n * via double reduction. If the normalized value is `0n`, there is no inverse and\n * a `CryptographyError` is thrown.\n *\n * ## Complexity\n *\n * O(log p) ≈ O(254) field multiplications (squarings and multiplications via\n * the square-and-multiply algorithm on a 254-bit exponent `p-2`).\n *\n * @param value - The BN254 field element to invert. Must be non-zero in the field.\n * @returns The multiplicative inverse of `value` in `[1, BN254_FIELD_PRIME - 1]`.\n *\n * @throws {CryptographyError} If `value` is congruent to zero modulo the field prime,\n * because zero has no multiplicative inverse in any field.\n *\n * @example\n * ```typescript\n * import {\n * computeBn254ModularInverse,\n * bn254Mul,\n * BN254_FIELD_PRIME,\n * } from \"@umbra/sdk\";\n * import { assertBn254FieldElement } from \"@umbra/sdk\";\n *\n * const a = 12345n;\n * assertBn254FieldElement(a, \"a\");\n *\n * const aInv = computeBn254ModularInverse(a);\n *\n * // Verify: a * a^(-1) = 1 (mod p)\n * const product = bn254Mul(a, aInv);\n * console.log(product === 1n); // true\n *\n * // Division by a: b / a = b * a^(-1) mod p\n * const b = 99999n;\n * assertBn254FieldElement(b, \"b\");\n * const quotient = bn254Mul(b, aInv); // b / a mod p\n * ```\n *\n * @see {@link bn254ModuloPow} For general modular exponentiation in the BN254 field\n * @see {@link computeBn254LimbwiseSumInverse} For the inverse of a Base85 limb sum\n *\n * @public\n */\nexport function computeBn254ModularInverse(value: Bn254FieldElement): Bn254FieldElement {\n // Ensure the value is in the field\n const normalizedValue =\n ((BigInt(value) % BN254_FIELD_PRIME) + BN254_FIELD_PRIME) % BN254_FIELD_PRIME;\n\n if (normalizedValue === 0n) {\n throw new CryptographyError(\"Cannot compute inverse of zero in BN254 field\");\n }\n\n // Use Fermat's Little Theorem: a^(-1) = a^(p-2) mod p\n const inverse = modulePow(normalizedValue, BN254_FIELD_PRIME - 2n, BN254_FIELD_PRIME);\n\n assertBn254FieldElement(inverse, \"inverse\");\n return inverse;\n}\n\n/**\n * Computes the multiplicative inverse of the sum of three Base85 limbs in the\n * BN254 scalar field.\n *\n * @remarks\n * ## Context: Base85 Limb Representation\n *\n * In ZK circuits that use the Circom/Groth16 toolchain, 255-bit field element\n * inputs are commonly represented as three 85-bit limbs (sometimes called\n * \"Base85 limbs\") to allow efficient constraint generation. Each limb holds\n * a 85-bit chunk of the full value:\n * ```\n * full_value = limbs[0] + limbs[1] * 2^85 + limbs[2] * 2^170\n * ```\n *\n * ## Circuit Non-Zero Validation\n *\n * Proving that a value is non-zero in a ZK circuit requires the circuit to\n * supply the multiplicative inverse of that value as an auxiliary witness.\n * When the value is represented in limbwise form, the circuit sometimes needs\n * the inverse of the *sum of the limbs* rather than the inverse of the\n * reconstructed value. This function computes exactly that:\n * ```\n * sum = (limbs[0] + limbs[1] + limbs[2]) mod p\n * result = sum^(-1) mod p\n * ```\n *\n * ## Why Limbwise Sum Instead of Reconstructed Value?\n *\n * The sum `limbs[0] + limbs[1] + limbs[2]` is a cheaper operation in\n * the circuit compared to the full positional reconstruction\n * `limbs[0] + limbs[1]*2^85 + limbs[2]*2^170`. The sum-based non-zero check\n * works because if all three limbs are zero, their sum is also zero; otherwise\n * the sum is guaranteed to be non-zero (given the limb range constraints enforced\n * by the circuit).\n *\n * @param limbs - A tuple of three `Base85Limb` values: `[low, middle, high]`.\n * Each limb must be in the range `[0, 2^85 - 1]`.\n * @returns The multiplicative inverse of `(limbs[0] + limbs[1] + limbs[2]) mod p`\n * as a `Bn254FieldElement` in the range `[1, BN254_FIELD_PRIME - 1]`.\n *\n * @throws {CryptographyError} If the sum of all three limbs is congruent to zero\n * modulo the BN254 field prime, meaning no inverse exists.\n *\n * @example\n * ```typescript\n * import {\n * computeBn254LimbwiseSumInverse,\n * BN254_FIELD_PRIME,\n * } from \"@umbra/sdk\";\n * import { assertBase85Limb } from \"@umbra/sdk\";\n *\n * const low = 0x1234n;\n * const mid = 0x5678n;\n * const high = 0x9ABCn;\n * assertBase85Limb(low, \"low\");\n * assertBase85Limb(mid, \"mid\");\n * assertBase85Limb(high, \"high\");\n *\n * const inverse = computeBn254LimbwiseSumInverse([low, mid, high]);\n *\n * // Verify: (low + mid + high) * inverse ≡ 1 (mod p)\n * const sum = (low + mid + high) % BN254_FIELD_PRIME;\n * const check = (sum * inverse) % BN254_FIELD_PRIME;\n * console.log(check === 1n); // true\n * ```\n *\n * @see {@link computeBn254ModularInverse} For inverting a single field element\n * @see {@link Base85Limb} The branded limb type from `crypto/poseidon/types`\n *\n * @public\n */\nexport function computeBn254LimbwiseSumInverse(\n limbs: [Base85Limb, Base85Limb, Base85Limb],\n): Bn254FieldElement {\n // Sum the limbs\n const sum = (BigInt(limbs[0]) + BigInt(limbs[1]) + BigInt(limbs[2])) % BN254_FIELD_PRIME;\n\n if (sum === 0n) {\n throw new CryptographyError(\"Cannot compute inverse: sum of limbs is zero\");\n }\n\n // Compute the inverse\n const inverse = modulePow(sum, BN254_FIELD_PRIME - 2n, BN254_FIELD_PRIME);\n\n assertBn254FieldElement(inverse, \"inverse\");\n return inverse;\n}\n\n/**\n * Computes modular exponentiation in the BN254 scalar field: `base^exp mod p`.\n *\n * @remarks\n * This is a type-safe wrapper around the internal `modulePow` helper that\n * constrains both the input and output to the BN254 scalar field. It delegates\n * to the square-and-multiply algorithm with O(log exp) multiplications.\n *\n * ## Typical Use Cases\n *\n * - Computing powers of a Fiat-Shamir challenge scalar\n * - Evaluating polynomial commitments at a challenge point\n * - Batch inversion via exponentiation (less efficient than Extended GCD but simpler)\n *\n * ## Exponent Sign\n *\n * The exponent must be a non-negative `bigint`. Negative exponents are not supported;\n * use `computeBn254ModularInverse` for `base^(-1)` and compose with `bn254ModuloPow`\n * for general negative powers.\n *\n * @param base - The base field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param exp - The non-negative integer exponent (a plain `bigint`, not necessarily in the field).\n * @returns `base^exp mod BN254_FIELD_PRIME` as a `Bn254FieldElement`.\n *\n * @example\n * ```typescript\n * import { bn254ModuloPow, assertBn254FieldElement } from \"@umbra/sdk\";\n *\n * const challenge = 999n;\n * assertBn254FieldElement(challenge, \"challenge\");\n *\n * // Compute challenge^3 mod p (evaluating a cubic polynomial coefficient)\n * const cubed = bn254ModuloPow(challenge, 3n);\n *\n * // Compute challenge^0 = 1 (identity)\n * const identity = bn254ModuloPow(challenge, 0n);\n * console.log(identity === 1n); // true\n * ```\n *\n * @see {@link computeBn254ModularInverse} For the special case exp = -1\n * @see {@link bn254Mul} For a single multiplication\n *\n * @public\n */\nexport function bn254ModuloPow(base: Bn254FieldElement, exp: bigint): Bn254FieldElement {\n const result = modulePow(BigInt(base), exp, BN254_FIELD_PRIME);\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n\n/**\n * Computes the sum of two BN254 scalar field elements modulo the field prime.\n *\n * @remarks\n * ## Formula\n *\n * ```\n * result = (a + b) mod BN254_FIELD_PRIME\n * ```\n *\n * Because both `a` and `b` are in `[0, p-1]`, their sum is in `[0, 2p-2]`,\n * which requires at most one modular reduction step. This is implemented directly\n * via JavaScript's `%` operator on `bigint`.\n *\n * ## Overflow Behavior\n *\n * JavaScript `bigint` arithmetic is arbitrary precision, so there is no risk of\n * overflow. The modular reduction always yields a result in `[0, p-1]`.\n *\n * @param a - First summand, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param b - Second summand, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @returns `(a + b) mod BN254_FIELD_PRIME` as a `Bn254FieldElement`.\n *\n * @example\n * ```typescript\n * import { bn254Add, assertBn254FieldElement, BN254_FIELD_PRIME } from \"@umbra/sdk\";\n *\n * const a = 10n;\n * const b = 20n;\n * assertBn254FieldElement(a, \"a\");\n * assertBn254FieldElement(b, \"b\");\n *\n * const sum = bn254Add(a, b);\n * console.log(sum === 30n); // true\n *\n * // Demonstrates wraparound at the field boundary\n * const nearPrime = BN254_FIELD_PRIME - 1n;\n * assertBn254FieldElement(nearPrime, \"nearPrime\");\n * const wrapped = bn254Add(nearPrime, b);\n * // (p - 1 + 20) mod p = 19\n * console.log(wrapped === 19n); // true\n * ```\n *\n * @see {@link bn254Sub} For modular subtraction\n * @see {@link bn254Mul} For modular multiplication\n *\n * @public\n */\nexport function bn254Add(a: Bn254FieldElement, b: Bn254FieldElement): Bn254FieldElement {\n const result = (BigInt(a) + BigInt(b)) % BN254_FIELD_PRIME;\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n\n/**\n * Computes the difference of two BN254 scalar field elements modulo the field prime.\n *\n * @remarks\n * ## Formula\n *\n * ```\n * result = (a - b) mod BN254_FIELD_PRIME\n * ```\n *\n * Because `a - b` can be negative when `b > a`, the result is obtained by\n * adding the prime before taking the modulo to ensure canonicalization into\n * `[0, p-1]`:\n * ```\n * diff = a - b\n * result = ((diff % p) + p) % p\n * ```\n *\n * This pattern handles both the case where `a >= b` (no wrap-around needed)\n * and the case where `a < b` (wrap-around by adding `p`).\n *\n * @param a - Minuend, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param b - Subtrahend, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @returns `(a - b) mod BN254_FIELD_PRIME` as a `Bn254FieldElement` in `[0, p-1]`.\n *\n * @example\n * ```typescript\n * import { bn254Sub, assertBn254FieldElement, BN254_FIELD_PRIME } from \"@umbra/sdk\";\n *\n * const a = 30n;\n * const b = 10n;\n * assertBn254FieldElement(a, \"a\");\n * assertBn254FieldElement(b, \"b\");\n *\n * const diff = bn254Sub(a, b);\n * console.log(diff === 20n); // true\n *\n * // Underflow wraps around the field prime\n * const small = 5n;\n * assertBn254FieldElement(small, \"small\");\n * const wrapped = bn254Sub(small, b);\n * // (5 - 10 + p) mod p = p - 5\n * console.log(wrapped === BN254_FIELD_PRIME - 5n); // true\n * ```\n *\n * @see {@link bn254Add} For modular addition\n * @see {@link bn254Mul} For modular multiplication\n *\n * @public\n */\nexport function bn254Sub(a: Bn254FieldElement, b: Bn254FieldElement): Bn254FieldElement {\n const diff = BigInt(a) - BigInt(b);\n const result = ((diff % BN254_FIELD_PRIME) + BN254_FIELD_PRIME) % BN254_FIELD_PRIME;\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n\n/**\n * Computes the product of two BN254 scalar field elements modulo the field prime.\n *\n * @remarks\n * ## Formula\n *\n * ```\n * result = (a * b) mod BN254_FIELD_PRIME\n * ```\n *\n * Because both `a` and `b` are approximately 254-bit values, their product is\n * approximately 508 bits before reduction. JavaScript's `bigint` type handles\n * arbitrary precision arithmetic natively, so no overflow occurs. The result\n * is reduced to `[0, p-1]` via a single `%` operation.\n *\n * ## Performance Note\n *\n * This function uses JavaScript's built-in `bigint` multiplication, which is not\n * constant-time. For cryptographic contexts where timing side-channels are a\n * concern (e.g., secret-key operations), use `bn254ModuloMul` from\n * `field-arithmetic.ts` which uses constant-time Montgomery multiplication.\n *\n * @param a - First factor, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @param b - Second factor, a valid BN254 field element in `[0, BN254_FIELD_PRIME - 1]`.\n * @returns `(a * b) mod BN254_FIELD_PRIME` as a `Bn254FieldElement`.\n *\n * @example\n * ```typescript\n * import { bn254Mul, assertBn254FieldElement, BN254_FIELD_PRIME } from \"@umbra/sdk\";\n *\n * const a = 7n;\n * const b = 8n;\n * assertBn254FieldElement(a, \"a\");\n * assertBn254FieldElement(b, \"b\");\n *\n * const product = bn254Mul(a, b);\n * console.log(product === 56n); // true\n *\n * // Product of two large field elements wraps around\n * const large = BN254_FIELD_PRIME - 1n;\n * assertBn254FieldElement(large, \"large\");\n * const result = bn254Mul(large, 2n as unknown as typeof large);\n * // (p - 1) * 2 mod p = p - 2\n * console.log(result === BN254_FIELD_PRIME - 2n); // true\n * ```\n *\n * @see {@link bn254Add} For modular addition\n * @see {@link bn254Sub} For modular subtraction\n * @see {@link computeBn254ModularInverse} For multiplicative inverse (division)\n *\n * @public\n */\nexport function bn254Mul(a: Bn254FieldElement, b: Bn254FieldElement): Bn254FieldElement {\n const result = (BigInt(a) * BigInt(b)) % BN254_FIELD_PRIME;\n assertBn254FieldElement(result, \"result\");\n return result;\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import { Address, Commitment, MaybeEncodedAccount, Blockhash, createSolanaRpc, createSolanaRpcSubscriptions, sendAndConfirmTransactionFactory, Transaction, TransactionWithBlockhashLifetime, SignatureBytes } from '@solana/kit';
2
- import { j as U32, e as U256LeBytes, k as U64, U as U128, l as U128LeBytes, h as U512 } from './types-CM3nVKl2.cjs';
3
- import { A as AesKey, a as AesCiphertextWithMetadata, b as AesPlaintext, X as X25519PublicKey, c as X25519PrivateKey, M as MasterSeed, d as MasterViewingKey, P as PoseidonKey, Y as YearlyViewingKey, e as MonthlyViewingKey, D as DailyViewingKey, f as MintViewingKey, B as Bn254FieldElement, C as Curve25519FieldElement } from './cryptography-BJ5sCytb.cjs';
4
- import { S as SignedTransaction, T as TransactionSignature, M as MasterSeedLoaderFunction, a as MasterSeedStorerFunction, b as MasterSeedGeneratorFunction, L as LoaderFunction, c as StorerFunction, G as GeneratorFunction, P as ParameterizedLoaderFunction, d as ParameterizedStorerFunction, e as ParameterizedGeneratorFunction } from './types-i26vVlXf.cjs';
5
- import { Y as Year, M as Month, D as Day, H as Hour, a as Minute, S as Second } from './types-BYBfXNV_.cjs';
2
+ import { j as U32, e as U256LeBytes, k as U64, U as U128, l as U128LeBytes, h as U512 } from './types-C_V_CaKK.cjs';
3
+ import { A as AesKey, a as AesCiphertextWithMetadata, b as AesPlaintext, X as X25519PublicKey, c as X25519PrivateKey, M as MasterSeed, d as MasterViewingKey, P as PoseidonKey, Y as YearlyViewingKey, e as MonthlyViewingKey, D as DailyViewingKey, f as MintViewingKey, B as Bn254FieldElement, C as Curve25519FieldElement } from './cryptography-D6tPDh-Y.cjs';
4
+ import { S as SignedTransaction, T as TransactionSignature, M as MasterSeedLoaderFunction, a as MasterSeedStorerFunction, b as MasterSeedGeneratorFunction, L as LoaderFunction, c as StorerFunction, G as GeneratorFunction, P as ParameterizedLoaderFunction, d as ParameterizedStorerFunction, e as ParameterizedGeneratorFunction } from './types-EKuIfxTz.cjs';
5
+ import { Y as Year, M as Month, D as Day, H as Hour, a as Minute, S as Second } from './types-IMGYmlv-.cjs';
6
6
  import { N as Network, f as ProtocolVersionSpecifierFunction, a as AlgorithmVersionSpecifierFunction, g as SchemeVersionSpecifierFunction, e as NetworkSpecifierFunction } from './versions-BRlR36EA.cjs';
7
- import { N as NetworkConfig } from './networks-Bkl2oP0q.cjs';
7
+ import { N as NetworkConfig } from './networks-yAoO8peQ.cjs';
8
8
 
9
9
  /**
10
10
  * AES Encryption Interfaces
@@ -1,10 +1,10 @@
1
1
  import { Address, Commitment, MaybeEncodedAccount, Blockhash, createSolanaRpc, createSolanaRpcSubscriptions, sendAndConfirmTransactionFactory, Transaction, TransactionWithBlockhashLifetime, SignatureBytes } from '@solana/kit';
2
- import { j as U32, e as U256LeBytes, k as U64, U as U128, l as U128LeBytes, h as U512 } from './types-CM3nVKl2.js';
3
- import { A as AesKey, a as AesCiphertextWithMetadata, b as AesPlaintext, X as X25519PublicKey, c as X25519PrivateKey, M as MasterSeed, d as MasterViewingKey, P as PoseidonKey, Y as YearlyViewingKey, e as MonthlyViewingKey, D as DailyViewingKey, f as MintViewingKey, B as Bn254FieldElement, C as Curve25519FieldElement } from './cryptography-Dk1cBuym.js';
4
- import { S as SignedTransaction, T as TransactionSignature, M as MasterSeedLoaderFunction, a as MasterSeedStorerFunction, b as MasterSeedGeneratorFunction, L as LoaderFunction, c as StorerFunction, G as GeneratorFunction, P as ParameterizedLoaderFunction, d as ParameterizedStorerFunction, e as ParameterizedGeneratorFunction } from './types-gNnLmOsz.js';
5
- import { Y as Year, M as Month, D as Day, H as Hour, a as Minute, S as Second } from './types-DfmTaW3z.js';
2
+ import { j as U32, e as U256LeBytes, k as U64, U as U128, l as U128LeBytes, h as U512 } from './types-C_V_CaKK.js';
3
+ import { A as AesKey, a as AesCiphertextWithMetadata, b as AesPlaintext, X as X25519PublicKey, c as X25519PrivateKey, M as MasterSeed, d as MasterViewingKey, P as PoseidonKey, Y as YearlyViewingKey, e as MonthlyViewingKey, D as DailyViewingKey, f as MintViewingKey, B as Bn254FieldElement, C as Curve25519FieldElement } from './cryptography-BFSJcvi6.js';
4
+ import { S as SignedTransaction, T as TransactionSignature, M as MasterSeedLoaderFunction, a as MasterSeedStorerFunction, b as MasterSeedGeneratorFunction, L as LoaderFunction, c as StorerFunction, G as GeneratorFunction, P as ParameterizedLoaderFunction, d as ParameterizedStorerFunction, e as ParameterizedGeneratorFunction } from './types-CxfTIpN9.js';
5
+ import { Y as Year, M as Month, D as Day, H as Hour, a as Minute, S as Second } from './types-D1jDUjfN.js';
6
6
  import { N as Network, f as ProtocolVersionSpecifierFunction, a as AlgorithmVersionSpecifierFunction, g as SchemeVersionSpecifierFunction, e as NetworkSpecifierFunction } from './versions-BRlR36EA.js';
7
- import { N as NetworkConfig } from './networks-B3pArLLR.js';
7
+ import { N as NetworkConfig } from './networks-RMd3abPE.js';
8
8
 
9
9
  /**
10
10
  * AES Encryption Interfaces
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkDQ25W34A_cjs = require('../../chunk-DQ25W34A.cjs');
4
- require('../../chunk-5GUSMQ74.cjs');
3
+ var chunkUEI7SYH6_cjs = require('../../chunk-UEI7SYH6.cjs');
5
4
  require('../../chunk-TQQZGNOI.cjs');
5
+ require('../../chunk-5GUSMQ74.cjs');
6
6
  require('../../chunk-FZYWLQAF.cjs');
7
7
  require('../../chunk-LTCKPTZC.cjs');
8
8
  require('../../chunk-PK6SKIKE.cjs');
@@ -11,135 +11,135 @@ require('../../chunk-PK6SKIKE.cjs');
11
11
 
12
12
  Object.defineProperty(exports, "TOKEN_POOL_SEED", {
13
13
  enumerable: true,
14
- get: function () { return chunkDQ25W34A_cjs.TOKEN_POOL_SEED; }
14
+ get: function () { return chunkUEI7SYH6_cjs.TOKEN_POOL_SEED; }
15
15
  });
16
16
  Object.defineProperty(exports, "computeCompDefOffset", {
17
17
  enumerable: true,
18
- get: function () { return chunkDQ25W34A_cjs.computeCompDefOffset; }
18
+ get: function () { return chunkUEI7SYH6_cjs.computeCompDefOffset; }
19
19
  });
20
20
  Object.defineProperty(exports, "computeStructSeed", {
21
21
  enumerable: true,
22
- get: function () { return chunkDQ25W34A_cjs.computeStructSeed; }
22
+ get: function () { return chunkUEI7SYH6_cjs.computeStructSeed; }
23
23
  });
24
24
  Object.defineProperty(exports, "findActiveStealthPoolPda", {
25
25
  enumerable: true,
26
- get: function () { return chunkDQ25W34A_cjs.findActiveStealthPoolPda; }
26
+ get: function () { return chunkUEI7SYH6_cjs.findActiveStealthPoolPda; }
27
27
  });
28
28
  Object.defineProperty(exports, "findArciumClusterPda", {
29
29
  enumerable: true,
30
- get: function () { return chunkDQ25W34A_cjs.findArciumClusterPda; }
30
+ get: function () { return chunkUEI7SYH6_cjs.findArciumClusterPda; }
31
31
  });
32
32
  Object.defineProperty(exports, "findArciumCompDefPda", {
33
33
  enumerable: true,
34
- get: function () { return chunkDQ25W34A_cjs.findArciumCompDefPda; }
34
+ get: function () { return chunkUEI7SYH6_cjs.findArciumCompDefPda; }
35
35
  });
36
36
  Object.defineProperty(exports, "findArciumComputationPda", {
37
37
  enumerable: true,
38
- get: function () { return chunkDQ25W34A_cjs.findArciumComputationPda; }
38
+ get: function () { return chunkUEI7SYH6_cjs.findArciumComputationPda; }
39
39
  });
40
40
  Object.defineProperty(exports, "findArciumExecutingPoolPda", {
41
41
  enumerable: true,
42
- get: function () { return chunkDQ25W34A_cjs.findArciumExecutingPoolPda; }
42
+ get: function () { return chunkUEI7SYH6_cjs.findArciumExecutingPoolPda; }
43
43
  });
44
44
  Object.defineProperty(exports, "findArciumInfrastructurePdas", {
45
45
  enumerable: true,
46
- get: function () { return chunkDQ25W34A_cjs.findArciumInfrastructurePdas; }
46
+ get: function () { return chunkUEI7SYH6_cjs.findArciumInfrastructurePdas; }
47
47
  });
48
48
  Object.defineProperty(exports, "findArciumMempoolPda", {
49
49
  enumerable: true,
50
- get: function () { return chunkDQ25W34A_cjs.findArciumMempoolPda; }
50
+ get: function () { return chunkUEI7SYH6_cjs.findArciumMempoolPda; }
51
51
  });
52
52
  Object.defineProperty(exports, "findArciumMxePda", {
53
53
  enumerable: true,
54
- get: function () { return chunkDQ25W34A_cjs.findArciumMxePda; }
54
+ get: function () { return chunkUEI7SYH6_cjs.findArciumMxePda; }
55
55
  });
56
56
  Object.defineProperty(exports, "findClaimInputBufferPda", {
57
57
  enumerable: true,
58
- get: function () { return chunkDQ25W34A_cjs.findClaimInputBufferPda; }
58
+ get: function () { return chunkUEI7SYH6_cjs.findClaimInputBufferPda; }
59
59
  });
60
60
  Object.defineProperty(exports, "findConfidentialNullifierBufferPda", {
61
61
  enumerable: true,
62
- get: function () { return chunkDQ25W34A_cjs.findConfidentialNullifierBufferPda; }
62
+ get: function () { return chunkUEI7SYH6_cjs.findConfidentialNullifierBufferPda; }
63
63
  });
64
64
  Object.defineProperty(exports, "findEncryptedTokenAccountPda", {
65
65
  enumerable: true,
66
- get: function () { return chunkDQ25W34A_cjs.findEncryptedTokenAccountPda; }
66
+ get: function () { return chunkUEI7SYH6_cjs.findEncryptedTokenAccountPda; }
67
67
  });
68
68
  Object.defineProperty(exports, "findEncryptedUserAccountPda", {
69
69
  enumerable: true,
70
- get: function () { return chunkDQ25W34A_cjs.findEncryptedUserAccountPda; }
70
+ get: function () { return chunkUEI7SYH6_cjs.findEncryptedUserAccountPda; }
71
71
  });
72
72
  Object.defineProperty(exports, "findFeeSchedulePda", {
73
73
  enumerable: true,
74
- get: function () { return chunkDQ25W34A_cjs.findFeeSchedulePda; }
74
+ get: function () { return chunkUEI7SYH6_cjs.findFeeSchedulePda; }
75
75
  });
76
76
  Object.defineProperty(exports, "findNetworkComplianceGrantPda", {
77
77
  enumerable: true,
78
- get: function () { return chunkDQ25W34A_cjs.findNetworkComplianceGrantPda; }
78
+ get: function () { return chunkUEI7SYH6_cjs.findNetworkComplianceGrantPda; }
79
79
  });
80
80
  Object.defineProperty(exports, "findNullifierSetPdas", {
81
81
  enumerable: true,
82
- get: function () { return chunkDQ25W34A_cjs.findNullifierSetPdas; }
82
+ get: function () { return chunkUEI7SYH6_cjs.findNullifierSetPdas; }
83
83
  });
84
84
  Object.defineProperty(exports, "findProtocolConfigPda", {
85
85
  enumerable: true,
86
- get: function () { return chunkDQ25W34A_cjs.findProtocolConfigPda; }
86
+ get: function () { return chunkUEI7SYH6_cjs.findProtocolConfigPda; }
87
87
  });
88
88
  Object.defineProperty(exports, "findProtocolFeeVaultPda", {
89
89
  enumerable: true,
90
- get: function () { return chunkDQ25W34A_cjs.findProtocolFeeVaultPda; }
90
+ get: function () { return chunkUEI7SYH6_cjs.findProtocolFeeVaultPda; }
91
91
  });
92
92
  Object.defineProperty(exports, "findPublicClaimComputationDataPda", {
93
93
  enumerable: true,
94
- get: function () { return chunkDQ25W34A_cjs.findPublicClaimComputationDataPda; }
94
+ get: function () { return chunkUEI7SYH6_cjs.findPublicClaimComputationDataPda; }
95
95
  });
96
96
  Object.defineProperty(exports, "findPublicClaimInputBufferPda", {
97
97
  enumerable: true,
98
- get: function () { return chunkDQ25W34A_cjs.findPublicClaimInputBufferPda; }
98
+ get: function () { return chunkUEI7SYH6_cjs.findPublicClaimInputBufferPda; }
99
99
  });
100
100
  Object.defineProperty(exports, "findPublicNullifierBufferPda", {
101
101
  enumerable: true,
102
- get: function () { return chunkDQ25W34A_cjs.findPublicNullifierBufferPda; }
102
+ get: function () { return chunkUEI7SYH6_cjs.findPublicNullifierBufferPda; }
103
103
  });
104
104
  Object.defineProperty(exports, "findPublicUtxoInputBufferPda", {
105
105
  enumerable: true,
106
- get: function () { return chunkDQ25W34A_cjs.findPublicUtxoInputBufferPda; }
106
+ get: function () { return chunkUEI7SYH6_cjs.findPublicUtxoInputBufferPda; }
107
107
  });
108
108
  Object.defineProperty(exports, "findRelayerFeeSchedulePda", {
109
109
  enumerable: true,
110
- get: function () { return chunkDQ25W34A_cjs.findRelayerFeeSchedulePda; }
110
+ get: function () { return chunkUEI7SYH6_cjs.findRelayerFeeSchedulePda; }
111
111
  });
112
112
  Object.defineProperty(exports, "findRelayerFeeVaultPda", {
113
113
  enumerable: true,
114
- get: function () { return chunkDQ25W34A_cjs.findRelayerFeeVaultPda; }
114
+ get: function () { return chunkUEI7SYH6_cjs.findRelayerFeeVaultPda; }
115
115
  });
116
116
  Object.defineProperty(exports, "findRelayerPda", {
117
117
  enumerable: true,
118
- get: function () { return chunkDQ25W34A_cjs.findRelayerPda; }
118
+ get: function () { return chunkUEI7SYH6_cjs.findRelayerPda; }
119
119
  });
120
120
  Object.defineProperty(exports, "findSharedComplianceGrantPda", {
121
121
  enumerable: true,
122
- get: function () { return chunkDQ25W34A_cjs.findSharedComplianceGrantPda; }
122
+ get: function () { return chunkUEI7SYH6_cjs.findSharedComplianceGrantPda; }
123
123
  });
124
124
  Object.defineProperty(exports, "findStealthPoolPda", {
125
125
  enumerable: true,
126
- get: function () { return chunkDQ25W34A_cjs.findStealthPoolPda; }
126
+ get: function () { return chunkUEI7SYH6_cjs.findStealthPoolPda; }
127
127
  });
128
128
  Object.defineProperty(exports, "findTokenPoolPda", {
129
129
  enumerable: true,
130
- get: function () { return chunkDQ25W34A_cjs.findTokenPoolPda; }
130
+ get: function () { return chunkUEI7SYH6_cjs.findTokenPoolPda; }
131
131
  });
132
132
  Object.defineProperty(exports, "findUserComplianceGrantPda", {
133
133
  enumerable: true,
134
- get: function () { return chunkDQ25W34A_cjs.findUserComplianceGrantPda; }
134
+ get: function () { return chunkUEI7SYH6_cjs.findUserComplianceGrantPda; }
135
135
  });
136
136
  Object.defineProperty(exports, "findUtxoInputBufferPda", {
137
137
  enumerable: true,
138
- get: function () { return chunkDQ25W34A_cjs.findUtxoInputBufferPda; }
138
+ get: function () { return chunkUEI7SYH6_cjs.findUtxoInputBufferPda; }
139
139
  });
140
140
  Object.defineProperty(exports, "findVerifyingKeyPda", {
141
141
  enumerable: true,
142
- get: function () { return chunkDQ25W34A_cjs.findVerifyingKeyPda; }
142
+ get: function () { return chunkUEI7SYH6_cjs.findVerifyingKeyPda; }
143
143
  });
144
144
  //# sourceMappingURL=index.cjs.map
145
145
  //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
1
  import { Address } from '@solana/kit';
2
- import { R as RcEncryptionNonce } from '../../cryptography-BJ5sCytb.cjs';
3
- import { U as U128 } from '../../types-CM3nVKl2.cjs';
2
+ import { R as RcEncryptionNonce } from '../../cryptography-D6tPDh-Y.cjs';
3
+ import { U as U128 } from '../../types-C_V_CaKK.cjs';
4
4
 
5
5
  /**
6
6
  * User PDA Utilities
@@ -1,6 +1,6 @@
1
1
  import { Address } from '@solana/kit';
2
- import { R as RcEncryptionNonce } from '../../cryptography-Dk1cBuym.js';
3
- import { U as U128 } from '../../types-CM3nVKl2.js';
2
+ import { R as RcEncryptionNonce } from '../../cryptography-BFSJcvi6.js';
3
+ import { U as U128 } from '../../types-C_V_CaKK.js';
4
4
 
5
5
  /**
6
6
  * User PDA Utilities
@@ -1,6 +1,6 @@
1
- export { TOKEN_POOL_SEED, computeCompDefOffset, computeStructSeed, findActiveStealthPoolPda, findArciumClusterPda, findArciumCompDefPda, findArciumComputationPda, findArciumExecutingPoolPda, findArciumInfrastructurePdas, findArciumMempoolPda, findArciumMxePda, findClaimInputBufferPda, findConfidentialNullifierBufferPda, findEncryptedTokenAccountPda, findEncryptedUserAccountPda, findFeeSchedulePda, findNetworkComplianceGrantPda, findNullifierSetPdas, findProtocolConfigPda, findProtocolFeeVaultPda, findPublicClaimComputationDataPda, findPublicClaimInputBufferPda, findPublicNullifierBufferPda, findPublicUtxoInputBufferPda, findRelayerFeeSchedulePda, findRelayerFeeVaultPda, findRelayerPda, findSharedComplianceGrantPda, findStealthPoolPda, findTokenPoolPda, findUserComplianceGrantPda, findUtxoInputBufferPda, findVerifyingKeyPda } from '../../chunk-D5MWU3TV.js';
2
- import '../../chunk-FQX6ZYGJ.js';
1
+ export { TOKEN_POOL_SEED, computeCompDefOffset, computeStructSeed, findActiveStealthPoolPda, findArciumClusterPda, findArciumCompDefPda, findArciumComputationPda, findArciumExecutingPoolPda, findArciumInfrastructurePdas, findArciumMempoolPda, findArciumMxePda, findClaimInputBufferPda, findConfidentialNullifierBufferPda, findEncryptedTokenAccountPda, findEncryptedUserAccountPda, findFeeSchedulePda, findNetworkComplianceGrantPda, findNullifierSetPdas, findProtocolConfigPda, findProtocolFeeVaultPda, findPublicClaimComputationDataPda, findPublicClaimInputBufferPda, findPublicNullifierBufferPda, findPublicUtxoInputBufferPda, findRelayerFeeSchedulePda, findRelayerFeeVaultPda, findRelayerPda, findSharedComplianceGrantPda, findStealthPoolPda, findTokenPoolPda, findUserComplianceGrantPda, findUtxoInputBufferPda, findVerifyingKeyPda } from '../../chunk-KH3YTDKA.js';
3
2
  import '../../chunk-EEKF4553.js';
3
+ import '../../chunk-FQX6ZYGJ.js';
4
4
  import '../../chunk-DD2WCK4C.js';
5
5
  import '../../chunk-CFTW5WNG.js';
6
6
  import '../../chunk-7QVYU63E.js';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkZQOIYCGA_cjs = require('../chunk-ZQOIYCGA.cjs');
4
+ var chunkTQQZGNOI_cjs = require('../chunk-TQQZGNOI.cjs');
4
5
  require('../chunk-BL6WXLPV.cjs');
5
6
  require('../chunk-FSK2ICMB.cjs');
6
- var chunkTQQZGNOI_cjs = require('../chunk-TQQZGNOI.cjs');
7
7
  require('../chunk-QJAUUYZU.cjs');
8
8
  var chunkPK6SKIKE_cjs = require('../chunk-PK6SKIKE.cjs');
9
9
 
@@ -1,8 +1,8 @@
1
- export { A as AltEntry, N as NetworkConfig, g as getNetworkConfig } from '../networks-Bkl2oP0q.cjs';
1
+ export { A as AltEntry, N as NetworkConfig, g as getNetworkConfig } from '../networks-yAoO8peQ.cjs';
2
2
  export { A as AlgorithmVersion, a as AlgorithmVersionSpecifierFunction, D as DEFAULT_ALGORITHM_VERSION, b as DEFAULT_NETWORK, c as DEFAULT_PROTOCOL_VERSION, d as DEFAULT_SCHEME_VERSION, N as Network, e as NetworkSpecifierFunction, P as ProtocolVersion, f as ProtocolVersionSpecifierFunction, S as SchemeVersion, g as SchemeVersionSpecifierFunction, h as assertNetwork, i as assertValidAlgorithmVersion, j as assertValidProtocolVersion, k as assertValidSchemeVersion, l as assertValidVersion, m as getDefaultAlgorithmVersion, n as getDefaultProtocolVersion, o as getDefaultSchemeVersion, p as getNetworkSpecifier } from '../versions-BRlR36EA.cjs';
3
3
  import { Address } from '@solana/kit';
4
- import '../cryptography-BJ5sCytb.cjs';
5
- import '../types-CM3nVKl2.cjs';
4
+ import '../cryptography-D6tPDh-Y.cjs';
5
+ import '../types-C_V_CaKK.cjs';
6
6
 
7
7
  /**
8
8
  * Arcium Protocol Constants
@@ -1,8 +1,8 @@
1
- export { A as AltEntry, N as NetworkConfig, g as getNetworkConfig } from '../networks-B3pArLLR.js';
1
+ export { A as AltEntry, N as NetworkConfig, g as getNetworkConfig } from '../networks-RMd3abPE.js';
2
2
  export { A as AlgorithmVersion, a as AlgorithmVersionSpecifierFunction, D as DEFAULT_ALGORITHM_VERSION, b as DEFAULT_NETWORK, c as DEFAULT_PROTOCOL_VERSION, d as DEFAULT_SCHEME_VERSION, N as Network, e as NetworkSpecifierFunction, P as ProtocolVersion, f as ProtocolVersionSpecifierFunction, S as SchemeVersion, g as SchemeVersionSpecifierFunction, h as assertNetwork, i as assertValidAlgorithmVersion, j as assertValidProtocolVersion, k as assertValidSchemeVersion, l as assertValidVersion, m as getDefaultAlgorithmVersion, n as getDefaultProtocolVersion, o as getDefaultSchemeVersion, p as getNetworkSpecifier } from '../versions-BRlR36EA.js';
3
3
  import { Address } from '@solana/kit';
4
- import '../cryptography-Dk1cBuym.js';
5
- import '../types-CM3nVKl2.js';
4
+ import '../cryptography-BFSJcvi6.js';
5
+ import '../types-C_V_CaKK.js';
6
6
 
7
7
  /**
8
8
  * Arcium Protocol Constants
@@ -1,7 +1,7 @@
1
1
  export { ASSOCIATED_TOKEN_PROGRAM_ID, DEFAULT_ALGORITHM_VERSION, DEFAULT_NETWORK, DEFAULT_PROTOCOL_VERSION, DEFAULT_SCHEME_VERSION, SPL_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, assertNetwork, assertValidAlgorithmVersion, assertValidProtocolVersion, assertValidSchemeVersion, assertValidVersion, getDefaultAlgorithmVersion, getDefaultProtocolVersion, getDefaultSchemeVersion, getNetworkConfig, getNetworkSpecifier } from '../chunk-INJ73LXQ.js';
2
+ export { ARCIUM_CLUSTER_SEED, ARCIUM_COMPUTATION_SEED, ARCIUM_COMP_DEF_SEED, ARCIUM_EXEC_POOL_SEED, ARCIUM_MEMPOOL_SEED, ARCIUM_MXE_ACCOUNT_SEED, ARCIUM_OFFSET_BUFFER_SIZE } from '../chunk-EEKF4553.js';
2
3
  import '../chunk-GP26R377.js';
3
4
  import '../chunk-5KPQXPQM.js';
4
- export { ARCIUM_CLUSTER_SEED, ARCIUM_COMPUTATION_SEED, ARCIUM_COMP_DEF_SEED, ARCIUM_EXEC_POOL_SEED, ARCIUM_MEMPOOL_SEED, ARCIUM_MXE_ACCOUNT_SEED, ARCIUM_OFFSET_BUFFER_SIZE } from '../chunk-EEKF4553.js';
5
5
  import '../chunk-4TZVXB5G.js';
6
6
  import { __name } from '../chunk-7QVYU63E.js';
7
7