Skip to content

Commit baa2b16

Browse files
committed
Edit Manage Starknet accounts
1 parent 8501a8b commit baa2b16

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

wallet/how-to/use-non-evm-networks/starknet/manage-starknet-accounts.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,26 @@ sidebar_position: 2
55

66
# Manage Starknet accounts
77

8-
You can manage Starknet accounts to display account information, handle transactions, and respond to account changes in your dapp.
8+
You can manage Starknet accounts in MetaMask.
9+
The following examples use the [`get-starknet`](https://github.com/starknet-io/get-starknet) library.
910

10-
## View account information
11+
:::note Notes
1112

12-
After a user connects, you can display the account details, such as the account address:
13+
- Account creation in Starknet is handled by the wallet provider.
14+
As a dapp developer, you do not create accounts directly.
15+
Instead, you can guide users to [create an account](connect-to-starknet.md) with MetaMask.
16+
- Currently, the Starknet Snap doesn't support multiple Starknet accounts.
17+
18+
:::
19+
20+
## Prerequisites
21+
22+
[Connect to Starknet](connect-to-starknet.md) from your dapp.
23+
24+
## Display account information
25+
26+
After a user connects to their Starknet account in MetaMask, you can display the account details.
27+
The following example displays the account address:
1328

1429
```javascript
1530
const showAccountInfo = async () => {
@@ -20,9 +35,12 @@ const showAccountInfo = async () => {
2035
};
2136
```
2237

23-
## Retrieve connected Starknet accounts
38+
## Retrieve the connected account
2439

25-
To retrieve and display connected Starknet accounts, use the `get-starknet` library in combination with React hooks:
40+
To retrieve and display a user's connected Starknet account, use the `get-starknet` library in
41+
combination with React hooks.
42+
The following example displays the connected account address if available, and displays buttons to
43+
connect or disconnect the account.
2644

2745
```javascript
2846
import { useStarknet, useConnectors } from "@starknet-react/core";
@@ -57,24 +75,13 @@ function AccountDisplay() {
5775
}
5876
```
5977
60-
This component displays the connected account address if available, and provides buttons to connect or disconnect accounts.
61-
62-
## Account creation
63-
64-
Account creation in Starknet is handled by the wallet provider. As a dapp developer, you do not create accounts directly. Instead, you guide users to [create an account](../connect-to-starknet) with their preferred wallet provider.
65-
66-
:::note
67-
68-
Currently, multiple Starknet accounts are not supported in the Starknet Snap.
69-
70-
:::
71-
7278
## Manage account transactions
7379
74-
You can manage transactions using `get-starknet` as follows:
80+
You can manage a user's Starknet account transactions using `get-starknet`.
81+
The following example invokes a specific function on a Starknet smart contract, handles wallet
82+
connection and transaction submission, and logs the result or any errors:
7583
7684
```javascript
77-
7885
const invokeStarknetContract = async () => {
7986
try {
8087
const starknet = getStarknet();
@@ -96,8 +103,6 @@ const invokeStarknetContract = async () => {
96103
}
97104
};
98105
```
99-
This invokes a specific function on a Starknet smart contract, handling wallet connection and transaction submission, and logs the result or any errors.
100-
101106
102107
## Handle account changes and disconnections
103108
@@ -155,4 +160,4 @@ function AccountChangeHandler() {
155160
export default AccountChangeHandler;
156161
```
157162
158-
Use this component at the top level of your app to handle account changes globally.
163+
Use this component at the top level of your dapp to handle account changes globally.

0 commit comments

Comments
 (0)