diyahir / fuels-react

React library for the Fuel blockchain

Home Page:https://fuels-react.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fuel React library

License: MIT CI

This repository is at its early stage so things might not work as expected.

A demo is available https://fuels-react-vite.vercel.app

Documentation

The documentation is available at fuels-react.com

Getting started

Installation

$ pnpm add fuels-react

# use yarn if you prefer
$ yarn add fuels-react

# or npm
$ npm install fuels-react

Setup

Configure your client then wrap your application inside FuelProvider.

import React from 'react';
import ReactDOM from 'react-dom/client';
import { FuelProvider, createClient } from 'fuels-react';
import App from './App';

const client = createClient({ chains: ['beta-2'] });

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

Then you are ready to go.

Checkout the example ./examples/vite for a more detailed usage

import { useWallet } from 'fuels-react';

function MyComponent() {
  const { address, status, connect, disconnect, signMessage, transfer } = useWallet();
  ...
}

License

This project is licensed under the MIT License. Feel free to use and modify it according to your needs.

About

React library for the Fuel blockchain

https://fuels-react.com

License:MIT License


Languages

Language:TypeScript 82.4%Language:CSS 14.5%Language:JavaScript 2.5%Language:HTML 0.6%