Skip to content

Commit

Permalink
Merge pull request #37 from Scaffold-Stark/docs/eth-stark-rename
Browse files Browse the repository at this point in the history
docs: rename
  • Loading branch information
0xquantum3labs authored Oct 24, 2024
2 parents df3bb88 + d90ec9a commit 568b85a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
sidebar_position: 6
---

# useDynamicAccount
# useEthStarkAccount

This is the hook that wraps the `useAccount` hook from starknet-react and wagmi. Use this hook to get your account details.

```ts
const { address } = useDynamicAccount();
const { address } = useEthStarkAccount();
```

## Return Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
sidebar_position: 5
---

# useDynamicContract
# useEthStarkContract

This is the hook that wraps the `useScaffoldContract` hook from Scaffold-Stark and Scaffold-ETH for both Starknet and Ethereum. Use this hook to get your contract instance by providing the contract name. It enables you to interact with your contract methods.
For reading data or sending transactions, it's recommended to use `useDynamicReadContract` and `useDynamicWriteContract`.
For reading data or sending transactions, it's recommended to use `useEthStarkReadContract` and `useEthStarkWriteContract`.

```ts
const { data: yourContract, isLoading: yourContractLoading } = useDynamicContract({
const { data: yourContract, isLoading: yourContractLoading } = useEthStarkContract({
eth: {
contractName: "YourContract",
},
Expand All @@ -17,7 +17,7 @@ const { data: yourContract, isLoading: yourContractLoading } = useDynamicContrac
},
});

// Returns the greeting and can be called in any function, unlike useDynamicReadContract
// Returns the greeting and can be called in any function, unlike useEthStarkReadContract

// for eth contract
await yourContract?.read.greeting();
Expand All @@ -32,7 +32,7 @@ import { useWalletClient } from "wagmi";
const { account } = useAccount();
const { data: walletClient } = useWalletClient();

const { data: yourContract, isLoading: yourContractLoading } = useDynamicContract({
const { data: yourContract, isLoading: yourContractLoading } = useEthStarkContract({
eth: {
contractName: "YourContract",
walletClient: walletClient,
Expand All @@ -53,7 +53,7 @@ const setGreeting = async () => {
};
```

This example uses the `useDynamicContract` hook to obtain a contract instance for the `YourContract` smart contract.
This example uses the `useEthStarkContract` hook to obtain a contract instance for the `YourContract` smart contract.

## Configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 4
---

# useDynamicDeployContract
# useEthStarkDeployedContract

This is the hook that wraps the `useDeployedContractInfo` hook from Scaffold-Stark and Scaffold-ETH for both Starknet and Ethereum. Use this hook to fetch details about a deployed smart contract, including the ABI and address.

Expand All @@ -11,7 +11,7 @@ const {
data: deployedContractInfo,
isLoading: deployedContractLoading,
error: deployedContractError,
} = useDynamicDeployContract({
} = useEthStarkDeployedContract({
eth: { contractName: "YourContract" },
strk: { contractName: "YourContract" },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
sidebar_position: 3
---

# useDynamicEventHistory
# useEthStarkEventHistory

This is the hook that wraps the `useScaffoldEventHistory` hook from Scaffold-Stark and Scaffold-ETH for both Starknet and Ethereum. This hook allows you to read events from a deployed smart contract.

```ts
const { data, isLoading, error } = useDynamicEventHistory({
const { data, isLoading, error } = useEthStarkEventHistory({
strk: {
contractName: "YourContract",
eventName: "contracts::YourContract::YourContract::GreetingChanged",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
sidebar_position: 1
---

# useDynamicReadContract
# useEthStarkReadContract

This is the hook that wraps the `useScaffoldReadContract` hook from Scaffold-Stark and Scaffold-ETH for both Starknet and Ethereum. Use this hook to read public variables and get data from read-only functions of your Starknet and Ethereum smart contracts.

```ts
const { data: totalCounter } = useDynamicReadContract({
const { data: totalCounter } = useEthStarkReadContract({
strk: {
contractName: "YourContract",
functionName: "userGreetingCounter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
sidebar_position: 7
---

# useDynamicTargetNetwork
# useEthStarkTargetNetwork

This is the hook that wraps the `useTargetNetwork` hook from Scaffold-Stark and Scaffold-ETH. Use this hook to get the current connected network.

```ts
const targetNetwork = useDynamicTargetNetwork();
const targetNetwork = useEthStarkTargetNetwork();
```

## Return Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
sidebar_position: 2
---

# useDynamicWriteContract
# useEthStarkWriteContract

This is the hook that wraps the `useScaffoldWriteContract` hook from Scaffold-Stark and Scaffold-ETH for both Starknet and Ethereum. Use this hook to write to your smart contract by calling state-mutating functions.

```ts
const { writeAsync, isPending: greetingPending } = useDynamicWriteContract({
const { writeAsync, isPending: greetingPending } = useEthStarkWriteContract({
strk: {
contractName: "YourContract",
functionName: "updateGreeting",
Expand All @@ -26,7 +26,7 @@ This example calls the updateGreeting function of the YourContract smart contrac
## Usage Example

```tsx
const { writeAsync, isPending: isUpdateGreetingPending } = useDynamicWriteContract({
const { writeAsync, isPending: isUpdateGreetingPending } = useEthStarkWriteContract({
strk: {
contractName: "YourContract",
functionName: "updateGreeting",
Expand Down

0 comments on commit 568b85a

Please sign in to comment.