@vlayer/sdk 0.1.0-nightly-20241016-4769145 → 0.1.0-nightly-20241018-2f0aade
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.ts +2 -2
- package/src/api/helpers.ts +3 -6
- package/src/api/lib/client.ts +2 -1
- package/src/api/lib/types/ethereum.ts +0 -1
- package/src/api/lib/types/vlayer.ts +4 -16
- package/src/api/lib/types/webProofProvider.ts +2 -7
- package/src/index.ts +3 -0
- package/src/web-proof-commons/types/message.ts +3 -1
package/package.json
CHANGED
@@ -26,13 +26,13 @@ export function parseParams(str: string) {
|
|
26
26
|
.split("=")
|
27
27
|
.map((v) => v && v.trim()),
|
28
28
|
),
|
29
|
-
)
|
29
|
+
) as Record<string, string>;
|
30
30
|
}
|
31
31
|
|
32
32
|
function parseHeader(header: Header) {
|
33
33
|
const params = parseParams(header.value);
|
34
34
|
if (!params) {
|
35
|
-
throw new DkimParsingError(`Invalid DKIM header ${header}`);
|
35
|
+
throw new DkimParsingError(`Invalid DKIM header ${header.value}`);
|
36
36
|
}
|
37
37
|
|
38
38
|
if (!params.d) {
|
package/src/api/helpers.ts
CHANGED
@@ -13,16 +13,13 @@ import {
|
|
13
13
|
} from "viem";
|
14
14
|
|
15
15
|
import { privateKeyToAccount, generatePrivateKey } from "viem/accounts";
|
16
|
-
import { foundry
|
16
|
+
import { foundry } from "viem/chains";
|
17
17
|
|
18
18
|
import type { ContractSpec, ContractArg } from "types/ethereum";
|
19
19
|
|
20
|
-
const rpcUrls: Map<number, HttpTransport> = new Map([
|
21
|
-
[foundry.id, http()],
|
22
|
-
[optimismSepolia.id, http("https://sepolia.optimism.io")],
|
23
|
-
]);
|
20
|
+
const rpcUrls: Map<number, HttpTransport> = new Map([[foundry.id, http()]]);
|
24
21
|
|
25
|
-
export const chainIds = [foundry.id
|
22
|
+
export const chainIds = [foundry.id];
|
26
23
|
|
27
24
|
export function createAnvilClient(
|
28
25
|
chainId: number = foundry.id,
|
package/src/api/lib/client.ts
CHANGED
@@ -7,7 +7,7 @@ import { type Abi, decodeFunctionResult } from "viem";
|
|
7
7
|
|
8
8
|
function dropEmptyProofFromArgs(args: unknown) {
|
9
9
|
if (Array.isArray(args)) {
|
10
|
-
return args.slice(1);
|
10
|
+
return args.slice(1) as unknown[];
|
11
11
|
}
|
12
12
|
return [];
|
13
13
|
}
|
@@ -39,6 +39,7 @@ export const createVlayerClient = (
|
|
39
39
|
>();
|
40
40
|
|
41
41
|
return {
|
42
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
42
43
|
prove: async ({ address, functionName, chainId, proverAbi, args }) => {
|
43
44
|
const result_promise = prove(
|
44
45
|
address,
|
@@ -21,32 +21,20 @@ export type CallContext = {
|
|
21
21
|
chain_id: number; // 31337
|
22
22
|
};
|
23
23
|
|
24
|
-
export
|
24
|
+
export type Proof = {
|
25
25
|
length: bigint;
|
26
26
|
seal: {
|
27
27
|
verifierSelector: Hex;
|
28
|
-
seal: [Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex];
|
28
|
+
seal: readonly [Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex];
|
29
29
|
mode: number;
|
30
30
|
};
|
31
|
-
|
32
|
-
bigint,
|
33
|
-
bigint,
|
34
|
-
bigint,
|
35
|
-
bigint,
|
36
|
-
bigint,
|
37
|
-
bigint,
|
38
|
-
bigint,
|
39
|
-
bigint,
|
40
|
-
bigint,
|
41
|
-
bigint,
|
42
|
-
];
|
43
|
-
assumptions: {
|
31
|
+
callAssumptions: {
|
44
32
|
proverContractAddress: Address;
|
45
33
|
functionSelector: Hex;
|
46
34
|
settleBlockHash: Hex;
|
47
35
|
settleBlockNumber: bigint;
|
48
36
|
};
|
49
|
-
}
|
37
|
+
};
|
50
38
|
|
51
39
|
export interface VCallResult {
|
52
40
|
evm_call_result: Hex;
|
@@ -1,15 +1,10 @@
|
|
1
1
|
import { AbiFunction, Hex, Abi, ContractFunctionName } from "viem";
|
2
2
|
import type { ContractFunctionArgsWithout } from "./viem";
|
3
|
-
import {
|
4
|
-
Branded,
|
5
|
-
WebProof,
|
6
|
-
WebProofStepExpectUrl,
|
7
|
-
WebProofStepStartPage,
|
8
|
-
} from "../../../web-proof-commons";
|
3
|
+
import { Branded, WebProof, WebProofStep } from "../../../web-proof-commons";
|
9
4
|
|
10
5
|
export type WebProofSetupInput = {
|
11
6
|
logoUrl: string;
|
12
|
-
steps: [
|
7
|
+
steps: WebProofStep[];
|
13
8
|
};
|
14
9
|
|
15
10
|
export type WebProofSetup = Branded<
|
package/src/index.ts
CHANGED
@@ -23,12 +23,14 @@ export const enum ExtensionMessageType {
|
|
23
23
|
ProofDone = "ProofDone",
|
24
24
|
ProofError = "ProofError",
|
25
25
|
RedirectBack = "RedirectBack",
|
26
|
+
TabOpened = "TabOpened",
|
26
27
|
}
|
27
28
|
|
28
29
|
export type ExtensionMessage =
|
29
30
|
| { type: ExtensionMessageType.ProofDone; proof: WebProof }
|
30
31
|
| { type: ExtensionMessageType.ProofError; error: string }
|
31
|
-
| { type: ExtensionMessageType.RedirectBack }
|
32
|
+
| { type: ExtensionMessageType.RedirectBack }
|
33
|
+
| { type: ExtensionMessageType.TabOpened; tabId: number };
|
32
34
|
|
33
35
|
export type WebProverSessionConfig = {
|
34
36
|
notaryUrl: string;
|