@dynamic-labs/ton 4.91.3 → 4.91.5
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 +17 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/TonWalletConnector.cjs +2 -2
- package/src/TonWalletConnector.js +2 -2
- package/src/connectors/TonConnectConnector/TonConnectConnector.cjs +18 -18
- package/src/connectors/TonConnectConnector/TonConnectConnector.js +18 -18
- package/src/waas/connector/DynamicWaasTonConnector.cjs +11 -11
- package/src/waas/connector/DynamicWaasTonConnector.d.ts +4 -0
- package/src/waas/connector/DynamicWaasTonConnector.js +11 -11
- package/src/wallet/TonWallet/TonWallet.cjs +2 -2
- package/src/wallet/TonWallet/TonWallet.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.91.5](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.4...v4.91.5) (2026-07-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* revoke WaaS signed-session callback on client rebuild to stop iOS nonce race ([#11766](https://github.com/dynamic-labs/dynamic-auth/issues/11766)) ([c895b5d](https://github.com/dynamic-labs/dynamic-auth/commit/c895b5d0987d62a9f5597741dbeae0ec7fedfe5b))
|
|
8
|
+
* **sdk-react-core:** allow sendOneTimeCode to target non-primary chain wallets ([#11777](https://github.com/dynamic-labs/dynamic-auth/issues/11777)) ([63f82af](https://github.com/dynamic-labs/dynamic-auth/commit/63f82af7c52be595bc2948ec88ee9c919ac9275a))
|
|
9
|
+
* **webview-controller:** resolve post-login wallet race in Viem and ZeroDev controllers ([#11774](https://github.com/dynamic-labs/dynamic-auth/issues/11774)) ([95ed26e](https://github.com/dynamic-labs/dynamic-auth/commit/95ed26eee09d9aff5a5af6517ab7e1360ef5f337))
|
|
10
|
+
|
|
11
|
+
### [4.91.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.3...v4.91.4) (2026-07-01)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* conditionally use /op/ route for AA transactions based on block explorer support ([#11628](https://github.com/dynamic-labs/dynamic-auth/issues/11628)) ([95822dc](https://github.com/dynamic-labs/dynamic-auth/commit/95822dc0edbcd739afe870f0b3881555fdb17eb6))
|
|
17
|
+
* require error codes in all SDK error classes ([#11761](https://github.com/dynamic-labs/dynamic-auth/issues/11761)) ([5744811](https://github.com/dynamic-labs/dynamic-auth/commit/5744811efdd1e415aaf51eec5b3300b323ec1347))
|
|
18
|
+
|
|
2
19
|
### [4.91.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.2...v4.91.3) (2026-06-30)
|
|
3
20
|
|
|
4
21
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ton",
|
|
3
|
-
"version": "4.91.
|
|
3
|
+
"version": "4.91.5",
|
|
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",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@dynamic-labs-sdk/client": "1.12.1",
|
|
22
|
-
"@dynamic-labs/assert-package-version": "4.91.
|
|
23
|
-
"@dynamic-labs/logger": "4.91.
|
|
22
|
+
"@dynamic-labs/assert-package-version": "4.91.5",
|
|
23
|
+
"@dynamic-labs/logger": "4.91.5",
|
|
24
24
|
"@dynamic-labs/sdk-api-core": "0.0.1046",
|
|
25
|
-
"@dynamic-labs/types": "4.91.
|
|
26
|
-
"@dynamic-labs/utils": "4.91.
|
|
27
|
-
"@dynamic-labs/waas": "4.91.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.91.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.91.
|
|
25
|
+
"@dynamic-labs/types": "4.91.5",
|
|
26
|
+
"@dynamic-labs/utils": "4.91.5",
|
|
27
|
+
"@dynamic-labs/waas": "4.91.5",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.91.5",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.91.5",
|
|
30
30
|
"@ton/core": "0.62.0",
|
|
31
31
|
"@ton/crypto": "3.3.0",
|
|
32
32
|
"@ton/ton": "16.0.0",
|
|
@@ -57,11 +57,11 @@ class TonWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
57
57
|
? (_a = this.tonNetworks) === null || _a === void 0 ? void 0 : _a.find((net) => net.chainId === targetChainId)
|
|
58
58
|
: selectedNetwork;
|
|
59
59
|
if (!network) {
|
|
60
|
-
throw new utils.DynamicError(`Network configuration not found for chainId: ${targetChainId}
|
|
60
|
+
throw new utils.DynamicError(`Network configuration not found for chainId: ${targetChainId}`, 'network_configuration_not_found_for_chainid');
|
|
61
61
|
}
|
|
62
62
|
const endpoint = ((_b = network.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = network.rpcUrls) === null || _c === void 0 ? void 0 : _c[0]);
|
|
63
63
|
if (!endpoint) {
|
|
64
|
-
throw new utils.DynamicError(`No RPC endpoint found for chainId: ${targetChainId}
|
|
64
|
+
throw new utils.DynamicError(`No RPC endpoint found for chainId: ${targetChainId}`, 'no_rpc_endpoint_found_for_chainid');
|
|
65
65
|
}
|
|
66
66
|
return new ton.TonClient({ endpoint });
|
|
67
67
|
}
|
|
@@ -53,11 +53,11 @@ class TonWalletConnector extends WalletConnectorBase {
|
|
|
53
53
|
? (_a = this.tonNetworks) === null || _a === void 0 ? void 0 : _a.find((net) => net.chainId === targetChainId)
|
|
54
54
|
: selectedNetwork;
|
|
55
55
|
if (!network) {
|
|
56
|
-
throw new DynamicError(`Network configuration not found for chainId: ${targetChainId}
|
|
56
|
+
throw new DynamicError(`Network configuration not found for chainId: ${targetChainId}`, 'network_configuration_not_found_for_chainid');
|
|
57
57
|
}
|
|
58
58
|
const endpoint = ((_b = network.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = network.rpcUrls) === null || _c === void 0 ? void 0 : _c[0]);
|
|
59
59
|
if (!endpoint) {
|
|
60
|
-
throw new DynamicError(`No RPC endpoint found for chainId: ${targetChainId}
|
|
60
|
+
throw new DynamicError(`No RPC endpoint found for chainId: ${targetChainId}`, 'no_rpc_endpoint_found_for_chainid');
|
|
61
61
|
}
|
|
62
62
|
return new TonClient({ endpoint });
|
|
63
63
|
}
|
|
@@ -217,11 +217,11 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
217
217
|
}
|
|
218
218
|
clearTimeout(timer);
|
|
219
219
|
cleanup();
|
|
220
|
-
reject(new utils.DynamicError('User rejected connection'));
|
|
220
|
+
reject(new utils.DynamicError('User rejected connection', 'user_rejected_connection'));
|
|
221
221
|
};
|
|
222
222
|
const timer = setTimeout(() => {
|
|
223
223
|
cleanup();
|
|
224
|
-
reject(new utils.DynamicError('Connection timed out — wallet did not respond'));
|
|
224
|
+
reject(new utils.DynamicError('Connection timed out — wallet did not respond', 'connection_timed_out_wallet_did_not'));
|
|
225
225
|
}, CONNECTION_TIMEOUT_MS);
|
|
226
226
|
if (this.tonConnectAppName) {
|
|
227
227
|
modalUnsub = ui.onSingleWalletModalStateChange(handleModalClose);
|
|
@@ -236,14 +236,14 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
236
236
|
}
|
|
237
237
|
catch (error) {
|
|
238
238
|
if (this.isUserRejectionError(error)) {
|
|
239
|
-
throw new utils.DynamicError('User rejected connection');
|
|
239
|
+
throw new utils.DynamicError('User rejected connection', 'user_rejected_connection');
|
|
240
240
|
}
|
|
241
241
|
walletConnectorCore.logger.error('[TON Connect] Connection failed:', error);
|
|
242
242
|
if (error instanceof utils.DynamicError) {
|
|
243
243
|
throw error;
|
|
244
244
|
}
|
|
245
245
|
const message = error instanceof Error ? error.message : String(error);
|
|
246
|
-
throw new utils.DynamicError(`Failed to connect to TON wallet: ${message}
|
|
246
|
+
throw new utils.DynamicError(`Failed to connect to TON wallet: ${message}`, 'connect_to_ton_wallet');
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
249
|
}
|
|
@@ -294,7 +294,7 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
294
294
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
295
295
|
const ui = this.getTonConnectUI();
|
|
296
296
|
if (!ui.connected) {
|
|
297
|
-
throw new utils.DynamicError('Wallet not connected');
|
|
297
|
+
throw new utils.DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
298
298
|
}
|
|
299
299
|
try {
|
|
300
300
|
const result = yield ui.signData({
|
|
@@ -305,10 +305,10 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
305
305
|
}
|
|
306
306
|
catch (error) {
|
|
307
307
|
if (this.isUserRejectionError(error)) {
|
|
308
|
-
throw new utils.DynamicError('User rejected message signing');
|
|
308
|
+
throw new utils.DynamicError('User rejected message signing', 'user_rejected_message_signing');
|
|
309
309
|
}
|
|
310
310
|
walletConnectorCore.logger.error('[TON Connect] Sign message failed:', error);
|
|
311
|
-
throw new utils.DynamicError(`Failed to sign message: ${error instanceof Error ? error.message : String(error)}
|
|
311
|
+
throw new utils.DynamicError(`Failed to sign message: ${error instanceof Error ? error.message : String(error)}`, 'sign_message');
|
|
312
312
|
}
|
|
313
313
|
});
|
|
314
314
|
}
|
|
@@ -320,7 +320,7 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
320
320
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
321
321
|
const ui = this.getTonConnectUI();
|
|
322
322
|
if (!ui.connected) {
|
|
323
|
-
throw new utils.DynamicError('Wallet not connected');
|
|
323
|
+
throw new utils.DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
324
324
|
}
|
|
325
325
|
try {
|
|
326
326
|
// Convert addresses from raw format (0:hex) to user-friendly format (EQ...)
|
|
@@ -335,10 +335,10 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
335
335
|
}
|
|
336
336
|
catch (error) {
|
|
337
337
|
if (this.isUserRejectionError(error)) {
|
|
338
|
-
throw new utils.DynamicError('User rejected transaction');
|
|
338
|
+
throw new utils.DynamicError('User rejected transaction', 'user_rejected_transaction');
|
|
339
339
|
}
|
|
340
340
|
walletConnectorCore.logger.error('[TON Connect] Send transaction failed:', error);
|
|
341
|
-
throw new utils.DynamicError(`Failed to send transaction: ${error instanceof Error ? error.message : String(error)}
|
|
341
|
+
throw new utils.DynamicError(`Failed to send transaction: ${error instanceof Error ? error.message : String(error)}`, 'send_transaction');
|
|
342
342
|
}
|
|
343
343
|
});
|
|
344
344
|
}
|
|
@@ -387,11 +387,11 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
387
387
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
388
388
|
var _a;
|
|
389
389
|
if (!transaction.to) {
|
|
390
|
-
throw new utils.DynamicError('Destination address is required');
|
|
390
|
+
throw new utils.DynamicError('Destination address is required', 'destination_address_is_required');
|
|
391
391
|
}
|
|
392
392
|
const ui = this.getTonConnectUI();
|
|
393
393
|
if (!ui.connected || !((_a = ui.account) === null || _a === void 0 ? void 0 : _a.address)) {
|
|
394
|
-
throw new utils.DynamicError('Wallet not connected');
|
|
394
|
+
throw new utils.DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
395
395
|
}
|
|
396
396
|
const walletAddress = this.convertAddressToUserFriendly(ui.account.address);
|
|
397
397
|
const client = this.getTonClient();
|
|
@@ -423,7 +423,7 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
423
423
|
});
|
|
424
424
|
return this.sendTransaction(request);
|
|
425
425
|
}
|
|
426
|
-
throw new utils.DynamicError('Invalid transaction parameters');
|
|
426
|
+
throw new utils.DynamicError('Invalid transaction parameters', 'invalid_transaction_parameters');
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
@@ -632,9 +632,9 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
632
632
|
}
|
|
633
633
|
// Check if connected but proof was rejected or not supported
|
|
634
634
|
if (ui.connected && !((_e = wallet === null || wallet === void 0 ? void 0 : wallet.connectItems) === null || _e === void 0 ? void 0 : _e.tonProof)) {
|
|
635
|
-
throw new utils.DynamicError('Wallet connected but did not provide proof. The wallet may not support tonProof.');
|
|
635
|
+
throw new utils.DynamicError('Wallet connected but did not provide proof. The wallet may not support tonProof.', 'wallet_connected_but_did_not_provide');
|
|
636
636
|
}
|
|
637
|
-
throw new utils.DynamicError('Connection timeout - user did not approve the connection');
|
|
637
|
+
throw new utils.DynamicError('Connection timeout - user did not approve the connection', 'connection_timeout_user_did_not_approve');
|
|
638
638
|
}
|
|
639
639
|
finally {
|
|
640
640
|
this.pendingProofPayload = null;
|
|
@@ -674,7 +674,7 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
674
674
|
});
|
|
675
675
|
const timer = setTimeout(() => {
|
|
676
676
|
statusUnsub();
|
|
677
|
-
reject(new utils.DynamicError('Connection timed out — wallet did not respond'));
|
|
677
|
+
reject(new utils.DynamicError('Connection timed out — wallet did not respond', 'connection_timed_out_wallet_did_not'));
|
|
678
678
|
}, CONNECTION_TIMEOUT_MS);
|
|
679
679
|
try {
|
|
680
680
|
connector.connect({ jsBridgeKey: walletInfo.jsBridgeKey }, tonProofPayload ? { tonProof: tonProofPayload } : undefined);
|
|
@@ -707,7 +707,7 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
707
707
|
const proof = yield this.generateTonConnectProof(payload);
|
|
708
708
|
const stateInit = (_a = this.connectedWallet) === null || _a === void 0 ? void 0 : _a.account.walletStateInit;
|
|
709
709
|
if (!stateInit) {
|
|
710
|
-
throw new utils.DynamicError('Wallet did not provide state_init required for verification');
|
|
710
|
+
throw new utils.DynamicError('Wallet did not provide state_init required for verification', 'wallet_did_not_provide_stateinit_required');
|
|
711
711
|
}
|
|
712
712
|
const walletProvidedKey = (_b = this.connectedWallet) === null || _b === void 0 ? void 0 : _b.account.publicKey;
|
|
713
713
|
const publicKey = walletProvidedKey || this.extractPublicKeyFromStateInit(stateInit);
|
|
@@ -752,7 +752,7 @@ class TonConnectConnector extends TonWalletConnector.TonWalletConnector {
|
|
|
752
752
|
catch (error) {
|
|
753
753
|
walletConnectorCore.logger.error('[TON Connect] Failed to extract public key from state_init:', error);
|
|
754
754
|
debugLog.debugLog('[TON Connect] state_init that failed:', stateInitBase64);
|
|
755
|
-
throw new utils.DynamicError('Failed to extract public key from wallet state_init');
|
|
755
|
+
throw new utils.DynamicError('Failed to extract public key from wallet state_init', 'extract_public_key_from_wallet_stateinit');
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
/**
|
|
@@ -213,11 +213,11 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
213
213
|
}
|
|
214
214
|
clearTimeout(timer);
|
|
215
215
|
cleanup();
|
|
216
|
-
reject(new DynamicError('User rejected connection'));
|
|
216
|
+
reject(new DynamicError('User rejected connection', 'user_rejected_connection'));
|
|
217
217
|
};
|
|
218
218
|
const timer = setTimeout(() => {
|
|
219
219
|
cleanup();
|
|
220
|
-
reject(new DynamicError('Connection timed out — wallet did not respond'));
|
|
220
|
+
reject(new DynamicError('Connection timed out — wallet did not respond', 'connection_timed_out_wallet_did_not'));
|
|
221
221
|
}, CONNECTION_TIMEOUT_MS);
|
|
222
222
|
if (this.tonConnectAppName) {
|
|
223
223
|
modalUnsub = ui.onSingleWalletModalStateChange(handleModalClose);
|
|
@@ -232,14 +232,14 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
232
232
|
}
|
|
233
233
|
catch (error) {
|
|
234
234
|
if (this.isUserRejectionError(error)) {
|
|
235
|
-
throw new DynamicError('User rejected connection');
|
|
235
|
+
throw new DynamicError('User rejected connection', 'user_rejected_connection');
|
|
236
236
|
}
|
|
237
237
|
logger.error('[TON Connect] Connection failed:', error);
|
|
238
238
|
if (error instanceof DynamicError) {
|
|
239
239
|
throw error;
|
|
240
240
|
}
|
|
241
241
|
const message = error instanceof Error ? error.message : String(error);
|
|
242
|
-
throw new DynamicError(`Failed to connect to TON wallet: ${message}
|
|
242
|
+
throw new DynamicError(`Failed to connect to TON wallet: ${message}`, 'connect_to_ton_wallet');
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
}
|
|
@@ -290,7 +290,7 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
290
290
|
return __awaiter(this, void 0, void 0, function* () {
|
|
291
291
|
const ui = this.getTonConnectUI();
|
|
292
292
|
if (!ui.connected) {
|
|
293
|
-
throw new DynamicError('Wallet not connected');
|
|
293
|
+
throw new DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
294
294
|
}
|
|
295
295
|
try {
|
|
296
296
|
const result = yield ui.signData({
|
|
@@ -301,10 +301,10 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
301
301
|
}
|
|
302
302
|
catch (error) {
|
|
303
303
|
if (this.isUserRejectionError(error)) {
|
|
304
|
-
throw new DynamicError('User rejected message signing');
|
|
304
|
+
throw new DynamicError('User rejected message signing', 'user_rejected_message_signing');
|
|
305
305
|
}
|
|
306
306
|
logger.error('[TON Connect] Sign message failed:', error);
|
|
307
|
-
throw new DynamicError(`Failed to sign message: ${error instanceof Error ? error.message : String(error)}
|
|
307
|
+
throw new DynamicError(`Failed to sign message: ${error instanceof Error ? error.message : String(error)}`, 'sign_message');
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
}
|
|
@@ -316,7 +316,7 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
316
316
|
return __awaiter(this, void 0, void 0, function* () {
|
|
317
317
|
const ui = this.getTonConnectUI();
|
|
318
318
|
if (!ui.connected) {
|
|
319
|
-
throw new DynamicError('Wallet not connected');
|
|
319
|
+
throw new DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
320
320
|
}
|
|
321
321
|
try {
|
|
322
322
|
// Convert addresses from raw format (0:hex) to user-friendly format (EQ...)
|
|
@@ -331,10 +331,10 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
331
331
|
}
|
|
332
332
|
catch (error) {
|
|
333
333
|
if (this.isUserRejectionError(error)) {
|
|
334
|
-
throw new DynamicError('User rejected transaction');
|
|
334
|
+
throw new DynamicError('User rejected transaction', 'user_rejected_transaction');
|
|
335
335
|
}
|
|
336
336
|
logger.error('[TON Connect] Send transaction failed:', error);
|
|
337
|
-
throw new DynamicError(`Failed to send transaction: ${error instanceof Error ? error.message : String(error)}
|
|
337
|
+
throw new DynamicError(`Failed to send transaction: ${error instanceof Error ? error.message : String(error)}`, 'send_transaction');
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
}
|
|
@@ -383,11 +383,11 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
383
383
|
return __awaiter(this, void 0, void 0, function* () {
|
|
384
384
|
var _a;
|
|
385
385
|
if (!transaction.to) {
|
|
386
|
-
throw new DynamicError('Destination address is required');
|
|
386
|
+
throw new DynamicError('Destination address is required', 'destination_address_is_required');
|
|
387
387
|
}
|
|
388
388
|
const ui = this.getTonConnectUI();
|
|
389
389
|
if (!ui.connected || !((_a = ui.account) === null || _a === void 0 ? void 0 : _a.address)) {
|
|
390
|
-
throw new DynamicError('Wallet not connected');
|
|
390
|
+
throw new DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
391
391
|
}
|
|
392
392
|
const walletAddress = this.convertAddressToUserFriendly(ui.account.address);
|
|
393
393
|
const client = this.getTonClient();
|
|
@@ -419,7 +419,7 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
419
419
|
});
|
|
420
420
|
return this.sendTransaction(request);
|
|
421
421
|
}
|
|
422
|
-
throw new DynamicError('Invalid transaction parameters');
|
|
422
|
+
throw new DynamicError('Invalid transaction parameters', 'invalid_transaction_parameters');
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
/**
|
|
@@ -628,9 +628,9 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
628
628
|
}
|
|
629
629
|
// Check if connected but proof was rejected or not supported
|
|
630
630
|
if (ui.connected && !((_e = wallet === null || wallet === void 0 ? void 0 : wallet.connectItems) === null || _e === void 0 ? void 0 : _e.tonProof)) {
|
|
631
|
-
throw new DynamicError('Wallet connected but did not provide proof. The wallet may not support tonProof.');
|
|
631
|
+
throw new DynamicError('Wallet connected but did not provide proof. The wallet may not support tonProof.', 'wallet_connected_but_did_not_provide');
|
|
632
632
|
}
|
|
633
|
-
throw new DynamicError('Connection timeout - user did not approve the connection');
|
|
633
|
+
throw new DynamicError('Connection timeout - user did not approve the connection', 'connection_timeout_user_did_not_approve');
|
|
634
634
|
}
|
|
635
635
|
finally {
|
|
636
636
|
this.pendingProofPayload = null;
|
|
@@ -670,7 +670,7 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
670
670
|
});
|
|
671
671
|
const timer = setTimeout(() => {
|
|
672
672
|
statusUnsub();
|
|
673
|
-
reject(new DynamicError('Connection timed out — wallet did not respond'));
|
|
673
|
+
reject(new DynamicError('Connection timed out — wallet did not respond', 'connection_timed_out_wallet_did_not'));
|
|
674
674
|
}, CONNECTION_TIMEOUT_MS);
|
|
675
675
|
try {
|
|
676
676
|
connector.connect({ jsBridgeKey: walletInfo.jsBridgeKey }, tonProofPayload ? { tonProof: tonProofPayload } : undefined);
|
|
@@ -703,7 +703,7 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
703
703
|
const proof = yield this.generateTonConnectProof(payload);
|
|
704
704
|
const stateInit = (_a = this.connectedWallet) === null || _a === void 0 ? void 0 : _a.account.walletStateInit;
|
|
705
705
|
if (!stateInit) {
|
|
706
|
-
throw new DynamicError('Wallet did not provide state_init required for verification');
|
|
706
|
+
throw new DynamicError('Wallet did not provide state_init required for verification', 'wallet_did_not_provide_stateinit_required');
|
|
707
707
|
}
|
|
708
708
|
const walletProvidedKey = (_b = this.connectedWallet) === null || _b === void 0 ? void 0 : _b.account.publicKey;
|
|
709
709
|
const publicKey = walletProvidedKey || this.extractPublicKeyFromStateInit(stateInit);
|
|
@@ -748,7 +748,7 @@ class TonConnectConnector extends TonWalletConnector {
|
|
|
748
748
|
catch (error) {
|
|
749
749
|
logger.error('[TON Connect] Failed to extract public key from state_init:', error);
|
|
750
750
|
debugLog('[TON Connect] state_init that failed:', stateInitBase64);
|
|
751
|
-
throw new DynamicError('Failed to extract public key from wallet state_init');
|
|
751
|
+
throw new DynamicError('Failed to extract public key from wallet state_init', 'extract_public_key_from_wallet_stateinit');
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
/**
|
|
@@ -53,7 +53,7 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
53
53
|
generateTonConnectProof(payload) {
|
|
54
54
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
55
55
|
if (!this.activeAccountAddress) {
|
|
56
|
-
throw new utils.DynamicError('Active account address is required');
|
|
56
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
57
57
|
}
|
|
58
58
|
yield this.getWaasWalletClient();
|
|
59
59
|
const host = utils.PlatformService.getHost();
|
|
@@ -88,7 +88,7 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
88
88
|
});
|
|
89
89
|
const additionalAddress = (_b = credential === null || credential === void 0 ? void 0 : credential.walletAdditionalAddresses) === null || _b === void 0 ? void 0 : _b.find((addr) => addr.address === walletAddress);
|
|
90
90
|
if (!(additionalAddress === null || additionalAddress === void 0 ? void 0 : additionalAddress.publicKey)) {
|
|
91
|
-
throw new utils.DynamicError(`Public key not found for wallet address: ${walletAddress}
|
|
91
|
+
throw new utils.DynamicError(`Public key not found for wallet address: ${walletAddress}`, 'public_key_not_found_for_wallet');
|
|
92
92
|
}
|
|
93
93
|
return Buffer.from(additionalAddress.publicKey, 'hex');
|
|
94
94
|
}
|
|
@@ -111,7 +111,7 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
111
111
|
var _a;
|
|
112
112
|
const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
113
113
|
if (!signedSessionId) {
|
|
114
|
-
throw new utils.DynamicError('Signed session ID is required');
|
|
114
|
+
throw new utils.DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
115
115
|
}
|
|
116
116
|
return signedSessionId;
|
|
117
117
|
});
|
|
@@ -127,7 +127,7 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
127
127
|
signedSessionId: '',
|
|
128
128
|
});
|
|
129
129
|
if (!targetWallet) {
|
|
130
|
-
throw new utils.DynamicError('Account not found');
|
|
130
|
+
throw new utils.DynamicError('Account not found', 'account_not_found');
|
|
131
131
|
}
|
|
132
132
|
const isWalletActive = walletConnectorCore.isSameAddress(targetWallet.accountAddress, this.activeAccountAddress || '', this.connectedChain);
|
|
133
133
|
if (!isWalletActive) {
|
|
@@ -201,11 +201,11 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
201
201
|
sendTransaction(request) {
|
|
202
202
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
203
203
|
if (!this.activeAccountAddress) {
|
|
204
|
-
throw new utils.DynamicError('Active account address is required');
|
|
204
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
205
205
|
}
|
|
206
206
|
// TON Connect spec allows 1-4 messages per transaction
|
|
207
207
|
if (request.messages.length < 1 || request.messages.length > 4) {
|
|
208
|
-
throw new utils.DynamicError(`Invalid message count: ${request.messages.length}. Must be between 1 and 4
|
|
208
|
+
throw new utils.DynamicError(`Invalid message count: ${request.messages.length}. Must be between 1 and 4.`, 'invalid_message_count_must_be_between');
|
|
209
209
|
}
|
|
210
210
|
const displayInfo = extractDisplayInfoFromRequest.extractDisplayInfoFromRequest(request);
|
|
211
211
|
const uiTransaction = new TonUiTransaction.TonUiTransaction({
|
|
@@ -229,7 +229,7 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
229
229
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
230
230
|
var _a, _b, _c;
|
|
231
231
|
if (!this.activeAccountAddress) {
|
|
232
|
-
throw new utils.DynamicError('Active account address is required');
|
|
232
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
233
233
|
}
|
|
234
234
|
const client = this.getTonClient();
|
|
235
235
|
const walletAddress = request.from || this.activeAccountAddress;
|
|
@@ -278,7 +278,7 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
278
278
|
transactionData,
|
|
279
279
|
});
|
|
280
280
|
if (!result.success) {
|
|
281
|
-
throw new utils.DynamicError(`Failed to execute transaction: ${result.error || 'Unknown error'}
|
|
281
|
+
throw new utils.DynamicError(`Failed to execute transaction: ${result.error || 'Unknown error'}`, 'execute_transaction');
|
|
282
282
|
}
|
|
283
283
|
return result.transactionHash || '';
|
|
284
284
|
});
|
|
@@ -286,10 +286,10 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
286
286
|
internalSendUiTransaction(transaction) {
|
|
287
287
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
288
288
|
if (!transaction.to) {
|
|
289
|
-
throw new utils.DynamicError('Destination address is required');
|
|
289
|
+
throw new utils.DynamicError('Destination address is required', 'destination_address_is_required');
|
|
290
290
|
}
|
|
291
291
|
if (!this.activeAccountAddress) {
|
|
292
|
-
throw new utils.DynamicError('Active account address is required');
|
|
292
|
+
throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
293
293
|
}
|
|
294
294
|
const client = this.getTonClient();
|
|
295
295
|
// Handle Jetton (non-native token) transfers
|
|
@@ -317,7 +317,7 @@ class DynamicWaasTonConnector extends waas.withDynamicWaas(TonWalletConnector.To
|
|
|
317
317
|
});
|
|
318
318
|
return this.internalSendTransaction(request);
|
|
319
319
|
}
|
|
320
|
-
throw new utils.DynamicError('Invalid transaction parameters');
|
|
320
|
+
throw new utils.DynamicError('Invalid transaction parameters', 'invalid_transaction_parameters');
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
createUiTransaction(from) {
|
|
@@ -32,6 +32,7 @@ declare const DynamicWaasTonConnector_base: (abstract new (...args: any[]) => {
|
|
|
32
32
|
relayUrl?: string | undefined;
|
|
33
33
|
baseClientKeysharesRelayApiUrl?: string | undefined;
|
|
34
34
|
dynamicWaasClient: import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient | undefined;
|
|
35
|
+
revokeSignedSession: (() => void) | undefined;
|
|
35
36
|
chainName: string;
|
|
36
37
|
authMode: "cookie" | "header";
|
|
37
38
|
logger: Logger;
|
|
@@ -63,6 +64,9 @@ declare const DynamicWaasTonConnector_base: (abstract new (...args: any[]) => {
|
|
|
63
64
|
accountAddress: string;
|
|
64
65
|
password?: string | undefined;
|
|
65
66
|
}): Promise<void>;
|
|
67
|
+
createRevocableSignedSessionCallback(): {
|
|
68
|
+
getSignedSessionId: () => Promise<string>;
|
|
69
|
+
};
|
|
66
70
|
createDynamicWaasClient(traceContext?: import("dist/packages/waas/utils/instrumentation").TraceContext | undefined): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
|
|
67
71
|
getWaasWalletClient(traceContext?: import("dist/packages/waas/utils/instrumentation").TraceContext | undefined, { forceRebuild }?: {
|
|
68
72
|
forceRebuild?: boolean | undefined;
|
|
@@ -49,7 +49,7 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
49
49
|
generateTonConnectProof(payload) {
|
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
51
|
if (!this.activeAccountAddress) {
|
|
52
|
-
throw new DynamicError('Active account address is required');
|
|
52
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
53
53
|
}
|
|
54
54
|
yield this.getWaasWalletClient();
|
|
55
55
|
const host = PlatformService.getHost();
|
|
@@ -84,7 +84,7 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
84
84
|
});
|
|
85
85
|
const additionalAddress = (_b = credential === null || credential === void 0 ? void 0 : credential.walletAdditionalAddresses) === null || _b === void 0 ? void 0 : _b.find((addr) => addr.address === walletAddress);
|
|
86
86
|
if (!(additionalAddress === null || additionalAddress === void 0 ? void 0 : additionalAddress.publicKey)) {
|
|
87
|
-
throw new DynamicError(`Public key not found for wallet address: ${walletAddress}
|
|
87
|
+
throw new DynamicError(`Public key not found for wallet address: ${walletAddress}`, 'public_key_not_found_for_wallet');
|
|
88
88
|
}
|
|
89
89
|
return Buffer.from(additionalAddress.publicKey, 'hex');
|
|
90
90
|
}
|
|
@@ -107,7 +107,7 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
107
107
|
var _a;
|
|
108
108
|
const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
109
109
|
if (!signedSessionId) {
|
|
110
|
-
throw new DynamicError('Signed session ID is required');
|
|
110
|
+
throw new DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
111
111
|
}
|
|
112
112
|
return signedSessionId;
|
|
113
113
|
});
|
|
@@ -123,7 +123,7 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
123
123
|
signedSessionId: '',
|
|
124
124
|
});
|
|
125
125
|
if (!targetWallet) {
|
|
126
|
-
throw new DynamicError('Account not found');
|
|
126
|
+
throw new DynamicError('Account not found', 'account_not_found');
|
|
127
127
|
}
|
|
128
128
|
const isWalletActive = isSameAddress(targetWallet.accountAddress, this.activeAccountAddress || '', this.connectedChain);
|
|
129
129
|
if (!isWalletActive) {
|
|
@@ -197,11 +197,11 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
197
197
|
sendTransaction(request) {
|
|
198
198
|
return __awaiter(this, void 0, void 0, function* () {
|
|
199
199
|
if (!this.activeAccountAddress) {
|
|
200
|
-
throw new DynamicError('Active account address is required');
|
|
200
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
201
201
|
}
|
|
202
202
|
// TON Connect spec allows 1-4 messages per transaction
|
|
203
203
|
if (request.messages.length < 1 || request.messages.length > 4) {
|
|
204
|
-
throw new DynamicError(`Invalid message count: ${request.messages.length}. Must be between 1 and 4
|
|
204
|
+
throw new DynamicError(`Invalid message count: ${request.messages.length}. Must be between 1 and 4.`, 'invalid_message_count_must_be_between');
|
|
205
205
|
}
|
|
206
206
|
const displayInfo = extractDisplayInfoFromRequest(request);
|
|
207
207
|
const uiTransaction = new TonUiTransaction({
|
|
@@ -225,7 +225,7 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
225
225
|
return __awaiter(this, void 0, void 0, function* () {
|
|
226
226
|
var _a, _b, _c;
|
|
227
227
|
if (!this.activeAccountAddress) {
|
|
228
|
-
throw new DynamicError('Active account address is required');
|
|
228
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
229
229
|
}
|
|
230
230
|
const client = this.getTonClient();
|
|
231
231
|
const walletAddress = request.from || this.activeAccountAddress;
|
|
@@ -274,7 +274,7 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
274
274
|
transactionData,
|
|
275
275
|
});
|
|
276
276
|
if (!result.success) {
|
|
277
|
-
throw new DynamicError(`Failed to execute transaction: ${result.error || 'Unknown error'}
|
|
277
|
+
throw new DynamicError(`Failed to execute transaction: ${result.error || 'Unknown error'}`, 'execute_transaction');
|
|
278
278
|
}
|
|
279
279
|
return result.transactionHash || '';
|
|
280
280
|
});
|
|
@@ -282,10 +282,10 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
282
282
|
internalSendUiTransaction(transaction) {
|
|
283
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
284
284
|
if (!transaction.to) {
|
|
285
|
-
throw new DynamicError('Destination address is required');
|
|
285
|
+
throw new DynamicError('Destination address is required', 'destination_address_is_required');
|
|
286
286
|
}
|
|
287
287
|
if (!this.activeAccountAddress) {
|
|
288
|
-
throw new DynamicError('Active account address is required');
|
|
288
|
+
throw new DynamicError('Active account address is required', 'active_account_address_is_required');
|
|
289
289
|
}
|
|
290
290
|
const client = this.getTonClient();
|
|
291
291
|
// Handle Jetton (non-native token) transfers
|
|
@@ -313,7 +313,7 @@ class DynamicWaasTonConnector extends withDynamicWaas(TonWalletConnector) {
|
|
|
313
313
|
});
|
|
314
314
|
return this.internalSendTransaction(request);
|
|
315
315
|
}
|
|
316
|
-
throw new DynamicError('Invalid transaction parameters');
|
|
316
|
+
throw new DynamicError('Invalid transaction parameters', 'invalid_transaction_parameters');
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
319
|
createUiTransaction(from) {
|
|
@@ -100,7 +100,7 @@ class TonWallet extends walletConnectorCore.Wallet {
|
|
|
100
100
|
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
101
101
|
const signature = yield this._connector.signMessage(messageString);
|
|
102
102
|
if (!signature) {
|
|
103
|
-
throw new utils.DynamicError('Failed to sign message');
|
|
103
|
+
throw new utils.DynamicError('Failed to sign message', 'sign_message_failed');
|
|
104
104
|
}
|
|
105
105
|
return signature;
|
|
106
106
|
});
|
|
@@ -150,7 +150,7 @@ class TonWallet extends walletConnectorCore.Wallet {
|
|
|
150
150
|
sendJettonViaConnector(options) {
|
|
151
151
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
152
152
|
if (!this.address) {
|
|
153
|
-
throw new utils.DynamicError('Wallet address is required');
|
|
153
|
+
throw new utils.DynamicError('Wallet address is required', 'wallet_address_is_required');
|
|
154
154
|
}
|
|
155
155
|
const client = this._connector.getTonClient();
|
|
156
156
|
const networkStr = yield this._connector.getNetwork();
|
|
@@ -96,7 +96,7 @@ class TonWallet extends Wallet {
|
|
|
96
96
|
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
97
97
|
const signature = yield this._connector.signMessage(messageString);
|
|
98
98
|
if (!signature) {
|
|
99
|
-
throw new DynamicError('Failed to sign message');
|
|
99
|
+
throw new DynamicError('Failed to sign message', 'sign_message_failed');
|
|
100
100
|
}
|
|
101
101
|
return signature;
|
|
102
102
|
});
|
|
@@ -146,7 +146,7 @@ class TonWallet extends Wallet {
|
|
|
146
146
|
sendJettonViaConnector(options) {
|
|
147
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
148
|
if (!this.address) {
|
|
149
|
-
throw new DynamicError('Wallet address is required');
|
|
149
|
+
throw new DynamicError('Wallet address is required', 'wallet_address_is_required');
|
|
150
150
|
}
|
|
151
151
|
const client = this._connector.getTonClient();
|
|
152
152
|
const networkStr = yield this._connector.getNetwork();
|