Skip to content

Commit

Permalink
many-many-many TC docs fixes!
Browse files Browse the repository at this point in the history
  • Loading branch information
SwiftAdviser committed Aug 13, 2023
1 parent 69667b2 commit b2630ec
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 215 deletions.
30 changes: 2 additions & 28 deletions docs/develop/dapps/ton-connect/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,15 @@ TON Connect is a communication protocol between **wallets** and **apps** in TON.
/>
<br></br>

## Bird's eye view

**Apps** built on TON provide rich functionality and high performance and are designed to protect user funds via smart contracts. Because apps are built using decentralized technologies such as Blockchain, they are typically called decentralized applications (dApps).

**Wallets** provide the UI to approving transactions and hold users’ cryptographic keys securely on their personal devices.
This separation of concerns enables rapid innovation and high level of security for the users: wallets do not need to build walled-garden ecosystems themselves, while the apps do not need to take the risk holding end users’ accounts.

TON Connect aims to offer a seamless user experience between wallets and apps.

Feel free to use one of the following flows for integration of your application:

<Button href="/develop/dapps/ton-connect/twa" colorType={'primary'} sizeType={'sm'}>Telegram Web Apps</Button>
<Button href="/develop/dapps/ton-connect/web"
colorType="secondary" sizeType={'sm'}>
Websites
</Button>
<Button href="/develop/dapps/ton-connect/mobile"
colorType="secondary" sizeType={'sm'}>
Mobile Apps
</Button>
<Button href="/develop/dapps/ton-connect/tg-bot-integration"
colorType="secondary" sizeType={'sm'}>
Telegram Bots
</Button>

## Connect a Wallet

If you are a wallet developer, you can connect your wallet to TON Connect and enable your users to interact with TON apps in a secure and convenient way.

Use the following steps to connect your wallet to TON Connect:

1. Read carefully [Protocol specifications](/develop/dapps/ton-connect/protocol/).
2. Implement the protocol using one of the [SDKs](/develop/dapps/ton-connect/developers).
3. Add your wallet to the [wallets-list](https://github.com/ton-blockchain/wallets-list) with a pull request.

<Button href="/develop/dapps/ton-connect/protocol/" colorType={'primary'} sizeType={'sm'}>Start Integration</Button>

## See also

- [TON Connect for Business](/develop/dapps/ton-connect/business)
Expand Down
39 changes: 39 additions & 0 deletions docs/develop/dapps/ton-connect/manifest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

# Creating manifest.json

Every app needs to have its manifest to pass meta information to the wallet. Manifest is a JSON file named as `tonconnect-manifest.json` following format:

```json
{
"url": "<app-url>", // required
"name": "<app-name>", // required
"iconUrl": "<app-icon-url>", // required
"termsOfUseUrl": "<terms-of-use-url>", // optional
"privacyPolicyUrl": "<privacy-policy-url>" // optional
}
```

## Example

You can find an example of the manifest below:

```json
{
"url": "https://ton.vote",
"name": "TON Vote",
"iconUrl": "https://ton.vote/logo.png"
}
```
## Best practices

- Best practice is to place the manifest in the root of your app and repository, e.g. `https://myapp.com/tonconnect-manifest.json`. It allows the wallet to handle your app better and improve the UX connected to your app.
- Make sure that `manifest.json` file is available to GET by its URL.

## Fields description
|Field|Requirement|Description|
|---|---|---|
|`url` |required| app URL. Will be used as the dapp identifier. Will be used to open the dapp after click to its icon in the wallet. It is recommended to pass url without closing slash, e.g. 'https://mydapp.com' instead of 'https://mydapp.com/'.|
| `name`|required| app name. Might be simple, will not be used as identifier.|
| `iconUrl`| required | Url to the app icon. Must be PNG, ICO, ... format. SVG icons are not supported. Perfectly pass url to a 180x180px PNG icon.|
| `termsOfUseUrl` |optional| url to the Terms Of Use document. Optional for usual apps, but required for the apps which is placed in the Tonkeeper recommended apps list.|
| `privacyPolicyUrl` | optional | url to the Privacy Policy document. Optional for usual apps, but required for the apps which is placed in the Tonkeeper recommended apps list.|
8 changes: 4 additions & 4 deletions docs/develop/dapps/ton-connect/message-builders.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ export const Settings = () => {
<TabItem value="tonconnect-ui" label="@tonconnect/ui">

```js
import TonConnect from '@tonconnect/ui';
import TonConnectUI from '@tonconnect/ui';

const tonConnectUI = new TonConnectUI({ //connect application
manifestUrl: 'https://<YOUR_APP_URL>/tonconnect-manifest.json',
buttonRootId: '<YOUR_CONNECT_BUTTON_ANCHOR_ID>'
});

transaction = {
const transaction = {
//transaction body
}

Expand Down Expand Up @@ -120,14 +120,14 @@ export const Settings = () => {
<TabItem value="tonconnect-ui" label="@tonconnect/ui">

```js
import TonConnect from '@tonconnect/ui';
import TonConnectUI from '@tonconnect/ui';

const tonConnectUI = new TonConnectUI({ //connect application
manifestUrl: 'https://<YOUR_APP_URL>/tonconnect-manifest.json',
buttonRootId: '<YOUR_CONNECT_BUTTON_ANCHOR_ID>'
});

transaction = {
const transaction = {
messages: [
{
address: "0:412410771DA82CBA306A55FA9E0D43C9D245E38133CB58F1457DFB8D5CD8892F", // destination address
Expand Down
2 changes: 0 additions & 2 deletions docs/develop/dapps/ton-connect/mobile.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# TON Connect for Mobiles with the React Native

TODO: add description with TON Connect React UI SDK
19 changes: 7 additions & 12 deletions docs/develop/dapps/ton-connect/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Button from '@site/src/components/button'

# Integrate with Wallets
# About TON Connect

Experience seamless connectivity with wallets within [TON](/learn/introduction) using TON Connect.

Expand All @@ -11,17 +11,16 @@ Feel free to use one of the following flows for integration of your application:
<Button href="/develop/dapps/ton-connect/twa" colorType={'primary'} sizeType={'sm'}>Telegram Web Apps</Button>
<Button href="/develop/dapps/ton-connect/web"
colorType="secondary" sizeType={'sm'}>
Websites
</Button>
<Button href="/develop/dapps/ton-connect/mobile"
colorType="secondary" sizeType={'sm'}>
Mobile Apps
HTML/JS Web Apps
</Button>
<Button href="/develop/dapps/ton-connect/tg-bot-integration"
colorType="secondary" sizeType={'sm'}>
Telegram Bots
</Button>

## For Wallet Developers

If you are a wallet developer, please read how to [integrate TON Connect into your wallet](/develop/dapps/ton-connect/wallet/).

## Use Cases For Your DApp

Expand Down Expand Up @@ -87,10 +86,6 @@ Explore these deliverables that the TON Ecosystem provides for superior DApp int
## Join the TON Ecosystem
To connect your service with the TON Ecosystem, you need to implement the following:

- **TON Connect**. Incorporate the TON Connect protocol within your application. Get started with our detailed [TON Connect integration guide](/develop/dapps/ton-connect).
- **Transaction Messages**. Create specified transaction messages using TON libraries. Dive into the process of [sending messages](/develop/smart-contracts/messages) with our comprehensive guide. _TODO: fix with sending messages examples for web developers._
- **TON Connect**. Incorporate the TON Connect protocol within your application.
- **Transactions**. Create specified transaction messages using TON libraries. Dive into the process of [sending messages](/develop/dapps/ton-connect/message-builders) with our comprehensive guide.
- **Payments**. Process payments via the public API ([tonapi](https://tonapi.io/)) or your own indexer, for instance, [gobycicle](http://github.com/gobicycle/bicycle). Learn more from our extensive guide on [asset processing](/develop/dapps/asset-processing).

:::info
Remember, not all apps necessitate payment processing. If your service's business logic doesn't require it, there's no need to support this feature.
:::
6 changes: 3 additions & 3 deletions docs/develop/dapps/ton-connect/protocol/requests-responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ The signature must be verified by public key:
2. If the smart contract is not deployed yet, or the get-method is missing, you need:
2.1. Parse `TonAddressItemReply.walletStateInit` and get public key from stateInit. You can compare the `walletStateInit.code` with the code of standard wallets contracts and parse the data according to the found wallet version.
1. Parse `TonAddressItemReply.walletStateInit` and get public key from stateInit. You can compare the `walletStateInit.code` with the code of standard wallets contracts and parse the data according to the found wallet version.
2.2. Check that `TonAddressItemReply.publicKey` equals to obtained public key
2. Check that `TonAddressItemReply.publicKey` equals to obtained public key
2.3. Check that `TonAddressItemReply.walletStateInit.hash()` equals to `TonAddressItemReply.address`. `.hash()` means BoC hash.
3. Check that `TonAddressItemReply.walletStateInit.hash()` equals to `TonAddressItemReply.address`. `.hash()` means BoC hash.
## Messages
Expand Down
11 changes: 3 additions & 8 deletions docs/develop/dapps/ton-connect/protocol/wallet-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ To switch account user need to disconnect (Log out) and connect (Login) again i

We recommend wallets provide the ability to disconnect session with a specified dapp because the dapp may have an incomplete UI.


## References

* /develop/dapps/ton-connect/protocol/wallet-guidelines

## See Also

* [Ton Connect Overview](/dapps/ton-connect/)
* [Integration manual](/develop/dapps/ton-connect/integration)
* [Telegram bot integration manual](/develop/dapps/ton-connect/tg-bot-integration)
* [TON Connect Overview](/dapps/ton-connect/overview)
* [Protocol specifications](/dapps/ton-connect/protocol/)
* [Connect a Wallet](/dapps/ton-connect/wallet)
6 changes: 3 additions & 3 deletions docs/develop/dapps/ton-connect/sign.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ The signature must be verified by public key:

2. If the smart contract is not deployed yet, or the get-method is missing, you need:

2.1. Parse `TonAddressItemReply.walletStateInit` and get public key from stateInit. You can compare the `walletStateInit.code` with the code of standard wallets contracts and parse the data according to the found wallet version.
1. Parse `TonAddressItemReply.walletStateInit` and get public key from stateInit. You can compare the `walletStateInit.code` with the code of standard wallets contracts and parse the data according to the found wallet version.

2.2. Check that `TonAddressItemReply.publicKey` equals to obtained public key
2. Check that `TonAddressItemReply.publicKey` equals to obtained public key

2.3. Check that `TonAddressItemReply.walletStateInit.hash()` equals to `TonAddressItemReply.address`. `.hash()` means BoC hash.
3. Check that `TonAddressItemReply.walletStateInit.hash()` equals to `TonAddressItemReply.address`. `.hash()` means BoC hash.


### Examples of TON Proof Verification
Expand Down
Loading

0 comments on commit b2630ec

Please sign in to comment.