New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vlayer/sdk

Package Overview
Dependencies
Maintainers
0
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vlayer/sdk - npm Package Compare versions

Comparing version 0.1.0-nightly-20241001-f254bee to 0.1.0-nightly-20241002-4630acc

src/api/lib/types/viem.ts

8

package.json

@@ -5,3 +5,4 @@ {

"module": "src/index.ts",
"version": "0.1.0-nightly-20241001-f254bee",
"version": "0.1.0-nightly-20241002-4630acc",
"types": "src/index.ts",
"scripts": {

@@ -15,3 +16,2 @@ "build": "npm run gen:types",

"@types/bun": "latest",
"@types/mailparser": "^3.4.4",
"abitype": "^1.0.6",

@@ -25,6 +25,6 @@ "vitest": "^2.1.1"

"dns-over-http-resolver": "^3.0.3",
"mailparser": "^3.7.1",
"postal-mime": "^2.3.2",
"viem": "^2.21.0"
"viem": "^2.21.0",
"zod": "^3.23.8"
}
}

@@ -21,10 +21,6 @@ import {

export const testChainId1 = 100001;
export const testChainId2 = 100002;
const rpcUrls: Map<number, HttpTransport> = new Map([
[testChainId1, http()],
[testChainId2, http("http://127.0.0.1:8546")],
]);
const rpcUrls: Map<number, HttpTransport> = new Map([[testChainId1, http()]]);
export const chainIds = [testChainId1, testChainId2];
export const chainIds = [testChainId1];

@@ -31,0 +27,0 @@ export function client(

import { VlayerClient } from "types/vlayer";
import { WebProofProvider } from "types/webProof";
import { WebProofProvider } from "types/webProofProvider";
import { prove } from "../prover";
export const createVlayerClient = ({

@@ -11,9 +12,9 @@ url,

}): VlayerClient => {
// TODO : implement high level api
console.log("createVlayerClient with", url, webProofProvider);
return {
prove: async () => {
console.log("prove");
console.log("url", url);
console.log("webProofProvider", webProofProvider);
prove: async ({ address, functionName, chainId, proverAbi, args }) => {
return prove(address, proverAbi, functionName, args, chainId);
},
};
};
export * from "./ethereum";
export * from "./webProof";
export * from "./utils";
export * from "./vlayer";
export * from "./webProofProvider";

@@ -1,3 +0,13 @@

import { Address, Hex } from "viem";
import {
Abi,
AbiFunction,
AbiStateMutability,
Address,
ContractFunctionArgs,
ContractFunctionName,
Hex,
} from "viem";
import { type ProverCallCommitment } from "types/webProofProvider.ts";
type Calldata = string;

@@ -33,3 +43,3 @@

];
commitment: {
assumptions: {
proverContractAddress: Address;

@@ -55,3 +65,15 @@ functionSelector: Hex;

export type VlayerClient = {
prove: () => void;
prove: <
T extends readonly [AbiFunction, ...Abi[number][]],
F extends ContractFunctionName<T>,
>(
args: VlayerClientProveArgs<T, F>,
) => void;
};
export type VlayerClientProveArgs<
T extends readonly [AbiFunction, ...Abi[number][]],
F extends ContractFunctionName<T>,
> = ProverCallCommitment<T, F> & {
args: ContractFunctionArgs<T, AbiStateMutability, F>;
};

@@ -1,4 +0,4 @@

//NOTE : this is copied from tlsn-js 5.4
// for some reason newest vertsions doesnt not export this type (clarification is in progress)
// probaly it should be reexported from tlsn-js
// NOTE : this is copied from tlsn-js 5.4
// for some reason newest versions doesn't export this type (clarification is in progress)
// probably it should be reexported from tlsn-js

@@ -103,5 +103,10 @@ export interface WebProof {

}
export type WebProofProvider = {
requestProof: (url: string) => Promise<WebProof>;
export const assertWebProof = function (candidate: {
notaryUrl?: string;
}): asserts candidate is WebProof {
//for now only thing we check is notary url
//TODO: implement later once we known the conteact with tlsn-js
if (!candidate.notaryUrl) {
throw new Error("Missing required parameter");
}
};

@@ -12,3 +12,3 @@ import {

import { type CallContext, type CallParams, Proof } from "types/vlayer";
import { type CallContext, type CallParams } from "types/vlayer";
import { v_call } from "./v_call";

@@ -47,29 +47,10 @@ import { testChainId1 } from "./helpers";

const returnValue = decodeFunctionResult({
const [, ...returnValue] = decodeFunctionResult({
abi: abi as Abi,
data: evm_call_result,
functionName: functionName as string,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}) as any[];
addDynamicParamsOffsets(abi, functionName, proof);
return { proof, returnValue: returnValue as `0x${string}`[] };
return { proof, returnValue };
}
function addDynamicParamsOffsets(
abi: Abi,
functionName: string | undefined,
proof: Proof,
) {
const proverFunction = abi.find(
(f) => f.type === "function" && f.name === functionName,
) as AbiFunction;
if (proverFunction?.outputs && proverFunction.outputs.length > 0) {
const secondVerifyMethodParamType = proverFunction.outputs[0].type;
if (secondVerifyMethodParamType === "string") {
proof.dynamicParamsOffsets[0] = BigInt(32);
}
}
}

@@ -9,1 +9,4 @@ export { v_call } from "./api/v_call";

export { preverifyEmail } from "./api/email/preverify.ts";
export * from "./api/webProof";
export * from "./api/lib/types";
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc