Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/apibara/starknet-react

A collection of React providers and hooks for StarkNet
https://github.com/apibara/starknet-react

ethereum hooks l2 react react-hooks starknet typescript

Last synced: 12 days ago
JSON representation

A collection of React providers and hooks for StarkNet

Awesome Lists containing this project

README

        

# Starknet React



@starknet-react/core


Release Status


MIT LICENSE

**Starknet React** is a collection of React hooks for Starknet. It is inspired by
[wagmi](https://github.com/tmm/wagmi), powered by [starknet.js](https://github.com/0xs34n/starknet.js).

## Documentation

Documentation, including demos, [is available online](https://starknet-react.com/).

## Getting Started

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

```shell
pnpm add @starknet-react/chains @starknet-react/core
```

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

```shell
pnpm add get-starknet-core starknet
```

2. Wrap your app with `StarknetConfig`

```typescript
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 (



);
}
```

3. Access the hooks from your components.

```typescript
import { useAccount } from "@starknet-react/core";

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

return

gm {address}
;
}
```

## License

This library is licensed under the MIT license.