Skip to content

Commit

Permalink
Updated bad react
Browse files Browse the repository at this point in the history
  • Loading branch information
BlobMaster41 committed Jan 10, 2025
1 parent 6431382 commit 0eda793
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 99 deletions.
2 changes: 1 addition & 1 deletion src/ui/pages/OpNet/Mint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default function Mint() {
}}
/>
</Column>
<Text text="Opnet Fee" color="textDim" />
<Text text="Priority Fee" color="textDim" />
<Input
preset="amount"
placeholder={'sat/vB'}
Expand Down
30 changes: 15 additions & 15 deletions src/ui/pages/OpNet/OpNetTokenScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BigNumber from 'bignumber.js';
import { getContract, IOP_20Contract, OP_20_ABI } from 'opnet';
import { useEffect, useMemo, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';

import { runesUtils } from '@/shared/lib/runes-utils';
import { OPTokenInfo } from '@/shared/types';
Expand Down Expand Up @@ -45,7 +45,15 @@ export default function OpNetTokenScreen() {
divisibility: 0
});

const getWallet = async () => {
const account = useCurrentAccount();

const [loading, setLoading] = useState(false);
const [isOwner, setIsOwner] = useState(false);

const tools = useTools();
const wallet = useWallet();

const getWallet = useCallback(async () => {
const currentWalletAddress = await wallet.getCurrentAccount();
const pubkey = currentWalletAddress.pubkey;

Expand All @@ -55,14 +63,7 @@ export default function OpNetTokenScreen() {
});

return Wallet.fromWif(wifWallet.wif, Web3API.network);
};

const account = useCurrentAccount();

const [loading, setLoading] = useState(false);
const [isOwner, setIsOwner] = useState(false);

const wallet = useWallet();
}, [wallet]);

const unitBtc = useBTCUnit();
useEffect(() => {
Expand Down Expand Up @@ -134,7 +135,7 @@ export default function OpNetTokenScreen() {
};

void getAddress();
}, [account.address, getWallet, params.address, unitBtc, wallet]);
}, [account.address, getWallet, params.address, tools, unitBtc, wallet]);

const enableTransfer = useMemo(() => {
let enable = false;
Expand All @@ -150,9 +151,9 @@ export default function OpNetTokenScreen() {
tools.toastSuccess(`Copied!`);
};

const deleteToken = async () => {
const deleteToken = useCallback(async () => {
const getChain = await wallet.getChainType();
const tokensImported = localStorage.getItem('opnetTokens_' + getChain);
const tokensImported = localStorage.getItem(`opnetTokens_${getChain}_${account.pubkey}`);

if (tokensImported) {
let updatedTokens: string[] = JSON.parse(tokensImported) as string[];
Expand All @@ -162,9 +163,8 @@ export default function OpNetTokenScreen() {

tools.toastSuccess('Token removed from imported list');
window.history.go(-1);
};
}, [account.pubkey, tokenSummary.address, tools, wallet]);

const tools = useTools();
if (loading) {
return (
<Layout>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/OpNet/SendOpNetScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default function SendOpNetScreen() {
}}
/>
</Column>
<Text text="Opnet Fee" color="textDim" />
<Text text="Priority Fee" color="textDim" />
<Input
preset="amount"
placeholder={'sat/vB'}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/OpNet/SplitUtxoScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function SplitUtxoScreen() {
}}
/>
</Column>
<Text text="Opnet Fee" color="textDim" />
<Text text="Priority Fee" color="textDim" />
<Input
preset="amount"
placeholder={'sat/vB'}
Expand Down
Loading

0 comments on commit 0eda793

Please sign in to comment.