-
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.
- Loading branch information
1 parent
d487cd2
commit 9cd1a3d
Showing
41 changed files
with
795 additions
and
680 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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: Account | ||
priority: 1 | ||
hookType: doc | ||
--- | ||
|
||
An Account hook is a function that allows you to set up the connection with wallets. |
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,51 @@ | ||
--- | ||
title: useAccount | ||
priority: 42 | ||
hookType: account | ||
--- | ||
|
||
Hook for accessing the account and its connection status. | ||
|
||
|
||
## Usage | ||
|
||
```ts | ||
import { useAccount } from "@starknet-react/core"; | ||
|
||
export default function Component() { | ||
const { account, address, status } = useAccount(); | ||
|
||
if (status === "disconnected") return <p>Disconnected</p>; | ||
return <p>Account: {address}</p>; | ||
} | ||
``` | ||
|
||
## Options | ||
* __onConnect?__`: (args: { address?: string; connector?: Connector}) => void` | ||
- Function to invoke when connected. | ||
- Connector from starknet.js | ||
|
||
* __onDisconnect?__ `: () => void` | ||
- Function to invoke when disconnected. | ||
|
||
## Returns | ||
* __account?__`: AccountInterface` | ||
- The connected account object. | ||
- AccountInterface from Starknet.js | ||
* __address?__`: string` | ||
- The address of the connected account. | ||
* __connector?__`: Connector` | ||
- The connected connector. | ||
- Connector from starknet.js | ||
* __status__`: AccountStatus` | ||
- The connection status. | ||
- AccountStatus from starknet.js | ||
* __isConnecting?__`: boolean` | ||
- True if connecting. | ||
* __isReconnecting?__`: boolean` | ||
- True if reconnecting. | ||
* __isConnected?__`: boolean` | ||
- True if connected. | ||
* __isDisconnected?__`: boolean` | ||
- True if disconnected. | ||
|
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,46 @@ | ||
--- | ||
title: useConnect | ||
priority: 41 | ||
hookType: account | ||
--- | ||
|
||
Hook to connect the currently connected wallet. | ||
|
||
## Usage | ||
|
||
```ts | ||
import { useConnect } from "@starknet-react/core"; | ||
|
||
export default function Component() { | ||
const { connect, connectors } = useConnect(); | ||
return ( | ||
<ul> | ||
{connectors.map((connector) => ( | ||
<li key={connector.id}> | ||
<button onClick={() => connect({ connector })}> | ||
{connector.name} | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
} | ||
``` | ||
|
||
## Returns | ||
* __connect?__`:(variables: void, options?: InvocationDetails | undefined) => void` | ||
- Connect wallet. | ||
* __connectAsync?__`: (variables: void, options?: InvocationDetails) => Promise<void>` | ||
- Connect wallet. | ||
* __connector?__`: Connector` | ||
- Current connector. | ||
- Connector from Starknet.js. | ||
* __connectors__`: Connector[]` | ||
- Connectors available for the current chain. | ||
- Connector from Starknet.js. | ||
* __pendingConnector?__`: Connector` | ||
- Connector waiting approval for connection. | ||
- Connector from Starknet.js. | ||
|
||
|
||
|
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,28 @@ | ||
--- | ||
title: useDisconnect | ||
priority: 40 | ||
hookType: account | ||
|
||
--- | ||
|
||
Hook to disconnect the currently connected wallet. | ||
|
||
## Usage | ||
|
||
|
||
```ts | ||
import { useDisconnect} from "@starknet-react/core" | ||
|
||
export default function Component() { | ||
const { disconnect } = useDisconnect(); | ||
|
||
return <button onClick={() => disconnect()}>Disconnect</button> | ||
} | ||
|
||
``` | ||
|
||
## Returns | ||
* __disconnect?__`:(variables: void, options?: InvocationDetails | undefined) => void` | ||
- Disconnect wallet | ||
* __disconnectAsync?__`: (variables: void, options?: InvocationDetails) => Promise<void>` | ||
- Disconnect wallet |
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,40 @@ | ||
--- | ||
title: Mutation | ||
priority: 2 | ||
hookType: doc | ||
--- | ||
|
||
A mutation hook is a function that allows you to perform state-changing operations on the Network. | ||
|
||
The mutation hook type provides a set of return values and options that can be used to control and monitor the status of the mutation. | ||
In addition to common options and returns, each mutation hook introduces its own unique set of options and returns. | ||
|
||
## Options | ||
|
||
* __options?__`: InvocationsDetails` | ||
- Additional invocation options. | ||
- From starknet.js | ||
|
||
## Returns | ||
|
||
- **error?**`: Error` | ||
- The error if the call was not successful. | ||
- **variables**`: { calls: Call[], abis: Abi[], options: InvocationDetails }` | ||
- Variables passed to the function invocation. | ||
- **reset**`: () => void` | ||
- Clean the mutation internal state. | ||
- **status**`: "idle" | "loading" | "success" |" error"` | ||
- idle before sending the transaction. | ||
- loading while sending the transaction. | ||
- success if the last invocation was successful. | ||
- error if there was an error. | ||
- **isSuccess?**`: boolean` | ||
- Derived from status. | ||
- **isError?**`: boolean` | ||
- Derived from status. | ||
- **isIdle?**`: boolean` | ||
- Derived from status. | ||
- **isLoading?**`: boolean` | ||
- Derived from status. | ||
- **isPaused?**`: boolean` | ||
- If true, the invocation has been paused. |
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,18 @@ | ||
--- | ||
title: useContractWrite | ||
priority: 41 | ||
hookType: mutation | ||
|
||
--- | ||
|
||
Hook to send one or more transaction to Starknet. | ||
|
||
## Usage | ||
|
||
```ts | ||
import { useContractWrite } from "@starknet-react/core"; | ||
|
||
export function App() { | ||
// TODO | ||
} | ||
``` |
Oops, something went wrong.