Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| if (status === "connected" && address !== undefined && address !== null) { | ||
| try { | ||
| const customProvider = new RpcProvider({ | ||
| nodeUrl: "https://free-rpc.nethermind.io/sepolia-juno/v0_7" |
There was a problem hiding this comment.
This is only for sepolia, but we need to also support mainnet
| selectedAccount.address != null | ||
| ? getShortenedHash(selectedAccount.address, 6, 4) | ||
| : "No account selected"; | ||
| console.log("sdfdfd", selectedAccount.balance); |
| import { useSetAtom } from "jotai"; | ||
| import { atom, useAtom, useSetAtom } from "jotai"; | ||
| import { RpcProvider, Contract } from "starknet"; | ||
| // import { formatEther } from "ethers/lib/utils"; |
|
|
||
| export const walletBalanceAtom = atom<string | null>(null); | ||
|
|
||
| const ETH_TOKEN_ADDRESS = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"; |
There was a problem hiding this comment.
Is it the right place for this? I think we can move it into utils/consts
| const setDeclTxHash = useSetAtom(declTxHashAtom); | ||
| const setDeployTxHash = useSetAtom(deployTxHashAtom); | ||
| const setInvokeTxHash = useSetAtom(invokeTxHashAtom); | ||
| console.log(balance |
| } | ||
| }; | ||
|
|
||
| if (status === "connected" && address !== undefined && address !== null) { |
There was a problem hiding this comment.
why do we need this check here? fetchBalance function is doing the same
| const walletAccount = useAtomValue(account); | ||
| // const walletProvider = useAtomValue(provider) | ||
| const walletBalance = useAtomValue(walletBalanceAtom); | ||
| console.log("walletBalance", walletBalance); |
| import { RpcProvider, Contract } from "starknet"; | ||
| // import { formatEther } from "ethers/lib/utils"; | ||
|
|
||
| export const walletBalanceAtom = atom<string | null>(null); |
There was a problem hiding this comment.
The walletBalanceAtom is typed as string | null but is later used as a BigNumberish value when formatting the balance. Consider using a type that reflects the returned value from balanceOf (e.g., BigNumberish | null) or consistently convert the fetched balance to a string.
|
hey @varex83 , that was not the code i meant to push, that was just for testing(the console logs, etc), while solving merge conflict i think i made the mistake, no worries i'll fix this |
| type: "function" | ||
| } | ||
| ]; | ||
| export const walletBalanceAtom = atom<string | bigint | null>(null); |
There was a problem hiding this comment.
We don't want to store atom here, we have atoms directory for this purpose
Removed the hardcoded wallet balance and displaying the actual wallet balance with proper decimal logic for integer and float


closes #318