diff --git a/src/zksync/actions/getL1TokenAddress.test.ts b/src/zksync/actions/getL1TokenAddress.test.ts deleted file mode 100644 index 6da7b2cd8f..0000000000 --- a/src/zksync/actions/getL1TokenAddress.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { expect, test } from 'vitest' -import { anvilZksync } from '~test/src/anvil.js' -import { mockAddresses } from '~test/src/zksync.js' -import { publicActionsL2 } from '~viem/zksync/decorators/publicL2.js' -import { type EIP1193RequestFn, padHex } from '../../index.js' -import { legacyEthAddress } from '../constants/address.js' -import { getL1TokenAddress } from './getL1TokenAddress.js' - -const daiL1 = '0x70a0F165d6f8054d0d0CF8dFd4DD2005f0AF6B55' -const daiL2 = '0xFC073319977e314F251EAE6ae6bE76B0B3BAeeCF' - -const client = anvilZksync.getClient().extend(publicActionsL2()) - -client.request = (async ({ method, params }) => { - if (method === 'eth_call') return padHex(daiL1) - if (method === 'eth_estimateGas') return 158774n - if (method === 'zks_getBridgeContracts') return mockAddresses - return anvilZksync.getClient().request({ method, params } as any) -}) as EIP1193RequestFn - -test('default', async () => { - expect(await getL1TokenAddress(client, { token: daiL2 })).toBe(daiL1) -}) - -test('args: legacyEthAddress', async () => { - expect( - await getL1TokenAddress(client, { token: legacyEthAddress }), - ).toBeDefined() -}) diff --git a/src/zksync/actions/getL2TokenAddress.test.ts b/src/zksync/actions/getL2TokenAddress.test.ts deleted file mode 100644 index efff398690..0000000000 --- a/src/zksync/actions/getL2TokenAddress.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { expect, test } from 'vitest' -import { anvilZksync } from '~test/src/anvil.js' -import { mockAddresses, mockBaseTokenL1Address } from '~test/src/zksync.js' -import { publicActionsL2 } from '~viem/zksync/decorators/publicL2.js' -import { type EIP1193RequestFn, padHex } from '../../index.js' -import { legacyEthAddress } from '../constants/address.js' -import { getL2TokenAddress } from './getL2TokenAddress.js' - -const daiL1 = '0x70a0F165d6f8054d0d0CF8dFd4DD2005f0AF6B55' -const daiL2 = '0xFC073319977e314F251EAE6ae6bE76B0B3BAeeCF' - -const client = anvilZksync.getClient().extend(publicActionsL2()) - -client.request = (async ({ method, params }) => { - if (method === 'eth_call') return padHex(daiL2) - if (method === 'eth_estimateGas') return 158774n - if (method === 'zks_getBridgeContracts') return mockAddresses - if (method === 'zks_getBaseTokenL1Address') return mockBaseTokenL1Address - return anvilZksync.getClient().request({ method, params } as any) -}) as EIP1193RequestFn - -test('default', async () => { - expect(await getL2TokenAddress(client, { token: daiL1 })).toBe(daiL2) -}) - -test('args: legacyEthAddress', async () => { - expect( - await getL2TokenAddress(client, { token: legacyEthAddress }), - ).toBeDefined() -}) diff --git a/src/zksync/decorators/publicL2.test.ts b/src/zksync/decorators/publicL2.test.ts index 09d1e9f2c9..9388764ae3 100644 --- a/src/zksync/decorators/publicL2.test.ts +++ b/src/zksync/decorators/publicL2.test.ts @@ -212,46 +212,3 @@ test('getLogProof', async () => { expect(fee).to.deep.equal(mockProofValues) }) - -test('getL2TokenAddress', async () => { - const daiL1 = '0x70a0F165d6f8054d0d0CF8dFd4DD2005f0AF6B55' - const daiL2 = '0xFC073319977e314F251EAE6ae6bE76B0B3BAeeCF' - const client = anvilZksync.getClient() - - client.request = (async ({ method, params }) => { - if (method === 'eth_call') return padHex(daiL2) - if (method === 'eth_estimateGas') return 158774n - if (method === 'zks_getBridgeContracts') return mockAddresses - if (method === 'zks_getBaseTokenL1Address') return mockBaseTokenL1Address - return anvilZksync.getClient().request({ method, params } as any) - }) as EIP1193RequestFn - - const zksyncClient = client.extend(publicActionsL2()) - - expect( - await zksyncClient.getL2TokenAddress({ - token: daiL1, - }), - ).toBeDefined() -}) - -test('getL1TokenAddress', async () => { - const daiL1 = '0x70a0F165d6f8054d0d0CF8dFd4DD2005f0AF6B55' - const daiL2 = '0xFC073319977e314F251EAE6ae6bE76B0B3BAeeCF' - const client = anvilZksync.getClient() - - client.request = (async ({ method, params }) => { - if (method === 'eth_call') return padHex(daiL1) - if (method === 'eth_estimateGas') return 158774n - if (method === 'zks_getBridgeContracts') return mockAddresses - return anvilZksync.getClient().request({ method, params } as any) - }) as EIP1193RequestFn - - const zksyncClient = client.extend(publicActionsL2()) - - expect( - await zksyncClient.getL1TokenAddress({ - token: daiL2, - }), - ).toBeDefined() -})