veilix-sdk 0.0.5 → 0.0.7

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../package.json","../../src/circuits/constants.ts","../../src/circuits/paths.ts"],"names":[],"mappings":";;;;AAAA,IAAA,eAAA,GAAA;AAAA,EACE,IAAA,EAAQ,YAiGV,CAAA;;;AC/FO,IAAM,eAAe,eAAA,CAAY;AAMjC,IAAM,qBAAA,GAAwB;AAC9B,IAAM,qBAAA,GAAwB;AAK9B,IAAM,uBAAA,GAA0B;AAAA,EACrC,IAAA,EAAM,kEAAA;AAAA,EACN,IAAA,EAAM;AACR;AAGO,IAAM,wBAAA,GAA2B;AAUjC,IAAM,mBAAA,GAAsB,YAAA;AAC5B,IAAM,mBAAA,GAAsB,OAAA;AAQ5B,SAAS,4BAA4B,IAAA,EAA4B;AACtE,EAAA,MAAM,OAAO,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,GAAI,IAAA,GAAO,GAAG,IAAI,CAAA,CAAA,CAAA;AAChD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA,CAAA;AAAA,IAC9C,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA;AAAA,GAChD;AACF;AASO,SAAS,wBAAA,GAAmC;AACjD,EAAA,OAAO,CAAA,6BAAA,EAAgC,mBAAmB,CAAA,CAAA,EAAI,mBAAmB,CAAA,eAAA,CAAA;AACnF;AAGO,SAAS,yBAAA,GAA0C;AACxD,EAAA,MAAM,OAAO,wBAAA,EAAyB;AACtC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,IACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,GACvC;AACF;AAEA,SAAS,eAAe,QAAA,EAA2B;AACjD,EAAA,OACE,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,OAAA;AAEjB;AAcO,SAAS,2BACd,YAAA,EACqB;AACrB,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,OAAO,4BAA4B,YAAY,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,cAAA,CAAe,MAAA,CAAO,QAAA,CAAS,QAAQ,CAAA,EAAG;AAC5C,IAAA,MAAM,IAAA,GAAO,iBAAiB,YAAY,CAAA,eAAA,CAAA;AAC1C,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,MACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,KACvC;AAAA,EACF;AAEA,EAAA,OAAO,yBAAA,EAA0B;AACnC;;;AC5EO,SAAS,oBAAoB,IAAA,EAA6B;AAC/D,EAAA,IAAI,SAAS,MAAA,EAAW;AACtB,IAAA,OAAO,4BAA4B,IAAI,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,UAAU,0BAAA,EAA2B;AAC3C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,2PAAe,CAAA,CAAE,IAAA;AAAA,IAC7D,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,2PAAe,CAAA,CAAE;AAAA,GAC/D;AACF","file":"paths.cjs","sourcesContent":["{\n \"name\": \"veilix-sdk\",\n \"version\": \"0.0.5\",\n \"description\": \"Veilix Privacy SDK\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"sideEffects\": false,\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./circuits/paths\": {\n \"import\": \"./dist/circuits/paths.js\",\n \"require\": \"./dist/circuits/paths.cjs\",\n \"default\": \"./dist/circuits/paths.js\"\n },\n \"./circuits/*\": \"./dist/circuits/*\",\n \"./vite\": {\n \"import\": {\n \"types\": \"./dist/vite/index.d.ts\",\n \"default\": \"./dist/vite/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/vite/index.d.cts\",\n \"default\": \"./dist/vite/index.cjs\"\n }\n },\n \"./react\": {\n \"import\": {\n \"types\": \"./dist/react/index.d.ts\",\n \"default\": \"./dist/react/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/react/index.d.cts\",\n \"default\": \"./dist/react/index.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"peerDependencies\": {\n \"@solana/wallet-adapter-react\": \">=0.15.0\",\n \"react\": \">=18\"\n },\n \"peerDependenciesMeta\": {\n \"@solana/wallet-adapter-react\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"prepare:snarkjs\": \"node scripts/prepare-snarkjs.mjs\",\n \"build\": \"npm run prepare:snarkjs && tsup\",\n \"dev\": \"npm run prepare:snarkjs && tsup --watch\",\n \"typecheck\": \"npm run prepare:snarkjs && tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"keywords\": [\n \"veilix-sdk\",\n \"sdk\"\n ],\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"@solana/wallet-adapter-react\": \"^0.15.39\",\n \"@types/node\": \"^26.0.0\",\n \"@types/react\": \"^19.1.8\",\n \"react\": \"^19.1.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.3\"\n },\n \"engines\": {\n \"node\": \">=18\"\n },\n \"dependencies\": {\n \"@coral-xyz/anchor\": \"^0.31.1\",\n \"@solana/spl-token\": \"^0.4.14\",\n \"@solana/web3.js\": \"^1.98.4\",\n \"@switchboard-xyz/common\": \"^5.8.1\",\n \"@switchboard-xyz/on-demand\": \"^3.10.1\",\n \"buffer\": \"^6.0.3\",\n \"ffjavascript\": \"^0.3.1\",\n \"fixed-merkle-tree\": \"^0.7.3\",\n \"poseidon-hash\": \"^1.0.1\",\n \"tweetnacl\": \"^1.0.3\"\n }\n}\n","import packageJson from \"../../package.json\";\n\n/** npm package name (used to load the standalone circuits module). */\nexport const PACKAGE_NAME = packageJson.name;\n\n/** Published npm version (pins CDN circuit URLs in production). */\nexport const PACKAGE_VERSION = packageJson.version;\n\n/** Withdraw circuit artifact filenames (published under `veilix-sdk/circuits/`). */\nexport const WITHDRAW_CIRCUIT_WASM = \"withdraw.wasm\";\nexport const WITHDRAW_CIRCUIT_ZKEY = \"withdraw.zkey\";\n/**\n * Pinned SHA-256 hashes for the published withdraw circuit artifacts.\n * These are verified in-browser before passing artifacts to snarkjs.\n */\nexport const WITHDRAW_CIRCUIT_SHA256 = {\n wasm: \"2565a8dd94b0b3cb9ec6d415933ab05ed5d32ac07165b71be6bcf31615fc0330\",\n zkey: \"64a4d915099f6fe6bfa06e151c254843be8773c7991c742260019dc5184e5d82\",\n} as const;\n\n/** Optional self-hosted path convention (opt-in via `circuitPathsBase`). */\nexport const SELF_HOSTED_CIRCUIT_BASE = \"/circuits/\";\n\n/**\n * Stable published source for the pinned circuit artifacts.\n *\n * Decoupled from {@link PACKAGE_VERSION} on purpose: the withdraw circuit is a\n * fixed cryptographic artifact, so SDK code releases must not change where the\n * verified circuits are fetched from. Bump these together with\n * {@link WITHDRAW_CIRCUIT_SHA256} only when the circuit itself changes.\n */\nexport const CIRCUIT_CDN_PACKAGE = \"veilix-sdk\";\nexport const CIRCUIT_CDN_VERSION = \"0.0.4\";\n\nexport type CircuitPaths = {\n wasm: string;\n zkey: string;\n};\n\n/** Resolve circuit URLs when the caller knows the package `dist/` root. */\nexport function resolveCircuitPathsFromBase(base: string): CircuitPaths {\n const root = base.endsWith(\"/\") ? base : `${base}/`;\n return {\n wasm: `${root}circuits/${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${root}circuits/${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\n/**\n * Base URL for circuit files on jsDelivr.\n *\n * Pinned to {@link CIRCUIT_CDN_PACKAGE}@{@link CIRCUIT_CDN_VERSION} (not the\n * current SDK version) so the bytes always match {@link WITHDRAW_CIRCUIT_SHA256}.\n * This URL is independent of the consuming app's origin/domain.\n */\nexport function resolveNpmCdnCircuitBase(): string {\n return `https://cdn.jsdelivr.net/npm/${CIRCUIT_CDN_PACKAGE}@${CIRCUIT_CDN_VERSION}/dist/circuits/`;\n}\n\n/** Trusted jsDelivr fallback paths for pinned withdraw circuit artifacts. */\nexport function resolveNpmCdnCircuitPaths(): CircuitPaths {\n const base = resolveNpmCdnCircuitBase();\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\nfunction isLocalDevHost(hostname: string): boolean {\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n );\n}\n\n/**\n * Browser circuit URLs.\n *\n * - Local dev (Vite): `/node_modules/<pkg>/dist/circuits/` — Vite serves node_modules.\n * - Production: pinned, domain-independent jsDelivr CDN (verified by SHA-256 before use).\n *\n * The production default does not depend on the app's own origin/domain, so it\n * works on any deployed host with no copy step. Artifacts are always integrity\n * checked before proving (see {@link WITHDRAW_CIRCUIT_SHA256}). To self-host\n * instead, pass {@link VeilixSdkInitOptions.circuitPathsBase} (e.g. `\"/circuits/\"`);\n * it is verified too and falls back to the CDN if unavailable.\n */\nexport function resolveBrowserCircuitPaths(\n baseOverride?: string\n): CircuitPaths | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n if (baseOverride !== undefined) {\n return resolveCircuitPathsFromBase(baseOverride);\n }\n\n if (isLocalDevHost(window.location.hostname)) {\n const base = `/node_modules/${PACKAGE_NAME}/dist/circuits/`;\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n }\n\n return resolveNpmCdnCircuitPaths();\n}\n","import {\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n type CircuitPaths,\n} from \"./constants\";\n\nexport {\n PACKAGE_NAME,\n SELF_HOSTED_CIRCUIT_BASE,\n WITHDRAW_CIRCUIT_SHA256,\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n resolveNpmCdnCircuitPaths,\n resolveNpmCdnCircuitBase,\n type CircuitPaths,\n} from \"./constants\";\n\n/**\n * Resolve default Groth16 circuit URLs.\n *\n * Published as `veilix-sdk/circuits/paths` so `import.meta.url` stays next to\n * `withdraw.wasm` and `withdraw.zkey` in `dist/circuits/` (Node / unbundled ESM).\n *\n * In the browser, defaults to `/node_modules/<pkg>/dist/circuits/` on localhost\n * and the pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).\n * Override via {@link VeilixSdkInitOptions.circuitPathsBase},\n * {@link resolveCircuitPathsFromBase}, or {@link GenerateWithdrawProofOptions}.\n */\nexport function resolveCircuitPaths(base?: string): CircuitPaths {\n if (base !== undefined) {\n return resolveCircuitPathsFromBase(base);\n }\n\n const browser = resolveBrowserCircuitPaths();\n if (browser) {\n return browser;\n }\n\n return {\n wasm: new URL(`./${WITHDRAW_CIRCUIT_WASM}`, import.meta.url).href,\n zkey: new URL(`./${WITHDRAW_CIRCUIT_ZKEY}`, import.meta.url).href,\n };\n}\n"]}
1
+ {"version":3,"sources":["../../package.json","../../src/circuits/constants.ts","../../src/circuits/paths.ts"],"names":[],"mappings":";;;;AAAA,IAAA,eAAA,GAAA;AAAA,EACE,IAAA,EAAQ,YAiGV,CAAA;;;AC/FO,IAAM,eAAe,eAAA,CAAY;AAMjC,IAAM,qBAAA,GAAwB;AAC9B,IAAM,qBAAA,GAAwB;AAK9B,IAAM,uBAAA,GAA0B;AAAA,EACrC,IAAA,EAAM,kEAAA;AAAA,EACN,IAAA,EAAM;AACR;AAGO,IAAM,wBAAA,GAA2B;AAUjC,IAAM,mBAAA,GAAsB,YAAA;AAC5B,IAAM,mBAAA,GAAsB,OAAA;AAQ5B,SAAS,4BAA4B,IAAA,EAA4B;AACtE,EAAA,MAAM,OAAO,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,GAAI,IAAA,GAAO,GAAG,IAAI,CAAA,CAAA,CAAA;AAChD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA,CAAA;AAAA,IAC9C,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA;AAAA,GAChD;AACF;AASO,SAAS,wBAAA,GAAmC;AACjD,EAAA,OAAO,CAAA,6BAAA,EAAgC,mBAAmB,CAAA,CAAA,EAAI,mBAAmB,CAAA,eAAA,CAAA;AACnF;AAGO,SAAS,yBAAA,GAA0C;AACxD,EAAA,MAAM,OAAO,wBAAA,EAAyB;AACtC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,IACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,GACvC;AACF;AAEA,SAAS,eAAe,QAAA,EAA2B;AACjD,EAAA,OACE,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,OAAA;AAEjB;AAcO,SAAS,2BACd,YAAA,EACqB;AACrB,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,OAAO,4BAA4B,YAAY,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,cAAA,CAAe,MAAA,CAAO,QAAA,CAAS,QAAQ,CAAA,EAAG;AAC5C,IAAA,MAAM,IAAA,GAAO,iBAAiB,YAAY,CAAA,eAAA,CAAA;AAC1C,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,MACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,KACvC;AAAA,EACF;AAEA,EAAA,OAAO,yBAAA,EAA0B;AACnC;;;AC5EO,SAAS,oBAAoB,IAAA,EAA6B;AAC/D,EAAA,IAAI,SAAS,MAAA,EAAW;AACtB,IAAA,OAAO,4BAA4B,IAAI,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,UAAU,0BAAA,EAA2B;AAC3C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,2PAAe,CAAA,CAAE,IAAA;AAAA,IAC7D,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,2PAAe,CAAA,CAAE;AAAA,GAC/D;AACF","file":"paths.cjs","sourcesContent":["{\n \"name\": \"veilix-sdk\",\n \"version\": \"0.0.7\",\n \"description\": \"Veilix Privacy SDK\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"sideEffects\": false,\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./circuits/paths\": {\n \"import\": \"./dist/circuits/paths.js\",\n \"require\": \"./dist/circuits/paths.cjs\",\n \"default\": \"./dist/circuits/paths.js\"\n },\n \"./circuits/*\": \"./dist/circuits/*\",\n \"./vite\": {\n \"import\": {\n \"types\": \"./dist/vite/index.d.ts\",\n \"default\": \"./dist/vite/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/vite/index.d.cts\",\n \"default\": \"./dist/vite/index.cjs\"\n }\n },\n \"./react\": {\n \"import\": {\n \"types\": \"./dist/react/index.d.ts\",\n \"default\": \"./dist/react/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/react/index.d.cts\",\n \"default\": \"./dist/react/index.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"peerDependencies\": {\n \"@solana/wallet-adapter-react\": \">=0.15.0\",\n \"react\": \">=18\"\n },\n \"peerDependenciesMeta\": {\n \"@solana/wallet-adapter-react\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"prepare:snarkjs\": \"node scripts/prepare-snarkjs.mjs\",\n \"build\": \"npm run prepare:snarkjs && tsup\",\n \"dev\": \"npm run prepare:snarkjs && tsup --watch\",\n \"typecheck\": \"npm run prepare:snarkjs && tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"keywords\": [\n \"veilix-sdk\",\n \"sdk\"\n ],\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"@solana/wallet-adapter-react\": \"^0.15.39\",\n \"@types/node\": \"^26.0.0\",\n \"@types/react\": \"^19.1.8\",\n \"react\": \"^19.1.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.3\"\n },\n \"engines\": {\n \"node\": \">=18\"\n },\n \"dependencies\": {\n \"@coral-xyz/anchor\": \"^0.31.1\",\n \"@solana/spl-token\": \"^0.4.14\",\n \"@solana/web3.js\": \"^1.98.4\",\n \"@switchboard-xyz/common\": \"^5.8.1\",\n \"@switchboard-xyz/on-demand\": \"^3.10.1\",\n \"buffer\": \"^6.0.3\",\n \"ffjavascript\": \"^0.3.1\",\n \"fixed-merkle-tree\": \"^0.7.3\",\n \"poseidon-hash\": \"^1.0.1\",\n \"tweetnacl\": \"^1.0.3\"\n }\n}\n","import packageJson from \"../../package.json\";\n\n/** npm package name (used to load the standalone circuits module). */\nexport const PACKAGE_NAME = packageJson.name;\n\n/** Published npm version (pins CDN circuit URLs in production). */\nexport const PACKAGE_VERSION = packageJson.version;\n\n/** Withdraw circuit artifact filenames (published under `veilix-sdk/circuits/`). */\nexport const WITHDRAW_CIRCUIT_WASM = \"withdraw.wasm\";\nexport const WITHDRAW_CIRCUIT_ZKEY = \"withdraw.zkey\";\n/**\n * Pinned SHA-256 hashes for the published withdraw circuit artifacts.\n * These are verified in-browser before passing artifacts to snarkjs.\n */\nexport const WITHDRAW_CIRCUIT_SHA256 = {\n wasm: \"2565a8dd94b0b3cb9ec6d415933ab05ed5d32ac07165b71be6bcf31615fc0330\",\n zkey: \"64a4d915099f6fe6bfa06e151c254843be8773c7991c742260019dc5184e5d82\",\n} as const;\n\n/** Optional self-hosted path convention (opt-in via `circuitPathsBase`). */\nexport const SELF_HOSTED_CIRCUIT_BASE = \"/circuits/\";\n\n/**\n * Stable published source for the pinned circuit artifacts.\n *\n * Decoupled from {@link PACKAGE_VERSION} on purpose: the withdraw circuit is a\n * fixed cryptographic artifact, so SDK code releases must not change where the\n * verified circuits are fetched from. Bump these together with\n * {@link WITHDRAW_CIRCUIT_SHA256} only when the circuit itself changes.\n */\nexport const CIRCUIT_CDN_PACKAGE = \"veilix-sdk\";\nexport const CIRCUIT_CDN_VERSION = \"0.0.4\";\n\nexport type CircuitPaths = {\n wasm: string;\n zkey: string;\n};\n\n/** Resolve circuit URLs when the caller knows the package `dist/` root. */\nexport function resolveCircuitPathsFromBase(base: string): CircuitPaths {\n const root = base.endsWith(\"/\") ? base : `${base}/`;\n return {\n wasm: `${root}circuits/${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${root}circuits/${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\n/**\n * Base URL for circuit files on jsDelivr.\n *\n * Pinned to {@link CIRCUIT_CDN_PACKAGE}@{@link CIRCUIT_CDN_VERSION} (not the\n * current SDK version) so the bytes always match {@link WITHDRAW_CIRCUIT_SHA256}.\n * This URL is independent of the consuming app's origin/domain.\n */\nexport function resolveNpmCdnCircuitBase(): string {\n return `https://cdn.jsdelivr.net/npm/${CIRCUIT_CDN_PACKAGE}@${CIRCUIT_CDN_VERSION}/dist/circuits/`;\n}\n\n/** Trusted jsDelivr fallback paths for pinned withdraw circuit artifacts. */\nexport function resolveNpmCdnCircuitPaths(): CircuitPaths {\n const base = resolveNpmCdnCircuitBase();\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\nfunction isLocalDevHost(hostname: string): boolean {\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n );\n}\n\n/**\n * Browser circuit URLs.\n *\n * - Local dev (Vite): `/node_modules/<pkg>/dist/circuits/` — Vite serves node_modules.\n * - Production: pinned, domain-independent jsDelivr CDN (verified by SHA-256 before use).\n *\n * The production default does not depend on the app's own origin/domain, so it\n * works on any deployed host with no copy step. Artifacts are always integrity\n * checked before proving (see {@link WITHDRAW_CIRCUIT_SHA256}). To self-host\n * instead, pass {@link VeilixSdkInitOptions.circuitPathsBase} (e.g. `\"/circuits/\"`);\n * it is verified too and falls back to the CDN if unavailable.\n */\nexport function resolveBrowserCircuitPaths(\n baseOverride?: string\n): CircuitPaths | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n if (baseOverride !== undefined) {\n return resolveCircuitPathsFromBase(baseOverride);\n }\n\n if (isLocalDevHost(window.location.hostname)) {\n const base = `/node_modules/${PACKAGE_NAME}/dist/circuits/`;\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n }\n\n return resolveNpmCdnCircuitPaths();\n}\n","import {\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n type CircuitPaths,\n} from \"./constants\";\n\nexport {\n PACKAGE_NAME,\n SELF_HOSTED_CIRCUIT_BASE,\n WITHDRAW_CIRCUIT_SHA256,\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n resolveNpmCdnCircuitPaths,\n resolveNpmCdnCircuitBase,\n type CircuitPaths,\n} from \"./constants\";\n\n/**\n * Resolve default Groth16 circuit URLs.\n *\n * Published as `veilix-sdk/circuits/paths` so `import.meta.url` stays next to\n * `withdraw.wasm` and `withdraw.zkey` in `dist/circuits/` (Node / unbundled ESM).\n *\n * In the browser, defaults to `/node_modules/<pkg>/dist/circuits/` on localhost\n * and the pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).\n * Override via {@link VeilixSdkInitOptions.circuitPathsBase},\n * {@link resolveCircuitPathsFromBase}, or {@link GenerateWithdrawProofOptions}.\n */\nexport function resolveCircuitPaths(base?: string): CircuitPaths {\n if (base !== undefined) {\n return resolveCircuitPathsFromBase(base);\n }\n\n const browser = resolveBrowserCircuitPaths();\n if (browser) {\n return browser;\n }\n\n return {\n wasm: new URL(`./${WITHDRAW_CIRCUIT_WASM}`, import.meta.url).href,\n zkey: new URL(`./${WITHDRAW_CIRCUIT_ZKEY}`, import.meta.url).href,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../package.json","../../src/circuits/constants.ts","../../src/circuits/paths.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EACE,IAAA,EAAQ,YAiGV,CAAA;;;AC/FO,IAAM,eAAe,eAAA,CAAY;AAMjC,IAAM,qBAAA,GAAwB;AAC9B,IAAM,qBAAA,GAAwB;AAK9B,IAAM,uBAAA,GAA0B;AAAA,EACrC,IAAA,EAAM,kEAAA;AAAA,EACN,IAAA,EAAM;AACR;AAGO,IAAM,wBAAA,GAA2B;AAUjC,IAAM,mBAAA,GAAsB,YAAA;AAC5B,IAAM,mBAAA,GAAsB,OAAA;AAQ5B,SAAS,4BAA4B,IAAA,EAA4B;AACtE,EAAA,MAAM,OAAO,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,GAAI,IAAA,GAAO,GAAG,IAAI,CAAA,CAAA,CAAA;AAChD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA,CAAA;AAAA,IAC9C,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA;AAAA,GAChD;AACF;AASO,SAAS,wBAAA,GAAmC;AACjD,EAAA,OAAO,CAAA,6BAAA,EAAgC,mBAAmB,CAAA,CAAA,EAAI,mBAAmB,CAAA,eAAA,CAAA;AACnF;AAGO,SAAS,yBAAA,GAA0C;AACxD,EAAA,MAAM,OAAO,wBAAA,EAAyB;AACtC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,IACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,GACvC;AACF;AAEA,SAAS,eAAe,QAAA,EAA2B;AACjD,EAAA,OACE,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,OAAA;AAEjB;AAcO,SAAS,2BACd,YAAA,EACqB;AACrB,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,OAAO,4BAA4B,YAAY,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,cAAA,CAAe,MAAA,CAAO,QAAA,CAAS,QAAQ,CAAA,EAAG;AAC5C,IAAA,MAAM,IAAA,GAAO,iBAAiB,YAAY,CAAA,eAAA,CAAA;AAC1C,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,MACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,KACvC;AAAA,EACF;AAEA,EAAA,OAAO,yBAAA,EAA0B;AACnC;;;AC5EO,SAAS,oBAAoB,IAAA,EAA6B;AAC/D,EAAA,IAAI,SAAS,MAAA,EAAW;AACtB,IAAA,OAAO,4BAA4B,IAAI,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,UAAU,0BAAA,EAA2B;AAC3C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAE,IAAA;AAAA,IAC7D,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAE;AAAA,GAC/D;AACF","file":"paths.js","sourcesContent":["{\n \"name\": \"veilix-sdk\",\n \"version\": \"0.0.5\",\n \"description\": \"Veilix Privacy SDK\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"sideEffects\": false,\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./circuits/paths\": {\n \"import\": \"./dist/circuits/paths.js\",\n \"require\": \"./dist/circuits/paths.cjs\",\n \"default\": \"./dist/circuits/paths.js\"\n },\n \"./circuits/*\": \"./dist/circuits/*\",\n \"./vite\": {\n \"import\": {\n \"types\": \"./dist/vite/index.d.ts\",\n \"default\": \"./dist/vite/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/vite/index.d.cts\",\n \"default\": \"./dist/vite/index.cjs\"\n }\n },\n \"./react\": {\n \"import\": {\n \"types\": \"./dist/react/index.d.ts\",\n \"default\": \"./dist/react/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/react/index.d.cts\",\n \"default\": \"./dist/react/index.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"peerDependencies\": {\n \"@solana/wallet-adapter-react\": \">=0.15.0\",\n \"react\": \">=18\"\n },\n \"peerDependenciesMeta\": {\n \"@solana/wallet-adapter-react\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"prepare:snarkjs\": \"node scripts/prepare-snarkjs.mjs\",\n \"build\": \"npm run prepare:snarkjs && tsup\",\n \"dev\": \"npm run prepare:snarkjs && tsup --watch\",\n \"typecheck\": \"npm run prepare:snarkjs && tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"keywords\": [\n \"veilix-sdk\",\n \"sdk\"\n ],\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"@solana/wallet-adapter-react\": \"^0.15.39\",\n \"@types/node\": \"^26.0.0\",\n \"@types/react\": \"^19.1.8\",\n \"react\": \"^19.1.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.3\"\n },\n \"engines\": {\n \"node\": \">=18\"\n },\n \"dependencies\": {\n \"@coral-xyz/anchor\": \"^0.31.1\",\n \"@solana/spl-token\": \"^0.4.14\",\n \"@solana/web3.js\": \"^1.98.4\",\n \"@switchboard-xyz/common\": \"^5.8.1\",\n \"@switchboard-xyz/on-demand\": \"^3.10.1\",\n \"buffer\": \"^6.0.3\",\n \"ffjavascript\": \"^0.3.1\",\n \"fixed-merkle-tree\": \"^0.7.3\",\n \"poseidon-hash\": \"^1.0.1\",\n \"tweetnacl\": \"^1.0.3\"\n }\n}\n","import packageJson from \"../../package.json\";\n\n/** npm package name (used to load the standalone circuits module). */\nexport const PACKAGE_NAME = packageJson.name;\n\n/** Published npm version (pins CDN circuit URLs in production). */\nexport const PACKAGE_VERSION = packageJson.version;\n\n/** Withdraw circuit artifact filenames (published under `veilix-sdk/circuits/`). */\nexport const WITHDRAW_CIRCUIT_WASM = \"withdraw.wasm\";\nexport const WITHDRAW_CIRCUIT_ZKEY = \"withdraw.zkey\";\n/**\n * Pinned SHA-256 hashes for the published withdraw circuit artifacts.\n * These are verified in-browser before passing artifacts to snarkjs.\n */\nexport const WITHDRAW_CIRCUIT_SHA256 = {\n wasm: \"2565a8dd94b0b3cb9ec6d415933ab05ed5d32ac07165b71be6bcf31615fc0330\",\n zkey: \"64a4d915099f6fe6bfa06e151c254843be8773c7991c742260019dc5184e5d82\",\n} as const;\n\n/** Optional self-hosted path convention (opt-in via `circuitPathsBase`). */\nexport const SELF_HOSTED_CIRCUIT_BASE = \"/circuits/\";\n\n/**\n * Stable published source for the pinned circuit artifacts.\n *\n * Decoupled from {@link PACKAGE_VERSION} on purpose: the withdraw circuit is a\n * fixed cryptographic artifact, so SDK code releases must not change where the\n * verified circuits are fetched from. Bump these together with\n * {@link WITHDRAW_CIRCUIT_SHA256} only when the circuit itself changes.\n */\nexport const CIRCUIT_CDN_PACKAGE = \"veilix-sdk\";\nexport const CIRCUIT_CDN_VERSION = \"0.0.4\";\n\nexport type CircuitPaths = {\n wasm: string;\n zkey: string;\n};\n\n/** Resolve circuit URLs when the caller knows the package `dist/` root. */\nexport function resolveCircuitPathsFromBase(base: string): CircuitPaths {\n const root = base.endsWith(\"/\") ? base : `${base}/`;\n return {\n wasm: `${root}circuits/${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${root}circuits/${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\n/**\n * Base URL for circuit files on jsDelivr.\n *\n * Pinned to {@link CIRCUIT_CDN_PACKAGE}@{@link CIRCUIT_CDN_VERSION} (not the\n * current SDK version) so the bytes always match {@link WITHDRAW_CIRCUIT_SHA256}.\n * This URL is independent of the consuming app's origin/domain.\n */\nexport function resolveNpmCdnCircuitBase(): string {\n return `https://cdn.jsdelivr.net/npm/${CIRCUIT_CDN_PACKAGE}@${CIRCUIT_CDN_VERSION}/dist/circuits/`;\n}\n\n/** Trusted jsDelivr fallback paths for pinned withdraw circuit artifacts. */\nexport function resolveNpmCdnCircuitPaths(): CircuitPaths {\n const base = resolveNpmCdnCircuitBase();\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\nfunction isLocalDevHost(hostname: string): boolean {\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n );\n}\n\n/**\n * Browser circuit URLs.\n *\n * - Local dev (Vite): `/node_modules/<pkg>/dist/circuits/` — Vite serves node_modules.\n * - Production: pinned, domain-independent jsDelivr CDN (verified by SHA-256 before use).\n *\n * The production default does not depend on the app's own origin/domain, so it\n * works on any deployed host with no copy step. Artifacts are always integrity\n * checked before proving (see {@link WITHDRAW_CIRCUIT_SHA256}). To self-host\n * instead, pass {@link VeilixSdkInitOptions.circuitPathsBase} (e.g. `\"/circuits/\"`);\n * it is verified too and falls back to the CDN if unavailable.\n */\nexport function resolveBrowserCircuitPaths(\n baseOverride?: string\n): CircuitPaths | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n if (baseOverride !== undefined) {\n return resolveCircuitPathsFromBase(baseOverride);\n }\n\n if (isLocalDevHost(window.location.hostname)) {\n const base = `/node_modules/${PACKAGE_NAME}/dist/circuits/`;\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n }\n\n return resolveNpmCdnCircuitPaths();\n}\n","import {\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n type CircuitPaths,\n} from \"./constants\";\n\nexport {\n PACKAGE_NAME,\n SELF_HOSTED_CIRCUIT_BASE,\n WITHDRAW_CIRCUIT_SHA256,\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n resolveNpmCdnCircuitPaths,\n resolveNpmCdnCircuitBase,\n type CircuitPaths,\n} from \"./constants\";\n\n/**\n * Resolve default Groth16 circuit URLs.\n *\n * Published as `veilix-sdk/circuits/paths` so `import.meta.url` stays next to\n * `withdraw.wasm` and `withdraw.zkey` in `dist/circuits/` (Node / unbundled ESM).\n *\n * In the browser, defaults to `/node_modules/<pkg>/dist/circuits/` on localhost\n * and the pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).\n * Override via {@link VeilixSdkInitOptions.circuitPathsBase},\n * {@link resolveCircuitPathsFromBase}, or {@link GenerateWithdrawProofOptions}.\n */\nexport function resolveCircuitPaths(base?: string): CircuitPaths {\n if (base !== undefined) {\n return resolveCircuitPathsFromBase(base);\n }\n\n const browser = resolveBrowserCircuitPaths();\n if (browser) {\n return browser;\n }\n\n return {\n wasm: new URL(`./${WITHDRAW_CIRCUIT_WASM}`, import.meta.url).href,\n zkey: new URL(`./${WITHDRAW_CIRCUIT_ZKEY}`, import.meta.url).href,\n };\n}\n"]}
1
+ {"version":3,"sources":["../../package.json","../../src/circuits/constants.ts","../../src/circuits/paths.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EACE,IAAA,EAAQ,YAiGV,CAAA;;;AC/FO,IAAM,eAAe,eAAA,CAAY;AAMjC,IAAM,qBAAA,GAAwB;AAC9B,IAAM,qBAAA,GAAwB;AAK9B,IAAM,uBAAA,GAA0B;AAAA,EACrC,IAAA,EAAM,kEAAA;AAAA,EACN,IAAA,EAAM;AACR;AAGO,IAAM,wBAAA,GAA2B;AAUjC,IAAM,mBAAA,GAAsB,YAAA;AAC5B,IAAM,mBAAA,GAAsB,OAAA;AAQ5B,SAAS,4BAA4B,IAAA,EAA4B;AACtE,EAAA,MAAM,OAAO,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,GAAI,IAAA,GAAO,GAAG,IAAI,CAAA,CAAA,CAAA;AAChD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA,CAAA;AAAA,IAC9C,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,qBAAqB,CAAA;AAAA,GAChD;AACF;AASO,SAAS,wBAAA,GAAmC;AACjD,EAAA,OAAO,CAAA,6BAAA,EAAgC,mBAAmB,CAAA,CAAA,EAAI,mBAAmB,CAAA,eAAA,CAAA;AACnF;AAGO,SAAS,yBAAA,GAA0C;AACxD,EAAA,MAAM,OAAO,wBAAA,EAAyB;AACtC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,IACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,GACvC;AACF;AAEA,SAAS,eAAe,QAAA,EAA2B;AACjD,EAAA,OACE,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,WAAA,IACb,QAAA,KAAa,OAAA;AAEjB;AAcO,SAAS,2BACd,YAAA,EACqB;AACrB,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,IAAA,OAAO,4BAA4B,YAAY,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,cAAA,CAAe,MAAA,CAAO,QAAA,CAAS,QAAQ,CAAA,EAAG;AAC5C,IAAA,MAAM,IAAA,GAAO,iBAAiB,YAAY,CAAA,eAAA,CAAA;AAC1C,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA,CAAA;AAAA,MACrC,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,EAAG,qBAAqB,CAAA;AAAA,KACvC;AAAA,EACF;AAEA,EAAA,OAAO,yBAAA,EAA0B;AACnC;;;AC5EO,SAAS,oBAAoB,IAAA,EAA6B;AAC/D,EAAA,IAAI,SAAS,MAAA,EAAW;AACtB,IAAA,OAAO,4BAA4B,IAAI,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,UAAU,0BAAA,EAA2B;AAC3C,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAE,IAAA;AAAA,IAC7D,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA,EAAK,qBAAqB,CAAA,CAAA,EAAI,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAE;AAAA,GAC/D;AACF","file":"paths.js","sourcesContent":["{\n \"name\": \"veilix-sdk\",\n \"version\": \"0.0.7\",\n \"description\": \"Veilix Privacy SDK\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"sideEffects\": false,\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./circuits/paths\": {\n \"import\": \"./dist/circuits/paths.js\",\n \"require\": \"./dist/circuits/paths.cjs\",\n \"default\": \"./dist/circuits/paths.js\"\n },\n \"./circuits/*\": \"./dist/circuits/*\",\n \"./vite\": {\n \"import\": {\n \"types\": \"./dist/vite/index.d.ts\",\n \"default\": \"./dist/vite/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/vite/index.d.cts\",\n \"default\": \"./dist/vite/index.cjs\"\n }\n },\n \"./react\": {\n \"import\": {\n \"types\": \"./dist/react/index.d.ts\",\n \"default\": \"./dist/react/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/react/index.d.cts\",\n \"default\": \"./dist/react/index.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"peerDependencies\": {\n \"@solana/wallet-adapter-react\": \">=0.15.0\",\n \"react\": \">=18\"\n },\n \"peerDependenciesMeta\": {\n \"@solana/wallet-adapter-react\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"prepare:snarkjs\": \"node scripts/prepare-snarkjs.mjs\",\n \"build\": \"npm run prepare:snarkjs && tsup\",\n \"dev\": \"npm run prepare:snarkjs && tsup --watch\",\n \"typecheck\": \"npm run prepare:snarkjs && tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"keywords\": [\n \"veilix-sdk\",\n \"sdk\"\n ],\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"@solana/wallet-adapter-react\": \"^0.15.39\",\n \"@types/node\": \"^26.0.0\",\n \"@types/react\": \"^19.1.8\",\n \"react\": \"^19.1.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.3\"\n },\n \"engines\": {\n \"node\": \">=18\"\n },\n \"dependencies\": {\n \"@coral-xyz/anchor\": \"^0.31.1\",\n \"@solana/spl-token\": \"^0.4.14\",\n \"@solana/web3.js\": \"^1.98.4\",\n \"@switchboard-xyz/common\": \"^5.8.1\",\n \"@switchboard-xyz/on-demand\": \"^3.10.1\",\n \"buffer\": \"^6.0.3\",\n \"ffjavascript\": \"^0.3.1\",\n \"fixed-merkle-tree\": \"^0.7.3\",\n \"poseidon-hash\": \"^1.0.1\",\n \"tweetnacl\": \"^1.0.3\"\n }\n}\n","import packageJson from \"../../package.json\";\n\n/** npm package name (used to load the standalone circuits module). */\nexport const PACKAGE_NAME = packageJson.name;\n\n/** Published npm version (pins CDN circuit URLs in production). */\nexport const PACKAGE_VERSION = packageJson.version;\n\n/** Withdraw circuit artifact filenames (published under `veilix-sdk/circuits/`). */\nexport const WITHDRAW_CIRCUIT_WASM = \"withdraw.wasm\";\nexport const WITHDRAW_CIRCUIT_ZKEY = \"withdraw.zkey\";\n/**\n * Pinned SHA-256 hashes for the published withdraw circuit artifacts.\n * These are verified in-browser before passing artifacts to snarkjs.\n */\nexport const WITHDRAW_CIRCUIT_SHA256 = {\n wasm: \"2565a8dd94b0b3cb9ec6d415933ab05ed5d32ac07165b71be6bcf31615fc0330\",\n zkey: \"64a4d915099f6fe6bfa06e151c254843be8773c7991c742260019dc5184e5d82\",\n} as const;\n\n/** Optional self-hosted path convention (opt-in via `circuitPathsBase`). */\nexport const SELF_HOSTED_CIRCUIT_BASE = \"/circuits/\";\n\n/**\n * Stable published source for the pinned circuit artifacts.\n *\n * Decoupled from {@link PACKAGE_VERSION} on purpose: the withdraw circuit is a\n * fixed cryptographic artifact, so SDK code releases must not change where the\n * verified circuits are fetched from. Bump these together with\n * {@link WITHDRAW_CIRCUIT_SHA256} only when the circuit itself changes.\n */\nexport const CIRCUIT_CDN_PACKAGE = \"veilix-sdk\";\nexport const CIRCUIT_CDN_VERSION = \"0.0.4\";\n\nexport type CircuitPaths = {\n wasm: string;\n zkey: string;\n};\n\n/** Resolve circuit URLs when the caller knows the package `dist/` root. */\nexport function resolveCircuitPathsFromBase(base: string): CircuitPaths {\n const root = base.endsWith(\"/\") ? base : `${base}/`;\n return {\n wasm: `${root}circuits/${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${root}circuits/${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\n/**\n * Base URL for circuit files on jsDelivr.\n *\n * Pinned to {@link CIRCUIT_CDN_PACKAGE}@{@link CIRCUIT_CDN_VERSION} (not the\n * current SDK version) so the bytes always match {@link WITHDRAW_CIRCUIT_SHA256}.\n * This URL is independent of the consuming app's origin/domain.\n */\nexport function resolveNpmCdnCircuitBase(): string {\n return `https://cdn.jsdelivr.net/npm/${CIRCUIT_CDN_PACKAGE}@${CIRCUIT_CDN_VERSION}/dist/circuits/`;\n}\n\n/** Trusted jsDelivr fallback paths for pinned withdraw circuit artifacts. */\nexport function resolveNpmCdnCircuitPaths(): CircuitPaths {\n const base = resolveNpmCdnCircuitBase();\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n}\n\nfunction isLocalDevHost(hostname: string): boolean {\n return (\n hostname === \"localhost\" ||\n hostname === \"127.0.0.1\" ||\n hostname === \"[::1]\"\n );\n}\n\n/**\n * Browser circuit URLs.\n *\n * - Local dev (Vite): `/node_modules/<pkg>/dist/circuits/` — Vite serves node_modules.\n * - Production: pinned, domain-independent jsDelivr CDN (verified by SHA-256 before use).\n *\n * The production default does not depend on the app's own origin/domain, so it\n * works on any deployed host with no copy step. Artifacts are always integrity\n * checked before proving (see {@link WITHDRAW_CIRCUIT_SHA256}). To self-host\n * instead, pass {@link VeilixSdkInitOptions.circuitPathsBase} (e.g. `\"/circuits/\"`);\n * it is verified too and falls back to the CDN if unavailable.\n */\nexport function resolveBrowserCircuitPaths(\n baseOverride?: string\n): CircuitPaths | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n if (baseOverride !== undefined) {\n return resolveCircuitPathsFromBase(baseOverride);\n }\n\n if (isLocalDevHost(window.location.hostname)) {\n const base = `/node_modules/${PACKAGE_NAME}/dist/circuits/`;\n return {\n wasm: `${base}${WITHDRAW_CIRCUIT_WASM}`,\n zkey: `${base}${WITHDRAW_CIRCUIT_ZKEY}`,\n };\n }\n\n return resolveNpmCdnCircuitPaths();\n}\n","import {\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n type CircuitPaths,\n} from \"./constants\";\n\nexport {\n PACKAGE_NAME,\n SELF_HOSTED_CIRCUIT_BASE,\n WITHDRAW_CIRCUIT_SHA256,\n WITHDRAW_CIRCUIT_WASM,\n WITHDRAW_CIRCUIT_ZKEY,\n resolveBrowserCircuitPaths,\n resolveCircuitPathsFromBase,\n resolveNpmCdnCircuitPaths,\n resolveNpmCdnCircuitBase,\n type CircuitPaths,\n} from \"./constants\";\n\n/**\n * Resolve default Groth16 circuit URLs.\n *\n * Published as `veilix-sdk/circuits/paths` so `import.meta.url` stays next to\n * `withdraw.wasm` and `withdraw.zkey` in `dist/circuits/` (Node / unbundled ESM).\n *\n * In the browser, defaults to `/node_modules/<pkg>/dist/circuits/` on localhost\n * and the pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).\n * Override via {@link VeilixSdkInitOptions.circuitPathsBase},\n * {@link resolveCircuitPathsFromBase}, or {@link GenerateWithdrawProofOptions}.\n */\nexport function resolveCircuitPaths(base?: string): CircuitPaths {\n if (base !== undefined) {\n return resolveCircuitPathsFromBase(base);\n }\n\n const browser = resolveBrowserCircuitPaths();\n if (browser) {\n return browser;\n }\n\n return {\n wasm: new URL(`./${WITHDRAW_CIRCUIT_WASM}`, import.meta.url).href,\n zkey: new URL(`./${WITHDRAW_CIRCUIT_ZKEY}`, import.meta.url).href,\n };\n}\n"]}
package/dist/index.cjs CHANGED
@@ -12653,7 +12653,7 @@ function getProgramId() {
12653
12653
  }
12654
12654
  return _programId;
12655
12655
  }
12656
- var CONFIG_SEED = buffer.Buffer.from("veilix-config");
12656
+ var CONFIG_SEED = buffer.Buffer.from("config");
12657
12657
  function getPoolPDA(denominationLamports) {
12658
12658
  const buf = buffer.Buffer.alloc(8);
12659
12659
  buf.writeBigUInt64BE(BigInt(denominationLamports));
@@ -12827,8 +12827,6 @@ async function buildDepositTx({
12827
12827
  }).instruction()
12828
12828
  );
12829
12829
  }
