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
Moreover, you always can initiate the connection manually, using `useTonConnectUI` hook and [connectWallet](https://github.com/ton-connect/sdk/tree/main/packages/ui#call-connect) method.
56
+
Moreover, you always can initiate the connection manually, using `useTonConnectUI` hook and `openModal` method (❗ Note that `connectWallet` method is deprecated ❗).
@@ -85,50 +107,53 @@ If you want to use some low-level TON Connect UI SDK features in your React app,
85
107
86
108
### useTonAddress
87
109
88
-
Use it to get user's current ton wallet address. Pass boolean parameter isUserFriendlyto choose format of the address. If wallet is not connectedhook will return empty string.
110
+
Use it to get user's current ton wallet address. Pass the boolean parameter `isUserFriendly` (default is `true`) to choose the format of the address. If the wallet is not connected, the hook will return an empty string.
- Get more examples here: [Preparing Messages](/develop/dapps/ton-connect/message-builders)
@@ -232,91 +253,78 @@ The principle located in Payment Processing (using tonweb). [See more](/develop/
232
253
Understand how to sign and verify messages: [Signing and Verification](/develop/dapps/ton-connect/sign)
233
254
:::
234
255
235
-
Use `tonConnectUI.setConnectRequestParameters` function to pass your connect request parameters.
236
-
237
-
This function takes one parameter:
238
-
239
-
Set state to 'loading' while you are waiting for the response from your backend. If user opens connect wallet modal at this moment, he will see a loader.
240
-
```ts
241
-
const [tonConnectUI] =useTonConnectUI();
242
-
243
-
tonConnectUI.setConnectRequestParameters({
244
-
state: 'loading'
245
-
});
246
-
```
256
+
To ensure that the user truly owns the declared address, you can use `ton_proof`.
247
257
248
-
or
258
+
Use the `tonConnectUI.setConnectRequestParameters` function to set up your connection request parameters. You can use it for:
259
+
- Loading State: Show a loading state while waiting for a response from your backend.
260
+
- Ready State with tonProof: Set the state to 'ready' and include the tonProof value.
261
+
- If an error occurs, remove the loader and create the connect request without additional parameters.
249
262
250
-
Set state to 'ready' and define `tonProof` value. Passed parameter will be applied to the connect request (QR and universal link).
Remove loader if it was enabled via `state: 'loading'` (e.g. you received an error instead of a response from your backend). Connect request will be created without any additional parameters.
265
-
```ts
266
-
const [tonConnectUI] =useTonConnectUI();
267
-
268
-
tonConnectUI.setConnectRequestParameters(null);
273
+
if (tonProofPayload) {
274
+
// Set ready state with tonProof
275
+
tonConnectUI.setConnectRequestParameters({
276
+
state: "ready",
277
+
value: { tonProof: tonProofPayload },
278
+
});
279
+
} else {
280
+
// Remove loader
281
+
tonConnectUI.setConnectRequestParameters(null);
282
+
}
269
283
```
270
284
285
+
#### Handling ton_proof Result
271
286
272
-
You can call `tonConnectUI.setConnectRequestParameters` multiple times if your tonProof payload has bounded lifetime (e.g. you can refresh connect request parameters every 10 minutes).
273
-
287
+
You can find `ton_proof` result in the `wallet` object when the wallet is connected:
0 commit comments