@dynamic-labs/tron 4.40.0 → 4.40.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +264 -20
  3. package/package.cjs +1 -1
  4. package/package.js +1 -1
  5. package/package.json +8 -6
  6. package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.cjs +436 -0
  7. package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.d.ts +115 -0
  8. package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.js +432 -0
  9. package/src/connectors/TronWalletAdapterConnector/index.d.ts +1 -0
  10. package/src/index.cjs +4 -13
  11. package/src/index.d.ts +5 -5
  12. package/src/index.js +3 -12
  13. package/src/types.d.ts +11 -181
  14. package/src/utils/TronUiTransaction/TronUiTransaction.cjs +67 -26
  15. package/src/utils/TronUiTransaction/TronUiTransaction.d.ts +38 -5
  16. package/src/utils/TronUiTransaction/TronUiTransaction.js +67 -26
  17. package/src/utils/convertChainIdToDecimal/convertChainIdToDecimal.cjs +16 -0
  18. package/src/utils/convertChainIdToDecimal/convertChainIdToDecimal.d.ts +9 -0
  19. package/src/utils/convertChainIdToDecimal/convertChainIdToDecimal.js +12 -0
  20. package/src/utils/convertChainIdToDecimal/index.d.ts +1 -0
  21. package/src/utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.cjs +80 -0
  22. package/src/utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.d.ts +35 -0
  23. package/src/utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.js +75 -0
  24. package/src/utils/fetchTronWalletAdapterConnectors/index.d.ts +1 -0
  25. package/src/utils/getTronGasEstimation/getTronGasEstimation.cjs +162 -0
  26. package/src/utils/getTronGasEstimation/getTronGasEstimation.d.ts +49 -0
  27. package/src/utils/getTronGasEstimation/getTronGasEstimation.js +158 -0
  28. package/src/utils/getTronGasEstimation/index.d.ts +1 -0
  29. package/src/utils/index.d.ts +1 -4
  30. package/src/wallet/TronWallet/TronWallet.cjs +124 -0
  31. package/src/wallet/TronWallet/TronWallet.d.ts +51 -0
  32. package/src/wallet/TronWallet/TronWallet.js +120 -0
  33. package/src/wallet/TronWallet/index.d.ts +1 -0
  34. package/src/connectors/BitgetTronConnector/BitgetTronConnector.cjs +0 -20
  35. package/src/connectors/BitgetTronConnector/BitgetTronConnector.d.ts +0 -7
  36. package/src/connectors/BitgetTronConnector/BitgetTronConnector.js +0 -16
  37. package/src/connectors/BitgetTronConnector/index.d.ts +0 -1
  38. package/src/connectors/BybitTronConnector/BybitTronConnector.d.ts +0 -7
  39. package/src/connectors/BybitTronConnector/index.d.ts +0 -1
  40. package/src/connectors/OKXTronConnector/OKXTronConnector.cjs +0 -20
  41. package/src/connectors/OKXTronConnector/OKXTronConnector.d.ts +0 -7
  42. package/src/connectors/OKXTronConnector/OKXTronConnector.js +0 -16
  43. package/src/connectors/OKXTronConnector/index.d.ts +0 -1
  44. package/src/connectors/TokenPocketTronConnector/TokenPocketTronConnector.cjs +0 -28
  45. package/src/connectors/TokenPocketTronConnector/TokenPocketTronConnector.d.ts +0 -7
  46. package/src/connectors/TokenPocketTronConnector/TokenPocketTronConnector.js +0 -24
  47. package/src/connectors/TokenPocketTronConnector/index.d.ts +0 -1
  48. package/src/connectors/TronWalletConnector/TronWalletConnector.cjs +0 -255
  49. package/src/connectors/TronWalletConnector/TronWalletConnector.d.ts +0 -42
  50. package/src/connectors/TronWalletConnector/TronWalletConnector.js +0 -251
  51. package/src/connectors/TronWalletConnector/index.d.ts +0 -1
  52. package/src/connectors/TrustTronConnector/TrustTronConnector.cjs +0 -31
  53. package/src/connectors/TrustTronConnector/TrustTronConnector.d.ts +0 -7
  54. package/src/connectors/TrustTronConnector/TrustTronConnector.js +0 -27
  55. package/src/connectors/TrustTronConnector/index.d.ts +0 -1
  56. package/src/utils/detectTronNetworkFromProvider.cjs +0 -67
  57. package/src/utils/detectTronNetworkFromProvider.d.ts +0 -30
  58. package/src/utils/detectTronNetworkFromProvider.js +0 -62
  59. package/src/utils/getDefaultTronNetworks.cjs +0 -60
  60. package/src/utils/getDefaultTronNetworks.d.ts +0 -9
  61. package/src/utils/getDefaultTronNetworks.js +0 -53
  62. package/src/utils/getTronGasEstimation.cjs +0 -136
  63. package/src/utils/getTronGasEstimation.d.ts +0 -47
  64. package/src/utils/getTronGasEstimation.js +0 -129
  65. package/src/utils/provider.cjs +0 -59
  66. package/src/utils/provider.d.ts +0 -24
  67. package/src/utils/provider.js +0 -53
  68. package/src/wallet/TronWallet.cjs +0 -106
  69. package/src/wallet/TronWallet.d.ts +0 -22
  70. package/src/wallet/TronWallet.js +0 -102
  71. package/src/wallet/index.d.ts +0 -2
