-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SDK+UI+REACT-UI+PROTOCOL]: Improve network support in TC2 #32
Comments
Hi @shaharyakir , thanks for your suggestion! If I got you right, there is no big difference for dApp where to declare/check chain_id. In the current protocol implementation dApp should check chain_id like this
Your suggestion:
Thus, in both cases, the dApp needs to explicitly declare the required chain. That's why I think the suggestion won't make a valuable improvement. |
Consider that a dapp will never want to receive a mainnet connection when it was looking for testnet, so having TonConnect throw an error in that case is valuable on its own. Second, passing the chain id to the constructor is easier and more explicit in its intent than listening. Third, passing the chain id via the bridge lets the wallet handle this case and prompt the user to change networks in the wallet. All these remove unnecessary burden from the dapp developers. We have a handful of wallets and only one TC2 spec, but there would be hundreds or thousands of dapps. And if we don't implement this, at least some dapps are bound to make the mistake of not handling these nuances correctly ( + the duplicated effort of doing so). |
In the current model, the wallet simply tells the dapp which accounts the user has. In the future, this will allow us to make a convenient system for changing accounts in the dapp. SDK will automatically add account and network information to action requests. Therefore, the suggestion to specify the network in the connection does not seem necessary to us. |
Improve network support in TC2
Current state
Upon connection, TC2 reports back the network ID.
However, the user could be using a dapp that "thinks" it's in testnet mode, not paying attention that the wallet reported back is actually connected to a mainnet wallet.
This is a source for UX confusion, and a boilerplate effort for dapp owners to handle network mismatches.
In this example, the dapp could easily ignore the network mismatch.
Proposed solution
The text was updated successfully, but these errors were encountered: