Skip to content

Commit

Permalink
integrations/hardhat: remove oasislabs/hardhat fork (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
CedarMist authored Sep 17, 2023
1 parent ef31612 commit 781392d
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 399 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ jobs:
path: |
integrations/hardhat/dist
- name: Test Integration Hardhat
run: pnpm test


test-client-go:
name: test-client-go
runs-on: ubuntu-latest
Expand Down
5 changes: 0 additions & 5 deletions integrations/hardhat/.mocharc.json

This file was deleted.

24 changes: 7 additions & 17 deletions integrations/hardhat/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@oasisprotocol/sapphire-hardhat",
"license": "Apache-2.0",
"version": "2.16.1",
"version": "2.17.3",
"description": "A Hardhat plugin for developing on the Sapphire ParaTime.",
"homepage": "https://github.com/oasisprotocol/sapphire-paratime/tree/main/integrations/hardhat",
"repository": {
Expand All @@ -13,33 +13,23 @@
"paratime",
"hardhat"
],
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/src/",
"dist/",
"src/"
],
"scripts": {
"lint": "prettier --cache --ignore-path .gitignore --check .",
"format": "prettier --cache --ignore-path .gitignore --write .",
"build": "tsc -b",
"test": "mocha --exit --recursive 'test/**/*.test.ts'"
"build": "tsc -b"
},
"dependencies": {
"@oasislabs/hardhat": "^2.16.1",
"@oasisprotocol/sapphire-paratime": "workspace:^"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
"@nomicfoundation/hardhat-network-helpers": "^1.0.7",
"@nomiclabs/hardhat-ethers": "^2.2.2",
"@types/chai": "^4.3.4",
"@types/mocha": "^9.1.1",
"@types/node": "^18.11.18",
"chai": "^4.3.7",
"ethers": "^5.7.2",
"hardhat": "^2.16.1",
"mocha": "^10.2.0",
"@types/node": "^18.7.18",
"hardhat": "^2.17.3",
"prettier": "^2.8.3",
"ts-node": "^8.10.2",
"typescript": "^4.9.4"
Expand Down
58 changes: 1 addition & 57 deletions integrations/hardhat/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as sapphire from '@oasisprotocol/sapphire-paratime';
import { extendEnvironment, subtask } from 'hardhat/config';
import { TASK_NODE_GET_PROVIDER } from 'hardhat/builtin-tasks/task-names';
import { EthereumProvider } from 'hardhat/types';
import { extendEnvironment } from 'hardhat/config';

import './type-extensions';

Expand All @@ -23,57 +21,3 @@ extendEnvironment((hre) => {
}
hre.network.provider = sapphire.wrap(hre.network.provider);
});

subtask(TASK_NODE_GET_PROVIDER).setAction(
async (
args: {
forkBlockNumber?: number;
forkUrl?: string;
},
{ artifacts, config, network, userConfig },
runSuper,
): Promise<EthereumProvider> => {
const HARDHAT_NETWORK_NAME = 'hardhat';
const { forkBlockNumber: forkBlockNumberParam, forkUrl: forkUrlParam } =
args;
if (
network.name !== HARDHAT_NETWORK_NAME ||
(network.config as any).confidential !== true
) {
return runSuper();
}

const hardhatNetworkConfig = config.networks[HARDHAT_NETWORK_NAME];
const { createProvider } = await import(
'@oasislabs/hardhat/internal/core/providers/construction'
);
const provider = await createProvider(
config,
HARDHAT_NETWORK_NAME,
artifacts,
);

const forkUrlConfig = hardhatNetworkConfig.forking?.url;
const forkBlockNumberConfig = hardhatNetworkConfig.forking?.blockNumber;

const forkUrl = forkUrlParam ?? forkUrlConfig;
const forkBlockNumber = forkBlockNumberParam ?? forkBlockNumberConfig;

if (forkBlockNumber || forkUrl) {
throw new Error(
'Sapphire forking is not yet supported. Please file an issue if you see this error!',
);
}

const hardhatNetworkUserConfig =
userConfig.networks?.[HARDHAT_NETWORK_NAME] ?? {};

// enable logging
await provider.request({
method: 'hardhat_setLoggingEnabled',
params: [hardhatNetworkUserConfig.loggingEnabled ?? true],
});

return provider;
},
);

This file was deleted.

This file was deleted.

29 changes: 0 additions & 29 deletions integrations/hardhat/test/helpers.ts

This file was deleted.

57 changes: 0 additions & 57 deletions integrations/hardhat/test/project.test.ts

This file was deleted.

Loading

0 comments on commit 781392d

Please sign in to comment.