Hello everyone! I use this code for sending transaction:
const sendTransactionTron = async (toAddress: string, amountInTrx: number): Promise<void> => {
if (window?.tronWeb) {
try {
await window?.tronWeb?.request({ method: 'tron_requestAccounts' });
if (window?.tronWeb?.ready) {
// Convert TRX to SUN. 1 TRX = 1,000,000 SUN
const amountInSun = Math.floor(amountInTRX * 1e6).toString();
await window.tronWeb?.trx?.sendTransaction(toAddress, amountInSun);
}
} catch (error) {
console.error('Transaction failed or TronLink not available', error);
}
} else {
console.warn('TronLink is not installed');
}
};
If you manually unlock TronLink extension, a transaction window appears and you can perform a transaction. How can I make it so that when the extension is locked, the password appears first, and after entering the password, the transaction window appears?
Hello everyone! I use this code for sending transaction:
If you manually unlock TronLink extension, a transaction window appears and you can perform a transaction. How can I make it so that when the extension is locked, the password appears first, and after entering the password, the transaction window appears?