Skip to content

Commit

Permalink
Merge pull request #38 from Scaffold-Stark/docs/update-based-on-new-p…
Browse files Browse the repository at this point in the history
…arser

docs: update based on new parser
  • Loading branch information
metalboyrick authored Nov 29, 2024
2 parents 026790d + e8686fd commit 4a2c7b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
25 changes: 20 additions & 5 deletions docs/hooks/useScaffoldMultiWriteContract.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ This example sends multiple transactions to the specified smart contracts to cal
## Usage Example

```tsx
const { sendAsync } = useScaffoldMultiWriteContract({
calls: [
{
contractName: "YourContract1",
functionName: "setGreeting",
args: ["Hello"],
},
{
contractName: "YourContract2",
functionName: "setCounter",
args: [42],
},
],
});

<button
className="btn btn-primary"
onClick={async () => {
Expand All @@ -39,17 +54,17 @@ This example sends multiple transactions to the specified smart contracts to cal
}}
>
Send Transactions
</button>
</button>;
```

This example demonstrates how to use the `sendAsync`function to send multiple transactions to the specified smart contracts, calling the functions with the arguments passed in calls.

## Configuration

| Parameter | Type | Description |
| :--------------------- | :------------------- | :---------------------------------------------------------------------------------------------------------------------------- |
| **calls** | `Calldata[]` | Array of configuration objects for the contract calls. Each object should contain `contractName`, `functionName`, and `args`. |
| **options** (optional) | `InvocationsDetails` | Additional options for the transactions. |
| Parameter | Type | Description |
| :--------------------- | :------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **calls** | `Calldata[]` | Array of configuration objects for the contract calls. Each object should contain `contractName`, `functionName`, and `args`. For special datatypes such as `enums`, you can pass in enum types from `starknet.js` |
| **options** (optional) | `InvocationsDetails` | Additional options for the transactions. |

## Call Object Configuration

Expand Down
10 changes: 5 additions & 5 deletions docs/hooks/useScaffoldWriteContract.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ In this example, the updateGreeting function of the YourContract is called with

## Configuration

| Parameter | Type | Description |
| :------------------ | :---------- | :--------------------------------------------------------------------------------------------------------------- |
| **contractName** | `string` | Name of the contract to write to. |
| **functionName** | `string` | Name of the function to call. |
| **args** (optional) | `unknown[]` | Array of arguments to pass to the function (if any). Types are inferred from the contract's function parameters. |
| Parameter | Type | Description |
| :------------------ | :---------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **contractName** | `string` | Name of the contract to write to. |
| **functionName** | `string` | Name of the function to call. |
| **args** (optional) | `unknown[]` | Array of arguments to pass to the function (if any). Types are inferred from the contract's function parameters. For special datatypes such as `enums`, you can pass in enum types from `starknet.js` |

## Return Values

Expand Down

0 comments on commit 4a2c7b3

Please sign in to comment.