Skip to content

Commit dca4edd

Browse files
Merge pull request #71 from compolabs/fix/1193-fuelet-minting-error
fetch balance if wallet exists
2 parents e1f6d2b + 50af718 commit dca4edd

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

src/blockchain/FuelNetwork.ts

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ export class FuelNetwork {
6464
return this.walletManager.getBalance(accountAddress, assetAddress);
6565
};
6666

67+
getWallet = (): Nullable<any> => {
68+
return this.walletManager.wallet;
69+
};
70+
6771
getIsExternalWallet = () => false;
6872

6973
getTokenList = (): Token[] => {

src/components/Header/Header.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ const Header: React.FC = observer(() => {
4040
useEffect(() => {
4141
accountStore.setAddress(address);
4242
if (address && wallet) {
43-
const bcNetwork = FuelNetwork.getInstance();
44-
bcNetwork.setWallet(address, wallet);
43+
const setWallet = async () => {
44+
const bcNetwork = FuelNetwork.getInstance();
45+
await bcNetwork.setWallet(address, wallet);
46+
};
47+
48+
setWallet();
4549
}
4650
}, [address, wallet?.address]);
4751

src/stores/BalanceStore.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ export class BalanceStore {
4949
update = async () => {
5050
const { accountStore } = this.rootStore;
5151
const bcNetwork = FuelNetwork.getInstance();
52+
const wallet = bcNetwork.getWallet();
5253

53-
if (!accountStore.address) return;
54+
if (!accountStore.address || !wallet) return;
5455

5556
try {
5657
for (const token of bcNetwork!.getTokenList()) {

src/stores/TradeStore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class TradeStore {
158158
this.setSpotMarkets(spotMarkets);
159159
await this.updateMarketPrices();
160160
} catch (error) {
161-
console.error("[PERP] Error init spot market", error);
161+
console.error("Error init spot market", error);
162162
}
163163
};
164164

0 commit comments

Comments
 (0)