@mysten/dapp-kit-core 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/index.d.mts +2 -2
  3. package/dist/index.mjs +6 -2
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/{types-DCpd4A8C.d.mts → types-CujIIq_S.d.mts} +2 -2
  6. package/dist/types-CujIIq_S.d.mts.map +1 -0
  7. package/dist/web/index.d.mts +1 -1
  8. package/docs/actions/connect-wallet.md +68 -0
  9. package/docs/actions/disconnect-wallet.md +37 -0
  10. package/docs/actions/sign-and-execute-transaction.md +95 -0
  11. package/docs/actions/sign-personal-message.md +57 -0
  12. package/docs/actions/sign-transaction.md +64 -0
  13. package/docs/actions/switch-account.md +36 -0
  14. package/docs/actions/switch-network.md +36 -0
  15. package/docs/dapp-kit-instance.md +163 -0
  16. package/docs/getting-started/create-dapp.md +151 -0
  17. package/docs/getting-started/next-js.md +162 -0
  18. package/docs/getting-started/react.md +170 -0
  19. package/docs/getting-started/vue.md +188 -0
  20. package/docs/index.md +70 -0
  21. package/docs/llms-index.md +34 -0
  22. package/docs/react/components/connect-button.md +42 -0
  23. package/docs/react/components/connect-modal.md +51 -0
  24. package/docs/react/components/index.md +13 -0
  25. package/docs/react/dapp-kit-provider.md +86 -0
  26. package/docs/react/hooks/index.md +25 -0
  27. package/docs/react/hooks/use-current-account.md +33 -0
  28. package/docs/react/hooks/use-current-client.md +36 -0
  29. package/docs/react/hooks/use-current-network.md +28 -0
  30. package/docs/react/hooks/use-current-wallet.md +36 -0
  31. package/docs/react/hooks/use-dapp-kit.md +100 -0
  32. package/docs/react/hooks/use-wallet-connection.md +48 -0
  33. package/docs/react/hooks/use-wallets.md +33 -0
  34. package/docs/state.md +168 -0
  35. package/docs/theming.md +196 -0
  36. package/docs/web-components/connect-button.md +87 -0
  37. package/docs/web-components/connect-modal.md +176 -0
  38. package/package.json +6 -4
  39. package/src/core/actions/disconnect-wallet.ts +6 -1
  40. package/src/core/index.ts +1 -1
  41. package/src/core/initializers/sync-state-to-storage.ts +7 -7
  42. package/src/index.ts +1 -0
  43. package/src/wallets/index.ts +2 -2
  44. package/dist/types-DCpd4A8C.d.mts.map +0 -1
