Skip to content

Commit

Permalink
fix: tests ci
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Maldonado <[email protected]>
  • Loading branch information
md0x committed Jul 16, 2024
1 parent cb52562 commit 9a5c3e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ jobs:
- name: "Install Node.js dependencies"
run: "yarn install"

- name: "Create .env file"
run: |
echo 'PROVIDER_URL="https://mainnet.infura.io/v3/00000000000000000000000000000000"' > .env
echo 'PROVIDER_WSS="wss://mainnet.infura.io/ws/v3/00000000000000000000000000000000"' >> .env
echo 'FORWARD_URL="https://relay.flashbots.net"' >> .env
echo 'OVAL_CONFIGS="{\"0x0000000000000000000000000000000000000000\":{\"refundAddress\":\"0x0000000000000000000000000000000000000000\",\"refundPercent\":90,\"unlockerKey\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}}"' >> .env
echo 'AUTH_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000000"' >> .env
echo 'MAINNET_BLOCK_OFFSET=5' >> .env
- name: "Run the tests"
run: "yarn test"

Expand Down
3 changes: 1 addition & 2 deletions src/lib/env.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import dotenv from "dotenv";
import { getAddress, parseEther } from "ethers";
import { MAINNET_CHAIN_ID, SEPOLIA_CHAIN_ID, fallback, supportedNetworks } from "./constants";
import { getBoolean, getFloat, getInt, getOvalConfigs, getPrivateKey, getStringArray, isMochaTest } from "./helpers";
import { getBoolean, getFloat, getInt, getOvalConfigs, getPrivateKey, getStringArray } from "./helpers";
import { OvalConfigs } from "./types";
dotenv.config({ path: ".env" });

function getEnvVar(varName: string, defaultValue?: string): string {
const envValue = process.env[varName];
if (envValue !== undefined) return envValue;
if (defaultValue !== undefined) return defaultValue;
if (isMochaTest()) return "";
throw new Error(`Environment error: ${varName} not set.`);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export function verifyBundleSignature(
export function getPrivateKey(input: string): string {
// Prepend 0x if missing.
const privateKey = input.startsWith("0x") ? input : "0x" + input;
if (!isHexString(privateKey, 32) && !isMochaTest()) throw new Error(`Value ${input} not a valid private key`);
if (!isHexString(privateKey, 32)) throw new Error(`Value ${input} not a valid private key`);
return privateKey;
}

Expand Down

0 comments on commit 9a5c3e2

Please sign in to comment.