@permissionless-technologies/upp-sdk 0.4.4 → 0.4.6
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.
- package/dist/{chunk-UC2QMWGS.js → chunk-746OK22E.js} +14 -14
- package/dist/{chunk-UC2QMWGS.js.map → chunk-746OK22E.js.map} +1 -1
- package/dist/{chunk-ROV6WWIS.cjs → chunk-CZRCIN6S.cjs} +2 -2
- package/dist/{chunk-ROV6WWIS.cjs.map → chunk-CZRCIN6S.cjs.map} +1 -1
- package/dist/{chunk-4UKH6LXH.js → chunk-VDZSF5GW.js} +2 -2
- package/dist/{chunk-4UKH6LXH.js.map → chunk-VDZSF5GW.js.map} +1 -1
- package/dist/{chunk-A7EORZW7.cjs → chunk-VIBIC5L7.cjs} +14 -14
- package/dist/{chunk-A7EORZW7.cjs.map → chunk-VIBIC5L7.cjs.map} +1 -1
- package/dist/core/index.cjs +7 -7
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.js +2 -2
- package/dist/indexer/index.cjs +6 -6
- package/dist/indexer/index.js +1 -1
- package/dist/react/index.cjs +5 -5
- package/dist/react/index.js +5 -5
- package/dist/{transfer-Y2RSJS6Y.cjs → transfer-KKFEYGL4.cjs} +9 -9
- package/dist/{transfer-Y2RSJS6Y.cjs.map → transfer-KKFEYGL4.cjs.map} +1 -1
- package/dist/{transfer-4XBP4DPQ.js → transfer-SGPJB6AK.js} +3 -3
- package/dist/{transfer-4XBP4DPQ.js.map → transfer-SGPJB6AK.js.map} +1 -1
- package/package.json +1 -1
- package/src/deployments/11155111.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deployments/31337.json","../src/deployments/11155111.json","../src/deployments/index.ts","../src/core/transfer.ts"],"names":["__default","init_poseidon","STATE_TREE_DEPTH","ASP_TREE_DEPTH","buildMerkleTree","poseidon","computeOwnerHash","computeNoteCommitment","generateASPProof","DEMO_ASP_ID","generateUPP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AK;AAAA,GACtB;AACF","file":"chunk-A7EORZW7.cjs","sourcesContent":["{\n \"UniversalPrivatePool\": \"0x2279b7a0a67db372996a5fab50d91eaa73d2ebe6\",\n \"ASPRegistryHub\": \"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512\",\n \"TestToken\": \"0x610178da211fef7d417bc0e6fed39f05609ad788\",\n \"TestToken2\": \"0xb7f8bc63bbcad18155201308c8f3540b07f84f5e\",\n \"verifiers\": {\n \"TransferVerifier\": \"0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0\",\n \"MergeVerifier\": \"0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9\",\n \"WithdrawVerifier\": \"0xdc64a140aa3e981100a9beca4e685f962f0cf6c9\",\n \"JoinSplitVerifier\": \"0x5fc8d32690cc91d4c39d9d3abcbd16989f875707\",\n \"MergeTransfer2x2Verifier\": \"0x0165878a594ca255338adfa4d48449f69242eb8f\",\n \"MergeTransfer4x2Verifier\": \"0xa513e6e4b8f2a923d98304ec87f64353c4d5c853\"\n },\n \"starkVerifiers\": {\n \"CircleStarkVerifier\": \"0x0dcd1bf9a1b36ce34237eeafef220932846bcd82\"\n },\n \"deployBlock\": 1,\n \"deployTimestamp\": 1774728354492\n}\n","{\n \"UniversalPrivatePool\": \"0xc0af763cd42e03338da6cdde137ce4a59b3c9387\",\n \"ASPRegistryHub\": \"0xfd11c56a23314aa88dfbcc36254f33e5e8b010df\",\n \"TestToken\": \"0x8430a59e30e771c6f77f6d3417f591cdc2b83c79\",\n \"TestToken2\": \"0x7740ece8e68001e215f9573b0c270d68eeefa875\",\n \"verifiers\": {\n \"TransferVerifier\": \"0xd384b9192d3de09e306ea2bed0b0e44e2e0756d1\",\n \"MergeVerifier\": \"0x4603a9bc05732811970e6dfc4eb5264463fe08e6\",\n \"WithdrawVerifier\": \"0x86f86e58bc56eca8947a2e5c074f3a6461e77f8c\",\n \"JoinSplitVerifier\": \"0xc31846964ac1492c0c2d95c6792a36f0797f59bc\",\n \"MergeTransfer2x2Verifier\": \"0x6e16218283a7796f6d1f6ed3fec591a29fad8c0a\",\n \"MergeTransfer4x2Verifier\": \"0xc4f7991eddf0aeaa203457f49d1d3563919dd596\"\n },\n \"starkVerifiers\": {\n \"CircleStarkVerifier\": \"0x4e74980dec35572da4901831dac0a05435aaca6c\"\n },\n \"deployBlock\": 10547346,\n \"deployTimestamp\": 1774796558196,\n \"proofSystem\": \"PLONK\",\n \"curve\": \"BLS12-381\",\n \"verifierType\": \"PlonkVerifierBLS12381\"\n}\n","/**\n * Deployment Configuration Loader\n *\n * Loads contract addresses based on chain ID.\n * Built-in: Anvil (31337) and Sepolia (11155111).\n * Custom chains can be registered at runtime via registerDeployment().\n */\n\nimport type { Address } from \"viem\";\n\n/**\n * Verifier contract addresses\n */\nexport interface VerifierAddresses {\n TransferVerifier: Address;\n MergeVerifier: Address;\n WithdrawVerifier: Address;\n JoinSplitVerifier?: Address;\n MergeTransfer2x2Verifier?: Address;\n MergeTransfer4x2Verifier?: Address;\n}\n\n/**\n * STARK verifier contract addresses\n */\nexport interface StarkVerifierAddresses {\n CircleStarkVerifier?: Address;\n}\n\n/**\n * Deployment configuration for a chain\n */\nexport interface DeploymentConfig {\n /** Universal Private Pool contract address */\n UniversalPrivatePool: Address;\n /** ASP Registry Hub contract address */\n ASPRegistryHub: Address;\n /** Test token address (local/testnet) */\n TestToken?: Address;\n /** Test token 2 address — bonding curve token (local/testnet) */\n TestToken2?: Address;\n /** Verifier contract addresses */\n verifiers: VerifierAddresses;\n /** STARK verifier contract addresses */\n starkVerifiers?: StarkVerifierAddresses;\n /** Chain ID */\n chainId: number;\n /** Block number when contracts were deployed (for efficient scanning) */\n deployBlock: number;\n /** Timestamp when contracts were deployed */\n deployTimestamp?: number;\n}\n\n/**\n * Raw JSON file format (without chainId, which is added dynamically)\n */\ninterface DeploymentJSON {\n UniversalPrivatePool: string;\n ASPRegistryHub: string;\n TestToken?: string;\n TestToken2?: string;\n verifiers: {\n TransferVerifier: string;\n MergeVerifier: string;\n WithdrawVerifier: string;\n JoinSplitVerifier?: string;\n MergeTransfer2x2Verifier?: string;\n MergeTransfer4x2Verifier?: string;\n };\n starkVerifiers?: {\n CircleStarkVerifier?: string;\n };\n deployBlock: number;\n deployTimestamp?: number;\n}\n\n/**\n * Parse raw deployment JSON into typed config\n */\nfunction parseDeployment(\n json: DeploymentJSON,\n chainId: number\n): DeploymentConfig {\n return {\n UniversalPrivatePool: json.UniversalPrivatePool as Address,\n ASPRegistryHub: json.ASPRegistryHub as Address,\n TestToken: json.TestToken as Address | undefined,\n TestToken2: json.TestToken2 as Address | undefined,\n verifiers: {\n TransferVerifier: json.verifiers.TransferVerifier as Address,\n MergeVerifier: json.verifiers.MergeVerifier as Address,\n WithdrawVerifier: json.verifiers.WithdrawVerifier as Address,\n JoinSplitVerifier: json.verifiers.JoinSplitVerifier as Address | undefined,\n MergeTransfer2x2Verifier: json.verifiers\n .MergeTransfer2x2Verifier as Address | undefined,\n MergeTransfer4x2Verifier: json.verifiers\n .MergeTransfer4x2Verifier as Address | undefined,\n },\n starkVerifiers: json.starkVerifiers\n ? {\n CircleStarkVerifier: json.starkVerifiers\n .CircleStarkVerifier as Address | undefined,\n }\n : undefined,\n chainId,\n deployBlock: json.deployBlock,\n deployTimestamp: json.deployTimestamp,\n };\n}\n\n// Import deployment configs\n// These will be updated by the extract-deployment.js script\nimport anvil from \"./31337.json\" with { type: \"json\" };\nimport sepolia from \"./11155111.json\" with { type: \"json\" };\n\nconst deployments: Record<number, DeploymentConfig> = {\n 31337: parseDeployment(anvil as unknown as DeploymentJSON, 31337),\n 11155111: parseDeployment(sepolia as unknown as DeploymentJSON, 11155111),\n};\n\n/**\n * Get deployment config for a chain\n *\n * @param chainId - Chain ID to get deployment for\n * @returns Deployment config or null if not found\n *\n * @example\n * ```ts\n * const deployment = getDeployment(31337)\n * if (deployment) {\n * console.log('Pool address:', deployment.UniversalPrivatePool)\n * }\n * ```\n */\nexport function getDeployment(chainId: number): DeploymentConfig | null {\n return deployments[chainId] ?? null;\n}\n\n/**\n * Get deployment config or throw if not found\n *\n * @param chainId - Chain ID to get deployment for\n * @returns Deployment config\n * @throws Error if deployment not found\n */\nexport function getDeploymentOrThrow(chainId: number): DeploymentConfig {\n const deployment = getDeployment(chainId);\n if (!deployment) {\n throw new Error(\n `No deployment found for chain ${chainId}. ` +\n `Supported chains: ${Object.keys(deployments).join(\", \")}`\n );\n }\n return deployment;\n}\n\n/**\n * Check if a chain has a deployment\n */\nexport function hasDeployment(chainId: number): boolean {\n return chainId in deployments;\n}\n\n/**\n * Get all supported chain IDs\n */\nexport function getSupportedChainIds(): number[] {\n return Object.keys(deployments).map(Number);\n}\n\n/**\n * Get the token address for a chain\n */\nexport function getTokenAddress(chainId: number): Address | null {\n const deployment = getDeployment(chainId);\n if (!deployment) return null;\n return deployment.TestToken ?? null;\n}\n\n/**\n * Register a deployment for a custom chain at runtime.\n *\n * Use this when deploying your own pool on a chain not built into the SDK.\n * Overrides any existing deployment for the same chainId.\n *\n * @example\n * ```ts\n * registerDeployment(8453, {\n * UniversalPrivatePool: '0x...',\n * ASPRegistryHub: '0x...',\n * verifiers: { TransferVerifier: '0x...', MergeVerifier: '0x...', WithdrawVerifier: '0x...' },\n * chainId: 8453,\n * deployBlock: 12345678,\n * })\n * ```\n */\nexport function registerDeployment(chainId: number, config: DeploymentConfig): void {\n deployments[chainId] = { ...config, chainId };\n}\n","/**\n * Transfer Module\n *\n * Core logic for building and executing UPP transfers.\n * This module is framework-agnostic (no React).\n */\n\nimport { toHex, type Address, type Hex, type PublicClient } from 'viem'\nimport { getDeployment } from '../deployments/index.js'\nimport { buildMerkleTree, type MerkleProof } from '../utils/merkle.js'\nimport { poseidon, computeOwnerHash as poseidonOwnerHash, computeNoteCommitment } from '../utils/poseidon.js'\nimport {\n generateUPPProof,\n formatPlonkProofForContract,\n STATE_TREE_DEPTH,\n ASP_TREE_DEPTH,\n type UPPCircuitType,\n type UPPTransferCircuitInputs,\n type PlonkProofStruct,\n} from './proof.js'\nimport { generateASPProof, type ASPProof } from './asp.js'\nimport type { NoteCreationResult } from '../react/use-upp-account.js'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Transfer stage for progress tracking\n */\nexport type TransferStage =\n | 'selecting_notes'\n | 'syncing_merkle'\n | 'creating_outputs'\n | 'generating_proof'\n | 'submitting_tx'\n | 'confirming'\n\n/**\n * A shielded note with all data needed for spending\n *\n * Post-quantum: uses ownerSecret/ownerHash instead of BabyJubJub one-time keys.\n * Ownership is proven via hash preimage: Poseidon(ownerSecret) == ownerHash.\n */\nexport interface SpendableNote {\n amount: bigint\n blinding: bigint\n commitment: string\n /** Owner secret (hash preimage for ownership proof) */\n ownerSecret: string\n /** Owner hash = Poseidon(ownerSecret) - committed in the note */\n ownerHash: string\n leafIndex: number\n /** Origin address (depositor) - required for UPP circuits */\n origin: bigint\n /** Token address - required for UPP circuits */\n token: bigint\n}\n\n/**\n * Merkle proof with associated note\n */\nexport interface MerkleProofWithNote {\n proof: MerkleProof\n note: SpendableNote\n}\n\n/**\n * Transfer context (dependencies)\n */\nexport interface TransferContext {\n /** viem PublicClient for RPC calls */\n publicClient: PublicClient\n /** Contract address */\n contractAddress: Address\n /** Chain ID */\n chainId: number\n /** Circuit base URL (default: '/circuits/') */\n circuitBaseUrl?: string\n /** ASP ID to use (default: DEMO_ASP_ID) */\n aspId?: bigint\n /** All approved origins in the ASP tree (enables multi-origin proofs) */\n aspApprovedOrigins?: bigint[]\n}\n\n/**\n * Transfer result\n */\nexport interface TransferBuildResult {\n /** Circuit type used */\n circuit: UPPCircuitType\n /** Formatted PLONK proof for contract */\n proof: {\n proofStruct: PlonkProofStruct\n publicSignals: bigint[]\n }\n /** Public signals from proof */\n publicSignals: string[]\n /** State tree root */\n stateRoot: bigint\n /** ASP tree root */\n aspRoot: bigint\n /** Nullifier hash */\n nullifier: bigint\n /** Output commitment 1 */\n outputCommitment1: bigint\n /** Output commitment 2 */\n outputCommitment2: bigint\n /** Token address */\n token: bigint\n /** Recipient output */\n recipientOutput: NoteCreationResult\n /** Change output */\n changeOutput: NoteCreationResult\n /** Notes that will be spent */\n spentNotes: SpendableNote[]\n}\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Chunk size for paginated RPC queries on testnets */\nconst RPC_CHUNK_SIZE = 9000n\n\n/**\n * Pad an array to the state tree depth (32 levels)\n * @param arr - Array to pad\n * @param padValue - Value to use for padding (default: '0')\n * @returns Padded array of length STATE_TREE_DEPTH\n */\nfunction padToStateTreeDepth<T>(arr: T[], padValue: T): T[] {\n if (arr.length >= STATE_TREE_DEPTH) {\n return arr.slice(0, STATE_TREE_DEPTH)\n }\n return [...arr, ...Array(STATE_TREE_DEPTH - arr.length).fill(padValue)]\n}\n\n/**\n * Pad an array to the ASP tree depth (20 levels)\n * @param arr - Array to pad\n * @param padValue - Value to use for padding (default: '0')\n * @returns Padded array of length ASP_TREE_DEPTH\n */\nfunction padToASPTreeDepth<T>(arr: T[], padValue: T): T[] {\n if (arr.length >= ASP_TREE_DEPTH) {\n return arr.slice(0, ASP_TREE_DEPTH)\n }\n return [...arr, ...Array(ASP_TREE_DEPTH - arr.length).fill(padValue)]\n}\n\n/**\n * CommitmentInserted event — emitted by _insertLeaf() for ALL leaf insertions\n * (shield, transfer, merge, swap fill, swap claim, swap cancel).\n * This is the single canonical event for Merkle tree reconstruction.\n */\nconst COMMITMENT_INSERTED_EVENT = {\n type: 'event' as const,\n name: 'CommitmentInserted',\n inputs: [\n { type: 'bytes32', name: 'commitment', indexed: true },\n { type: 'uint256', name: 'leafIndex' },\n { type: 'uint256', name: 'timestamp' },\n ],\n}\n\n// ============================================================================\n// Merkle Tree Functions\n// ============================================================================\n\n/**\n * Fetch all commitments from the contract and build a Merkle tree\n *\n * @param publicClient - viem PublicClient\n * @param contractAddress - Contract address\n * @returns Object with tree and leaves array\n */\nexport async function syncMerkleTree(\n publicClient: PublicClient,\n contractAddress: Address\n): Promise<{ tree: ReturnType<typeof buildMerkleTree>; leaves: bigint[] }> {\n const currentBlock = await publicClient.getBlockNumber()\n const chainId = await publicClient.getChainId()\n\n // Use CommitmentInserted events — the canonical event emitted by _insertLeaf()\n // for ALL operations (shield, transfer, merge, swap fill/claim/cancel).\n // Each event has an explicit leafIndex, so ordering is deterministic.\n let commitmentLogs: any[] = []\n\n if (chainId === 31337) {\n // Anvil - single query is fine\n commitmentLogs = await publicClient.getLogs({\n address: contractAddress,\n event: COMMITMENT_INSERTED_EVENT,\n fromBlock: 0n,\n })\n } else {\n // Testnet/mainnet - paginate to avoid RPC limits\n const deployment = getDeployment(chainId)\n let fromBlock = deployment?.deployBlock ? BigInt(deployment.deployBlock) : 0n\n console.log(`[syncMerkleTree] Chain ${chainId}: scanning from block ${fromBlock} to ${currentBlock}`)\n\n while (fromBlock <= currentBlock) {\n const toBlock =\n fromBlock + RPC_CHUNK_SIZE > currentBlock ? currentBlock : fromBlock + RPC_CHUNK_SIZE\n const chunk = await publicClient.getLogs({\n address: contractAddress,\n event: COMMITMENT_INSERTED_EVENT,\n fromBlock,\n toBlock,\n })\n commitmentLogs = commitmentLogs.concat(chunk)\n fromBlock = toBlock + 1n\n }\n }\n\n // Sort by explicit leafIndex (most reliable), falling back to block+logIndex\n commitmentLogs.sort((a: any, b: any) => {\n const idxA = Number(a.args.leafIndex!)\n const idxB = Number(b.args.leafIndex!)\n return idxA - idxB\n })\n\n // Build leaves array using the explicit leafIndex from each event\n const leaves: bigint[] = []\n for (const log of commitmentLogs) {\n const leafIndex = Number(log.args.leafIndex!)\n const commitment = BigInt(log.args.commitment!)\n\n if (leaves.length !== leafIndex) {\n console.warn(\n `[syncMerkleTree] WARNING: Expected leafIndex ${leaves.length} but event has ${leafIndex}. ` +\n `This may indicate missed events or reorg.`\n )\n }\n leaves.push(commitment)\n }\n\n const tree = buildMerkleTree(leaves)\n\n // Debug: compare our root with on-chain root\n const ourRoot = await tree.getRoot()\n const onChainRoot = (await publicClient.readContract({\n address: contractAddress,\n abi: [\n {\n type: 'function',\n name: 'getMerkleRoot',\n inputs: [],\n outputs: [{ type: 'uint256' }],\n stateMutability: 'view',\n },\n ],\n functionName: 'getMerkleRoot',\n })) as bigint\n\n console.log(`[syncMerkleTree] Leaves count: ${leaves.length}`)\n console.log(`[syncMerkleTree] Tree depth: ${tree.depth}`)\n console.log(`[syncMerkleTree] Our computed root: ${ourRoot}`)\n console.log(`[syncMerkleTree] On-chain root: ${onChainRoot}`)\n console.log(`[syncMerkleTree] Roots match: ${ourRoot === onChainRoot}`)\n\n if (ourRoot !== onChainRoot) {\n console.log(`[syncMerkleTree] WARNING: Root mismatch!`)\n console.log(\n `[syncMerkleTree] Leaves:`,\n leaves.map((l) => '0x' + l.toString(16))\n )\n }\n\n return { tree, leaves }\n}\n\n/**\n * Get Merkle proofs for a set of notes\n *\n * @param notes - Notes to get proofs for\n * @param leaves - All leaves in the tree\n * @param tree - Merkle tree instance\n * @returns Array of proofs with associated notes\n */\nexport async function getMerkleProofsForNotes(\n notes: SpendableNote[],\n leaves: bigint[],\n tree: ReturnType<typeof buildMerkleTree>\n): Promise<MerkleProofWithNote[]> {\n const { verifyMerkleProof } = await import('../utils/merkle.js')\n const proofs: MerkleProofWithNote[] = []\n\n for (const note of notes) {\n const commitmentBI = BigInt(note.commitment)\n const leafIndex = leaves.findIndex((l) => l === commitmentBI)\n\n console.log(`[getMerkleProofsForNotes] Note commitment: ${note.commitment}`)\n console.log(`[getMerkleProofsForNotes] Note commitment as BigInt: ${commitmentBI}`)\n console.log(`[getMerkleProofsForNotes] Found at leafIndex: ${leafIndex}`)\n console.log(`[getMerkleProofsForNotes] Note's stored leafIndex: ${note.leafIndex}`)\n\n if (leafIndex === -1) {\n console.log(`[getMerkleProofsForNotes] Leaves in tree:`, leaves.map((l) => l.toString()))\n throw new Error(`Note ${note.commitment.slice(0, 10)}... not found on-chain`)\n }\n\n const proof = await tree.getProof(leafIndex)\n\n console.log(`[getMerkleProofsForNotes] Proof root: ${proof.root}`)\n console.log(`[getMerkleProofsForNotes] Proof leafIndex: ${proof.leafIndex}`)\n console.log(`[getMerkleProofsForNotes] PathElements:`, proof.pathElements.map((e) => e.toString()))\n console.log(`[getMerkleProofsForNotes] PathIndices:`, proof.pathIndices)\n\n // Verify the proof locally before returning\n const isValid = await verifyMerkleProof(commitmentBI, proof)\n console.log(`[getMerkleProofsForNotes] Local proof verification: ${isValid}`)\n\n if (!isValid) {\n console.error(`[getMerkleProofsForNotes] WARNING: Merkle proof is invalid!`)\n }\n\n proofs.push({ proof, note: { ...note, leafIndex } })\n }\n\n return proofs\n}\n\n// ============================================================================\n// Circuit Input Building\n// ============================================================================\n\n/**\n * Compute nullifier for a UPP note (BLS12-381)\n *\n * nullifier = Poseidon(ownerSecret, leafIndex, commitment)\n *\n * @param ownerSecret - Owner secret (hash preimage)\n * @param leafIndex - Leaf index in Merkle tree\n * @param commitment - Note commitment\n * @returns Nullifier as bigint\n */\nexport async function computeNullifier(\n ownerSecret: bigint,\n leafIndex: number,\n commitment: bigint\n): Promise<bigint> {\n return await poseidon([ownerSecret, BigInt(leafIndex), commitment])\n}\n\n/**\n * Note with amount for circuit building\n */\nexport interface NoteWithAmount extends NoteCreationResult {\n amount: bigint\n}\n\n/**\n * Build circuit inputs for UPP transfer (1-in-2-out)\n *\n * @param noteProof - Merkle proof for input note\n * @param aspProof - ASP membership proof for input note's origin\n * @param recipientNote - Output note for recipient\n * @param changeNote - Output note for change\n * @returns UPP transfer circuit inputs\n */\nexport async function buildUPPTransferCircuitInputs(\n noteProof: MerkleProofWithNote,\n aspProof: ASPProof,\n recipientNote: NoteWithAmount,\n changeNote: NoteWithAmount\n): Promise<UPPTransferCircuitInputs> {\n const { proof, note } = noteProof\n\n // Compute owner hash from secret (hash-based ownership)\n const inputOwnerHash = poseidonOwnerHash(BigInt(note.ownerSecret))\n\n // Verify input commitment locally\n // BLS12-381 commitment: Poseidon(amount, ownerHash, blinding, origin, token)\n const localInputCommitment = computeNoteCommitment(\n note.amount,\n inputOwnerHash,\n note.blinding,\n note.origin,\n note.token,\n )\n\n const storedCommitment = BigInt(note.commitment)\n if (localInputCommitment !== storedCommitment) {\n console.error(`[buildUPPTransferCircuitInputs] COMMITMENT MISMATCH`)\n console.error(` amount: ${note.amount}, ownerHash: ${inputOwnerHash}`)\n console.error(` blinding: ${note.blinding}, origin: ${note.origin}, token: ${note.token}`)\n console.error(` local=${localInputCommitment}, stored=${storedCommitment}`)\n throw new Error(\n `Note commitment mismatch — this note was created with an outdated commitment formula. ` +\n `Clear your shielded account (localStorage) and re-shield tokens.`\n )\n }\n\n const nullifier = await computeNullifier(\n BigInt(note.ownerSecret),\n proof.leafIndex,\n BigInt(note.commitment)\n )\n\n return {\n // Public inputs\n stateRoot: String(proof.root),\n aspRoot: String(aspProof.aspRoot),\n nullifier: String(nullifier),\n outputCommitment1: String(recipientNote.commitment),\n outputCommitment2: String(changeNote.commitment),\n token: String(note.token),\n\n // Private inputs - Input Note\n inputAmount: String(note.amount),\n inputOneTimeSecret: String(BigInt(note.ownerSecret)),\n inputBlinding: String(note.blinding),\n inputOrigin: String(note.origin),\n inputLeafIndex: String(proof.leafIndex),\n inputPathElements: padToStateTreeDepth(proof.pathElements.map((e) => String(e)), '0'),\n inputPathIndices: padToStateTreeDepth(proof.pathIndices.map(String), '0'),\n\n // Private inputs - ASP Membership Proof\n aspPathElements: padToASPTreeDepth(aspProof.aspPathElements.map((e) => String(e)), '0'),\n aspPathIndices: padToASPTreeDepth(aspProof.aspPathIndices.map(String), '0'),\n\n // Private inputs - Output Notes (hash-based ownership)\n outputAmount1: String(recipientNote.amount),\n outputOwnerHash1: String(recipientNote.ownerHash),\n outputBlinding1: String(recipientNote.blinding),\n\n outputAmount2: String(changeNote.amount),\n outputOwnerHash2: String(changeNote.ownerHash),\n outputBlinding2: String(changeNote.blinding),\n }\n}\n\n// ============================================================================\n// Transfer Building\n// ============================================================================\n\nimport { DEMO_ASP_ID } from './asp.js'\n\n/**\n * Build a UPP transfer (proof + outputs)\n *\n * This prepares everything needed to submit the transaction.\n * UPP transfer is 1-in-2-out with ASP membership proof.\n *\n * @param ctx - Transfer context\n * @param selectedNote - Note to spend (UPP transfer uses exactly 1 input)\n * @param recipientNote - Output note for recipient\n * @param changeNote - Output note for change\n * @param onStageChange - Optional callback for stage updates\n * @returns Transfer build result with proof and outputs\n */\nexport async function buildTransfer(\n ctx: TransferContext,\n selectedNote: SpendableNote,\n recipientNote: NoteWithAmount,\n changeNote: NoteWithAmount,\n onStageChange?: (stage: TransferStage) => void\n): Promise<TransferBuildResult> {\n // 1. Sync Merkle tree\n onStageChange?.('syncing_merkle')\n const { tree, leaves } = await syncMerkleTree(ctx.publicClient, ctx.contractAddress)\n\n // 2. Get Merkle proof for note\n const noteProofs = await getMerkleProofsForNotes([selectedNote], leaves, tree)\n const noteProof = noteProofs[0]!\n\n // 3. Generate ASP proof for the note's origin\n const aspProof = await generateASPProof(\n ctx.aspId ?? DEMO_ASP_ID,\n selectedNote.origin,\n ctx.aspApprovedOrigins\n )\n\n // 4. Build circuit inputs and generate proof\n onStageChange?.('generating_proof')\n\n const circuitInputs = await buildUPPTransferCircuitInputs(\n noteProof,\n aspProof,\n recipientNote,\n changeNote\n )\n\n const { proof } = await generateUPPProof(\n 'transfer',\n circuitInputs,\n ctx.circuitBaseUrl ?? '/circuits/'\n )\n\n const formattedProof = await formatPlonkProofForContract(proof)\n\n return {\n circuit: 'transfer',\n proof: formattedProof,\n publicSignals: proof.publicSignals,\n stateRoot: BigInt(circuitInputs.stateRoot),\n aspRoot: BigInt(circuitInputs.aspRoot),\n nullifier: BigInt(circuitInputs.nullifier),\n outputCommitment1: BigInt(circuitInputs.outputCommitment1),\n outputCommitment2: BigInt(circuitInputs.outputCommitment2),\n token: BigInt(circuitInputs.token),\n recipientOutput: recipientNote,\n changeOutput: changeNote,\n spentNotes: [selectedNote],\n }\n}\n\n/**\n * Format output for contract call (post-quantum)\n */\nexport function formatOutputForContract(note: NoteCreationResult): {\n commitment: Hex\n searchTag: bigint\n ownerHash: bigint\n encryptedNote: Hex\n} {\n return {\n commitment: toHex(note.commitment, { size: 32 }),\n searchTag: note.searchTag,\n ownerHash: note.ownerHash,\n encryptedNote: note.encryptedNote as Hex,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/deployments/31337.json","../src/deployments/11155111.json","../src/deployments/index.ts","../src/core/transfer.ts"],"names":["__default","init_poseidon","STATE_TREE_DEPTH","ASP_TREE_DEPTH","buildMerkleTree","poseidon","computeOwnerHash","computeNoteCommitment","generateASPProof","DEMO_ASP_ID","generateUPPProof","formatPlonkProofForContract","toHex"],"mappings":";;;;;;;;;AAAA,IAAA,SAAA,GAAA;AAAA,EACE,oBAAA,EAAwB,4CAAA;AAAA,EACxB,cAAA,EAAkB,4CAAA;AAAA,EAClB,SAAA,EAAa,4CAAA;AAAA,EACb,UAAA,EAAc,4CAAA;AAAA,EACd,SAAA,EAAa;AAAA,IACX,gBAAA,EAAoB,4CAAA;AAAA,IACpB,aAAA,EAAiB,4CAAA;AAAA,IACjB,gBAAA,EAAoB,4CAAA;AAAA,IACpB,iBAAA,EAAqB,4CAAA;AAAA,IACrB,wBAAA,EAA4B,4CAAA;AAAA,IAC5B,wBAAA,EAA4B;AAAA,GAC9B;AAAA,EACA,cAAA,EAAkB;AAAA,IAChB,mBAAA,EAAuB;AAAA,GACzB;AAAA,EACA,WAAA,EAAe,CAAA;AAAA,EACf,eAAA,EAAmB;AACrB,CAAA;;;AClBA,IAAAA,UAAAA,GAAA;AAAA,EACE,oBAAA,EAAwB,4CAAA;AAAA,EACxB,cAAA,EAAkB,4CAAA;AAAA,EAClB,SAAA,EAAa,4CAAA;AAAA,EACb,UAAA,EAAc,4CAAA;AAAA,EACd,SAAA,EAAa;AAAA,IACX,gBAAA,EAAoB,4CAAA;AAAA,IACpB,aAAA,EAAiB,4CAAA;AAAA,IACjB,gBAAA,EAAoB,4CAAA;AAAA,IACpB,iBAAA,EAAqB,4CAAA;AAAA,IACrB,wBAAA,EA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K,CAAA;AAAA,IACjC,eAAA,EAAiB,aAAA;AAAA,IACjB,YAAA,EAAc,UAAA;AAAA,IACd,UAAA,EAAY,CAAC,YAAY;AAAA,GAC3B;AACF;AAKO,SAAS,wBAAwB,IAAA,EAKtC;AACA,EAAA,OAAO;AAAA,IACL,YAAYC,UAAA,CAAM,IAAA,CAAK,YAAY,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA,IAC/C,WAAW,IAAA,CAAK,SAAA;AAAA,IAChB,WAAW,IAAA,CAAK,SAAA;AAAA,IAChB,eAAe,IAAA,CAAK;AAAA,GACtB;AACF","file":"chunk-VIBIC5L7.cjs","sourcesContent":["{\n \"UniversalPrivatePool\": \"0x2279b7a0a67db372996a5fab50d91eaa73d2ebe6\",\n \"ASPRegistryHub\": \"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512\",\n \"TestToken\": \"0x610178da211fef7d417bc0e6fed39f05609ad788\",\n \"TestToken2\": \"0xb7f8bc63bbcad18155201308c8f3540b07f84f5e\",\n \"verifiers\": {\n \"TransferVerifier\": \"0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0\",\n \"MergeVerifier\": \"0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9\",\n \"WithdrawVerifier\": \"0xdc64a140aa3e981100a9beca4e685f962f0cf6c9\",\n \"JoinSplitVerifier\": \"0x5fc8d32690cc91d4c39d9d3abcbd16989f875707\",\n \"MergeTransfer2x2Verifier\": \"0x0165878a594ca255338adfa4d48449f69242eb8f\",\n \"MergeTransfer4x2Verifier\": \"0xa513e6e4b8f2a923d98304ec87f64353c4d5c853\"\n },\n \"starkVerifiers\": {\n \"CircleStarkVerifier\": \"0x0dcd1bf9a1b36ce34237eeafef220932846bcd82\"\n },\n \"deployBlock\": 1,\n \"deployTimestamp\": 1774728354492\n}\n","{\n \"UniversalPrivatePool\": \"0x8d7bddfb66bed215dd73525af3c7a0b596d37544\",\n \"ASPRegistryHub\": \"0xfd11c56a23314aa88dfbcc36254f33e5e8b010df\",\n \"TestToken\": \"0x67ef1d13bbc7e0de9ea2c4e531024f66845234e8\",\n \"TestToken2\": \"0xab36c0e6eb7edff36ec2e955eb490616051dc442\",\n \"verifiers\": {\n \"TransferVerifier\": \"0xd64739cbb7dbd5ed35fd6842972cbb9c7bae6c12\",\n \"MergeVerifier\": \"0x37a15c5c12c7843c77270a61c3c62fdc027ffb04\",\n \"WithdrawVerifier\": \"0x18d4345dce5513a6c5fc57863dcf8c063c910e47\",\n \"JoinSplitVerifier\": \"0x284018c3e4092a8e5a4ff3315ad58de116493e93\",\n \"MergeTransfer2x2Verifier\": \"0xd9f1d970fa7c94ee68d7eecdbc12676b0e2836b6\",\n \"MergeTransfer4x2Verifier\": \"0x597e97154a2dd8cf44939290299bc3586a1f894f\"\n },\n \"starkVerifiers\": {\n \"CircleStarkVerifier\": \"0xda3380ab901c474fd8a44646eebb03fae0e601ce\"\n },\n \"deployBlock\": 10548447,\n \"deployTimestamp\": 1774810176621,\n \"proofSystem\": \"PLONK\",\n \"curve\": \"BLS12-381\",\n \"verifierType\": \"PlonkVerifierBLS12381\"\n}\n","/**\n * Deployment Configuration Loader\n *\n * Loads contract addresses based on chain ID.\n * Built-in: Anvil (31337) and Sepolia (11155111).\n * Custom chains can be registered at runtime via registerDeployment().\n */\n\nimport type { Address } from \"viem\";\n\n/**\n * Verifier contract addresses\n */\nexport interface VerifierAddresses {\n TransferVerifier: Address;\n MergeVerifier: Address;\n WithdrawVerifier: Address;\n JoinSplitVerifier?: Address;\n MergeTransfer2x2Verifier?: Address;\n MergeTransfer4x2Verifier?: Address;\n}\n\n/**\n * STARK verifier contract addresses\n */\nexport interface StarkVerifierAddresses {\n CircleStarkVerifier?: Address;\n}\n\n/**\n * Deployment configuration for a chain\n */\nexport interface DeploymentConfig {\n /** Universal Private Pool contract address */\n UniversalPrivatePool: Address;\n /** ASP Registry Hub contract address */\n ASPRegistryHub: Address;\n /** Test token address (local/testnet) */\n TestToken?: Address;\n /** Test token 2 address — bonding curve token (local/testnet) */\n TestToken2?: Address;\n /** Verifier contract addresses */\n verifiers: VerifierAddresses;\n /** STARK verifier contract addresses */\n starkVerifiers?: StarkVerifierAddresses;\n /** Chain ID */\n chainId: number;\n /** Block number when contracts were deployed (for efficient scanning) */\n deployBlock: number;\n /** Timestamp when contracts were deployed */\n deployTimestamp?: number;\n}\n\n/**\n * Raw JSON file format (without chainId, which is added dynamically)\n */\ninterface DeploymentJSON {\n UniversalPrivatePool: string;\n ASPRegistryHub: string;\n TestToken?: string;\n TestToken2?: string;\n verifiers: {\n TransferVerifier: string;\n MergeVerifier: string;\n WithdrawVerifier: string;\n JoinSplitVerifier?: string;\n MergeTransfer2x2Verifier?: string;\n MergeTransfer4x2Verifier?: string;\n };\n starkVerifiers?: {\n CircleStarkVerifier?: string;\n };\n deployBlock: number;\n deployTimestamp?: number;\n}\n\n/**\n * Parse raw deployment JSON into typed config\n */\nfunction parseDeployment(\n json: DeploymentJSON,\n chainId: number\n): DeploymentConfig {\n return {\n UniversalPrivatePool: json.UniversalPrivatePool as Address,\n ASPRegistryHub: json.ASPRegistryHub as Address,\n TestToken: json.TestToken as Address | undefined,\n TestToken2: json.TestToken2 as Address | undefined,\n verifiers: {\n TransferVerifier: json.verifiers.TransferVerifier as Address,\n MergeVerifier: json.verifiers.MergeVerifier as Address,\n WithdrawVerifier: json.verifiers.WithdrawVerifier as Address,\n JoinSplitVerifier: json.verifiers.JoinSplitVerifier as Address | undefined,\n MergeTransfer2x2Verifier: json.verifiers\n .MergeTransfer2x2Verifier as Address | undefined,\n MergeTransfer4x2Verifier: json.verifiers\n .MergeTransfer4x2Verifier as Address | undefined,\n },\n starkVerifiers: json.starkVerifiers\n ? {\n CircleStarkVerifier: json.starkVerifiers\n .CircleStarkVerifier as Address | undefined,\n }\n : undefined,\n chainId,\n deployBlock: json.deployBlock,\n deployTimestamp: json.deployTimestamp,\n };\n}\n\n// Import deployment configs\n// These will be updated by the extract-deployment.js script\nimport anvil from \"./31337.json\" with { type: \"json\" };\nimport sepolia from \"./11155111.json\" with { type: \"json\" };\n\nconst deployments: Record<number, DeploymentConfig> = {\n 31337: parseDeployment(anvil as unknown as DeploymentJSON, 31337),\n 11155111: parseDeployment(sepolia as unknown as DeploymentJSON, 11155111),\n};\n\n/**\n * Get deployment config for a chain\n *\n * @param chainId - Chain ID to get deployment for\n * @returns Deployment config or null if not found\n *\n * @example\n * ```ts\n * const deployment = getDeployment(31337)\n * if (deployment) {\n * console.log('Pool address:', deployment.UniversalPrivatePool)\n * }\n * ```\n */\nexport function getDeployment(chainId: number): DeploymentConfig | null {\n return deployments[chainId] ?? null;\n}\n\n/**\n * Get deployment config or throw if not found\n *\n * @param chainId - Chain ID to get deployment for\n * @returns Deployment config\n * @throws Error if deployment not found\n */\nexport function getDeploymentOrThrow(chainId: number): DeploymentConfig {\n const deployment = getDeployment(chainId);\n if (!deployment) {\n throw new Error(\n `No deployment found for chain ${chainId}. ` +\n `Supported chains: ${Object.keys(deployments).join(\", \")}`\n );\n }\n return deployment;\n}\n\n/**\n * Check if a chain has a deployment\n */\nexport function hasDeployment(chainId: number): boolean {\n return chainId in deployments;\n}\n\n/**\n * Get all supported chain IDs\n */\nexport function getSupportedChainIds(): number[] {\n return Object.keys(deployments).map(Number);\n}\n\n/**\n * Get the token address for a chain\n */\nexport function getTokenAddress(chainId: number): Address | null {\n const deployment = getDeployment(chainId);\n if (!deployment) return null;\n return deployment.TestToken ?? null;\n}\n\n/**\n * Register a deployment for a custom chain at runtime.\n *\n * Use this when deploying your own pool on a chain not built into the SDK.\n * Overrides any existing deployment for the same chainId.\n *\n * @example\n * ```ts\n * registerDeployment(8453, {\n * UniversalPrivatePool: '0x...',\n * ASPRegistryHub: '0x...',\n * verifiers: { TransferVerifier: '0x...', MergeVerifier: '0x...', WithdrawVerifier: '0x...' },\n * chainId: 8453,\n * deployBlock: 12345678,\n * })\n * ```\n */\nexport function registerDeployment(chainId: number, config: DeploymentConfig): void {\n deployments[chainId] = { ...config, chainId };\n}\n","/**\n * Transfer Module\n *\n * Core logic for building and executing UPP transfers.\n * This module is framework-agnostic (no React).\n */\n\nimport { toHex, type Address, type Hex, type PublicClient } from 'viem'\nimport { getDeployment } from '../deployments/index.js'\nimport { buildMerkleTree, type MerkleProof } from '../utils/merkle.js'\nimport { poseidon, computeOwnerHash as poseidonOwnerHash, computeNoteCommitment } from '../utils/poseidon.js'\nimport {\n generateUPPProof,\n formatPlonkProofForContract,\n STATE_TREE_DEPTH,\n ASP_TREE_DEPTH,\n type UPPCircuitType,\n type UPPTransferCircuitInputs,\n type PlonkProofStruct,\n} from './proof.js'\nimport { generateASPProof, type ASPProof } from './asp.js'\nimport type { NoteCreationResult } from '../react/use-upp-account.js'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Transfer stage for progress tracking\n */\nexport type TransferStage =\n | 'selecting_notes'\n | 'syncing_merkle'\n | 'creating_outputs'\n | 'generating_proof'\n | 'submitting_tx'\n | 'confirming'\n\n/**\n * A shielded note with all data needed for spending\n *\n * Post-quantum: uses ownerSecret/ownerHash instead of BabyJubJub one-time keys.\n * Ownership is proven via hash preimage: Poseidon(ownerSecret) == ownerHash.\n */\nexport interface SpendableNote {\n amount: bigint\n blinding: bigint\n commitment: string\n /** Owner secret (hash preimage for ownership proof) */\n ownerSecret: string\n /** Owner hash = Poseidon(ownerSecret) - committed in the note */\n ownerHash: string\n leafIndex: number\n /** Origin address (depositor) - required for UPP circuits */\n origin: bigint\n /** Token address - required for UPP circuits */\n token: bigint\n}\n\n/**\n * Merkle proof with associated note\n */\nexport interface MerkleProofWithNote {\n proof: MerkleProof\n note: SpendableNote\n}\n\n/**\n * Transfer context (dependencies)\n */\nexport interface TransferContext {\n /** viem PublicClient for RPC calls */\n publicClient: PublicClient\n /** Contract address */\n contractAddress: Address\n /** Chain ID */\n chainId: number\n /** Circuit base URL (default: '/circuits/') */\n circuitBaseUrl?: string\n /** ASP ID to use (default: DEMO_ASP_ID) */\n aspId?: bigint\n /** All approved origins in the ASP tree (enables multi-origin proofs) */\n aspApprovedOrigins?: bigint[]\n}\n\n/**\n * Transfer result\n */\nexport interface TransferBuildResult {\n /** Circuit type used */\n circuit: UPPCircuitType\n /** Formatted PLONK proof for contract */\n proof: {\n proofStruct: PlonkProofStruct\n publicSignals: bigint[]\n }\n /** Public signals from proof */\n publicSignals: string[]\n /** State tree root */\n stateRoot: bigint\n /** ASP tree root */\n aspRoot: bigint\n /** Nullifier hash */\n nullifier: bigint\n /** Output commitment 1 */\n outputCommitment1: bigint\n /** Output commitment 2 */\n outputCommitment2: bigint\n /** Token address */\n token: bigint\n /** Recipient output */\n recipientOutput: NoteCreationResult\n /** Change output */\n changeOutput: NoteCreationResult\n /** Notes that will be spent */\n spentNotes: SpendableNote[]\n}\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Chunk size for paginated RPC queries on testnets */\nconst RPC_CHUNK_SIZE = 9000n\n\n/**\n * Pad an array to the state tree depth (32 levels)\n * @param arr - Array to pad\n * @param padValue - Value to use for padding (default: '0')\n * @returns Padded array of length STATE_TREE_DEPTH\n */\nfunction padToStateTreeDepth<T>(arr: T[], padValue: T): T[] {\n if (arr.length >= STATE_TREE_DEPTH) {\n return arr.slice(0, STATE_TREE_DEPTH)\n }\n return [...arr, ...Array(STATE_TREE_DEPTH - arr.length).fill(padValue)]\n}\n\n/**\n * Pad an array to the ASP tree depth (20 levels)\n * @param arr - Array to pad\n * @param padValue - Value to use for padding (default: '0')\n * @returns Padded array of length ASP_TREE_DEPTH\n */\nfunction padToASPTreeDepth<T>(arr: T[], padValue: T): T[] {\n if (arr.length >= ASP_TREE_DEPTH) {\n return arr.slice(0, ASP_TREE_DEPTH)\n }\n return [...arr, ...Array(ASP_TREE_DEPTH - arr.length).fill(padValue)]\n}\n\n/**\n * CommitmentInserted event — emitted by _insertLeaf() for ALL leaf insertions\n * (shield, transfer, merge, swap fill, swap claim, swap cancel).\n * This is the single canonical event for Merkle tree reconstruction.\n */\nconst COMMITMENT_INSERTED_EVENT = {\n type: 'event' as const,\n name: 'CommitmentInserted',\n inputs: [\n { type: 'bytes32', name: 'commitment', indexed: true },\n { type: 'uint256', name: 'leafIndex' },\n { type: 'uint256', name: 'timestamp' },\n ],\n}\n\n// ============================================================================\n// Merkle Tree Functions\n// ============================================================================\n\n/**\n * Fetch all commitments from the contract and build a Merkle tree\n *\n * @param publicClient - viem PublicClient\n * @param contractAddress - Contract address\n * @returns Object with tree and leaves array\n */\nexport async function syncMerkleTree(\n publicClient: PublicClient,\n contractAddress: Address\n): Promise<{ tree: ReturnType<typeof buildMerkleTree>; leaves: bigint[] }> {\n const currentBlock = await publicClient.getBlockNumber()\n const chainId = await publicClient.getChainId()\n\n // Use CommitmentInserted events — the canonical event emitted by _insertLeaf()\n // for ALL operations (shield, transfer, merge, swap fill/claim/cancel).\n // Each event has an explicit leafIndex, so ordering is deterministic.\n let commitmentLogs: any[] = []\n\n if (chainId === 31337) {\n // Anvil - single query is fine\n commitmentLogs = await publicClient.getLogs({\n address: contractAddress,\n event: COMMITMENT_INSERTED_EVENT,\n fromBlock: 0n,\n })\n } else {\n // Testnet/mainnet - paginate to avoid RPC limits\n const deployment = getDeployment(chainId)\n let fromBlock = deployment?.deployBlock ? BigInt(deployment.deployBlock) : 0n\n console.log(`[syncMerkleTree] Chain ${chainId}: scanning from block ${fromBlock} to ${currentBlock}`)\n\n while (fromBlock <= currentBlock) {\n const toBlock =\n fromBlock + RPC_CHUNK_SIZE > currentBlock ? currentBlock : fromBlock + RPC_CHUNK_SIZE\n const chunk = await publicClient.getLogs({\n address: contractAddress,\n event: COMMITMENT_INSERTED_EVENT,\n fromBlock,\n toBlock,\n })\n commitmentLogs = commitmentLogs.concat(chunk)\n fromBlock = toBlock + 1n\n }\n }\n\n // Sort by explicit leafIndex (most reliable), falling back to block+logIndex\n commitmentLogs.sort((a: any, b: any) => {\n const idxA = Number(a.args.leafIndex!)\n const idxB = Number(b.args.leafIndex!)\n return idxA - idxB\n })\n\n // Build leaves array using the explicit leafIndex from each event\n const leaves: bigint[] = []\n for (const log of commitmentLogs) {\n const leafIndex = Number(log.args.leafIndex!)\n const commitment = BigInt(log.args.commitment!)\n\n if (leaves.length !== leafIndex) {\n console.warn(\n `[syncMerkleTree] WARNING: Expected leafIndex ${leaves.length} but event has ${leafIndex}. ` +\n `This may indicate missed events or reorg.`\n )\n }\n leaves.push(commitment)\n }\n\n const tree = buildMerkleTree(leaves)\n\n // Debug: compare our root with on-chain root\n const ourRoot = await tree.getRoot()\n const onChainRoot = (await publicClient.readContract({\n address: contractAddress,\n abi: [\n {\n type: 'function',\n name: 'getMerkleRoot',\n inputs: [],\n outputs: [{ type: 'uint256' }],\n stateMutability: 'view',\n },\n ],\n functionName: 'getMerkleRoot',\n })) as bigint\n\n console.log(`[syncMerkleTree] Leaves count: ${leaves.length}`)\n console.log(`[syncMerkleTree] Tree depth: ${tree.depth}`)\n console.log(`[syncMerkleTree] Our computed root: ${ourRoot}`)\n console.log(`[syncMerkleTree] On-chain root: ${onChainRoot}`)\n console.log(`[syncMerkleTree] Roots match: ${ourRoot === onChainRoot}`)\n\n if (ourRoot !== onChainRoot) {\n console.log(`[syncMerkleTree] WARNING: Root mismatch!`)\n console.log(\n `[syncMerkleTree] Leaves:`,\n leaves.map((l) => '0x' + l.toString(16))\n )\n }\n\n return { tree, leaves }\n}\n\n/**\n * Get Merkle proofs for a set of notes\n *\n * @param notes - Notes to get proofs for\n * @param leaves - All leaves in the tree\n * @param tree - Merkle tree instance\n * @returns Array of proofs with associated notes\n */\nexport async function getMerkleProofsForNotes(\n notes: SpendableNote[],\n leaves: bigint[],\n tree: ReturnType<typeof buildMerkleTree>\n): Promise<MerkleProofWithNote[]> {\n const { verifyMerkleProof } = await import('../utils/merkle.js')\n const proofs: MerkleProofWithNote[] = []\n\n for (const note of notes) {\n const commitmentBI = BigInt(note.commitment)\n const leafIndex = leaves.findIndex((l) => l === commitmentBI)\n\n console.log(`[getMerkleProofsForNotes] Note commitment: ${note.commitment}`)\n console.log(`[getMerkleProofsForNotes] Note commitment as BigInt: ${commitmentBI}`)\n console.log(`[getMerkleProofsForNotes] Found at leafIndex: ${leafIndex}`)\n console.log(`[getMerkleProofsForNotes] Note's stored leafIndex: ${note.leafIndex}`)\n\n if (leafIndex === -1) {\n console.log(`[getMerkleProofsForNotes] Leaves in tree:`, leaves.map((l) => l.toString()))\n throw new Error(`Note ${note.commitment.slice(0, 10)}... not found on-chain`)\n }\n\n const proof = await tree.getProof(leafIndex)\n\n console.log(`[getMerkleProofsForNotes] Proof root: ${proof.root}`)\n console.log(`[getMerkleProofsForNotes] Proof leafIndex: ${proof.leafIndex}`)\n console.log(`[getMerkleProofsForNotes] PathElements:`, proof.pathElements.map((e) => e.toString()))\n console.log(`[getMerkleProofsForNotes] PathIndices:`, proof.pathIndices)\n\n // Verify the proof locally before returning\n const isValid = await verifyMerkleProof(commitmentBI, proof)\n console.log(`[getMerkleProofsForNotes] Local proof verification: ${isValid}`)\n\n if (!isValid) {\n console.error(`[getMerkleProofsForNotes] WARNING: Merkle proof is invalid!`)\n }\n\n proofs.push({ proof, note: { ...note, leafIndex } })\n }\n\n return proofs\n}\n\n// ============================================================================\n// Circuit Input Building\n// ============================================================================\n\n/**\n * Compute nullifier for a UPP note (BLS12-381)\n *\n * nullifier = Poseidon(ownerSecret, leafIndex, commitment)\n *\n * @param ownerSecret - Owner secret (hash preimage)\n * @param leafIndex - Leaf index in Merkle tree\n * @param commitment - Note commitment\n * @returns Nullifier as bigint\n */\nexport async function computeNullifier(\n ownerSecret: bigint,\n leafIndex: number,\n commitment: bigint\n): Promise<bigint> {\n return await poseidon([ownerSecret, BigInt(leafIndex), commitment])\n}\n\n/**\n * Note with amount for circuit building\n */\nexport interface NoteWithAmount extends NoteCreationResult {\n amount: bigint\n}\n\n/**\n * Build circuit inputs for UPP transfer (1-in-2-out)\n *\n * @param noteProof - Merkle proof for input note\n * @param aspProof - ASP membership proof for input note's origin\n * @param recipientNote - Output note for recipient\n * @param changeNote - Output note for change\n * @returns UPP transfer circuit inputs\n */\nexport async function buildUPPTransferCircuitInputs(\n noteProof: MerkleProofWithNote,\n aspProof: ASPProof,\n recipientNote: NoteWithAmount,\n changeNote: NoteWithAmount\n): Promise<UPPTransferCircuitInputs> {\n const { proof, note } = noteProof\n\n // Compute owner hash from secret (hash-based ownership)\n const inputOwnerHash = poseidonOwnerHash(BigInt(note.ownerSecret))\n\n // Verify input commitment locally\n // BLS12-381 commitment: Poseidon(amount, ownerHash, blinding, origin, token)\n const localInputCommitment = computeNoteCommitment(\n note.amount,\n inputOwnerHash,\n note.blinding,\n note.origin,\n note.token,\n )\n\n const storedCommitment = BigInt(note.commitment)\n if (localInputCommitment !== storedCommitment) {\n console.error(`[buildUPPTransferCircuitInputs] COMMITMENT MISMATCH`)\n console.error(` amount: ${note.amount}, ownerHash: ${inputOwnerHash}`)\n console.error(` blinding: ${note.blinding}, origin: ${note.origin}, token: ${note.token}`)\n console.error(` local=${localInputCommitment}, stored=${storedCommitment}`)\n throw new Error(\n `Note commitment mismatch — this note was created with an outdated commitment formula. ` +\n `Clear your shielded account (localStorage) and re-shield tokens.`\n )\n }\n\n const nullifier = await computeNullifier(\n BigInt(note.ownerSecret),\n proof.leafIndex,\n BigInt(note.commitment)\n )\n\n return {\n // Public inputs\n stateRoot: String(proof.root),\n aspRoot: String(aspProof.aspRoot),\n nullifier: String(nullifier),\n outputCommitment1: String(recipientNote.commitment),\n outputCommitment2: String(changeNote.commitment),\n token: String(note.token),\n\n // Private inputs - Input Note\n inputAmount: String(note.amount),\n inputOneTimeSecret: String(BigInt(note.ownerSecret)),\n inputBlinding: String(note.blinding),\n inputOrigin: String(note.origin),\n inputLeafIndex: String(proof.leafIndex),\n inputPathElements: padToStateTreeDepth(proof.pathElements.map((e) => String(e)), '0'),\n inputPathIndices: padToStateTreeDepth(proof.pathIndices.map(String), '0'),\n\n // Private inputs - ASP Membership Proof\n aspPathElements: padToASPTreeDepth(aspProof.aspPathElements.map((e) => String(e)), '0'),\n aspPathIndices: padToASPTreeDepth(aspProof.aspPathIndices.map(String), '0'),\n\n // Private inputs - Output Notes (hash-based ownership)\n outputAmount1: String(recipientNote.amount),\n outputOwnerHash1: String(recipientNote.ownerHash),\n outputBlinding1: String(recipientNote.blinding),\n\n outputAmount2: String(changeNote.amount),\n outputOwnerHash2: String(changeNote.ownerHash),\n outputBlinding2: String(changeNote.blinding),\n }\n}\n\n// ============================================================================\n// Transfer Building\n// ============================================================================\n\nimport { DEMO_ASP_ID } from './asp.js'\n\n/**\n * Build a UPP transfer (proof + outputs)\n *\n * This prepares everything needed to submit the transaction.\n * UPP transfer is 1-in-2-out with ASP membership proof.\n *\n * @param ctx - Transfer context\n * @param selectedNote - Note to spend (UPP transfer uses exactly 1 input)\n * @param recipientNote - Output note for recipient\n * @param changeNote - Output note for change\n * @param onStageChange - Optional callback for stage updates\n * @returns Transfer build result with proof and outputs\n */\nexport async function buildTransfer(\n ctx: TransferContext,\n selectedNote: SpendableNote,\n recipientNote: NoteWithAmount,\n changeNote: NoteWithAmount,\n onStageChange?: (stage: TransferStage) => void\n): Promise<TransferBuildResult> {\n // 1. Sync Merkle tree\n onStageChange?.('syncing_merkle')\n const { tree, leaves } = await syncMerkleTree(ctx.publicClient, ctx.contractAddress)\n\n // 2. Get Merkle proof for note\n const noteProofs = await getMerkleProofsForNotes([selectedNote], leaves, tree)\n const noteProof = noteProofs[0]!\n\n // 3. Generate ASP proof for the note's origin\n const aspProof = await generateASPProof(\n ctx.aspId ?? DEMO_ASP_ID,\n selectedNote.origin,\n ctx.aspApprovedOrigins\n )\n\n // 4. Build circuit inputs and generate proof\n onStageChange?.('generating_proof')\n\n const circuitInputs = await buildUPPTransferCircuitInputs(\n noteProof,\n aspProof,\n recipientNote,\n changeNote\n )\n\n const { proof } = await generateUPPProof(\n 'transfer',\n circuitInputs,\n ctx.circuitBaseUrl ?? '/circuits/'\n )\n\n const formattedProof = await formatPlonkProofForContract(proof)\n\n return {\n circuit: 'transfer',\n proof: formattedProof,\n publicSignals: proof.publicSignals,\n stateRoot: BigInt(circuitInputs.stateRoot),\n aspRoot: BigInt(circuitInputs.aspRoot),\n nullifier: BigInt(circuitInputs.nullifier),\n outputCommitment1: BigInt(circuitInputs.outputCommitment1),\n outputCommitment2: BigInt(circuitInputs.outputCommitment2),\n token: BigInt(circuitInputs.token),\n recipientOutput: recipientNote,\n changeOutput: changeNote,\n spentNotes: [selectedNote],\n }\n}\n\n/**\n * Format output for contract call (post-quantum)\n */\nexport function formatOutputForContract(note: NoteCreationResult): {\n commitment: Hex\n searchTag: bigint\n ownerHash: bigint\n encryptedNote: Hex\n} {\n return {\n commitment: toHex(note.commitment, { size: 32 }),\n searchTag: note.searchTag,\n ownerHash: note.ownerHash,\n encryptedNote: note.encryptedNote as Hex,\n }\n}\n"]}
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk5BLMSTFQ_cjs = require('../chunk-5BLMSTFQ.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkVIBIC5L7_cjs = require('../chunk-VIBIC5L7.cjs');
|
|
5
5
|
var chunk23B5XSS4_cjs = require('../chunk-23B5XSS4.cjs');
|
|
6
6
|
var chunkXVIICZKW_cjs = require('../chunk-XVIICZKW.cjs');
|
|
7
7
|
var chunkSWTNJPK5_cjs = require('../chunk-SWTNJPK5.cjs');
|
|
@@ -36,27 +36,27 @@ Object.defineProperty(exports, "encryptNote", {
|
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "buildTransfer", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkVIBIC5L7_cjs.buildTransfer; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkVIBIC5L7_cjs.buildUPPTransferCircuitInputs; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "computeNullifier", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkVIBIC5L7_cjs.computeNullifier; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "formatOutputForContract", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkVIBIC5L7_cjs.formatOutputForContract; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "getMerkleProofsForNotes", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkVIBIC5L7_cjs.getMerkleProofsForNotes; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "syncMerkleTree", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkVIBIC5L7_cjs.syncMerkleTree; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "ADDRESS_VERSION", {
|
|
62
62
|
enumerable: true,
|
package/dist/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { NOTE_VERSION, createNote, createUPPClient, decryptNote, encryptNote } from '../chunk-O6ALW7DB.js';
|
|
2
|
-
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from '../chunk-
|
|
2
|
+
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from '../chunk-746OK22E.js';
|
|
3
3
|
export { ADDRESS_VERSION, DirectAccountAdapter, NoteStore, RATE_PRECISION, STARK_ADDRESS_VERSION, STARK_STEALTH_ADDRESS_PREFIX, STEALTH_ADDRESS_PREFIX, SWAP_EVENTS_ABI, SWAP_ORDER_CANCELLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_PLACED_EVENT, StorableAccountAdapter, computeCancelKeyHash, computeFillPercentage, computeGiveAmount, computeNoteEncryptionKey, computeRate, computeTakeAmount, computeTotalBuyAmount, createOneTimeKeys, decodeStarkStealthAddress, decodeStealthAddress, detectAddressType, encodeStarkStealthAddress, encodeStealthAddress, filterOrdersByASP, filterOrdersByTokenPair, formatRate, generateCancelSecret, generateStarkStealthAddress, generateStealthAddress, getCancelSecret, getOwnOrderIds, isFillerASPAccepted, isOrderActive, isValidStarkStealthAddress, isValidStealthAddress, removeCancelSecret, storeCancelSecret, verifyOwnership } from '../chunk-RNUG3EFC.js';
|
|
4
4
|
export { DEMO_ASP_ID, DEMO_ASP_NAME, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, createDemoASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof, verifyASPProof } from '../chunk-6IEYWJVS.js';
|
|
5
5
|
export { STARK_AMOUNT_SCALE } from '../chunk-7T4CUE6E.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk5BLMSTFQ_cjs = require('./chunk-5BLMSTFQ.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkVIBIC5L7_cjs = require('./chunk-VIBIC5L7.cjs');
|
|
5
|
+
var chunkCZRCIN6S_cjs = require('./chunk-CZRCIN6S.cjs');
|
|
6
6
|
var chunk7BNJV2ZS_cjs = require('./chunk-7BNJV2ZS.cjs');
|
|
7
7
|
var chunk23B5XSS4_cjs = require('./chunk-23B5XSS4.cjs');
|
|
8
8
|
var chunkXVIICZKW_cjs = require('./chunk-XVIICZKW.cjs');
|
|
@@ -3729,55 +3729,55 @@ Object.defineProperty(exports, "encryptNote", {
|
|
|
3729
3729
|
});
|
|
3730
3730
|
Object.defineProperty(exports, "buildTransfer", {
|
|
3731
3731
|
enumerable: true,
|
|
3732
|
-
get: function () { return
|
|
3732
|
+
get: function () { return chunkVIBIC5L7_cjs.buildTransfer; }
|
|
3733
3733
|
});
|
|
3734
3734
|
Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
|
|
3735
3735
|
enumerable: true,
|
|
3736
|
-
get: function () { return
|
|
3736
|
+
get: function () { return chunkVIBIC5L7_cjs.buildUPPTransferCircuitInputs; }
|
|
3737
3737
|
});
|
|
3738
3738
|
Object.defineProperty(exports, "computeNullifier", {
|
|
3739
3739
|
enumerable: true,
|
|
3740
|
-
get: function () { return
|
|
3740
|
+
get: function () { return chunkVIBIC5L7_cjs.computeNullifier; }
|
|
3741
3741
|
});
|
|
3742
3742
|
Object.defineProperty(exports, "formatOutputForContract", {
|
|
3743
3743
|
enumerable: true,
|
|
3744
|
-
get: function () { return
|
|
3744
|
+
get: function () { return chunkVIBIC5L7_cjs.formatOutputForContract; }
|
|
3745
3745
|
});
|
|
3746
3746
|
Object.defineProperty(exports, "getDeployment", {
|
|
3747
3747
|
enumerable: true,
|
|
3748
|
-
get: function () { return
|
|
3748
|
+
get: function () { return chunkVIBIC5L7_cjs.getDeployment; }
|
|
3749
3749
|
});
|
|
3750
3750
|
Object.defineProperty(exports, "getDeploymentOrThrow", {
|
|
3751
3751
|
enumerable: true,
|
|
3752
|
-
get: function () { return
|
|
3752
|
+
get: function () { return chunkVIBIC5L7_cjs.getDeploymentOrThrow; }
|
|
3753
3753
|
});
|
|
3754
3754
|
Object.defineProperty(exports, "getMerkleProofsForNotes", {
|
|
3755
3755
|
enumerable: true,
|
|
3756
|
-
get: function () { return
|
|
3756
|
+
get: function () { return chunkVIBIC5L7_cjs.getMerkleProofsForNotes; }
|
|
3757
3757
|
});
|
|
3758
3758
|
Object.defineProperty(exports, "getSupportedChainIds", {
|
|
3759
3759
|
enumerable: true,
|
|
3760
|
-
get: function () { return
|
|
3760
|
+
get: function () { return chunkVIBIC5L7_cjs.getSupportedChainIds; }
|
|
3761
3761
|
});
|
|
3762
3762
|
Object.defineProperty(exports, "getTokenAddress", {
|
|
3763
3763
|
enumerable: true,
|
|
3764
|
-
get: function () { return
|
|
3764
|
+
get: function () { return chunkVIBIC5L7_cjs.getTokenAddress; }
|
|
3765
3765
|
});
|
|
3766
3766
|
Object.defineProperty(exports, "hasDeployment", {
|
|
3767
3767
|
enumerable: true,
|
|
3768
|
-
get: function () { return
|
|
3768
|
+
get: function () { return chunkVIBIC5L7_cjs.hasDeployment; }
|
|
3769
3769
|
});
|
|
3770
3770
|
Object.defineProperty(exports, "registerDeployment", {
|
|
3771
3771
|
enumerable: true,
|
|
3772
|
-
get: function () { return
|
|
3772
|
+
get: function () { return chunkVIBIC5L7_cjs.registerDeployment; }
|
|
3773
3773
|
});
|
|
3774
3774
|
Object.defineProperty(exports, "syncMerkleTree", {
|
|
3775
3775
|
enumerable: true,
|
|
3776
|
-
get: function () { return
|
|
3776
|
+
get: function () { return chunkVIBIC5L7_cjs.syncMerkleTree; }
|
|
3777
3777
|
});
|
|
3778
3778
|
Object.defineProperty(exports, "makeRpcIndexer", {
|
|
3779
3779
|
enumerable: true,
|
|
3780
|
-
get: function () { return
|
|
3780
|
+
get: function () { return chunkCZRCIN6S_cjs.makeRpcIndexer; }
|
|
3781
3781
|
});
|
|
3782
3782
|
Object.defineProperty(exports, "DEFAULT_KEY_DERIVATION_CONFIG", {
|
|
3783
3783
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { NOTE_VERSION, createNote, createUPPClient, decryptNote, encryptNote } from './chunk-O6ALW7DB.js';
|
|
2
|
-
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getDeployment, getDeploymentOrThrow, getMerkleProofsForNotes, getSupportedChainIds, getTokenAddress, hasDeployment, registerDeployment, syncMerkleTree } from './chunk-
|
|
3
|
-
export { makeRpcIndexer } from './chunk-
|
|
2
|
+
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getDeployment, getDeploymentOrThrow, getMerkleProofsForNotes, getSupportedChainIds, getTokenAddress, hasDeployment, registerDeployment, syncMerkleTree } from './chunk-746OK22E.js';
|
|
3
|
+
export { makeRpcIndexer } from './chunk-VDZSF5GW.js';
|
|
4
4
|
export { DEFAULT_KEY_DERIVATION_CONFIG, deriveDualKeysFromSignature, deriveKeysFromSignature, deriveNullifierKey, derivePerNoteKey, derivePerNoteKeyFromKeys, deriveStarkKeysFromSignature, deriveStarkPerNoteKey, deriveStarkPerNoteKeyFromKeys, exportViewingKeysForAudit, getKeyDerivationMessage, getViewingKeyFromExport, validateAuditKeyExport, verifyKeysMatchSignature } from './chunk-DTEAFJG7.js';
|
|
5
5
|
export { ADDRESS_VERSION, DirectAccountAdapter, NoteStore, RATE_PRECISION, STARK_ADDRESS_VERSION, STARK_STEALTH_ADDRESS_PREFIX, STEALTH_ADDRESS_PREFIX, SWAP_EVENTS_ABI, SWAP_ORDER_CANCELLED_EVENT, SWAP_ORDER_CLAIMED_EVENT, SWAP_ORDER_FILLED_EVENT, SWAP_ORDER_PLACED_EVENT, StorableAccountAdapter, computeCancelKeyHash, computeFillPercentage, computeGiveAmount, computeNoteEncryptionKey, computeRate, computeTakeAmount, computeTotalBuyAmount, createOneTimeKeys, decodeStarkStealthAddress, decodeStealthAddress, detectAddressType, encodeStarkStealthAddress, encodeStealthAddress, filterOrdersByASP, filterOrdersByTokenPair, formatRate, generateCancelSecret, generateStarkStealthAddress, generateStealthAddress, getCancelSecret, getOwnOrderIds, isFillerASPAccepted, isOrderActive, isValidStarkStealthAddress, isValidStealthAddress, removeCancelSecret, storeCancelSecret, verifyOwnership } from './chunk-RNUG3EFC.js';
|
|
6
6
|
export { DEMO_ASP_ID, DEMO_ASP_NAME, buildASPTree, computeMultiOriginASPRoot, computeSingleOriginASPRoot, createDemoASPRoot, generateASPProof, generateMultiOriginASPProof, generateSingleOriginASPProof, verifyASPProof } from './chunk-6IEYWJVS.js';
|
package/dist/indexer/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCZRCIN6S_cjs = require('../chunk-CZRCIN6S.cjs');
|
|
4
4
|
var chunkERQE57IA_cjs = require('../chunk-ERQE57IA.cjs');
|
|
5
5
|
require('../chunk-G7VZBCD6.cjs');
|
|
6
6
|
|
|
@@ -8,23 +8,23 @@ require('../chunk-G7VZBCD6.cjs');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "computeSearchTag", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkCZRCIN6S_cjs.computeSearchTag; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "makeRpcIndexer", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkCZRCIN6S_cjs.makeRpcIndexer; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "matchesSearchTag", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkCZRCIN6S_cjs.matchesSearchTag; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "tryDecryptNote", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkCZRCIN6S_cjs.tryDecryptNote; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "unpackNoteData", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkCZRCIN6S_cjs.unpackNoteData; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createAutoAdapter", {
|
|
30
30
|
enumerable: true,
|
package/dist/indexer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-
|
|
1
|
+
export { computeSearchTag, makeRpcIndexer, matchesSearchTag, tryDecryptNote, unpackNoteData } from '../chunk-VDZSF5GW.js';
|
|
2
2
|
export { createAutoAdapter, createIndexedDBAdapter, createLocalStorageAdapter, createMemoryAdapter, indexedDBAdapter, localStorageAdapter, memoryAdapter } from '../chunk-XV72HNHN.js';
|
|
3
3
|
import '../chunk-Z6ZWNWWR.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.cjs
CHANGED
|
@@ -1597,7 +1597,7 @@ function usePoolTransfer(config) {
|
|
|
1597
1597
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1598
1598
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1599
1599
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1600
|
-
import('../transfer-
|
|
1600
|
+
import('../transfer-KKFEYGL4.cjs'),
|
|
1601
1601
|
import('../proof-VINVGL4F.cjs'),
|
|
1602
1602
|
import('../asp-CUE3NMBN.cjs')
|
|
1603
1603
|
]);
|
|
@@ -1746,7 +1746,7 @@ function useWithdraw(config) {
|
|
|
1746
1746
|
const token = BigInt(selectedNote.token);
|
|
1747
1747
|
setStage("creating_outputs");
|
|
1748
1748
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1749
|
-
import('../transfer-
|
|
1749
|
+
import('../transfer-KKFEYGL4.cjs'),
|
|
1750
1750
|
import('../proof-VINVGL4F.cjs'),
|
|
1751
1751
|
import('../index.cjs')
|
|
1752
1752
|
]);
|
|
@@ -2116,7 +2116,7 @@ function useSwap(config) {
|
|
|
2116
2116
|
}
|
|
2117
2117
|
setStage("creating_outputs");
|
|
2118
2118
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2119
|
-
import('../transfer-
|
|
2119
|
+
import('../transfer-KKFEYGL4.cjs'),
|
|
2120
2120
|
import('../proof-VINVGL4F.cjs'),
|
|
2121
2121
|
import('../index.cjs'),
|
|
2122
2122
|
import('../asp-CUE3NMBN.cjs')
|
|
@@ -2258,7 +2258,7 @@ function useSwap(config) {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
setStage("creating_outputs");
|
|
2260
2260
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2261
|
-
import('../transfer-
|
|
2261
|
+
import('../transfer-KKFEYGL4.cjs'),
|
|
2262
2262
|
import('../proof-VINVGL4F.cjs'),
|
|
2263
2263
|
import('../index.cjs'),
|
|
2264
2264
|
import('../asp-CUE3NMBN.cjs')
|
|
@@ -2478,7 +2478,7 @@ function useSwap(config) {
|
|
|
2478
2478
|
createNoteForSelf(changeAmount, origin, token)
|
|
2479
2479
|
]);
|
|
2480
2480
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2481
|
-
import('../transfer-
|
|
2481
|
+
import('../transfer-KKFEYGL4.cjs'),
|
|
2482
2482
|
import('../proof-VINVGL4F.cjs'),
|
|
2483
2483
|
import('../asp-CUE3NMBN.cjs')
|
|
2484
2484
|
]);
|
package/dist/react/index.js
CHANGED
|
@@ -1596,7 +1596,7 @@ function usePoolTransfer(config) {
|
|
|
1596
1596
|
const recipientNote = await createNoteForSelf(amount, origin, token);
|
|
1597
1597
|
const changeNote = await createNoteForSelf(changeAmount, origin, token);
|
|
1598
1598
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
1599
|
-
import('../transfer-
|
|
1599
|
+
import('../transfer-SGPJB6AK.js'),
|
|
1600
1600
|
import('../proof-XQG5DN5N.js'),
|
|
1601
1601
|
import('../asp-72WUGTQE.js')
|
|
1602
1602
|
]);
|
|
@@ -1745,7 +1745,7 @@ function useWithdraw(config) {
|
|
|
1745
1745
|
const token = BigInt(selectedNote.token);
|
|
1746
1746
|
setStage("creating_outputs");
|
|
1747
1747
|
const [transferModule, proofModule, sdk] = await Promise.all([
|
|
1748
|
-
import('../transfer-
|
|
1748
|
+
import('../transfer-SGPJB6AK.js'),
|
|
1749
1749
|
import('../proof-XQG5DN5N.js'),
|
|
1750
1750
|
import('../index.js')
|
|
1751
1751
|
]);
|
|
@@ -2115,7 +2115,7 @@ function useSwap(config) {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
setStage("creating_outputs");
|
|
2117
2117
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2118
|
-
import('../transfer-
|
|
2118
|
+
import('../transfer-SGPJB6AK.js'),
|
|
2119
2119
|
import('../proof-XQG5DN5N.js'),
|
|
2120
2120
|
import('../index.js'),
|
|
2121
2121
|
import('../asp-72WUGTQE.js')
|
|
@@ -2257,7 +2257,7 @@ function useSwap(config) {
|
|
|
2257
2257
|
}
|
|
2258
2258
|
setStage("creating_outputs");
|
|
2259
2259
|
const [transferModule, proofModule, sdk, aspModule] = await Promise.all([
|
|
2260
|
-
import('../transfer-
|
|
2260
|
+
import('../transfer-SGPJB6AK.js'),
|
|
2261
2261
|
import('../proof-XQG5DN5N.js'),
|
|
2262
2262
|
import('../index.js'),
|
|
2263
2263
|
import('../asp-72WUGTQE.js')
|
|
@@ -2477,7 +2477,7 @@ function useSwap(config) {
|
|
|
2477
2477
|
createNoteForSelf(changeAmount, origin, token)
|
|
2478
2478
|
]);
|
|
2479
2479
|
const [transferModule, proofModule, aspModule] = await Promise.all([
|
|
2480
|
-
import('../transfer-
|
|
2480
|
+
import('../transfer-SGPJB6AK.js'),
|
|
2481
2481
|
import('../proof-XQG5DN5N.js'),
|
|
2482
2482
|
import('../asp-72WUGTQE.js')
|
|
2483
2483
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVIBIC5L7_cjs = require('./chunk-VIBIC5L7.cjs');
|
|
4
4
|
require('./chunk-XVIICZKW.cjs');
|
|
5
5
|
require('./chunk-IIUKM5VE.cjs');
|
|
6
6
|
require('./chunk-HEHXSV47.cjs');
|
|
@@ -11,27 +11,27 @@ require('./chunk-G7VZBCD6.cjs');
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "buildTransfer", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkVIBIC5L7_cjs.buildTransfer; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkVIBIC5L7_cjs.buildUPPTransferCircuitInputs; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "computeNullifier", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkVIBIC5L7_cjs.computeNullifier; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "formatOutputForContract", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkVIBIC5L7_cjs.formatOutputForContract; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "getMerkleProofsForNotes", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkVIBIC5L7_cjs.getMerkleProofsForNotes; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "syncMerkleTree", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkVIBIC5L7_cjs.syncMerkleTree; }
|
|
35
35
|
});
|
|
36
|
-
//# sourceMappingURL=transfer-
|
|
37
|
-
//# sourceMappingURL=transfer-
|
|
36
|
+
//# sourceMappingURL=transfer-KKFEYGL4.cjs.map
|
|
37
|
+
//# sourceMappingURL=transfer-KKFEYGL4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-KKFEYGL4.cjs"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-
|
|
1
|
+
export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-746OK22E.js';
|
|
2
2
|
import './chunk-6IEYWJVS.js';
|
|
3
3
|
import './chunk-GPF72JFR.js';
|
|
4
4
|
import './chunk-5QSSX3KR.js';
|
|
5
5
|
import './chunk-KRLRJ3HN.js';
|
|
6
6
|
import './chunk-Z6ZWNWWR.js';
|
|
7
|
-
//# sourceMappingURL=transfer-
|
|
8
|
-
//# sourceMappingURL=transfer-
|
|
7
|
+
//# sourceMappingURL=transfer-SGPJB6AK.js.map
|
|
8
|
+
//# sourceMappingURL=transfer-SGPJB6AK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-SGPJB6AK.js"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
"UniversalPrivatePool": "
|
|
2
|
+
"UniversalPrivatePool": "0x8d7bddfb66bed215dd73525af3c7a0b596d37544",
|
|
3
3
|
"ASPRegistryHub": "0xfd11c56a23314aa88dfbcc36254f33e5e8b010df",
|
|
4
|
-
"TestToken": "
|
|
5
|
-
"TestToken2": "
|
|
4
|
+
"TestToken": "0x67ef1d13bbc7e0de9ea2c4e531024f66845234e8",
|
|
5
|
+
"TestToken2": "0xab36c0e6eb7edff36ec2e955eb490616051dc442",
|
|
6
6
|
"verifiers": {
|
|
7
|
-
"TransferVerifier": "
|
|
8
|
-
"MergeVerifier": "
|
|
9
|
-
"WithdrawVerifier": "
|
|
10
|
-
"JoinSplitVerifier": "
|
|
11
|
-
"MergeTransfer2x2Verifier": "
|
|
12
|
-
"MergeTransfer4x2Verifier": "
|
|
7
|
+
"TransferVerifier": "0xd64739cbb7dbd5ed35fd6842972cbb9c7bae6c12",
|
|
8
|
+
"MergeVerifier": "0x37a15c5c12c7843c77270a61c3c62fdc027ffb04",
|
|
9
|
+
"WithdrawVerifier": "0x18d4345dce5513a6c5fc57863dcf8c063c910e47",
|
|
10
|
+
"JoinSplitVerifier": "0x284018c3e4092a8e5a4ff3315ad58de116493e93",
|
|
11
|
+
"MergeTransfer2x2Verifier": "0xd9f1d970fa7c94ee68d7eecdbc12676b0e2836b6",
|
|
12
|
+
"MergeTransfer4x2Verifier": "0x597e97154a2dd8cf44939290299bc3586a1f894f"
|
|
13
13
|
},
|
|
14
14
|
"starkVerifiers": {
|
|
15
|
-
"CircleStarkVerifier": "
|
|
15
|
+
"CircleStarkVerifier": "0xda3380ab901c474fd8a44646eebb03fae0e601ce"
|
|
16
16
|
},
|
|
17
|
-
"deployBlock":
|
|
18
|
-
"deployTimestamp":
|
|
17
|
+
"deployBlock": 10548447,
|
|
18
|
+
"deployTimestamp": 1774810176621,
|
|
19
19
|
"proofSystem": "PLONK",
|
|
20
20
|
"curve": "BLS12-381",
|
|
21
21
|
"verifierType": "PlonkVerifierBLS12381"
|