Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3382 from NomicFoundation/hardhat-metadata
Add hardhat_metadata RPC method
- Loading branch information
Showing
9 changed files
with
287 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"hardhat": patch | ||
--- | ||
|
||
Added a new `hardhat_metadata` RPC method |
32 changes: 32 additions & 0 deletions
32
packages/hardhat-core/src/internal/core/jsonrpc/types/output/metadata.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
export interface HardhatMetadata { | ||
// A string identifying the version of Hardhat, for debugging purposes, | ||
// not meant to be displayed to users. | ||
clientVersion: string; | ||
|
||
// The chain's id. Used to sign transactions. | ||
chainId: number; | ||
|
||
// A 0x-prefixed hex-encoded 32 bytes id which uniquiely identifies an instance/run | ||
// of Hardhat Network. Running Hardhat Network more than once (even with the same version | ||
// and parameters) would always result in different `instanceId`s. | ||
// Running `hardhat_reset` would change the `instanceId` of an existing Hardhat Network. | ||
instanceId: string; | ||
|
||
// The latest block's number in Hardhat Network | ||
latestBlockNumber: number; | ||
|
||
// The latest block's hash in Hardhat Network | ||
latestBlockHash: string; | ||
|
||
// This field is only present when Hardhat Network is forking another chain. | ||
forkedNetwork?: { | ||
// The chainId of the network that is being forked | ||
chainId: number; | ||
|
||
// The number of the block that the network forked from. | ||
forkBlockNumber: number; | ||
|
||
// The hash of the block that the network forked from. | ||
forkBlockHash: string; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/hardhat-core/test/fixture-projects/non-default-chainid/hardhat.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
solidity: "0.5.15", | ||
networks: { | ||
hardhat: { | ||
chainId: 1000, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.