-
Notifications
You must be signed in to change notification settings - Fork 99
Update Hardhat Console Docs #1289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
themacexpert
wants to merge
17
commits into
master
Choose a base branch
from
themacexpert/hhnov
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
789ae84
update hardhat
themacexpert 4c8c250
Update .snippets/code/builders/ethereum/dev-env/hardhat/scripts/box-c…
themacexpert 00a1830
Update builders/ethereum/dev-env/hardhat.md
themacexpert 660de4f
Update builders/ethereum/dev-env/hardhat.md
themacexpert 2702b54
revise llms full
themacexpert 6a3f3e3
Update builders/ethereum/dev-env/hardhat.md
themacexpert 17fbb9b
Update builders/ethereum/dev-env/hardhat.md
themacexpert 25f9888
Update .snippets/code/builders/ethereum/dev-env/hardhat/terminal/inte…
themacexpert 18f7545
Update .snippets/code/builders/ethereum/dev-env/hardhat/scripts/box-c…
themacexpert 31f50af
run prettier
themacexpert 95fe0a9
local commit
themacexpert 4f1f40a
Merge branch 'themacexpert/hhnov' of https://github.com/moonbeam-foun…
themacexpert 434a3e7
llms
themacexpert 6b8345b
Merge branch 'master' into themacexpert/hhnov
themacexpert eb28a20
llms
themacexpert cc62e43
rev
themacexpert c713570
rev
themacexpert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
.snippets/code/builders/ethereum/dev-env/hardhat/scripts/box-console.ts
This file contains hidden or 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,42 @@ | ||
| // scripts/box-console.ts | ||
| import { network } from 'hardhat'; | ||
|
|
||
| const CONTRACT_ADDRESS = 'INSERT_CONTRACT_ADDRESS'; | ||
| const VALUE_TO_STORE = 5n; | ||
|
|
||
| async function main() { | ||
| if (CONTRACT_ADDRESS === 'INSERT_CONTRACT_ADDRESS') { | ||
| throw new Error( | ||
| 'Update CONTRACT_ADDRESS with the Box deployment address (0x...).' | ||
| ); | ||
| } | ||
|
|
||
| if (!CONTRACT_ADDRESS.startsWith('0x')) { | ||
| throw new Error('CONTRACT_ADDRESS must start with 0x.'); | ||
| } | ||
|
|
||
| const { ethers } = await network.connect('moonbase'); | ||
| const [signer] = await ethers.getSigners(); | ||
|
|
||
| console.log(`Using signer ${signer.address}`); | ||
| console.log(`Attaching to Box at ${CONTRACT_ADDRESS}`); | ||
|
|
||
| const Box = await ethers.getContractFactory('Box'); | ||
| const box = await Box.attach(CONTRACT_ADDRESS); | ||
|
|
||
| const current = (await box.retrieve()).toString(); | ||
| console.log(`Current stored value: ${current}`); | ||
|
|
||
| console.log(`Calling store(${VALUE_TO_STORE})...`); | ||
| const tx = await box.store(VALUE_TO_STORE); | ||
| console.log(`Submitted tx ${tx.hash}, waiting for confirmation...`); | ||
| await tx.wait(); | ||
|
|
||
| const updated = (await box.retrieve()).toString(); | ||
| console.log(`Updated stored value: ${updated}`); | ||
| } | ||
|
|
||
| main().catch((err) => { | ||
| console.error(err); | ||
| process.exitCode = 1; | ||
| }); | ||
45 changes: 11 additions & 34 deletions
45
.snippets/code/builders/ethereum/dev-env/hardhat/terminal/interact.md
This file contains hidden or 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 |
|---|---|---|
| @@ -1,36 +1,13 @@ | ||
| <div id="termynal" data-termynal> | ||
| <span data-ty="input">npx hardhat console --network moonbase</span> | ||
| <br> | ||
| <span data-ty>Welcome to Node.js v20.9.0.</span> | ||
| <span data-ty>Type ".help" for more information.</span> | ||
| <span data-ty="input" data-ty-prompt=">"> const Box = await ethers.getContractFactory('Box');</span> | ||
| <span data-ty>undefined</span> | ||
| <br> | ||
| <span data-ty="input" data-ty-prompt=">"> const box = await Box.attach('0xfBD78CE8C9E1169851119754C4Ea2f70AB159289');</span> | ||
| <span data-ty>undefined</span> | ||
| <br> | ||
| <span data-ty="input" data-ty-prompt=">"> await box.store(5);</span> | ||
| <span data-ty>ContractTransactionResponse {<br> | ||
| provider: HardhatEthersProvider { ... },<br> | ||
| blockNumber: null,<br> | ||
| blockHash: null,<br> | ||
| index: undefined,<br> | ||
| hash: '0x1c49a64a601fc5dd184f0a368a91130cb49203ec0f533c6fcf20445c68e20264',<br> | ||
| type: 2,<br> | ||
| to: '0xa84caB60db6541573a091e5C622fB79e175E17be',<br> | ||
| from: '0x3B939FeaD1557C741Ff06492FD0127bd287A421e',<br> | ||
| nonce: 87,<br> | ||
| gasLimit: 45881n,<br> | ||
| gasPrice: 1107421875n,<br> | ||
| maxPriorityFeePerGas: 1n,<br> | ||
| maxFeePerGas: 1107421875n,<br> | ||
| data: '0x6057361d0000000000000000000000000000000000000000000000000000000000000005',<br> | ||
| value: 0n,<br> | ||
| chainId: 5678n,<br> | ||
| signature: Signature { r: "0x9233b9cc4ae6879b7e08b9f1a4bfb175c8216eee0099966eca4a305c7f369ecc", s: "0x7663688633006b5a449d02cb08311569fadf2f9696bd7fe65417860a3b5fc57d", yParity: 0, networkV: null },<br> | ||
| accessList: [],<br> | ||
| blobVersionedHashes: null<br>}</span> | ||
| <span data-ty="input" data-ty-prompt=">"> await box.retrieve();</span> | ||
| <span data-ty>5n</span> | ||
| <br> | ||
| <span data-ty="input"><span class="file-path"></span>npx hardhat run --network moonbase scripts/box-console.ts</span> | ||
| <br> | ||
| <span data-ty></span> | ||
| <span data-ty>[hardhat-keystore] Enter the password: **********</span> | ||
| <span data-ty>Using signer 0x3B939FeaD1557C741Ff06492FD0127bd287A421e</span> | ||
| <span data-ty>Attaching to Box at INSERT_CONTRACT_ADDRESS</span> | ||
themacexpert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <span data-ty>Current stored value: 4</span> | ||
| <span data-ty>Calling store(5)...</span> | ||
| <span data-ty>Submitted tx 0xdb0a7bfe9caeae5fb590cde27ad156f9b2788434aa4a94b95d1c3a8ce3d58b30, waiting for confirmation...</span> | ||
| <span data-ty>Updated stored value: 5</span> | ||
| <span data-ty="input"><span class="file-path"></span>%</span> | ||
| </div> | ||
6 changes: 0 additions & 6 deletions
6
.snippets/code/builders/ethereum/dev-env/hardhat/terminal/run.md
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.