12830
- const { sigVerifyIx } = await getOracleQuote(sender, sender.toBase58());
12831
- ixs.unshift(sigVerifyIx);
12832
12830
  const { blockhash } = await connection.getLatestBlockhash();
12833
12831
  const depositMessage = new web3_js.TransactionMessage({
12834
12832
  payerKey: sender,
@@ -13732,11 +13730,14 @@ async function executeVeilixTransfer(items, tempKeypair) {
13732
13730
  const circuitArtifacts = await prepareWithdrawCircuitArtifacts();
13733
13731
  try {
13734
13732
  const extendBackupPdaNeeded = await isExtendBackupPdaNeeded2(senderPublicKey, allNotes.length);
13735
- const [{ sigVerifyIx }, depositInstructions, initNotesIx] = await Promise.all([
13736
- getOracleQuote(senderPublicKey, senderPublicKey.toBase58()),
13737
- buildDepositInstructionsForNotes2(senderPublicKey, allNotes, tempKeypair.publicKey),
13738
- buildInitNotesInstructionIfNeeded2(senderPublicKey)
13739
- ]);
13733
+ const [depositInstructions, initNotesIx] = (
13734
+ //{ sigVerifyIx },
13735
+ await Promise.all([
13736
+ // getOracleQuote(senderPublicKey, senderPublicKey.toBase58()),
13737
+ buildDepositInstructionsForNotes2(senderPublicKey, allNotes, tempKeypair.publicKey),
13738
+ buildInitNotesInstructionIfNeeded2(senderPublicKey)
13739
+ ])
13740
+ );
13740
13741
  const indexedDeposits = prepared.map((item, index) => ({
13741
13742
  item,
13742
13743
  depositIx: depositInstructions[index]
@@ -13747,7 +13748,7 @@ async function executeVeilixTransfer(items, tempKeypair) {
13747
13748
  Promise.all(
13748
13749
  depositChunks.map(async (batch, batchIndex) => {
13749
13750
  const instructions = [
13750
- sigVerifyIx,
13751
+ // sigVerifyIx,
13751
13752
  ...batch.map((entry) => entry.depositIx)
13752
13753
  ];
13753
13754
  instructions.map((ix) => {