@@ -0,0 +1,432 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../_virtual/_tslib.js';
3
+ import { TronLinkAdapter, BitKeepAdapter, OkxWalletAdapter, TokenPocketAdapter, TrustAdapter } from '@tronweb3/tronwallet-adapters';
4
+ import { WalletConnectorBase, logger } from '@dynamic-labs/wallet-connector-core';
5
+ import { DynamicError } from '@dynamic-labs/utils';
6
+ import { TronWallet } from '../../wallet/TronWallet/TronWallet.js';
7
+ import { TronUiTransaction } from '../../utils/TronUiTransaction/TronUiTransaction.js';
8
+ import { convertChainIdToDecimal } from '../../utils/convertChainIdToDecimal/convertChainIdToDecimal.js';
9
+
10
+ /**
11
+ * Registry mapping wallet keys to their adapter classes
12
+ */
13
+ const ADAPTER_REGISTRY = {
14
+ bitgettron: BitKeepAdapter,
15
+ okxtron: OkxWalletAdapter,
16
+ tokenpockettron: TokenPocketAdapter,
17
+ tronlinkwallet: TronLinkAdapter,
18
+ trusttron: TrustAdapter,
19
+ };
20
+ class TronWalletAdapterConnector extends WalletConnectorBase {
21
+ /**
22
+ * Create the TronWallet Adapter instance for this connector
23
+ * Uses the adapter registry to create the appropriate adapter
24
+ */
25
+ createAdapter() {
26
+ const AdapterClass = ADAPTER_REGISTRY[this.overrideKey];
27
+ if (!AdapterClass) {
28
+ logger.warn(`[${this.name}] Unknown adapter for overrideKey: ${this.overrideKey}. Falling back to TronLink.`);
29
+ return new TronLinkAdapter();
30
+ }
31
+ const adapter = new AdapterClass();
32
+ return adapter;
33
+ }
34
+ constructor(opts) {
35
+ super(opts);
36
+ this.ChainWallet = TronWallet;
37
+ this.name = 'Tron Wallet';
38
+ this.overrideKey = 'tronwallet';
39
+ this.connectedChain = 'TRON';
40
+ this.supportedChains = ['TRON'];
41
+ this.switchNetworkOnlyFromWallet = true;
42
+ this.adapter = undefined;
43
+ this.balanceCache = new Map();
44
+ this.networkCache = null;
45
+ this.tronNetworks = opts.tronNetworks;
46
+ this.overrideKey = opts.overrideKey || 'tronwallet';
47
+ }
48
+ confirmTransactionStatus() {
49
+ throw new Error('Method not implemented.');
50
+ }
51
+ /**
52
+ * Get the TronWallet Adapter instance
53
+ * Adapter is created lazily only when connect() is called to avoid multiple adapters
54
+ * polling simultaneously at startup.
55
+ */
56
+ getAdapter() {
57
+ if (!this.adapter) {
58
+ throw new Error('Adapter not initialized. Call connect() first.');
59
+ }
60
+ return this.adapter;
61
+ }
62
+ /**
63
+ * Check if the specific wallet is installed on the browser
64
+ * Each wallet adapter checks for its own specific browser injection
65
+ */
66
+ isInstalledOnBrowser() {
67
+ try {
68
+ // Create the adapter to check if the wallet is installed
69
+ if (!this.adapter) {
70
+ const AdapterClass = ADAPTER_REGISTRY[this.overrideKey];
71
+ if (!AdapterClass) {
72
+ return false;
73
+ }
74
+ this.adapter = new AdapterClass();
75
+ }
76
+ // The adapter's readyState indicates if the wallet is installed:
77
+ // NotFound = wallet not installed
78
+ // Loading/Found = wallet is installed
79
+ return this.adapter.readyState !== 'NotFound';
80
+ }
81
+ catch (_a) {
82
+ return false;
83
+ }
84
+ }
85
+ /**
86
+ * Connect to the wallet
87
+ */
88
+ connect() {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ // Create adapter NOW (first time connect is called)
91
+ if (!this.adapter) {
92
+ this.adapter = this.createAdapter();
93
+ }
94
+ const { adapter } = { adapter: this.adapter };
95
+ // If already connected, return early
96
+ if (adapter.connected) {
97
+ return;
98
+ }
99
+ // Connect to the adapter
100
+ try {
101
+ yield adapter.connect();
102
+ }
103
+ catch (error) {
104
+ throw new DynamicError(`Failed to connect to ${this.name}: ${error}`);
105
+ }
106
+ // Some wallets (Trust, Bitget) populate the address asynchronously after connect()
107
+ // Wait briefly for the address to be populated by the wallet
108
+ const initialAddress = adapter.address;
109
+ const hasNoAddress = !initialAddress ||
110
+ (typeof initialAddress === 'string' && initialAddress.length === 0);
111
+ if (hasNoAddress) {
112
+ // Give the wallet 1000ms to populate the address
113
+ const startTime = Date.now();
114
+ while ((!adapter.address ||
115
+ (typeof adapter.address === 'string' &&
116
+ adapter.address.length === 0)) &&
117
+ Date.now() - startTime < 1000) {
118
+ yield new Promise((resolve) => setTimeout(resolve, 50));
119
+ }
120
+ }
121
+ });
122
+ }
123
+ /**
124
+ * Get the current address
125
+ */
126
+ getAddress() {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ // Create adapter if it doesn't exist yet (defensive against SDK calling getAddress before connect)
129
+ if (!this.adapter) {
130
+ this.adapter = this.createAdapter();
131
+ }
132
+ const { adapter } = { adapter: this.adapter };
133
+ // If adapter exists but isn't connected yet, connect it first
134
+ if (!adapter.connected) {
135
+ try {
136
+ yield adapter.connect();
137
+ // Some wallets (Trust, Bitget) populate the address asynchronously after connect()
138
+ // Wait briefly for the address to be populated by the wallet
139
+ const initialAddress = adapter.address;
140
+ const hasNoAddress = !initialAddress ||
141
+ (typeof initialAddress === 'string' && initialAddress.length === 0);
142
+ if (hasNoAddress) {
143
+ // Give the wallet 1000ms to populate the address
144
+ const startTime = Date.now();
145
+ while ((!adapter.address ||
146
+ (typeof adapter.address === 'string' &&
147
+ adapter.address.length === 0)) &&
148
+ Date.now() - startTime < 1000) {
149
+ yield new Promise((resolve) => setTimeout(resolve, 50));
150
+ }
151
+ }
152
+ }
153
+ catch (error) {
154
+ throw new DynamicError(`Failed to connect to ${this.name}: ${error}`);
155
+ }
156
+ }
157
+ const { address } = adapter;
158
+ // Handle null, undefined, and empty string
159
+ if (!address || address.length === 0) {
160
+ return undefined;
161
+ }
162
+ return address;
163
+ });
164
+ }
165
+ /**
166
+ * Get connected accounts
167
+ */
168
+ getConnectedAccounts() {
169
+ return __awaiter(this, void 0, void 0, function* () {
170
+ const address = yield this.getAddress();
171
+ return address ? [address] : [];
172
+ });
173
+ }
174
+ /**
175
+ * Get the current network with caching to prevent rate limiting
176
+ */
177
+ getNetwork() {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ var _a;
180
+ // Don't create adapter if it doesn't exist yet (prevents initialization crashes)
181
+ if (!this.adapter) {
182
+ return '728126428'; // Mainnet fallback
183
+ }
184
+ // Check cache first (10 second cache for network info)
185
+ if (this.networkCache && Date.now() - this.networkCache.timestamp < 10000) {
186
+ return this.networkCache.network;
187
+ }
188
+ try {
189
+ const networkInfo = yield this.adapter.network();
190
+ const networkStr = convertChainIdToDecimal(networkInfo.chainId);
191
+ // Cache the result
192
+ this.networkCache = {
193
+ network: networkStr,
194
+ timestamp: Date.now(),
195
+ };
196
+ return networkStr;
197
+ }
198
+ catch (error) {
199
+ // Handle rate limiting gracefully
200
+ if (error instanceof Error && error.message.includes('429')) {
201
+ logger.warn(`[${this.name}] Rate limited, returning cached network or mainnet`);
202
+ return ((_a = this.networkCache) === null || _a === void 0 ? void 0 : _a.network) || '728126428'; // Mainnet in decimal format
203
+ }
204
+ // If adapter is not connected, fall back to mainnet
205
+ return '728126428'; // Mainnet in decimal format
206
+ }
207
+ });
208
+ }
209
+ /**
210
+ * Check if current network is testnet
211
+ */
212
+ isTestnet() {
213
+ return __awaiter(this, void 0, void 0, function* () {
214
+ // Don't create adapter if it doesn't exist yet (prevents initialization crashes)
215
+ if (!this.adapter) {
216
+ return false; // Assume mainnet if not connected
217
+ }
218
+ try {
219
+ const networkInfo = yield this.adapter.network();
220
+ // Testnet networkTypes: Shasta, Nile
221
+ return (networkInfo.networkType === 'Shasta' ||
222
+ networkInfo.networkType === 'Nile');
223
+ }
224
+ catch (error) {
225
+ // Handle rate limiting gracefully - assume mainnet (not testnet)
226
+ if (error instanceof Error && error.message.includes('429')) {
227
+ logger.warn(`[${this.name}] Rate limited, assuming mainnet (not testnet)`);
228
+ return false;
229
+ }
230
+ // If adapter is not connected, assume mainnet (not testnet)
231
+ return false;
232
+ }
233
+ });
234
+ }
235
+ /**
236
+ * Sign a message using the adapter
237
+ */
238
+ signMessage(messageToSign) {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ if (!this.adapter) {
241
+ throw new DynamicError('Wallet not connected');
242
+ }
243
+ const { adapter } = { adapter: this.adapter };
244
+ if (!adapter.connected) {
245
+ throw new DynamicError('Wallet not connected');
246
+ }
247
+ try {
248
+ const signature = yield adapter.signMessage(messageToSign);
249
+ return signature;
250
+ }
251
+ catch (error) {
252
+ logger.error(`[${this.name}] Sign message failed:`, error);
253
+ throw new DynamicError(`Failed to sign message: ${error}`);
254
+ }
255
+ });
256
+ }
257
+ /**
258
+ * Get the TronWeb instance from the adapter
259
+ *
260
+ * CRITICAL: Each adapter maintains its own _wallet.tronWeb reference
261
+ * to avoid collision. We access it through the adapter's internal state,
262
+ * NOT through global window objects.
263
+ *
264
+ * This is the key insight from the tronwallet-adapter implementation:
265
+ * - TronLink stores in _wallet (can be window.tronLink or window.tron.tronWeb)
266
+ * - TokenPocket stores in _wallet (from window.tokenpocket.tronWeb)
267
+ * - BitKeep stores in _wallet (from window.bitkeep.tronWeb)
268
+ * - Each adapter handles its own detection and isolation
269
+ */
270
+ getWalletTronWeb() {
271
+ var _a, _b, _c;
272
+ if (!this.adapter) {
273
+ return undefined;
274
+ }
275
+ const adapter = this.adapter;
276
+ // The adapter's internal wallet contains the wallet-specific TronWeb
277
+ // This is the safe way to access it without collisions
278
+ if ((_a = adapter._wallet) === null || _a === void 0 ? void 0 : _a.tronWeb) {
279
+ return adapter._wallet.tronWeb;
280
+ }
281
+ // Some adapters nest it under _wallet.tron.tronWeb
282
+ if ((_c = (_b = adapter._wallet) === null || _b === void 0 ? void 0 : _b.tron) === null || _c === void 0 ? void 0 : _c.tronWeb) {
283
+ return adapter._wallet.tron.tronWeb;
284
+ }
285
+ return undefined;
286
+ }
287
+ /**
288
+ * Get balance of an address with caching to prevent rate limiting
289
+ */
290
+ getBalance(address) {
291
+ return __awaiter(this, void 0, void 0, function* () {
292
+ var _a;
293
+ if (!this.adapter) {
294
+ return '0';
295
+ }
296
+ // Check cache first (5 second cache)
297
+ const cached = this.balanceCache.get(address);
298
+ if (cached && Date.now() - cached.timestamp < 5000) {
299
+ return cached.balance;
300
+ }
301
+ // Get TronWeb from the adapter's internal wallet state
302
+ const tronWeb = this.getWalletTronWeb();
303
+ if (!((_a = tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.trx) === null || _a === void 0 ? void 0 : _a.getBalance)) {
304
+ logger.debug(`[${this.name}] TronWeb not available for balance check`);
305
+ return '0';
306
+ }
307
+ try {
308
+ const balance = yield tronWeb.trx.getBalance(address);
309
+ const balanceStr = (balance / 1000000).toFixed(6); // SUN → TRX
310
+ // Cache the result
311
+ this.balanceCache.set(address, {
312
+ balance: balanceStr,
313
+ timestamp: Date.now(),
314
+ });
315
+ return balanceStr;
316
+ }
317
+ catch (error) {
318
+ // Handle rate limiting gracefully
319
+ if (error instanceof Error && error.message.includes('429')) {
320
+ logger.warn(`[${this.name}] Rate limited, returning cached balance or 0`);
321
+ return (cached === null || cached === void 0 ? void 0 : cached.balance) || '0';
322
+ }
323
+ logger.error(`[${this.name}] Failed to get balance:`, error);
324
+ return '0';
325
+ }
326
+ });
327
+ }
328
+ /**
329
+ * Get enabled networks
330
+ */
331
+ getEnabledNetworks() {
332
+ return this.tronNetworks;
333
+ }
334
+ /**
335
+ * Switch network (must be done in wallet UI)
336
+ */
337
+ switchNetwork() {
338
+ return __awaiter(this, void 0, void 0, function* () {
339
+ throw new DynamicError('Network switching must be done manually in the Tron wallet UI');
340
+ });
341
+ }
342
+ /**
343
+ * Get block explorer URLs for current network
344
+ */
345
+ getBlockExplorerUrlsForCurrentNetwork() {
346
+ return __awaiter(this, void 0, void 0, function* () {
347
+ var _a, _b, _c, _d, _e, _f;
348
+ if (!this.adapter) {
349
+ // If adapter is not connected, return mainnet block explorer URLs
350
+ return ((_b = (_a = this.tronNetworks.find((n) => String(n.chainId) === '728126428')) === null || _a === void 0 ? void 0 : _a.blockExplorerUrls) !== null && _b !== void 0 ? _b : []);
351
+ }
352
+ try {
353
+ const networkInfo = yield this.adapter.network();
354
+ const decimalChainId = convertChainIdToDecimal(networkInfo.chainId);
355
+ return ((_d = (_c = this.tronNetworks.find((n) => String(n.chainId) === decimalChainId)) === null || _c === void 0 ? void 0 : _c.blockExplorerUrls) !== null && _d !== void 0 ? _d : []);
356
+ }
357
+ catch (error) {
358
+ // If adapter is not connected, return mainnet block explorer URLs
359
+ return ((_f = (_e = this.tronNetworks.find((n) => String(n.chainId) === '728126428')) === null || _e === void 0 ? void 0 : _e.blockExplorerUrls) !== null && _f !== void 0 ? _f : []);
360
+ }
361
+ });
362
+ }
363
+ /**
364
+ * Disconnect and cleanup
365
+ */
366
+ endSession() {
367
+ return __awaiter(this, void 0, void 0, function* () {
368
+ var _a;
369
+ if ((_a = this.adapter) === null || _a === void 0 ? void 0 : _a.connected) {
370
+ try {
371
+ yield this.adapter.disconnect();
372
+ }
373
+ catch (error) {
374
+ logger.debug(`[${this.name}] Error during disconnect:`, error);
375
+ }
376
+ }
377
+ // Clear caches on disconnect
378
+ this.balanceCache.clear();
379
+ this.networkCache = null;
380
+ });
381
+ }
382
+ /**
383
+ * Create a UI transaction for the send balance flow
384
+ *
385
+ * @param from - The address sending the transaction
386
+ * @returns A TronUiTransaction instance
387
+ */
388
+ createUiTransaction(from) {
389
+ return __awaiter(this, void 0, void 0, function* () {
390
+ yield this.validateActiveWallet(from);
391
+ // Get TronWeb from the adapter's internal wallet state
392
+ const tronWeb = this.getWalletTronWeb();
393
+ if (!tronWeb) {
394
+ throw new DynamicError('TronWeb not available');
395
+ }
396
+ return new TronUiTransaction({
397
+ from,
398
+ onSubmit: (transaction) => __awaiter(this, void 0, void 0, function* () {
399
+ var _a;
400
+ if (!transaction.to) {
401
+ throw new DynamicError('Destination address is required');
402
+ }
403
+ // Create a minimal wallet instance for sending
404
+ const wallet = new TronWallet({
405
+ address: from,
406
+ chain: 'TRON',
407
+ connector: this,
408
+ id: 'temp-id',
409
+ isAuthenticated: false,
410
+ key: 'temp-key',
411
+ });
412
+ if (transaction.nonNativeAddress && transaction.nonNativeValue) {
413
+ // Handle TRC20 token transfers - not yet implemented
414
+ throw new DynamicError('TRC20 token transfers not yet implemented');
415
+ }
416
+ else if (transaction.value) {
417
+ // Handle native TRX transfers
418
+ const trxAmount = Number(transaction.value) / 1000000; // Convert SUN to TRX
419
+ const result = yield wallet.sendTrx(transaction.to, trxAmount, {
420
+ from,
421
+ });
422
+ return result.txid || ((_a = result.transaction) === null || _a === void 0 ? void 0 : _a.txID);
423
+ }
424
+ throw new DynamicError('Invalid transaction parameters');
425
+ }),
426
+ tronWeb,
427
+ });
428
+ });
429
+ }
430
+ }
431
+
432
+ export { TronWalletAdapterConnector };
@@ -0,0 +1 @@
1
+ export { TronWalletAdapterConnector } from './TronWalletAdapterConnector';
package/src/index.cjs CHANGED
@@ -5,22 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var assertPackageVersion = require('@dynamic-labs/assert-package-version');
7
7
  var _package = require('../package.cjs');
