Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/networks/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, it, expect } from 'vitest';
import * as rootBarrel from './index.js';
import { SUPPORTED_CHAINS, CHAINS, getPublicRpcUrl } from './index.js';

describe('CHAINS / SUPPORTED_CHAINS', () => {
Expand Down Expand Up @@ -40,6 +41,29 @@ describe('CHAINS / SUPPORTED_CHAINS', () => {
});
});

describe('root barrel viem isolation', () => {
it('does not export wagmi symbols', () => {
expect((rootBarrel as Record<string, unknown>)['ethereumWagmi']).toBeUndefined();
expect((rootBarrel as Record<string, unknown>)['baseWagmi']).toBeUndefined();
expect((rootBarrel as Record<string, unknown>)['arbitrumWagmi']).toBeUndefined();
expect((rootBarrel as Record<string, unknown>)['optimismWagmi']).toBeUndefined();
expect((rootBarrel as Record<string, unknown>)['polygonWagmi']).toBeUndefined();
expect((rootBarrel as Record<string, unknown>)['ALL_WAGMI_CHAINS']).toBeUndefined();
});

it('exports the viem-free surface', () => {
expect(rootBarrel.CHAINS).toBeDefined();
expect(rootBarrel.SUPPORTED_CHAINS).toBeDefined();
expect(rootBarrel.TOKENS).toBeDefined();
expect(rootBarrel.SUPPORTED_TOKENS).toBeDefined();
expect(typeof rootBarrel.getPublicRpcUrl).toBe('function');
expect(typeof rootBarrel.getChainConfig).toBe('function');
expect(typeof rootBarrel.tryGetChainConfig).toBe('function');
expect(typeof rootBarrel.getExplorerTxUrl).toBe('function');
expect(typeof rootBarrel.getExplorerAddressUrl).toBe('function');
});
});

describe('getPublicRpcUrl', () => {
it.each([1, 8453, 42161, 10, 137] as const)(
'returns a non-empty URL for chainId %i',
Expand Down
8 changes: 0 additions & 8 deletions packages/networks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ export { TOKENS, SUPPORTED_TOKENS, getTokenInfo, type TokenInfo } from './tokens
export { getPublicRpcUrl } from './rpc.js';
export { getChainConfig, tryGetChainConfig } from './get-chain.js';
export { getExplorerTxUrl, getExplorerAddressUrl } from './explorer.js';
export {
ethereumWagmi,
baseWagmi,
arbitrumWagmi,
optimismWagmi,
polygonWagmi,
ALL_WAGMI_CHAINS,
} from './wagmi.js';