Skip to content

Commit

Permalink
fix: type & exports
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Sep 12, 2023
1 parent 181d303 commit 096c587
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/commands/fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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({
Expand Down
5 changes: 2 additions & 3 deletions src/commands/governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/govv3/governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export enum ProposalState {
Expired,
}

export interface Governance<T extends WalletClient | undefined> {
export interface Governance<T extends WalletClient | undefined = undefined> {
governanceContract: GetContractReturnType<typeof IGovernanceCore_ABI, PublicClient, WalletClient>;
cacheLogs: () => Promise<{
createdLogs: Array<CreatedLog>;
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './govv3/payloadsController';
export * from './govv3/generatePayloadReport';
export * from './utils/tenderlyClient';
export * from './utils/logger';
export * from './utils/rpcClients';
2 changes: 1 addition & 1 deletion src/utils/rpcClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 096c587

Please sign in to comment.