Skip to content

Commit

Permalink
Wallet and contract deploy utils
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrskv committed Jul 19, 2024
1 parent 012aa3a commit 18d3a6f
Show file tree
Hide file tree
Showing 13 changed files with 8,538 additions and 18 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
node_modules
.env
.idea
dist/
.vscode/*
!.vscode/settings.json
.tsbuildinfo
*.tar.gz
*.tgz
/cache/
/artifacts/
/typechain-types/
/tests/artifacts/
/tests/cache/
/tests/typechain-types/
208 changes: 206 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nilfoundation/hardhat-plugin",
"version": "0.1.9",
"version": "0.1.10",
"description": "Custom Hardhat plugin to enable seamless deployment and interaction with applications within =nil;",
"repository": {
"type": "git",
Expand Down
18 changes: 14 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@ import type { HardhatUserConfig } from "hardhat/types";
import { unifiedInterceptor } from "./interceptors";
import { setupWalletAndClient } from "./setup";

extendEnvironment(async (hre) => {
const context = await setupWalletAndClient(hre);
extendEnvironment((hre) => {
const originalRequest = hre.network.provider.request.bind(
hre.network.provider,
);
const originalSend = hre.network.provider.send.bind(hre.network.provider);
const contextPromise = setupWalletAndClient(
hre,
originalRequest,
originalSend,
);

hre.network.provider.send = (method, params) => {
hre.network.provider.send = async (method, params) => {
const context = await contextPromise;
context.isRequest = false;
return unifiedInterceptor(method, params || [], context);
};

hre.network.provider.request = (args) => {
hre.network.provider.request = async (args) => {
const context = await contextPromise;
context.isRequest = true;
const safeParams = Array.isArray(args.params)
? args.params
Expand Down
Loading

0 comments on commit 18d3a6f

Please sign in to comment.