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

Removed unnecessary console logs #330

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
33 changes: 3 additions & 30 deletions packages/react-app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ function App(props) {
const mainnetContracts = useContractLoader(mainnetProvider);

// If you want to call a function on a new block
useOnBlock(mainnetProvider, () => {
console.log(`⛓ A new mainnet block is here: ${mainnetProvider._lastBlockNumber}`);
});


const appServer = process.env.REACT_APP_SERVER;

Expand All @@ -243,28 +241,7 @@ function App(props) {
// 🧫 DEBUG 👨🏻‍🔬
//
useEffect(() => {
if (
DEBUG &&
mainnetProvider &&
address &&
selectedChainId &&
yourLocalBalance &&
yourMainnetBalance &&
readContracts &&
writeContracts &&
mainnetContracts
) {
console.log("_____________________________________ 🏗 scaffold-eth _____________________________________");
console.log("🌎 mainnetProvider", mainnetProvider);
console.log("🏠 localChainId", localChainId);
console.log("👩‍💼 selected address:", address);
console.log("🕵🏻‍♂️ selectedChainId:", selectedChainId);
console.log("💵 yourLocalBalance", yourLocalBalance ? ethers.utils.formatEther(yourLocalBalance) : "...");
console.log("💵 yourMainnetBalance", yourMainnetBalance ? ethers.utils.formatEther(yourMainnetBalance) : "...");
console.log("📝 readContracts", readContracts);
console.log("🌍 DAI contract on mainnet:", mainnetContracts);
console.log("🔐 writeContracts", writeContracts);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This info is good for debugging. We can just set debugging to false and these console.log messages won't show

if(readContracts){
setIsWalletConnected(!!userSigner);
}
Expand All @@ -278,6 +255,7 @@ function App(props) {
readContracts,
writeContracts,
mainnetContracts,
userSigner
]);

let networkDisplay = "";
Expand Down Expand Up @@ -323,7 +301,6 @@ function App(props) {
blockExplorerUrls: [targetNetwork.blockExplorer],
},
];
console.log("data", data);
// try to add new chain
try {
await ethereum.request({ method: "wallet_addEthereumChain", params: data });
Expand Down Expand Up @@ -390,7 +367,6 @@ function App(props) {
blockExplorerUrls: [targetNetwork.blockExplorer],
},
];
console.log("data", data);
// try to add new chain
try {
await ethereum.request({ method: "wallet_addEthereumChain", params: data });
Expand Down Expand Up @@ -424,18 +400,15 @@ function App(props) {
setInjectedProvider(new ethers.providers.Web3Provider(provider));

provider.on("chainChanged", chainId => {
console.log(`chain changed to ${chainId}! updating providers`);
setInjectedProvider(new ethers.providers.Web3Provider(provider));
});

provider.on("accountsChanged", () => {
console.log(`account changed!`);
setInjectedProvider(new ethers.providers.Web3Provider(provider));
});

// Subscribe to session disconnection
provider.on("disconnect", (code, reason) => {
console.log(code, reason);
logoutOfWeb3Modal();
});
}, [setInjectedProvider]);
Expand Down
1 change: 0 additions & 1 deletion packages/react-app/src/components/Account/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default function Account({
} else {
modalButtons.push(
<Button
key="loginbutton"
style={{ verticalAlign: "top", marginLeft: 8, marginTop: 4, width: width }}
size="large"
onClick={loadWeb3Modal}
Expand Down
1 change: 0 additions & 1 deletion packages/react-app/src/components/TokenModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default function TokenModal({ list, setImportToken, onChange, chainId = 1
}, [JSON.stringify(searchResults)]);

const handleSearch = async val => {
console.log("View result ", props.networkTokenList, list);
let collectionResult = [];

if (val.length > 0) {
Expand Down
1 change: 0 additions & 1 deletion packages/react-app/src/components/TransactionHash.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default function TransactionHash({ hash, localProvider, chainId, ...props
const checkTx = async () => {
const _tx = await localProvider.waitForTransaction(hash, 1);

console.log(_tx);
updateTxData(_tx);
updateLoading(false);
};
Expand Down
2 changes: 0 additions & 2 deletions packages/react-app/src/views/GuestRoom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export default function GuestRoom({
useEffect(() => {
// moving current user to the top of the list
if (addresses && addresses.length > 0) {
console.log("address:", address);
const newAddresses = [...addresses];
newAddresses.forEach((add, index) => {
if (add.toLowerCase() === address.toLowerCase()) {
Expand Down Expand Up @@ -88,7 +87,6 @@ export default function GuestRoom({
}, [room, chainId]);

useOnBlock(localProvider, () => {
console.log("new block");
if (isSignedIn) {
handleHashes(localProvider);
}
Expand Down