Skip to content
Closed

test #1189

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
6 changes: 6 additions & 0 deletions hooks/checkout/usePriceManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ export const usePriceManagement = (
const tokenBalance = tokenBalances[displayedCurrency];
if (!tokenBalance) return;
const _price = formState.isUpselled ? discountedPrice : price;
console.log(
"tokenBalance",
BigInt(tokenBalance),
"price",
BigInt(_price)
);
Comment on lines +186 to +191
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove debug console.log before merging.

This debug logging statement should be removed before merging to production. Console logs in production code can clutter browser consoles, impact performance slightly, and may expose unnecessary implementation details.

Apply this diff to remove the debug log:

-      console.log(
-        "tokenBalance",
-        BigInt(tokenBalance),
-        "price",
-        BigInt(_price)
-      );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log(
"tokenBalance",
BigInt(tokenBalance),
"price",
BigInt(_price)
);
🤖 Prompt for AI Agents
In hooks/checkout/usePriceManagement.tsx around lines 186 to 191, remove the
debug console.log statement that prints tokenBalance and price; delete the
entire console.log(...) call (or replace it with a proper debug-level logger if
you need to retain the information in non-production builds) so no development
logging remains in production code.

if (tokenBalance && BigInt(tokenBalance) >= BigInt(_price))
setInvalidBalance(false);
else setInvalidBalance(true);
Expand Down
8 changes: 7 additions & 1 deletion hooks/useBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { useEffect, useState } from "react";
import { ERC20Contract, CurrencyType } from "../utils/constants";
import { fromUint256 } from "../utils/feltService";

export default function useBalances(address?: string) {
export default function useBalances(addressss?: string) {
const address =
"0x008476cB2C9A4935fd9b587983F89124B182e5fb78a3795Fc1A6fDe735d856cf";
Comment on lines +8 to +10
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Hardcoded address breaks hook functionality.

The function parameter was renamed to addressss (appears to be a typo) and a hardcoded address is now used instead of the passed parameter. This breaks the hook's functionality—all callers will receive balances for the same hardcoded address regardless of what address they pass.

This change completely defeats the purpose of the address parameter and will likely cause incorrect balance displays throughout the application.

Apply this diff to fix the issue:

-export default function useBalances(addressss?: string) {
-  const address =
-    "0x008476cB2C9A4935fd9b587983F89124B182e5fb78a3795Fc1A6fDe735d856cf";
+export default function useBalances(address?: string) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export default function useBalances(addressss?: string) {
const address =
"0x008476cB2C9A4935fd9b587983F89124B182e5fb78a3795Fc1A6fDe735d856cf";
export default function useBalances(address?: string) {
🤖 Prompt for AI Agents
In hooks/useBalances.tsx around lines 8 to 10, the hook now ignores its input by
renaming the parameter to `addressss` and hardcoding a fixed address; revert
this so the hook uses the passed-in address. Rename the parameter back to
`address` (or accept the existing parameter name) and remove the hardcoded
string so the hook assigns the incoming address variable directly (e.g., const
address = address; or use the parameter directly), ensuring callers receive
balances for the address they pass.

const [balances, setBalances] = useState<TokenBalance>({});
const [callData, setCallData] = useState<Call[]>([]);
const { contract: multicallContract } = useMulticallContract();
Expand All @@ -18,6 +20,10 @@ export default function useBalances(address?: string) {
blockIdentifier: BlockTag.PENDING,
});

console.log("erc20BalanceData", erc20BalanceData, erc20BalanceError);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove debug console.log before merging.

Debug logging statements should be removed before merging to production to avoid console clutter and potential performance impacts.

Apply this diff:

-  console.log("erc20BalanceData", erc20BalanceData, erc20BalanceError);
-
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log("erc20BalanceData", erc20BalanceData, erc20BalanceError);
🤖 Prompt for AI Agents
In hooks/useBalances.tsx around line 23, remove the debug console.log statement
(console.log("erc20BalanceData", erc20BalanceData, erc20BalanceError);) before
merging: delete the line or replace it with a proper, environment-guarded logger
(e.g., only log in development) if runtime visibility is required in dev,
ensuring no raw console.log remains in production code.


console.log("balances", balances);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove debug console.log before merging.

This debug logging statement should also be removed before merging to production.

Apply this diff:

-  console.log("balances", balances);
-
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log("balances", balances);
🤖 Prompt for AI Agents
In hooks/useBalances.tsx around line 25 there is a debug console.log("balances",
balances);—remove that console.log statement before merging (or replace it with
a proper debug-level logger call if persistent debugging is required), ensuring
no stray console logging remains in production code.


useEffect(() => {
const balancesCallData = () => {
const currencies = Object.values(ERC20Contract);
Expand Down