@fuels/react
TypeScript icon, indicating that this package has built-in type declarations

0.36.1 • Public • Published

discord

⚡️ Fuel Wallet React Hooks

The Fuel Wallet React Hooks provide a set of hooks to seamless integrate the Fuel Wallet browser extension with any React JS or Next JS project.

Installation

npm install fuels @fuels/react

Note that the fuels package is also required as a dependency for better integration with other applications built using the Fuels TS SDK.

Usage

Setup the provider

Adding the providers on the upper level of the application that will use the hooks.

import { FuelProvider } from '@fuels/react';

import { App } from './App';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <React.StrictMode>
    <FuelProvider>
      <App />
    </FuelProvider>
  </React.StrictMode>,
);

Connecting to Wallet

import { useState } from 'react';
import {
  useConnect,
  useConnectors,
  useDisconnect,
  useIsConnected,
} from '@fuels/react';

export default function App() {
  const [connector, setConnector] = useState('');
  const { connectors } = useConnectors();
  const { connect } = useConnect();
  const { disconnect } = useDisconnect();
  const { isConnected } = useIsConnected();

  return (
    <div
      style={{
        display: 'flex',
        flexDirection: 'column',
        gap: 10,
        padding: 10,
        maxWidth: 300,
      }}
    >
      <select
        onChange={(e) => {
          console.log(e.target.value);
          setConnector(e.target.value);
        }}
      >
        <option value="">Select a connector</option>
        {connectors.map((c) => (
          <option key={c.name} value={c.name}>
            {c.name}
          </option>
        ))}
      </select>
      <button disabled={!connector} onClick={() => connect(connector)}>
        Connect to {connector}
      </button>
      <button disabled={!connector} onClick={() => disconnect()}>
        Disconnect from {connector}
      </button>
      <p>{isConnected ? 'Connected' : ''}</p>
    </div>
  );
}

Please visit our docs to get started using the Fuel Wallet React Hooks.

Additionally, you can check up the Fuel Wallet React Hooks reference for more details.

📜 License

