@vlayer/sdk 0.1.0-nightly-20241009-3c85ef5 → 0.1.0-nightly-20241009-c348db7

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vlayer/sdk",
3
3
  "type": "module",
4
4
  "module": "src/index.ts",
5
- "version": "0.1.0-nightly-20241009-3c85ef5",
5
+ "version": "0.1.0-nightly-20241009-c348db7",
6
6
  "types": "src/index.ts",
7
7
  "scripts": {
8
8
  "build": "npm run gen:types",
@@ -21,7 +21,7 @@ const rpcUrls: Map<number, HttpTransport> = new Map([[foundry.id, http()]]);
21
21
 
22
22
  export const chainIds = [foundry.id];
23
23
 
24
- export function client(
24
+ export function createAnvilClient(
25
25
  chainId: number = foundry.id,
26
26
  ): ReturnType<typeof walletActions> & PublicClient {
27
27
  const transport = rpcUrls.get(chainId);
@@ -43,7 +43,7 @@ export async function deployContract(
43
43
  args: ContractArg[] = [],
44
44
  chainId: number = foundry.id,
45
45
  ): Promise<Address> {
46
- const ethClient = client(chainId);
46
+ const ethClient = createAnvilClient(chainId);
47
47
 
48
48
  const [deployer] = await ethClient.getAddresses();
49
49
 
@@ -113,7 +113,7 @@ export async function call<
113
113
  args?: ContractFunctionArgs<T, "pure" | "view", F>,
114
114
  chainId: number = foundry.id,
115
115
  ) {
116
- const ethClient = client(chainId);
116
+ const ethClient = createAnvilClient(chainId);
117
117
 
118
118
  return ethClient.readContract({
119
119
  abi,
@@ -134,7 +134,7 @@ export async function writeContract<
134
134
  sender?: Address,
135
135
  chainId: number = foundry.id,
136
136
  ) {
137
- const ethClient = client(chainId);
137
+ const ethClient = createAnvilClient(chainId);
138
138
  const selectedSender = sender || (await ethClient.getAddresses())[0];
139
139
 
140
140
  const txHash = await ethClient.writeContract({
@@ -160,4 +160,4 @@ export const getTestAccount = () => privateKeyToAccount(generatePrivateKey());
160
160
 
161
161
  export const getTestAddresses = (
162
162
  chainId: number = foundry.id,
163
- ): Promise<Address[]> => client(chainId).getAddresses();
163
+ ): Promise<Address[]> => createAnvilClient(chainId).getAddresses();
package/src/api/prover.ts CHANGED
@@ -11,13 +11,8 @@ import {
11
11
 
12
12
  import { type CallContext, type CallParams } from "types/vlayer";
13
13
  import { v_call } from "./v_call";
14
- import { ContractSpec } from "types/ethereum";
15
14
  import { foundry } from "viem/chains";
16
15
 
17
- export async function getContractSpec(file: string): Promise<ContractSpec> {
18
- return Bun.file(file).json();
19
- }
20
-
21
16
  export async function prove<
22
17
  T extends readonly [AbiFunction, ...Abi[number][]],
23
18
  F extends ContractFunctionName<T>,
package/src/index.ts CHANGED
@@ -1,10 +1,4 @@
1
- export { v_call } from "./api/v_call";
2
- export type { CallParams, CallContext } from "types/vlayer";
3
- export type { ContractSpec } from "types/ethereum";
4
-
5
- export { getContractSpec } from "./api/prover";
6
1
  export * as testHelpers from "./api/helpers";
7
- export { client as createTestClient } from "./api/helpers";
8
2
  export { preverifyEmail } from "./api/email/preverify.ts";
9
3
  export { createVlayerClient } from "./api/lib/client.ts";
10
4