Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
- also, remove vestiges of @gnosis.pm dependencies, which have been subbed out in favor of
  "@safe-global/[email protected]" which supports ethersv5

Signed-off-by: Ryan Goulding <[email protected]>
  • Loading branch information
ryandgoulding committed Feb 20, 2024
1 parent 94f2935 commit d04195d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions packages/devtools-evm/src/signer/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ export class OmniSignerEVM extends OmniSignerEVMBase {
* Implements an OmniSigner interface for EVM-compatible chains using Gnosis Safe.
*/
export class GnosisOmniSignerEVM<TSafeConfig extends ConnectSafeConfig> extends OmniSignerEVMBase {
// TODO: upgrade from @gnosis.pm to @safeglobal dependencies once the codebase upgrades to Ethers v6. Currently,
// devtools only supports Ethers v5, and @safeglobal only supports Ethers v6.

protected safeSdk: Safe | undefined
protected apiKit: SafeApiKit | undefined

Expand Down
14 changes: 8 additions & 6 deletions packages/devtools-evm/test/signer/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import fc from 'fast-check'
import { endpointArbitrary, pointArbitrary } from '@layerzerolabs/test-devtools'
import { Signer } from '@ethersproject/abstract-signer'
import { GnosisOmniSignerEVM, OmniSignerEVM } from '@/signer'
import Safe, { SafeConfig } from '@gnosis.pm/safe-core-sdk'
import SafeServiceClient from '@gnosis.pm/safe-service-client'
import Safe, { SafeConfig } from '@safe-global/protocol-kit'
import SafeApiKit from '@safe-global/api-kit'

describe('signer/ethers', () => {
const transactionHashArbitrary = fc.hexaString()
Expand Down Expand Up @@ -121,22 +121,24 @@ describe('signer/ethers', () => {
{} as SafeConfig
)
omniSigner['safeSdk'] = {
createTransaction: jest.fn(),
createTransaction: jest.fn().mockResolvedValue({ data: 'transaction' }),
getTransactionHash: jest.fn().mockResolvedValue(transactionHash),
getAddress: jest.fn(),
signTransactionHash: jest.fn().mockResolvedValue({ data: 'signature' }),
} as unknown as Safe
const safeService = (omniSigner['safeService'] = {
const safeService = (omniSigner['apiKit'] = {
proposeTransaction: jest.fn(),
} as unknown as SafeServiceClient)
} as unknown as SafeApiKit)

const result = await omniSigner.signAndSend(transaction)
expect(result.transactionHash).toEqual(transactionHash)
expect(await result.wait()).toEqual({ transactionHash })
expect(safeService.proposeTransaction).toHaveBeenCalledWith({
safeAddress: undefined,
safeTransaction: undefined,
safeTransactionData: 'transaction',
safeTxHash: transactionHash,
senderAddress: undefined,
senderSignature: 'signature',
})
}
)
Expand Down

0 comments on commit d04195d

Please sign in to comment.