This repo is licensed under the Apache-2.0 license. See LICENSE for more information.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.36.2-pr-420-9a5bf150pr-420
0.36.2-pr-419-fd731c20pr-419
0.36.2-pr-399-8d5b25c0pr-399
0.36.1-pr-418-02795b70pr-418
0.36.1-pr-408-2e276520pr-408
0.36.1-pr-406-be199710pr-406
0.36.1-pr-402-8ef31f10pr-402
0.36.1-pr-400-c6276950pr-400
0.36.1-main-b0ef68f0main
0.36.0-pr-404-5f2537a0pr-404
0.36.0-pr-403-e43bf450pr-403
0.35.2-pr-405-3b571a70pr-405
0.35.2-pr-401-b910e0d0pr-401
0.35.2-pr-397-68a91c80pr-397
0.35.2-pr-395-7118aec0pr-395
0.35.2-pr-394-1459bd30pr-394
0.35.2-pr-393-70794a50pr-393
0.35.2-pr-392-b1377930pr-392
0.35.2-pr-391-8606e460pr-391
0.35.1-pr-389-ffab3900pr-389
0.35.1-pr-388-b9c95890pr-388
0.35.0-pr-387-713d3210pr-387
0.34.3-pr-386-62f8c290pr-386
0.34.2-pr-385-29cdcec0pr-385
0.34.2-pr-384-8a75adc0pr-384
0.34.2-pr-383-21962a60pr-383
0.34.1-pr-382-ee2dad10pr-382
0.34.1-pr-380-68540fe0pr-380
0.34.0-pr-381-5118ab30pr-381
0.33.1-pr-379-1abca230pr-379
0.33.1-pr-378-e1f75120pr-378
0.33.1-pr-375-4a9bb220pr-375
0.33.0-pr-377-9ec3fa70pr-377
0.32.1-pr-376-fb357af0pr-376
0.32.1-pr-374-4f670610pr-374
0.32.1-pr-372-c071a630pr-372
0.32.0-pr-371-1beac3c0pr-371
0.32.0-pr-370-6fbe6430pr-370
0.31.7-pr-369-cda40660pr-369
0.31.6-pr-368-3913af20pr-368
0.31.6-pr-367-4fb9e4b0pr-367
0.31.6-pr-362-7c91e190pr-362
0.31.5-pr-366-5699f200pr-366
0.31.5-pr-365-32714e20pr-365
0.31.5-pr-364-c24fd470pr-364
0.31.5-pr-363-76f7d5e0pr-363
0.31.5-pr-361-6e6b2e90pr-361
0.31.5-pr-359-a9c54820pr-359
0.31.4-pr-360-22c2d720pr-360
0.31.4-pr-356-37e36240pr-356
0.31.4-pr-355-e2c557b0pr-355
0.31.4-pr-354-e5088490pr-354
0.31.4-pr-353-151b6930pr-353
0.31.4-pr-351-883c7e90pr-351
0.31.4-pr-349-ee36c870pr-349
0.31.3-pr-348-0e6b1fe0pr-348
0.31.3-pr-347-d01e9a60pr-347
0.31.2-pr-346-aa346ed0pr-346
0.31.2-pr-341-28ddc0e0pr-341
0.31.1-pr-345-50c9bed0pr-345
0.31.1-pr-340-1d7fcb70pr-340
0.31.0-pr-343-744697c0pr-343
0.30.2-pr-339-42e2f9d0pr-339
0.30.2-pr-337-0d9156d0pr-337
0.30.2-pr-336-4c35f1c0565a40e721c6882b4d54aa9e63fcd7ec0pr-336
0.30.1-pr-335-a996f44092ffbd6dc30657d1ba4a3acecdaa16070pr-335
0.30.1-pr-329-1f87dd45771219de646cabbc6a9cdcf564d6ee890pr-329
0.30.1-pr-321-a0fb1a14a1782ed0ef397e7c20b25e89a7f0e9af0pr-321
0.30.0-pr-334-6e9538b0b5f37f78f54b4b9b003e2442b7c7cfa50pr-334
0.30.0-pr-333-eee65b6f2761cf0c20728df728050b925c82de650pr-333
0.29.6-preview-42e87855a29f6acb2b675b3b89b57f85f867f0d80preview
0.29.3-pr-308-ac1479a55868d1f31575331ce7f2569d28f1741d0pr-308
0.28.0-pr-252-880cf8549c595f4911e0403b31bcd5cabd92db190pr-252
0.28.0-pr-251-f01a9ddfae85d2ffdf5e67181ebabfd2cb32bfc90pr-251
0.28.0-pr--0dfda2bec629e572a34ad61e9401b13aefed16cb0pr-
0.27.1-pr-240-981ad68d2b7feb6ad7958ad02cf6b4f6d0607d350pr-240
0.27.1-pr-225-09c5574f2030a794bdf4c61cb713e750627a319a0pr-225
0.27.0-pr-231-be65f7d661913757360eb9f2712d5579dc4228630pr-231
0.27.0-pr-230-e5df61d28d6fafe7e2d17c0c544fdb1280e5d4f80pr-230
0.26.0-pr-208-b8510d31d999a5da4fefe7d6bb3cc070ed6662750pr-208
0.22.1-pr-106-fc2d4e90pr-106
0.21.0-pr-91-b176f650pr-91
0.19.1-pr-76-a5bcdc10pr-76
0.19.0-pr-72-790aad40pr-72
0.18.0-dev-e4c2fba0dev
0.36.1578latest
0.36.1578next
0.35.2-pr-396-97d4da4241pr-396

Version History

