-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathgetRollupCreatorAddress.unit.test.ts
More file actions
43 lines (32 loc) · 1.21 KB
/
getRollupCreatorAddress.unit.test.ts
File metadata and controls
43 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { expect, it } from 'vitest';
import { createPublicClient, http } from 'viem';
import { sepolia } from 'viem/chains';
import { getRollupCreatorAddress } from './getRollupCreatorAddress';
import { registerCustomParentChain } from '../chains';
import { testHelper_createCustomParentChain } from '../testHelpers';
it(`successfully returns address for Sepolia`, () => {
const client = createPublicClient({
chain: sepolia,
transport: http(),
});
expect(getRollupCreatorAddress(client)).toEqual('0x57A8aBED71b14dBa84b5d400A4227Ff4B4f31EB5');
});
it(`fails to return address for an unrecognized parent chain`, () => {
const chain = testHelper_createCustomParentChain();
const client = createPublicClient({
chain,
transport: http(),
});
expect(() => getRollupCreatorAddress(client)).toThrowError(
`Parent chain not supported: ${chain.id}`,
);
});
it(`successfully returns address for a registered custom parent chain`, () => {
const chain = testHelper_createCustomParentChain();
registerCustomParentChain(chain);
const client = createPublicClient({
chain,
transport: http(),
});
expect(getRollupCreatorAddress(client)).toEqual(chain.contracts.rollupCreator.address);
});