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: 12 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-05-22T08:34:20.000Z (6 months ago)
- Last Synced: 2024-05-22T16:27:39.785Z (6 months ago)
- Topics: ethereum, hooks, l2, react, react-hooks, starknet, typescript
- Language: TypeScript
- Homepage: https://starknet-react.com
- Size: 11.9 MB
- Stars: 331
- Watchers: 6
- Forks: 122
- Open Issues: 18
-
Metadata Files:
- Readme: README.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.