@dynamic-labs/tron 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 +6 -6
- package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.cjs +10 -10
- package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.js +10 -10
- package/src/wallet/TronWallet/TronWallet.cjs +8 -8
- package/src/wallet/TronWallet/TronWallet.js +8 -8
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/tron",
|
|
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",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/assert-package-version": "4.91.
|
|
21
|
+
"@dynamic-labs/assert-package-version": "4.91.5",
|
|
22
22
|
"@tronweb3/tronwallet-abstract-adapter": "1.1.10",
|
|
23
23
|
"@tronweb3/tronwallet-adapters": "1.2.17",
|
|
24
24
|
"tronweb": "6.1.1",
|
|
25
|
-
"@dynamic-labs/types": "4.91.
|
|
26
|
-
"@dynamic-labs/utils": "4.91.
|
|
27
|
-
"@dynamic-labs/wallet-book": "4.91.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "4.91.
|
|
25
|
+
"@dynamic-labs/types": "4.91.5",
|
|
26
|
+
"@dynamic-labs/utils": "4.91.5",
|
|
27
|
+
"@dynamic-labs/wallet-book": "4.91.5",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "4.91.5"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {}
|
|
31
31
|
}
|
|
@@ -129,7 +129,7 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
129
129
|
yield adapter.connect();
|
|
130
130
|
}
|
|
131
131
|
catch (error) {
|
|
132
|
-
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
132
|
+
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
133
133
|
}
|
|
134
134
|
// Some wallets (Trust, Bitget) populate the address asynchronously after connect()
|
|
135
135
|
// Wait briefly for the address to be populated by the wallet
|
|
@@ -179,7 +179,7 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
catch (error) {
|
|
182
|
-
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
182
|
+
throw new utils.DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
const { address } = adapter;
|
|
@@ -266,11 +266,11 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
266
266
|
signMessage(messageToSign) {
|
|
267
267
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
268
268
|
if (!this.adapter) {
|
|
269
|
-
throw new utils.DynamicError('Wallet not connected');
|
|
269
|
+
throw new utils.DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
270
270
|
}
|
|
271
271
|
const { adapter } = { adapter: this.adapter };
|
|
272
272
|
if (!adapter.connected) {
|
|
273
|
-
throw new utils.DynamicError('Wallet not connected');
|
|
273
|
+
throw new utils.DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
274
274
|
}
|
|
275
275
|
try {
|
|
276
276
|
const signature = yield adapter.signMessage(messageToSign);
|
|
@@ -278,7 +278,7 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
278
278
|
}
|
|
279
279
|
catch (error) {
|
|
280
280
|
walletConnectorCore.logger.error(`[${this.name}] Sign message failed:`, error);
|
|
281
|
-
throw new utils.DynamicError(`Failed to sign message: ${error}
|
|
281
|
+
throw new utils.DynamicError(`Failed to sign message: ${error}`, 'sign_message');
|
|
282
282
|
}
|
|
283
283
|
});
|
|
284
284
|
}
|
|
@@ -364,7 +364,7 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
364
364
|
*/
|
|
365
365
|
switchNetwork() {
|
|
366
366
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
367
|
-
throw new utils.DynamicError('Network switching must be done manually in the Tron wallet UI');
|
|
367
|
+
throw new utils.DynamicError('Network switching must be done manually in the Tron wallet UI', 'network_switching_must_be_done_manually');
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
@@ -419,14 +419,14 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
419
419
|
// Get TronWeb from the adapter's internal wallet state
|
|
420
420
|
const tronWeb = this.getWalletTronWeb();
|
|
421
421
|
if (!tronWeb) {
|
|
422
|
-
throw new utils.DynamicError('TronWeb not available');
|
|
422
|
+
throw new utils.DynamicError('TronWeb not available', 'tronweb_not_available');
|
|
423
423
|
}
|
|
424
424
|
return new TronUiTransaction.TronUiTransaction({
|
|
425
425
|
from,
|
|
426
426
|
onSubmit: (transaction) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
427
427
|
var _a;
|
|
428
428
|
if (!transaction.to) {
|
|
429
|
-
throw new utils.DynamicError('Destination address is required');
|
|
429
|
+
throw new utils.DynamicError('Destination address is required', 'destination_address_is_required');
|
|
430
430
|
}
|
|
431
431
|
// Create a minimal wallet instance for sending
|
|
432
432
|
const wallet = new TronWallet.TronWallet({
|
|
@@ -446,7 +446,7 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
446
446
|
},
|
|
447
447
|
});
|
|
448
448
|
if (!result) {
|
|
449
|
-
throw new utils.DynamicError('Failed to send TRC20 token');
|
|
449
|
+
throw new utils.DynamicError('Failed to send TRC20 token', 'send_trc20_token');
|
|
450
450
|
}
|
|
451
451
|
return result;
|
|
452
452
|
}
|
|
@@ -458,7 +458,7 @@ class TronWalletAdapterConnector extends walletConnectorCore.WalletConnectorBase
|
|
|
458
458
|
});
|
|
459
459
|
return result.txid || ((_a = result.transaction) === null || _a === void 0 ? void 0 : _a.txID);
|
|
460
460
|
}
|
|
461
|
-
throw new utils.DynamicError('Invalid transaction parameters');
|
|
461
|
+
throw new utils.DynamicError('Invalid transaction parameters', 'invalid_transaction_parameters');
|
|
462
462
|
}),
|
|
463
463
|
tronWeb,
|
|
464
464
|
});
|
|
@@ -125,7 +125,7 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
125
125
|
yield adapter.connect();
|
|
126
126
|
}
|
|
127
127
|
catch (error) {
|
|
128
|
-
throw new DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
128
|
+
throw new DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
129
129
|
}
|
|
130
130
|
// Some wallets (Trust, Bitget) populate the address asynchronously after connect()
|
|
131
131
|
// Wait briefly for the address to be populated by the wallet
|
|
@@ -175,7 +175,7 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
catch (error) {
|
|
178
|
-
throw new DynamicError(`Failed to connect to ${this.name}: ${error}
|
|
178
|
+
throw new DynamicError(`Failed to connect to ${this.name}: ${error}`, 'connect_to');
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
const { address } = adapter;
|
|
@@ -262,11 +262,11 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
262
262
|
signMessage(messageToSign) {
|
|
263
263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
264
264
|
if (!this.adapter) {
|
|
265
|
-
throw new DynamicError('Wallet not connected');
|
|
265
|
+
throw new DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
266
266
|
}
|
|
267
267
|
const { adapter } = { adapter: this.adapter };
|
|
268
268
|
if (!adapter.connected) {
|
|
269
|
-
throw new DynamicError('Wallet not connected');
|
|
269
|
+
throw new DynamicError('Wallet not connected', 'wallet_not_connected');
|
|
270
270
|
}
|
|
271
271
|
try {
|
|
272
272
|
const signature = yield adapter.signMessage(messageToSign);
|
|
@@ -274,7 +274,7 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
274
274
|
}
|
|
275
275
|
catch (error) {
|
|
276
276
|
logger.error(`[${this.name}] Sign message failed:`, error);
|
|
277
|
-
throw new DynamicError(`Failed to sign message: ${error}
|
|
277
|
+
throw new DynamicError(`Failed to sign message: ${error}`, 'sign_message');
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
}
|
|
@@ -360,7 +360,7 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
360
360
|
*/
|
|
361
361
|
switchNetwork() {
|
|
362
362
|
return __awaiter(this, void 0, void 0, function* () {
|
|
363
|
-
throw new DynamicError('Network switching must be done manually in the Tron wallet UI');
|
|
363
|
+
throw new DynamicError('Network switching must be done manually in the Tron wallet UI', 'network_switching_must_be_done_manually');
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
@@ -415,14 +415,14 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
415
415
|
// Get TronWeb from the adapter's internal wallet state
|
|
416
416
|
const tronWeb = this.getWalletTronWeb();
|
|
417
417
|
if (!tronWeb) {
|
|
418
|
-
throw new DynamicError('TronWeb not available');
|
|
418
|
+
throw new DynamicError('TronWeb not available', 'tronweb_not_available');
|
|
419
419
|
}
|
|
420
420
|
return new TronUiTransaction({
|
|
421
421
|
from,
|
|
422
422
|
onSubmit: (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
423
423
|
var _a;
|
|
424
424
|
if (!transaction.to) {
|
|
425
|
-
throw new DynamicError('Destination address is required');
|
|
425
|
+
throw new DynamicError('Destination address is required', 'destination_address_is_required');
|
|
426
426
|
}
|
|
427
427
|
// Create a minimal wallet instance for sending
|
|
428
428
|
const wallet = new TronWallet({
|
|
@@ -442,7 +442,7 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
442
442
|
},
|
|
443
443
|
});
|
|
444
444
|
if (!result) {
|
|
445
|
-
throw new DynamicError('Failed to send TRC20 token');
|
|
445
|
+
throw new DynamicError('Failed to send TRC20 token', 'send_trc20_token');
|
|
446
446
|
}
|
|
447
447
|
return result;
|
|
448
448
|
}
|
|
@@ -454,7 +454,7 @@ class TronWalletAdapterConnector extends WalletConnectorBase {
|
|
|
454
454
|
});
|
|
455
455
|
return result.txid || ((_a = result.transaction) === null || _a === void 0 ? void 0 : _a.txID);
|
|
456
456
|
}
|
|
457
|
-
throw new DynamicError('Invalid transaction parameters');
|
|
457
|
+
throw new DynamicError('Invalid transaction parameters', 'invalid_transaction_parameters');
|
|
458
458
|
}),
|
|
459
459
|
tronWeb,
|
|
460
460
|
});
|
|
@@ -32,7 +32,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
32
32
|
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
33
33
|
const signature = yield this._connector.signMessage(messageString);
|
|
34
34
|
if (signature === undefined || signature === '') {
|
|
35
|
-
throw new utils.DynamicError('Failed to sign message');
|
|
35
|
+
throw new utils.DynamicError('Failed to sign message', 'sign_message_failed');
|
|
36
36
|
}
|
|
37
37
|
return signature;
|
|
38
38
|
});
|
|
@@ -61,7 +61,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
61
61
|
});
|
|
62
62
|
return result;
|
|
63
63
|
}
|
|
64
|
-
throw new utils.DynamicError(`Unsupported transaction type: ${transactionType}
|
|
64
|
+
throw new utils.DynamicError(`Unsupported transaction type: ${transactionType}`, 'unsupported_transaction_type');
|
|
65
65
|
}
|
|
66
66
|
const result = yield this.sendTrx(toAddress, Number(amount));
|
|
67
67
|
return result.txid;
|
|
@@ -81,7 +81,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
81
81
|
var _b;
|
|
82
82
|
const tronWeb = this.getTronWeb();
|
|
83
83
|
if (!(tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.contract)) {
|
|
84
|
-
throw new utils.DynamicError('TRC20 token operations not supported by this wallet');
|
|
84
|
+
throw new utils.DynamicError('TRC20 token operations not supported by this wallet', 'trc20_token_operations_not_supported_by');
|
|
85
85
|
}
|
|
86
86
|
const contract = yield tronWeb.contract().at(token.address);
|
|
87
87
|
const fromAddress = (options === null || options === void 0 ? void 0 : options.from) || this.address;
|
|
@@ -91,7 +91,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
91
91
|
// e.g., if amount is "1.5" and decimals is 18, result should be "1500000000000000000"
|
|
92
92
|
const amountNumber = parseFloat(amount);
|
|
93
93
|
if (isNaN(amountNumber) || amountNumber < 0) {
|
|
94
|
-
throw new utils.DynamicError('Invalid token amount');
|
|
94
|
+
throw new utils.DynamicError('Invalid token amount', 'invalid_token_amount');
|
|
95
95
|
}
|
|
96
96
|
const amountInSmallestUnit = BigInt(Math.floor(amountNumber * Math.pow(10, decimals)));
|
|
97
97
|
// Default 5 TRX max fee limit until we implement the gas estimation
|
|
@@ -114,7 +114,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
114
114
|
return result;
|
|
115
115
|
}
|
|
116
116
|
catch (error) {
|
|
117
|
-
throw new utils.DynamicError(`Failed to send TRC20 token: ${error instanceof Error ? error.message : String(error)}
|
|
117
|
+
throw new utils.DynamicError(`Failed to send TRC20 token: ${error instanceof Error ? error.message : String(error)}`, 'send_trc20_token');
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -131,7 +131,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
131
131
|
var _a;
|
|
132
132
|
const tronWeb = this.getTronWeb();
|
|
133
133
|
if (!((_a = tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.trx) === null || _a === void 0 ? void 0 : _a.sendTransaction)) {
|
|
134
|
-
throw new utils.DynamicError('TRX transfer not supported');
|
|
134
|
+
throw new utils.DynamicError('TRX transfer not supported', 'trx_transfer_not_supported');
|
|
135
135
|
}
|
|
136
136
|
const fromAddress = (options === null || options === void 0 ? void 0 : options.from) || this.address;
|
|
137
137
|
const amountInSun = tronWeb.toSun(amount);
|
|
@@ -151,7 +151,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
151
151
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
152
152
|
const tronWeb = this.getTronWeb();
|
|
153
153
|
if (!(tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.contract)) {
|
|
154
|
-
throw new utils.DynamicError('TRC20 token operations not supported by this wallet');
|
|
154
|
+
throw new utils.DynamicError('TRC20 token operations not supported by this wallet', 'trc20_token_operations_not_supported_by');
|
|
155
155
|
}
|
|
156
156
|
const targetAddress = address || this.address;
|
|
157
157
|
try {
|
|
@@ -162,7 +162,7 @@ class TronWallet extends walletConnectorCore.Wallet {
|
|
|
162
162
|
: Number(balance);
|
|
163
163
|
}
|
|
164
164
|
catch (error) {
|
|
165
|
-
throw new utils.DynamicError(`Failed to get TRC20 token balance: ${error}
|
|
165
|
+
throw new utils.DynamicError(`Failed to get TRC20 token balance: ${error}`, 'get_trc20_token_balance');
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
}
|
|
@@ -28,7 +28,7 @@ class TronWallet extends Wallet {
|
|
|
28
28
|
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
29
29
|
const signature = yield this._connector.signMessage(messageString);
|
|
30
30
|
if (signature === undefined || signature === '') {
|
|
31
|
-
throw new DynamicError('Failed to sign message');
|
|
31
|
+
throw new DynamicError('Failed to sign message', 'sign_message_failed');
|
|
32
32
|
}
|
|
33
33
|
return signature;
|
|
34
34
|
});
|
|
@@ -57,7 +57,7 @@ class TronWallet extends Wallet {
|
|
|
57
57
|
});
|
|
58
58
|
return result;
|
|
59
59
|
}
|
|
60
|
-
throw new DynamicError(`Unsupported transaction type: ${transactionType}
|
|
60
|
+
throw new DynamicError(`Unsupported transaction type: ${transactionType}`, 'unsupported_transaction_type');
|
|
61
61
|
}
|
|
62
62
|
const result = yield this.sendTrx(toAddress, Number(amount));
|
|
63
63
|
return result.txid;
|
|
@@ -77,7 +77,7 @@ class TronWallet extends Wallet {
|
|
|
77
77
|
var _b;
|
|
78
78
|
const tronWeb = this.getTronWeb();
|
|
79
79
|
if (!(tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.contract)) {
|
|
80
|
-
throw new DynamicError('TRC20 token operations not supported by this wallet');
|
|
80
|
+
throw new DynamicError('TRC20 token operations not supported by this wallet', 'trc20_token_operations_not_supported_by');
|
|
81
81
|
}
|
|
82
82
|
const contract = yield tronWeb.contract().at(token.address);
|
|
83
83
|
const fromAddress = (options === null || options === void 0 ? void 0 : options.from) || this.address;
|
|
@@ -87,7 +87,7 @@ class TronWallet extends Wallet {
|
|
|
87
87
|
// e.g., if amount is "1.5" and decimals is 18, result should be "1500000000000000000"
|
|
88
88
|
const amountNumber = parseFloat(amount);
|
|
89
89
|
if (isNaN(amountNumber) || amountNumber < 0) {
|
|
90
|
-
throw new DynamicError('Invalid token amount');
|
|
90
|
+
throw new DynamicError('Invalid token amount', 'invalid_token_amount');
|
|
91
91
|
}
|
|
92
92
|
const amountInSmallestUnit = BigInt(Math.floor(amountNumber * Math.pow(10, decimals)));
|
|
93
93
|
// Default 5 TRX max fee limit until we implement the gas estimation
|
|
@@ -110,7 +110,7 @@ class TronWallet extends Wallet {
|
|
|
110
110
|
return result;
|
|
111
111
|
}
|
|
112
112
|
catch (error) {
|
|
113
|
-
throw new DynamicError(`Failed to send TRC20 token: ${error instanceof Error ? error.message : String(error)}
|
|
113
|
+
throw new DynamicError(`Failed to send TRC20 token: ${error instanceof Error ? error.message : String(error)}`, 'send_trc20_token');
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
}
|
|
@@ -127,7 +127,7 @@ class TronWallet extends Wallet {
|
|
|
127
127
|
var _a;
|
|
128
128
|
const tronWeb = this.getTronWeb();
|
|
129
129
|
if (!((_a = tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.trx) === null || _a === void 0 ? void 0 : _a.sendTransaction)) {
|
|
130
|
-
throw new DynamicError('TRX transfer not supported');
|
|
130
|
+
throw new DynamicError('TRX transfer not supported', 'trx_transfer_not_supported');
|
|
131
131
|
}
|
|
132
132
|
const fromAddress = (options === null || options === void 0 ? void 0 : options.from) || this.address;
|
|
133
133
|
const amountInSun = tronWeb.toSun(amount);
|
|
@@ -147,7 +147,7 @@ class TronWallet extends Wallet {
|
|
|
147
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
148
|
const tronWeb = this.getTronWeb();
|
|
149
149
|
if (!(tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.contract)) {
|
|
150
|
-
throw new DynamicError('TRC20 token operations not supported by this wallet');
|
|
150
|
+
throw new DynamicError('TRC20 token operations not supported by this wallet', 'trc20_token_operations_not_supported_by');
|
|
151
151
|
}
|
|
152
152
|
const targetAddress = address || this.address;
|
|
153
153
|
try {
|
|
@@ -158,7 +158,7 @@ class TronWallet extends Wallet {
|
|
|
158
158
|
: Number(balance);
|
|
159
159
|
}
|
|
160
160
|
catch (error) {
|
|
161
|
-
throw new DynamicError(`Failed to get TRC20 token balance: ${error}
|
|
161
|
+
throw new DynamicError(`Failed to get TRC20 token balance: ${error}`, 'get_trc20_token_balance');
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
}
|