{"version":3,"sources":["../src/rpc_interfaces.ts"],"sourcesContent":["import type {\n  EntriesSchema,\n  PODSchema,\n  PodspecProofRequest\n} from \"@parcnet-js/podspec\";\nimport type {\n  GPCBoundConfig,\n  GPCIdentifier,\n  GPCProof,\n  GPCRevealedClaims\n} from \"@pcd/gpc\";\nimport type { PODEntries } from \"@pcd/pod\";\nimport type { PODData } from \"./pod_data.js\";\n\n/**\n * @file This file contains the RPC interfaces for the Parcnet client.\n *\n * These interfaces are implemented in rpc_client.ts.\n */\n\nexport type PODQuery = PODSchema<EntriesSchema>;\n\nexport interface SubscriptionUpdateResult {\n  subscriptionId: string;\n  update: PODData[];\n}\n\nexport interface GPCProofReturn {\n  proof: GPCProof;\n  boundConfig: GPCBoundConfig;\n  revealedClaims: GPCRevealedClaims;\n}\n\nexport type ProveResult =\n  | ({\n      success: true;\n    } & GPCProofReturn)\n  | {\n      success: false;\n      error: string;\n    };\n\nexport interface ParcnetGPCRPC {\n  prove: ({\n    request,\n    collectionIds\n  }: {\n    request: PodspecProofRequest;\n    circuitIdentifier?: GPCIdentifier;\n    collectionIds?: string[];\n  }) => Promise<ProveResult>;\n  canProve: ({\n    request,\n    circuitIdentifier,\n    collectionIds\n  }: {\n    request: PodspecProofRequest;\n    circuitIdentifier?: GPCIdentifier;\n    collectionIds?: string[];\n  }) => Promise<boolean>;\n  verify: (\n    proof: GPCProof,\n    boundConfig: GPCBoundConfig,\n    revealedClaims: GPCRevealedClaims\n  ) => Promise<boolean>;\n  verifyWithProofRequest: (\n    proof: GPCProof,\n    boundConfig: GPCBoundConfig,\n    revealedClaims: GPCRevealedClaims,\n    proofRequest: PodspecProofRequest\n  ) => Promise<boolean>;\n}\n\nexport interface ParcnetIdentityRPC {\n  getSemaphoreV3Commitment: () => Promise<bigint>;\n  getSemaphoreV4Commitment: () => Promise<bigint>;\n  getPublicKey: () => Promise<string>;\n}\n\nexport interface ParcnetPODRPC {\n  // Returns array of serialized PODs\n  query: (collectionId: string, query: PODQuery) => Promise<PODData[]>;\n  insert: (collectionId: string, podData: PODData) => Promise<void>;\n  delete: (collectionId: string, signature: string) => Promise<void>;\n  subscribe: (collectionId: string, query: PODQuery) => Promise<string>;\n  unsubscribe: (subscriptionId: string) => Promise<void>;\n  // Returns serialized POD\n  sign: (entries: PODEntries) => Promise<PODData>;\n  signPrefixed: (entries: PODEntries) => Promise<PODData>;\n}\n\nexport interface ParcnetRPC {\n  _version: \"1\";\n  gpc: ParcnetGPCRPC;\n  identity: ParcnetIdentityRPC;\n  pod: ParcnetPODRPC;\n}\n\nexport interface ParcnetEvents {\n  on: (\n    event: \"subscription-update\",\n    callback: (result: SubscriptionUpdateResult) => void\n  ) => () => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}