Detecting wallet presence

To begin integrating with Fuelet Wallet, you first need to install the packages @fuel-wallet/sdk and fuels.

npm install @fuel-wallet/sdk fuels

With these dependencies installed you're able to create a Fuel object to interact with any supported wallet on Fuel:

import {
  Fuel,
  FuelWalletConnector,
  FueletWalletConnector,
} from "@fuel-wallet/sdk";

const fuel = new Fuel({
  connectors: [
    new FueletWalletConnector(),
    new FuelWalletConnector(),
  ],
});

To detect that Fuelet wallet is installed you need to specify FueletWalletConnector when creating an instance of Fuel and then check the status of the needed connector:

const fuel = new Fuel({connectors: [new FueletWalletConnector()]});
const connectors = await window.fuel.connectors();
const fueletWalletInstalled = connectors.find((c) => {
  return c.name === 'Fuelet Wallet';
})?.installed ?? false;

See more on SDK documentation page.

Last updated