diff --git a/package-lock.json b/package-lock.json index 2382b33..87529b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "1.3.2", "license": "MIT", "dependencies": { - "@fireblocks/fireblocks-web3-provider": "^1.3.2" + "@fireblocks/fireblocks-web3-provider": "^1.3.2", + "undici": "^6.6.2" }, "devDependencies": { "@types/fs-extra": "5.1.0", @@ -753,6 +754,14 @@ "@ethersproject/strings": "^5.7.0" } }, + "node_modules/@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "engines": { + "node": ">=14" + } + }, "node_modules/@fireblocks/fireblocks-web3-provider": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@fireblocks/fireblocks-web3-provider/-/fireblocks-web3-provider-1.3.2.tgz", @@ -2267,18 +2276,6 @@ "node": ">=0.10.0" } }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dev": true, - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -3232,6 +3229,18 @@ } } }, + "node_modules/hardhat/node_modules/undici": { + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "dev": true, + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -4798,15 +4807,6 @@ "node": ">= 0.8" } }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "dev": true, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/strict-uri-encode": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", @@ -5133,15 +5133,14 @@ } }, "node_modules/undici": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.22.0.tgz", - "integrity": "sha512-fR9RXCc+6Dxav4P9VV/sp5w3eFiSdOjJYsbtWfd4s5L5C4ogyuVpdKIVHeW0vV1MloM65/f7W45nR9ZxwVdyiA==", - "dev": true, + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.6.2.tgz", + "integrity": "sha512-vSqvUE5skSxQJ5sztTZ/CdeJb1Wq0Hf44hlYMciqHghvz+K88U0l7D6u1VsndoFgskDcnU+nG3gYmMzJVzd9Qg==", "dependencies": { - "busboy": "^1.6.0" + "@fastify/busboy": "^2.0.0" }, "engines": { - "node": ">=14.0" + "node": ">=18.0" } }, "node_modules/universalify": { @@ -5867,6 +5866,11 @@ "@ethersproject/strings": "^5.7.0" } }, + "@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==" + }, "@fireblocks/fireblocks-web3-provider": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@fireblocks/fireblocks-web3-provider/-/fireblocks-web3-provider-1.3.2.tgz", @@ -7114,15 +7118,6 @@ "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==", "dev": true }, - "busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dev": true, - "requires": { - "streamsearch": "^1.1.0" - } - }, "bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -7867,6 +7862,17 @@ "undici": "^5.4.0", "uuid": "^8.3.2", "ws": "^7.4.6" + }, + "dependencies": { + "undici": { + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "dev": true, + "requires": { + "@fastify/busboy": "^2.0.0" + } + } } }, "has": { @@ -9007,12 +9013,6 @@ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true }, - "streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "dev": true - }, "strict-uri-encode": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", @@ -9250,12 +9250,11 @@ } }, "undici": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.22.0.tgz", - "integrity": "sha512-fR9RXCc+6Dxav4P9VV/sp5w3eFiSdOjJYsbtWfd4s5L5C4ogyuVpdKIVHeW0vV1MloM65/f7W45nR9ZxwVdyiA==", - "dev": true, + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.6.2.tgz", + "integrity": "sha512-vSqvUE5skSxQJ5sztTZ/CdeJb1Wq0Hf44hlYMciqHghvz+K88U0l7D6u1VsndoFgskDcnU+nG3gYmMzJVzd9Qg==", "requires": { - "busboy": "^1.6.0" + "@fastify/busboy": "^2.0.0" } }, "universalify": { diff --git a/package.json b/package.json index 77b87ec..ab16099 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "hardhat": "^2.6.0" }, "dependencies": { - "@fireblocks/fireblocks-web3-provider": "^1.3.2" + "@fireblocks/fireblocks-web3-provider": "^1.3.2", + "undici": "^6.6.2" } } diff --git a/src/index.ts b/src/index.ts index 4c07430..9cea0aa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import { HardhatUserConfig, HttpNetworkUserConfig, } from "hardhat/types"; +import { Dispatcher, ProxyAgent } from 'undici'; import { version as SDK_VERSION } from "../package.json"; @@ -46,16 +47,22 @@ extendConfig( extendEnvironment((hre) => { if ((hre.network.config as HttpNetworkUserConfig).fireblocks) { const httpNetConfig = hre.network.config as HttpNetworkUserConfig; + const fireblocksW3PConfig =(hre.network.config as HttpNetworkUserConfig).fireblocks!; + let dispatcher: Dispatcher | undefined = undefined; + if(fireblocksW3PConfig.proxyPath){ + dispatcher = new ProxyAgent(fireblocksW3PConfig.proxyPath!); + } const eip1193Provider = new HttpProvider( httpNetConfig.url!, hre.network.name, httpNetConfig.httpHeaders, - httpNetConfig.timeout + httpNetConfig.timeout, + dispatcher ); let wrappedProvider: EIP1193Provider; wrappedProvider = new FireblocksSigner( eip1193Provider, - (hre.network.config as HttpNetworkUserConfig).fireblocks! + fireblocksW3PConfig ); wrappedProvider = new AutomaticGasProvider( wrappedProvider,