veilix-sdk 0.0.3 → 0.0.4

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.
@@ -73,7 +73,7 @@ declare const prepareCircuitArtifacts: (circuitWasmPath?: string, circuitZkeyPat
73
73
 
74
74
  type Network = "mainnet" | "devnet";
75
75
  declare const MAINNET_TOKEN_MINTS: {
76
- readonly Veilix: "3jSL5nnnYcRLmTqFmwvY1Mikh42fQsT7p7NvXPYzanon";
76
+ readonly Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
77
77
  readonly Bitcoin: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
78
78
  readonly Ethereum: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
79
79
  readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
@@ -294,7 +294,7 @@ declare class VeilixSDK {
294
294
  getRiskApiUrl(): string;
295
295
  getTokenMints(): {
296
296
  Solana: string;
297
- Veilix: "3jSL5nnnYcRLmTqFmwvY1Mikh42fQsT7p7NvXPYzanon" | "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
297
+ Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
298
298
  Bitcoin: "" | "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
299
299
  Ethereum: "" | "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
300
300
  USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" | "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
@@ -73,7 +73,7 @@ declare const prepareCircuitArtifacts: (circuitWasmPath?: string, circuitZkeyPat
73
73
 
74
74
  type Network = "mainnet" | "devnet";
75
75
  declare const MAINNET_TOKEN_MINTS: {
76
- readonly Veilix: "3jSL5nnnYcRLmTqFmwvY1Mikh42fQsT7p7NvXPYzanon";
76
+ readonly Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
77
77
  readonly Bitcoin: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
78
78
  readonly Ethereum: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
79
79
  readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
@@ -294,7 +294,7 @@ declare class VeilixSDK {
294
294
  getRiskApiUrl(): string;
295
295
  getTokenMints(): {
296
296
  Solana: string;
297
- Veilix: "3jSL5nnnYcRLmTqFmwvY1Mikh42fQsT7p7NvXPYzanon" | "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
297
+ Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH";
298
298
  Bitcoin: "" | "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
299
299
  Ethereum: "" | "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
300
300
  USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" | "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
@@ -15,7 +15,7 @@ var WITHDRAW_CIRCUIT_SHA256 = {
15
15
  };
16
16
  var SELF_HOSTED_CIRCUIT_BASE = "/circuits/";
17
17
  var CIRCUIT_CDN_PACKAGE = "veilix-sdk";
18
- var CIRCUIT_CDN_VERSION = "0.0.2";
18
+ var CIRCUIT_CDN_VERSION = "0.0.3";
19
19
  function resolveCircuitPathsFromBase(base) {
20
20
  const root = base.endsWith("/") ? base : `${base}/`;
21
21
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../package.json","../../src/circuits/constants.ts","../../src/circuits/paths.ts"],"names":[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;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.3\",\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.2\";\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,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,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.4\",\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.3\";\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"]}
@@ -12,7 +12,7 @@ var WITHDRAW_CIRCUIT_SHA256 = {
12
12
  };
13
13
  var SELF_HOSTED_CIRCUIT_BASE = "/circuits/";
14
14
  var CIRCUIT_CDN_PACKAGE = "veilix-sdk";
15
- var CIRCUIT_CDN_VERSION = "0.0.2";
15
+ var CIRCUIT_CDN_VERSION = "0.0.3";
16
16
  function resolveCircuitPathsFromBase(base) {
17
17
  const root = base.endsWith("/") ? base : `${base}/`;
18
18
  return {
@@ -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;AA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esContent":["{\n \"name\": \"veilix-sdk\",\n \"version\": \"0.0.3\",\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.2\";\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,GACv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\n \"name\": \"veilix-sdk\",\n \"version\": \"0.0.4\",\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.3\";\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"]}
Binary file
Binary file
package/dist/index.cjs CHANGED
@@ -3587,8 +3587,8 @@ function getProgramIdForNetwork(network) {
3587
3587
  function getIdlForNetwork(network) {
3588
3588
  return network === "devnet" ? veilix_devnet_default : veilix_default;
3589
3589
  }
3590
- var MAINNET_INDEXER_URL = "https://idx.veilixprivacy.com";
3591
- var DEVNET_INDEXER_URL = "https://indexer.veilixprivacy.com";
3590
+ var MAINNET_INDEXER_URL = "https://idx.veilixprotocol.com";
3591
+ var DEVNET_INDEXER_URL = "https://api.veilixprotocol.com";
3592
3592
  var INDEXER_URLS_BY_NETWORK = {
3593
3593
  mainnet: MAINNET_INDEXER_URL,
3594
3594
  devnet: DEVNET_INDEXER_URL
@@ -3607,7 +3607,7 @@ function getRiskApiUrlForNetwork(network) {
3607
3607
  return RISK_API_URLS_BY_NETWORK[network];
3608
3608
  }
3609
3609
  var MAINNET_TOKEN_MINTS = {
3610
- Veilix: "3jSL5nnnYcRLmTqFmwvY1Mikh42fQsT7p7NvXPYzanon",
3610
+ Veilix: "GAFN64LvtCBoc5BHncVn3JEJGpq42rUzQjPmvMK2UhZH",
3611
3611
  Bitcoin: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh",
3612
3612
  Ethereum: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs",
3613
3613
  USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
@@ -3686,7 +3686,7 @@ var WITHDRAW_CIRCUIT_SHA256 = {
3686
3686
  zkey: "64a4d915099f6fe6bfa06e151c254843be8773c7991c742260019dc5184e5d82"
3687
3687
  };
3688
3688
  var CIRCUIT_CDN_PACKAGE = "veilix-sdk";
3689
- var CIRCUIT_CDN_VERSION = "0.0.2";
3689
+ var CIRCUIT_CDN_VERSION = "0.0.3";
3690
3690
  function resolveCircuitPathsFromBase(base) {
3691
3691
  const root = base.endsWith("/") ? base : `${base}/`;
3692
3692
  return {