@maci-protocol/coordinator 0.0.0-ci.c4ca4f0 → 0.0.0-ci.c898917

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { mainnet, sepolia, arbitrum, arbitrumSepolia, baseSepolia, lineaSepolia, scrollSepolia, scroll, base, holesky, linea, bsc, gnosis, polygon, optimism, optimismSepolia, } from "viem/chains";
2
2
  import { getBundlerClient, getPublicClient, getZeroDevBundlerRPCUrl } from "../accountAbstraction";
3
- import { genAlchemyRPCUrl } from "../chain";
3
+ import { getAlchemyRpcUrl } from "../chain";
4
4
  import { ErrorCodes } from "../errors";
5
5
  import { ESupportedNetworks, viemChain } from "../networks";
6
6
  describe("common", () => {
@@ -29,23 +29,23 @@ describe("common", () => {
29
29
  expect(() => getBundlerClient("Unsupported")).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
30
30
  });
31
31
  });
32
- describe("genAlchemyRPCUrl", () => {
32
+ describe("getAlchemyRpcUrl", () => {
33
33
  test("should return the correct RPCUrl for optimism-sepolia", () => {
34
- const rpcUrl = genAlchemyRPCUrl(ESupportedNetworks.OPTIMISM_SEPOLIA);
34
+ const rpcUrl = getAlchemyRpcUrl(ESupportedNetworks.OPTIMISM_SEPOLIA);
35
35
  expect(rpcUrl).toBeDefined();
36
36
  expect(rpcUrl).toContain("https://opt-sepolia.g.alchemy.com/v2/");
37
37
  });
38
38
  test("should return the correct RPCUrl for sepolia", () => {
39
- const rpcUrl = genAlchemyRPCUrl(ESupportedNetworks.ETHEREUM_SEPOLIA);
39
+ const rpcUrl = getAlchemyRpcUrl(ESupportedNetworks.ETHEREUM_SEPOLIA);
40
40
  expect(rpcUrl).toBeDefined();
41
41
  expect(rpcUrl).toContain("https://eth-sepolia.g.alchemy.com/v2/");
42
42
  });
43
43
  test("should throw when given an unsupported network", () => {
44
- expect(() => genAlchemyRPCUrl(ESupportedNetworks.GNOSIS_CHAIN)).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
44
+ expect(() => getAlchemyRpcUrl(ESupportedNetworks.GNOSIS_CHAIN)).toThrow(ErrorCodes.UNSUPPORTED_NETWORK.toString());
45
45
  });
46
46
  test("should throw when ALCHEMY_API_KEY is not set", () => {
47
47
  delete process.env.RPC_API_KEY;
48
- expect(() => genAlchemyRPCUrl(ESupportedNetworks.OPTIMISM_SEPOLIA)).toThrow(ErrorCodes.RPC_API_KEY_NOT_SET.toString());
48
+ expect(() => getAlchemyRpcUrl(ESupportedNetworks.OPTIMISM_SEPOLIA)).toThrow(ErrorCodes.RPC_API_KEY_NOT_SET.toString());
49
49
  });
50
50
  });
51
51
  describe("viemChain", () => {
@@ -6,7 +6,7 @@ import dotenv from "dotenv";
6
6
  import { createPublicClient, http } from "viem";
7
7
  import { createBundlerClient } from "viem/account-abstraction";
8
8
  import { privateKeyToAccount } from "viem/accounts";
9
- import { genAlchemyRPCUrl } from "./chain";
9
+ import { getAlchemyRpcUrl } from "./chain";
10
10
  import { ErrorCodes } from "./errors";
11
11
  import { ESupportedNetworks, viemChain } from "./networks";
12
12
  dotenv.config();
@@ -17,7 +17,7 @@ dotenv.config();
17
17
  * @returns the public client
18
18
  */
19
19
  export const getPublicClient = (chainName) => createPublicClient({
20
- transport: http(genAlchemyRPCUrl(chainName)),
20
+ transport: http(getAlchemyRpcUrl(chainName)),
21
21
  chain: viemChain(chainName),
22
22
  });
23
23
  /**
@@ -1,12 +1,12 @@
1
1
  import { Signer } from "ethers";
2
2
  import { ESupportedNetworks } from "./networks";
3
3
  /**
4
- * Generate the RPCUrl for Alchemy based on the chain we need to interact with
4
+ * Get the RPCUrl for Alchemy based on the chain we need to interact with
5
5
  *
6
6
  * @param network - the network we want to interact with
7
7
  * @returns the RPCUrl for the network
8
8
  */
9
- export declare const genAlchemyRPCUrl: (network: ESupportedNetworks) => string;
9
+ export declare const getAlchemyRpcUrl: (network: ESupportedNetworks) => string;
10
10
  /**
11
11
  * Get a Ethers Signer given a chain and private key
12
12
  * @param chain
@@ -2,21 +2,21 @@ import { JsonRpcProvider, Wallet } from "ethers";
2
2
  import { ErrorCodes } from "./errors";
3
3
  import { ESupportedNetworks } from "./networks";
4
4
  /**
5
- * Generate the RPCUrl for Alchemy based on the chain we need to interact with
5
+ * Get the RPCUrl for Alchemy based on the chain we need to interact with
6
6
  *
7
7
  * @param network - the network we want to interact with
8
8
  * @returns the RPCUrl for the network
9
9
  */
10
- export const genAlchemyRPCUrl = (network) => {
11
- const rpcAPIKey = process.env.RPC_API_KEY;
12
- if (!rpcAPIKey) {
10
+ export const getAlchemyRpcUrl = (network) => {
11
+ const apiKey = process.env.RPC_API_KEY;
12
+ if (!apiKey) {
13
13
  throw new Error(ErrorCodes.RPC_API_KEY_NOT_SET.toString());
14
14
  }
15
15
  switch (network) {
16
16
  case ESupportedNetworks.OPTIMISM_SEPOLIA:
17
- return `https://opt-sepolia.g.alchemy.com/v2/${rpcAPIKey}`;
17
+ return `https://opt-sepolia.g.alchemy.com/v2/${apiKey}`;
18
18
  case ESupportedNetworks.ETHEREUM_SEPOLIA:
19
- return `https://eth-sepolia.g.alchemy.com/v2/${rpcAPIKey}`;
19
+ return `https://eth-sepolia.g.alchemy.com/v2/${apiKey}`;
20
20
  default:
21
21
  throw new Error(ErrorCodes.UNSUPPORTED_NETWORK.toString());
22
22
  }
@@ -28,7 +28,7 @@ export const genAlchemyRPCUrl = (network) => {
28
28
  */
29
29
  export const getSigner = (chain) => {
30
30
  const wallet = new Wallet(process.env.PRIVATE_KEY);
31
- const alchemyRpcUrl = genAlchemyRPCUrl(chain);
31
+ const alchemyRpcUrl = getAlchemyRpcUrl(chain);
32
32
  const provider = new JsonRpcProvider(alchemyRpcUrl);
33
33
  return wallet.connect(provider);
34
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../ts/common/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,EAAE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