Skip to content

Commit f73b71a

Browse files
authored
Merge pull request #72 from compolabs/fix/1186-bug-create-switch
[1186] Working on fix for wallets
2 parents a52d60b + 26bf49b commit f73b71a

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

src/blockchain/FuelNetwork.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import BN from "@src/utils/BN";
1717
import {
1818
CONTRACT_ADDRESSES,
1919
INDEXER_URL,
20-
NETWORKS,
20+
NETWORK,
2121
PYTH_URL,
2222
TOKENS_BY_ASSET_ID,
2323
TOKENS_BY_SYMBOL,
@@ -39,13 +39,13 @@ export class FuelNetwork {
3939
private walletManager = new WalletManager();
4040
private orderbookSdk: SparkOrderBookSdk;
4141

42-
public network = NETWORKS[0];
42+
public network = NETWORK;
4343

4444
private constructor() {
4545
makeObservable(this.walletManager);
4646

4747
this.orderbookSdk = new SparkOrderBookSdk({
48-
networkUrl: NETWORKS[0].url,
48+
networkUrl: NETWORK.url,
4949
contractAddresses: CONTRACT_ADDRESSES,
5050
indexerApiUrl: INDEXER_URL,
5151
pythUrl: PYTH_URL,

src/blockchain/constants.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ export interface Network {
1616
url: string;
1717
}
1818

19-
export const NETWORKS: Network[] = [
20-
{
21-
name: "Fuel",
22-
url: "https://testnet.fuel.network/v1/graphql",
23-
},
24-
];
19+
export const NETWORK: Network = {
20+
name: "Fuel",
21+
url: "https://beta-5.fuel.network/graphql",
22+
};
2523

2624
export const EXPLORER_URL = "https://app.fuel.network/";
2725

src/components/Header/ConnectedWallet.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useState } from "react";
22
import styled from "@emotion/styled";
3-
import { useDisconnect } from "@fuels/react";
43
import copy from "copy-to-clipboard";
54
import { observer } from "mobx-react";
65

@@ -23,8 +22,7 @@ import ConnectedWalletButton from "./ConnectedWalletButton";
2322

2423
const ConnectedWallet: React.FC = observer(() => {
2524
const { accountStore, notificationStore, balanceStore } = useStores();
26-
const { address } = useWallet();
27-
const { disconnect } = useDisconnect();
25+
const { address, disconnect } = useWallet();
2826

2927
const [isFocused, setIsFocused] = useState(false);
3028

@@ -60,7 +58,7 @@ const ConnectedWallet: React.FC = observer(() => {
6058
},
6159
{
6260
icon: logoutIcon,
63-
action: () => disconnect(),
61+
action: () => disconnectWallet(),
6462
title: "Disconnect",
6563
active: true,
6664
},

src/components/Modal/AccountInfoSheet.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from "react";
22
import styled from "@emotion/styled";
3-
import { useDisconnect } from "@fuels/react";
43
import copy from "copy-to-clipboard";
54

65
import copyIcon from "@src/assets/icons/copy.svg";
@@ -24,9 +23,8 @@ interface Props {
2423
}
2524

2625
const AccountInfoSheet: React.FC<Props> = ({ isOpen, onClose }) => {
26+
const { disconnect } = useWallet();
2727
const { accountStore, notificationStore, balanceStore } = useStores();
28-
const { balance } = useWallet();
29-
const { disconnect } = useDisconnect();
3028

3129
const bcNetwork = FuelNetwork.getInstance();
3230

src/hooks/useWallet.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
useIsConnected,
88
useWallet as useFuelWallet,
99
} from "@fuels/react";
10+
import { useDisconnect } from "@fuels/react";
1011

1112
interface ICurrentConnector {
1213
logo: string;
@@ -23,6 +24,7 @@ export const useWallet = () => {
2324
const { connect, isConnecting, isLoading: isLoadingConnectors } = useConnectUI();
2425
const { isConnected, refetch: refetchConnected } = useIsConnected();
2526
const { account, isLoading: isLoadingAccount, isFetching: isFetchingAccount } = useAccount();
27+
const { disconnect } = useDisconnect();
2628

2729
const address = account ?? "";
2830

@@ -70,6 +72,7 @@ export const useWallet = () => {
7072
isLoadingConnectors,
7173
wallet,
7274
connect,
75+
disconnect,
7376
refetchConnected,
7477
refetchWallet,
7578
};

0 commit comments

Comments
 (0)