From 096c5870fba0bdd6424cb37333d3646982b97d49 Mon Sep 17 00:00:00 2001 From: sakulstra Date: Tue, 12 Sep 2023 16:02:05 +0200 Subject: [PATCH] fix: type & exports --- src/commands/fork.ts | 4 ++-- src/commands/governance.ts | 5 ++--- src/govv3/governance.ts | 2 +- src/index.ts | 1 + src/utils/rpcClients.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/commands/fork.ts b/src/commands/fork.ts index 32affa4..37db8d1 100644 --- a/src/commands/fork.ts +++ b/src/commands/fork.ts @@ -2,7 +2,7 @@ import { Command } from '@commander-js/extra-typings'; import { tenderly } from '../utils/tenderlyClient'; import { getGovernance } from '../govv3/governance'; import { GovernanceV3Ethereum } from '@bgd-labs/aave-address-book'; -import { RPC_MAP, mainnetClient } from '../utils/rpcClients'; +import { CHAIN_ID_CLIENT_MAP, mainnetClient } from '../utils/rpcClients'; import { getPayloadsController } from '../govv3/payloadsController'; import { Hex, PublicClient } from 'viem'; @@ -54,7 +54,7 @@ export function addCommand(program: Command) { if (!payloadsControllerAddress) throw new Error('you need to provide a payloadsController'); const payloadsController = getPayloadsController( payloadsControllerAddress as Hex, - RPC_MAP[forkConfig.chainId as keyof typeof RPC_MAP] as PublicClient + CHAIN_ID_CLIENT_MAP[forkConfig.chainId as keyof typeof CHAIN_ID_CLIENT_MAP] as PublicClient ); const payload = await payloadsController.getSimulationPayloadForExecution(Number(payloadId)); const fork = await tenderly.fork({ diff --git a/src/commands/governance.ts b/src/commands/governance.ts index 6f4d39a..fbc0041 100644 --- a/src/commands/governance.ts +++ b/src/commands/governance.ts @@ -2,7 +2,7 @@ import { Command } from '@commander-js/extra-typings'; import { simulateProposal } from '../govv3/simulate'; import { GovernanceV3Goerli, IVotingMachineWithProofs_ABI, IVotingPortal_ABI } from '@bgd-labs/aave-address-book'; import { HUMAN_READABLE_STATE, ProposalState, getGovernance } from '../govv3/governance'; -import { RPC_MAP, goerliClient } from '../utils/rpcClients'; +import { CHAIN_ID_CLIENT_MAP, goerliClient } from '../utils/rpcClients'; import { logError, logInfo, logSuccess } from '../utils/logger'; import { Hex, @@ -164,8 +164,7 @@ export function addCommand(program: Command) { const votingMachine = getContract({ address: machine, abi: IVotingMachineWithProofs_ABI, - publicClient: RPC_MAP[Number(chainId) as keyof typeof RPC_MAP] as PublicClient, - // walletClient: createWalletClient({ account: '0x0', chain: { id: Number(chainId) } as any, transport: http() }), + publicClient: CHAIN_ID_CLIENT_MAP[Number(chainId) as keyof typeof CHAIN_ID_CLIENT_MAP] as PublicClient, }); const proofs = await governance.getVotingProofs(proposalId, voter as Hex, chainId); const encodedData = encodeFunctionData({ diff --git a/src/govv3/governance.ts b/src/govv3/governance.ts index 816a229..bfe838a 100644 --- a/src/govv3/governance.ts +++ b/src/govv3/governance.ts @@ -40,7 +40,7 @@ export enum ProposalState { Expired, } -export interface Governance { +export interface Governance { governanceContract: GetContractReturnType; cacheLogs: () => Promise<{ createdLogs: Array; diff --git a/src/index.ts b/src/index.ts index 141010e..dfe63ee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,3 +5,4 @@ export * from './govv3/payloadsController'; export * from './govv3/generatePayloadReport'; export * from './utils/tenderlyClient'; export * from './utils/logger'; +export * from './utils/rpcClients'; diff --git a/src/utils/rpcClients.ts b/src/utils/rpcClients.ts index 63729fe..dd1bf6d 100644 --- a/src/utils/rpcClients.ts +++ b/src/utils/rpcClients.ts @@ -36,7 +36,7 @@ export const sepoliaClient = createPublicClient({ chain: sepolia, transport: htt export const goerliClient = createPublicClient({ chain: goerli, transport: http(process.env.RPC_GOERLI) }); -export const RPC_MAP = { +export const CHAIN_ID_CLIENT_MAP = { [mainnet.id]: mainnetClient, [arbitrum.id]: arbitrumClient, [polygon.id]: polygonClient,