veilix-sdk 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -228,7 +228,7 @@ declare function encryptData(key: Uint8Array, plaintext: string): Buffer$1;
228
228
  declare function decryptData(key: Uint8Array, combined: Uint8Array): string;
229
229
 
230
230
  /**
231
- * Indexer asset selector: an asset label (`"SOL"`, `"VEILIX"`, ...), a mint
231
+ * Indexer asset selector: an asset label (`"SOL"`, `"USDC"`, ...), a mint
232
232
  * address, or `{ mint }` / `{ asset }`. Defaults to SOL.
233
233
  */
234
234
  type IndexerAsset = string | {
@@ -228,7 +228,7 @@ declare function encryptData(key: Uint8Array, plaintext: string): Buffer$1;
228
228
  declare function decryptData(key: Uint8Array, combined: Uint8Array): string;
229
229
 
230
230
  /**
231
- * Indexer asset selector: an asset label (`"SOL"`, `"VEILIX"`, ...), a mint
231
+ * Indexer asset selector: an asset label (`"SOL"`, `"USDC"`, ...), a mint
232
232
  * address, or `{ mint }` / `{ asset }`. Defaults to SOL.
233
233
  */
234
234
  type IndexerAsset = string | {
@@ -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,YAmGV,CAAA;;;ACjGO,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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AO,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.2.2\",\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/bn.js\": \"^5.2.0\",\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 \"bn.js\": \"^5.2.5\",\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: \"5f9eb88bcbc1b3dd5669dad6fdd3b91d59dd2d617ad0b34827af8a498d13fa60\",\n zkey: \"73e0d2328eca8f48024b69b42d659b68d7dd2f067d762079e859ffff34360a1a\",\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.2.0\";\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,YAmGV,CAAA;;;ACjGO,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,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A,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.2.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/bn.js\": \"^5.2.0\",\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 \"bn.js\": \"^5.2.5\",\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: \"5f9eb88bcbc1b3dd5669dad6fdd3b91d59dd2d617ad0b34827af8a498d13fa60\",\n zkey: \"73e0d2328eca8f48024b69b42d659b68d7dd2f067d762079e859ffff34360a1a\",\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.2.0\";\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,YAmGV,CAAA;;;ACjGO,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,GAA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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.2.2\",\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/bn.js\": \"^5.2.0\",\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 \"bn.js\": \"^5.2.5\",\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: \"5f9eb88bcbc1b3dd5669dad6fdd3b91d59dd2d617ad0b34827af8a498d13fa60\",\n zkey: \"73e0d2328eca8f48024b69b42d659b68d7dd2f067d762079e859ffff34360a1a\",\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.2.0\";\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,YAmGV,CAAA;;;ACjGO,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;A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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.2.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/bn.js\": \"^5.2.0\",\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 \"bn.js\": \"^5.2.5\",\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: \"5f9eb88bcbc1b3dd5669dad6fdd3b91d59dd2d617ad0b34827af8a498d13fa60\",\n zkey: \"73e0d2328eca8f48024b69b42d659b68d7dd2f067d762079e859ffff34360a1a\",\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.2.0\";\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
@@ -7405,6 +7405,13 @@ var TOKEN_DECIMALS = {
7405
7405
  Bitcoin: 8,
7406
7406
  USDC: 6
7407
7407
  };
7408
+ var INDEXER_ASSET_LABELS = {
7409
+ Solana: "SOL",
7410
+ Veilix: "VEILIX",
7411
+ Bitcoin: "WBTC",
7412
+ Ethereum: "WETH",
7413
+ USDC: "USDC"
7414
+ };
7408
7415
  function getTokenDecimals(symbol) {
7409
7416
  return TOKEN_DECIMALS[symbol];
7410
7417
  }
@@ -7419,7 +7426,7 @@ function getDepositQueueForNetwork(network) {
7419
7426
  // package.json
7420
7427
  var package_default = {
7421
7428
  name: "veilix-sdk",
7422
- version: "0.2.2"};
7429
+ version: "0.2.3"};
7423
7430
 
7424
7431
  // src/circuits/constants.ts
7425
7432
  var PACKAGE_NAME = package_default.name;
@@ -16970,14 +16977,24 @@ function decryptData(key, combined) {
16970
16977
 
16971
16978
  // src/tokenAssets.ts
16972
16979
  var WRAPPED_SOL_MINT2 = "So11111111111111111111111111111111111111112";
16980
+ var TOKEN_MINT_TABLES = [MAINNET_TOKEN_MINTS, DEVNET_TOKEN_MINTS];
16981
+ function indexerLabelForMint(mint) {
16982
+ if (mint === WRAPPED_SOL_MINT2) return INDEXER_ASSET_LABELS.Solana;
16983
+ for (const table of TOKEN_MINT_TABLES) {
16984
+ for (const symbol of Object.keys(table)) {
16985
+ if (table[symbol] && table[symbol] === mint) return INDEXER_ASSET_LABELS[symbol];
16986
+ }
16987
+ }
16988
+ return void 0;
16989
+ }
16973
16990
  function resolveIndexerAsset(indexerAsset) {
16974
- if (!indexerAsset) return "SOL";
16991
+ if (!indexerAsset) return INDEXER_ASSET_LABELS.Solana;
16975
16992
  if (typeof indexerAsset === "string") {
16976
- return indexerAsset === WRAPPED_SOL_MINT2 ? "SOL" : indexerAsset;
16993
+ return indexerLabelForMint(indexerAsset) ?? indexerAsset;
16977
16994
  }
16978
- if (indexerAsset.asset) return indexerAsset.asset;
16979
- if (indexerAsset.mint && indexerAsset.mint !== WRAPPED_SOL_MINT2) return indexerAsset.mint;
16980
- return "SOL";
16995
+ if (indexerAsset.asset) return indexerLabelForMint(indexerAsset.asset) ?? indexerAsset.asset;
16996
+ if (indexerAsset.mint) return indexerLabelForMint(indexerAsset.mint) ?? indexerAsset.mint;
16997
+ return INDEXER_ASSET_LABELS.Solana;
16981
16998
  }
16982
16999
  function indexerAssetForMint(mint) {
16983
17000
  return resolveIndexerAsset(mint ?? null);