VersionDownloads (Last 7 Days)Published
0.36.2-pr-399-8d5b25c0
0.36.2-pr-399-033d2870
0.36.2-pr-399-3c2e80a0
0.36.2-pr-420-9a5bf150
0.36.1578
0.36.2-pr-419-fd731c20
0.36.1-main-b0ef68f0
0.36.1-pr-418-02795b70
0.36.1-pr-418-190bdcf0
0.36.1-pr-399-189c9be0
0.36.1-pr-399-34ca48f0
0.36.1-pr-399-c8037740
0.36.1-pr-399-916b3a30
0.36.1-pr-399-f0a87830
0.36.1-pr-399-70508a40
0.36.1-pr-399-bb869870
0.36.1-pr-399-b4aa7f40
0.36.1-pr-399-3fa337d0
0.36.1-pr-399-7f20be30
0.36.1-pr-399-6453f260
0.36.1-pr-399-e944d930
0.36.1-pr-399-f0ae40c0
0.36.1-pr-399-b4f03b00
0.36.1-pr-399-8b5c9b40
0.36.1-pr-399-fa0c6b60
0.36.1-pr-399-1cc488d0
0.36.1-pr-399-6d855640
0.36.1-pr-399-d5fcafd0
0.36.1-pr-399-371b58c0
0.36.1-pr-400-c6276950
0.36.1-pr-400-79b9e8e0
0.36.1-pr-400-260aa720
0.36.1-pr-400-581d6370
0.36.1-pr-400-70b71390
0.36.1-pr-400-35055a10
0.36.1-pr-400-01e21e40
0.36.1-pr-400-59df07f0
0.36.1-pr-399-3df96bc0
0.36.1-pr-399-2cf82900
0.36.1-pr-408-2e276520
0.36.1-pr-406-be199710
0.36.0233
0.36.1-pr-402-8ef31f10
0.36.0-main-57dc2f60
0.36.0-pr-404-5f2537a0
0.36.0-pr-404-b02595f0
0.36.0-pr-403-e43bf450
0.35.2-main-9d5e0040
0.35.2-pr-405-3b571a70
0.35.2-pr-397-68a91c80
0.35.2-pr-400-234980b0
0.36.0-pr-404-4ea37210
0.36.0-pr-403-17936bd0
0.35.2-pr-404-331f2870
0.35.2-pr-403-fe7bd2f0
0.35.2-pr-396-97d4da4241
0.35.2-pr-396-cd335480
0.35.2-pr-396-1bf430d0
0.35.3-pr-402-883e4010
0.35.2-main-46000eb0
0.35.2-pr-401-b910e0d0
0.35.2-pr-400-103dd6e0
0.35.2-pr-399-ca7ee160
0.35.2-pr-397-54d7f940
0.35.2-pr-397-9ebe0440
0.35.2-pr-397-8b9a8820
0.35.2-pr-397-1459bd30
0.35.2-pr-394-1459bd30
0.35.2-pr-394-615f5b10
0.35.2-pr-394-c81515b0
0.35.2-pr-394-8cdca670
0.35.2-pr-394-67564b30
0.35.2-pr-396-cb673ad0
0.35.2-pr-395-7118aec0
0.35.2-pr-394-7f175320
0.35.2-pr-394-7de85800
0.35.2-pr-394-8a4e21f0
0.35.2-pr-394-95733350
0.35.2-pr-394-57e9b290
0.35.2-pr-393-70794a50
0.35.2-pr-392-b1377930
0.35.1-pr-392-1b7787a0
0.35.1180
0.35.2-pr-391-8606e460
0.35.1-main-d6e12c90
0.35.1-pr-389-ffab3900
0.35.033
0.35.1-pr-388-b9c95890
0.35.0-main-5c3d3370
0.35.0-pr-387-713d3210
0.35.0-pr-387-3c4513b0
0.34.20
0.34.3-pr-386-62f8c290
0.34.2-main-9c0923b0
0.34.2-pr-385-29cdcec0
0.34.2-pr-385-578e8270
0.34.2-pr-384-8a75adc0
0.34.10
0.34.2-pr-383-21962a60
0.34.1-main-b0708e30
0.34.1-pr-382-ee2dad10
0.34.00
0.34.1-pr-380-68540fe0
0.34.0-main-cdac8d40
0.34.0-pr-381-5118ab30
0.34.0-pr-381-447be410
0.33.2-pr-380-20835f50
0.33.1-main-cd36eda0
0.33.1-pr-379-1abca230
0.33.1-pr-379-eabd6c90
0.33.1-pr-378-e1f75120
0.33.00
0.33.1-pr-375-4a9bb220
0.33.0-main-aa757db0
0.33.0-pr-377-9ec3fa70
0.32.1-pr-376-fb357af0
0.32.1-pr-376-4b2d4d20
0.32.2-pr-375-0f5502e0
0.32.1-main-58d03880
0.32.1-pr-374-4f670610
0.32.00
0.32.1-pr-372-c071a630
0.32.0-main-5a2cfe30
0.32.0-pr-371-1beac3c0
0.32.1-pr-372-80c40140
0.32.0-main-9a202240
0.32.0-pr-370-6fbe6430
0.32.0-pr-370-b9fd4050
0.31.7-pr-371-8bb60be0
0.31.7-pr-370-14548640
0.31.61
0.31.7-pr-369-cda40660
0.31.6-main-450b6120
0.31.6-pr-368-3913af20
0.31.6-pr-367-4fb9e4b0
0.31.50
0.31.6-pr-362-7c91e190
0.31.5-main-11f468c0
0.31.5-pr-366-5699f200
0.31.5-pr-366-9ee4ecb0
0.31.5-main-28022d00
0.31.5-pr-364-c24fd470
0.31.5-main-4eecdf30
0.31.5-pr-365-32714e20
0.31.5-pr-365-b8aa8320
0.31.5-pr-365-af2a2ee0
0.31.5-pr-364-eaf91480
0.31.5-pr-363-76f7d5e0
0.31.5-pr-363-92e0ff70
0.31.5-pr-363-a10824d0
0.31.5-pr-363-19f3f580
0.31.5-pr-363-816dca30
0.31.6-pr-362-aa412040
0.31.5-main-64c291f0
0.31.5-pr-359-a9c54820
0.31.40
0.31.5-pr-361-6e6b2e90
0.31.4-main-9c1db2e0
0.31.4-pr-360-22c2d720
0.31.4-pr-360-caea2340
0.31.4-pr-360-7f41c9c0
0.31.4-pr-359-2ae68320
0.31.4-pr-355-e2c557b0
0.31.4-pr-356-37e36240
0.31.4-pr-356-0d039d00
0.31.4-pr-355-42550e30
0.31.4-pr-355-7b387080
0.31.4-pr-354-e5088490
0.31.4-pr-351-883c7e90
0.31.4-pr-351-ca29eb60
0.31.4-pr-351-9acbc4d0
0.31.4-pr-353-151b6930
0.31.4-pr-353-0c7802e0
0.31.4-pr-353-3f174d30
0.31.4-pr-353-45bfeb40
0.31.4-pr-353-34f36520
0.31.4-pr-351-c078ce10
0.31.4-pr-351-eacec700
0.31.310
0.31.4-pr-349-ee36c870
0.31.3-main-1ffb4b50
0.31.3-pr-348-0e6b1fe0
0.31.6-pr-348-1910b5a0
0.31.20
0.31.3-pr-347-d01e9a60
0.31.2-main-d40b0b70
0.31.2-pr-341-28ddc0e0
0.31.10
0.31.2-pr-346-aa346ed0
0.31.1-main-fa88dca0
0.31.1-pr-345-50c9bed0
0.31.1-pr-345-742c05c0
0.31.00
0.31.1-pr-340-1d7fcb70
0.31.0-main-4303a900
0.31.0-pr-343-744697c0
0.30.2-pr-343-c5ed8410
0.30.2-pr-343-48c74f30
0.30.2-pr-341-a9a9dfa0
0.30.2-pr-341-0f75f340
0.30.3-pr-340-c99dd630
0.30.2-main-296748c0
0.30.2-pr-339-42e2f9d0
0.30.2-pr-337-0d9156d0
0.30.10
0.30.2-pr-336-4c35f1c0565a40e721c6882b4d54aa9e63fcd7ec0
0.30.2-pr-336-81cff7d92cda7e607c27128f6b9c00f13d4498a50
0.30.1-main-be193e39d16bfeeef4cbadde8be5067e912584190
0.30.2-pr-336-1acef5d9dce6cfac53d8123e07ba308d838c6b380
0.30.1-pr-321-a0fb1a14a1782ed0ef397e7c20b25e89a7f0e9af0
0.30.1-pr-335-a996f44092ffbd6dc30657d1ba4a3acecdaa16070
0.30.1-pr-335-7ad1770f52515b697209d031d2682aef10bc7ace0
0.30.1-pr-335-4be4de01de5026a5585ce1d7c56aa448c23337c70
0.30.1-pr-335-7d7ea4331ba4d1c96965258b7641987ead80c3c80
0.30.00
0.30.1-pr-329-1f87dd45771219de646cabbc6a9cdcf564d6ee890
0.30.0-pr-334-6e9538b0b5f37f78f54b4b9b003e2442b7c7cfa50
0.29.7-pr-334-bfa53f0a20bf153dbaf2403b53936a6e3177b6fa0
0.30.0-main-ac45fc9c2ac3d2ddb2374cb6ea642e58635f66500
0.30.0-pr-333-eee65b6f2761cf0c20728df728050b925c82de650
0.29.7-main-a9bf3c474e20ececa386cddb6e861bcb52651f3f0
0.29.60
0.29.6-main-165ca68518c3581666b6e33c8d5aab63525fa55b0
0.29.6-preview-42e87855a29f6acb2b675b3b89b57f85f867f0d80
0.29.6-preview-013f56b1a22d35d33b9262252a39d82c74dcc2b10
0.29.50
0.29.5-main-01f20fb80e221b5d0daa78743583424c683b382c0
0.29.5-preview-1df2be95d9a12f0ff645a3d76f3ce854408c53e10
0.29.40
0.29.4-main-9fc7a98ba855f449b65819417247881dab3365980
0.29.30
0.29.3-main-f1a0a237a204aee555e5a2fb166b8f143377cc210
0.29.3-main-681785bdd135ba9a205130bbbc381d32919cf7e30
0.29.3-main-a7c78f4eab3641a2221552543b73150a3fcdc3880
0.29.3-pr-308-ac1479a55868d1f31575331ce7f2569d28f1741d0
0.29.20
0.29.2-main-56f3a600cc96aa6fa675af3e41dc192e97f014610
0.29.2-preview-e11a3c91846df358fff66f439d59204d8c03ace40
0.29.10
0.29.1-main-dea65a09822ae1aca4577e415d9bf78d53b0657f0
0.29.00
0.29.0-main-7f719cc474396d3fdaa82aad379c5b29c6b036960
0.29.0-main-3c29c368ced7dd17a7768b048c576ec1c63924720
0.29.0-main-3c55d250946fa920e371d914f7733217cf47ea160
0.29.0-main-65924f35f2e76dc0f334bc68914806205ec10bfc0
0.29.0-main-366ffa92a1958894c5b4ec060a5008a4ef380c450
0.29.0-main-0fbc99b33cf927b44eb5c6bf21d4f841e42dfa160
0.29.0-main-6b8963c80beb14b79b8a42f84e6ecd7fee519fd20
0.29.0-main-507c73f429f94187e3bdc01238474334b112e5100
0.29.0-main-17838cfb4e649cabc20b78f1d60c3a9bc041a6260
0.28.2-main-50488ae7ab7c41202fa48234ef977978a752d9920
0.28.2-main-e2c514959a54918a7a99f2730b68e83fc68daa2b0
0.28.2-preview-e63f612950627980c2b9782d9a731752c639ac3d0
0.28.2-main-ca76a505967340f5085a271073710097d538b9d60
0.28.2-preview-934012c3935f6f492ffdbcfe0085d22e7eef92a50
0.28.10
0.28.1-main-ed0f8b2fbdc6610457287fa668be7fb7779ca7490
0.28.1-main-b789ad04054d4c7a57b0e6c14e33dd83cb4790130
0.28.00
0.28.0-main-eea98c991ed9aca318f65743f2734d5aa32e2e0e0
0.28.0-main-c321b2510cd72074e82ffe1072b25c93db0d03c60
0.28.0-pr-252-880cf8549c595f4911e0403b31bcd5cabd92db190
0.28.0-pr-252-f1766572a9c1137a4c2dbaca0307fcfeb7829af20
0.28.0-main-d10db6d28e74d958addbb113ec07bd75c0821e740
0.28.0-main-1f6ee8679994528ae36faec51535a183d582a58b0
0.28.0-pr-251-f01a9ddfae85d2ffdf5e67181ebabfd2cb32bfc90
0.28.0-pr-251-ccf7ce112bc7d9118f8e1563a46933945866ceaf0
0.28.0-pr-251-eafc1ab4a8e52ac9562c48f63e6eae82e93561ae0
0.28.0-pr-251-ffbc50b009b2c1a348bd56ca4fe2ae8cd7542e450
0.28.0-pr--0dfda2bec629e572a34ad61e9401b13aefed16cb0
0.27.2-main-b662c8d36f078764a4f6a146ad9758db3882e5ac0
0.27.11,765
0.27.1-main-9b6b7d3d271aa68fab01c6d236095cc2537b100e0
0.27.1-main-57ba758b8952fcad9c9ecd5813c22fab0d5af0e40
0.27.1-pr-240-981ad68d2b7feb6ad7958ad02cf6b4f6d0607d350
0.27.00
0.27.1-pr-225-09c5574f2030a794bdf4c61cb713e750627a319a0
0.27.0-main-083bf92b594c7d1eee9e7225f909e1e140aef8090
0.27.0-preview-be65f7d661913757360eb9f2712d5579dc4228630
0.27.0-pr-231-be65f7d661913757360eb9f2712d5579dc4228630
0.27.0-pr-230-e5df61d28d6fafe7e2d17c0c544fdb1280e5d4f80
0.27.0-main-1d90228e5425ab4dc8018f72e09797ef385f2ab60
0.26.00
0.26.0-main-2c194a46f144c82a0f9a3205d79ef58f938eb2970
0.26.0-pr-208-b8510d31d999a5da4fefe7d6bb3cc070ed6662750
0.26.0-pr-208-7fc22a99ee9d8cb004fd401fe1d4944a50cb8df50
0.25.013
0.25.0-main-fda8db19298d1042aba40504ff876196eb9a0f400
0.25.0-main-6c313dfcac480a345acbf4d1b7a70168ef07f8d50
0.24.00
0.24.0-main-d175142c7efb3f7134ddef2eae4d318f18bce7ed0
0.24.0-main-533abbfd163ad377faf2239d768a15821f6f56110
0.24.0-main-98df6e304f67a8aa6f43eec9194d179ebfd427250
0.24.0-main-ed5fb440b1b0739fbeb616156864d9ba6da3ac070
0.23.037
0.23.0-main-256385d0
0.23.0-main-f10d40d0
0.22.1-pr-106-fc2d4e90
0.22.00
0.22.0-main-3e2786a0
0.22.0-preview-19e28310
0.21.077
0.21.0-main-30f37c80
0.21.0-main-56f67a40
0.21.0-pr-91-b176f650
0.21.0-main-497fb060
0.21.0-pr-91-400c8e10
0.21.0-pr-91-ced044a0
0.21.0-pr-91-57e38460
0.21.0-pr-91-39bb4350
0.21.0-main-12d138a0
0.21.0-pr-91-14976e50
0.21.0-pr-91-29f2dab0
0.21.0-pr-91-0385f700
0.21.0-pr-91-daa7f070
0.21.0-pr-91-92045c50
0.21.0-pr-91-476a8230
0.21.0-pr-91-cfdb8970
0.21.0-pr-91-33e033b0
0.21.0-pr-91-19e25270
0.21.0-pr-91-139d9710
0.21.0-main-fe4cef20
0.21.0-main-9bd5c800
0.21.0-pr-91-57d79b50
0.21.0-main-ec0bd2d0
0.20.04
0.20.0-main-af02d500
0.19.1-pr-76-a5bcdc10
0.19.1-pr-76-57c84500
0.19.01
0.19.0-main-f6c02630
0.19.0-pr-72-790aad40
0.19.0-pr-72-1a5afab0
0.18.12
0.18.1-next-b42f9e20
0.18.010
0.18.0-dev-e4c2fba0
0.17.00
0.17.0-dev-84861d70
0.16.1-dev-5d985310
0.16.00
0.16.0-dev-ec20a4b0
0.15.30
0.15.3-dev-3e3156b0
0.15.21
0.15.2-dev-d21393b0
0.15.2-dev-2c796ee0
0.15.2-dev-f32be820
0.15.2-dev-3aee54c0
0.15.10
0.15.1-dev-aac1c400

Package Sidebar

Install

npm i @fuels/react

Weekly Downloads

3,066

Version

0.36.1

License

Apache-2.0

Unpacked Size

708 kB

Total Files

150

Last publish

Collaborators

  • fuel-ci