reddio-com / starknet-react

A collection of React providers and hooks for StarkNet

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starknet React

@starknet-react/core Release Status MIT LICENSE

Starknet React is a collection of React hooks for Starknet. It is inspired by wagmi, powered by starknet.js.

Documentation

Documentation, including demos, is available online.

Getting Started

  1. Add @starknet-react/chains and @starknet-react/core to your dependencies.
pnpm add @starknet-react/chains @starknet-react/core

You also need to add get-starknet-core and starknet to your dependencies.

pnpm add get-starknet-core starknet
  1. Wrap your app with StarknetConfig
import { sepolia } from "@starknet-react/chains";
import {
  StarknetConfig,
  publicProvider,
  argent,
  braavos,
} from "@starknet-react/core";

function App() {
  const chains = [sepolia];
  const provider = publicProvider();
  const connectors = [braavos(), argent()];

  return (
    <StarknetConfig chains={chains} provider={provider} connectors={connectors}>
      <YourApp />
    </StarknetConfig>
  );
}
  1. Access the hooks from your components.
import { useAccount } from "@starknet-react/core";

function YourComponent() {
  const { address } = useAccount();

  return <div>gm {address}</div>;
}

License

This library is licensed under the MIT license.

About

A collection of React providers and hooks for StarkNet

https://starknet-react.com

License:MIT License


Languages

Language:TypeScript 78.1%Language:MDX 18.9%Language:JavaScript 2.1%Language:CSS 0.8%Language:Nix 0.2%Language:HTML 0.1%