Skip to content

Commit

Permalink
fix: pass HTTP to EDR (#5846)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann authored Oct 24, 2024
1 parent f6ac346 commit ede1cde
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/neat-moose-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Fixed broken HTTP headers for forked configurations
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
RawTrace,
Response,
SubscriptionEvent,
HttpHeader,
} from "@nomicfoundation/edr";
import { Common } from "@nomicfoundation/ethereumjs-common";
import chalk from "chalk";
Expand Down Expand Up @@ -201,12 +202,27 @@ export class EdrProviderWrapper

let fork;
if (config.forkConfig !== undefined) {
let httpHeaders: HttpHeader[] | undefined;
if (config.forkConfig.httpHeaders !== undefined) {
httpHeaders = [];

for (const [name, value] of Object.entries(
config.forkConfig.httpHeaders
)) {
httpHeaders.push({
name,
value,
});
}
}

fork = {
jsonRpcUrl: config.forkConfig.jsonRpcUrl,
blockNumber:
config.forkConfig.blockNumber !== undefined
? BigInt(config.forkConfig.blockNumber)
: undefined,
httpHeaders,
};
}

Expand Down

0 comments on commit ede1cde

Please sign in to comment.