Skip to content
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

Add custom rpc method to toggle ledger feedback #4946

Merged
merged 2 commits into from
Apr 3, 2024
Merged

Conversation

schaable
Copy link
Member

@schaable schaable commented Feb 29, 2024

Note: This RPC method is intended for internal usage and may change without notice.

Usage:

try {
  // Disable the default ledger output by calling `hardhat_setLedgerOutputEnabled`
  await hre.network.provider.send("hardhat_setLedgerOutputEnabled", [false]);

  // Subscribe to hardhat-ledger events and manually handle the output
  hre.network.provider.once("connection_start", () => console.log("IGNITION: [hardhat-ledger] Connecting wallet"));
  hre.network.provider.once("connection_success", () => console.log("[🗸] IGNITION: [hardhat-ledger] Connecting wallet"));
  hre.network.provider.once("connection_failure", () => console.log("[x] IGNITION: [hardhat-ledger] Connecting wallet"));
  // confirmation_start
  // confirmation_success
  // confirmation_failure
  // derivation_start
  // derivation_progress
  // derivation_success
  // derivation_failure
  
  // Placeholder for contract deployment logic

  // Re-enable the default ledger output after deployment
  await hre.network.provider.send("hardhat_setLedgerOutputEnabled", [true]);
} catch (error) {
  if (/Unsupported method/.test(error.message)) {
    // The current provider does not support the hardhat-ledger method
    console.error("The method hardhat_setLedgerOutputEnabled is not supported by the current provider.");
  }
}

Closes #4844

@schaable schaable added the no changeset needed This PR doesn't require a changeset label Feb 29, 2024
@schaable schaable self-assigned this Feb 29, 2024
Copy link

changeset-bot bot commented Feb 29, 2024

🦋 Changeset detected

Latest commit: 4912563

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nomicfoundation/hardhat-ledger Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2024 10:06am

@schaable
Copy link
Member Author

schaable commented Mar 5, 2024

@kanej are we good to merge this?

@kanej
Copy link
Member

kanej commented Mar 5, 2024

@kanej are we good to merge this?

Sorry, I haven't got to this yet.

@kanej kanej removed no changeset needed This PR doesn't require a changeset status:triaging labels Apr 3, 2024
schaable and others added 2 commits April 3, 2024 10:40
This will be an internal release, but we need a changeset to keep the
infra happy.
Copy link
Member

@kanej kanej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a changeset and tested this manually:

  1. Apply changeset
  2. Install into local verdaccio
  3. In a fresh HH project install the update version of hardhat-ledger
  4. Ran through the usage example from the docs: https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-ledger#usage

@schaable schaable merged commit 2893430 into main Apr 3, 2024
34 checks passed
@schaable schaable deleted the toggle-ledger-output branch April 3, 2024 12:51
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Expose hardhat-ledger api to allow down stream plugins to control UI
3 participants