@tonconnect/ui 2.4.0-beta.0 → 2.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/tonconnect-ui.min.js +239 -239
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +127 -16
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +12 -3
- package/lib/index.mjs +128 -17
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -944,6 +944,23 @@ tonConnectUI.onStatusChange(wallet => {
|
|
|
944
944
|
});
|
|
945
945
|
```
|
|
946
946
|
|
|
947
|
+
## Network selection
|
|
948
|
+
|
|
949
|
+
You can specify the desired network before connecting to a wallet using the `setConnectionNetwork()` method. If the wallet connects to a different network, the connection will be aborted with a `WalletWrongNetworkError`.
|
|
950
|
+
|
|
951
|
+
```ts
|
|
952
|
+
import { CHAIN } from '@tonconnect/ui';
|
|
953
|
+
|
|
954
|
+
// Set desired network before connecting
|
|
955
|
+
tonConnectUI.setConnectionNetwork(CHAIN.MAINNET); // or CHAIN.TESTNET, or any custom chainId string
|
|
956
|
+
|
|
957
|
+
// Allow any network (default behavior)
|
|
958
|
+
tonConnectUI.setConnectionNetwork(undefined);
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
**Important:**
|
|
962
|
+
- Network must be set before calling `connectWallet()` or opening the wallet selection modal. Attempting to change network while connected will throw an error.
|
|
963
|
+
- Network validation is also performed for `sendTransaction` and `signData` operations if a network was specified.
|
|
947
964
|
|
|
948
965
|
# Tracking
|
|
949
966
|
|