Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
fix ethereum-waffle dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sentilesdal committed Jan 19, 2022
1 parent 9082a91 commit 1de29ea
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
12 changes: 10 additions & 2 deletions src/elf/providers/providers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createAlchemyWeb3 } from "@alch/alchemy-web3";
import { ExternalProvider, Provider } from "@ethersproject/providers";
import { MockProvider } from "ethereum-waffle";
import type { MockProvider } from "ethereum-waffle";
import { providers } from "ethers";

import { addressesJson } from "src/elf-council-addresses";
Expand All @@ -15,7 +15,15 @@ const { chainId } = addressesJson;
export const ALCHEMY_GOERLI_HTTP_URL = `https://eth-goerli.alchemyapi.io/v2/${ALCHEMY_GOERLI_KEY}`;
export const ALCHEMY_MAINNET_HTTP_URL = `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_MAINNET_KEY}`;

export const testProvider = new MockProvider();
// vercel won't build with ethereum-waffle as a production dependency. only import it if we are testing.
let mockProvider: MockProvider | undefined;
if (process.env.NODE_ENV === "test") {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { MockProvider } = require("ethereum-waffle");
mockProvider = new MockProvider();
}
// safe to cast since this should only ever be used in 'test' environment anyway.
export const testProvider = mockProvider as MockProvider;

const provider = getProvider();
export const defaultProvider = provider;
Expand Down
17 changes: 13 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -13,11 +17,16 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"jsx": "preserve",
"rootDir": ".",
"baseUrl": ".",
"incremental": true
},
"include": ["pages", "src"],
"exclude": ["node_modules"]
"include": [
"pages",
"src"
],
"exclude": [
"node_modules"
]
}

0 comments on commit 1de29ea

Please sign in to comment.