@umbra-privacy/sdk 1.0.0

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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -0
  3. package/dist/addresses-Brzgurv_.d.ts +145 -0
  4. package/dist/addresses-D_0YAS6B.d.cts +145 -0
  5. package/dist/chunk-2Q75CQQJ.js +12 -0
  6. package/dist/chunk-2Q75CQQJ.js.map +1 -0
  7. package/dist/chunk-7QVYU63E.js +6 -0
  8. package/dist/chunk-7QVYU63E.js.map +1 -0
  9. package/dist/chunk-BM7N6N7E.js +1883 -0
  10. package/dist/chunk-BM7N6N7E.js.map +1 -0
  11. package/dist/chunk-GXKSUB2U.cjs +4416 -0
  12. package/dist/chunk-GXKSUB2U.cjs.map +1 -0
  13. package/dist/chunk-HOEXDXRC.cjs +792 -0
  14. package/dist/chunk-HOEXDXRC.cjs.map +1 -0
  15. package/dist/chunk-MDFSBU5W.cjs +2033 -0
  16. package/dist/chunk-MDFSBU5W.cjs.map +1 -0
  17. package/dist/chunk-MQY7HDIA.js +600 -0
  18. package/dist/chunk-MQY7HDIA.js.map +1 -0
  19. package/dist/chunk-MVKTV3FT.cjs +20 -0
  20. package/dist/chunk-MVKTV3FT.cjs.map +1 -0
  21. package/dist/chunk-PG2J6V6Y.js +4094 -0
  22. package/dist/chunk-PG2J6V6Y.js.map +1 -0
  23. package/dist/chunk-PK6SKIKE.cjs +8 -0
  24. package/dist/chunk-PK6SKIKE.cjs.map +1 -0
  25. package/dist/chunk-VEGLTTYQ.cjs +621 -0
  26. package/dist/chunk-VEGLTTYQ.cjs.map +1 -0
  27. package/dist/chunk-WVHQ46DD.js +758 -0
  28. package/dist/chunk-WVHQ46DD.js.map +1 -0
  29. package/dist/constants/index.cjs +316 -0
  30. package/dist/constants/index.cjs.map +1 -0
  31. package/dist/constants/index.d.cts +739 -0
  32. package/dist/constants/index.d.ts +739 -0
  33. package/dist/constants/index.js +193 -0
  34. package/dist/constants/index.js.map +1 -0
  35. package/dist/cryptography-BTGC72u-.d.cts +4809 -0
  36. package/dist/cryptography-BTGC72u-.d.ts +4809 -0
  37. package/dist/errors/index.cjs +141 -0
  38. package/dist/errors/index.cjs.map +1 -0
  39. package/dist/errors/index.d.cts +1415 -0
  40. package/dist/errors/index.d.ts +1415 -0
  41. package/dist/errors/index.js +4 -0
  42. package/dist/errors/index.js.map +1 -0
  43. package/dist/index-B9pDY73x.d.ts +12933 -0
  44. package/dist/index-CLj_zWSD.d.ts +235 -0
  45. package/dist/index-CX6_pIRS.d.cts +235 -0
  46. package/dist/index-D33yo0qB.d.cts +12933 -0
  47. package/dist/index.cjs +22464 -0
  48. package/dist/index.cjs.map +1 -0
  49. package/dist/index.d.cts +11694 -0
  50. package/dist/index.d.ts +11694 -0
  51. package/dist/index.js +22314 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/interfaces/index.cjs +4 -0
  54. package/dist/interfaces/index.cjs.map +1 -0
  55. package/dist/interfaces/index.d.cts +8 -0
  56. package/dist/interfaces/index.d.ts +8 -0
  57. package/dist/interfaces/index.js +3 -0
  58. package/dist/interfaces/index.js.map +1 -0
  59. package/dist/networks-C-orpSFW.d.ts +65 -0
  60. package/dist/networks-FxYERGD1.d.cts +65 -0
  61. package/dist/types/index.cjs +605 -0
  62. package/dist/types/index.cjs.map +1 -0
  63. package/dist/types/index.d.cts +1853 -0
  64. package/dist/types/index.d.ts +1853 -0
  65. package/dist/types/index.js +4 -0
  66. package/dist/types/index.js.map +1 -0
  67. package/dist/types-BBuELtY8.d.cts +495 -0
  68. package/dist/types-n-sHFcgr.d.ts +495 -0
  69. package/dist/utils/index.cjs +1295 -0
  70. package/dist/utils/index.cjs.map +1 -0
  71. package/dist/utils/index.d.cts +9559 -0
  72. package/dist/utils/index.d.ts +9559 -0
  73. package/dist/utils/index.js +6 -0
  74. package/dist/utils/index.js.map +1 -0
  75. package/dist/versions-D9PqsEvj.d.cts +173 -0
  76. package/dist/versions-D9PqsEvj.d.ts +173 -0
  77. package/package.json +151 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/errors.ts","../src/crypto/errors.ts","../src/solana/errors.ts","../src/umbra/errors.ts"],"names":[],"mappings":";;;AAoEO,IAAM,UAAA,GAAN,MAAM,WAAA,SAAmB,KAAA,CAAM;AAAA,EApEtC;AAoEsC,IAAA,MAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW3B,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcS,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBlB,WAAA,CACE,SACA,OAAA,EAKA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,SAAS,IAAA,IAAQ,aAAA;AAC7B,IAAA,IAAI,OAAA,EAAS,YAAY,MAAA,EAAW;AAClC,MAAA,IAAA,CAAK,UAAU,OAAA,CAAQ,OAAA;AAAA,IACzB;AACA,IAAA,IAAI,OAAA,EAAS,UAAU,MAAA,EAAW;AAChC,MAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,KAAA;AAAA,IACvB;AAGA,IAAA,KAAA,CAAM,iBAAA,CAAkB,MAAM,WAAU,CAAA;AAAA,EAC1C;AACF;AAgCO,SAAS,aAAa,KAAA,EAAqC;AAChE,EAAA,OAAO,KAAA,YAAiB,UAAA;AAC1B;AAFgB,MAAA,CAAA,YAAA,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AC,CAAA,CAAA;AAAA,MACvD;AAAA,KACD,CAAA;AACD,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF;AAGO,SAAS,aAAa,KAAA,EAAqC;AAChE,EAAA,OAAO,KAAA,YAAiB,UAAA;AAC1B;AAFgB,MAAA,CAAA,YAAA,EAAA,cAAA,CAAA","file":"chunk-WVHQ46DD.js","sourcesContent":["/**\n * Error Classes\n *\n * Centralized error hierarchy for the Umbra SDK.\n * Contains the base `UmbraError` and all domain-specific assertion error classes.\n *\n * @remarks\n * The SDK uses a two-level error hierarchy:\n *\n * 1. `UmbraError` — top-level base class for all SDK errors. Consumers can use\n * `instanceof UmbraError` (or the `isUmbraError` type guard) to distinguish SDK errors\n * from third-party or built-in errors in a catch block.\n *\n * 2. Domain assertion errors — thrown by type-assertion functions when a value fails\n * validation. Each domain has its own class to make it easy to catch errors from a\n * specific subsystem:\n * - `MathematicsAssertionError` — thrown by `assertU8`, `assertU256`, etc.\n * - `CryptographyAssertionError` — thrown by `assertBn254FieldElement`, `assertAesKey`, etc.\n * - `SolanaAssertionError` — thrown by Solana-type assertion functions.\n * - `TemporalAssertionError` — thrown by `assertYear`, `assertMonth`, etc.\n *\n * All four assertion error classes share the same three properties:\n * - `value` — the actual value that failed\n * - `expectedType` — the name of the expected branded type\n * - `constraint` — optional human-readable constraint description\n *\n * @packageDocumentation\n * @module common/errors\n */\n\n/* =============================================================================\n * BASE ERROR\n *\n * The root error class for all Umbra SDK errors.\n * ============================================================================= */\n\n/**\n * Base error class for all Umbra SDK errors.\n *\n * All errors thrown by the SDK extend this class, allowing consumers\n * to distinguish SDK errors from other errors using `instanceof`.\n *\n * @remarks\n * Prefer using the `isUmbraError` type guard over `instanceof UmbraError` when writing\n * defensive catch handlers — the type guard also works across module boundaries and\n * iframe/realm boundaries where `instanceof` may fail due to different class references.\n *\n * Sub-classes (domain assertion errors) extend this class so callers can catch either\n * all SDK errors at once (`instanceof UmbraError`) or only a specific domain's failures\n * (e.g., `instanceof MathematicsAssertionError`).\n *\n * @example\n * ```typescript\n * try {\n * await umbraClient.register();\n * } catch (error) {\n * if (error instanceof UmbraError) {\n * console.log('SDK error:', error.message);\n * console.log('Error code:', error.code);\n * } else {\n * throw error; // Re-throw non-SDK errors\n * }\n * }\n * ```\n *\n * @see {@link isUmbraError}\n * @public\n */\nexport class UmbraError extends Error {\n /**\n * A machine-readable error code for programmatic error handling.\n *\n * @remarks\n * Defaults to `\"UMBRA_ERROR\"` when no code is supplied in the constructor options.\n * Sub-classes or specific throw sites should supply a more specific code to allow\n * callers to branch on error identity without string-matching `message`.\n *\n * @readonly\n */\n readonly code: string;\n\n /**\n * Additional context about the error.\n *\n * @remarks\n * A free-form key-value map of diagnostic data attached to the error at the throw site.\n * Useful for logging and debugging — consumers should not rely on specific keys for\n * control flow; use `code` for programmatic branching instead.\n *\n * Will be `undefined` when no context was provided to the constructor.\n *\n * @readonly\n */\n readonly context?: Record<string, unknown>;\n\n /**\n * The original error that caused this error, if any.\n *\n * @remarks\n * When an SDK function wraps a lower-level error (e.g., a failed RPC call or a\n * cryptographic library error), it sets `cause` to the original thrown value so\n * callers can inspect the full error chain.\n *\n * Will be `undefined` when there is no underlying cause.\n *\n * @readonly\n */\n override readonly cause?: unknown;\n\n /**\n * Creates a new UmbraError.\n *\n * @param message - Human-readable description of what went wrong. Should be\n * actionable and specific enough for a developer to understand the failure\n * without reading source code.\n * @param options - Optional structured metadata attached to the error.\n * @param options.code - Machine-readable error code for programmatic branching.\n * Defaults to `\"UMBRA_ERROR\"` if omitted.\n * @param options.context - Free-form diagnostic key-value pairs. Omit or set to\n * `undefined` to leave the `context` property unset.\n * @param options.cause - The original error that triggered this one. Enables\n * full error-chain inspection. Omit or set to `undefined` when there is no\n * underlying cause.\n *\n * @defaultValue `options` — `undefined` (all options optional)\n * @defaultValue `options.code` — `\"UMBRA_ERROR\"`\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message);\n this.name = \"UmbraError\";\n this.code = options?.code ?? \"UMBRA_ERROR\";\n if (options?.context !== undefined) {\n this.context = options.context;\n }\n if (options?.cause !== undefined) {\n this.cause = options.cause;\n }\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n Error.captureStackTrace(this, UmbraError);\n }\n}\n\n/**\n * Type guard to check if an error is an UmbraError.\n *\n * @remarks\n * Prefer this guard over `error instanceof UmbraError` in generic catch handlers because\n * it is safe to call with any value (including `null`, primitives, and non-Error objects)\n * and narrows the type to `UmbraError` for TypeScript's type system in the true branch.\n *\n * @param error - The value to test. Typically the caught value in a `catch (error)` block,\n * typed as `unknown`.\n * @returns `true` and narrows `error` to `UmbraError` when the value is an instance of\n * `UmbraError` (or any sub-class such as `MathematicsAssertionError`). Returns `false`\n * for all other values.\n *\n * @example\n * ```typescript\n * try {\n * await operation();\n * } catch (error) {\n * if (isUmbraError(error)) {\n * // error is narrowed to UmbraError here\n * console.log('SDK error code:', error.code);\n * console.log('SDK error context:', error.context);\n * }\n * }\n * ```\n *\n * @see {@link UmbraError}\n * @public\n */\nexport function isUmbraError(error: unknown): error is UmbraError {\n return error instanceof UmbraError;\n}\n\n/* =============================================================================\n * MATHEMATICS ASSERTION ERROR\n *\n * Error thrown when mathematical type assertions fail.\n * ============================================================================= */\n\n/**\n * Error thrown when a value fails a mathematical type assertion.\n *\n * This error provides detailed information about why an assertion failed,\n * including the actual value, the expected type, and the constraint that\n * was violated.\n *\n * @remarks\n * All assertion functions in the mathematics module (e.g., `assertU8`, `assertU256`,\n * `assertU32LeBytes`) throw this error type on failure. Catch it specifically to handle\n * mathematical type validation failures differently from cryptographic or Solana errors.\n *\n * The three diagnostic properties together allow automated logging pipelines to produce\n * structured records without parsing the `message` string:\n * - `value` — the actual value that was supplied\n * - `expectedType` — the branded type name (e.g., `\"U8\"`, `\"U256LeBytes\"`)\n * - `constraint` — the violated range or length rule, or `undefined` for type mismatches\n *\n * Note that this class does NOT extend `UmbraError`. It extends `Error` directly to keep\n * the assertion error classes lightweight and independent of the UmbraError hierarchy.\n * Use `isUmbraError` only to detect top-level SDK operational errors; use\n * `instanceof MathematicsAssertionError` for assertion failures.\n *\n * @example\n * ```typescript\n * import { assertU8, MathematicsAssertionError } from \"./mathematics\";\n *\n * try {\n * const value = assertU8(256n); // Will throw\n * } catch (error) {\n * if (error instanceof MathematicsAssertionError) {\n * console.error(`Assertion failed for ${error.expectedType}`);\n * console.error(`Value: ${error.value}`);\n * console.error(`Constraint: ${error.constraint}`);\n * // Output:\n * // Assertion failed for U8\n * // Value: 256\n * // Constraint: 0 <= value <= 255\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Safe parse pattern — returns null instead of throwing\n * function safeParseU8(value: bigint): U8 | null {\n * try {\n * return assertU8(value);\n * } catch (error) {\n * if (error instanceof MathematicsAssertionError) {\n * console.warn(`Invalid U8 value: ${value}`);\n * return null;\n * }\n * throw error; // Re-throw unexpected errors\n * }\n * }\n * ```\n *\n * @sealed\n * @public\n */\nexport class MathematicsAssertionError extends Error {\n /**\n * The actual value that failed the assertion.\n *\n * @remarks\n * The runtime type reflects what was actually passed to the assertion function:\n * - `bigint` for integer assertions (`assertU8`, `assertU256`, etc.)\n * - `Uint8Array` for byte-array assertions (`assertU256LeBytes`, `assertU32LeBytes`, etc.)\n * - Any other type when a non-numeric value was passed unexpectedly\n *\n * @readonly\n */\n public readonly value: unknown;\n\n /**\n * The type that was expected.\n *\n * @remarks\n * Contains the branded type name exactly as it appears in the SDK type system,\n * e.g., `\"U8\"`, `\"U256\"`, `\"U32LeBytes\"`. Use this for structured logging or\n * to build user-facing error messages without parsing the `message` string.\n *\n * @readonly\n */\n public readonly expectedType: string;\n\n /**\n * Description of the constraint that was violated.\n *\n * @remarks\n * Is `undefined` when only a type check failed (e.g., a `string` was passed where a\n * `bigint` was expected). Contains a human-readable inequality or length rule when a\n * value of the correct type was out of the allowed range.\n *\n * @example\n * - `\"0 <= value <= 255\"` — U8 range violation\n * - `\"length === 32\"` — U256LeBytes length violation\n * - `\"value >= 0\"` — negative value passed to an unsigned integer assertion\n *\n * @readonly\n */\n public readonly constraint: string | undefined;\n\n /**\n * Creates a new MathematicsAssertionError.\n *\n * @param message - Human-readable description of the assertion failure. Should name\n * the assertion function, the expected type, and the constraint that was violated.\n * @param options - Structured diagnostic details attached to the error.\n * @param options.value - The actual value that was supplied and failed the assertion.\n * @param options.expectedType - The name of the branded type that was expected\n * (e.g., `\"U8\"`, `\"U256LeBytes\"`).\n * @param options.constraint - Optional human-readable constraint description\n * (e.g., `\"0 <= value <= 255\"`). Omit when the failure is a type mismatch rather\n * than a range violation.\n */\n constructor(\n message: string,\n options: {\n value: unknown;\n expectedType: string;\n constraint?: string;\n },\n ) {\n super(message);\n this.name = \"MathematicsAssertionError\";\n this.value = options.value;\n this.expectedType = options.expectedType;\n this.constraint = options.constraint;\n\n // Maintains proper stack trace for where our error was thrown (V8 only)\n Error.captureStackTrace(this, MathematicsAssertionError);\n\n // Set the prototype explicitly for proper instanceof checks\n Object.setPrototypeOf(this, MathematicsAssertionError.prototype);\n }\n}\n\n/* =============================================================================\n * CRYPTOGRAPHY ASSERTION ERROR\n *\n * Error thrown when cryptographic type assertions fail.\n * ============================================================================= */\n\n/**\n * Error thrown when a value fails a cryptographic type assertion.\n *\n * This error provides detailed information about why an assertion failed,\n * including the actual value, the expected type, and the constraint that\n * was violated.\n *\n * @remarks\n * Thrown by assertion functions in the cryptography module, such as\n * `assertBn254FieldElement`, `assertAesKey`, `assertX25519PrivateKey`, and similar.\n * Each function validates that a value conforms to a branded cryptographic type,\n * throwing this error with a precise `expectedType` and `constraint` when it does not.\n *\n * Common reasons for failure:\n * - A `bigint` field element exceeds the BN254 or Curve25519 field prime\n * - A byte array has the wrong length (e.g., a 31-byte array passed as an AES-256 key)\n * - A wrong JavaScript type was supplied (e.g., a `number` instead of a `bigint`)\n *\n * @example\n * ```typescript\n * import { assertBn254FieldElement, CryptographyAssertionError } from \"./cryptography\";\n *\n * try {\n * assertBn254FieldElement(invalidValue); // Will throw\n * } catch (error) {\n * if (error instanceof CryptographyAssertionError) {\n * console.error(`Assertion failed for ${error.expectedType}`);\n * console.error(`Value: ${error.value}`);\n * console.error(`Constraint: ${error.constraint}`);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Distinguish cryptographic assertion failures from mathematical ones\n * try {\n * const key = assertAesKey(rawBytes);\n * } catch (error) {\n * if (error instanceof CryptographyAssertionError) {\n * console.warn(\"Crypto assertion failed:\", error.expectedType, error.constraint);\n * } else if (error instanceof MathematicsAssertionError) {\n * console.warn(\"Math assertion failed:\", error.expectedType, error.constraint);\n * }\n * }\n * ```\n *\n * @see {@link MathematicsAssertionError}\n * @see {@link SolanaAssertionError}\n * @see {@link TemporalAssertionError}\n * @sealed\n * @public\n */\nexport class CryptographyAssertionError extends Error {\n /**\n * The actual value that failed the assertion.\n *\n * @remarks\n * The runtime type reflects what was actually passed to the assertion function:\n * - `bigint` for field element assertions (`assertBn254FieldElement`, etc.)\n * - `Uint8Array` for byte-array assertions (`assertAesKey`, `assertX25519PrivateKey`, etc.)\n * - Any other type when an entirely wrong value type was supplied\n *\n * @readonly\n */\n public readonly value: unknown;\n\n /**\n * The type that was expected (e.g., `\"Bn254FieldElement\"`, `\"PoseidonKey\"`, `\"AesKey\"`).\n *\n * @remarks\n * Contains the branded type name exactly as it appears in the SDK type system.\n * Use this property for structured logging without parsing the `message` string.\n *\n * @readonly\n */\n public readonly expectedType: string;\n\n /**\n * Description of the constraint that was violated.\n *\n * @remarks\n * Is `undefined` for pure type-mismatch failures (e.g., `string` instead of `bigint`).\n * Contains a human-readable constraint description for range and length violations\n * (e.g., `\"value < BN254_FIELD_PRIME\"`, `\"length === 32\"`).\n *\n * @readonly\n */\n public readonly constraint: string | undefined;\n\n /**\n * Creates a new CryptographyAssertionError.\n *\n * @param message - Human-readable description of the assertion failure. Should name\n * the assertion function, the expected type, and the constraint that was violated.\n * @param options - Structured diagnostic details attached to the error.\n * @param options.value - The actual value that was supplied and failed the assertion.\n * @param options.expectedType - The name of the branded cryptographic type that was\n * expected (e.g., `\"Bn254FieldElement\"`, `\"AesKey\"`).\n * @param options.constraint - Optional human-readable constraint description.\n * Omit when the failure is a type mismatch rather than a range or length violation.\n */\n constructor(\n message: string,\n options: {\n value: unknown;\n expectedType: string;\n constraint?: string;\n },\n ) {\n super(message);\n this.name = \"CryptographyAssertionError\";\n this.value = options.value;\n this.expectedType = options.expectedType;\n this.constraint = options.constraint;\n\n Error.captureStackTrace(this, CryptographyAssertionError);\n\n Object.setPrototypeOf(this, CryptographyAssertionError.prototype);\n }\n}\n\n/* =============================================================================\n * SOLANA ASSERTION ERROR\n *\n * Error thrown when Solana type assertions fail.\n * ============================================================================= */\n\n/**\n * Error thrown when a Solana type assertion fails.\n *\n * This error provides detailed information about why the assertion failed,\n * including the actual value, expected type, and constraint that was violated.\n *\n * @remarks\n * Thrown by assertion functions for Solana-specific branded types, such as\n * `assertTransactionSignature`, `assertSignatureBytes`, and similar validators.\n * These assertions verify that string or byte-array values conform to Solana's\n * encoding and length conventions (e.g., Base58-encoded 64-byte Ed25519 signatures).\n *\n * Common reasons for failure:\n * - A string that fails Base58 decoding or has the wrong decoded length\n * - A `Uint8Array` with the wrong byte length for a signature or public key\n * - A wrong JavaScript type (e.g., `number` instead of `string`)\n *\n * @example\n * ```typescript\n * import { assertTransactionSignature, SolanaAssertionError } from \"./solana\";\n *\n * try {\n * assertTransactionSignature(\"invalid!signature\"); // Will throw\n * } catch (error) {\n * if (error instanceof SolanaAssertionError) {\n * console.error(`Assertion failed for ${error.expectedType}`);\n * console.error(`Value: ${error.value}`);\n * console.error(`Constraint: ${error.constraint}`);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Safe parse pattern — returns null on failure\n * function tryParseSignature(raw: unknown): TransactionSignature | null {\n * try {\n * return assertTransactionSignature(raw);\n * } catch (error) {\n * if (error instanceof SolanaAssertionError) return null;\n * throw error;\n * }\n * }\n * ```\n *\n * @see {@link MathematicsAssertionError}\n * @see {@link CryptographyAssertionError}\n * @see {@link TemporalAssertionError}\n * @sealed\n * @public\n */\nexport class SolanaAssertionError extends Error {\n /**\n * The actual value that failed the assertion.\n *\n * @remarks\n * The runtime type reflects what was actually passed to the assertion function:\n * - `string` for Base58-encoded assertions (`assertTransactionSignature`, etc.)\n * - `Uint8Array` for byte-array assertions (`assertSignatureBytes`, etc.)\n * - Any other type when a completely wrong value type was supplied\n *\n * @readonly\n */\n public readonly value: unknown;\n\n /**\n * The type that was expected (e.g., `\"TransactionSignature\"`, `\"SignatureBytes\"`).\n *\n * @remarks\n * Contains the branded type name exactly as it appears in the SDK type system.\n * Use this for structured logging without parsing the `message` string.\n *\n * @readonly\n */\n public readonly expectedType: string;\n\n /**\n * Description of the constraint that was violated.\n *\n * @remarks\n * Is `undefined` for pure type-mismatch failures. Contains a human-readable rule\n * for encoding or length violations (e.g., `\"valid Base58\"`, `\"length === 64\"`).\n *\n * @readonly\n */\n public readonly constraint: string | undefined;\n\n /**\n * Creates a new SolanaAssertionError.\n *\n * @param message - Human-readable description of the assertion failure. Should name\n * the assertion function, the expected type, and the constraint that was violated.\n * @param options - Structured diagnostic details attached to the error.\n * @param options.value - The actual value that was supplied and failed the assertion.\n * @param options.expectedType - The name of the branded Solana type that was expected\n * (e.g., `\"TransactionSignature\"`, `\"SignatureBytes\"`).\n * @param options.constraint - Optional human-readable constraint description.\n * Omit when the failure is a type mismatch rather than an encoding or length violation.\n */\n constructor(\n message: string,\n options: {\n value: unknown;\n expectedType: string;\n constraint?: string;\n },\n ) {\n super(message);\n this.name = \"SolanaAssertionError\";\n this.value = options.value;\n this.expectedType = options.expectedType;\n this.constraint = options.constraint;\n\n Error.captureStackTrace(this, SolanaAssertionError);\n\n Object.setPrototypeOf(this, SolanaAssertionError.prototype);\n }\n}\n\n/* =============================================================================\n * TEMPORAL ASSERTION ERROR\n *\n * Error thrown when temporal type assertions fail.\n * ============================================================================= */\n\n/**\n * Error thrown when a temporal type assertion fails.\n *\n * This error provides detailed information about why an assertion failed,\n * including the actual value, the expected type, and the constraint that\n * was violated.\n *\n * @remarks\n * Thrown by assertion functions for branded temporal types: `assertYear`, `assertMonth`,\n * `assertDay`, `assertHour`, `assertMinute`, and `assertSecond`. These functions validate\n * that a `bigint` value falls within the calendar range appropriate for each component\n * (e.g., months must be in `[1, 12]`, hours in `[0, 23]`).\n *\n * Temporal assertions are used to validate the output of UTC timestamp extraction before\n * the components are used in time-scoped viewing key derivation. In normal operation they\n * should never throw (JavaScript's `Date` always produces in-range values), but callers\n * that construct components manually can encounter these errors.\n *\n * @example\n * ```typescript\n * import { assertMonth, TemporalAssertionError } from \"./temporal\";\n *\n * try {\n * assertMonth(13n); // Will throw — month must be 1–12\n * } catch (error) {\n * if (error instanceof TemporalAssertionError) {\n * console.error(`Assertion failed for ${error.expectedType}`);\n * console.error(`Value: ${error.value}`);\n * console.error(`Constraint: ${error.constraint}`);\n * // Output:\n * // Assertion failed for Month\n * // Value: 13\n * // Constraint: 1 <= value <= 12\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Safe parse of a user-supplied year value\n * function tryParseYear(raw: bigint): Year | null {\n * try {\n * return assertYear(raw);\n * } catch (error) {\n * if (error instanceof TemporalAssertionError) return null;\n * throw error;\n * }\n * }\n * ```\n *\n * @see {@link MathematicsAssertionError}\n * @see {@link CryptographyAssertionError}\n * @see {@link SolanaAssertionError}\n * @sealed\n * @public\n */\nexport class TemporalAssertionError extends Error {\n /**\n * The actual value that failed the assertion.\n *\n * @remarks\n * Will be a `bigint` for all temporal assertions since the temporal types are\n * BigInt-backed branded types (e.g., `Year`, `Month`, `Day`). May also be any\n * other type when a non-bigint value was supplied unexpectedly.\n *\n * @readonly\n */\n public readonly value: unknown;\n\n /**\n * The type that was expected (e.g., `\"Year\"`, `\"Month\"`, `\"Hour\"`).\n *\n * @remarks\n * Contains the branded temporal type name exactly as it appears in the SDK type system.\n * Use this for structured logging without parsing the `message` string.\n *\n * @readonly\n */\n public readonly expectedType: string;\n\n /**\n * Description of the constraint that was violated.\n *\n * @remarks\n * Contains a human-readable range rule for out-of-range values\n * (e.g., `\"1 <= value <= 12\"` for a month violation). Is `undefined` only for\n * pure type-mismatch failures (e.g., a `string` passed where a `bigint` was expected),\n * which should not occur in normal usage.\n *\n * @readonly\n */\n public readonly constraint: string | undefined;\n\n /**\n * Creates a new TemporalAssertionError.\n *\n * @param message - Human-readable description of the assertion failure. Should name\n * the assertion function, the expected type, and the violated range constraint.\n * @param details - Structured diagnostic details attached to the error.\n * @param details.value - The actual `bigint` value (or other type) that was supplied\n * and failed the temporal assertion.\n * @param details.expectedType - The name of the branded temporal type that was expected\n * (e.g., `\"Year\"`, `\"Month\"`, `\"Hour\"`).\n * @param details.constraint - Optional human-readable range description\n * (e.g., `\"1 <= value <= 12\"`). Omit when the failure is a type mismatch.\n */\n constructor(\n message: string,\n details: {\n value: unknown;\n expectedType: string;\n constraint?: string;\n },\n ) {\n super(message);\n this.name = \"TemporalAssertionError\";\n this.value = details.value;\n this.expectedType = details.expectedType;\n this.constraint = details.constraint;\n }\n}\n","/**\n * Cryptography Error Classes\n *\n * This module provides error classes for cryptographic operation failures\n * in the Umbra SDK.\n *\n * @module crypto/errors\n */\n\nimport { UmbraError } from \"../common/errors\";\n\n/**\n * Error thrown when a cryptographic operation fails.\n *\n * This includes key derivation failures, encryption/decryption errors,\n * hash computation failures, and ZK proof generation errors.\n *\n * @example\n * ```typescript\n * try {\n * const commitment = await generateUserCommitment(mvk, index, seed);\n * } catch (error) {\n * if (error instanceof CryptographyError) {\n * console.log('Crypto operation failed:', error.operation);\n * }\n * }\n * ```\n */\nexport class CryptographyError extends UmbraError {\n /**\n * The cryptographic operation that failed.\n */\n readonly operation?: string;\n\n constructor(\n message: string,\n options?: {\n code?: string;\n operation?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"CRYPTOGRAPHY_ERROR\",\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"CryptographyError\";\n if (options?.operation !== undefined) {\n this.operation = options.operation;\n }\n }\n}\n\n/**\n * Type guard to check if an error is a CryptographyError.\n */\nexport function isCryptographyError(error: unknown): error is CryptographyError {\n return error instanceof CryptographyError;\n}\n","/**\n * Solana-Specific Error Classes.\n *\n * This module defines the structured error hierarchy for Solana-related failures\n * in the Umbra SDK. All classes extend `UmbraError` from `../common/errors` and\n * carry structured context that makes programmatic error handling and logging\n * straightforward.\n *\n * @remarks\n * The error hierarchy is:\n * ```\n * UmbraError (base)\n * ├── InstructionError — instruction build/validation failures\n * ├── RpcError — JSON-RPC request failures\n * └── TransactionError — transaction lifecycle failures\n * ├── TransactionSigningError — signing-phase failures\n * │ └── MasterSeedSigningRejectedError — master seed derivation rejection\n * ```\n *\n * **Type guards** — Each concrete error class has a matching `is*` type guard\n * function ({@link isInstructionError}, {@link isRpcError},\n * {@link isTransactionError}, {@link isTransactionSigningError}). Prefer these\n * over `instanceof` checks in code that may cross module or bundle boundaries,\n * where `instanceof` can fail due to different class references.\n *\n * **Recovery strategies by error type:**\n *\n * - `InstructionError` — inspect `instructionName` and `context` to determine\n * which account is missing or which parameter is invalid; fix the call site.\n *\n * - `RpcError` — check `statusCode` (HTTP) and `rpcErrorCode` (JSON-RPC) to\n * distinguish rate limiting (429), node overload (503), or invalid request\n * (400). Transient errors are typically retryable.\n *\n * - `TransactionError` — check `simulationLogs` for program error messages that\n * identify the on-chain failure. If `signature` is set, the transaction landed\n * on-chain but was reverted.\n *\n * - `TransactionSigningError` — check `wasRejected` to distinguish a deliberate\n * user rejection from a hardware wallet communication failure.\n *\n * - `MasterSeedSigningRejectedError` — the user declined the master seed\n * derivation message; prompt the user and retry with `getUmbraClientFromSigner`.\n *\n * @packageDocumentation\n */\n\nimport { UmbraError } from \"../common/errors\";\n\n/**\n * Error thrown when building or validating a Solana instruction fails.\n *\n * This error is raised during the instruction-construction phase — before any\n * RPC or network interaction occurs. Common causes include missing required\n * accounts, invalid parameter values, PDA derivation failures, and instruction\n * serialization errors.\n *\n * @remarks\n * The `instructionName` field identifies which instruction failed, which is\n * particularly useful when a single SDK operation constructs multiple\n * instructions. The `context` field (inherited from `UmbraError`) carries\n * arbitrary key-value pairs for additional diagnostic information, such as\n * the list of missing accounts or the conflicting parameter values.\n *\n * **Default error code** — `\"INSTRUCTION_ERROR\"`. Sub-classes or callers may\n * override this via the `code` option.\n *\n * @example\n * Catching and inspecting an instruction build failure:\n * ```typescript\n * import { isInstructionError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const instruction = buildRegisterInstruction(params);\n * } catch (error) {\n * if (isInstructionError(error)) {\n * console.error(`Instruction \"${error.instructionName}\" failed: ${error.message}`);\n * console.error(\"Context:\", error.context);\n * }\n * }\n * ```\n *\n * @example\n * Throwing an `InstructionError` from a builder:\n * ```typescript\n * import { InstructionError } from \"@umbra-privacy/sdk\";\n *\n * throw new InstructionError(\"Required account 'poolConfig' not found\", {\n * instructionName: \"encryptedDeposit\",\n * context: { missingAccounts: [\"poolConfig\"], providedMint: mint.toString() },\n * });\n * ```\n *\n * @see {@link isInstructionError} for the corresponding type guard\n * @public\n */\nexport class InstructionError extends UmbraError {\n /**\n * The name of the instruction that failed during construction or validation.\n *\n * @remarks\n * Matches the Anchor instruction name (camelCase), e.g. `\"encryptedDeposit\"`,\n * `\"initUserAccount\"`. May be `undefined` if the failing instruction could\n * not be identified at the throw site.\n */\n readonly instructionName?: string;\n\n /**\n * Creates a new `InstructionError`.\n *\n * @param message - Human-readable description of the instruction failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"INSTRUCTION_ERROR\"`.\n * @param options.instructionName - The name of the failing instruction.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n instructionName?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"INSTRUCTION_ERROR\",\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"InstructionError\";\n if (options?.instructionName !== undefined) {\n this.instructionName = options.instructionName;\n }\n }\n}\n\n/**\n * Error thrown when a Solana JSON-RPC request fails.\n *\n * This error covers all network-level and protocol-level failures that occur\n * while communicating with a Solana RPC node: unreachable endpoints, HTTP\n * errors, rate limiting, malformed responses, and JSON-RPC error objects\n * returned by the node.\n *\n * @remarks\n * **HTTP errors** — Use `statusCode` to check for common HTTP failure modes:\n * - `429` — rate limited; back off and retry with exponential delay\n * - `503` — node overloaded or temporarily unavailable; retry after a pause\n * - `400` — malformed request; usually a client bug, not retryable\n *\n * **JSON-RPC errors** — Use `rpcErrorCode` to distinguish Solana-specific\n * error codes returned in the `error.code` field of an RPC response body.\n * Common codes: `-32002` (transaction not found), `-32005` (node behind),\n * `-32007` (slot skipped).\n *\n * **Retryability** — `statusCode >= 500` or `statusCode === 429` generally\n * indicates a transient error. Client-side errors (`statusCode === 400`) are\n * not retryable without fixing the request.\n *\n * **Default error code** — `\"RPC_ERROR\"`.\n *\n * @example\n * Distinguishing rate-limit errors from other RPC failures:\n * ```typescript\n * import { isRpcError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const account = await rpc.getAccountInfo(address);\n * } catch (error) {\n * if (isRpcError(error)) {\n * if (error.statusCode === 429) {\n * console.warn(\"Rate limited — retry after delay\");\n * } else {\n * console.error(`RPC failure at ${error.endpoint}: ${error.message}`);\n * }\n * }\n * }\n * ```\n *\n * @example\n * Constructing an `RpcError`:\n * ```typescript\n * import { RpcError } from \"@umbra-privacy/sdk\";\n *\n * throw new RpcError(\"Failed to fetch account\", {\n * endpoint: \"https://api.mainnet-beta.solana.com\",\n * statusCode: 503,\n * cause: originalError,\n * });\n * ```\n *\n * @see {@link isRpcError} for the corresponding type guard\n * @public\n */\nexport class RpcError extends UmbraError {\n /**\n * The RPC endpoint URL that was called when the error occurred.\n *\n * @remarks\n * May be `undefined` if the endpoint was not known at the throw site (e.g.,\n * when the error originates deep within `@solana/kit` internals).\n */\n readonly endpoint?: string;\n\n /**\n * The HTTP status code returned by the RPC node, if applicable.\n *\n * @remarks\n * `undefined` for network-level failures (e.g., DNS resolution failure,\n * connection refused) where no HTTP response was received.\n */\n readonly statusCode?: number;\n\n /**\n * The JSON-RPC error code from the response body, if any.\n *\n * @remarks\n * Set when the RPC node returns a well-formed JSON-RPC error object with a\n * numeric `code` field. `undefined` for HTTP-level failures or when the node\n * returns a malformed response body.\n */\n readonly rpcErrorCode?: number;\n\n /**\n * Creates a new `RpcError`.\n *\n * @param message - Human-readable description of the RPC failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"RPC_ERROR\"`.\n * @param options.endpoint - The RPC endpoint URL that was called.\n * @param options.statusCode - HTTP status code from the response, if any.\n * @param options.rpcErrorCode - JSON-RPC error code from the response, if any.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n endpoint?: string;\n statusCode?: number;\n rpcErrorCode?: number;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"RPC_ERROR\",\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"RpcError\";\n if (options?.endpoint !== undefined) {\n this.endpoint = options.endpoint;\n }\n if (options?.statusCode !== undefined) {\n this.statusCode = options.statusCode;\n }\n if (options?.rpcErrorCode !== undefined) {\n this.rpcErrorCode = options.rpcErrorCode;\n }\n }\n}\n\n/**\n * Error thrown when a transaction operation fails.\n *\n * This error covers failures across the full transaction lifecycle: building the\n * transaction message, running preflight simulation, submitting to the network,\n * and waiting for confirmation. It is the base class for more specific\n * transaction-related errors.\n *\n * @remarks\n * **Simulation logs** — When available, `simulationLogs` contain the program\n * log output from a failed preflight simulation. These logs often include the\n * Anchor error code and a human-readable message describing why the on-chain\n * program rejected the transaction.\n *\n * **Signature** — When `signature` is present, the transaction was accepted by\n * the network and executed but the execution itself failed (on-chain error).\n * When `signature` is absent, the transaction was rejected before reaching the\n * network (e.g., preflight failure, malformed transaction).\n *\n * **Default error code** — `\"TRANSACTION_ERROR\"`.\n *\n * @example\n * Inspecting simulation logs on failure:\n * ```typescript\n * import { isTransactionError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const signatures = await forwarder.forwardSequentially([signedTx]);\n * } catch (error) {\n * if (isTransactionError(error)) {\n * console.error(\"Transaction failed:\", error.message);\n * if (error.simulationLogs) {\n * console.error(\"Simulation logs:\");\n * for (const log of error.simulationLogs) {\n * console.error(\" \", log);\n * }\n * }\n * if (error.signature) {\n * console.error(\"Failed signature:\", error.signature);\n * }\n * }\n * }\n * ```\n *\n * @example\n * Constructing a `TransactionError`:\n * ```typescript\n * import { TransactionError } from \"@umbra-privacy/sdk\";\n *\n * throw new TransactionError(\"Transaction simulation failed\", {\n * simulationLogs: [\"Program log: AnchorError: Error Code: 6001\"],\n * cause: originalError,\n * });\n * ```\n *\n * @see {@link isTransactionError} for the corresponding type guard\n * @see {@link TransactionSigningError} for signing-phase failures\n * @public\n */\nexport class TransactionError extends UmbraError {\n /**\n * The transaction signature, if available.\n *\n * @remarks\n * Base58-encoded signature string. Present when the transaction was submitted\n * to the network but failed during execution. Use this to look up the failed\n * transaction in a block explorer.\n */\n readonly signature?: string;\n\n /**\n * Simulation log output from the transaction preflight, if available.\n *\n * @remarks\n * Each entry in the array is one line of program log output (e.g.,\n * `\"Program log: ...\"` or `\"Program <address> failed: ...\"`). Anchor programs\n * emit error codes and names here when constraints are violated.\n */\n readonly simulationLogs?: string[];\n\n /**\n * Creates a new `TransactionError`.\n *\n * @param message - Human-readable description of the transaction failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"TRANSACTION_ERROR\"`.\n * @param options.signature - Base58-encoded transaction signature, if available.\n * @param options.simulationLogs - Program log output from preflight simulation.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n signature?: string;\n simulationLogs?: string[];\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"TRANSACTION_ERROR\",\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"TransactionError\";\n if (options?.signature !== undefined) {\n this.signature = options.signature;\n }\n if (options?.simulationLogs !== undefined) {\n this.simulationLogs = options.simulationLogs;\n }\n }\n}\n\n/**\n * Error thrown when transaction signing fails.\n *\n * This is a specific sub-class of {@link TransactionError} that occurs during\n * the signing phase — after the transaction is built but before it is submitted\n * to the network. Common causes include explicit user rejection in a wallet UI,\n * hardware wallet disconnection or timeout, and missing key material.\n *\n * @remarks\n * **User rejection** — When `wasRejected` is `true`, the user deliberately\n * declined to sign in the wallet prompt. This is not an error condition in the\n * traditional sense — the user made an intentional choice. UIs should catch this\n * and show a user-friendly cancellation message rather than an error dialog.\n *\n * **Hardware wallet issues** — When `wasRejected` is `false`, the failure was\n * not deliberate. It may indicate a disconnected Ledger, a timeout waiting for\n * the user to confirm on-device, or an incompatible app version on the device.\n *\n * **Signer address** — `signerAddress` identifies which signer's key was needed\n * at the time of failure. In multi-signer flows this helps identify which party\n * must re-sign.\n *\n * **Default error code** — `\"TRANSACTION_SIGNING_ERROR\"`.\n *\n * @example\n * Handling user rejection gracefully:\n * ```typescript\n * import { isTransactionSigningError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const signedTx = await walletSigner.signTransaction(tx);\n * } catch (error) {\n * if (isTransactionSigningError(error)) {\n * if (error.wasRejected) {\n * showToast(\"Transaction cancelled by user\");\n * } else {\n * showToast(`Signing failed: ${error.message}`);\n * }\n * }\n * }\n * ```\n *\n * @example\n * Constructing a `TransactionSigningError`:\n * ```typescript\n * import { TransactionSigningError } from \"@umbra-privacy/sdk\";\n *\n * throw new TransactionSigningError(\"User rejected the transaction\", {\n * wasRejected: true,\n * signerAddress: wallet.publicKey.toString(),\n * });\n * ```\n *\n * @see {@link isTransactionSigningError} for the corresponding type guard\n * @see {@link MasterSeedSigningRejectedError} for the master seed rejection sub-class\n * @public\n */\nexport class TransactionSigningError extends TransactionError {\n /**\n * Whether the signing was explicitly rejected by the user.\n *\n * @remarks\n * `true` when the wallet UI presented a sign request and the user actively\n * clicked \"Reject\" or equivalent. `false` when the failure was due to a\n * technical issue (disconnected device, timeout, missing key).\n *\n * @defaultValue `false`\n */\n readonly wasRejected: boolean;\n\n /**\n * The address of the signer that failed to produce a signature.\n *\n * @remarks\n * Base58-encoded public key string. May be `undefined` if the failing signer\n * could not be identified at the throw site.\n */\n readonly signerAddress?: string;\n\n /**\n * Creates a new `TransactionSigningError`.\n *\n * @param message - Human-readable description of the signing failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"TRANSACTION_SIGNING_ERROR\"`.\n * @param options.wasRejected - Whether the user deliberately rejected. Defaults to `false`.\n * @param options.signerAddress - Base58 address of the signer that failed.\n * @param options.signature - Transaction signature, if the transaction was partially signed.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n wasRejected?: boolean;\n signerAddress?: string;\n signature?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"TRANSACTION_SIGNING_ERROR\",\n ...(options?.signature !== undefined && {\n signature: options.signature,\n }),\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"TransactionSigningError\";\n this.wasRejected = options?.wasRejected ?? false;\n if (options?.signerAddress !== undefined) {\n this.signerAddress = options.signerAddress;\n }\n }\n}\n\n/**\n * Error thrown when master seed signing is rejected by the user.\n *\n * The Umbra privacy protocol derives a deterministic master seed by asking the\n * user's wallet to sign a fixed message. This seed is the root of the key\n * hierarchy used for encrypting and decrypting confidential balances. If the\n * user declines to sign this message, no Umbra operations that require private\n * key material can proceed.\n *\n * @remarks\n * This error always has `wasRejected: true` because it is only thrown when the\n * user deliberately declines — hardware wallet failures or timeouts during the\n * seed derivation flow produce a generic {@link TransactionSigningError} instead.\n *\n * **Recovery** — Prompt the user to explain that the Umbra seed derivation\n * signature is used only to derive encryption keys locally and is never\n * broadcast to the network. Then call `getUmbraClientFromSigner` again.\n *\n * **Default error code** — `\"MASTER_SEED_SIGNING_REJECTED\"`.\n *\n * @example\n * Distinguishing master seed rejection from other signing errors:\n * ```typescript\n * import {\n * MasterSeedSigningRejectedError,\n * isTransactionSigningError,\n * } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const client = await getUmbraClientFromSigner({ signer });\n * } catch (error) {\n * if (error instanceof MasterSeedSigningRejectedError) {\n * showModal(\n * \"Umbra needs a signature to derive your private keys locally. \" +\n * \"This signature is never sent to the network.\",\n * );\n * } else if (isTransactionSigningError(error)) {\n * showToast(`Signing error: ${error.message}`);\n * }\n * }\n * ```\n *\n * @see {@link TransactionSigningError} for the parent class\n * @public\n */\nexport class MasterSeedSigningRejectedError extends TransactionSigningError {\n /**\n * Creates a new `MasterSeedSigningRejectedError`.\n *\n * @param message - Human-readable description. Defaults to a standard rejection\n * message explaining that the user declined the required derivation signature.\n * @param options - Optional structured metadata.\n * @param options.signerAddress - Base58 address of the wallet that rejected.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message = \"Master seed derivation was rejected. The user declined to sign the required message.\",\n options?: {\n signerAddress?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: \"MASTER_SEED_SIGNING_REJECTED\",\n wasRejected: true,\n ...(options?.signerAddress !== undefined && {\n signerAddress: options.signerAddress,\n }),\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"MasterSeedSigningRejectedError\";\n }\n}\n\n/**\n * Type guard to check whether an unknown value is an {@link InstructionError}.\n *\n * @remarks\n * Prefer this function over `instanceof InstructionError` in code that may\n * cross module or bundle boundaries where the class reference might differ.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `InstructionError`, narrowing\n * the type accordingly.\n *\n * @example\n * ```typescript\n * if (isInstructionError(error)) {\n * console.error(\"Instruction:\", error.instructionName);\n * }\n * ```\n *\n * @see {@link InstructionError}\n * @public\n */\nexport function isInstructionError(error: unknown): error is InstructionError {\n return error instanceof InstructionError;\n}\n\n/**\n * Type guard to check whether an unknown value is an {@link RpcError}.\n *\n * @remarks\n * Prefer this function over `instanceof RpcError` in code that may cross\n * module or bundle boundaries where the class reference might differ.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `RpcError`, narrowing the type\n * accordingly.\n *\n * @example\n * ```typescript\n * if (isRpcError(error) && error.statusCode === 429) {\n * await sleep(backoffMs);\n * return retry();\n * }\n * ```\n *\n * @see {@link RpcError}\n * @public\n */\nexport function isRpcError(error: unknown): error is RpcError {\n return error instanceof RpcError;\n}\n\n/**\n * Type guard to check whether an unknown value is a {@link TransactionError}.\n *\n * @remarks\n * Because {@link TransactionSigningError} and {@link MasterSeedSigningRejectedError}\n * extend `TransactionError`, this guard returns `true` for those sub-classes as\n * well. Use the more specific guards ({@link isTransactionSigningError}) when the\n * sub-type matters.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `TransactionError` or any of its\n * sub-classes, narrowing the type accordingly.\n *\n * @example\n * ```typescript\n * if (isTransactionError(error) && error.simulationLogs) {\n * console.error(\"Simulation logs:\", error.simulationLogs.join(\"\\n\"));\n * }\n * ```\n *\n * @see {@link TransactionError}\n * @see {@link isTransactionSigningError}\n * @public\n */\nexport function isTransactionError(error: unknown): error is TransactionError {\n return error instanceof TransactionError;\n}\n\n/**\n * Type guard to check whether an unknown value is a {@link TransactionSigningError}.\n *\n * @remarks\n * Because {@link MasterSeedSigningRejectedError} extends `TransactionSigningError`,\n * this guard returns `true` for that sub-class as well.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `TransactionSigningError` or any\n * of its sub-classes, narrowing the type accordingly.\n *\n * @example\n * ```typescript\n * if (isTransactionSigningError(error) && error.wasRejected) {\n * showCancellationMessage();\n * }\n * ```\n *\n * @see {@link TransactionSigningError}\n * @see {@link MasterSeedSigningRejectedError}\n * @public\n */\nexport function isTransactionSigningError(error: unknown): error is TransactionSigningError {\n return error instanceof TransactionSigningError;\n}\n","/**\n * Umbra Error Classes\n *\n * This module provides error classes for all Umbra SDK operation failures,\n * each carrying a `stage` field that identifies exactly where in the pipeline\n * the failure occurred.\n *\n * @module umbra/errors\n */\n\nimport { UmbraError } from \"../common/errors\";\n\n// =============================================================================\n// DEPOSIT\n// =============================================================================\n\n/**\n * Stage of the encrypted deposit operation where an error occurred.\n *\n * Each stage represents a distinct phase in the deposit flow:\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Input parameter validation failed |\n * | `mint-fetch` | Failed to fetch mint account data |\n * | `fee-calculation` | Failed to calculate transfer fee |\n * | `pda-derivation` | PDA address generation failed |\n * | `account-fetch` | Failed to fetch account data from RPC |\n * | `instruction-build` | Failed to build the deposit instruction |\n * | `transaction-build` | Failed to build transaction message |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Failed to sign the transaction |\n * | `transaction-validate` | Transaction validation failed |\n * | `transaction-send` | Failed to send or confirm the transaction |\n */\nexport type EncryptedDepositStage =\n | \"initialization\"\n | \"validation\"\n | \"mint-fetch\"\n | \"fee-calculation\"\n | \"pda-derivation\"\n | \"account-fetch\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when an encrypted deposit operation fails. */\nexport class EncryptedDepositError extends UmbraError {\n readonly stage: EncryptedDepositStage;\n\n constructor(stage: EncryptedDepositStage, message: string, cause?: Error) {\n super(message, {\n code: `ENCRYPTED_DEPOSIT_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"EncryptedDepositError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is an EncryptedDepositError. */\nexport function isEncryptedDepositError(error: unknown): error is EncryptedDepositError {\n return error instanceof EncryptedDepositError;\n}\n\n// =============================================================================\n// WITHDRAWAL\n// =============================================================================\n\n/**\n * Stage of the encrypted withdrawal operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Input parameter validation failed |\n * | `mint-fetch` | Failed to fetch mint account data |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build the withdrawal instruction |\n * | `transaction-build` | Failed to build transaction message |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Failed to sign the transaction |\n * | `transaction-send` | Failed to send or confirm the transaction |\n */\nexport type EncryptedWithdrawalStage =\n | \"initialization\"\n | \"validation\"\n | \"mint-fetch\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-send\";\n\n/** Error thrown when an encrypted withdrawal operation fails. */\nexport class EncryptedWithdrawalError extends UmbraError {\n readonly stage: EncryptedWithdrawalStage;\n\n constructor(stage: EncryptedWithdrawalStage, message: string, cause?: Error) {\n super(message, {\n code: `ENCRYPTED_WITHDRAWAL_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"EncryptedWithdrawalError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is an EncryptedWithdrawalError. */\nexport function isEncryptedWithdrawalError(error: unknown): error is EncryptedWithdrawalError {\n return error instanceof EncryptedWithdrawalError;\n}\n\n// =============================================================================\n// REGISTRATION\n// =============================================================================\n\n/**\n * Stage of the user registration operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `master-seed-derivation` | Master seed signing was rejected or failed |\n * | `account-fetch` | RPC call to read existing registration state failed |\n * | `key-derivation` | Cryptographic key derivation from master seed failed |\n * | `zk-proof-generation` | Groth16 proof generation failed (anonymous step) |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build an instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing |\n * | `transaction-validate` | Pre-flight simulation failed |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type RegistrationStage =\n | \"initialization\"\n | \"master-seed-derivation\"\n | \"account-fetch\"\n | \"key-derivation\"\n | \"zk-proof-generation\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when a user registration operation fails. */\nexport class RegistrationError extends UmbraError {\n readonly stage: RegistrationStage;\n\n constructor(stage: RegistrationStage, message: string, cause?: unknown) {\n super(message, {\n code: `REGISTRATION_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"RegistrationError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a RegistrationError. */\nexport function isRegistrationError(error: unknown): error is RegistrationError {\n return error instanceof RegistrationError;\n}\n\n// =============================================================================\n// CONVERSION\n// =============================================================================\n\n/**\n * Stage of the MXE-to-Shared conversion operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `account-fetch` | Batch RPC fetch of token account PDAs failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build a conversion instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing for a per-mint transaction |\n * | `transaction-validate` | Pre-flight simulation failed |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type ConversionStage =\n | \"initialization\"\n | \"account-fetch\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when an MXE-to-Shared conversion operation fails. */\nexport class ConversionError extends UmbraError {\n readonly stage: ConversionStage;\n\n constructor(stage: ConversionStage, message: string, cause?: unknown) {\n super(message, {\n code: `CONVERSION_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"ConversionError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a ConversionError. */\nexport function isConversionError(error: unknown): error is ConversionError {\n return error instanceof ConversionError;\n}\n\n// =============================================================================\n// CREATE UTXO\n// =============================================================================\n\n/**\n * Stage of a UTXO creation operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Input parameter validation failed |\n * | `account-fetch` | Failed to fetch recipient or token account data |\n * | `mint-fetch` | Failed to fetch mint account data |\n * | `fee-calculation` | Token-2022 transfer fee calculation failed |\n * | `key-derivation` | Key derivation from master seed failed |\n * | `zk-proof-generation` | Groth16 proof generation failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build an instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing |\n * | `transaction-validate` | Pre-flight simulation failed |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type CreateUtxoStage =\n | \"initialization\"\n | \"validation\"\n | \"account-fetch\"\n | \"mint-fetch\"\n | \"fee-calculation\"\n | \"key-derivation\"\n | \"zk-proof-generation\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when a UTXO creation operation fails. */\nexport class CreateUtxoError extends UmbraError {\n readonly stage: CreateUtxoStage;\n\n constructor(stage: CreateUtxoStage, message: string, cause?: unknown) {\n super(message, {\n code: `CREATE_UTXO_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"CreateUtxoError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a CreateUtxoError. */\nexport function isCreateUtxoError(error: unknown): error is CreateUtxoError {\n return error instanceof CreateUtxoError;\n}\n\n// =============================================================================\n// FETCH UTXOS\n// =============================================================================\n\n/**\n * Stage of a UTXO fetch operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory construction failed — missing indexerApiEndpoint |\n * | `validation` | Invalid tree index or insertion index parameters |\n * | `key-derivation` | X25519 private key derivation from master seed failed |\n * | `indexer-fetch` | Indexer HTTP call failed |\n * | `proof-fetch` | Merkle proof HTTP call failed |\n */\nexport type FetchUtxosStage =\n | \"initialization\"\n | \"validation\"\n | \"key-derivation\"\n | \"indexer-fetch\"\n | \"proof-fetch\";\n\n/** Error thrown when a UTXO fetch operation fails. */\nexport class FetchUtxosError extends UmbraError {\n readonly stage: FetchUtxosStage;\n\n constructor(stage: FetchUtxosStage, message: string, cause?: unknown) {\n super(message, {\n code: `FETCH_UTXOS_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"FetchUtxosError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a FetchUtxosError. */\nexport function isFetchUtxosError(error: unknown): error is FetchUtxosError {\n return error instanceof FetchUtxosError;\n}\n\n// =============================================================================\n// CLAIM UTXO\n// =============================================================================\n\n/**\n * Stage of a UTXO claim operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Invalid UTXO data or Merkle proof parameters |\n * | `key-derivation` | Key derivation from master seed failed |\n * | `zk-proof-generation` | Groth16 proof generation failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build an instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing |\n * | `transaction-validate` | Pre-flight simulation failed — also surfaces stale Merkle proof |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type ClaimUtxoStage =\n | \"initialization\"\n | \"validation\"\n | \"key-derivation\"\n | \"zk-proof-generation\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when a UTXO claim operation fails. */\nexport class ClaimUtxoError extends UmbraError {\n readonly stage: ClaimUtxoStage;\n\n constructor(stage: ClaimUtxoStage, message: string, cause?: unknown) {\n super(message, {\n code: `CLAIM_UTXO_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"ClaimUtxoError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a ClaimUtxoError. */\nexport function isClaimUtxoError(error: unknown): error is ClaimUtxoError {\n return error instanceof ClaimUtxoError;\n}\n\n// =============================================================================\n// QUERY\n// =============================================================================\n\n/**\n * Stage of a query operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `account-fetch` | RPC fetch failed |\n * | `account-decode` | On-chain account data could not be decoded |\n * | `key-derivation` | X25519 key derivation failed (encrypted balance query) |\n * | `decryption` | Rescue cipher decryption failed (encrypted balance query) |\n */\nexport type QueryStage =\n | \"initialization\"\n | \"pda-derivation\"\n | \"account-fetch\"\n | \"account-decode\"\n | \"key-derivation\"\n | \"decryption\";\n\n/** Error thrown when a query operation fails. */\nexport class QueryError extends UmbraError {\n readonly stage: QueryStage;\n\n constructor(stage: QueryStage, message: string, cause?: unknown) {\n super(message, {\n code: `QUERY_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"QueryError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a QueryError. */\nexport function isQueryError(error: unknown): error is QueryError {\n return error instanceof QueryError;\n}\n"]}
@@ -0,0 +1,316 @@
1
+ 'use strict';
2
+
3
+ var chunkVEGLTTYQ_cjs = require('../chunk-VEGLTTYQ.cjs');
4
+ require('../chunk-HOEXDXRC.cjs');
5
+ var chunkMVKTV3FT_cjs = require('../chunk-MVKTV3FT.cjs');
6
+ var chunkPK6SKIKE_cjs = require('../chunk-PK6SKIKE.cjs');
7
+
8
+ // src/constants/domain-separators.ts
9
+ function createClaimDomainSeparators(claimType) {
10
+ return {
11
+ MODIFIED_GEN_INDEX: `Claim${claimType} / modifiedGenerationIndex`,
12
+ EXPANDED_GEN_INDEX: `Claim${claimType} / expandedGenerationIndex`
13
+ };
14
+ }
15
+ chunkPK6SKIKE_cjs.__name(createClaimDomainSeparators, "createClaimDomainSeparators");
16
+ var CLAIM_DOMAINS = {
17
+ /** Domain separators for self-claimable UTXO claims into public balance */
18
+ SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: createClaimDomainSeparators("SelfClaimableUtxoIntoPublicBalance"),
19
+ /** Domain separators for self-claimable UTXO claims into encrypted balance */
20
+ SELF_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators("SelfClaimableUtxoIntoEncryptedBalance"),
21
+ /** Domain separators for receiver-claimable UTXO claims into encrypted balance */
22
+ RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators("ReceiverClaimableUtxoIntoEncryptedBalance")
23
+ };
24
+ var LINKER_KEYSTREAM_DOMAINS = {
25
+ /** Self-claimable UTXO claim into public balance */
26
+ SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: "selfClaimableUtxoIntoPublicBalance / linkerKeystreamBlindingFactor",
27
+ /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */
28
+ RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: "receiverClaimableUtxoIntoEncryptedBalance / linkerKeystreamBlindingFactor"
29
+ };
30
+ var RANDOM_FACTOR_DOMAINS = {
31
+ /** Self-claimable UTXO claim into public balance */
32
+ SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: "selfClaimableUtxoIntoPublicBalance / randomFactorForPolynomialCommitment",
33
+ /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */
34
+ RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: "receiverClaimableUtxoIntoEncryptedBalance / randomFactorForPolynomialCommitment"
35
+ };
36
+ var RESCUE_COMMITMENT_DOMAINS = {
37
+ /** Self-claimable UTXO claim into public balance */
38
+ SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: "selfClaimableUtxoIntoPublicBalance / rescueEncryptionCommitmentBlindingFactor",
39
+ /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */
40
+ RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: "receiverClaimableUtxoIntoEncryptedBalance / rescueEncryptionCommitmentBlindingFactor"
41
+ };
42
+
43
+ // src/constants/encryption-counts.ts
44
+ var LINKER_ENCRYPTIONS_PER_LEAF = {
45
+ /**
46
+ * ATA claims - excludes amount encryption (amounts are public).
47
+ * Encrypts: senderAddressLow, senderAddressHigh, mintAddressLow, mintAddressHigh, leafCommitment
48
+ */
49
+ INTO_ATA: 5,
50
+ /**
51
+ * ETA claims - includes amount encryption.
52
+ * Encrypts: senderAddressLow, senderAddressHigh, amount, mintAddressLow, mintAddressHigh, leafCommitment
53
+ */
54
+ INTO_ETA: 6
55
+ };
56
+ var RESCUE_ENCRYPTIONS_COUNT = {
57
+ /**
58
+ * ATA claims - no fee encryption (amounts are public).
59
+ * Encrypts: mvkLow, mvkHigh, randomFactorLow, randomFactorHigh
60
+ */
61
+ WITHOUT_FEES: 4,
62
+ /**
63
+ * ETA claims - includes fee encryption.
64
+ * Encrypts: finalAmount, protocolFees, relayerFees, mvkLow, mvkHigh, randomFactorLow, randomFactorHigh
65
+ */
66
+ WITH_FEES: 7
67
+ };
68
+ var KMAC_512_OUTPUT_LENGTH = 64;
69
+ var AGGREGATED_HASH_INPUT_COUNT = {
70
+ /** ATA claims use 45 elements */
71
+ ATA: 45,
72
+ /** ETA claims use 70 elements */
73
+ ETA: 70
74
+ };
75
+
76
+ // src/umbra/constants.ts
77
+ var UMBRA_MESSAGE_TO_SIGN = `
78
+ Signing this message is a sensitive cryptographic operation that generates the master key used to derive your private spending keys and decrypt your account balances. This signature acts as the root of your privacy and financial security within the Umbra ecosystem.
79
+
80
+ You must ensure that you are interacting with the official Umbra Privacy application or a verified integration. Signing this message on an unverified or malicious site could allow an attacker to gain full control over your funds and expose your entire transaction history.
81
+ `;
82
+ var PROTOCOL_FEE = {
83
+ /**
84
+ * Fixed base fee charged per operation, denominated in the SPL token's smallest unit.
85
+ *
86
+ * @remarks
87
+ * Added to the proportional BPS fee before clamping. A value of `10n` means 10
88
+ * token micro-units (e.g. 0.00001 USDC for a 6-decimal token).
89
+ *
90
+ * @readonly
91
+ */
92
+ BASE_FEE: 10n,
93
+ /**
94
+ * Proportional fee rate expressed in basis points (1 BPS = 0.01%).
95
+ *
96
+ * @remarks
97
+ * `35n` corresponds to 0.35%. Applied to the claimed or transferred amount before
98
+ * adding `BASE_FEE` and clamping to `[LOWER_BOUND, UPPER_BOUND]`.
99
+ *
100
+ * @readonly
101
+ */
102
+ BPS: 35n,
103
+ /**
104
+ * Minimum fee amount. The total fee is never less than this value.
105
+ *
106
+ * @remarks
107
+ * Currently `0n`, meaning there is no enforced minimum beyond the `BASE_FEE`.
108
+ *
109
+ * @readonly
110
+ */
111
+ LOWER_BOUND: 0n,
112
+ /**
113
+ * Maximum fee amount (cap). The total fee is never greater than this value.
114
+ *
115
+ * @remarks
116
+ * Set to `1_000_000n` (one million token micro-units), which equals 1 USDC for a
117
+ * 6-decimal token. This cap prevents runaway fees on very large claims.
118
+ *
119
+ * @readonly
120
+ */
121
+ UPPER_BOUND: BigInt("1000000")
122
+ };
123
+ var RELAYER_FEE = {
124
+ /**
125
+ * Fixed base fee for relayer operations, denominated in the SPL token's smallest unit.
126
+ *
127
+ * @remarks
128
+ * `0n` — relayers do not charge a fixed base fee; they earn purely through BPS.
129
+ *
130
+ * @readonly
131
+ */
132
+ BASE_FEE: 0n,
133
+ /**
134
+ * Proportional fee rate for the relayer, expressed in basis points (1 BPS = 0.01%).
135
+ *
136
+ * @remarks
137
+ * `35n` corresponds to 0.35%. The relayer earns this percentage of the claimed amount
138
+ * as compensation for submitting and funding the MPC callback transaction.
139
+ *
140
+ * @readonly
141
+ */
142
+ BPS: 35n,
143
+ /**
144
+ * Minimum relayer fee. Currently `0n`.
145
+ *
146
+ * @readonly
147
+ */
148
+ LOWER_BOUND: 0n,
149
+ /**
150
+ * Maximum relayer fee (cap). `1_000_000n` token micro-units.
151
+ *
152
+ * @remarks
153
+ * Mirrors the protocol fee cap to ensure the combined fee never exceeds a predictable
154
+ * maximum, protecting users from paying unexpectedly large fees on large claims.
155
+ *
156
+ * @readonly
157
+ */
158
+ UPPER_BOUND: BigInt("1000000")
159
+ };
160
+ var FEE_OFFSETS = {
161
+ /**
162
+ * Offset used in `UnifiedFeesPool` PDA derivation for the unified protocol fees pool.
163
+ *
164
+ * @remarks
165
+ * Passed as the final seed to `getProtocolOnlyUnifiedFeesPoolPda` and
166
+ * `getRelayerUnifiedFeesPoolPda`. Currently `0n`.
167
+ *
168
+ * @readonly
169
+ */
170
+ PROTOCOL_FEES_POOL: 0n,
171
+ /**
172
+ * Offset used in `ProtocolFeesConfiguration` PDA derivation.
173
+ *
174
+ * @remarks
175
+ * Passed as the final seed to `getProtocolFeesConfigurationPda`. Currently `0n`.
176
+ *
177
+ * @readonly
178
+ */
179
+ PROTOCOL_FEES_CONFIG: 0n,
180
+ /**
181
+ * Offset used in relayer fee configuration PDA derivation.
182
+ *
183
+ * @remarks
184
+ * Passed as the offset seed when looking up the relayer's fee configuration account.
185
+ * Currently `0n`.
186
+ *
187
+ * @readonly
188
+ */
189
+ RELAYER_FEES_CONFIG: 0n
190
+ };
191
+ var BPS_DIVISOR = 10000n;
192
+
193
+ Object.defineProperty(exports, "ASSOCIATED_TOKEN_PROGRAM_ID", {
194
+ enumerable: true,
195
+ get: function () { return chunkVEGLTTYQ_cjs.ASSOCIATED_TOKEN_PROGRAM_ID; }
196
+ });
197
+ Object.defineProperty(exports, "COMPUTE_BUDGET_PROGRAM_ADDRESS", {
198
+ enumerable: true,
199
+ get: function () { return chunkVEGLTTYQ_cjs.COMPUTE_BUDGET_PROGRAM_ADDRESS; }
200
+ });
201
+ Object.defineProperty(exports, "DEFAULT_ALGORITHM_VERSION", {
202
+ enumerable: true,
203
+ get: function () { return chunkVEGLTTYQ_cjs.DEFAULT_ALGORITHM_VERSION; }
204
+ });
205
+ Object.defineProperty(exports, "DEFAULT_NETWORK", {
206
+ enumerable: true,
207
+ get: function () { return chunkVEGLTTYQ_cjs.DEFAULT_NETWORK; }
208
+ });
209
+ Object.defineProperty(exports, "DEFAULT_PROTOCOL_VERSION", {
210
+ enumerable: true,
211
+ get: function () { return chunkVEGLTTYQ_cjs.DEFAULT_PROTOCOL_VERSION; }
212
+ });
213
+ Object.defineProperty(exports, "DEFAULT_SCHEME_VERSION", {
214
+ enumerable: true,
215
+ get: function () { return chunkVEGLTTYQ_cjs.DEFAULT_SCHEME_VERSION; }
216
+ });
217
+ Object.defineProperty(exports, "SPL_TOKEN_PROGRAM_ID", {
218
+ enumerable: true,
219
+ get: function () { return chunkVEGLTTYQ_cjs.SPL_TOKEN_PROGRAM_ID; }
220
+ });
221
+ Object.defineProperty(exports, "SYSTEM_PROGRAM_ID", {
222
+ enumerable: true,
223
+ get: function () { return chunkVEGLTTYQ_cjs.SYSTEM_PROGRAM_ID; }
224
+ });
225
+ Object.defineProperty(exports, "TOKEN_2022_PROGRAM_ID", {
226
+ enumerable: true,
227
+ get: function () { return chunkVEGLTTYQ_cjs.TOKEN_2022_PROGRAM_ID; }
228
+ });
229
+ Object.defineProperty(exports, "assertNetwork", {
230
+ enumerable: true,
231
+ get: function () { return chunkVEGLTTYQ_cjs.assertNetwork; }
232
+ });
233
+ Object.defineProperty(exports, "assertValidAlgorithmVersion", {
234
+ enumerable: true,
235
+ get: function () { return chunkVEGLTTYQ_cjs.assertValidAlgorithmVersion; }
236
+ });
237
+ Object.defineProperty(exports, "assertValidProtocolVersion", {
238
+ enumerable: true,
239
+ get: function () { return chunkVEGLTTYQ_cjs.assertValidProtocolVersion; }
240
+ });
241
+ Object.defineProperty(exports, "assertValidSchemeVersion", {
242
+ enumerable: true,
243
+ get: function () { return chunkVEGLTTYQ_cjs.assertValidSchemeVersion; }
244
+ });
245
+ Object.defineProperty(exports, "assertValidVersion", {
246
+ enumerable: true,
247
+ get: function () { return chunkVEGLTTYQ_cjs.assertValidVersion; }
248
+ });
249
+ Object.defineProperty(exports, "createSetComputeUnitLimitInstruction", {
250
+ enumerable: true,
251
+ get: function () { return chunkVEGLTTYQ_cjs.createSetComputeUnitLimitInstruction; }
252
+ });
253
+ Object.defineProperty(exports, "getDefaultAlgorithmVersion", {
254
+ enumerable: true,
255
+ get: function () { return chunkVEGLTTYQ_cjs.getDefaultAlgorithmVersion; }
256
+ });
257
+ Object.defineProperty(exports, "getDefaultProtocolVersion", {
258
+ enumerable: true,
259
+ get: function () { return chunkVEGLTTYQ_cjs.getDefaultProtocolVersion; }
260
+ });
261
+ Object.defineProperty(exports, "getDefaultSchemeVersion", {
262
+ enumerable: true,
263
+ get: function () { return chunkVEGLTTYQ_cjs.getDefaultSchemeVersion; }
264
+ });
265
+ Object.defineProperty(exports, "getNetworkConfig", {
266
+ enumerable: true,
267
+ get: function () { return chunkVEGLTTYQ_cjs.getNetworkConfig; }
268
+ });
269
+ Object.defineProperty(exports, "getNetworkSpecifier", {
270
+ enumerable: true,
271
+ get: function () { return chunkVEGLTTYQ_cjs.getNetworkSpecifier; }
272
+ });
273
+ Object.defineProperty(exports, "ARCIUM_CLUSTER_SEED", {
274
+ enumerable: true,
275
+ get: function () { return chunkMVKTV3FT_cjs.ARCIUM_CLUSTER_SEED; }
276
+ });
277
+ Object.defineProperty(exports, "ARCIUM_COMPUTATION_SEED", {
278
+ enumerable: true,
279
+ get: function () { return chunkMVKTV3FT_cjs.ARCIUM_COMPUTATION_SEED; }
280
+ });
281
+ Object.defineProperty(exports, "ARCIUM_COMP_DEF_SEED", {
282
+ enumerable: true,
283
+ get: function () { return chunkMVKTV3FT_cjs.ARCIUM_COMP_DEF_SEED; }
284
+ });
285
+ Object.defineProperty(exports, "ARCIUM_EXEC_POOL_SEED", {
286
+ enumerable: true,
287
+ get: function () { return chunkMVKTV3FT_cjs.ARCIUM_EXEC_POOL_SEED; }
288
+ });
289
+ Object.defineProperty(exports, "ARCIUM_MEMPOOL_SEED", {
290
+ enumerable: true,
291
+ get: function () { return chunkMVKTV3FT_cjs.ARCIUM_MEMPOOL_SEED; }
292
+ });
293
+ Object.defineProperty(exports, "ARCIUM_MXE_ACCOUNT_SEED", {
294
+ enumerable: true,
295
+ get: function () { return chunkMVKTV3FT_cjs.ARCIUM_MXE_ACCOUNT_SEED; }
296
+ });
297
+ Object.defineProperty(exports, "ARCIUM_OFFSET_BUFFER_SIZE", {
298
+ enumerable: true,
299
+ get: function () { return chunkMVKTV3FT_cjs.ARCIUM_OFFSET_BUFFER_SIZE; }
300
+ });
301
+ exports.AGGREGATED_HASH_INPUT_COUNT = AGGREGATED_HASH_INPUT_COUNT;
302
+ exports.BPS_DIVISOR = BPS_DIVISOR;
303
+ exports.CLAIM_DOMAINS = CLAIM_DOMAINS;
304
+ exports.FEE_OFFSETS = FEE_OFFSETS;
305
+ exports.KMAC_512_OUTPUT_LENGTH = KMAC_512_OUTPUT_LENGTH;
306
+ exports.LINKER_ENCRYPTIONS_PER_LEAF = LINKER_ENCRYPTIONS_PER_LEAF;
307
+ exports.LINKER_KEYSTREAM_DOMAINS = LINKER_KEYSTREAM_DOMAINS;
308
+ exports.PROTOCOL_FEE = PROTOCOL_FEE;
309
+ exports.RANDOM_FACTOR_DOMAINS = RANDOM_FACTOR_DOMAINS;
310
+ exports.RELAYER_FEE = RELAYER_FEE;
311
+ exports.RESCUE_COMMITMENT_DOMAINS = RESCUE_COMMITMENT_DOMAINS;
312
+ exports.RESCUE_ENCRYPTIONS_COUNT = RESCUE_ENCRYPTIONS_COUNT;
313
+ exports.UMBRA_MESSAGE_TO_SIGN = UMBRA_MESSAGE_TO_SIGN;
314
+ exports.createClaimDomainSeparators = createClaimDomainSeparators;
315
+ //# sourceMappingURL=index.cjs.map
316
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/constants/domain-separators.ts","../../src/constants/encryption-counts.ts","../../src/umbra/constants.ts"],"names":["__name"],"mappings":";;;;;;;;AAyCO,SAAS,4BAA4B,SAAA,EAA6C;AACvF,EAAA,OAAO;AAAA,IACL,kBAAA,EAAoB,QAAQ,SAAS,CAAA,0BAAA,CAAA;AAAA,IACrC,kBAAA,EAAoB,QAAQ,SAAS,CAAA,0BAAA;AAAA,GACvC;AACF;AALgBA,wBAAA,CAAA,2BAAA,EAAA,6BAAA,CAAA;AAcT,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,kCAAA,EAAoC,4BAA4B,oCAAoC,CAAA;AAAA;AAAA,EAEpG,qCAAA,EAAuC,4BAA4B,uCAAuC,CAAA;AAAA;AAAA,EAE1G,yCAAA,EAA2C,4BAA4B,2CAA2C;AACpH;AASO,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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUV,GAAA,EAAK,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAML,WAAA,EAAa,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUb,WAAA,EAAa,OAAO,SAAS;AAC/B;AAyCO,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUzB,kBAAA,EAAoB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpB,oBAAA,EAAsB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUtB,mBAAA,EAAqB;AACvB;AAgCO,IAAM,WAAA,GAAc","file":"index.cjs","sourcesContent":["/**\n * Domain Separator Constants\n *\n * Domain separators for cryptographic operations in claim functions.\n * These are used as keys in KMAC256 for domain separation.\n *\n * @module constants/domain-separators\n */\n\n/* =============================================================================\n * CLAIM DOMAIN SEPARATOR TYPES\n * ============================================================================= */\n\n/**\n * Types of claim operations that require domain separators.\n */\nexport type ClaimType =\n | \"SelfClaimableUtxoIntoPublicBalance\"\n | \"SelfClaimableUtxoIntoEncryptedBalance\"\n | \"ReceiverClaimableUtxoIntoEncryptedBalance\";\n\n/**\n * Domain separator pair for claim operations.\n */\nexport interface ClaimDomainSeparators {\n /** Domain separator for modified generation index derivation */\n readonly MODIFIED_GEN_INDEX: string;\n /** Domain separator for expanded generation index derivation */\n readonly EXPANDED_GEN_INDEX: string;\n}\n\n/* =============================================================================\n * DOMAIN SEPARATOR FACTORY\n * ============================================================================= */\n\n/**\n * Creates domain separators for a specific claim type.\n *\n * @param claimType - The type of claim operation\n * @returns Domain separator pair for the claim type\n */\nexport function createClaimDomainSeparators(claimType: ClaimType): ClaimDomainSeparators {\n return {\n MODIFIED_GEN_INDEX: `Claim${claimType} / modifiedGenerationIndex`,\n EXPANDED_GEN_INDEX: `Claim${claimType} / expandedGenerationIndex`,\n } as const;\n}\n\n/* =============================================================================\n * PRE-BUILT DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Pre-built domain separators for all claim types.\n */\nexport const CLAIM_DOMAINS = {\n /** Domain separators for self-claimable UTXO claims into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: createClaimDomainSeparators(\"SelfClaimableUtxoIntoPublicBalance\"),\n /** Domain separators for self-claimable UTXO claims into encrypted balance */\n SELF_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(\"SelfClaimableUtxoIntoEncryptedBalance\"),\n /** Domain separators for receiver-claimable UTXO claims into encrypted balance */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: createClaimDomainSeparators(\"ReceiverClaimableUtxoIntoEncryptedBalance\"),\n} as const;\n\n/* =============================================================================\n * LINKER KEYSTREAM DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for linker keystream blinding factor derivation.\n */\nexport const LINKER_KEYSTREAM_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: \"selfClaimableUtxoIntoPublicBalance / linkerKeystreamBlindingFactor\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: \"receiverClaimableUtxoIntoEncryptedBalance / linkerKeystreamBlindingFactor\",\n} as const;\n\n/* =============================================================================\n * RANDOM FACTOR DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for random factor generation in polynomial commitment.\n */\nexport const RANDOM_FACTOR_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: \"selfClaimableUtxoIntoPublicBalance / randomFactorForPolynomialCommitment\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: \"receiverClaimableUtxoIntoEncryptedBalance / randomFactorForPolynomialCommitment\",\n} as const;\n\n/* =============================================================================\n * RESCUE ENCRYPTION COMMITMENT DOMAIN SEPARATORS\n * ============================================================================= */\n\n/**\n * Domain separators for rescue encryption commitment blinding factor derivation.\n */\nexport const RESCUE_COMMITMENT_DOMAINS = {\n /** Self-claimable UTXO claim into public balance */\n SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: \"selfClaimableUtxoIntoPublicBalance / rescueEncryptionCommitmentBlindingFactor\",\n /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */\n RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: \"receiverClaimableUtxoIntoEncryptedBalance / rescueEncryptionCommitmentBlindingFactor\",\n} as const;\n","/**\n * Encryption Count Constants\n *\n * Constants for encryption operations in claim circuits.\n *\n * @module constants/encryption-counts\n */\n\n/* =============================================================================\n * LINKER ENCRYPTION CONSTANTS\n * ============================================================================= */\n\n/**\n * Number of linker encryptions per leaf for different claim types.\n */\nexport const LINKER_ENCRYPTIONS_PER_LEAF = {\n /**\n * ATA claims - excludes amount encryption (amounts are public).\n * Encrypts: senderAddressLow, senderAddressHigh, mintAddressLow, mintAddressHigh, leafCommitment\n */\n INTO_ATA: 5,\n /**\n * ETA claims - includes amount encryption.\n * Encrypts: senderAddressLow, senderAddressHigh, amount, mintAddressLow, mintAddressHigh, leafCommitment\n */\n INTO_ETA: 6,\n} as const;\n\n/* =============================================================================\n * RESCUE CIPHER ENCRYPTION CONSTANTS\n * ============================================================================= */\n\n/**\n * Number of rescue cipher encryptions for different claim types.\n */\nexport const RESCUE_ENCRYPTIONS_COUNT = {\n /**\n * ATA claims - no fee encryption (amounts are public).\n * Encrypts: mvkLow, mvkHigh, randomFactorLow, randomFactorHigh\n */\n WITHOUT_FEES: 4,\n /**\n * ETA claims - includes fee encryption.\n * Encrypts: finalAmount, protocolFees, relayerFees, mvkLow, mvkHigh, randomFactorLow, randomFactorHigh\n */\n WITH_FEES: 7,\n} as const;\n\n/* =============================================================================\n * CRYPTOGRAPHIC OUTPUT CONSTANTS\n * ============================================================================= */\n\n/**\n * KMAC256 output length for 512-bit (64 bytes) output.\n */\nexport const KMAC_512_OUTPUT_LENGTH = 64;\n\n/**\n * Number of elements in the public aggregated hash input array.\n */\nexport const AGGREGATED_HASH_INPUT_COUNT = {\n /** ATA claims use 45 elements */\n ATA: 45,\n /** ETA claims use 70 elements */\n ETA: 70,\n} as const;\n","/**\n * Umbra Protocol Constants\n *\n * Defines the configuration constants used when building and validating Umbra protocol\n * instructions on the client side. These constants mirror on-chain values defined in the\n * Anchor program (`programs/umbra/src/`) and must be kept in sync with that source of\n * truth.\n *\n * ## Sections\n *\n * - **Message signing** — the canonical warning text presented to users before their\n * wallet signature is used to derive the master private key.\n * - **Protocol fee configuration** — the fee schedule applied to the protocol's share\n * of each claim or transfer. Set by program admin, enforced on-chain.\n * - **Relayer fee configuration** — the fee schedule applied to the relayer's commission\n * on claim and transfer instructions. Set per-relayer.\n * - **Fee offset configuration** — the `offset` discriminators used when deriving PDAs\n * for fee-related accounts.\n * - **BPS divisor** — the basis-point denominator used in fee arithmetic.\n *\n * @packageDocumentation\n * @module umbra/constants\n */\n\n/* =============================================================================\n * UMBRA PROTOCOL CONSTANTS\n * ============================================================================= */\n\n/**\n * Canonical message shown to the user before their wallet signature is requested for\n * master key derivation.\n *\n * @remarks\n * Signing this message is the root of the user's key hierarchy. The resulting signature\n * is fed into the SDK's key derivation pipeline to produce the `MasterSeed`, from which\n * all spending keys, viewing keys, and Poseidon private keys are derived.\n *\n * The message is deliberately verbose and alarming to ensure that:\n * 1. Users understand the cryptographic weight of their signature.\n * 2. Phishing sites that silently request this signature cannot hide the operation from\n * an attentive user.\n *\n * The exact string (including surrounding newlines) must not be modified without a\n * corresponding protocol upgrade, because changing the message changes all derived keys\n * for every existing user.\n *\n * @example\n * ```typescript\n * import { UMBRA_MESSAGE_TO_SIGN } from \"@umbra-privacy/sdk\";\n * import { signMessage } from \"@solana/kit\";\n *\n * // Present to the user before requesting their signature:\n * console.log(UMBRA_MESSAGE_TO_SIGN);\n *\n * // Obtain the signature and pass it to the key derivation pipeline:\n * const signature = await signer.signMessage(\n * new TextEncoder().encode(UMBRA_MESSAGE_TO_SIGN)\n * );\n * ```\n *\n * @public\n */\nexport const UMBRA_MESSAGE_TO_SIGN = `\nSigning this message is a sensitive cryptographic operation that generates the master key used to derive your private spending keys and decrypt your account balances. This signature acts as the root of your privacy and financial security within the Umbra ecosystem.\n\nYou must ensure that you are interacting with the official Umbra Privacy application or a verified integration. Signing this message on an unverified or malicious site could allow an attacker to gain full control over your funds and expose your entire transaction history.\n`;\n\n/* =============================================================================\n * PROTOCOL FEE CONFIGURATION\n * ============================================================================= */\n\n/**\n * Default fee schedule applied to the protocol's share of each claim or transfer\n * instruction.\n *\n * @remarks\n * These values mirror the `ProtocolFeesConfiguration` account that is written by the\n * program admin during pool setup. The SDK uses them client-side to:\n *\n * 1. Pre-calculate expected fee amounts before building a transaction, so callers can\n * display accurate fee estimates in the UI.\n * 2. Compute the amount of tokens the user actually receives after fees are deducted\n * from the claimed UTXO.\n *\n * The on-chain program independently validates the actual fee config account, so these\n * client-side defaults act as a best-effort estimate rather than an authoritative source.\n * If the admin updates fee parameters on-chain, callers should fetch the live\n * `ProtocolFeesConfiguration` PDA and override these defaults.\n *\n * ## Fee formula\n *\n * ```\n * fee = clamp(BASE_FEE + floor(amount * BPS / BPS_DIVISOR), LOWER_BOUND, UPPER_BOUND)\n * ```\n *\n * Where `BPS_DIVISOR = 10_000n` (see {@link BPS_DIVISOR}).\n *\n * @example\n * ```typescript\n * import { PROTOCOL_FEE, BPS_DIVISOR } from \"@umbra-privacy/sdk\";\n *\n * function estimateProtocolFee(amount: bigint): bigint {\n * const bpsFee = (amount * PROTOCOL_FEE.BPS) / BPS_DIVISOR;\n * const rawFee = PROTOCOL_FEE.BASE_FEE + bpsFee;\n * const clamped = rawFee < PROTOCOL_FEE.LOWER_BOUND\n * ? PROTOCOL_FEE.LOWER_BOUND\n * : rawFee > PROTOCOL_FEE.UPPER_BOUND\n * ? PROTOCOL_FEE.UPPER_BOUND\n * : rawFee;\n * return clamped;\n * }\n * ```\n *\n * @see {@link RELAYER_FEE} for the relayer's fee schedule.\n * @see {@link BPS_DIVISOR} for the basis-point denominator.\n * @public\n */\nexport const PROTOCOL_FEE = {\n /**\n * Fixed base fee charged per operation, denominated in the SPL token's smallest unit.\n *\n * @remarks\n * Added to the proportional BPS fee before clamping. A value of `10n` means 10\n * token micro-units (e.g. 0.00001 USDC for a 6-decimal token).\n *\n * @readonly\n */\n BASE_FEE: 10n,\n /**\n * Proportional fee rate expressed in basis points (1 BPS = 0.01%).\n *\n * @remarks\n * `35n` corresponds to 0.35%. Applied to the claimed or transferred amount before\n * adding `BASE_FEE` and clamping to `[LOWER_BOUND, UPPER_BOUND]`.\n *\n * @readonly\n */\n BPS: 35n,\n /**\n * Minimum fee amount. The total fee is never less than this value.\n *\n * @remarks\n * Currently `0n`, meaning there is no enforced minimum beyond the `BASE_FEE`.\n *\n * @readonly\n */\n LOWER_BOUND: 0n,\n /**\n * Maximum fee amount (cap). The total fee is never greater than this value.\n *\n * @remarks\n * Set to `1_000_000n` (one million token micro-units), which equals 1 USDC for a\n * 6-decimal token. This cap prevents runaway fees on very large claims.\n *\n * @readonly\n */\n UPPER_BOUND: BigInt(\"1000000\"),\n} as const;\n\n/* =============================================================================\n * RELAYER FEE CONFIGURATION\n * ============================================================================= */\n\n/**\n * Default fee schedule applied to the relayer's commission on each claim or transfer\n * instruction that involves a relayer.\n *\n * @remarks\n * These values mirror the `RelayerFeesConfiguration` account associated with a specific\n * relayer. The SDK uses them client-side for fee estimation and for constructing the\n * `expected_fee` field that is verified on-chain during MPC computation.\n *\n * Note that `BASE_FEE` is `0n` for relayers by default — relayers are compensated\n * entirely through the proportional BPS component, unlike the protocol which charges a\n * fixed base fee on top of BPS.\n *\n * ## Fee formula\n *\n * ```\n * relayerFee = clamp(BASE_FEE + floor(amount * BPS / BPS_DIVISOR), LOWER_BOUND, UPPER_BOUND)\n * ```\n *\n * @example\n * ```typescript\n * import { RELAYER_FEE, BPS_DIVISOR } from \"@umbra-privacy/sdk\";\n *\n * function estimateRelayerFee(amount: bigint): bigint {\n * const bpsFee = (amount * RELAYER_FEE.BPS) / BPS_DIVISOR;\n * const rawFee = RELAYER_FEE.BASE_FEE + bpsFee;\n * return rawFee > RELAYER_FEE.UPPER_BOUND ? RELAYER_FEE.UPPER_BOUND : rawFee;\n * }\n * ```\n *\n * @see {@link PROTOCOL_FEE} for the protocol's fee schedule.\n * @see {@link BPS_DIVISOR} for the basis-point denominator.\n * @public\n */\nexport const RELAYER_FEE = {\n /**\n * Fixed base fee for relayer operations, denominated in the SPL token's smallest unit.\n *\n * @remarks\n * `0n` — relayers do not charge a fixed base fee; they earn purely through BPS.\n *\n * @readonly\n */\n BASE_FEE: 0n,\n /**\n * Proportional fee rate for the relayer, expressed in basis points (1 BPS = 0.01%).\n *\n * @remarks\n * `35n` corresponds to 0.35%. The relayer earns this percentage of the claimed amount\n * as compensation for submitting and funding the MPC callback transaction.\n *\n * @readonly\n */\n BPS: 35n,\n /**\n * Minimum relayer fee. Currently `0n`.\n *\n * @readonly\n */\n LOWER_BOUND: 0n,\n /**\n * Maximum relayer fee (cap). `1_000_000n` token micro-units.\n *\n * @remarks\n * Mirrors the protocol fee cap to ensure the combined fee never exceeds a predictable\n * maximum, protecting users from paying unexpectedly large fees on large claims.\n *\n * @readonly\n */\n UPPER_BOUND: BigInt(\"1000000\"),\n} as const;\n\n/* =============================================================================\n * FEE OFFSET CONFIGURATION\n * ============================================================================= */\n\n/**\n * Offset discriminators used when deriving PDAs for fee-related on-chain accounts.\n *\n * @remarks\n * The Umbra program uses an `offset` field in PDA seeds to allow multiple independent\n * instances of the same account type to coexist (e.g. multiple fee pools for future\n * protocol versions). The offset is encoded as a `U128` little-endian byte array and\n * appended as the final seed when calling `getProgramDerivedAddress`.\n *\n * All offsets are currently `0n` because the protocol uses a single canonical instance\n * of each fee account type. Future upgrades may introduce non-zero offsets for versioned\n * account sets.\n *\n * These values are passed directly to PDA derivation helpers such as\n * `getProtocolOnlyUnifiedFeesPoolPda`, `getRelayerUnifiedFeesPoolPda`, and\n * `getProtocolFeesConfigurationPda`.\n *\n * @example\n * ```typescript\n * import { FEE_OFFSETS } from \"@umbra-privacy/sdk\";\n * import { getProtocolFeesConfigurationPda } from \"@umbra-privacy/sdk/pda\";\n *\n * const [feeConfigPda] = await getProtocolFeesConfigurationPda(\n * instructionSeed as U128,\n * mintAddress,\n * FEE_OFFSETS.PROTOCOL_FEES_CONFIG as U128,\n * programId,\n * );\n * ```\n *\n * @see {@link getProtocolOnlyUnifiedFeesPoolPda} for protocol-only pool PDA derivation.\n * @see {@link getRelayerUnifiedFeesPoolPda} for relayer pool PDA derivation.\n * @see {@link getProtocolFeesConfigurationPda} for fee config PDA derivation.\n * @public\n */\nexport const FEE_OFFSETS = {\n /**\n * Offset used in `UnifiedFeesPool` PDA derivation for the unified protocol fees pool.\n *\n * @remarks\n * Passed as the final seed to `getProtocolOnlyUnifiedFeesPoolPda` and\n * `getRelayerUnifiedFeesPoolPda`. Currently `0n`.\n *\n * @readonly\n */\n PROTOCOL_FEES_POOL: 0n,\n /**\n * Offset used in `ProtocolFeesConfiguration` PDA derivation.\n *\n * @remarks\n * Passed as the final seed to `getProtocolFeesConfigurationPda`. Currently `0n`.\n *\n * @readonly\n */\n PROTOCOL_FEES_CONFIG: 0n,\n /**\n * Offset used in relayer fee configuration PDA derivation.\n *\n * @remarks\n * Passed as the offset seed when looking up the relayer's fee configuration account.\n * Currently `0n`.\n *\n * @readonly\n */\n RELAYER_FEES_CONFIG: 0n,\n} as const;\n\n/* =============================================================================\n * FEE CALCULATION CONSTANTS\n * ============================================================================= */\n\n/**\n * Denominator for basis-point fee calculations.\n *\n * @remarks\n * Basis points (BPS) express a fee rate as an integer fraction of 10,000.\n * For example, 35 BPS = 35 / 10,000 = 0.35%.\n *\n * To convert a BPS fee rate to a proportional fee amount:\n * ```\n * proportionalFee = floor(amount * bps / BPS_DIVISOR)\n * ```\n *\n * Using integer division (`/` on `bigint`) automatically floors the result, which is\n * the correct behaviour for fee deductions (always round down in favour of the user).\n *\n * @example\n * ```typescript\n * import { BPS_DIVISOR, PROTOCOL_FEE } from \"@umbra-privacy/sdk\";\n *\n * const amount = 1_000_000n; // 1 USDC in micro-units\n * const proportionalFee = (amount * PROTOCOL_FEE.BPS) / BPS_DIVISOR;\n * // proportionalFee = 1_000_000n * 35n / 10_000n = 3_500n (0.0035 USDC)\n * ```\n *\n * @public\n */\nexport const BPS_DIVISOR = 10_000n;\n"]}