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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@bgd-labs/aave-address-book": "^4.22.1",
"@bgd-labs/js-utils": "^1.4.7",
"@bgd-labs/rpc-env": "^2.3.3",
"@bgd-labs/toolbox": "^0.0.38",
"@types/lodash": "^4.17.15",
"@types/node": "^22.12.0",
"bignumber.js": "^9.1.2",
Expand All @@ -63,7 +63,8 @@
"ethers": "5",
"globals": "^15.14.0",
"lodash": "^4.17.21",
"prettier": "^3.4.2",
"prettier": "^3.5.2",
"prettier-plugin-solidity": "^1.0.0",
"tsup": "^8.3.6",
"tsx": "^4.19.2",
"typescript": "^5.7.3",
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/createClient.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Chain, createClient, http } from 'viem';
import { createClient, http } from 'viem';

export const createViemClient = ({
chain,
rpcUrl,
}: {
chain: Chain;
chain: any;
rpcUrl?: string;
}) =>
createClient({
Expand Down
17 changes: 9 additions & 8 deletions src/scripts/parse-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import {
ChainList,
getRPCUrl,
SupportedChainIds,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
} from '@bgd-labs/rpc-env';
} from '@bgd-labs/toolbox';
import { Address, getContract, Hex, zeroAddress, zeroHash } from 'viem';
import { getBlock, getEnsName } from 'viem/actions';

Expand Down Expand Up @@ -87,15 +85,16 @@ export function getVotingMachineAddress(
}

async function getVotingData(initialProposals: InitialProposal[]) {
const votingMachineDataHelpers = {
const votingMachineDataHelpers: Record<number, any> = {
[appConfig.votingMachineChainIds[0]]: getContract({
address:
appConfig.votingMachineConfig[appConfig.votingMachineChainIds[0]]
.dataHelperContractAddress,
abi: IVotingMachineDataHelper_ABI,
client: createViemClient({
chain:
ChainList[appConfig.votingMachineChainIds[0] as SupportedChainIds],
chain: ChainList[
appConfig.votingMachineChainIds[0] as SupportedChainIds
] as any,
rpcUrl: getRPCUrl(
appConfig.votingMachineChainIds[0] as SupportedChainIds,
),
Expand All @@ -109,7 +108,7 @@ async function getVotingData(initialProposals: InitialProposal[]) {
address: votingMachineConfig.dataHelperContractAddress,
abi: IVotingMachineDataHelper_ABI,
client: createViemClient({
chain: ChainList[chainId as SupportedChainIds],
chain: ChainList[chainId as SupportedChainIds] as any,
rpcUrl: getRPCUrl(chainId as SupportedChainIds),
}),
});
Expand Down Expand Up @@ -447,7 +446,9 @@ async function parseProposalEvents(
const executedTimestamp = (
await getBlock(
createViemClient({
chain: ChainList[appConfig.govCoreChainId as SupportedChainIds],
chain: ChainList[
appConfig.govCoreChainId as SupportedChainIds
] as any,
rpcUrl: getRPCUrl(appConfig.govCoreChainId as SupportedChainIds),
}),
{
Expand Down
16 changes: 7 additions & 9 deletions src/scripts/update-cache-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
readJSONCache,
writeJSONCache,
} from '@bgd-labs/js-utils';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { ChainList, getRPCUrl, SupportedChainIds } from '@bgd-labs/rpc-env';
import { ChainList, getRPCUrl, SupportedChainIds } from '@bgd-labs/toolbox';
import { Address, getContract, Hex } from 'viem';
import { getBlock, getBlockNumber } from 'viem/actions';

Expand Down Expand Up @@ -74,7 +72,7 @@ async function updatePayloadsEvents(
bookKeepingCache: BookKeepingCache,
) {
const client = createViemClient({
chain: ChainList[chainId as SupportedChainIds],
chain: ChainList[chainId as SupportedChainIds] as any,
rpcUrl: getRPCUrl(chainId as SupportedChainIds, {
alchemyKey: process.env.ALCHEMY_API_KEY,
}),
Expand Down Expand Up @@ -129,7 +127,7 @@ async function updatePayloadsData(
readJSONCache<PayloadsCache>(payloadsPath, controller) || {};

const client = createViemClient({
chain: ChainList[chainId as SupportedChainIds],
chain: ChainList[chainId as SupportedChainIds] as any,
rpcUrl: getRPCUrl(chainId as SupportedChainIds, {
alchemyKey: process.env.ALCHEMY_API_KEY,
}),
Expand Down Expand Up @@ -181,7 +179,7 @@ async function updateGovCoreEvents(
const eventsPath = `${Number(govCoreChainId)}/events`;

const client = createViemClient({
chain: ChainList[govCoreChainId as SupportedChainIds],
chain: ChainList[govCoreChainId as SupportedChainIds] as any,
rpcUrl: getRPCUrl(govCoreChainId as SupportedChainIds, {
alchemyKey: process.env.ALCHEMY_API_KEY,
}),
Expand Down Expand Up @@ -238,7 +236,7 @@ async function updateVMEvents(
const portalContract = getContract({
abi: IVotingPortal_ABI,
client: createViemClient({
chain: ChainList[govCoreChainId as SupportedChainIds],
chain: ChainList[govCoreChainId as SupportedChainIds] as any,
rpcUrl: getRPCUrl(govCoreChainId as SupportedChainIds),
}),
address: portal,
Expand All @@ -255,7 +253,7 @@ async function updateVMEvents(
const path = `${chainId}/events`;
const address = machine;
const client = createViemClient({
chain: ChainList[chainId as SupportedChainIds],
chain: ChainList[chainId as SupportedChainIds] as any,
rpcUrl: getRPCUrl(chainId as SupportedChainIds, {
alchemyKey: process.env.ALCHEMY_API_KEY,
}),
Expand Down Expand Up @@ -316,7 +314,7 @@ export async function updateCache({
{};
// initialize contracts
const govCoreClient = createViemClient({
chain: ChainList[govCoreChainId as SupportedChainIds],
chain: ChainList[govCoreChainId as SupportedChainIds] as any,
rpcUrl: getRPCUrl(govCoreChainId as SupportedChainIds, {
alchemyKey: process.env.ALCHEMY_API_KEY,
}),
Expand Down
Loading