@tonconnect/ui 2.3.1 → 2.4.0-beta.1
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 +39 -0
- package/dist/tonconnect-ui.min.js +239 -239
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +400 -85
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +17 -11
- package/lib/index.mjs +401 -86
- package/lib/index.mjs.map +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -317,6 +317,18 @@ try {
|
|
|
317
317
|
}
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
+
### Trace ID for analytics
|
|
321
|
+
|
|
322
|
+
You can pass a custom trace ID to track the transaction through your analytics:
|
|
323
|
+
|
|
324
|
+
```ts
|
|
325
|
+
const result = await tonConnectUI.sendTransaction(transaction, {
|
|
326
|
+
traceId: '019a2a92-a884-7cfc-b1bc-caab18644b6f' // optional, UUIDv7 auto-generated if not provided
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
console.log(result.traceId); // use this ID to correlate with analytics events
|
|
330
|
+
```
|
|
331
|
+
|
|
320
332
|
`sendTransaction` will automatically render informational modals and notifications. You can change its behaviour:
|
|
321
333
|
|
|
322
334
|
```ts
|
|
@@ -382,6 +394,16 @@ try {
|
|
|
382
394
|
}
|
|
383
395
|
```
|
|
384
396
|
|
|
397
|
+
You can also pass a trace ID to correlate with analytics:
|
|
398
|
+
|
|
399
|
+
```ts
|
|
400
|
+
const result = await tonConnectUI.signData(textData, {
|
|
401
|
+
traceId: '019a2a92-a884-7cfc-b1bc-caab18644b6f' // optional, UUIDv7 auto-generated if not provided
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
console.log(result.traceId); // use this ID to correlate with analytics events
|
|
405
|
+
```
|
|
406
|
+
|
|
385
407
|
#### Binary Format
|
|
386
408
|
|
|
387
409
|
Use for arbitrary binary data. The wallet shows a warning about unknown content.
|
|
@@ -922,6 +944,23 @@ tonConnectUI.onStatusChange(wallet => {
|
|
|
922
944
|
});
|
|
923
945
|
```
|
|
924
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.
|
|
925
964
|
|
|
926
965
|
# Tracking
|
|
927
966
|
|