Skip to content

Commit

Permalink
feat: remove l2 configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnigir1 committed Aug 30, 2024
1 parent 16890d3 commit 8689c5a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
27 changes: 1 addition & 26 deletions apps/api/src/common/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import dotenv from "dotenv";
import { Address } from "viem";
import {
localhost,
mainnet,
sepolia,
zksync,
zksyncLocalNode,
zksyncSepoliaTestnet,
} from "viem/chains";
import { localhost, mainnet, sepolia } from "viem/chains";

import { MetadataConfig } from "@zkchainhub/metadata";
import { PricingConfig } from "@zkchainhub/pricing";
Expand Down Expand Up @@ -77,17 +70,6 @@ const getChain = (environment: "mainnet" | "testnet" | "local") => {
}
};

const getL2Chain = (environment: "mainnet" | "testnet" | "local") => {
switch (environment) {
case "mainnet":
return zksync;
case "testnet":
return zksyncSepoliaTestnet;
case "local":
return zksyncLocalNode;
}
};

export const config = {
port: envData.PORT,
environment: envData.ENVIRONMENT,
Expand All @@ -96,13 +78,6 @@ export const config = {
rpcUrls: envData.L1_RPC_URLS,
chain: getChain(envData.ENVIRONMENT),
},
l2:
envData.L2_RPC_URLS.length > 0
? {
rpcUrls: envData.L2_RPC_URLS,
chain: getL2Chain(envData.ENVIRONMENT),
}
: undefined,
bridgeHubAddress: envData.BRIDGE_HUB_ADDRESS as Address,
sharedBridgeAddress: envData.SHARED_BRIDGE_ADDRESS as Address,
stateTransitionManagerAddresses: envData.STATE_MANAGER_ADDRESSES as Address[],
Expand Down
7 changes: 0 additions & 7 deletions apps/api/src/common/config/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ const baseSchema = z.object({
STATE_MANAGER_ADDRESSES: addressArraySchema,
ENVIRONMENT: z.enum(["mainnet", "testnet", "local"]).default("mainnet"),
L1_RPC_URLS: urlArraySchema,
L2_RPC_URLS: z
.union([z.literal(""), urlArraySchema])
.optional()
.transform((val) => {
if (val === undefined || val === "") return [];
return val;
}),
PRICING_SOURCE: z.enum(["dummy", "coingecko"]).default("dummy"),
DUMMY_PRICE: z.coerce.number().optional(),
COINGECKO_API_KEY: z.string().optional(),
Expand Down

0 comments on commit 8689c5a

Please sign in to comment.