From 4b03dfbca4b4e59d35141e96d1a7a702b6c2b838 Mon Sep 17 00:00:00 2001 From: Simon Bihel Date: Wed, 10 Apr 2024 14:36:03 +0100 Subject: [PATCH] Fix ts ingores --- packages/siwe/lib/client.test.ts | 2 +- packages/siwe/lib/client.ts | 1 + packages/siwe/lib/ethersCompat.ts | 40 +++++++++++++++---------------- packages/siwe/lib/types.ts | 1 + packages/siwe/lib/utils.ts | 1 + 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/packages/siwe/lib/client.test.ts b/packages/siwe/lib/client.test.ts index 89d16df6..4e30e063 100644 --- a/packages/siwe/lib/client.test.ts +++ b/packages/siwe/lib/client.test.ts @@ -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'; diff --git a/packages/siwe/lib/client.ts b/packages/siwe/lib/client.ts index 1fd53a45..d46ac14e 100644 --- a/packages/siwe/lib/client.ts +++ b/packages/siwe/lib/client.ts @@ -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'; diff --git a/packages/siwe/lib/ethersCompat.ts b/packages/siwe/lib/ethersCompat.ts index 457b73de..1dd64645 100644 --- a/packages/siwe/lib/ethersCompat.ts +++ b/packages/siwe/lib/ethersCompat.ts @@ -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'; @@ -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 ?? diff --git a/packages/siwe/lib/types.ts b/packages/siwe/lib/types.ts index 66bcdfd8..df14e191 100644 --- a/packages/siwe/lib/types.ts +++ b/packages/siwe/lib/types.ts @@ -1,3 +1,4 @@ +// @ts-expect-error -- ethers v6 compatibility hack import { providers } from 'ethers'; import { SiweMessage } from './client'; diff --git a/packages/siwe/lib/utils.ts b/packages/siwe/lib/utils.ts index b0725b7d..8a5447ad 100644 --- a/packages/siwe/lib/utils.ts +++ b/packages/siwe/lib/utils.ts @@ -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';