Skip to content

Commit

Permalink
Update IEthereumSignerCompatibleWithEthersV5
Browse files Browse the repository at this point in the history
Extends the `Signer` interface from ethers v6 to include more methods
required by ethers v5.
  • Loading branch information
r-czajkowski committed May 16, 2024
1 parent a51688e commit 56aa212
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sdk/src/lib/utils/ethereum-signer.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
11 changes: 7 additions & 4 deletions sdk/test/modules/tbtc/Tbtc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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()
Expand Down

0 comments on commit 56aa212

Please sign in to comment.