Skip to content

Commit 72551c0

Browse files
committed
chore: console cleanup part 1
1 parent 8ae32b0 commit 72551c0

17 files changed

+76
-89
lines changed

config-overrides.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const webpack = require("webpack");
22

33
module.exports = function override(config, env) {
4-
console.log("override");
54
let loaders = config.resolve;
65
loaders.fallback = {
76
url: require.resolve("url"),

src/components/utils/Debug.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const DebugRenderer: FunctionComponent<Partial<DebugProps>> = ({
8484
}) => {
8585
const [, forceUpdate] = useReducer((x) => x + 1, 0);
8686
const noClick = useCallback((event) => {
87-
console.log("debug: forceUpdate");
8887
forceUpdate();
8988
event.stopPropagation();
9089
}, []);

src/constants/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const appName = "RenBridge V2";
1+
export const appName = "RenBridge V3";
22

33
export enum storageKeys {
44
TERMS_AGREED = "termsAgreed",

src/constants/featureFlags.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export const featureFlags = {
1717
Boolean(localStorage.getItem("godMode")),
1818
};
1919

20-
console.log(featureFlags);
20+
console.info(featureFlags);

src/features/chain/chainUtils.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ export const getSolanaChain = (
118118
network === RenNetwork.Mainnet ? "mainnet-beta" : "devnet";
119119
const rpcUrl = clusterApiUrl(solanaNetwork);
120120
const provider = new Connection(rpcUrl);
121-
console.log(rpcUrl);
121+
// console.log(rpcUrl);
122122
const signer =
123123
((window as any).solana as SolanaWallet) ||
124124
new SolanaWallet(rpcUrl, network);
125-
console.log("solana signer", (window as any).solana, signer);
126-
console.log(signer);
125+
console.info("solana signer", (window as any).solana, signer);
126+
console.info(signer);
127127
return {
128128
chain: new Solana({
129129
network,
@@ -203,7 +203,7 @@ export const alterContractChainProviderSigner = (
203203
console.error(`Altering failed: No provider`);
204204
return;
205205
}
206-
console.log("ContractChainProviderSigner", alteredChain);
206+
console.info("ContractChainProviderSigner", alteredChain);
207207
if (!isContractBaseChain(alteredChain)) {
208208
throw new Error(`Altering failed: Not a contract chain: ${alteredChain}.`);
209209
}

src/features/gateway/gatewayHooks.ts

+15-22
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const useGateway = (
8484
[]
8585
);
8686
const addTransaction = useCallback((newTx: GatewayTransaction) => {
87-
console.log("gateway detected tx:", newTx.hash, newTx);
87+
console.info("gateway detected tx:", newTx.hash, newTx);
8888
setTransactions((txs) => {
8989
const index = txs.findIndex((tx) => tx.hash === newTx.hash);
9090
if (index >= 0) {
@@ -96,7 +96,7 @@ export const useGateway = (
9696

9797
useEffect(() => {
9898
// setRenJs(null); // added
99-
console.log("gateway useEffect renJs and provider");
99+
console.info("gateway useEffect renJs and provider");
100100
if (!chains) {
101101
return;
102102
}
@@ -119,11 +119,11 @@ export const useGateway = (
119119

120120
useEffect(() => {
121121
// setGateway(null); // added
122-
console.log("gateway useEffect gateway init");
122+
console.info("gateway useEffect gateway init");
123123
let newGateway: Gateway | null = null;
124124
if (renJs && chains !== null) {
125125
const initializeGateway = async () => {
126-
console.log("gateway params", {
126+
console.info("gateway params", {
127127
asset,
128128
from,
129129
to,
@@ -137,13 +137,13 @@ export const useGateway = (
137137
chains,
138138
partialTx
139139
);
140-
console.log("gateway created", newGateway);
140+
console.info("gateway created", newGateway);
141141
newGateway.on("transaction", addTransaction);
142-
console.log("gateway transaction listener added");
142+
console.info("gateway transaction listener added");
143143
(window as any).gateway = newGateway;
144144
return newGateway;
145145
};
146-
console.log("gateway initializing", chains);
146+
console.info("gateway initializing", chains);
147147
initializeGateway()
148148
.then((newGateway) => setGateway(newGateway))
149149
.catch((error) => {
@@ -154,7 +154,7 @@ export const useGateway = (
154154

155155
return () => {
156156
if (newGateway && autoTeardown) {
157-
console.log("gateway removing listeners");
157+
console.info("gateway removing listeners");
158158
newGateway.eventEmitter.removeListener("transaction", addTransaction);
159159
}
160160
};
@@ -177,14 +177,12 @@ export const useGateway = (
177177
async (txHash, localTxEntry) => {
178178
// tx.done?
179179
if (renJs !== null && gateway !== null) {
180-
console.log("tx: gateway transactions before", gateway.transactions);
181-
console.log("tx: recovering", localTxEntry);
180+
console.info("tx: recovering", localTxEntry);
182181

183182
const tx = await renJs.gatewayTransaction(localTxEntry.params);
184-
console.log("tx: created", tx);
183+
console.info("tx: created", tx);
185184
// TODO: TBD: discuss with Noah
186185
gateway.transactions = gateway.transactions.set(txHash, tx);
187-
console.log("tx: gateway transactions after", gateway.transactions);
188186
// addTransaction(tx); will be handled automatically, emitter is required
189187
gateway.eventEmitter.emit("transaction", tx);
190188
} else {
@@ -248,7 +246,7 @@ export const useGatewayFeesObject = (
248246
});
249247
return gatewayFeesObject;
250248
};
251-
console.log("gateway initializing", chains);
249+
console.info("gateway initializing", chains);
252250
initializeGatewayFees()
253251
.then((gatewayFeesObject) => setGatewayFeesObject(gatewayFeesObject))
254252
.catch((error) => {
@@ -262,7 +260,6 @@ export const useGatewayFeesObject = (
262260
};
263261

264262
export const useAssetDecimals = (chain: Chain, asset: string | Asset) => {
265-
console.log("useAssetDecimals", chain, asset);
266263
const chains = useCurrentNetworkChains();
267264
const instance = chains[chain]?.chain;
268265
return useChainInstanceAssetDecimals(instance, asset);
@@ -351,22 +348,19 @@ export const useContractChainAssetBalance = (
351348
decimals === null ||
352349
!isContractBaseChain(instance.chain as Chain)
353350
) {
354-
console.log("not ready");
355351
setBalance(null);
356352
return;
357353
}
358354
if (connected !== undefined && !connected) {
359-
console.log("!connected mode");
360355
return;
361356
}
362357
const getBalance = async () => {
363-
console.log(`asset balance ${instance?.chain}/${asset}: ${decimals}`);
358+
console.info(`asset balance ${instance?.chain}/${asset}: ${decimals}`);
364359
setBalance(null);
365360
const balanceBn = (
366361
await (instance as ContractChain).getBalance(asset, address || "")
367362
).shiftedBy(-decimals);
368363
setBalance(balanceBn.toFixed());
369-
console.log(`gateway balance: ${balanceBn}`);
370364
};
371365
getBalance().catch((error) => {
372366
console.error(error);
@@ -494,7 +488,7 @@ export const useGatewayFees = (
494488
.estimateOutput(amountBn.shiftedBy(fromChainDecimals))
495489
.shiftedBy(-fromChainDecimals);
496490
setOutputAmount(estimatedOutputBn.toFixed());
497-
console.log(`gateway amount estimated output: ${estimatedOutputBn}`);
491+
console.info(`gateway amount estimated output: ${estimatedOutputBn}`);
498492

499493
const renVMFeeAmountBn = renVMFeePercentBn.div(100).multipliedBy(amountBn);
500494
setRenVMFeeAmount(renVMFeeAmountBn.toFixed());
@@ -759,14 +753,13 @@ export const useGatewayMeta = (
759753
}
760754
reset();
761755
setError(undefined);
762-
console.log(asset, from, to);
763756
if (asset === null || from === null || to === null) {
764757
return;
765758
}
766759
setIsToContractChain(Boolean(chains[to]?.connectionRequired));
767760
setIsFromContractChain(Boolean(chains[from]?.connectionRequired));
768761

769-
console.log("getInputAndOutputTypes", asset, from, to);
762+
console.info("getInputAndOutputTypes", asset, from, to);
770763

771764
const promise = getInputAndOutputTypes({
772765
asset,
@@ -775,7 +768,7 @@ export const useGatewayMeta = (
775768
});
776769
const cancelablePromise = cancelable(promise)
777770
.then(({ inputType, outputType, selector }) => {
778-
console.log("getInputAndOutputTypes", inputType, outputType, selector);
771+
console.info("getInputAndOutputTypes", inputType, outputType, selector);
779772
// deprecated, keep until cleaned
780773
if (inputType === InputType.Burn) {
781774
setIsBurn(true);

src/features/gateway/gatewayRoutingUtils.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ export const useRedirectToGatewayFlow = (
7575
return useCallback(
7676
(dynamicAdditionalParams = additionalParams) => {
7777
const { partialTx, expiryTime } = dynamicAdditionalParams || {};
78-
console.log("dynamicAdditionalParams", dynamicAdditionalParams);
7978
if (isBurnAndMint) {
80-
console.log("bridge (h2h)");
79+
// console.log("bridge (h2h)");
8180
history.push({
8281
state: reloadState,
8382
pathname: paths.BRIDGE_GATEWAY,
@@ -95,7 +94,7 @@ export const useRedirectToGatewayFlow = (
9594
),
9695
});
9796
} else if (isMint && isH2H) {
98-
console.log("h2h mint");
97+
// console.log("h2h mint");
9998
history.push({
10099
state: reloadState,
101100
pathname: paths.MINT__GATEWAY_H2H,
@@ -113,7 +112,7 @@ export const useRedirectToGatewayFlow = (
113112
),
114113
});
115114
} else if (isMint) {
116-
console.log("standard mint");
115+
// console.log("standard mint");
117116
history.push({
118117
state: reloadState,
119118
pathname: paths.MINT__GATEWAY_STANDARD,
@@ -131,7 +130,7 @@ export const useRedirectToGatewayFlow = (
131130
),
132131
});
133132
} else if (isRelease && isH2H) {
134-
console.log("h2h release");
133+
// console.log("h2h release");
135134
history.push({
136135
state: reloadState,
137136
pathname: paths.RELEASE__GATEWAY_H2H,
@@ -149,7 +148,7 @@ export const useRedirectToGatewayFlow = (
149148
),
150149
});
151150
} else {
152-
console.log("standard release");
151+
// console.log("standard release");
153152
history.push({
154153
state: reloadState,
155154
pathname: paths.RELEASE__GATEWAY_STANDARD,

src/features/gateway/gatewayTransactionHooks.ts

+26-26
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const useRenVMChainTransactionStatusUpdater = ({
5454
const trackProgress = useCallback(
5555
(progress) => {
5656
setError(null);
57-
console.log(l`tx: newStatus`, progress);
57+
console.info(l`tx: newStatus`, progress);
5858
setStatus(progress.status);
5959
setTarget(progress.target);
6060

@@ -81,17 +81,17 @@ export const useRenVMChainTransactionStatusUpdater = ({
8181
if (!tx || !startTrigger) {
8282
return;
8383
}
84-
console.log(l`tx: attaching listener`);
84+
console.info(l`tx: attaching listener`);
8585
tx.wait()
8686
.on("progress", trackProgress)
8787
.then(trackProgress)
8888
.catch((error) => {
89-
console.log(l`tx: error`, error.message);
89+
console.info(l`tx: error`, error.message);
9090
setError(error);
9191
});
9292

9393
return () => {
94-
console.log(l`tx: detaching listener`);
94+
console.info(l`tx: detaching listener`);
9595
tx.eventEmitter.removeListener("progress", trackProgress);
9696
};
9797
}, [l, trackProgress, waitTarget, tx, startTrigger, reset]);
@@ -140,7 +140,7 @@ export const useChainTransactionStatusUpdater = ({
140140
const trackProgress = useCallback(
141141
(progress) => {
142142
setError(null);
143-
console.log(l`tx: newStatus`, progress);
143+
console.info(l`tx: newStatus`, progress);
144144
setStatus(progress.status);
145145
setTarget(progress.target);
146146
if (isDefined(progress.confirmations)) {
@@ -169,20 +169,20 @@ export const useChainTransactionStatusUpdater = ({
169169
if (!tx || !startTrigger) {
170170
return;
171171
}
172-
console.log(l`tx: attaching listener`);
172+
console.info(l`tx: attaching listener`);
173173
tx.wait()
174174
.on("progress", trackProgress)
175175
.then(trackProgress)
176176
.catch((error) => {
177-
console.log(l`tx: error`, error.message);
177+
console.info(l`tx: error`, error.message);
178178
// TODO: typical error message
179179
if (!error.message.includes(".submit")) {
180180
console.error(error);
181181
setError(error);
182182
}
183183
});
184184
return () => {
185-
console.log(l`tx: detaching listener`);
185+
console.info(l`tx: detaching listener`);
186186
tx.eventEmitter.removeListener("progress", trackProgress);
187187
};
188188
}, [l, trackProgress, tx, waitTarget, chains, reset, startTrigger]);
@@ -240,11 +240,11 @@ export const useChainTransactionSubmitter = ({
240240

241241
const wait = useCallback(async () => {
242242
setErrorWaiting(undefined);
243-
console.log(l`tx: waiting`);
243+
console.info(l`tx: waiting`);
244244
try {
245245
setWaiting(true);
246246
if (tx) {
247-
console.log(l`tx: waiting`);
247+
console.info(l`tx: waiting`);
248248
await tx.wait(waitTarget);
249249
} else {
250250
console.error(l`tx: waiting error, tx not ready`);
@@ -259,7 +259,7 @@ export const useChainTransactionSubmitter = ({
259259

260260
const handleSubmit = useCallback(async () => {
261261
setErrorSubmitting(undefined);
262-
console.log(l`tx: submitting`);
262+
console.info(l`tx: submitting`);
263263
if (
264264
tx &&
265265
tx.submit &&
@@ -296,9 +296,9 @@ export const useChainTransactionSubmitter = ({
296296

297297
useEffect(() => {
298298
if (Boolean(autoSubmit)) {
299-
console.log(l`tx: automatic submit`);
299+
console.info(l`tx: automatic submit`);
300300
handleSubmit().catch((error) => {
301-
console.log(l`tx: automatic submit failed`);
301+
console.info(l`tx: automatic submit failed`);
302302
console.error(error);
303303
});
304304
}
@@ -323,13 +323,13 @@ export const updateRenVMHashParam = (
323323
) => {
324324
const params = new URLSearchParams(history.location.search);
325325
const renVMHashParam = (params as any).renVMHash;
326-
console.log("renVMHash param", renVMHash, params);
326+
// console.log("renVMHash param", renVMHash, params);
327327
if (renVMHash !== renVMHashParam) {
328-
console.log(
329-
"renVMHash param replacing",
330-
history.location.search,
331-
renVMHash
332-
);
328+
// console.log(
329+
// "renVMHash param replacing",
330+
// history.location.search,
331+
// renVMHash
332+
// );
333333
if (renVMHash === null) {
334334
params.delete("renVMHash");
335335
} else {
@@ -348,13 +348,13 @@ export const reloadWithPartialTxParam = (
348348
) => {
349349
const params = new URLSearchParams(history.location.search);
350350
const partialTxParam = (params as any).partialTx;
351-
console.log("partialTx param", partialTx, params);
351+
// console.log("partialTx param", partialTx, params);
352352
if (partialTx !== partialTxParam) {
353-
console.log(
354-
"partialTx param replacing",
355-
history.location.search,
356-
partialTx
357-
);
353+
// console.log(
354+
// "partialTx param replacing",
355+
// history.location.search,
356+
// partialTx
357+
// );
358358
if (partialTx === null) {
359359
params.delete("partialTx");
360360
} else {
@@ -417,7 +417,7 @@ export const useTxRecovery = ({
417417
!recoveringStarted
418418
) {
419419
setRecoveringStarted(true);
420-
console.log("recovering tx: " + trimAddress(renVMHash));
420+
console.info("recovering tx: " + trimAddress(renVMHash));
421421
const localTx = findLocalTx(fromAddress, renVMHash);
422422
let cancelablePromise: CancelablePromise | null = null;
423423
if (localTx === null) {

0 commit comments

Comments
 (0)