Skip to content

Commit 00a8e2f

Browse files
committed
Add test for non-evm contract lookup
1 parent 7aa683f commit 00a8e2f

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

packages/cli/src/command-helpers/contracts.test.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ const TEST_SOURCIFY_CONTRACT_INFO = {
9999
startBlock: 7_019_815,
100100
},
101101
},
102+
wax: {
103+
'': {
104+
name: '',
105+
startBlock: 0,
106+
},
107+
},
102108
};
103109

104110
describe('getStartBlockForContract', { sequential: true }, async () => {
@@ -127,13 +133,20 @@ describe('getFromSourcifyForContract', { sequential: true }, async () => {
127133
test(
128134
`Returns contract information ${networkId} ${contract} ${info.name} ${info.startBlock}`,
129135
async () => {
130-
// Only check name and startBlock, omit API property from Sourcify results
131-
const { name, startBlock } = (await contractService.getFromSourcify(
132-
EthereumABI,
133-
networkId,
134-
contract,
135-
))!;
136-
expect(info).toEqual({ name, startBlock: parseInt(startBlock) });
136+
if (networkId == 'wax') {
137+
// Sourcify only supports EVM chains
138+
expect(
139+
await contractService.getFromSourcify(EthereumABI, networkId, contract),
140+
).toBeNull();
141+
} else {
142+
// Only check name and startBlock, omit API property from Sourcify results
143+
const { name, startBlock } = (await contractService.getFromSourcify(
144+
EthereumABI,
145+
networkId,
146+
contract,
147+
))!;
148+
expect(info).toEqual({ name, startBlock: parseInt(startBlock) });
149+
}
137150
},
138151
{ timeout: 10_000 },
139152
);

0 commit comments

Comments
 (0)