@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.
- package/CHANGELOG.md +13 -0
- package/README.md +264 -20
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -6
- package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.cjs +436 -0
- package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.d.ts +115 -0
- package/src/connectors/TronWalletAdapterConnector/TronWalletAdapterConnector.js +432 -0
- package/src/connectors/TronWalletAdapterConnector/index.d.ts +1 -0
- package/src/index.cjs +4 -13
- package/src/index.d.ts +5 -5
- package/src/index.js +3 -12
- package/src/types.d.ts +11 -181
- package/src/utils/TronUiTransaction/TronUiTransaction.cjs +67 -26
- package/src/utils/TronUiTransaction/TronUiTransaction.d.ts +38 -5
- package/src/utils/TronUiTransaction/TronUiTransaction.js +67 -26
- package/src/utils/convertChainIdToDecimal/convertChainIdToDecimal.cjs +16 -0
- package/src/utils/convertChainIdToDecimal/convertChainIdToDecimal.d.ts +9 -0
- package/src/utils/convertChainIdToDecimal/convertChainIdToDecimal.js +12 -0
- package/src/utils/convertChainIdToDecimal/index.d.ts +1 -0
- package/src/utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.cjs +80 -0
- package/src/utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.d.ts +35 -0
- package/src/utils/fetchTronWalletAdapterConnectors/fetchTronWalletAdapterConnectors.js +75 -0
- package/src/utils/fetchTronWalletAdapterConnectors/index.d.ts +1 -0
- package/src/utils/getTronGasEstimation/getTronGasEstimation.cjs +162 -0
- package/src/utils/getTronGasEstimation/getTronGasEstimation.d.ts +49 -0
- package/src/utils/getTronGasEstimation/getTronGasEstimation.js +158 -0
- package/src/utils/getTronGasEstimation/index.d.ts +1 -0
- package/src/utils/index.d.ts +1 -4
- package/src/wallet/TronWallet/TronWallet.cjs +124 -0
- package/src/wallet/TronWallet/TronWallet.d.ts +51 -0
- package/src/wallet/TronWallet/TronWallet.js +120 -0
- package/src/wallet/TronWallet/index.d.ts +1 -0
- package/src/connectors/BitgetTronConnector/BitgetTronConnector.cjs +0 -20
- package/src/connectors/BitgetTronConnector/BitgetTronConnector.d.ts +0 -7
- package/src/connectors/BitgetTronConnector/BitgetTronConnector.js +0 -16
- package/src/connectors/BitgetTronConnector/index.d.ts +0 -1
- package/src/connectors/BybitTronConnector/BybitTronConnector.d.ts +0 -7
- package/src/connectors/BybitTronConnector/index.d.ts +0 -1
- package/src/connectors/OKXTronConnector/OKXTronConnector.cjs +0 -20
- package/src/connectors/OKXTronConnector/OKXTronConnector.d.ts +0 -7
- package/src/connectors/OKXTronConnector/OKXTronConnector.js +0 -16
- package/src/connectors/OKXTronConnector/index.d.ts +0 -1
- package/src/connectors/TokenPocketTronConnector/TokenPocketTronConnector.cjs +0 -28
- package/src/connectors/TokenPocketTronConnector/TokenPocketTronConnector.d.ts +0 -7
- package/src/connectors/TokenPocketTronConnector/TokenPocketTronConnector.js +0 -24
- package/src/connectors/TokenPocketTronConnector/index.d.ts +0 -1
- package/src/connectors/TronWalletConnector/TronWalletConnector.cjs +0 -255
- package/src/connectors/TronWalletConnector/TronWalletConnector.d.ts +0 -42
- package/src/connectors/TronWalletConnector/TronWalletConnector.js +0 -251
- package/src/connectors/TronWalletConnector/index.d.ts +0 -1
- package/src/connectors/TrustTronConnector/TrustTronConnector.cjs +0 -31
- package/src/connectors/TrustTronConnector/TrustTronConnector.d.ts +0 -7
- package/src/connectors/TrustTronConnector/TrustTronConnector.js +0 -27
- package/src/connectors/TrustTronConnector/index.d.ts +0 -1
- package/src/utils/detectTronNetworkFromProvider.cjs +0 -67
- package/src/utils/detectTronNetworkFromProvider.d.ts +0 -30
- package/src/utils/detectTronNetworkFromProvider.js +0 -62
- package/src/utils/getDefaultTronNetworks.cjs +0 -60
- package/src/utils/getDefaultTronNetworks.d.ts +0 -9
- package/src/utils/getDefaultTronNetworks.js +0 -53
- package/src/utils/getTronGasEstimation.cjs +0 -136
- package/src/utils/getTronGasEstimation.d.ts +0 -47
- package/src/utils/getTronGasEstimation.js +0 -129
- package/src/utils/provider.cjs +0 -59
- package/src/utils/provider.d.ts +0 -24
- package/src/utils/provider.js +0 -53
- package/src/wallet/TronWallet.cjs +0 -106
- package/src/wallet/TronWallet.d.ts +0 -22
- package/src/wallet/TronWallet.js +0 -102
- package/src/wallet/index.d.ts +0 -2
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
|
|
10
|
+
class TronWallet extends walletConnectorCore.Wallet {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get TronWeb instance from the connected wallet
|
|
16
|
+
*/
|
|
17
|
+
getTronWeb() {
|
|
18
|
+
// Access the wallet-specific TronWeb through the connector
|
|
19
|
+
const connectorWithMethod = this._connector;
|
|
20
|
+
if (connectorWithMethod.getWalletTronWeb) {
|
|
21
|
+
return connectorWithMethod.getWalletTronWeb();
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sign a message
|
|
27
|
+
*/
|
|
28
|
+
signMessage(message) {
|
|
29
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
31
|
+
const signature = yield this._connector.signMessage(messageString);
|
|
32
|
+
if (signature === undefined || signature === '') {
|
|
33
|
+
throw new utils.DynamicError('Failed to sign message');
|
|
34
|
+
}
|
|
35
|
+
return signature;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get balance of an address
|
|
40
|
+
*/
|
|
41
|
+
getBalance(address) {
|
|
42
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const targetAddress = address || this.address;
|
|
44
|
+
return this._connector.getBalance(targetAddress);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Send balance (sends TRX)
|
|
49
|
+
*/
|
|
50
|
+
sendBalance(_a) {
|
|
51
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
52
|
+
const result = yield this.sendTrx(toAddress, Number(amount));
|
|
53
|
+
return result.txid;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Send TRX to an address
|
|
58
|
+
*
|
|
59
|
+
* @param to - Recipient address
|
|
60
|
+
* @param amount - Amount in TRX
|
|
61
|
+
* @param options - Optional parameters
|
|
62
|
+
* @returns Transaction result
|
|
63
|
+
*/
|
|
64
|
+
sendTrx(to, amount, options) {
|
|
65
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
var _a;
|
|
67
|
+
const tronWeb = this.getTronWeb();
|
|
68
|
+
if (!((_a = tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.trx) === null || _a === void 0 ? void 0 : _a.sendTransaction)) {
|
|
69
|
+
throw new utils.DynamicError('TRX transfer not supported');
|
|
70
|
+
}
|
|
71
|
+
const fromAddress = (options === null || options === void 0 ? void 0 : options.from) || this.address;
|
|
72
|
+
const amountInSun = tronWeb.toSun(amount);
|
|
73
|
+
return tronWeb.trx.sendTransaction(to, Number(amountInSun), {
|
|
74
|
+
address: fromAddress,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get TRC20 token balance
|
|
80
|
+
*
|
|
81
|
+
* @param tokenId - Token contract address
|
|
82
|
+
* @param address - Optional address (defaults to current account)
|
|
83
|
+
* @returns Token balance
|
|
84
|
+
*/
|
|
85
|
+
getTokenBalance(tokenId, address) {
|
|
86
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const tronWeb = this.getTronWeb();
|
|
88
|
+
if (!(tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.contract)) {
|
|
89
|
+
throw new utils.DynamicError('TRC20 token operations not supported by this wallet');
|
|
90
|
+
}
|
|
91
|
+
const targetAddress = address || this.address;
|
|
92
|
+
try {
|
|
93
|
+
const contract = yield tronWeb.contract().at(tokenId);
|
|
94
|
+
const balance = yield contract.balanceOf(targetAddress).call();
|
|
95
|
+
return typeof balance === 'string'
|
|
96
|
+
? parseInt(balance, 10)
|
|
97
|
+
: Number(balance);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
throw new utils.DynamicError(`Failed to get TRC20 token balance: ${error}`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get network details
|
|
106
|
+
*/
|
|
107
|
+
getNetworkDetails() {
|
|
108
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const chainId = yield this._connector.getNetwork();
|
|
110
|
+
// Map chain IDs to network names
|
|
111
|
+
const networkMap = {
|
|
112
|
+
'0x2b6653dc': 'Mainnet',
|
|
113
|
+
'0x94a9059e': 'Shasta Testnet',
|
|
114
|
+
'0xcd8690dc': 'Nile Testnet',
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
chainId: chainId || '0x2b6653dc', // default to mainnet
|
|
118
|
+
name: networkMap[chainId || '0x2b6653dc'] || 'Unknown',
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
exports.TronWallet = TronWallet;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { TronWeb, Types } from 'tronweb';
|
|
2
|
+
import { Wallet, WalletProps } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import type { TronWalletAdapterConnector } from '../../connectors/TronWalletAdapterConnector/TronWalletAdapterConnector';
|
|
4
|
+
export declare class TronWallet extends Wallet<TronWalletAdapterConnector> {
|
|
5
|
+
constructor(props: WalletProps<TronWalletAdapterConnector>);
|
|
6
|
+
/**
|
|
7
|
+
* Get TronWeb instance from the connected wallet
|
|
8
|
+
*/
|
|
9
|
+
getTronWeb(): TronWeb | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Sign a message
|
|
12
|
+
*/
|
|
13
|
+
signMessage(message: string | Uint8Array): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Get balance of an address
|
|
16
|
+
*/
|
|
17
|
+
getBalance(address?: string): Promise<string | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Send balance (sends TRX)
|
|
20
|
+
*/
|
|
21
|
+
sendBalance({ amount, toAddress, }: {
|
|
22
|
+
amount: string;
|
|
23
|
+
toAddress: string;
|
|
24
|
+
}): Promise<string | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Send TRX to an address
|
|
27
|
+
*
|
|
28
|
+
* @param to - Recipient address
|
|
29
|
+
* @param amount - Amount in TRX
|
|
30
|
+
* @param options - Optional parameters
|
|
31
|
+
* @returns Transaction result
|
|
32
|
+
*/
|
|
33
|
+
sendTrx(to: string, amount: number, options?: {
|
|
34
|
+
from?: string;
|
|
35
|
+
}): Promise<Types.BroadcastReturn<Types.SignedTransaction>>;
|
|
36
|
+
/**
|
|
37
|
+
* Get TRC20 token balance
|
|
38
|
+
*
|
|
39
|
+
* @param tokenId - Token contract address
|
|
40
|
+
* @param address - Optional address (defaults to current account)
|
|
41
|
+
* @returns Token balance
|
|
42
|
+
*/
|
|
43
|
+
getTokenBalance(tokenId: string, address?: string): Promise<number>;
|
|
44
|
+
/**
|
|
45
|
+
* Get network details
|
|
46
|
+
*/
|
|
47
|
+
getNetworkDetails(): Promise<{
|
|
48
|
+
chainId: string;
|
|
49
|
+
name: string;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
+
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
|
|
6
|
+
class TronWallet extends Wallet {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get TronWeb instance from the connected wallet
|
|
12
|
+
*/
|
|
13
|
+
getTronWeb() {
|
|
14
|
+
// Access the wallet-specific TronWeb through the connector
|
|
15
|
+
const connectorWithMethod = this._connector;
|
|
16
|
+
if (connectorWithMethod.getWalletTronWeb) {
|
|
17
|
+
return connectorWithMethod.getWalletTronWeb();
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Sign a message
|
|
23
|
+
*/
|
|
24
|
+
signMessage(message) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const messageString = typeof message === 'string' ? message : new TextDecoder().decode(message);
|
|
27
|
+
const signature = yield this._connector.signMessage(messageString);
|
|
28
|
+
if (signature === undefined || signature === '') {
|
|
29
|
+
throw new DynamicError('Failed to sign message');
|
|
30
|
+
}
|
|
31
|
+
return signature;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get balance of an address
|
|
36
|
+
*/
|
|
37
|
+
getBalance(address) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const targetAddress = address || this.address;
|
|
40
|
+
return this._connector.getBalance(targetAddress);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Send balance (sends TRX)
|
|
45
|
+
*/
|
|
46
|
+
sendBalance(_a) {
|
|
47
|
+
return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
48
|
+
const result = yield this.sendTrx(toAddress, Number(amount));
|
|
49
|
+
return result.txid;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Send TRX to an address
|
|
54
|
+
*
|
|
55
|
+
* @param to - Recipient address
|
|
56
|
+
* @param amount - Amount in TRX
|
|
57
|
+
* @param options - Optional parameters
|
|
58
|
+
* @returns Transaction result
|
|
59
|
+
*/
|
|
60
|
+
sendTrx(to, amount, options) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a;
|
|
63
|
+
const tronWeb = this.getTronWeb();
|
|
64
|
+
if (!((_a = tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.trx) === null || _a === void 0 ? void 0 : _a.sendTransaction)) {
|
|
65
|
+
throw new DynamicError('TRX transfer not supported');
|
|
66
|
+
}
|
|
67
|
+
const fromAddress = (options === null || options === void 0 ? void 0 : options.from) || this.address;
|
|
68
|
+
const amountInSun = tronWeb.toSun(amount);
|
|
69
|
+
return tronWeb.trx.sendTransaction(to, Number(amountInSun), {
|
|
70
|
+
address: fromAddress,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get TRC20 token balance
|
|
76
|
+
*
|
|
77
|
+
* @param tokenId - Token contract address
|
|
78
|
+
* @param address - Optional address (defaults to current account)
|
|
79
|
+
* @returns Token balance
|
|
80
|
+
*/
|
|
81
|
+
getTokenBalance(tokenId, address) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const tronWeb = this.getTronWeb();
|
|
84
|
+
if (!(tronWeb === null || tronWeb === void 0 ? void 0 : tronWeb.contract)) {
|
|
85
|
+
throw new DynamicError('TRC20 token operations not supported by this wallet');
|
|
86
|
+
}
|
|
87
|
+
const targetAddress = address || this.address;
|
|
88
|
+
try {
|
|
89
|
+
const contract = yield tronWeb.contract().at(tokenId);
|
|
90
|
+
const balance = yield contract.balanceOf(targetAddress).call();
|
|
91
|
+
return typeof balance === 'string'
|
|
92
|
+
? parseInt(balance, 10)
|
|
93
|
+
: Number(balance);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw new DynamicError(`Failed to get TRC20 token balance: ${error}`);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get network details
|
|
102
|
+
*/
|
|
103
|
+
getNetworkDetails() {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const chainId = yield this._connector.getNetwork();
|
|
106
|
+
// Map chain IDs to network names
|
|
107
|
+
const networkMap = {
|
|
108
|
+
'0x2b6653dc': 'Mainnet',
|
|
109
|
+
'0x94a9059e': 'Shasta Testnet',
|
|
110
|
+
'0xcd8690dc': 'Nile Testnet',
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
chainId: chainId || '0x2b6653dc', // default to mainnet
|
|
114
|
+
name: networkMap[chainId || '0x2b6653dc'] || 'Unknown',
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { TronWallet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TronWallet } from './TronWallet';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var TronWalletConnector = require('../TronWalletConnector/TronWalletConnector.cjs');
|
|
7
|
-
|
|
8
|
-
class BitgetTronConnector extends TronWalletConnector.TronWalletConnector {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.name = 'Bitget Wallet';
|
|
12
|
-
this.overrideKey = 'bitgettron';
|
|
13
|
-
}
|
|
14
|
-
getProvider() {
|
|
15
|
-
var _a;
|
|
16
|
-
return (_a = window.bitkeep) === null || _a === void 0 ? void 0 : _a.tron;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exports.BitgetTronConnector = BitgetTronConnector;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ITronProvider } from '../../types';
|
|
2
|
-
import { TronWalletConnector } from '../TronWalletConnector';
|
|
3
|
-
export declare class BitgetTronConnector extends TronWalletConnector {
|
|
4
|
-
name: string;
|
|
5
|
-
overrideKey: string;
|
|
6
|
-
getProvider(): ITronProvider | undefined;
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { TronWalletConnector } from '../TronWalletConnector/TronWalletConnector.js';
|
|
3
|
-
|
|
4
|
-
class BitgetTronConnector extends TronWalletConnector {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.name = 'Bitget Wallet';
|
|
8
|
-
this.overrideKey = 'bitgettron';
|
|
9
|
-
}
|
|
10
|
-
getProvider() {
|
|
11
|
-
var _a;
|
|
12
|
-
return (_a = window.bitkeep) === null || _a === void 0 ? void 0 : _a.tron;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { BitgetTronConnector };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BitgetTronConnector } from './BitgetTronConnector';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ITronProvider } from '../../types';
|
|
2
|
-
import { TronWalletConnector } from '../TronWalletConnector';
|
|
3
|
-
export declare class BybitTronConnector extends TronWalletConnector {
|
|
4
|
-
name: string;
|
|
5
|
-
overrideKey: string;
|
|
6
|
-
getProvider(): ITronProvider | undefined;
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BybitTronConnector } from './BybitTronConnector';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var TronWalletConnector = require('../TronWalletConnector/TronWalletConnector.cjs');
|
|
7
|
-
|
|
8
|
-
class OKXTronConnector extends TronWalletConnector.TronWalletConnector {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.name = 'OKX Wallet';
|
|
12
|
-
this.overrideKey = 'okxtron';
|
|
13
|
-
}
|
|
14
|
-
getProvider() {
|
|
15
|
-
var _a;
|
|
16
|
-
return (_a = window.okxwallet) === null || _a === void 0 ? void 0 : _a.tronLink;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exports.OKXTronConnector = OKXTronConnector;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ITronProvider } from '../../types';
|
|
2
|
-
import { TronWalletConnector } from '../TronWalletConnector';
|
|
3
|
-
export declare class OKXTronConnector extends TronWalletConnector {
|
|
4
|
-
name: string;
|
|
5
|
-
overrideKey: string;
|
|
6
|
-
getProvider(): ITronProvider | undefined;
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { TronWalletConnector } from '../TronWalletConnector/TronWalletConnector.js';
|
|
3
|
-
|
|
4
|
-
class OKXTronConnector extends TronWalletConnector {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.name = 'OKX Wallet';
|
|
8
|
-
this.overrideKey = 'okxtron';
|
|
9
|
-
}
|
|
10
|
-
getProvider() {
|
|
11
|
-
var _a;
|
|
12
|
-
return (_a = window.okxwallet) === null || _a === void 0 ? void 0 : _a.tronLink;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { OKXTronConnector };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { OKXTronConnector } from './OKXTronConnector';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var TronWalletConnector = require('../TronWalletConnector/TronWalletConnector.cjs');
|
|
7
|
-
require('../../../_virtual/_tslib.cjs');
|
|
8
|
-
require('@dynamic-labs/utils');
|
|
9
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
-
var detectTronNetworkFromProvider = require('../../utils/detectTronNetworkFromProvider.cjs');
|
|
11
|
-
|
|
12
|
-
class TokenPocketTronConnector extends TronWalletConnector.TronWalletConnector {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.name = 'TokenPocket';
|
|
16
|
-
this.overrideKey = 'tokenpockettron';
|
|
17
|
-
}
|
|
18
|
-
getProvider() {
|
|
19
|
-
var _a;
|
|
20
|
-
const provider = (_a = window.tokenpocket) === null || _a === void 0 ? void 0 : _a.tron;
|
|
21
|
-
if (!provider) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
return detectTronNetworkFromProvider.detectTronNetworkFromProvider(provider);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
exports.TokenPocketTronConnector = TokenPocketTronConnector;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ITronProvider } from '../../types';
|
|
2
|
-
import { TronWalletConnector } from '../TronWalletConnector';
|
|
3
|
-
export declare class TokenPocketTronConnector extends TronWalletConnector {
|
|
4
|
-
name: string;
|
|
5
|
-
overrideKey: string;
|
|
6
|
-
getProvider(): ITronProvider | undefined;
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { TronWalletConnector } from '../TronWalletConnector/TronWalletConnector.js';
|
|
3
|
-
import '../../../_virtual/_tslib.js';
|
|
4
|
-
import '@dynamic-labs/utils';
|
|
5
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { detectTronNetworkFromProvider } from '../../utils/detectTronNetworkFromProvider.js';
|
|
7
|
-
|
|
8
|
-
class TokenPocketTronConnector extends TronWalletConnector {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.name = 'TokenPocket';
|
|
12
|
-
this.overrideKey = 'tokenpockettron';
|
|
13
|
-
}
|
|
14
|
-
getProvider() {
|
|
15
|
-
var _a;
|
|
16
|
-
const provider = (_a = window.tokenpocket) === null || _a === void 0 ? void 0 : _a.tron;
|
|
17
|
-
if (!provider) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
return detectTronNetworkFromProvider(provider);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { TokenPocketTronConnector };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TokenPocketTronConnector } from './TokenPocketTronConnector';
|