From acd3329f31f280c7f61d95b02bb33aac5c6117ae Mon Sep 17 00:00:00 2001 From: nicoshark Date: Sat, 29 Mar 2025 01:13:45 +0900 Subject: [PATCH] Feat/proof conversion (#491) * export castFromScope * export proof conversion --- common/src/utils/contracts/formatCallData.ts | 12 ++++++++++++ contracts/test/integration/verifyAll.test.ts | 2 +- sdk/core/package.json | 2 +- sdk/core/src/index.ts | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/src/utils/contracts/formatCallData.ts b/common/src/utils/contracts/formatCallData.ts index b6a04a3ca..7dca0b34a 100644 --- a/common/src/utils/contracts/formatCallData.ts +++ b/common/src/utils/contracts/formatCallData.ts @@ -80,3 +80,15 @@ export function packForbiddenCountriesList(forbiddenCountries: string[]): string return output; } + +export function formatProof(proof: any, publicSignals: any) { + return { + a: proof.a, + b: [ + [proof.b[0][1], proof.b[0][0]], + [proof.b[1][1], proof.b[1][0]], + ], + c: proof.c, + pubSignals: publicSignals, + }; +} diff --git a/contracts/test/integration/verifyAll.test.ts b/contracts/test/integration/verifyAll.test.ts index b139efd76..21a1a8e48 100644 --- a/contracts/test/integration/verifyAll.test.ts +++ b/contracts/test/integration/verifyAll.test.ts @@ -104,7 +104,7 @@ describe("VerifyAll", () => { vcAndDiscloseProof: vcAndDiscloseProof }; - const types = ['0', '1', '2']; // Example types + const types = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']; // Example types const [readableData, success] = await verifyAll.verifyAll( timestamp, vcAndDiscloseHubProof, diff --git a/sdk/core/package.json b/sdk/core/package.json index 85d34583b..bf27018e2 100644 --- a/sdk/core/package.json +++ b/sdk/core/package.json @@ -1,6 +1,6 @@ { "name": "@selfxyz/core", - "version": "0.0.14", + "version": "0.0.15", "repository": { "type": "git", "url": "https://github.com/selfxyz/self" diff --git a/sdk/core/src/index.ts b/sdk/core/src/index.ts index 90b39afab..f3e3d7821 100644 --- a/sdk/core/src/index.ts +++ b/sdk/core/src/index.ts @@ -1,4 +1,5 @@ import { castFromScope } from '@common/utils/circuits/uuid'; +import { formatProof } from '@common/utils/contracts/formatCallData'; export { SelfBackendVerifier } from './SelfBackendVerifier'; -export { castFromScope }; +export { castFromScope, formatProof };