8
- var BitgetTronConnector = require('./connectors/BitgetTronConnector/BitgetTronConnector.cjs');
9
- var OKXTronConnector = require('./connectors/OKXTronConnector/OKXTronConnector.cjs');
10
- var TokenPocketTronConnector = require('./connectors/TokenPocketTronConnector/TokenPocketTronConnector.cjs');
11
- var TrustTronConnector = require('./connectors/TrustTronConnector/TrustTronConnector.cjs');
8
+ var fetchTronWalletAdapterConnectors = require('./utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.cjs');
9
+ var TronWallet = require('./wallet/TronWallet/TronWallet.cjs');
12
10
  var isTronWallet = require('./wallet/isTronWallet/isTronWallet.cjs');
13
- var TronWallet = require('./wallet/TronWallet.cjs');
14
11
 
15
12
  assertPackageVersion.assertPackageVersion('@dynamic-labs/tron', _package.version);
16
- const TronWalletConnectors = () => [
17
- // BybitTronConnector, // Currently Bybit can't sign messages
18
- BitgetTronConnector.BitgetTronConnector,
19
- OKXTronConnector.OKXTronConnector,
20
- TokenPocketTronConnector.TokenPocketTronConnector,
21
- TrustTronConnector.TrustTronConnector,
22
- ];
13
+ const TronWalletConnectors = (props) => [...fetchTronWalletAdapterConnectors.fetchTronWalletAdapterConnectors(props)];
23
14
 
