@vlayer/sdk 0.1.0-nightly-20241016-2d34385 → 0.1.0-nightly-20241016-4769145

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
@@ -2,7 +2,7 @@
2
2
  "name": "@vlayer/sdk",
3
3
  "type": "module",
4
4
  "exports": "./src/index.ts",
5
- "version": "0.1.0-nightly-20241016-2d34385",
5
+ "version": "0.1.0-nightly-20241016-4769145",
6
6
  "types": "src/index.ts",
7
7
  "scripts": {
8
8
  "build": "npm run gen:types",
@@ -30,7 +30,7 @@ describe("parseEmail", () => {
30
30
  const email = await parseEmail(
31
31
  `${emailHeaders}${dkimHeader}\n${dkimHeader2}\n\n${body}`,
32
32
  );
33
- const dkim = email.headers.filter((h) => h.key === "dkim-signature")!;
33
+ const dkim = email.headers.filter((h) => h.key === "dkim-signature");
34
34
 
35
35
  expect(dkim).toHaveLength(2);
36
36
  expect(parseParams(dkim[0].value).s).toBe("selector1");
@@ -5,7 +5,7 @@ import { prove } from "../prover";
5
5
  import { createExtensionWebProofProvider } from "../webProof";
6
6
  import { type Abi, decodeFunctionResult } from "viem";
7
7
 
8
- function dropProofFromArgs(args: unknown) {
8
+ function dropEmptyProofFromArgs(args: unknown) {
9
9
  if (Array.isArray(args)) {
10
10
  return args.slice(1);
11
11
  }
@@ -32,7 +32,6 @@ export const createVlayerClient = (
32
32
  webProofProvider: createExtensionWebProofProvider(),
33
33
  },
34
34
  ): VlayerClient => {
35
- // TODO : implement high level api
36
35
  console.log("createVlayerClient with", url, webProofProvider);
37
36
  const resultHashMap = new Map<
38
37
  string,
@@ -62,15 +61,15 @@ export const createVlayerClient = (
62
61
  result: { proof, evm_call_result },
63
62
  } = await savedProvingData[0];
64
63
 
65
- const result = dropProofFromArgs(
64
+ const result = dropEmptyProofFromArgs(
66
65
  decodeFunctionResult({
67
- abi: savedProvingData[1] as Abi,
66
+ abi: savedProvingData[1],
68
67
  data: evm_call_result,
69
- functionName: savedProvingData[2] as string,
68
+ functionName: savedProvingData[2],
70
69
  }),
71
70
  );
72
71
 
73
- return { proof, result };
72
+ return [proof, ...result];
74
73
  },
75
74
  };
76
75
  };
@@ -1,5 +1,6 @@
1
1
  import { Abi, Address, Hex } from "viem";
2
- import { Branded } from "@vlayer/web-proof-commons";
2
+ import { Branded } from "../../../web-proof-commons";
3
+
3
4
  export type Bytecode = {
4
5
  object: Hex;
5
6
  };
@@ -59,7 +59,6 @@ export interface VCallResponse {
59
59
  id: number;
60
60
  }
61
61
 
62
- // Add more methods here
63
62
  export type VlayerClient = {
64
63
  prove: <
65
64
  T extends readonly [AbiFunction, ...Abi[number][]],
@@ -71,7 +70,7 @@ export type VlayerClient = {
71
70
  hash,
72
71
  }: {
73
72
  hash: string;
74
- }) => Promise<{ proof: Proof; result: unknown[] }>;
73
+ }) => Promise<[Proof, ...unknown[]]>;
75
74
  };
76
75
 
77
76
  export type VlayerClientProveArgs<
@@ -5,7 +5,7 @@ import {
5
5
  WebProof,
6
6
  WebProofStepExpectUrl,
7
7
  WebProofStepStartPage,
8
- } from "@vlayer/web-proof-commons";
8
+ } from "../../../web-proof-commons";
9
9
 
10
10
  export type WebProofSetupInput = {
11
11
  logoUrl: string;
@@ -10,7 +10,7 @@ import {
10
10
  ExtensionMessageType,
11
11
  type MessageToExtension,
12
12
  WebProof,
13
- } from "@vlayer/web-proof-commons";
13
+ } from "../../../web-proof-commons";
14
14
 
15
15
  // NOTE @types/chrome and webextension-polyfill work only in the extension context
16
16
  // and looks that there is no community driven package providing typings for chrome.runtime
@@ -63,7 +63,7 @@ export const createExtensionWebProofProvider = (
63
63
  resolve(message.proof);
64
64
  }
65
65
  if (message.type === ExtensionMessageType.ProofError) {
66
- reject(message.error);
66
+ reject(new Error(message.error));
67
67
  }
68
68
  });
69
69
  });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXTENSION_STEP,
3
3
  WebProofStepExpectUrl,
4
- } from "@vlayer/web-proof-commons";
4
+ } from "../../../web-proof-commons";
5
5
 
6
6
  export const expectUrl = (url: string, label: string) => {
7
7
  return {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXTENSION_STEP,
3
3
  WebProofStepNotarize,
4
- } from "@vlayer/web-proof-commons";
4
+ } from "../../../web-proof-commons";
5
5
 
6
6
  export const notarize = (
7
7
  url: string,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXTENSION_STEP,
3
3
  WebProofStepStartPage,
4
- } from "@vlayer/web-proof-commons";
4
+ } from "../../../web-proof-commons";
5
5
 
6
6
  export const startPage = (url: string, label: string) => {
7
7
  return {
package/tsconfig.json CHANGED
@@ -24,8 +24,6 @@
24
24
  "paths": {
25
25
  "types/*": ["./src/api/lib/types/*"],
26
26
  "testHelpers/*": ["./src/testHelpers/*"],
27
- "@vlayer/web-proof-commons" : ["./web-proof-commons"],
28
27
  },
29
-
30
28
  }
31
- }
29
+ }