Skip to content

Commit

Permalink
do not require package to deep import into relay-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Nov 13, 2024
1 parent 46c3af5 commit 46ee507
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
8 changes: 3 additions & 5 deletions packages/api-kit/tests/e2e/addSafeOperation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import {
generateTransferCallData,
ENTRYPOINT_ABI,
ENTRYPOINT_ADDRESS_V06,
RPC_4337_CALLS
RPC_4337_CALLS,
mockGetEip4337BundlerProvider
} from '@safe-global/relay-kit/test-utils'

// Needs to be imported from dist folder in order to mock the getEip4337BundlerProvider function
import * as safe4337Utils from '@safe-global/relay-kit/dist/src/packs/safe-4337/utils'
import { getKits } from '../utils/setupKits'

chai.use(chaiAsPromised)
Expand Down Expand Up @@ -42,7 +40,7 @@ describe('addSafeOperation', () => {
const requestStub = sinon.stub()
// Setup mocks for the bundler client
before(async () => {
sinon.stub(safe4337Utils, 'getEip4337BundlerProvider').returns({
mockGetEip4337BundlerProvider().returns({
request: requestStub,
readContract: sinon
.stub()
Expand Down
7 changes: 3 additions & 4 deletions packages/api-kit/tests/e2e/confirmSafeOperation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { BundlerClient, Safe4337InitOptions, Safe4337Pack } from '@safe-global/r
import {
generateTransferCallData,
ENTRYPOINT_ADDRESS_V06,
RPC_4337_CALLS
RPC_4337_CALLS,
mockGetEip4337BundlerProvider
} from '@safe-global/relay-kit/test-utils'
import SafeApiKit from '@safe-global/api-kit/index'
import { getAddSafeOperationProps } from '@safe-global/api-kit/utils/safeOperation'
import { SafeOperation } from '@safe-global/types-kit'
// Needs to be imported from dist folder in order to mock the getEip4337BundlerProvider function
import * as safe4337Utils from '@safe-global/relay-kit/dist/src/packs/safe-4337/utils'
import { getApiKit, getEip1193Provider } from '../utils/setupKits'

chai.use(chaiAsPromised)
Expand Down Expand Up @@ -73,7 +72,7 @@ describe('confirmSafeOperation', () => {
const requestStub = sinon.stub()

before(async () => {
sinon.stub(safe4337Utils, 'getEip4337BundlerProvider').returns({
mockGetEip4337BundlerProvider().returns({
request: requestStub
} as unknown as BundlerClient)

Expand Down
2 changes: 1 addition & 1 deletion packages/relay-kit/test-utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * as fixtures from './fixtures'
export * from './helpers'

export {
ENTRYPOINT_ABI,
ENTRYPOINT_ADDRESS_V06,
RPC_4337_CALLS
} from '../src/packs/safe-4337/constants'
export { mockGetEip4337BundlerProvider } from './mockGetEip4337BundlerProvider'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import sinon from 'sinon'
import * as utils from '../src/packs/safe-4337/utils'

export const mockGetEip4337BundlerProvider = () => sinon.stub(utils, 'getEip4337BundlerProvider')

0 comments on commit 46ee507

Please sign in to comment.