-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrating hardhat-ledger support (#731)
Integrated the new `hardhat-ledger` support for controlling its UI display. Ignition now takes control of displaying the messages from the ledger (e.g. "Connect wallet"). Fixes #720
- Loading branch information
Showing
7 changed files
with
275 additions
and
9 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
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
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,72 @@ | ||
import { assert } from "chai"; | ||
|
||
import { PrettyEventHandler } from "../../src/ui/pretty-event-handler"; | ||
|
||
describe("ui - pretty event handler", () => { | ||
describe("ledger", () => { | ||
it("should set a message on connection start", () => { | ||
const eventHandler = new PrettyEventHandler(undefined, true); | ||
|
||
eventHandler.ledgerConnectionStart(); | ||
|
||
assert.equal(eventHandler.state.ledgerMessage, "Connecting wallet"); | ||
assert.isTrue(eventHandler.state.ledger); | ||
assert.isTrue(eventHandler.state.ledgerMessageIsDisplayed); | ||
}); | ||
|
||
it("should set a message on connection success", () => { | ||
const eventHandler = new PrettyEventHandler(undefined, true); | ||
|
||
eventHandler.ledgerConnectionSuccess(); | ||
|
||
assert.equal(eventHandler.state.ledgerMessage, "Wallet connected"); | ||
}); | ||
|
||
it("should set a message on connection failure", () => { | ||
const eventHandler = new PrettyEventHandler(undefined, true); | ||
|
||
eventHandler.ledgerConnectionFailure(); | ||
|
||
assert.equal( | ||
eventHandler.state.ledgerMessage, | ||
"Wallet connection failed" | ||
); | ||
}); | ||
|
||
it("should set a message on confirmation start", () => { | ||
const eventHandler = new PrettyEventHandler(undefined, true); | ||
|
||
eventHandler.ledgerConfirmationStart(); | ||
|
||
assert.equal( | ||
eventHandler.state.ledgerMessage, | ||
"Waiting for confirmation on device" | ||
); | ||
assert.isTrue(eventHandler.state.ledger); | ||
assert.isTrue(eventHandler.state.ledgerMessageIsDisplayed); | ||
}); | ||
|
||
it("should set a message on confirmation success", () => { | ||
const eventHandler = new PrettyEventHandler(undefined, true); | ||
|
||
eventHandler.ledgerConfirmationSuccess(); | ||
|
||
assert.equal( | ||
eventHandler.state.ledgerMessage, | ||
"Transaction approved by device" | ||
); | ||
assert.isFalse(eventHandler.state.ledger); | ||
}); | ||
|
||
it("should set a message on confirmation failure", () => { | ||
const eventHandler = new PrettyEventHandler(undefined, true); | ||
|
||
eventHandler.ledgerConfirmationFailure(); | ||
|
||
assert.equal( | ||
eventHandler.state.ledgerMessage, | ||
"Transaction confirmation failed" | ||
); | ||
}); | ||
}); | ||
}); |