@vlayer/sdk 0.1.0-nightly-20241016-2d34385 → 0.1.0-nightly-20241016-4769145
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/api/email/parseEmail.test.ts +1 -1
- package/src/api/lib/client.ts +5 -6
- package/src/api/lib/types/ethereum.ts +2 -1
- package/src/api/lib/types/vlayer.ts +1 -2
- package/src/api/lib/types/webProofProvider.ts +1 -1
- package/src/api/webProof/providers/extension.ts +2 -2
- package/src/api/webProof/steps/expectUrl.ts +1 -1
- package/src/api/webProof/steps/notarize.ts +1 -1
- package/src/api/webProof/steps/startPage.ts +1 -1
- package/tsconfig.json +1 -3
- /package/{web-proof-commons → src/web-proof-commons}/index.ts +0 -0
- /package/{web-proof-commons → src/web-proof-commons}/types/message.ts +0 -0
- /package/{web-proof-commons → src/web-proof-commons}/types/webProof.ts +0 -0
- /package/{web-proof-commons → src/web-proof-commons}/utils.ts +0 -0
package/package.json
CHANGED
@@ -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");
|
package/src/api/lib/client.ts
CHANGED
@@ -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
|
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 =
|
64
|
+
const result = dropEmptyProofFromArgs(
|
66
65
|
decodeFunctionResult({
|
67
|
-
abi: savedProvingData[1]
|
66
|
+
abi: savedProvingData[1],
|
68
67
|
data: evm_call_result,
|
69
|
-
functionName: savedProvingData[2]
|
68
|
+
functionName: savedProvingData[2],
|
70
69
|
}),
|
71
70
|
);
|
72
71
|
|
73
|
-
return
|
72
|
+
return [proof, ...result];
|
74
73
|
},
|
75
74
|
};
|
76
75
|
};
|
@@ -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<
|
73
|
+
}) => Promise<[Proof, ...unknown[]]>;
|
75
74
|
};
|
76
75
|
|
77
76
|
export type VlayerClientProveArgs<
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
ExtensionMessageType,
|
11
11
|
type MessageToExtension,
|
12
12
|
WebProof,
|
13
|
-
} from "
|
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
|
});
|
package/tsconfig.json
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|