diff --git a/examples/test-app/package.json b/examples/test-app/package.json index 3fd51b9..3a55be4 100644 --- a/examples/test-app/package.json +++ b/examples/test-app/package.json @@ -14,10 +14,7 @@ "@parcnet-js/client-rpc": "workspace:*", "@parcnet-js/podspec": "workspace:*", "@parcnet-js/ticket-spec": "workspace:*", - "@pcd/pod": "0.1.7", - "json-bigint": "^1.0.0", - "@semaphore-protocol/identity": "^3.15.2", - "lodash": "^4.17.21", + "@pcd/pod": "^0.3.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^5.0.1", @@ -27,7 +24,6 @@ "@parcnet-js/eslint-config": "workspace:*", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.14", - "@types/json-bigint": "^1.0.1", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", diff --git a/examples/test-app/src/apis/GPC.tsx b/examples/test-app/src/apis/GPC.tsx index ee32bc0..e117bad 100644 --- a/examples/test-app/src/apis/GPC.tsx +++ b/examples/test-app/src/apis/GPC.tsx @@ -1,7 +1,6 @@ import type { ProveResult } from "@parcnet-js/client-rpc"; import type { PODData, PodspecProofRequest } from "@parcnet-js/podspec"; import { TicketSpec, ticketProofRequest } from "@parcnet-js/ticket-spec"; -import JSONBig from "json-bigint"; import type { ReactNode } from "react"; import { useEffect, useState } from "react"; import { TryIt } from "../components/TryIt"; @@ -141,7 +140,10 @@ const gpcProof = await z.gpc.prove({ request }); /> {proveResult && (
-              {JSONBig.stringify(proveResult, null, 2)}
+              {JSON.stringify(proveResult, (key, value) =>
+                // eslint-disable-next-line @typescript-eslint/no-unsafe-return
+                typeof value === "bigint" ? value.toString() : value
+              )}
             
)} @@ -308,7 +310,10 @@ const gpcProof = await z.gpc.prove({ request: request.schema }); /> {proveResult && (
-              {JSONBig.stringify(proveResult, null, 2)}
+              {JSON.stringify(proveResult, (key, value) =>
+                // eslint-disable-next-line @typescript-eslint/no-unsafe-return
+                typeof value === "bigint" ? value.toString() : value
+              )}
             
)} diff --git a/examples/test-app/src/apis/PODSection.tsx b/examples/test-app/src/apis/PODSection.tsx index 5917fc8..8d5d67f 100644 --- a/examples/test-app/src/apis/PODSection.tsx +++ b/examples/test-app/src/apis/PODSection.tsx @@ -2,8 +2,7 @@ import type { ParcnetAPI, Subscription } from "@parcnet-js/app-connector"; import * as p from "@parcnet-js/podspec"; import type { PODData } from "@parcnet-js/podspec"; import type { PODEntries, PODValue } from "@pcd/pod"; -import { POD_INT_MAX, POD_INT_MIN } from "@pcd/pod"; -import JSONBig from "json-bigint"; +import { POD_INT_MAX, POD_INT_MIN } from "@pcd/pod/podTypes"; import type { Dispatch, ReactNode, SetStateAction } from "react"; import { useReducer, useState } from "react"; import { Button } from "../components/Button"; @@ -102,14 +101,15 @@ const pods = await z.pod.collection("${selectedCollection}").query(q); /> {pods !== undefined && (
-          {JSONBig.stringify(
+          {JSON.stringify(
             pods.map((p) => ({
               entries: p.entries,
               signature: p.signature,
               signerPublicKey: p.signerPublicKey
             })),
-            null,
-            2
+            (key, value) =>
+              // eslint-disable-next-line @typescript-eslint/no-unsafe-return
+              typeof value === "bigint" ? value.toString() : value
           )}
         
)} @@ -695,14 +695,15 @@ const sub = await z.pod.collection("${selectedCollection}").subscribe(q); {pods.length > 0 && subscription !== null && (
-            {JSONBig.stringify(
+            {JSON.stringify(
               pods.map((p) => ({
                 entries: p.entries,
                 signature: p.signature,
                 signerPublicKey: p.signerPublicKey
               })),
-              null,
-              2
+              (key, value) =>
+                // eslint-disable-next-line @typescript-eslint/no-unsafe-return
+                typeof value === "bigint" ? value.toString() : value
             )}
           
diff --git a/packages/podspec/package.json b/packages/podspec/package.json index 57fcb8e..e27749e 100644 --- a/packages/podspec/package.json +++ b/packages/podspec/package.json @@ -45,7 +45,7 @@ "@pcd/proto-pod-gpc-artifacts": "^0.11.0", "@semaphore-protocol/identity": "^3.15.2", "@types/uuid": "^9.0.0", - "@zk-kit/eddsa-poseidon": "1.0.3", + "@zk-kit/eddsa-poseidon": "^1.0.3", "tsup": "^8.2.4", "typescript": "^5.5", "uuid": "^9.0.0", diff --git a/packages/podspec/src/parse/entries.ts b/packages/podspec/src/parse/entries.ts index bf212cc..8c5b318 100644 --- a/packages/podspec/src/parse/entries.ts +++ b/packages/podspec/src/parse/entries.ts @@ -1,5 +1,5 @@ import type { PODEntries, PODValue } from "@pcd/pod"; -import { checkPODName } from "@pcd/pod"; +import { checkPODName } from "@pcd/pod/podChecks"; import type { PodspecBaseIssue, PodspecInvalidEntryNameIssue, diff --git a/packages/podspec/src/parse/entry.ts b/packages/podspec/src/parse/entry.ts index 92de9a8..af8a4fe 100644 --- a/packages/podspec/src/parse/entry.ts +++ b/packages/podspec/src/parse/entry.ts @@ -1,5 +1,5 @@ import type { PODCryptographicValue, PODIntValue } from "@pcd/pod"; -import { checkBigintBounds } from "@pcd/pod"; +import { checkBigintBounds } from "@pcd/pod/podChecks"; import type { PodspecBaseIssue, PodspecNotInRangeIssue } from "../error.js"; import { IssueCode } from "../error.js"; import type { DefinedEntrySchema } from "../schemas/entry.js"; diff --git a/packages/podspec/src/parse/parse_utils.ts b/packages/podspec/src/parse/parse_utils.ts index e4b352e..8d6b1c3 100644 --- a/packages/podspec/src/parse/parse_utils.ts +++ b/packages/podspec/src/parse/parse_utils.ts @@ -9,7 +9,7 @@ import { checkBigintBounds, checkPODValue, checkPublicKeyFormat -} from "@pcd/pod"; +} from "@pcd/pod/podChecks"; import type { PodspecBaseIssue, PodspecExcludedByListIssue, diff --git a/packages/podspec/src/schemas/cryptographic.ts b/packages/podspec/src/schemas/cryptographic.ts index f760cc8..377ce6e 100644 --- a/packages/podspec/src/schemas/cryptographic.ts +++ b/packages/podspec/src/schemas/cryptographic.ts @@ -1,5 +1,8 @@ import type { PODCryptographicValue, PODName } from "@pcd/pod"; -import { POD_CRYPTOGRAPHIC_MAX, POD_CRYPTOGRAPHIC_MIN } from "@pcd/pod"; +import { + POD_CRYPTOGRAPHIC_MAX, + POD_CRYPTOGRAPHIC_MIN +} from "@pcd/pod/podTypes"; import type { PodspecInvalidTypeIssue } from "../error.js"; import { IssueCode } from "../error.js"; import type { ParseResult } from "../parse/parse_utils.js"; diff --git a/packages/podspec/src/schemas/int.ts b/packages/podspec/src/schemas/int.ts index 2cc1959..63ed69d 100644 --- a/packages/podspec/src/schemas/int.ts +++ b/packages/podspec/src/schemas/int.ts @@ -1,5 +1,5 @@ import type { PODIntValue, PODName } from "@pcd/pod"; -import { POD_INT_MAX, POD_INT_MIN } from "@pcd/pod"; +import { POD_INT_MAX, POD_INT_MIN } from "@pcd/pod/podTypes"; import type { PodspecInvalidTypeIssue } from "../error.js"; import { IssueCode } from "../error.js"; import type { ParseResult } from "../parse/parse_utils.js"; diff --git a/packages/podspec/test/podspec.spec.ts b/packages/podspec/test/podspec.spec.ts index 76e8240..692e017 100644 --- a/packages/podspec/test/podspec.spec.ts +++ b/packages/podspec/test/podspec.spec.ts @@ -1,7 +1,8 @@ import path from "path"; import type { GPCBoundConfig } from "@pcd/gpc"; import { gpcProve, gpcVerify } from "@pcd/gpc"; -import { POD, POD_INT_MAX, POD_INT_MIN } from "@pcd/pod"; +import { POD } from "@pcd/pod"; +import { POD_INT_MAX, POD_INT_MIN } from "@pcd/pod/podTypes"; import { v4 as uuidv4 } from "uuid"; import { assert, describe, expect, it } from "vitest"; import type { diff --git a/packages/ticket-spec/package.json b/packages/ticket-spec/package.json index 5a73bda..b6cd1a1 100644 --- a/packages/ticket-spec/package.json +++ b/packages/ticket-spec/package.json @@ -32,8 +32,8 @@ "devDependencies": { "@parcnet-js/eslint-config": "workspace:*", "@parcnet-js/typescript-config": "workspace:*", - "@pcd/gpc": "0.2.0", - "@pcd/pod": "0.3.0", + "@pcd/gpc": "^0.2.0", + "@pcd/pod": "^0.3.0", "@pcd/proto-pod-gpc-artifacts": "^0.9.0", "@semaphore-protocol/core": "^4.0.3", "@semaphore-protocol/identity": "^3.15.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74bdb8d..a19181b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -191,17 +191,8 @@ importers: specifier: workspace:* version: link:../../packages/ticket-spec '@pcd/pod': - specifier: 0.1.7 - version: 0.1.7 - '@semaphore-protocol/identity': - specifier: ^3.15.2 - version: 3.15.2 - json-bigint: - specifier: ^1.0.0 - version: 1.0.0 - lodash: - specifier: ^4.17.21 - version: 4.17.21 + specifier: ^0.3.0 + version: 0.3.0 react: specifier: ^18.2.0 version: 18.3.1 @@ -224,9 +215,6 @@ importers: '@tailwindcss/typography': specifier: ^0.5.14 version: 0.5.15(tailwindcss@3.4.10(ts-node@10.9.2(@types/node@20.16.3)(typescript@5.5.4))) - '@types/json-bigint': - specifier: ^1.0.1 - version: 1.0.4 '@types/node': specifier: ^20 version: 20.16.3 @@ -260,9 +248,6 @@ importers: packages/app-connector: dependencies: - '@brenoroosevelt/toast': - specifier: ^2.0.3 - version: 2.0.3 '@parcnet-js/client-rpc': specifier: workspace:* version: link:../client-rpc @@ -288,12 +273,6 @@ importers: '@parcnet-js/typescript-config': specifier: workspace:* version: link:../typescript-config - '@types/json-bigint': - specifier: ^1.0.1 - version: 1.0.4 - '@types/node': - specifier: ^22.5.4 - version: 22.5.4 tsup: specifier: ^8.2.4 version: 8.2.4(jiti@1.21.6)(postcss@8.4.44)(tsx@4.19.0)(typescript@5.5.4)(yaml@2.5.1) @@ -302,7 +281,7 @@ importers: version: 5.5.4 vitest: specifier: ^2.0.5 - version: 2.0.5(@types/node@22.5.4)(terser@5.34.1) + version: 2.0.5(@types/node@22.5.5)(terser@5.34.1) packages/client-helpers: dependencies: @@ -424,8 +403,8 @@ importers: specifier: ^9.0.0 version: 9.0.8 '@zk-kit/eddsa-poseidon': - specifier: 1.0.3 - version: 1.0.3 + specifier: ^1.0.3 + version: 1.0.4 tsup: specifier: ^8.2.4 version: 8.2.4(jiti@1.21.6)(postcss@8.4.44)(tsx@4.19.0)(typescript@5.5.4)(yaml@2.5.1) @@ -728,9 +707,6 @@ packages: cpu: [x64] os: [win32] - '@brenoroosevelt/toast@2.0.3': - resolution: {integrity: sha512-Tivp/tA5EUkQFP9LVmop8Y9EuxVtuom8x+5gYOFjfib/1oATX7QWAc4cKSELd36HoeDIThXD3vDxTy2FVUsRBA==} - '@changesets/apply-release-plan@7.0.5': resolution: {integrity: sha512-1cWCk+ZshEkSVEZrm2fSj1Gz8sYvxgUL4Q78+1ZZqeqfuevPTPk033/yUZ3df8BKMohkqqHfzj0HOOrG0KtXTw==} @@ -1371,9 +1347,6 @@ packages: '@pcd/gpcircuits@0.3.0': resolution: {integrity: sha512-BZn+Cr6fp0lVXfLIJxYcG3PQN1Jio5DrPBRSugSMQNBU/Q8lOPwqGysICL+kIG2k7uZ4qp7wJ8ERGOsgQypp1g==} - '@pcd/pod@0.1.7': - resolution: {integrity: sha512-y8wPXLw36VPsTBYR05TkURyb5v1S40kQmDwL26sEDxX90ZwAv6vTIjRpC4pmxk5gIFGtxTgxMembfrH2vZDOkA==} - '@pcd/pod@0.3.0': resolution: {integrity: sha512-7bWchkdMn1z+cZcNdNMl9t7WhFfhmbT3xVKojZWDxKW/cB60t/ohZ+SIgzf0/6TnY4NqRK+udsI3pn2D2wszmA==} @@ -1383,9 +1356,6 @@ packages: '@pcd/proto-pod-gpc-artifacts@0.9.0': resolution: {integrity: sha512-DipHMqcwpwCGy0/4hpENYjhKPcxVDEM4Koe13L1QpDYlOVVlUfsV9Y5ObpjtZELH4Q8jLWEW2tnMW9vR+c388w==} - '@pcd/util@0.5.4': - resolution: {integrity: sha512-BkG3PxujAOE3K9odBJqMUzhvK97tzJwVrMTbqSqhGqHnKLVQNuzhURkbdjoNfVRSp8BwaxP516ocjyY1KrxpuA==} - '@pcd/util@0.7.0': resolution: {integrity: sha512-LVSNKvTppLhqNvjwFyXm1eVPuIh8NglsFx4epy6/LiMtr6GfrFDou6+R7kT33CAfACDsyVf/vw15ugRCnN6h9A==} @@ -1771,9 +1741,6 @@ packages: '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} - '@types/json-bigint@1.0.4': - resolution: {integrity: sha512-ydHooXLbOmxBbubnA7Eh+RpBzuaIiQjh8WGJYQB50JFGFrdxW7JzVlyEV7fAXw0T2sqJ1ysTneJbiyNLqZRAag==} - '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} @@ -2033,9 +2000,6 @@ packages: '@zk-kit/eddsa-poseidon@1.0.4': resolution: {integrity: sha512-w0HrF5F+Kh+77+VK/p9qzB7wvitiZMAoWnqrmzPUM+MWlaNp0ipmtuO8KTLxnj8ACjt98GAK4voxl7XeWjC4XQ==} - '@zk-kit/lean-imt@2.0.1': - resolution: {integrity: sha512-yc0rh9BCY6VvvKrZUNejfucuWscy1iRb9JrppuJktsiA9HcEukB3oX9CB7N/CUmCtqzmdwybet6N2aglGL/SUQ==} - '@zk-kit/lean-imt@2.1.0': resolution: {integrity: sha512-RbG6QmTrurken7HzrJQouKiXKyGTpcoD+czQ1jvExRIA83k9w+SEsRdB7anPE8WoMKWAandDe09BzDCk6AirSw==} @@ -4318,9 +4282,6 @@ packages: poseidon-lite@0.2.0: resolution: {integrity: sha512-vivDZnGmz8W4G/GzVA72PXkfYStjilu83rjjUfpL4PueKcC8nfX6hCPh2XhoC5FBgC6y0TA3YuUeUo5YCcNoig==} - poseidon-lite@0.2.1: - resolution: {integrity: sha512-xIr+G6HeYfOhCuswdqcFpSX47SPhm0EpisWJ6h7fHlWwaVIvH3dLnejpatrtw6Xc6HaLrpq05y7VRfvDmDGIog==} - poseidon-lite@0.3.0: resolution: {integrity: sha512-ilJj4MIve4uBEG7SrtPqUUNkvpJ/pLVbndxa0WvebcQqeIhe+h72JR4g0EvwchUzm9sOQDlOjiDNmRAgxNZl4A==} @@ -6132,8 +6093,6 @@ snapshots: '@biomejs/cli-win32-x64@1.9.1': optional: true - '@brenoroosevelt/toast@2.0.3': {} - '@changesets/apply-release-plan@7.0.5': dependencies: '@changesets/config': 3.0.3 @@ -6768,17 +6727,6 @@ snapshots: snarkjs: 0.7.4 url-join: 4.0.1 - '@pcd/pod@0.1.7': - dependencies: - '@pcd/util': 0.5.4 - '@zk-kit/baby-jubjub': 1.0.1 - '@zk-kit/eddsa-poseidon': 1.0.3 - '@zk-kit/lean-imt': 2.0.1 - '@zk-kit/utils': 1.2.0 - js-sha256: 0.10.1 - json-bigint: 1.0.0 - poseidon-lite: 0.2.1 - '@pcd/pod@0.3.0': dependencies: '@pcd/util': 0.7.0 @@ -6793,14 +6741,6 @@ snapshots: '@pcd/proto-pod-gpc-artifacts@0.9.0': {} - '@pcd/util@0.5.4': - dependencies: - buffer: 6.0.3 - email-validator: 2.0.4 - js-sha256: 0.10.1 - secure-random: 1.1.2 - uuid: 9.0.1 - '@pcd/util@0.7.0': dependencies: buffer: 6.0.3 @@ -7199,8 +7139,6 @@ snapshots: dependencies: '@types/unist': 3.0.3 - '@types/json-bigint@1.0.4': {} - '@types/json-schema@7.0.15': {} '@types/json5@0.0.29': {} @@ -7571,10 +7509,6 @@ snapshots: buffer: 6.0.3 poseidon-lite: 0.3.0 - '@zk-kit/lean-imt@2.0.1': - dependencies: - '@zk-kit/utils': 1.0.0 - '@zk-kit/lean-imt@2.1.0': dependencies: '@zk-kit/utils': 1.2.0 @@ -10511,8 +10445,6 @@ snapshots: poseidon-lite@0.2.0: {} - poseidon-lite@0.2.1: {} - poseidon-lite@0.3.0: {} possible-typed-array-names@1.0.0: {} @@ -11893,24 +11825,6 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.0.5(@types/node@22.5.4)(terser@5.34.1): - dependencies: - cac: 6.7.14 - debug: 4.3.7 - pathe: 1.1.2 - tinyrainbow: 1.2.0 - vite: 5.4.4(@types/node@22.5.4)(terser@5.34.1) - transitivePeerDependencies: - - '@types/node' - - less - - lightningcss - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - vite-node@2.0.5(@types/node@22.5.5)(terser@5.34.1): dependencies: cac: 6.7.14 @@ -11989,16 +11903,6 @@ snapshots: fsevents: 2.3.3 terser: 5.34.1 - vite@5.4.4(@types/node@22.5.4)(terser@5.34.1): - dependencies: - esbuild: 0.21.5 - postcss: 8.4.44 - rollup: 4.21.2 - optionalDependencies: - '@types/node': 22.5.4 - fsevents: 2.3.3 - terser: 5.34.1 - vite@5.4.4(@types/node@22.5.5)(terser@5.34.1): dependencies: esbuild: 0.21.5 @@ -12013,39 +11917,6 @@ snapshots: optionalDependencies: vite: 5.4.4(@types/node@22.5.5)(terser@5.34.1) - vitest@2.0.5(@types/node@22.5.4)(terser@5.34.1): - dependencies: - '@ampproject/remapping': 2.3.0 - '@vitest/expect': 2.0.5 - '@vitest/pretty-format': 2.0.5 - '@vitest/runner': 2.0.5 - '@vitest/snapshot': 2.0.5 - '@vitest/spy': 2.0.5 - '@vitest/utils': 2.0.5 - chai: 5.1.1 - debug: 4.3.6 - execa: 8.0.1 - magic-string: 0.30.11 - pathe: 1.1.2 - std-env: 3.7.0 - tinybench: 2.9.0 - tinypool: 1.0.1 - tinyrainbow: 1.2.0 - vite: 5.4.4(@types/node@22.5.4)(terser@5.34.1) - vite-node: 2.0.5(@types/node@22.5.4)(terser@5.34.1) - why-is-node-running: 2.3.0 - optionalDependencies: - '@types/node': 22.5.4 - transitivePeerDependencies: - - less - - lightningcss - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - vitest@2.0.5(@types/node@22.5.5)(terser@5.34.1): dependencies: '@ampproject/remapping': 2.3.0