@dynamic-labs/ton 4.61.1 → 4.61.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/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ ### [4.61.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.1...v4.61.2) (2026-02-12)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * export wallet password hook ([#10433](https://github.com/dynamic-labs/dynamic-auth/issues/10433)) ([dd6170e](https://github.com/dynamic-labs/dynamic-auth/commit/dd6170ec42a863b33baea92f9716083e3c4941d0))
8
+ * only prompt braavos wallet once to connect ([#10405](https://github.com/dynamic-labs/dynamic-auth/issues/10405)) ([2aff336](https://github.com/dynamic-labs/dynamic-auth/commit/2aff336a6222404b7907be65ef9af6806c357a07))
9
+ * remove signedSessionId from validateActiveWallet ([#10422](https://github.com/dynamic-labs/dynamic-auth/issues/10422)) ([700a953](https://github.com/dynamic-labs/dynamic-auth/commit/700a95383c8754f1cc0c87f53c50d04b57ef1b52))
10
+ * ton wallets not showing download links ([#10421](https://github.com/dynamic-labs/dynamic-auth/issues/10421)) ([cc8a8f8](https://github.com/dynamic-labs/dynamic-auth/commit/cc8a8f82485e4cc94aacd63d2e6a1bd8ca291f9c))
11
+
2
12
  ### [4.61.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.0...v4.61.1) (2026-02-11)
3
13
 
4
14
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.61.1";
6
+ var version = "4.61.2";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.61.1";
2
+ var version = "4.61.2";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ton",
3
- "version": "4.61.1",
3
+ "version": "4.61.2",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,14 +18,14 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/assert-package-version": "4.61.1",
22
- "@dynamic-labs/logger": "4.61.1",
21
+ "@dynamic-labs/assert-package-version": "4.61.2",
22
+ "@dynamic-labs/logger": "4.61.2",
23
23
  "@dynamic-labs/sdk-api-core": "0.0.864",
24
- "@dynamic-labs/types": "4.61.1",
25
- "@dynamic-labs/utils": "4.61.1",
26
- "@dynamic-labs/waas": "4.61.1",
27
- "@dynamic-labs/wallet-book": "4.61.1",
28
- "@dynamic-labs/wallet-connector-core": "4.61.1",
24
+ "@dynamic-labs/types": "4.61.2",
25
+ "@dynamic-labs/utils": "4.61.2",
26
+ "@dynamic-labs/waas": "4.61.2",
27
+ "@dynamic-labs/wallet-book": "4.61.2",
28
+ "@dynamic-labs/wallet-connector-core": "4.61.2",
29
29
  "@ton/core": "0.62.0",
30
30
  "@ton/crypto": "3.3.0",
31
31
  "@ton/ton": "16.0.0",
@@ -56,9 +56,10 @@ class TonConnectConnector extends walletConnectorCore.WalletConnectorBase {
56
56
  this.overrideKey = 'tonconnect';
57
57
  this.connectedChain = 'TON';
58
58
  this.supportedChains = ['TON'];
59
- this.canConnectViaQrCode = true;
59
+ this.canConnectViaQrCode = false;
60
60
  this.connectedWallet = null;
61
61
  this.pendingProofPayload = null;
62
+ this.lastConnectionUrl = null;
62
63
  this.tonNetworks = opts.tonNetworks || [];
63
64
  this.overrideKey = opts.overrideKey || 'tonconnect';
64
65
  // Only initialize TonConnect in browser environment
@@ -109,12 +110,21 @@ class TonConnectConnector extends walletConnectorCore.WalletConnectorBase {
109
110
  });
110
111
  }
111
112
  /**
112
- * Check if TON Connect is available
113
+ * Check if the wallet's browser extension is installed
113
114
  */
114
115
  isInstalledOnBrowser() {
115
- // TON Connect wallets are mobile apps, not browser extensions
116
- // Return false so they show as QR code/deep link wallets
117
- return false;
116
+ if (typeof window === 'undefined') {
117
+ return false;
118
+ }
119
+ return sdk.TonConnect.isWalletInjected(this.overrideKey);
120
+ }
121
+ /**
122
+ * Retry opening the wallet deep link on mobile
123
+ */
124
+ retryDeeplinkConnection() {
125
+ if (this.lastConnectionUrl) {
126
+ utils.PlatformService.openURL(this.lastConnectionUrl);
127
+ }
118
128
  }
119
129
  /**
120
130
  * Connect to a TON wallet
@@ -143,6 +153,17 @@ class TonConnectConnector extends walletConnectorCore.WalletConnectorBase {
143
153
  const connectOptions = proofPayload
144
154
  ? { request: { tonProof: proofPayload } }
145
155
  : undefined;
156
+ // On mobile, use bridge connection to avoid injection attempts
157
+ // and open the resulting connection URL as a deep link
158
+ if (utils.isMobile() && sdk.isWalletInfoRemote(matchingWallet)) {
159
+ const connectionUrl = tonConnect.connect({
160
+ bridgeUrl: matchingWallet.bridgeUrl,
161
+ universalLink: matchingWallet.universalLink,
162
+ }, connectOptions);
163
+ this.lastConnectionUrl = connectionUrl;
164
+ utils.PlatformService.openURL(connectionUrl);
165
+ return;
166
+ }
146
167
  tonConnect.connect(matchingWallet, connectOptions);
147
168
  }
148
169
  catch (error) {
@@ -182,6 +203,13 @@ class TonConnectConnector extends walletConnectorCore.WalletConnectorBase {
182
203
  if (tonConnect.connected && ((_a = tonConnect.account) === null || _a === void 0 ? void 0 : _a.address)) {
183
204
  return this.convertAddressToUserFriendly(tonConnect.account.address);
184
205
  }
206
+ // On mobile without the wallet's JS bridge available,
207
+ // start bridge connection and redirect to wallet app.
208
+ // Return undefined — connection completes when user returns.
209
+ if (utils.isMobile() && !this.isInstalledOnBrowser()) {
210
+ yield this.connect();
211
+ return undefined;
212
+ }
185
213
  // If not connected, initiate connection and wait for it to complete
186
214
  try {
187
215
  // Start the connection process (shows QR code/deep link)
@@ -21,6 +21,7 @@ export declare class TonConnectConnector extends WalletConnectorBase<typeof TonW
21
21
  private tonNetworks;
22
22
  private connectedWallet;
23
23
  private pendingProofPayload;
24
+ private lastConnectionUrl;
24
25
  /**
25
26
  * Get the TonConnect instance (for discovering wallets and advanced usage)
26
27
  */
@@ -36,9 +37,13 @@ export declare class TonConnectConnector extends WalletConnectorBase<typeof TonW
36
37
  */
37
38
  setupEventListeners(): void;
38
39
  /**
39
- * Check if TON Connect is available
40
+ * Check if the wallet's browser extension is installed
40
41
  */
41
42
  isInstalledOnBrowser(): boolean;
43
+ /**
44
+ * Retry opening the wallet deep link on mobile
45
+ */
46
+ retryDeeplinkConnection(): void;
42
47
  /**
43
48
  * Connect to a TON wallet
44
49
  * @param tonProofPayload - Optional payload for tonProof authentication
@@ -1,10 +1,10 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
- import { TonConnect } from '@tonconnect/sdk';
3
+ import { TonConnect, isWalletInfoRemote } from '@tonconnect/sdk';
4
4
  import { Address, beginCell, Cell, loadStateInit } from '@ton/core';
5
5
  import { TonClient, fromNano } from '@ton/ton';
6
6
  import { WalletConnectorBase, logger } from '@dynamic-labs/wallet-connector-core';
7
- import { DynamicError } from '@dynamic-labs/utils';
7
+ import { PlatformService, DynamicError, isMobile } from '@dynamic-labs/utils';
8
8
  import { TonWallet } from '../../wallet/TonWallet/TonWallet.js';
9
9
  import { debugLogMultiline, debugLogWithLevel, debugLog } from '../../utils/debugLog/debugLog.js';
10
10
  import { TonUiTransaction, NANOTON_PER_TON } from '../../utils/TonUiTransaction/TonUiTransaction.js';
@@ -52,9 +52,10 @@ class TonConnectConnector extends WalletConnectorBase {
52
52
  this.overrideKey = 'tonconnect';
53
53
  this.connectedChain = 'TON';
54
54
  this.supportedChains = ['TON'];
55
- this.canConnectViaQrCode = true;
55
+ this.canConnectViaQrCode = false;
56
56
  this.connectedWallet = null;
57
57
  this.pendingProofPayload = null;
58
+ this.lastConnectionUrl = null;
58
59
  this.tonNetworks = opts.tonNetworks || [];
59
60
  this.overrideKey = opts.overrideKey || 'tonconnect';
60
61
  // Only initialize TonConnect in browser environment
@@ -105,12 +106,21 @@ class TonConnectConnector extends WalletConnectorBase {
105
106
  });
106
107
  }
107
108
  /**
108
- * Check if TON Connect is available
109
+ * Check if the wallet's browser extension is installed
109
110
  */
110
111
  isInstalledOnBrowser() {
111
- // TON Connect wallets are mobile apps, not browser extensions
112
- // Return false so they show as QR code/deep link wallets
113
- return false;
112
+ if (typeof window === 'undefined') {
113
+ return false;
114
+ }
115
+ return TonConnect.isWalletInjected(this.overrideKey);
116
+ }
117
+ /**
118
+ * Retry opening the wallet deep link on mobile
119
+ */
120
+ retryDeeplinkConnection() {
121
+ if (this.lastConnectionUrl) {
122
+ PlatformService.openURL(this.lastConnectionUrl);
123
+ }
114
124
  }
115
125
  /**
116
126
  * Connect to a TON wallet
@@ -139,6 +149,17 @@ class TonConnectConnector extends WalletConnectorBase {
139
149
  const connectOptions = proofPayload
140
150
  ? { request: { tonProof: proofPayload } }
141
151
  : undefined;
152
+ // On mobile, use bridge connection to avoid injection attempts
153
+ // and open the resulting connection URL as a deep link
154
+ if (isMobile() && isWalletInfoRemote(matchingWallet)) {
155
+ const connectionUrl = tonConnect.connect({
156
+ bridgeUrl: matchingWallet.bridgeUrl,
157
+ universalLink: matchingWallet.universalLink,
158
+ }, connectOptions);
159
+ this.lastConnectionUrl = connectionUrl;
160
+ PlatformService.openURL(connectionUrl);
161
+ return;
162
+ }
142
163
  tonConnect.connect(matchingWallet, connectOptions);
143
164
  }
144
165
  catch (error) {
@@ -178,6 +199,13 @@ class TonConnectConnector extends WalletConnectorBase {
178
199
  if (tonConnect.connected && ((_a = tonConnect.account) === null || _a === void 0 ? void 0 : _a.address)) {
179
200
  return this.convertAddressToUserFriendly(tonConnect.account.address);
180
201
  }
202
+ // On mobile without the wallet's JS bridge available,
203
+ // start bridge connection and redirect to wallet app.
204
+ // Return undefined — connection completes when user returns.
205
+ if (isMobile() && !this.isInstalledOnBrowser()) {
206
+ yield this.connect();
207
+ return undefined;
208
+ }
181
209
  // If not connected, initiate connection and wait for it to complete
182
210
  try {
183
211
  // Start the connection process (shows QR code/deep link)
@@ -3,11 +3,9 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var walletBook = require('@dynamic-labs/wallet-book');
7
6
  var TonConnectConnector = require('../../connectors/TonConnectConnector/TonConnectConnector.cjs');
8
7
  var debugLog = require('../debugLog/debugLog.cjs');
9
8
 
10
- /* eslint-disable @typescript-eslint/no-unused-vars */
11
9
  /**
12
10
  * Checks if a wallet configuration supports TON Connect.
13
11
  *
@@ -42,10 +40,10 @@ const isValidTonConnectWallet = (wallet) => { var _a; return Boolean((_a = walle
42
40
  * // Returns connectors for wallets like Tonkeeper, MyTonWallet, etc.
43
41
  * ```
44
42
  */
45
- const fetchTonWalletConnectors = ({ walletBook: walletBook$1, tonNetworks = [], }) => {
43
+ const fetchTonWalletConnectors = ({ walletBook, tonNetworks = [], }) => {
46
44
  var _a;
47
45
  // Create connectors from wallet book entries (these provide custom metadata/icons)
48
- const allWallets = Object.entries((_a = walletBook$1 === null || walletBook$1 === void 0 ? void 0 : walletBook$1.wallets) !== null && _a !== void 0 ? _a : {});
46
+ const allWallets = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {});
49
47
  const tonWallets = allWallets.filter(([_, wallet]) => isValidTonConnectWallet(wallet));
50
48
  // Debug logging
51
49
  debugLog.debugLogMultiline(['[TON] Total wallets in wallet book:', allWallets.length], ['[TON] TON wallets found:', tonWallets.length], ['[TON] TON wallet keys:', tonWallets.map(([key]) => key)]);
@@ -55,22 +53,8 @@ const fetchTonWalletConnectors = ({ walletBook: walletBook$1, tonNetworks = [],
55
53
  return class extends TonConnectConnector.TonConnectConnector {
56
54
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
55
  constructor(props) {
58
- var _a;
59
- super(Object.assign(Object.assign({}, props), { metadata: {
60
- brandColor: undefined,
61
- deepLinks: undefined,
62
- downloadLinks: undefined,
63
- groupKey: undefined,
64
- icon: ((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.spriteId)
65
- ? walletBook.renderTemplate('iconicUrl', wallet.brand.spriteId)
66
- : '',
67
- id: key,
68
- name: name,
69
- rdns: undefined,
70
- supportedHardwareWallets: undefined,
71
- walletLimitations: undefined,
72
- }, overrideKey: key, tonNetworks,
73
- walletBook: walletBook$1 }));
56
+ super(Object.assign(Object.assign({}, props), { overrideKey: key, tonNetworks,
57
+ walletBook }));
74
58
  this.name = name;
75
59
  this.overrideKey = key;
76
60
  }
@@ -89,19 +73,8 @@ const fetchTonWalletConnectors = ({ walletBook: walletBook$1, tonNetworks = [],
89
73
  class extends TonConnectConnector.TonConnectConnector {
90
74
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
75
  constructor(props) {
92
- super(Object.assign(Object.assign({}, props), { metadata: {
93
- brandColor: undefined,
94
- deepLinks: undefined,
95
- downloadLinks: undefined,
96
- groupKey: undefined,
97
- icon: '', // Will use default TON icon from chain icon mapping
98
- id: 'tonconnect',
99
- name: 'TON Connect',
100
- rdns: undefined,
101
- supportedHardwareWallets: undefined,
102
- walletLimitations: undefined,
103
- }, tonNetworks,
104
- walletBook: walletBook$1 }));
76
+ super(Object.assign(Object.assign({}, props), { tonNetworks,
77
+ walletBook }));
105
78
  this.name = 'TON Connect';
106
79
  this.overrideKey = 'tonconnect';
107
80
  }
@@ -1,9 +1,7 @@
1
1
  'use client'
2
- import { renderTemplate } from '@dynamic-labs/wallet-book';
3
2
  import { TonConnectConnector } from '../../connectors/TonConnectConnector/TonConnectConnector.js';
4
3
  import { debugLogMultiline, debugLog } from '../debugLog/debugLog.js';
5
4
 
6
- /* eslint-disable @typescript-eslint/no-unused-vars */
7
5
  /**
8
6
  * Checks if a wallet configuration supports TON Connect.
9
7
  *
@@ -51,21 +49,7 @@ const fetchTonWalletConnectors = ({ walletBook, tonNetworks = [], }) => {
51
49
  return class extends TonConnectConnector {
52
50
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
51
  constructor(props) {
54
- var _a;
55
- super(Object.assign(Object.assign({}, props), { metadata: {
56
- brandColor: undefined,
57
- deepLinks: undefined,
58
- downloadLinks: undefined,
59
- groupKey: undefined,
60
- icon: ((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.spriteId)
61
- ? renderTemplate('iconicUrl', wallet.brand.spriteId)
62
- : '',
63
- id: key,
64
- name: name,
65
- rdns: undefined,
66
- supportedHardwareWallets: undefined,
67
- walletLimitations: undefined,
68
- }, overrideKey: key, tonNetworks,
52
+ super(Object.assign(Object.assign({}, props), { overrideKey: key, tonNetworks,
69
53
  walletBook }));
70
54
  this.name = name;
71
55
  this.overrideKey = key;
@@ -85,18 +69,7 @@ const fetchTonWalletConnectors = ({ walletBook, tonNetworks = [], }) => {
85
69
  class extends TonConnectConnector {
86
70
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
71
  constructor(props) {
88
- super(Object.assign(Object.assign({}, props), { metadata: {
89
- brandColor: undefined,
90
- deepLinks: undefined,
91
- downloadLinks: undefined,
92
- groupKey: undefined,
93
- icon: '', // Will use default TON icon from chain icon mapping
94
- id: 'tonconnect',
95
- name: 'TON Connect',
96
- rdns: undefined,
97
- supportedHardwareWallets: undefined,
98
- walletLimitations: undefined,
99
- }, tonNetworks,
72
+ super(Object.assign(Object.assign({}, props), { tonNetworks,
100
73
  walletBook }));
101
74
  this.name = 'TON Connect';
102
75
  this.overrideKey = 'tonconnect';
@@ -120,11 +120,11 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
120
120
  return _tslib.__awaiter(this, void 0, void 0, function* () {
121
121
  var _a;
122
122
  const walletClient = yield this.getWaasWalletClient();
123
- const signedSessionId = yield this.requireSignedSessionId();
124
123
  const targetWallet = yield walletClient.getWallet({
125
124
  accountAddress: expectedAddress,
126
125
  authToken: (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this),
127
- signedSessionId,
126
+ // TODO: This is a hack - validateActiveWallet is a no-op operation that shouldn't require nonce signing
127
+ signedSessionId: '',
128
128
  });
129
129
  if (!targetWallet) {
130
130
  throw new utils.DynamicError('Account not found');
@@ -60,12 +60,13 @@ declare const DynamicWaasTonConnector_base: (abstract new (...args: any[]) => {
60
60
  publicKeyHex: string;
61
61
  rawPublicKey: string | Uint8Array | undefined;
62
62
  }>;
63
- importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, }: {
63
+ importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, password, }: {
64
64
  privateKey: string;
65
65
  thresholdSignatureScheme?: string | undefined;
66
66
  publicAddressCheck?: string | undefined;
67
67
  addressType?: string | undefined;
68
68
  legacyWalletId?: string | undefined;
69
+ password?: string | undefined;
69
70
  }): Promise<void>;
70
71
  exportPrivateKey({ accountAddress, displayContainer, password, }?: {
71
72
  accountAddress?: string | undefined;
@@ -116,11 +116,11 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
116
116
  return __awaiter(this, void 0, void 0, function* () {
117
117
  var _a;
118
118
  const walletClient = yield this.getWaasWalletClient();
119
- const signedSessionId = yield this.requireSignedSessionId();
120
119
  const targetWallet = yield walletClient.getWallet({
121
120
  accountAddress: expectedAddress,
122
121
  authToken: (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this),
123
- signedSessionId,
122
+ // TODO: This is a hack - validateActiveWallet is a no-op operation that shouldn't require nonce signing
123
+ signedSessionId: '',
124
124
  });
125
125
  if (!targetWallet) {
126
126
  throw new DynamicError('Account not found');