@tonconnect/ui 2.0.0 → 2.0.1-beta.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.
- package/README.md +34 -0
- package/dist/tonconnect-ui.min.js +190 -190
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +261 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +64 -0
- package/lib/index.mjs +261 -9
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -167,6 +167,40 @@ unsubscribe();
|
|
|
167
167
|
|
|
168
168
|
While `tonConnectUI` internally delegates these calls to the `modal`, it is recommended to use the `tonConnectUI` methods for a more straightforward and consistent experience. The `modal` is exposed in case you need direct access to the modal window's state and behavior, but this should generally be avoided unless necessary.
|
|
169
169
|
|
|
170
|
+
## Open specific wallet
|
|
171
|
+
|
|
172
|
+
> The methods described in this section are marked as experimental and are subject to change in future releases.
|
|
173
|
+
|
|
174
|
+
To open a modal window for a specific wallet, use the `openSingleWalletModal()` method. This method accepts the wallet `app_name` as a parameter (please refer to the [wallets-list.json](https://github.com/ton-blockchain/wallets-list/blob/main/wallets-v2.json)) and opens the corresponding wallet modal. It returns a promise that resolves after the modal window is successfully opened.
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
await tonConnectUI.openSingleWalletModal('wallet_identifier');
|
|
178
|
+
````
|
|
179
|
+
|
|
180
|
+
To close the currently open specific wallet modal, use the `closeSingleWalletModal()` method:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
tonConnectUI.closeSingleWalletModal();
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
To subscribe to the state changes of the specific wallet modal, use the `onSingleWalletModalStateChange((state) => {})` method. It accepts a callback function that will be called with the current modal state.
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
const unsubscribe = tonConnectUI.onSingleWalletModalStateChange((state) => {
|
|
190
|
+
console.log('Modal state changed:', state);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Call `unsubscribe` when you want to stop listening to the state changes
|
|
194
|
+
unsubscribe();
|
|
195
|
+
````
|
|
196
|
+
|
|
197
|
+
To get the current state of the specific wallet modal window, use the `singleWalletModalState` property:
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
const currentState = tonConnectUI.singleWalletModalState;
|
|
201
|
+
console.log('Current modal state:', currentState);
|
|
202
|
+
```
|
|
203
|
+
|
|
170
204
|
## Get current connected Wallet and WalletInfo
|
|
171
205
|
You can use special getters to read current connection state. Note that this getter only represents current value, so they are not reactive.
|
|
172
206
|
To react and handle wallet changes use `onStatusChange` method.
|