Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove infura rpc api key #1391

Merged
merged 4 commits into from
Feb 29, 2024
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
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ NEXT_PUBLIC_ALCHEMY_SEPOLIA_API_KEY=""
NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY=""
# ABI selector (*)
NEXT_PUBLIC_ETHERSCAN_API_KEY=""
# wallet providers (*)
NEXT_PUBLIC_INFURA_API_KEY=""
# IPFS pinning (*)
NEXT_PUBLIC_INFURA_IPFS_API_KEY=""
# IPFS pinning (*)
Expand Down
11 changes: 5 additions & 6 deletions src/components/ui/forms/ABISelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { isAddress } from 'ethers/lib/utils';
import detectProxyTarget from 'evm-proxy-detection';
import { useMemo, useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useEnsAddress } from 'wagmi';
import { useEnsAddress, usePublicClient } from 'wagmi';
import { logError } from '../../../helpers/errorLogging';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import { useEIP1193Providers } from '../../../providers/NetworkConfig/utils';
import { LabelComponent } from './InputComponent';

export type ABIElement = {
Expand All @@ -30,15 +29,15 @@ export default function ABISelector({ target, onChange, onFetchABI }: IABISelect
const [abi, setABI] = useState<ABIElement[]>([]);
const { etherscanAPIBaseUrl } = useNetworkConfig();
const { t } = useTranslation('common');
const { eip1193InfuraProvider } = useEIP1193Providers();
const { data: ensAddress } = useEnsAddress({ name: target });
const client = usePublicClient();

useEffect(() => {
const loadABI = async () => {
if (target && ((ensAddress && isAddress(ensAddress)) || isAddress(target))) {
try {
const requestFunc = ({ method, params }: { method: string; params: any[] }) =>
eip1193InfuraProvider.send(method, params);
const requestFunc = ({ method, params }: { method: any; params: any }) =>
client.request({ method, params });

const proxy = await detectProxyTarget(ensAddress || target, requestFunc);

Expand Down Expand Up @@ -71,7 +70,7 @@ export default function ABISelector({ target, onChange, onFetchABI }: IABISelect
}
};
loadABI();
}, [target, ensAddress, etherscanAPIBaseUrl, onFetchABI, eip1193InfuraProvider]);
}, [target, ensAddress, etherscanAPIBaseUrl, onFetchABI, client]);

/*
* This makes component quite scoped to proposal / proposal template creation
Expand Down
16 changes: 0 additions & 16 deletions src/providers/NetworkConfig/utils.ts

This file was deleted.