Seguinte

<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>VTron - VoiD Tron Wallet</title>
    <!-- Link para o arquivo CSS refinado -->
    <link rel="stylesheet" href="/static/style.css">
    <!-- Link para a biblioteca de ícones FontAwesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <!-- Link para a biblioteca Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
    <!-- Barra Lateral -->
    <aside>
        <div class="logo">
            <i class="fas fa-wallet fa-2x"></i>
            <h2>VTron</h2>
        </div>
        <nav>
            <button id="btn_login" onclick="showSection('login')" class="nav-button">
                <i class="fas fa-sign-in-alt"></i>
                Login
            </button>
            <button id="btn_dashboard" onclick="showSection('dashboard')" disabled class="nav-button">
                <i class="fas fa-tachometer-alt"></i>
                Dashboard
            </button>
            <button id="btn_bot" onclick="showSection('bot')" disabled class="nav-button">
                <i class="fas fa-robot"></i>
                SR Voting Bot
            </button>
        </nav>
    </aside>

    <!-- Conteúdo Principal -->
    <div class="main-content">
        <!-- Seção de Login -->
        <section id="login_section" class="section active">
            <div class="card">
                <h1><i class="fas fa-wallet"></i> VTron - VoiD Tron</h1>
                <h2>Faça Login na Sua Carteira</h2>
                <form>
                    <input id="wallet_address" type="text" placeholder="Endereço da Carteira" required>
                    <input id="private_key" type="password" placeholder="Chave Privada" required>
                    <button type="button" onclick="login()">Entrar</button>
                </form>
                <p class="error" id="login_error"></p>
            </div>
        </section>

        <!-- Seção do Dashboard -->
        <section id="dashboard_section" class="section">
            <div class="card">
                <h2><i class="fas fa-tachometer-alt"></i> Dashboard</h2>
                <div class="stats">
                    <div class="stat-card">
                        <i class="fas fa-balance-scale"></i>
                        <p><strong>Saldo:</strong> <span id="balance"></span> TRX</p>
                    </div>
                    <div class="stat-card">
                        <i class="fas fa-chart-line"></i>
                        <p><strong>Investido:</strong> <span id="invested_amount"></span> TRX</p>
                    </div>
                    <div class="stat-card">
                        <i class="fas fa-dollar-sign"></i>
                        <p><strong>Renda Passiva (Hoje):</strong> <span id="daily_income"></span> TRX</p>
                    </div>
                    <div class="stat-card">
                        <i class="fas fa-clipboard-check"></i>
                        <p><strong>Total Acumulado:</strong> <span id="total_acumulado"></span> TRX</p>
                    </div>
                </div>
                <!-- Gráfico adicionado -->
                <div class="chart-container">
                    <canvas id="balanceChart"></canvas>
                </div>

                <div class="buttons">
                    <button onclick="toggleSendTrx()"><i class="fas fa-paper-plane"></i> Enviar TRX</button>
                    <button onclick="toggleBotSettings()"><i class="fas fa-cogs"></i> Gerenciar Bot</button>
                </div>

                <!-- Seção Enviar TRX -->
                <div id="send_trx_section" class="sub-section" style="display: none;">
                    <h3><i class="fas fa-paper-plane"></i> Enviar TRX</h3>
                    <form>
                        <input id="send_to_address" type="text" placeholder="Endereço de Destino" required>
                        <input id="send_amount" type="number" placeholder="Quantidade em TRX" required>
                        <button type="button" onclick="sendTrx()">Enviar</button>
                    </form>
                    <p id="send_result" class="result"></p>
                </div>
            </div>
        </section>

        <!-- Seção de Configuração do Bot -->
        <section id="bot_section" class="section" style="display: none;">
            <div class="card">
                <h2><i class="fas fa-robot"></i> Configurar SR Voting Bot</h2>
                <form>
                    <input id="bot_investment_amount" type="number" placeholder="Valor a Investir em TRX">
                    <div class="bot-buttons">
                        <button type="button" onclick="startBot()"><i class="fas fa-play"></i> Iniciar Bot</button>
                        <button type="button" onclick="stopBot()"><i class="fas fa-stop"></i> Parar Bot</button>
                    </div>
                </form>
                <p id="bot_status" class="result"></p>
            </div>
        </section>
    </div>

    <!-- Link para o arquivo JavaScript -->
    <script src="/static/script.js"></script>
</body>
</html>

let wallet_address = '';
let private_key = '';
let botActive = false;

// Função para exibir a seção selecionada
function showSection(section) {
    document.querySelectorAll('.section').forEach(sec => {
        sec.classList.remove('active');
    });
    document.getElementById(`${section}_section`).classList.add('active');
}

// Função de Login
async function login() {
    wallet_address = document.getElementById("wallet_address").value.trim();
    private_key = document.getElementById("private_key").value.trim();

    if (!wallet_address || !private_key) {
        document.getElementById("login_error").textContent = "Ambos os campos são obrigatórios!";
        return;
    }

    // Enviar requisição de login
    const response = await fetch("/login", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ wallet_address, private_key })
    });
    const result = await response.json();
    if (response.ok) {
        document.getElementById("login_error").textContent = "";
        document.getElementById("btn_login").disabled = true;
        document.getElementById("btn_dashboard").disabled = false;
        document.getElementById("btn_bot").disabled = false;
        showSection('dashboard');
        atualizarDashboard();
    } else {
        document.getElementById("login_error").textContent = result.error;
    }
}

