Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 5 days ago
JSON representation
A collection of React providers and hooks for StarkNet
- Host: GitHub
- URL: https://github.com/apibara/starknet-react
- Owner: apibara
- License: mit
- Created: 2022-02-04T17:32:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T12:11:50.000Z (about 1 month ago)
- Last Synced: 2024-10-29T12:17:06.980Z (about 1 month ago)
- Topics: ethereum, hooks, l2, react, react-hooks, starknet, typescript
- Language: TypeScript
- Homepage: https://starknet-react.com
- Size: 5.15 MB
- Stars: 363
- Watchers: 13
- Forks: 144
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-starknet - Starknet React - React hooks library. (Additional developer resources)
README
# Starknet React
**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.