Skip to content

Commit

Permalink
Add code snippet to demo pages (#527)
Browse files Browse the repository at this point in the history
closes #518 

The changes include the following
- Adds a description of the demo page
- Adds a link to github containing the source code snippet.
  • Loading branch information
fracek authored Oct 31, 2024
2 parents dceaad0 + f395190 commit cc4ecb4
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/pages/demo/account.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import Demo from "../../components/demo";
# Account

<Demo.Account />

This demo shows how to access the currently connected account and its address.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/account.tsx)

Hook(s)
- `useAccount`
7 changes: 7 additions & 0 deletions docs/pages/demo/add-chain.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import Demo from "../../components/demo";
# Add Chain

<Demo.AddChain />

This demo shows how to add a new chain to the wallet.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/add-chain.tsx)

Hook(s)
- `useAddChain`
7 changes: 7 additions & 0 deletions docs/pages/demo/balance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ import Demo from "../../components/demo";

<Demo.Balance />

This demo shows how to fetch an ERC-20 token balance.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/balance.tsx)

Hooks
- `useAccount`
- `useBalance`
9 changes: 9 additions & 0 deletions docs/pages/demo/change-default-network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ import Demo from "../../components/demo";
# Change Default Network (Todo)

<Demo.ChangeDefaultNetwork />

This demo shows how to change the default network.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/change-default-network.tsx)

Hooks
- `publicProvider`
- `useAccount`
- `useNetwork`
8 changes: 8 additions & 0 deletions docs/pages/demo/declare-contract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ import Demo from "../../components/demo";
# Declare Contract (Todo)

<Demo.DeclareContract />

This demo shows how to declare a contract.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/declare-contract.tsx)

Hooks
- `useAccount`
- `useDeclareContract`
10 changes: 10 additions & 0 deletions docs/pages/demo/estimate-fees.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ import Demo from "../../components/demo";
# Estimate Fees

<Demo.EstimateFees />

This demo shows a fee estimate fees for smart contract calls.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/estimate-fees.tsx)

Hooks
- `useAccount`
- `useContract`
- `useEstimateFees`
- `useNetwork`
8 changes: 8 additions & 0 deletions docs/pages/demo/nonce-for-address.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ import Demo from "../../components/demo";
# Nonce for Address

<Demo.NonceForAddress />

This demo shows how to get the nonce for an address.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/nonce-for-address.tsx)

Hooks
- `useAccount`
- `useNonceForAddress`
8 changes: 8 additions & 0 deletions docs/pages/demo/read-contract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ import Demo from "../../components/demo";
# Read Contract

<Demo.ReadContract />

This demo shows how to use the `useReadContract` type-safe API to query a Starknet contract.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/read-contract.tsx)

Hooks
- `useNetwork`
- `useReadContract`
8 changes: 8 additions & 0 deletions docs/pages/demo/send-transaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ import Demo from "../../components/demo";
# Send Transaction

<Demo.SendTransaction />

This demo shows how to send transactions to the network.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/send-transaction.tsx)

Hooks
- `useContract`
- `useSendTransaction`
7 changes: 7 additions & 0 deletions docs/pages/demo/sign-typed-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import Demo from "../../components/demo";
# Sign Typed Data

<Demo.SignTypedData />

This demo shows how to sign typed data via the wallet of the connected account.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/sign-typed-data.tsx)

Hook(s)
- `useSignTypedData`
7 changes: 7 additions & 0 deletions docs/pages/demo/stark-address.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import Demo from "../../components/demo";
# Stark Address

<Demo.StarkAddress />

This demo shows how to get the address associated to a Starknet ID.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/stark-address.tsx)

Hook(s)
- `useStarkAddress`
7 changes: 7 additions & 0 deletions docs/pages/demo/stark-name.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import Demo from "../../components/demo";
# Stark Name

<Demo.StarkName />

This demo shows how to get the Starknet ID associated to an address.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/stark-name.tsx)

Hook(s)
- `useStarkName`
7 changes: 7 additions & 0 deletions docs/pages/demo/stark-profile.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import Demo from "../../components/demo";
# Stark Profile

<Demo.StarkProfile />

This demo shows how to get the Starknet ID profile associated to an address.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/stark-profile.tsx)

Hook(s)
- `useStarkProfile`
13 changes: 13 additions & 0 deletions docs/pages/demo/starknetkit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@ import Demo from "../../components/demo";
# StarknetKit Integration

<Demo.StarknetKit />

This demo shows how to integrate Starknet React with StarknetKit.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/starknetkit.tsx)

Hooks
- starknet-react
-`publicProvider`
- `useAccount`
- `useConnect`
- `useNetwork`,
- starknetkitconnector
- `useStarknetkitConnectModal`
9 changes: 9 additions & 0 deletions docs/pages/demo/switch-chain.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ import Demo from "../../components/demo";
# Switch Chain

<Demo.SwitchChain />

This demo shows how to switch between chains.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/switch-chain.tsx)

Hooks
- `useAccount`
- `useNetwork`
- `useSwitchChain`
7 changes: 7 additions & 0 deletions docs/pages/demo/wallet-permission.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import Demo from "../../components/demo";
# Wallet Permission

<Demo.WalletPermission />

This demo shows how to request wallet permissions.

[Link to GitHub](https://github.com/apibara/starknet-react/blob/main/docs/components/demo/wallet-permission.tsx)

Hook(s)
- `useWalletRequest`

0 comments on commit cc4ecb4

Please sign in to comment.