@vlayer/sdk 0.1.0-nightly-20241114-4867874 → 0.1.0-nightly-20241114-b5e205a

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
- import { Chain } from "viem";
1
+ import { type Chain, type CustomTransport, custom } from "viem";
2
2
  import { Config } from "./getConfig.js";
3
- export declare const createContext: (config: Config) => Promise<{
3
+ export declare const customTransport: typeof custom;
4
+ export { Chain };
5
+ export declare const createContext: (config: Config, transport?: CustomTransport) => Promise<{
4
6
  chain: Chain;
5
7
  account: {
6
8
  address: import("viem").Address;
@@ -21,7 +23,7 @@ export declare const createContext: (config: Config) => Promise<{
21
23
  type: "local";
22
24
  };
23
25
  jsonRpcUrl: string;
24
- ethClient: import("viem").Client<import("viem").HttpTransport, Chain, undefined, import("viem").WalletRpcSchema, {
26
+ ethClient: import("viem").Client<import("viem").HttpTransport | CustomTransport, Chain, undefined, import("viem").WalletRpcSchema, {
25
27
  call: (parameters: import("viem").CallParameters<Chain>) => Promise<import("viem").CallReturnType>;
26
28
  createBlockFilter: () => Promise<import("viem").CreateBlockFilterReturnType>;
27
29
  createContractEventFilter: <const abi extends import("viem").Abi | readonly unknown[], eventName extends import("viem").ContractEventName<abi> | undefined, args extends import("viem").MaybeExtractEventArgsFromAbi<abi, eventName> | undefined, strict extends boolean | undefined = undefined, fromBlock extends import("viem").BlockNumber | import("viem").BlockTag | undefined = undefined, toBlock extends import("viem").BlockNumber | import("viem").BlockTag | undefined = undefined>(args: import("viem").CreateContractEventFilterParameters<abi, eventName, args, strict, fromBlock, toBlock>) => Promise<import("viem").CreateContractEventFilterReturnType<abi, eventName, args, strict, fromBlock, toBlock>>;
@@ -4941,10 +4943,10 @@ export declare const createContext: (config: Config) => Promise<{
4941
4943
  uninstallFilter: (args: import("viem").UninstallFilterParameters) => Promise<import("viem").UninstallFilterReturnType>;
4942
4944
  waitForTransactionReceipt: (args: import("viem").WaitForTransactionReceiptParameters<Chain>) => Promise<import("viem").TransactionReceipt>;
4943
4945
  watchBlockNumber: (args: import("viem").WatchBlockNumberParameters) => import("viem").WatchBlockNumberReturnType;
4944
- watchBlocks: <includeTransactions extends boolean = false, blockTag extends import("viem").BlockTag = "latest">(args: import("viem").WatchBlocksParameters<import("viem").HttpTransport, Chain, includeTransactions, blockTag>) => import("viem").WatchBlocksReturnType;
4945
- watchContractEvent: <const abi extends import("viem").Abi | readonly unknown[], eventName extends import("viem").ContractEventName<abi>, strict extends boolean | undefined = undefined>(args: import("viem").WatchContractEventParameters<abi, eventName, strict, import("viem").HttpTransport>) => import("viem").WatchContractEventReturnType;
4946
- watchEvent: <const abiEvent extends import("viem").AbiEvent | undefined = undefined, const abiEvents extends readonly import("viem").AbiEvent[] | readonly unknown[] | undefined = abiEvent extends import("viem").AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined>(args: import("viem").WatchEventParameters<abiEvent, abiEvents, strict, import("viem").HttpTransport>) => import("viem").WatchEventReturnType;
4947
- watchPendingTransactions: (args: import("viem").WatchPendingTransactionsParameters<import("viem").HttpTransport>) => import("viem").WatchPendingTransactionsReturnType;
4946
+ watchBlocks: <includeTransactions extends boolean = false, blockTag extends import("viem").BlockTag = "latest">(args: import("viem").WatchBlocksParameters<import("viem").HttpTransport | CustomTransport, Chain, includeTransactions, blockTag>) => import("viem").WatchBlocksReturnType;
4947
+ watchContractEvent: <const abi extends import("viem").Abi | readonly unknown[], eventName extends import("viem").ContractEventName<abi>, strict extends boolean | undefined = undefined>(args: import("viem").WatchContractEventParameters<abi, eventName, strict, import("viem").HttpTransport | CustomTransport>) => import("viem").WatchContractEventReturnType;
4948
+ watchEvent: <const abiEvent extends import("viem").AbiEvent | undefined = undefined, const abiEvents extends readonly import("viem").AbiEvent[] | readonly unknown[] | undefined = abiEvent extends import("viem").AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined>(args: import("viem").WatchEventParameters<abiEvent, abiEvents, strict, import("viem").HttpTransport | CustomTransport>) => import("viem").WatchEventReturnType;
4949
+ watchPendingTransactions: (args: import("viem").WatchPendingTransactionsParameters<import("viem").HttpTransport | CustomTransport>) => import("viem").WatchPendingTransactionsReturnType;
4948
4950
  } & import("viem").WalletActions<Chain, undefined>>;
4949
4951
  confirmations: number;
4950
4952
  chainName: string;
@@ -1,21 +1,21 @@
1
- import { createWalletClient, http, publicActions } from "viem";
1
+ import { createWalletClient, http, publicActions, custom, } from "viem";
2
2
  import { privateKeyToAccount } from "viem/accounts";
3
3
  import { getChainConfirmations } from "./getChainConfirmations.js";
4
4
  const getChainSpecs = async (chainName) => {
5
5
  try {
6
6
  const chains = await import("viem/chains");
7
- const chain = chains[chainName];
8
- return chain;
7
+ return chains[chainName];
9
8
  }
10
9
  catch {
11
10
  throw Error(`Cannot import ${chainName} from viem/chains`);
12
11
  }
13
12
  };
14
- const createEthClient = (chain, jsonRpcUrl) => createWalletClient({
13
+ export const customTransport = custom;
14
+ const createEthClient = (chain, jsonRpcUrl, transport) => createWalletClient({
15
15
  chain,
16
- transport: http(jsonRpcUrl),
16
+ transport: transport || http(jsonRpcUrl),
17
17
  }).extend(publicActions);
18
- export const createContext = async (config) => {
18
+ export const createContext = async (config, transport) => {
19
19
  const chain = await getChainSpecs(config.chainName);
20
20
  const jsonRpcUrl = config.jsonRpcUrl ?? chain.rpcUrls.default.http[0];
21
21
  return {
@@ -23,7 +23,7 @@ export const createContext = async (config) => {
23
23
  chain,
24
24
  account: privateKeyToAccount(config.privateKey),
25
25
  jsonRpcUrl,
26
- ethClient: createEthClient(chain, jsonRpcUrl),
26
+ ethClient: createEthClient(chain, jsonRpcUrl, transport),
27
27
  confirmations: getChainConfirmations(config.chainName),
28
28
  };
29
29
  };
@@ -28,7 +28,6 @@ export const deployVlayerContracts = async ({ proverSpec, verifierSpec, proverAr
28
28
  const config = getConfig();
29
29
  const { chain, ethClient, account } = await createContext(config);
30
30
  console.log("Deploying prover contract...");
31
- console.log(proverArgs, verifierArgs, account);
32
31
  const proverHash = await ethClient.deployContract({
33
32
  chain,
34
33
  account,
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "types": "./dist/config/index.d.ts"
16
16
  }
17
17
  },
18
- "version": "0.1.0-nightly-20241114-4867874",
18
+ "version": "0.1.0-nightly-20241114-b5e205a",
19
19
  "scripts": {
20
20
  "build": "bun tsc && bun tsc-alias",
21
21
  "test:unit": "vitest --run",