Skip to content

Commit a20af85

Browse files
committed
test: fix ledger tests
1 parent affd252 commit a20af85

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/keyring-eth-ledger-bridge/src/ledger-keyring.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ describe('LedgerKeyring', function () {
968968
],
969969
},
970970
};
971-
const options = { version: 'V4' };
971+
const options = { version: sigUtil.SignTypedDataVersion.V4 };
972972

973973
beforeEach(async function () {
974974
jest
@@ -1043,7 +1043,7 @@ describe('LedgerKeyring', function () {
10431043
it('throws an error if the signTypedData version is not v4', async function () {
10441044
await expect(
10451045
keyring.signTypedData(fakeAccounts[0], fixtureData, {
1046-
version: 'V3',
1046+
version: sigUtil.SignTypedDataVersion.V3,
10471047
}),
10481048
).rejects.toThrow(
10491049
'Ledger: Only version 4 of typed data signing is supported',

packages/keyring-eth-ledger-bridge/src/ledger-keyring.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,16 @@ export class LedgerKeyring implements Keyring {
485485
}
486486

487487
async signTypedData<
488-
Version extends SignTypedDataVersion.V4,
488+
Version extends SignTypedDataVersion,
489489
Types extends MessageTypes,
490490
Options extends { version?: Version },
491491
>(
492492
withAccount: Hex,
493493
data: TypedMessage<Types>,
494-
options: Options,
494+
options?: Options,
495495
): Promise<string> {
496-
const isV4 = options?.version === 'V4';
496+
const { version } = options ?? {};
497+
const isV4 = version === 'V4';
497498
if (!isV4) {
498499
throw new Error(
499500
'Ledger: Only version 4 of typed data signing is supported',

0 commit comments

Comments
 (0)