-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update documentation for v3 release (#494)
- Loading branch information
Showing
47 changed files
with
5,923 additions
and
5,118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,6 @@ function AccountInner() { | |
2, | ||
)} | ||
</pre> | ||
|
||
<i className="text-xs mt-2">* Wallet connection required</i> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,39 @@ | ||
# Demos | ||
|
||
- [Account](/demo/account) | ||
- [Add Chain](/demo/add-chain) | ||
- [Connect wallet](/demo/connect-wallet) | ||
- [Declare Contract (TODO)](/demo/declare-contract) | ||
- [Esimate Fees](/demo/estimate-fees) | ||
- [Nonce for Address](/demo/nonce-for-address) | ||
- [Read contract](/demo/read-contract) | ||
- [Send transaction](/demo/send-transaction) | ||
- [Sign Typed Data](/demo/sign-typed-data) | ||
- [Stark Address](/demo/stark-address) | ||
- [Stark Name](/demo/stark-name) | ||
- [Stark Profile](/demo/stark-profile) | ||
- [StarknetKit Integration](/demo/starknetkit) | ||
- [Switch Chain](/demo/switch-chain) | ||
This section contains a list of demos showing how to use Starknet React. | ||
|
||
You can find the source code for these demos [on GitHub](https://github.com/apibara/starknet-react/tree/main/docs/components/demo). | ||
|
||
## Common Hooks | ||
|
||
**[Account](/demo/account)**: Shows how to access the current account and its address. | ||
|
||
**[Estimate Fees](/demo/estimate-fees)**: Shows how to estimate fees for smart contract calls. | ||
|
||
**[Nonce for Address](/demo/nonce-for-address)**: Shows how to get the nonce for an address. | ||
|
||
**[Read contract](/demo/read-contract)**: Shows how to use the `useReadContract` type-safe API to query a Starknet contract. | ||
|
||
**[Send transaction](/demo/send-transaction)**: Shows how to use the `useContract` and `useSendTransaction` hooks to send transactions to the network. | ||
|
||
**[Sign Typed Data](/demo/sign-typed-data)**: Shows how to request users to sign a piece of data. | ||
|
||
## New APIs | ||
|
||
**[Request wallet permissions](/demo/wallet-permission)**: Shows how to request wallet permissions. | ||
|
||
**[Add Chain](/demo/add-chain)**: Shows how to add a new chain to the wallet. | ||
|
||
**[Switch Chain](/demo/switch-chain)**: Shows how to switch between chains. | ||
|
||
## Starknet ID | ||
|
||
**[Stark Address](/demo/stark-address)**: Shows how to get the address associated to a Starknet ID. | ||
|
||
**[Stark Name](/demo/stark-name)**: Shows how to get the Starknet ID associated to an address. | ||
|
||
**[Stark Profile](/demo/stark-profile)**: Shows how to get the Starknet ID profile associated to an address. | ||
|
||
## Integrations | ||
|
||
**[StarknetKit Integration](/demo/starknetkit)**: Shows how to integrate Starknet React with StarknetKit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Demo from "../../components/demo"; | ||
|
||
# Wallet Permission | ||
|
||
<Demo.WalletPermission /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Explorers | ||
|
||
The `StarknetConfig` provider accepts an optional `explorer` property to | ||
configure the block explorer used by the `useExplorer` hook. | ||
|
||
Starknet React ships with the following block explorers (in alphabetical order): | ||
|
||
- Starkscan | ||
- Viewblock | ||
- Voyager | ||
|
||
## The `Explorer` interface | ||
|
||
The `Explorer` interface is used to generate links to the block explorer. | ||
It provides the following properties and methods. | ||
|
||
- `name: string`: human-friendly explorer name. | ||
- `block({ hash?: string, number?: number }): string`: link to the specified | ||
block, either by hash or number. | ||
- `transaction(hash: string): string`: link to the specified transaction. | ||
- `contract(address: string): string`: link to the specified contract. | ||
- `class(hash: string): string`: link to the specified class. | ||
|
||
## Explorer factory | ||
|
||
`StarknetConfig` expects an __explorer factory__, that is a function with the | ||
following signature: | ||
|
||
```ts | ||
|
||
type ExplorerFactory<T extends Explorer = Explorer> = ( | ||
chain: Chain, | ||
) => T | null; | ||
``` | ||
|
||
Starknet React ships with the following explorer factories: | ||
|
||
- `starkscan` | ||
- `viewblock` | ||
- `voyager` | ||
|
||
## `useExplorer` hook | ||
|
||
You can get an instance of the current explorer already initialized for the current chain | ||
using the `useExplorer` hook. | ||
|
||
```tsx twoslash | ||
import { useExplorer } from "@starknet-react/core"; | ||
|
||
const explorer = useExplorer(); | ||
|
||
const name = explorer.name | ||
const link = explorer.block({ number: 123 }) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.