Skip to content

Commit 74a4bfc

Browse files
authored
Merge pull request #36 from Scaffold-Stark/docs/cleanup
docs: docs cleanup part 1
2 parents aaa113c + 2c254a2 commit 74a4bfc

17 files changed

+172
-616
lines changed

docs/deploying/deploy-faucets.mdx

+12-27
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,28 @@ sidebar_position: 3
33
toc_max_heading_level: 5
44
---
55

6-
# Faucets
7-
8-
Faucets for deployment of smart contracts can be requested from the website.
9-
10-
- The button is at the bottom left of the [Demo app](https://scaffold-stark-demo.vercel.app/)
6+
# Faucets
117

8+
Faucets for deployment of smart contracts can be requested from the website. You can access it by clicking the "Faucet" button located at the bottom left of the screen.
129

1310
![Faucets Example](/img/faucets.jpg)
1411

15-
- On clicking on it, You will get a pop up
16-
17-
![Sepolia Example](/img/Sepolia.jpg)
18-
19-
20-
## Starknet Sepolia faucets
21-
22-
You can get your faucets in the following websites :
23-
24-
- [Starknet Foundation](https://starknet-faucet.vercel.app/)
25-
26-
- [Alchemy](https://www.alchemy.com/faucets/starknet-sepolia)
27-
28-
- [Blast](https://blastapi.io/faucets/starknet-sepolia-eth)
29-
30-
3112
## Devnet Faucets
3213

33-
- To mint tokens, either to an existing address or a new one, use the following command:
14+
To mint tokens, either to an existing address or a new one, use the following cURL command:
3415

16+
```bash
17+
curl -d '{"amount":1000000000000000000, "address":"0x064b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691"}' -H \
18+
"Content-Type: application/json" -X \
19+
POST http://localhost:5050/mint
3520
```
36-
curl -d '{"amount":1000000000000000000, "address":"0x064b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691"}' -H "Content-Type: application/json" -X POST http://localhost:5050/mint
3721

38-
```
22+
or use our UI to transfer any token to your desired wallet, as shown below.
3923

40-
- You can also transfer faucets as shown below
24+
![getFaucets Example](/img/getFaucets.jpg)
4125

42-
- This is made possible following the installation procedures in the Readme file in [Scaffold-stark-2](https://github.com/Scaffold-Stark/scaffold-stark-2)
26+
## Starknet Sepolia faucets
4327

28+
![Sepolia Example](/img/Sepolia.jpg)
4429

45-
![getFaucets Example](/img/getFaucets.jpg)
30+
We provide links to some official faucets that can be used to obtain testnet tokens.

docs/eth-stark/eth-stark.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 6
33
---
44

5-
# 🚩 Using Scaffold Stark with Ethereum Contracts
5+
# 🚩 (Coming Soon) Using Scaffold Stark with Ethereum Contracts
66

77
[Scaffold-ETH-Stark](https://github.com/Scaffold-Stark/scaffold-eth-stark) is an innovative toolkit that combines the capabilities of Scaffold-Stark and Scaffold-ETH, providing a unified solution for building decentralized applications (dapps) on both Starknet and EVM-compatible blockchains.
88

docs/hooks/hooks.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ sidebar_position: 4
66

77
Scaffold-Stark provides a collection of custom React hooks designed to simplify interactions with your deployed smart contracts. These hooks are wrappers around Starknet-React, an easy-to-use interface with typescript autocompletions for reading from, writing to, and monitoring events emitted by your smart contracts.
88

9-
If you need to interact with external contracts (i.e. not deployed with your SS-2 instance) you can add external contract data to your `packages/nextjs/contracts/preDeployedContracts.ts` file, which would let you use Scaffold-Stark hooks.
9+
If you need to interact with external contracts (i.e. not deployed with your SS-2 instance) you can add external contract data to your `packages/nextjs/contracts/configExternalContracts.ts` file, which would let you use Scaffold-Stark hooks. You can also use our [external contract fetching tool](/quick-start/importing-existing-smart-contracts) that allows you to bring in external contracts with few simple clicks.
1010

11-
To achieve this, include the contract name, its `address`, and `abi` in `preDeployedContracts.ts` for each chain ID. Ensure to update the [`targetNetworks`](/deploying/deploy-nextjs-app#--targetnetworks) in `scaffold.config.ts` to your preferred chains to enable hooks typescript autocompletion.
11+
:::danger
12+
`predeployedContracts.ts` are reserved for our built-in contracts and should not be edited. `deployedContracts.ts` will be updated when you deploy from starknet-foundry and should not be manually updated either.
13+
:::
14+
15+
To achieve this, include the contract name, its `address`, and `abi` in `configExternalContracts.ts` for each chain ID. Ensure to update the [`targetNetworks`](/deploying/deploy-nextjs-app#--targetnetworks) in `scaffold.config.ts` to your preferred chains to enable hooks typescript autocompletion.
1216

13-
This is the structure of `preDeployedContracts` object:
17+
This is the structure of `configExternalContracts` object:
1418

1519
```ts
16-
const preDeployedContracts = {
20+
const configExternalContracts = {
1721
devnet: {
1822
DAI: {
1923
address: "0x...",

docs/hooks/useScaffoldContract.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ sidebar_position: 6
44

55
# useScaffoldContract
66

7+
:::caution
8+
This hook currently only works to read contracts. We apologize for the inconvenience and will work on a fix.
9+
:::
10+
711
Use this hook to get your contract instance by providing the contract name. It enables you to interact with your contract methods.
812
For reading data or sending transactions, it's recommended to use `useScaffoldReadContract` and `useScaffoldWriteContract`.
913

docs/hooks/useScaffoldEthBalance.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,26 @@ This example demonstrates how to use the `useScaffoldEthBalance` hook to display
3434

3535
## Configuration
3636

37-
| Parameter | Type | Description |
38-
| :------------- | :--------------------- | :---------------------------------------------------------------------------------------------- |
39-
| **address** | `Address \| string` | The Ethereum address to fetch the balance for. If not provided, the balance of the contract is used.|
37+
| Parameter | Type | Description |
38+
| :---------- | :------------------ | :--------------------------------------------------------------------------------------------------- |
39+
| **address** | `Address \| string` | The Ethereum address to fetch the balance for. If not provided, the balance of the contract is used. |
4040

4141
## Return Values
4242

43-
| Parameter | Type | Description |
44-
| :--------------- | :------------ | :------------------------------------------------------------------------------------------------------------- |
45-
| **value** | `bigint` | The raw balance fetched from the contract as a `bigint`. |
46-
| **decimals** | `number` | Number of decimals for the token. Defaults to `18` for ETH. |
47-
| **symbol** | `string` | The token symbol. For this contract, it will return `"ETH"`. |
48-
| **formatted** | `string` | The balance formatted into a human-readable string using ethers' `formatUnits`. Defaults to `"0"` if no balance. |
43+
| Parameter | Type | Description |
44+
| :------------ | :------- | :--------------------------------------------------------------------------------------------------------------- |
45+
| **value** | `bigint` | The raw balance fetched from the contract as a `bigint`. |
46+
| **decimals** | `number` | Number of decimals for the token. Defaults to `18` for ETH. |
47+
| **symbol** | `string` | The token symbol. For this contract, it will return `"ETH"`. |
48+
| **formatted** | `string` | The balance formatted into a human-readable string using ethers' `formatUnits`. Defaults to `"0"` if no balance. |
4949

5050
## Call Object Configuration
5151

52-
| Parameter | Type | Description |
53-
| :------------------ | :---------- | :--------------------------------------------------------------------------------------------------------------- |
54-
| **functionName** | `string` | Name of the function to call (in this case, `balance_of`). |
55-
| **args** (optional) | `unknown[]` | Arguments to pass to the function, such as the target address. |
56-
| **blockIdentifier** | `BlockNumber`| Specifies the block to query the contract from, set as `"pending"` by default. |
52+
| Parameter | Type | Description |
53+
| :------------------ | :------------ | :----------------------------------------------------------------------------- |
54+
| **functionName** | `string` | Name of the function to call (in this case, `balance_of`). |
55+
| **args** (optional) | `unknown[]` | Arguments to pass to the function, such as the target address. |
56+
| **blockIdentifier** | `BlockNumber` | Specifies the block to query the contract from, set as `"pending"` by default. |
5757

5858
You can also pass other arguments accepted by [useReadContract from starknet-react](https://starknet-react.com/docs/hooks/queries/usecontractread).
5959

@@ -64,15 +64,17 @@ You can also pass other arguments accepted by [useReadContract from starknet-rea
6464
- **`symbol`**: The token symbol ("ETH").
6565
- The object also includes properties from the `useReadContract` hook. You can check the [useContractRead return values](https://starknet-react.com/docs/hooks/queries/usecontractread) for additional details.
6666

67-
6867
## Best Practices
68+
6969
- Use this hook in any component where you need to display the ETH balance of a specific address.
7070
- Ensure that the component using this hook is wrapped in a StarkNet React provider for seamless integration with the blockchain context.
7171
- For a smooth user experience, handle loading and error states in the component using this hook.
7272
- Consider using the formatted balance for display purposes as it is easier for users to understand compared to the raw bigint value.
7373

7474
## Error Handling
75+
7576
The hook does not handle errors explicitly, but the `useReadContract` hook from StarkNet React includes an `error` property in the return object. You can leverage this to manage errors in your component like this:
77+
7678
```tsx
7779
const { value, formatted, symbol, error } = useScaffoldEthBalance({ address });
7880

docs/hooks/useScaffoldEventHistory.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const { data, isLoading, error } = useScaffoldEventHistory({
2020
});
2121
```
2222

23-
This example configures the hook to read events from the YourEvent event of the YourContract smart contract, starting from block 0. It includes block data, but excludes transaction and receipt data. The hook will watch for new events and refresh the data.
23+
This example configures the hook to read events from the `YourEvent` event of the `YourContract` smart contract, starting from block 0. It includes block data, but excludes transaction and receipt data. The hook will watch for new events and refresh the data.
2424

2525
## Configuration
2626

docs/hooks/useScaffoldMultiWriteContract.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 2
44

55
# useScaffoldMultiWriteContract
66

7-
Use this hook to write to state-changing functions of your smart contract.
7+
Use this hook to batch-write multiple transactions to your smart contract.
88

99
```ts
1010
const { sendAsync } = useScaffoldMultiWriteContract({
@@ -48,7 +48,7 @@ This example demonstrates how to use the `sendAsync`function to send multiple tr
4848

4949
| Parameter | Type | Description |
5050
| :--------------------- | :------------------- | :---------------------------------------------------------------------------------------------------------------------------- |
51-
| **calls** | `Array` | Array of configuration objects for the contract calls. Each object should contain `contractName`, `functionName`, and `args`. |
51+
| **calls** | `Calldata[]` | Array of configuration objects for the contract calls. Each object should contain `contractName`, `functionName`, and `args`. |
5252
| **options** (optional) | `InvocationsDetails` | Additional options for the transactions. |
5353

5454
## Call Object Configuration
@@ -59,10 +59,8 @@ This example demonstrates how to use the `sendAsync`function to send multiple tr
5959
| **functionName** | `string` | Name of the function to call. |
6060
| **args** (optional) | `unknown[]` | Array of arguments to pass to the function (if any). Types are inferred from the contract's function parameters. |
6161

62-
You can also pass other arguments accepted by [writeContractAsync from starknet-react](https://starknet-react.com/hooks/mutation/usecontractwrite).
62+
You can also pass other arguments accepted by [useSendTransaction#sendAsync from starknet-react](https://www.starknet-react.com/docs/hooks/use-send-transaction#sendasync).
6363

6464
## Return Values
6565

66-
- `writeContractAsync` function sends the transaction to the smart contract.
67-
- `isMining` property indicates whether the transaction is currently being mined.
68-
- The extended object includes properties inherited from the useContractWrite hook from starknet-react. You can check the [useContractWrite return values](https://starknet-react.com/hooks/mutation/usecontractwrite) for the types.
66+
- `sendAsync` function sends the transaction(s) to the smart contract.

docs/hooks/useScaffoldReadContract.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ This example retrieves the data returned by the `userGreetingCounter` function o
2727
| **watch** (optional) | `boolean` | Watches and refreshes data on new blocks. (default : `true`) |
2828
| Other arguments | `various` | You can pass other arguments accepted by the useContractRead hook from @starknet-react/core. |
2929

30-
You can also pass other arguments accepted by [useContractRead from Starknet-react](https://starknet-react.com/hooks/query/usecontractread).
30+
You can also pass other arguments accepted by [starknet-react useReadContract](https://www.starknet-react.com/docs/hooks/use-read-contract).
3131

3232
## Return Values
3333

3434
- The retrieved data is stored in the `data` property of the returned object.
35-
- The extended object includes properties inherited from the useContractRead hook of starknet-react. You can check the [useContractRead return values](https://starknet-react.com/hooks/query/usecontractread) documentation for the types.
35+
- The extended object includes properties inherited from the `useReadContract` hook of starknet-react. You can check the [useReadContract return values](https://www.starknet-react.com/docs/hooks/use-read-contract) documentation for the types.

docs/hooks/useScaffoldWriteContract.md

+7-10
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,13 @@ In this example, the updateGreeting function of the YourContract is called with
4040

4141
## Configuration
4242

43-
| Parameter | Type | Description |
44-
| :-------------------- | :---------- | :--------------------------------------------------------------------------------------------------------------- |
45-
| **contractName** | `string` | Name of the contract to write to. |
46-
| **functionName** | `string` | Name of the function to call. |
47-
| **args** (optional) | `unknown[]` | Array of arguments to pass to the function (if any). Types are inferred from the contract's function parameters. |
48-
| **option** (optional) | `object` | Additional options for the transaction, such as gas and value. |
49-
50-
You can also pass other arguments accepted by [useContractWrite from Starknet-react](https://starknet-react.com/hooks/mutation/usecontractwrite).
43+
| Parameter | Type | Description |
44+
| :------------------ | :---------- | :--------------------------------------------------------------------------------------------------------------- |
45+
| **contractName** | `string` | Name of the contract to write to. |
46+
| **functionName** | `string` | Name of the function to call. |
47+
| **args** (optional) | `unknown[]` | Array of arguments to pass to the function (if any). Types are inferred from the contract's function parameters. |
5148

5249
## Return Values
5350

54-
- The sendAsync method is used to send the write transaction. It returns a promise that resolves when the transaction is confirmed.
55-
- The extended object includes properties inherited from the useContractWrite hook of starknet-react. You can check the [useContractWrite return values](https://starknet-react.com/hooks/mutation/usecontractwrite) documentation for the types.
51+
- The `sendAsync` method is used to send the write transaction. It returns a promise that resolves when the transaction is confirmed.
52+
- The extended object includes properties inherited from the `useSendTransaction` hook of starknet-react. You can check their [documentation](https://www.starknet-react.com/docs/hooks/use-send-transaction#sendasync) for the the sepcific return values.

0 commit comments

Comments
 (0)