You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> See methods and migration notes in the [`@stacks/connect` documentation](./packages/connect).
7
+
Head over to the [`@stacks/connect` README](https://github.com/hirosystems/connect/tree/main/packages/connect).
14
8
15
9
---
16
10
17
-
## ⚡️ Installation
18
-
19
-
Use your favorite package manager to install `@stacks/connect` in your project.
20
-
Follow the **Getting Started** section of the [`@stacks/connect` README](https://github.com/hirosystems/connect/tree/main/packages/connect).
21
-
22
-
> Or use one of our starter-templates to bootstrap a fresh project already including connect using the [command-line](https://github.com/hirosystems/stacks.js-starters) locally via `npm create stacks`
11
+
## Development Notes
23
12
24
-
##📦 Packages
13
+
###Packages
25
14
26
15
This repository includes three packages:
27
16
28
17
-[`@stacks/connect`](./packages/connect): The one-stop-shop tool for letting web-apps interact with Stacks web wallets.
29
18
-[`@stacks/connect-ui`](./packages/connect-ui): A web-component UI for displaying an intro modal in Stacks web-apps during authentication _(used in the background by `@stacks/connect`)_.
30
19
-~~[`@stacks/connect-react`](./packages/connect-react): A wrapper library for making `@stacks/connect` use in React even easier~~
31
20
32
-
##🛠️ Wallet Implementation Guide
21
+
###Wallet Implementation Guide
33
22
34
23
Wallets implement a "Provider" interface.
35
24
The latest spec uses a simple JS Object exposing a `.request(method: string, params?: object)` method.
- You may need to manually reload a component to see local storage updates.
71
74
- No custom hooks are needed to use Stacks Connect anymore.
72
75
- We are working on a new `@stacks/react` package that will make usage even easier in the future (e.g. tracking transaction status, reloading components when a connection is established, updating the page when the network changes, and more).
Previously, the `UserSession` class was used to access the user's addresses and data, which abstracted away the underlying implementation details.
77
80
Now, the `request` method is used to directly interact with the wallet, giving developers more explicit control and clarity over what's happening under the hood.
78
81
This manual approach makes the wallet interaction more transparent and customizable.
79
-
Developer can manually manage the currently connected user's address in e.g. local storage, jotai, etc. or use the `connect()` method to cache the address in local storage.
82
+
Developer can manually manage the currently connected user's address in e.g. local storage, jotai, etc. or use the `connect()`/`request()` method to cache the address in local storage.
80
83
81
84
> [!IMPORTANT]
82
85
> For security reasons, the `8.x.x` release only returns the current network's address (where previously both mainnet and testnet addresses were returned).
The `request` method returns a Promise, allowing you to handle errors using standard Promise-based error handling patterns. You can use either `try/catch` with `async/await` or the `.catch()` method with Promise chains.
> For example, it handles converting numeric types between string and number formats as needed by different wallets, and remaps certain method names to match wallet-specific implementations.
364
424
> This ensures consistent behavior across different wallet providers without requiring manual adjustments.
365
425
426
+
> The `approvedProviderIds` option allows you to filter which wallet providers are shown in the connect modal.
427
+
> This is useful when you want to limit the available wallet options to specific providers.
428
+
> For example, you might only want to support Leather wallet:
0 commit comments