@@ -0,0 +1,51 @@
1
+ # Connect Modal
2
+
3
+ > React modal component for wallet selection
4
+
5
+ ## Usage
6
+
7
+ ```tsx
8
+
9
+ const [open, setOpen] = useState(false);
10
+ return (
11
+ <>
12
+ <button onClick={() => setOpen(true)}>Connect Wallet</button>
13
+ <ConnectModal open={open} />
14
+ </>
15
+ );
16
+ }
17
+ ```
18
+
19
+ ## Props
20
+
21
+ - **open** (optional) - Boolean to control modal visibility. If not provided, the modal can be
22
+ controlled by calling `show()` and `close()` methods directly on the component ref.
23
+ - **instance** (optional) - dApp Kit instance. If not provided, uses the instance from context
24
+ - **filterFn** (optional) - Function to filter available wallets
25
+ - Type: `(wallet: UiWallet, index: number, array: UiWallet[]) => boolean`
26
+ - **sortFn** (optional) - Function to sort available wallets
27
+ - Type: `(a: UiWallet, b: UiWallet) => number`
28
+
29
+ ### Example
30
+
31
+ ```tsx
32
+ <ConnectModal
33
+ open={open}
34
+ filterFn={(wallet) => wallet.name !== 'ExcludedWallet'}
35
+ sortFn={(a, b) => a.name.localeCompare(b.name)}
36
+ />
37
+ ```
38
+
39
+ ## Modal States
40
+
41
+ The modal displays different views based on connection status:
42
+
43
+ - **Wallet Selection**: Shows available wallets to choose from
44
+ - **Connecting**: Displays loading state while connecting to selected wallet
45
+ - **Error**: Shows error message with retry option when connection fails
46
+ - **Request Cancelled**: Appears when user cancels the wallet connection request
47
+
48
+ ## Server-Side Rendering (SSR)
49
+
50
+ The `<ConnectModal />` component can be only client-side rendered, as wallets are detected in the
51
+ browser. For Next.js guide see [here](/dapp-kit/getting-started/next-js).
@@ -0,0 +1,13 @@
1
+ # React Components
2
+
3
+ > Pre-built React UI components for wallet interaction
4
+
5
+ The `@mysten/dapp-kit-react` package provides pre-built React components for common wallet
6
+ interactions.
7
+
8
+ ## Available Components
9
+
10
+ - [`ConnectButton`](/dapp-kit/react/components/connect-button) - A button that opens the wallet
11
+ connection modal and displays account info when connected
12
+ - [`ConnectModal`](/dapp-kit/react/components/connect-modal) - A modal dialog for selecting and
13
+ connecting to a wallet
@@ -0,0 +1,86 @@
1
+ # DAppKitProvider
2
+
3
+ > React context provider for dApp Kit configuration
4
+
5
+ The `DAppKitProvider` is a React context provider that makes your dApp Kit instance available
6
+ throughout your React application. It must wrap any components that use dApp Kit hooks.
7
+
8
+ ## Basic Usage
9
+
10
+ ```tsx
11
+
12
+ return (
13
+ <DAppKitProvider dAppKit={dAppKit}>
14
+ <YourApp />
15
+ </DAppKitProvider>
16
+ );
17
+ }
18
+ ```
19
+
20
+ ## Props
21
+
22
+ - **dAppKit**: The dApp Kit instance created with `createDAppKit`
23
+
24
+ ## Provider Setup Patterns
25
+
26
+ ### With Custom Configuration
27
+
28
+ ```tsx
29
+
30
+ const GRPC_URLS = {
31
+ testnet: 'https://fullnode.testnet.sui.io:443',
32
+ } as const;
33
+
34
+ const dAppKit = createDAppKit({
35
+ networks: ['testnet'],
36
+ createClient: (network) => new SuiGrpcClient({ network, baseUrl: GRPC_URLS[network] }),
37
+ autoConnect: true,
38
+ storage: localStorage,
39
+ storageKey: 'myapp_dappkit',
40
+ });
41
+
42
+ // global type registration necessary for the hooks to work correctly
43
+ declare module '@mysten/dapp-kit-react' {
44
+ interface Register {
45
+ dAppKit: typeof dAppKit;
46
+ }
47
+ }
48
+
49
+ return (
50
+ <DAppKitProvider dAppKit={dAppKit}>
51
+ <YourApp />
52
+ </DAppKitProvider>
53
+ );
54
+ }
55
+ ```
56
+
57
+ ## Using Hooks Inside the Provider
58
+
59
+ Once your app is wrapped with `DAppKitProvider`, you can use any dApp Kit hooks in child components:
60
+
61
+ ```tsx
62
+
63
+ const dAppKit = useDAppKit();
64
+ const account = useCurrentAccount();
65
+ const network = useCurrentNetwork();
66
+ const handleConnect = async () => {
67
+ await dAppKit.connectWallet({ wallet });
68
+ };
69
+ return (
70
+ <div>
71
+ <p>Network: {network}</p>
72
+ <p>Account: {account?.address}</p>
73
+ <button onClick={handleConnect}>Connect</button>
74
+ </div>
75
+ );
76
+ }
77
+ ```
78
+
79
+ > All dApp Kit hooks must be used within components that are descendants of `DAppKitProvider`. Using
80
+ > them outside will result in an error.
81
+
82
+ ## Server-Side Rendering (SSR)
83
+
84
+ While `DAppKitProvider` itself is SSR-safe, components that interact with wallets should be
85
+ client-side rendered, as wallets are detected in the browser. For Next.js guide see
86
+ [here](/dapp-kit/getting-started/next-js).
@@ -0,0 +1,25 @@
1
+ # React Hooks
2
+
3
+ > React hooks for accessing dApp Kit state and actions
4
+
5
+ The `@mysten/dapp-kit-react` package provides a set of hooks for interacting with wallets and the
6
+ Sui blockchain in React applications.
7
+
8
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
9
+ > [DAppKitProvider](/dapp-kit/react/dapp-kit-provider). Using them outside will result in an error.
10
+
11
+ ## Available Hooks
12
+
13
+ - [`useDAppKit`](/dapp-kit/react/hooks/use-dapp-kit) - Access the dApp Kit instance for calling
14
+ actions directly
15
+ - [`useCurrentAccount`](/dapp-kit/react/hooks/use-current-account) - Get the currently selected
16
+ account
17
+ - [`useCurrentClient`](/dapp-kit/react/hooks/use-current-client) - Get the blockchain client for the
18
+ current network
19
+ - [`useCurrentNetwork`](/dapp-kit/react/hooks/use-current-network) - Get the currently selected
20
+ network
21
+ - [`useCurrentWallet`](/dapp-kit/react/hooks/use-current-wallet) - Get the currently connected
22
+ wallet
23
+ - [`useWalletConnection`](/dapp-kit/react/hooks/use-wallet-connection) - Get wallet connection
24
+ status and actions
25
+ - [`useWallets`](/dapp-kit/react/hooks/use-wallets) - Get all available wallets
@@ -0,0 +1,33 @@
1
+ # useCurrentAccount
2
+
3
+ > React hook to get the current wallet account
4
+
5
+ The `useCurrentAccount` hook provides access to the currently selected account.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const account = useCurrentAccount();
15
+
16
+ if (!account) {
17
+ return <div>No account selected</div>;
18
+ }
19
+
20
+ return (
21
+ <div>
22
+ <p>Address: {account.address}</p>
23
+ <p>Label: {account.label}</p>
24
+ </div>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Return Value
30
+
31
+ ```tsx
32
+ UiWalletAccount | null;
33
+ ```
@@ -0,0 +1,36 @@
1
+ # useCurrentClient
2
+
3
+ > React hook to get the current Sui client instance
4
+
5
+ The `useCurrentClient` hook provides access to the blockchain client instance for the current
6
+ network.
7
+
8
+ > **Note:** By default, this returns a `SuiClient` instance when using the standard setup. However,
9
+ > the dApp Kit supports any client that implements the Sui core API, making it flexible for
10
+ > different blockchain implementations.
11
+
12
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
13
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+
19
+ const client = useCurrentClient();
20
+
21
+ const handleQuery = async () => {
22
+ const balance = await client.getBalance({
23
+ owner: '0x...',
24
+ });
25
+ console.log(balance);
26
+ };
27
+
28
+ return <button onClick={handleQuery}>Check Balance</button>;
29
+ }
30
+ ```
31
+
32
+ ## Return Value
33
+
34
+ ```tsx
35
+ SuiClient;
36
+ ```
@@ -0,0 +1,28 @@
1
+ # useCurrentNetwork
2
+
3
+ > React hook to get the current network
4
+
5
+ The `useCurrentNetwork` hook provides access to the currently selected network.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const network = useCurrentNetwork();
15
+
16
+ return (
17
+ <div>
18
+ <p>Current network: {network}</p>
19
+ </div>
20
+ );
21
+ }
22
+ ```
23
+
24
+ ## Return Value
25
+
26
+ ```tsx
27
+ string;
28
+ ```
@@ -0,0 +1,36 @@
1
+ # useCurrentWallet
2
+
3
+ > React hook to get the current wallet connection
4
+
5
+ The `useCurrentWallet` hook provides access to the currently connected wallet.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const wallet = useCurrentWallet();
15
+
16
+ if (!wallet) {
17
+ return <div>No wallet connected</div>;
18
+ }
19
+
20
+ return (
21
+ <div>
22
+ <p>Wallet: {wallet.name}</p>
23
+ <p>
24
+ Icon: <img src={wallet.icon} alt={wallet.name} />
25
+ </p>
26
+ <p>Accounts: {wallet.accounts.length}</p>
27
+ </div>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ## Return Value
33
+
34
+ ```tsx
35
+ UiWallet | null;
36
+ ```
@@ -0,0 +1,100 @@
1
+ # useDAppKit
2
+
3
+ > React hook to access the full dApp Kit instance
4
+
5
+ The `useDAppKit` hook provides direct access to the dApp Kit instance within React components,
6
+ enabling you to call actions and access the underlying functionality.
7
+
8
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
9
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+
15
+ const dAppKit = useDAppKit();
16
+
17
+ async function handleConnect() {
18
+ try {
19
+ await dAppKit.connectWallet({ wallet });
20
+ console.log('Connected successfully');
21
+ } catch (error) {
22
+ console.error('Connection failed:', error);
23
+ }
24
+ }
25
+
26
+ return <button onClick={handleConnect}>Connect Wallet</button>;
27
+ }
28
+ ```
29
+
30
+ ## Return Value
31
+
32
+ ```ts
33
+ {
34
+ // Actions
35
+ connectWallet: (args: { wallet: UiWallet; account?: UiWalletAccount }) => Promise<{ accounts: UiWalletAccount[]; }>;
36
+ disconnectWallet: () => Promise<void>;
37
+ switchAccount: (args: { account: UiWalletAccount }) => Promise<void>;
38
+ switchNetwork: (network: string) => void;
39
+ signTransaction: (args: { transaction: Transaction | string; signal?: AbortSignal }) => Promise<SignedTransaction>;
40
+ signAndExecuteTransaction: (args: { transaction: Transaction | string; signal?: AbortSignal }) => Promise<TransactionResult>;
41
+ signPersonalMessage: (args: { message: Uint8Array }) => Promise<SignedPersonalMessage>;
42
+
43
+ // Properties
44
+ networks: string[];
45
+ stores: {
46
+ $wallets: DAppKitStores['$compatibleWallets'];
47
+ $connection: DAppKitStores['$connection'];
48
+ $currentNetwork: ReadableAtom<TNetworks[number]>;
49
+ $currentClient: ReadableAtom<Client>;
50
+ };
51
+ getClient: (network?: string) => Client;
52
+ }
53
+ ```
54
+
55
+ ## Examples
56
+
57
+ ### Transaction Execution
58
+
59
+ ```tsx
60
+
61
+ const dAppKit = useDAppKit();
62
+
63
+ async function handleTransfer() {
64
+ const tx = new Transaction();
65
+ tx.transferObjects([tx.object('0x123...')], '0xrecipient...');
66
+
67
+ try {
68
+ const result = await dAppKit.signAndExecuteTransaction({
69
+ transaction: tx,
70
+ });
71
+
72
+ if (result.FailedTransaction) {
73
+ throw new Error(`Transaction failed: ${result.FailedTransaction.status.error?.message}`);
74
+ }
75
+
76
+ console.log('Transaction digest:', result.Transaction.digest);
77
+ } catch (error) {
78
+ console.error('Transaction failed:', error);
79
+ }
80
+ }
81
+
82
+ return <button onClick={handleTransfer}>Transfer</button>;
83
+ }
84
+ ```
85
+
86
+ ### Subscribing to State Changes
87
+
88
+ ```tsx
89
+
90
+ const dAppKit = useDAppKit();
91
+ useEffect(() => {
92
+ // Subscribe directly to connection store changes
93
+ const unsubscribe = dAppKit.stores.$connection.subscribe((connection) => {
94
+ console.log('Connection status:', connection.status);
95
+ });
96
+ return unsubscribe;
97
+ }, [dAppKit]);
98
+ return null;
99
+ }
100
+ ```
@@ -0,0 +1,48 @@
1
+ # useWalletConnection
2
+
3
+ > React hook to manage wallet connection and disconnection
4
+
5
+ The `useWalletConnection` hook provides access to the current wallet connection status and
6
+ information.
7
+
8
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
9
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+
15
+ const connection = useWalletConnection();
16
+
17
+ if (connection.status === 'disconnected') {
18
+ return <div>Please connect your wallet</div>;
19
+ }
20
+
21
+ if (connection.status === 'connecting') {
22
+ return <div>Connecting...</div>;
23
+ }
24
+
25
+ // status === 'connected'
26
+ return (
27
+ <div>
28
+ <p>Connected to: {connection.wallet.name}</p>
29
+ <p>Address: {connection.account.address}</p>
30
+ </div>
31
+ );
32
+ }
33
+ ```
34
+
35
+ ## Return Value
36
+
37
+ ```tsx
38
+ {
39
+ status: 'disconnected' | 'connecting' | 'reconnecting' | 'connected';
40
+ wallet: UiWallet | null;
41
+ account: UiWalletAccount | null;
42
+ supportedIntents: string[];
43
+ isConnected: boolean;
44
+ isConnecting: boolean;
45
+ isReconnecting: boolean;
46
+ isDisconnected: boolean;
47
+ }
48
+ ```
@@ -0,0 +1,33 @@
1
+ # useWallets
2
+
3
+ > React hook to list available wallets
4
+
5
+ The `useWallets` hook provides access to all available wallets.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const wallets = useWallets();
15
+
16
+ return (
17
+ <div>
18
+ {wallets.map((wallet) => (
19
+ <div key={wallet.name}>
20
+ <img src={wallet.icon} alt={wallet.name} />
21
+ <span>{wallet.name}</span>
22
+ </div>
23
+ ))}
24
+ </div>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Return Value
30
+
31
+ ```tsx
32
+ UiWallet[]
33
+ ```
package/docs/state.md ADDED
@@ -0,0 +1,168 @@
1
+ # State
2
+
3
+ > Access and subscribe to wallet connection state in dApp Kit
4
+
5
+ The Sui dApp Kit SDK uses [nanostores](https://github.com/nanostores/nanostores) for state
6
+ management, providing a lightweight, framework-agnostic solution that works across React, Vue,
7
+ Vanilla JavaScript, and other frameworks.
8
+
9
+ ## Available Stores
10
+
11
+ The dApp Kit exposes four reactive stores that you can subscribe to:
12
+
13
+ - **`$connection`** - Current wallet connection state
14
+ - **`$currentNetwork`** - Currently selected network
15
+ - **`$currentClient`** - Client instance for the current network
16
+ - **`$wallets`** - List of available wallets
17
+
18
+ ## Accessing Stores
19
+
20
+ All stores are available through the `dAppKit.stores` property:
21
+
22
+ ```typescript
23
+ const dAppKit = createDAppKit({
24
+ /* config */
25
+ });
26
+
27
+ // Access stores
28
+ const connection = dAppKit.stores.$connection.get();
29
+ const currentNetwork = dAppKit.stores.$currentNetwork.get();
30
+ const client = dAppKit.stores.$currentClient.get();
31
+ const wallets = dAppKit.stores.$wallets.get();
32
+ ```
33
+
34
+ ## Subscribing to State Changes
35
+
36
+ Subscribe to any store to react to state changes:
37
+
38
+ ```typescript
39
+ // Subscribe to connection changes
40
+ const unsubscribe = dAppKit.stores.$connection.subscribe((connection) => {
41
+ if (connection.isConnected && connection.wallet && connection.account) {
42
+ console.log('Connected to:', connection.wallet.name);
43
+ console.log('Account:', connection.account.address);
44
+ } else {
45
+ console.log('Not connected');
46
+ }
47
+ });
48
+
49
+ // Clean up subscription when done
50
+ unsubscribe();
51
+ ```
52
+
53
+ ## Store Details
54
+
55
+ ### Connection Store (`$connection`)
56
+
57
+ Contains the current wallet connection state with status flags:
58
+
59
+ ```typescript
60
+ const connection = dAppKit.stores.$connection.get();
61
+
62
+ // Connection has these properties:
63
+ // - wallet: UiWallet | null
64
+ // - account: UiWalletAccount | null
65
+ // - status: 'connected' | 'connecting' | 'reconnecting' | 'disconnected'
66
+ // - supportedIntents: string[]
67
+ // - isConnected: boolean
68
+ // - isConnecting: boolean
69
+ // - isReconnecting: boolean
70
+ // - isDisconnected: boolean
71
+ ```
72
+
73
+ Example usage:
74
+
75
+ ```typescript
76
+ const connection = dAppKit.stores.$connection.get();
77
+
78
+ if (connection.isConnected && connection.wallet && connection.account) {
79
+ console.log('Address:', connection.account.address);
80
+ console.log('Wallet:', connection.wallet.name);
81
+ console.log('Available accounts:', connection.wallet.accounts);
82
+ }
83
+ ```
84
+
85
+ ### Current Network Store (`$currentNetwork`)
86
+
87
+ Contains the currently selected network as a string:
88
+
89
+ ```typescript
90
+ const currentNetwork = dAppKit.stores.$currentNetwork.get(); // 'mainnet' | 'testnet' | ...
91
+
92
+ // Subscribe to network changes
93
+ dAppKit.stores.$currentNetwork.subscribe((network) => {
94
+ console.log('Switched to network:', network);
95
+ });
96
+ ```
97
+
98
+ Note: This store is read-only. Use `dAppKit.switchNetwork()` to change networks.
99
+
100
+ ### Current Client Store (`$currentClient`)
101
+
102
+ Contains the SuiClient instance for the current network:
103
+
104
+ ```typescript
105
+ const client = dAppKit.stores.$currentClient.get();
106
+
107
+ // Use the client to query the blockchain
108
+ const balance = await client.getBalance({
109
+ owner: '0x...',
110
+ });
111
+ ```
112
+
113
+ Note: This store automatically updates when the network changes.
114
+
115
+ ### Wallets Store (`$wallets`)
116
+
117
+ Contains the list of available wallets:
118
+
119
+ ```typescript
120
+ const wallets = dAppKit.stores.$wallets.get();
121
+
122
+ wallets.forEach((wallet) => {
123
+ console.log('Wallet:', wallet.name);
124
+ console.log('Icon:', wallet.icon);
125
+ });
126
+ ```
127
+
128
+ ## Subscribing to State Changes
129
+
130
+ You can subscribe directly to stores:
131
+
132
+ ```typescript
133
+ // Subscribe to connection changes
134
+ dAppKit.stores.$connection.subscribe((connection) => {
135
+ const statusElement = document.getElementById('connection-status');
136
+ if (statusElement === null) return;
137
+ if (connection.isConnected && connection.account) {
138
+ statusElement.textContent = `Connected: ${connection.account.address}`;
139
+ } else {
140
+ statusElement.textContent = 'Not connected';
141
+ }
142
+ });
143
+
144
+ // Subscribe to network changes
145
+ dAppKit.stores.$currentNetwork.subscribe((network) => {
146
+ const networkElement = document.getElementById('current-network');
147
+ if (networkElement === null) return;
148
+ networkElement.textContent = `Network: ${network}`;
149
+ });
150
+ ```
151
+
152
+ ## React
153
+
154
+ React users can use the [provided hooks](./react/hooks/use-wallet-connection) instead of direct
155
+ store access.
156
+
157
+ ## Properties
158
+
159
+ Besides stores, some values are available as direct properties:
160
+
161
+ ```typescript
162
+ // Get available networks (not a store, just a property)
163
+ const networks = dAppKit.networks; // ['mainnet', 'testnet', ...]
164
+
165
+ // Get client for specific network
166
+ const mainnetClient = dAppKit.getClient('mainnet');
167
+ const currentClient = dAppKit.getClient(); // Current network's client
168
+ ```