Skip to content

Commit fc6bec1

Browse files
committedFeb 21, 2025·
test: fix simple keyring tests
1 parent a20af85 commit fc6bec1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

‎packages/keyring-eth-simple/src/simple-keyring.test.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ describe('simple-keyring', function () {
360360
it('returns the expected value if invalid version is given', async function () {
361361
await keyring.deserialize([privKeyHex]);
362362
const signature = await keyring.signTypedData(address, typedData, {
363+
// @ts-expect-error: intentionally passing invalid version
363364
version: 'FOO',
364365
});
365366
expect(signature).toBe(expectedSignature);
@@ -390,7 +391,7 @@ describe('simple-keyring', function () {
390391
it('works via `V1` string', async function () {
391392
await keyring.deserialize([privKeyHex]);
392393
const signature = await keyring.signTypedData(address, typedData, {
393-
version: 'V1',
394+
version: SignTypedDataVersion.V1,
394395
});
395396
expect(signature).toBe(expectedSignature);
396397
const restored = recoverTypedSignature({
@@ -446,7 +447,7 @@ describe('simple-keyring', function () {
446447

447448
await keyring.deserialize([privKeyHex]);
448449
const signature = await keyring.signTypedData(address, typedData, {
449-
version: 'V3',
450+
version: SignTypedDataVersion.V3,
450451
});
451452
const restored = recoverTypedSignature({
452453
data: typedData,
@@ -506,7 +507,7 @@ describe('simple-keyring', function () {
506507
const address = (await keyring.getAccounts())[0];
507508
assert(address, 'address is undefined');
508509
const signature = await keyring.signTypedData(address, typedData, {
509-
version: 'V3',
510+
version: SignTypedDataVersion.V3,
510511
});
511512
expect(signature).toBe(expectedSignature);
512513
const restored = recoverTypedSignature({
@@ -535,7 +536,7 @@ describe('simple-keyring', function () {
535536

536537
await keyring.deserialize([privKeyHex]);
537538
const signature = await keyring.signTypedData(address, typedData, {
538-
version: 'V4',
539+
version: SignTypedDataVersion.V4,
539540
});
540541
const restored = recoverTypedSignature({
541542
data: typedData,
@@ -734,7 +735,7 @@ describe('simple-keyring', function () {
734735
const address = (await keyring.getAccounts())[0];
735736
assert(address, 'address is undefined');
736737
const signature = await keyring.signTypedData(address, typedData, {
737-
version: 'V4',
738+
version: SignTypedDataVersion.V4,
738739
});
739740
expect(signature).toBe(expectedSignature);
740741
const restored = recoverTypedSignature({

‎packages/keyring-eth-simple/src/simple-keyring.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export default class SimpleKeyring implements Keyring {
153153
async signTypedData<
154154
Version extends SignTypedDataVersion,
155155
Types extends MessageTypes,
156-
Options extends { version: Version } & KeyringOpt,
156+
Options extends { version?: Version } & KeyringOpt,
157157
>(
158158
address: Hex,
159159
typedData: Version extends 'V1' ? TypedDataV1 : TypedMessage<Types>,

0 commit comments

Comments
 (0)
Please sign in to comment.