diff --git a/Models/Network.ts b/Models/Network.ts
index 6bcb70673..b66ef6177 100644
--- a/Models/Network.ts
+++ b/Models/Network.ts
@@ -7,7 +7,8 @@ export enum NetworkType {
Cosmos = "cosmos",
StarkEx = "starkex",//TODO check this
ZkSyncLite = "zksynclite",
- TON = 'ton'
+ TON = 'ton',
+ Fuel = 'fuel',
}
export class Network {
diff --git a/components/HeaderWithMenu/index.tsx b/components/HeaderWithMenu/index.tsx
index 5440d74f8..c0ec5a015 100644
--- a/components/HeaderWithMenu/index.tsx
+++ b/components/HeaderWithMenu/index.tsx
@@ -6,7 +6,6 @@ import { ArrowLeft } from 'lucide-react'
import ChatIcon from "../icons/ChatIcon"
import dynamic from "next/dynamic"
import LayerswapMenu from "../LayerswapMenu"
-import { useRouter } from "next/router"
import { useQueryState } from "../../context/query"
const WalletsHeader = dynamic(() => import("../ConnectedWallets").then((comp) => comp.WalletsHeader), {
@@ -18,7 +17,6 @@ function HeaderWithMenu({ goBack }: { goBack: (() => void) | undefined | null })
const { boot, show, update } = useIntercom()
const updateWithProps = () => update({ userId, customAttributes: { email: email, } })
const query = useQueryState()
- const router = useRouter()
return (
diff --git a/components/Input/Address/AddressPicker/index.tsx b/components/Input/Address/AddressPicker/index.tsx
index 460958962..e69d5e0c4 100644
--- a/components/Input/Address/AddressPicker/index.tsx
+++ b/components/Input/Address/AddressPicker/index.tsx
@@ -61,7 +61,7 @@ const AddressPicker: FC = forwardRef(function Ad
const provider = useMemo(() => {
if (destinationExchange) return undefined
-
+
return values?.to && getProvider(values?.to)
}, [values?.to, getProvider, destinationExchange])
@@ -169,13 +169,24 @@ const AddressPicker: FC = forwardRef(function Ad
{
destinationExchange ?
-
+
:
!disabled
&& destination
&& provider
&& !manualAddress &&
- { connectedWallet && handleSelectAddress(connectedWallet.address) }} onConnect={() => setIsConnecting(true)} destination={destination} destination_address={destination_address} />
+ { connectedWallet && handleSelectAddress(connectedWallet.address) }}
+ onConnect={() => setIsConnecting(true)}
+ destination={destination}
+ destination_address={destination_address}
+ />
}
{
diff --git a/components/Swap/Form/Form.tsx b/components/Swap/Form/Form.tsx
index d554b5d08..4aa02d86e 100644
--- a/components/Swap/Form/Form.tsx
+++ b/components/Swap/Form/Form.tsx
@@ -25,7 +25,7 @@ import CEXNetworkFormField from "../../Input/CEXNetworkFormField";
import { RouteNetwork } from "../../../Models/Network";
import { resolveExchangesURLForSelectedToken } from "../../../helpers/routes";
import ValidationError from "../../validationError";
-import { ImtblPassportProvider } from "../../ImtblPassportProvider";
+import { ImtblPassportProvider } from "../../WalletProviders/ImtblPassportProvider";
import { Exchange, ExchangeToken } from "../../../Models/Exchange";
import { resolveRoutesURLForSelectedToken } from "../../../helpers/routes";
import { useValidationContext } from "../../../context/validationErrorContext";
diff --git a/components/SwapWithdrawal.tsx b/components/SwapWithdrawal.tsx
index 8870f897c..794a9d906 100644
--- a/components/SwapWithdrawal.tsx
+++ b/components/SwapWithdrawal.tsx
@@ -4,7 +4,7 @@ import SwapDetails from "./Swap";
import { Widget } from "./Widget/Index";
import NotFound from "./Swap/NotFound";
import { BalancesDataProvider } from "../context/balances";
-import { ImtblPassportProvider } from "./ImtblPassportProvider";
+import { ImtblPassportProvider } from "./WalletProviders/ImtblPassportProvider";
const SwapWithdrawal: FC = () => {
const { swapResponse: swap, swapApiError } = useSwapDataState()
diff --git a/components/WalletProviders/FuelProvider.tsx b/components/WalletProviders/FuelProvider.tsx
new file mode 100644
index 000000000..cab6b97dc
--- /dev/null
+++ b/components/WalletProviders/FuelProvider.tsx
@@ -0,0 +1,44 @@
+
+import { defaultConnectors } from '@fuels/connectors';
+import { FuelProvider } from '@fuels/react';
+import { CHAIN_IDS, Provider } from '@fuel-ts/account';
+import { useConfig } from 'wagmi';
+import KnownInternalNames from '../../lib/knownIds';
+import { useSettingsState } from '../../context/settings';
+
+const FuelProviderWrapper = ({
+ children,
+}: { children: React.ReactNode }) => {
+
+ const WALLETCONNECT_PROJECT_ID = process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || '28168903b2d30c75e5f7f2d71902581b';
+ const config = useConfig()
+ const { networks } = useSettingsState()
+
+ const network = networks.find(network => network.name === KnownInternalNames.Networks.FuelMainnet || network.name === KnownInternalNames.Networks.FuelTestnet)
+ const isMainnet = network?.name === KnownInternalNames.Networks.FuelMainnet
+
+ if (!network)
+ return
+ {children}
+
+
+ const fuelConfig = {
+ connectors: defaultConnectors({
+ devMode: false,
+ wcProjectId: WALLETCONNECT_PROJECT_ID,
+ chainId: isMainnet ? CHAIN_IDS.fuel.mainnet : CHAIN_IDS.fuel.testnet,
+ fuelProvider: Provider.create(network?.node_url),
+ ethWagmiConfig: config
+ }),
+ };
+
+ return (
+
+ {children}
+
+ );
+};
+
+export default FuelProviderWrapper;
\ No newline at end of file
diff --git a/components/ImtblPassportProvider.tsx b/components/WalletProviders/ImtblPassportProvider.tsx
similarity index 97%
rename from components/ImtblPassportProvider.tsx
rename to components/WalletProviders/ImtblPassportProvider.tsx
index f3558f96b..4d3abad03 100644
--- a/components/ImtblPassportProvider.tsx
+++ b/components/WalletProviders/ImtblPassportProvider.tsx
@@ -1,5 +1,5 @@
import { useEffect } from "react"
-import { Network } from "../Models/Network";
+import { Network } from "../../Models/Network";
import { useRouter } from "next/router";
const PUBLISHABLE_KEY = process.env.NEXT_PUBLIC_IMMUTABLE_PUBLISHABLE_KEY;
diff --git a/components/RainbowKit.tsx b/components/WalletProviders/RainbowKit.tsx
similarity index 93%
rename from components/RainbowKit.tsx
rename to components/WalletProviders/RainbowKit.tsx
index e3e3e9a51..20aceb2b5 100644
--- a/components/RainbowKit.tsx
+++ b/components/WalletProviders/RainbowKit.tsx
@@ -1,6 +1,6 @@
import '@rainbow-me/rainbowkit/styles.css';
-import { useSettingsState } from "../context/settings";
+import { useSettingsState } from "../../context/settings";
import {
AvatarComponent,
connectorsForWallets,
@@ -8,11 +8,11 @@ import {
DisclaimerComponent,
RainbowKitProvider,
} from '@rainbow-me/rainbowkit';
-import { NetworkType } from "../Models/Network";
-import resolveChain from "../lib/resolveChain";
+import { NetworkType } from "../../Models/Network";
+import resolveChain from "../../lib/resolveChain";
import React from "react";
-import AddressIcon from "./AddressIcon";
-import NetworkSettings from "../lib/NetworkSettings";
+import AddressIcon from "../AddressIcon";
+import NetworkSettings from "../../lib/NetworkSettings";
import { WagmiProvider } from 'wagmi'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { argentWallet, bitgetWallet, coinbaseWallet, injectedWallet, metaMaskWallet, phantomWallet, rainbowWallet, walletConnectWallet } from '@rainbow-me/rainbowkit/wallets';
diff --git a/components/SolanaProvider.tsx b/components/WalletProviders/SolanaProvider.tsx
similarity index 100%
rename from components/SolanaProvider.tsx
rename to components/WalletProviders/SolanaProvider.tsx
diff --git a/components/TonConnectProvider.tsx b/components/WalletProviders/TonConnectProvider.tsx
similarity index 98%
rename from components/TonConnectProvider.tsx
rename to components/WalletProviders/TonConnectProvider.tsx
index f4444e7da..acdcf4966 100644
--- a/components/TonConnectProvider.tsx
+++ b/components/WalletProviders/TonConnectProvider.tsx
@@ -1,5 +1,5 @@
import { THEME, TonConnectUIProvider } from "@tonconnect/ui-react"
-import { ThemeData } from "../Models/Theme";
+import { ThemeData } from "../../Models/Theme";
const TonConnectProvider = ({ children, basePath, themeData, appName }: { children: JSX.Element | JSX.Element[], basePath: string, themeData: ThemeData, appName: string | undefined }) => {
diff --git a/components/WalletProviders/index.tsx b/components/WalletProviders/index.tsx
new file mode 100644
index 000000000..d2964f8e1
--- /dev/null
+++ b/components/WalletProviders/index.tsx
@@ -0,0 +1,32 @@
+import { FC } from "react"
+import TonConnectProvider from "./TonConnectProvider"
+import RainbowKit from "./RainbowKit"
+import SolanaProvider from "./SolanaProvider"
+import { ThemeData } from "../../Models/Theme"
+import dynamic from "next/dynamic"
+
+const FuelProviderWrapper = dynamic(() => import("./FuelProvider").then((comp) => comp.default), {
+ loading: () => null
+})
+
+const WalletsProviders: FC<{ children: JSX.Element | JSX.Element[], basePath: string, themeData: ThemeData, appName: string | undefined }> = ({ children, basePath, themeData, appName }) => {
+ return (
+
+
+
+ {
+ FuelProviderWrapper ?
+
+ {children}
+ :
+ <>
+ {children}
+ >
+ }
+
+
+
+ )
+}
+
+export default WalletsProviders
\ No newline at end of file
diff --git a/components/buttons/connectButton.tsx b/components/buttons/connectButton.tsx
index d1b8e291d..59093cb89 100644
--- a/components/buttons/connectButton.tsx
+++ b/components/buttons/connectButton.tsx
@@ -48,6 +48,11 @@ const ConnectButton = ({
id: "solana",
type: NetworkType.Solana,
},
+ {
+ name: "Fuel",
+ id: "fuel",
+ type: NetworkType.Fuel,
+ },
];
const filteredConnectors = knownConnectors.filter(
(c) => !wallets.map((w) => w?.providerName).includes(c.id)
diff --git a/components/icons/ConnectorIcons.tsx b/components/icons/ConnectorIcons.tsx
index 0f84233ba..bac891aa5 100644
--- a/components/icons/ConnectorIcons.tsx
+++ b/components/icons/ConnectorIcons.tsx
@@ -10,6 +10,9 @@ import OpenMask from "../icons/Wallets/OpenMask";
import Phantom from "../icons/Wallets/Phantom";
import CoinbaseIcon from "../icons/Wallets/Coinbase";
import GlowIcon from "../icons/Wallets/Glow";
+import Fuel from "./Wallets/Fuel";
+import BakoSafe from "./Wallets/BakoSafe";
+import Ethereum from "./Wallets/Ethereum";
export const ResolveConnectorIcon = ({
connector,
@@ -59,6 +62,15 @@ export const ResolveConnectorIcon = ({
{children}
);
+ case KnownConnectors.Fuel:
+ return (
+
+
+
+
+ {children}
+
+ );
default:
return <>>;
}
@@ -69,5 +81,6 @@ const KnownConnectors = {
EVM: "evm",
TON: "ton",
Solana: "solana",
- Glow: "glow"
+ Glow: "glow",
+ Fuel: "fuel",
};
\ No newline at end of file
diff --git a/components/icons/Wallets/BakoSafe.tsx b/components/icons/Wallets/BakoSafe.tsx
new file mode 100644
index 000000000..bcb2695f0
--- /dev/null
+++ b/components/icons/Wallets/BakoSafe.tsx
@@ -0,0 +1,23 @@
+import { SVGProps } from "react"
+
+const BakoSafe = (props: SVGProps) =>
+
+
+export default BakoSafe;
\ No newline at end of file
diff --git a/components/icons/Wallets/Ethereum.tsx b/components/icons/Wallets/Ethereum.tsx
new file mode 100644
index 000000000..27da36ef4
--- /dev/null
+++ b/components/icons/Wallets/Ethereum.tsx
@@ -0,0 +1,12 @@
+import { SVGProps } from "react"
+
+const Ethereum = (props: SVGProps) =>
+
+export default Ethereum;
\ No newline at end of file
diff --git a/components/icons/Wallets/Fuel.tsx b/components/icons/Wallets/Fuel.tsx
new file mode 100644
index 000000000..9fc4d75f6
--- /dev/null
+++ b/components/icons/Wallets/Fuel.tsx
@@ -0,0 +1,12 @@
+import { SVGProps } from "react"
+
+const Fuel = (props: SVGProps) =>
+
+
+export default Fuel;
\ No newline at end of file
diff --git a/components/icons/Wallets/Fuelet.tsx b/components/icons/Wallets/Fuelet.tsx
new file mode 100644
index 000000000..782a6e3a0
--- /dev/null
+++ b/components/icons/Wallets/Fuelet.tsx
@@ -0,0 +1,7 @@
+import { SVGProps } from "react"
+
+const Fuelet = (props: SVGProps) =>
+
+export default Fuelet;
\ No newline at end of file
diff --git a/components/icons/Wallets/Solana.tsx b/components/icons/Wallets/Solana.tsx
new file mode 100644
index 000000000..7cc387391
--- /dev/null
+++ b/components/icons/Wallets/Solana.tsx
@@ -0,0 +1,17 @@
+import { SVGProps } from "react"
+
+const Solana = (props: SVGProps) =>
+
+export default Solana;
\ No newline at end of file
diff --git a/components/icons/Wallets/TON.tsx b/components/icons/Wallets/TON.tsx
index 469ca7ed6..44255a84a 100644
--- a/components/icons/Wallets/TON.tsx
+++ b/components/icons/Wallets/TON.tsx
@@ -1,4 +1,6 @@
-const TON = (props) =>