Skip to content

Commit

Permalink
optimize style
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Jun 19, 2024
1 parent 69d2129 commit 596336a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,21 @@ const environment = process.env.NODE_ENV || "production";
export const devMode = environment != "production";

const getZeroConfig = (): XdcZeroConfig => {
const isEnabled: boolean = "PARENTNET_ZERO_CONTRACT" in process.env && "SUBNET_ZERO_CONTRACT" in process.env && "PARENTNET_ZERO_WALLET_PK" in process.env && "CHECKPOINT_CONTRACT" in process.env;
const isReverseEnabled: boolean = "PARENTNET_ZERO_CONTRACT" in process.env && "SUBNET_ZERO_CONTRACT" in process.env && "SUBNET_ZERO_WALLET_PK" in process.env && "REVERSE_CHECKPOINT_CONTRACT" in process.env;
const reqXdcZero = [
"PARENTNET_ZERO_CONTRACT",
"SUBNET_ZERO_CONTRACT",
"PARENTNET_ZERO_WALLET_PK",
"CHECKPOINT_CONTRACT"
];
const reqReverseXdcZero = [
"PARENTNET_ZERO_CONTRACT",
"SUBNET_ZERO_CONTRACT",
"SUBNET_ZERO_WALLET_PK",
"REVERSE_CHECKPOINT_CONTRACT"
];
const isEnabled = reqXdcZero.every(envVar => envVar in process.env);
const isReverseEnabled = reqReverseXdcZero.every(envVar => envVar in process.env);

let parentnetWalletPk = "";
if (isEnabled){
parentnetWalletPk = process.env.PARENTNET_ZERO_WALLET_PK.startsWith("0x") ? process.env.PARENTNET_ZERO_WALLET_PK : `0x${process.env.PARENTNET_ZERO_WALLET_PK}`;
Expand Down

0 comments on commit 596336a

Please sign in to comment.