@vlayer/react 0.1.0-nightly-20250121-bd67b4b → 0.1.0-nightly-20250121-fa87f47
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/package.json
CHANGED
@@ -103,8 +103,10 @@ describe("useWebproof", () => {
|
|
103
103
|
vi.advanceTimersByTime(1000);
|
104
104
|
rerender();
|
105
105
|
|
106
|
-
expect(result.current).
|
107
|
-
webProof: {
|
106
|
+
expect(result.current).toMatchObject({
|
107
|
+
webProof: {
|
108
|
+
webProofJson: JSON.stringify({ mock: "proof" }),
|
109
|
+
},
|
108
110
|
status: WebProofRequestStatus.success,
|
109
111
|
isIdle: false,
|
110
112
|
isPending: false,
|
@@ -2,17 +2,15 @@ import { useEffect, useState } from "react";
|
|
2
2
|
import { type Abi, type ContractFunctionName } from "viem";
|
3
3
|
import { useProofContext } from "../context";
|
4
4
|
import { WebProofRequestStatus } from "../types";
|
5
|
-
import {
|
6
|
-
ExtensionMessageType,
|
7
|
-
type GetWebProofArgs,
|
8
|
-
type PresentationJSON,
|
9
|
-
} from "@vlayer/sdk";
|
5
|
+
import { ExtensionMessageType, type GetWebProofArgs } from "@vlayer/sdk";
|
10
6
|
|
11
7
|
export const useWebProof = (
|
12
8
|
webProofRequest: GetWebProofArgs<Abi, ContractFunctionName>,
|
13
9
|
) => {
|
14
10
|
const { webProofProvider } = useProofContext();
|
15
|
-
const [webProof, setWebProof] = useState<
|
11
|
+
const [webProof, setWebProof] = useState<{
|
12
|
+
webProofJson: string;
|
13
|
+
} | null>(null);
|
16
14
|
const [error, setError] = useState<Error | null>(null);
|
17
15
|
const [status, setStatus] = useState<WebProofRequestStatus>(
|
18
16
|
WebProofRequestStatus.idle,
|
@@ -23,7 +21,9 @@ export const useWebProof = (
|
|
23
21
|
ExtensionMessageType.ProofDone,
|
24
22
|
({ payload: { proof } }) => {
|
25
23
|
console.log("useWebproof: ProofDone message", proof);
|
26
|
-
setWebProof(
|
24
|
+
setWebProof({
|
25
|
+
webProofJson: JSON.stringify(proof),
|
26
|
+
});
|
27
27
|
setStatus(WebProofRequestStatus.success);
|
28
28
|
},
|
29
29
|
);
|