TON
Integrating
Detecting the Provider
MathWallet will inject an object called ton
on the window object of any web application the user visits.
To detect if a browser extension using this API is installed, you can check for the existence of the ton
object.
To make it easy to detect MathWallet specifically, the extension adds an additional isMathWallet
flag.
const isMathWalletInstalled = window.ton && window.ton.isMathWallet
or
const isMathWalletInstalled = window.openmask.provider && window.openmask.provider.isMathWallet
If MathWallet is not installed, we recommend you redirect your users to our website. Altogether, this may look like the following.
Workflows.
- App checks existing of the
window.openmask.tonconnect
- App calls
window.openmask.tonconnect.connect()
and waits for a response - Wallet sends account information to the app;
Dapp Developer Guide
https://github.com/ton-blockchain/ton-connect/blob/main/bridge.md#js-bridge
More Resources
https://github.com/ton-blockchain/ton-connect/blob/main/requests-responses.md#methods