Skip to content

Commit

Permalink
Fix ts ingores
Browse files Browse the repository at this point in the history
  • Loading branch information
sbihel committed Apr 10, 2024
1 parent c491211 commit 4b03dfb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/siwe/lib/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const verificationNegative: object = JSON.parse(fs.readFileSync('../../test/veri
const EIP1271: object = JSON.parse(fs.readFileSync('../../test/eip1271.json', 'utf8'));

import {
providers,
// @ts-expect-error -- ethers v6 compatibility hack
providers,
InfuraProvider,
Wallet,
} from 'ethers';
Expand Down
1 change: 1 addition & 0 deletions packages/siwe/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ParsedMessage,
parseIntegerNumber,
} from '@spruceid/siwe-parser';
// @ts-expect-error -- ethers v6 compatibility hack
import { providers } from 'ethers';
import * as uri from 'valid-url';

Expand Down
40 changes: 19 additions & 21 deletions packages/siwe/lib/ethersCompat.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {
utils,
// @ts-expect-error -- ethers v6 compatibility hack
utils,
verifyMessage as ethersVerifyMessage,
// @ts-expect-error -- ethers v6 compatibility hack
hashMessage as ethersHashMessage,
// @ts-expect-error -- ethers v6 compatibility hack
getAddress as ethersGetAddress,
} from 'ethers';

Expand All @@ -15,26 +13,26 @@ type Ethers6BigNumberish = string | number | bigint;
type Ethers6SignatureLike =
| string
| {
r: string;
s: string;
v: Ethers6BigNumberish;
yParity?: 0 | 1;
yParityAndS?: string;
}
r: string;
s: string;
v: Ethers6BigNumberish;
yParity?: 0 | 1;
yParityAndS?: string;
}
| {
r: string;
yParityAndS: string;
yParity?: 0 | 1;
s?: string;
v?: number;
}
r: string;
yParityAndS: string;
yParity?: 0 | 1;
s?: string;
v?: number;
}
| {
r: string;
s: string;
yParity: 0 | 1;
v?: Ethers6BigNumberish;
yParityAndS?: string;
};
r: string;
s: string;
yParity: 0 | 1;
v?: Ethers6BigNumberish;
yParityAndS?: string;
};

export const verifyMessage =
utils?.verifyMessage ??
Expand Down
1 change: 1 addition & 0 deletions packages/siwe/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-expect-error -- ethers v6 compatibility hack
import { providers } from 'ethers';
import { SiweMessage } from './client';

Expand Down
1 change: 1 addition & 0 deletions packages/siwe/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { randomStringForEntropy } from '@stablelib/random';
// @ts-expect-error -- ethers v6 compatibility hack
import { Contract, providers, Signer } from 'ethers';

import type { SiweMessage } from './client';
Expand Down

0 comments on commit 4b03dfb

Please sign in to comment.