24
- exports.isTronWallet = isTronWallet.isTronWallet;
25
15
  exports.TronWallet = TronWallet.TronWallet;
16
+ exports.isTronWallet = isTronWallet.isTronWallet;
26
17
  exports.TronWalletConnectors = TronWalletConnectors;
package/src/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { BitgetTronConnector } from './connectors/BitgetTronConnector';
2
- export { type ITronProvider, type TronConnectionResult } from './types';
3
- export { type TronWalletConnector } from './connectors/TronWalletConnector';
4
- export { isTronWallet } from './wallet/isTronWallet';
5
1
  export { TronWallet } from './wallet/TronWallet';
6
- export declare const TronWalletConnectors: () => (typeof BitgetTronConnector)[];
2
+ export { isTronWallet } from './wallet/isTronWallet';
3
+ export declare const TronWalletConnectors: (props: {
4
+ walletBook: any;
5
+ tronNetworks: any[];
6
+ }) => import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor[];
package/src/index.js CHANGED
@@ -1,20 +1,11 @@
1
1
  'use client'
2
2
  import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
3
3
  import { version } from '../package.js';
4
- import { BitgetTronConnector } from './connectors/BitgetTronConnector/BitgetTronConnector.js';
5
- import { OKXTronConnector } from './connectors/OKXTronConnector/OKXTronConnector.js';
6
- import { TokenPocketTronConnector } from './connectors/TokenPocketTronConnector/TokenPocketTronConnector.js';
7
- import { TrustTronConnector } from './connectors/TrustTronConnector/TrustTronConnector.js';
4
+ import { fetchTronWalletAdapterConnectors } from './utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.js';
5
+ export { TronWallet } from './wallet/TronWallet/TronWallet.js';
8
6
  export { isTronWallet } from './wallet/isTronWallet/isTronWallet.js';
9
- export { TronWallet } from './wallet/TronWallet.js';
10
7
 
11
8
  assertPackageVersion('@dynamic-labs/tron', version);
12
- const TronWalletConnectors = () => [
13
- // BybitTronConnector, // Currently Bybit can't sign messages
14
- BitgetTronConnector,
15
- OKXTronConnector,
16
- TokenPocketTronConnector,
17
- TrustTronConnector,
18
- ];
9
+ const TronWalletConnectors = (props) => [...fetchTronWalletAdapterConnectors(props)];
19
10
 
20
11
  export { TronWalletConnectors };