// Atualizar Dashboard
async function atualizarDashboard() {
    const response = await fetch("/dashboard", {
        method: "GET",
        headers: { "Content-Type": "application/json" }
    });
    const result = await response.json();
    if (response.ok) {
        // Exibição dos valores no formato TRX 1.00000000
        const balance = parseFloat(result.balance).toFixed(8);
        const invested = parseFloat(result.invested).toFixed(8);
        const daily_income = parseFloat(result.daily_income).toFixed(8);
        const total = parseFloat(result.total).toFixed(8);

        document.getElementById("balance").textContent = balance;
        document.getElementById("invested_amount").textContent = invested;
        document.getElementById("daily_income").textContent = daily_income;
        document.getElementById("total_acumulado").textContent = total;

        // Atualizar gráfico
        atualizarGrafico([balance, invested, daily_income, total]);
    } else {
        alert(result.error);
    }
}

// Toggle Enviar TRX
function toggleSendTrx() {
    const section = document.getElementById("send_trx_section");
    if (section.style.display === "none" || section.style.display === "") {
        section.style.display = "block";
    } else {
        section.style.display = "none";
    }
}

// Enviar TRX
async function sendTrx() {
    const to_address = document.getElementById("send_to_address").value.trim();
    const amount = document.getElementById("send_amount").value.trim();

    if (!to_address || !amount) {
        alert("Todos os campos são obrigatórios!");
        return;
    }

    // Enviar requisição para enviar TRX
    const response = await fetch("/send_trx", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ to_address, amount })
    });

    const result = await response.json();
    if (response.ok) {
        document.getElementById("send_result").textContent = result.message;
        atualizarDashboard();
    } else {
        document.getElementById("send_result").textContent = result.error;
    }
}

// Gerenciar Bot
function toggleBotSettings() {
    showSection('bot');
}

// Iniciar Bot
async function startBot() {
    const amount = document.getElementById("bot_investment_amount").value.trim();
    if (!amount) {
        document.getElementById("bot_status").textContent = "Por favor, insira um valor para investir!";
        return;
    }

    const response = await fetch("/start_bot", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ amount })
    });

    const result = await response.json();
    if (response.ok) {
        document.getElementById("bot_status").textContent = result.message;
        botActive = true;
    } else {
        document.getElementById("bot_status").textContent = result.error;
    }
}

// Parar Bot
async function stopBot() {
    const response = await fetch("/stop_bot", {
        method: "POST",
        headers: { "Content-Type": "application/json" }
    });

    const result = await response.json();
    if (response.ok) {
        document.getElementById("bot_status").textContent = result.message;
        botActive = false;
    } else {
        document.getElementById("bot_status").textContent = result.error;
    }
}

// Atualizar Gráfico
let balanceChart;
function atualizarGrafico(data) {
    const ctx = document.getElementById('balanceChart').getContext('2d');
    if (balanceChart) {
        balanceChart.data.datasets[0].data = data;
        balanceChart.update();
    } else {
        balanceChart = new Chart(ctx, {
            type: 'bar',
            data: {
                labels: ['Saldo', 'Investido', 'Renda Passiva (Hoje)', 'Total Acumulado'],
                datasets: [{
                    label: 'TRX',
                    data: data,
                    backgroundColor: [
                        '#8A2BE2',
                        '#6A0DAD',
                        '#4B0082',
                        '#2E0854'
                    ]
                }]
            },
            options: {
                responsive: true,
                scales: {
                    y: {
                        beginAtZero: true
                    }
                }
            }
        });
    }
}

crie um arquivo carteira.py que usa as informações da api tronscan 'https://apilist.tronscanapi.com/api/account/wallet?address={wallet_address}&asset_type=0' que esta no formato "
{
  "data": [
    {
      "token_price_in_usd": "0.197777",
      "frozen_token_value_in_usd": "0",
      "level": 2,
      "frozen": 0,
      "token_value": "11.504848",
      "token_type": 0,
      "token_price": "1",
      "token_decimal": 6,
      "token_value_in_usd": "2.275394",
      "frozenV2": 1,
      "token_id": "_",
      "token_abbr": "trx",
      "balance": "11.504848",
      "frozenV2_token_value_in_usd": "0.197777",
      "token_name": "trx",
      "pair_id": 48,
      "vip": false,
      "token_url": "https://static.tronscan.org/production/logo/trx.png"
    }
  ],
  "count": 1
}
"
e crie @app.route para cada coisa que o html esta pedindo as preenchendo com as informações da api. 
A carteira.py vai armazenar wallet_address e private_key da tela de login para usar durante a sessão do usuario facilitando assim o envio de trx e as permiçoes do bot futuramente.
mas agora vamos apenas focar em ser eficiente no arquivo carteira.py obtendo as informações necessarias