Skip to content

Commit

Permalink
added twaReturnUrl case
Browse files Browse the repository at this point in the history
  • Loading branch information
SwiftAdviser committed Sep 21, 2023
1 parent 27a0462 commit d199a5b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
18 changes: 17 additions & 1 deletion docs/develop/dapps/ton-connect/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,23 @@ Moreover, you always can initiate the connection manually, using `useTonConnectU

### 4) Redirects

Usually, you don't need to think about it at all. But if you want to redirect user to a specific page after wallet connection, you can use `useTonConnectUI` hook and [customize your return strategy](https://github.com/ton-connect/sdk/tree/main/packages/ui#add-the-return-strategy).
If you want to redirect user to a specific page after wallet connection, you can use `useTonConnectUI` hook and [customize your return strategy](https://github.com/ton-connect/sdk/tree/main/packages/ui#add-the-return-strategy).

#### Telegram Mini Apps

If you want to redirect user to a [Telegram Mini App](/develop/dapps/telegram-apps/) after wallet connection, you can customize the `TonConnectUIProvider` element:

```tsx
<TonConnectUIProvider
// ... other parameters
actionsConfiguration={{
twaReturnUrl: 'https://t.me/<YOUR_APP_NAME>?start=<YOUR_START_PARAMETER>'
}}
>
</TonConnectUIProvider>
```

[Open example on GitHub](https://github.com/ton-connect/demo-dapp-with-wallet/blob/master/src/App.tsx)

### 5) UI customization

Expand Down
16 changes: 15 additions & 1 deletion docs/develop/dapps/ton-connect/web.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,21 @@ But you can open "connect modal" programmatically, e.g. after click on custom bu

### 4) Redirects

Usually, you don't need to think about it at all. But if you want to redirect user to a specific page after wallet connection, you can [customize your return strategy](https://github.com/ton-connect/sdk/tree/main/packages/ui#add-the-return-strategy).
#### Customizing return strategy

To redirect user to a specific URL after connection, you can [customize your return strategy](https://github.com/ton-connect/sdk/tree/main/packages/ui#add-the-return-strategy).

#### Telegram Mini Apps

To redirect user to a [Telegram Mini App](/develop/dapps/telegram-apps/) after wallet connection use `twaReturnUrl` option:

```tsx
tonConnectUI.uiOptions = {
twaReturnUrl: 'https://t.me/durov'
};
```

[Read more in SDK documentation](https://github.com/ton-connect/sdk/tree/main/packages/ui#use-inside-twa-telegram-web-app)

### 5) UI customization

Expand Down

0 comments on commit d199a5b

Please sign in to comment.