Skip to content

Commit

Permalink
fix: resolve issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Dec 2, 2024
1 parent 71792ca commit d1e4b05
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 200 deletions.
11 changes: 0 additions & 11 deletions scripts/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ const batchConfig = {batch: {multicall: true}};

const clientCache: Record<number, Client> = {};

const set = (obj, path, value) => {
// Regex explained: https://regexr.com/58j0k
const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);

pathArray.reduce((acc, key, i) => {
if (acc[key] === undefined) acc[key] = {};
if (i === pathArray.length - 1) acc[key] = value;
return acc[key];
}, obj);
};

export function getClient(chainId: number) {
if (!clientCache[chainId]) {
const rpcURL = getRPCUrl(chainId as any, {alchemyKey: process.env.ALCHEMY_API_KEY});
Expand Down
184 changes: 0 additions & 184 deletions tests/__snapshots__/verification.spec.ts.snap

This file was deleted.

9 changes: 6 additions & 3 deletions tests/generators/umbrella.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {describe, it, expect} from 'vitest';
import {getUmbrellaConfig} from '../../scripts/generator/umbrellaGenerator';
import {rpcResponseCache} from '../../scripts/clients';

describe('umbrellaGenerator', () => {
it('should generate the config', async () => {
Expand Down Expand Up @@ -89,10 +88,14 @@ describe('umbrellaGenerator', () => {
"0x98297F8CE8fBE6Ac21Baa23549389852D28715C4",
"0xF045cAB6235e10116319D94B1c5970DAAe9b7136",
"0x32735b634571904008D29086C95e90b558758F9f",
"0x7c743cCAE301b558D2DB0c72D6d69C792AA2E4c9",
"0x4Dc9749D5FF960e92b21800CC0a6fC7A2aD606f8",
"0x8d1dF6F3602f1Ca01f01F6e6d1071B205FbB0026",
"0xF2176ACe5DA79291D176C645a725eBa96A8f246D",
"0xC550C904e04C6046122C0271A5D90891870f8824",
"0xA821016E5A282676c07FeC5217016e229B518dE0",
],
}
`);

console.log('cache', rpcResponseCache);
});
});
1 change: 0 additions & 1 deletion tests/sanity/umbrella.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export async function check(addresses: Record<string, any>) {
address: addresses.UMBRELLA,
client,
});
console.log(addresses.UMBRELLA, addresses.CHAIN_ID);
const [POOL] = await Promise.all([umbrella.read.POOL()]);
expect(POOL).toEqual(addresses.POOL);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/verification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {flattenedAddresses, ListItem} from '../ui/src/utils/getAddresses';
import verified from './cache/verified.json';
import {writeFileSync} from 'fs';
import {Hex, PublicClient, zeroAddress} from 'viem';
import {getCode} from 'viem/actions';

import {getClient} from '../scripts/clients';

const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY as string;
Expand Down Expand Up @@ -112,7 +114,7 @@ describe(
if (checked.has(key)) continue;
checked.add(key);
const client = getClient(item.chainId) as PublicClient;
const hasCode = await client.getCode({address: item.value as Hex});
const hasCode = await getCode(client, {address: item.value as Hex});
if (hasCode) {
const {status, result} = (await checkVerified(item)) as {
status: string;
Expand Down

0 comments on commit d1e4b05

Please sign in to comment.