Skip to content

Commit

Permalink
fix: get starknet name issue (#205)
Browse files Browse the repository at this point in the history
* fix: get starknet name issue

* fix: code style
  • Loading branch information
stanleyyconsensys authored Feb 29, 2024
1 parent adfd8ae commit b4a800b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/wallet-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'toastr2/dist/toastr.min.css';
import { NoMetamaskModal } from 'components/ui/organism/NoMetamaskModal';
import { MinVersionModal } from './components/ui/organism/MinVersionModal';
import { useHasMetamask } from 'hooks/useHasMetamask';
import { DUMMY_ADDRESS } from 'utils/constants';

library.add(fas, far);

Expand All @@ -30,7 +31,7 @@ function App() {
const { accounts } = useAppSelector((state) => state.wallet);
const { hasMetamask } = useHasMetamask();

const address = accounts?.length > 0 ? (accounts[0] as unknown as string) : '0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const address = accounts?.length > 0 ? (accounts[0] as unknown as string) : DUMMY_ADDRESS;

useEffect(() => {
if (!provider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { openExplorerTab } from 'utils/utils';
import { useAppSelector } from 'hooks/redux';
import { AddTokenModal } from '../AddTokenModal';
import { useStarkNetSnap } from 'services';
import { DUMMY_ADDRESS } from 'utils/constants';

interface Props {
address: string;
Expand Down Expand Up @@ -53,7 +54,7 @@ export const SideBarView = ({ address }: Props) => {
}, [wallet.erc20TokenBalances]);

useEffect(() => {
if (address) {
if (address && address !== DUMMY_ADDRESS) {
getStarkName(address, chainId)
.then((name) => {
setStarkName(name);
Expand Down
2 changes: 2 additions & 0 deletions packages/wallet-ui/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ export const TRANSACTIONS_REFRESH_FREQUENCY = 60000;
export const TOKEN_BALANCE_REFRESH_FREQUENCY = 60000;

export const TIMEOUT_DURATION = 10000;

export const DUMMY_ADDRESS = '0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

0 comments on commit b4a800b

Please sign in to comment.