From 56aa212549bda16743329c9d882b3d9deb91bc38 Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 16 May 2024 20:05:01 +0200 Subject: [PATCH] Update `IEthereumSignerCompatibleWithEthersV5` Extends the `Signer` interface from ethers v6 to include more methods required by ethers v5. --- sdk/src/lib/utils/ethereum-signer.ts | 4 ++-- sdk/test/modules/tbtc/Tbtc.test.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sdk/src/lib/utils/ethereum-signer.ts b/sdk/src/lib/utils/ethereum-signer.ts index f3288ba8e..4c81e4063 100644 --- a/sdk/src/lib/utils/ethereum-signer.ts +++ b/sdk/src/lib/utils/ethereum-signer.ts @@ -1,10 +1,10 @@ -import { VoidSigner as EthersVoidSigner } from "ethers" +import { VoidSigner as EthersVoidSigner, Signer } from "ethers" /** * This abstract signer interface that defines necessary methods to be * compatible with ethers v5 signer which is used in tBTC-v2.ts SDK. */ -export interface IEthereumSignerCompatibleWithEthersV5 { +export interface IEthereumSignerCompatibleWithEthersV5 extends Signer { /** * @dev Required by ethers v5. */ diff --git a/sdk/test/modules/tbtc/Tbtc.test.ts b/sdk/test/modules/tbtc/Tbtc.test.ts index c9ee02f05..5af2f3eca 100644 --- a/sdk/test/modules/tbtc/Tbtc.test.ts +++ b/sdk/test/modules/tbtc/Tbtc.test.ts @@ -4,7 +4,8 @@ import { Deposit as TbtcSdkDeposit, } from "@keep-network/tbtc-v2.ts" -import { IEthereumSignerCompatibleWithEthersV5 } from "../../../src" +import { ZeroAddress, Provider } from "ethers" +import { IEthereumSignerCompatibleWithEthersV5, VoidSigner } from "../../../src" import Deposit from "../../../src/modules/tbtc/Deposit" import TbtcApi from "../../../src/lib/api/TbtcApi" @@ -24,9 +25,11 @@ jest.mock("@keep-network/tbtc-v2.ts", (): object => ({ ...jest.requireActual("@keep-network/tbtc-v2.ts"), })) -class MockEthereumSignerCompatibleWithEthersV5 - implements IEthereumSignerCompatibleWithEthersV5 -{ +class MockEthereumSignerCompatibleWithEthersV5 extends VoidSigner { + constructor() { + super(ZeroAddress, {} as Provider) + } + getAddress = jest.fn() connect = jest.fn()