Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Getting Started

Icon LinkGetting Started

The Fuel Wallet SDK serves as a connection manager between your DApp and other wallets compatible with the Fuel Network. This package ensures that you can connect to the Fuel Wallet as well as any other wallet using a unified API.

If you are using React jump to the React section .

Icon LinkInstallation

To begin integrating the Fuel Wallet SDK into your DApp, you first need to install the packages @fuels/connectors and fuels.

npm install fuels @fuels/connectors

The installation also requires the fuels SDK, as it is used to communicate with the Fuel Network and provides a set of utilities required for interacting with contracts on the Fuel Network.

Icon LinkExample

You can import defaultConnectors from @fuels/connectors to get a list of all the default connectors. Besides that, you can also create your own connectors or import them individually.

Icon LinkUsing default connectors

import { Fuel } from 'fuels';
import { defaultConnectors } from '@fuels/connectors';
 
const fuel = new Fuel({
  connectors: defaultConnectors({ devMode: true }),
});
 
await fuel.selectConnector('Fuel Wallet');
await fuel.connect();

Icon LinkUsing a custom list

import { Fuel } from 'fuels';
import { FuelWalletConnector } from '@fuels/connectors';
 
const fuel = new Fuel({
  connectors: [new FuelWalletConnector()],
});
 
await fuel.selectConnector('Fuel Wallet');
await fuel.connect();

Icon LinkUsing React

We also provide a set of React hooks and a user interface (UI) for seamless interaction with connectors, eliminating the need for manual UI creation.

Icon LinkInstallation

npm install fuels @fuels/connectors @fuels/react @tanstack/react-query

Icon LinkExample

Icon LinkSetup

Wrap your application with the providers QueryClientProvider and FuelProvider.

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
 
import { FuelProvider } from '@fuels/react';
import { defaultConnectors } from '@fuels/connectors';
 
const queryClient = new QueryClient();
 
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <React.StrictMode>
    <QueryClientProvider client={queryClient}>
      <FuelProvider fuelConfig={{ connectors: defaultConnectors({ devMode: true }) }}>
        <App />
      </FuelProvider>
    </QueryClientProvider>
  </React.StrictMode>
);

Alternatively, you can pass ui={false} to the FuelProvider to disable the UI in order to implement your own UI.

Icon LinkUsage

import { useConnectUI } from '@fuels/react';
const { connect, isConnecting } = useConnectUI();
 
<button onClick={connect}>
  {isConnecting ? 'Connecting...' : 'Connect'}
</button>

Check our example application for a quick start Icon Link.