{"id":30,"date":"2026-07-13T22:32:59","date_gmt":"2026-07-13T22:32:59","guid":{"rendered":"https:\/\/allseeingeye.xyz\/?page_id=30"},"modified":"2026-07-13T22:32:59","modified_gmt":"2026-07-13T22:32:59","slug":"my-rewards-dashboard","status":"publish","type":"page","link":"https:\/\/allseeingeye.xyz\/?page_id=30","title":{"rendered":"My Rewards Dashboard"},"content":{"rendered":"<div class=\"amp-dashboard\" id=\"amp-user-dashboard\">\n\n    <div class=\"amp-card amp-login-prompt\">\n        <div class=\"amp-empty-icon\">\ud83d\udd10<\/div>\n        <h3>Login Required<\/h3>\n        <p>Please log in to view your rewards dashboard and claim your tokens.<\/p>\n        <a href=\"https:\/\/allseeingeye.xyz\/wp-login.php?redirect_to=https%3A%2F%2Fallseeingeye.xyz%2F%3Fpage_id%3D30\" class=\"amp-btn amp-btn-primary amp-btn-lg\">\n            Log In to View Dashboard\n        <\/a>\n    <\/div>\n<\/div><!-- .amp-dashboard -->\n\n<!-- \u2500\u2500 Withdrawal Modal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 -->\n<div id=\"amp-withdraw-modal\" class=\"amp-modal-overlay\" style=\"display:none\" role=\"dialog\" aria-modal=\"true\">\n    <div class=\"amp-modal-box\">\n        <button class=\"amp-modal-close\" id=\"amp-modal-close\" aria-label=\"Close\">&times;<\/button>\n        <h3 class=\"amp-modal-title\">Withdraw <span id=\"amp-modal-ticker-label\"><\/span><\/h3>\n\n        <div class=\"amp-modal-summary\">\n            <div class=\"amp-modal-row\"><span>Balance:<\/span><strong id=\"amp-modal-balance-display\"><\/strong><\/div>\n            <div class=\"amp-modal-row\"><span>Fee:<\/span><span id=\"amp-modal-fee-display\"><\/span><\/div>\n            <div class=\"amp-modal-row amp-modal-net\"><span>You receive:<\/span><strong id=\"amp-modal-net-display\"><\/strong><\/div>\n        <\/div>\n\n        <label class=\"amp-modal-label\">\n            Destination Wallet Address\n            <input type=\"text\" id=\"amp-modal-wallet-input\" class=\"amp-input amp-mt4\"\n                   placeholder=\"Solana base58 address (32\u201344 chars)\"\n                   value=\"\" \/>\n        <\/label>\n\n        <div id=\"amp-modal-feedback\" class=\"amp-feedback\" style=\"display:none\"><\/div>\n\n        <button id=\"amp-modal-confirm\" class=\"amp-btn amp-btn-primary amp-btn-full amp-mt12\">Confirm Withdrawal<\/button>\n        <button id=\"amp-modal-cancel\"  class=\"amp-btn amp-btn-secondary amp-btn-full amp-mt8\">Cancel<\/button>\n\n        <p class=\"amp-hint amp-mt8 amp-text-center\">\n            \u26a1 Withdrawals are processed automatically.        <\/p>\n    <\/div>\n<\/div>\n\n<script>\n(function(){\n    \/\/ Seed config from PHP so the live-refresh never depends on footer script\n    \/\/ order. window.AMP_Wallet (localized on the footer wallet script) overrides\n    \/\/ these once present, but without the defaults cfg.rest_url is empty when this\n    \/\/ script first runs and the dashboard would never refresh.\n    var cfg          = Object.assign({\n        rest_url:     \"https:\\\/\\\/allseeingeye.xyz\\\/index.php?rest_route=\\\/amp\\\/v1\\\/\",\n        nonce:        \"80f047e494\",\n        saved_wallet: \"\",\n        min_withdraw: 10,\n        fee_type:     \"percent\",\n        fee_val:      1    }, window.AMP_Wallet || {});\n    var activeMint   = null;\n    var activeTicker = null;\n    var activeBalance= null;\n\n    function openModal(mint, ticker, balance, net){\n        activeMint    = mint;\n        activeTicker  = ticker;\n        activeBalance = parseFloat(balance);\n        var feeType   = cfg.fee_type || 'flat';\n        var feeVal    = parseFloat(cfg.fee_val || 0);\n        var feeStr    = feeType === 'percent' ? feeVal + '%' : feeVal.toFixed(4) + ' ' + ticker;\n        document.getElementById('amp-modal-ticker-label').textContent     = ticker;\n        document.getElementById('amp-modal-balance-display').textContent  = parseFloat(balance).toFixed(4) + ' ' + ticker;\n        document.getElementById('amp-modal-fee-display').textContent      = feeStr;\n        document.getElementById('amp-modal-net-display').textContent      = parseFloat(net).toFixed(4) + ' ' + ticker;\n        hideFeedback('amp-modal-feedback');\n        document.getElementById('amp-withdraw-modal').style.display = 'flex';\n        document.getElementById('amp-modal-wallet-input').focus();\n    }\n\n    function closeModal(){\n        document.getElementById('amp-withdraw-modal').style.display = 'none';\n        activeMint = null;\n    }\n\n    function showFeedback(id, msg, type){\n        var el = document.getElementById(id);\n        if(!el) return;\n        el.textContent   = msg;\n        el.className     = 'amp-feedback amp-feedback-' + type;\n        el.style.display = 'block';\n    }\n\n    function hideFeedback(id){\n        var el = document.getElementById(id || 'amp-modal-feedback');\n        if(el) el.style.display = 'none';\n    }\n\n    \/\/ Withdraw buttons (delegated so dynamically-refreshed cards keep working)\n    document.addEventListener('click', function(e){\n        var btn = e.target.closest && e.target.closest('.amp-withdraw-btn');\n        if(btn){\n            openModal(btn.dataset.mint, btn.dataset.ticker, btn.dataset.balance, btn.dataset.net);\n        }\n    });\n\n    \/\/ Modal confirm\n    var confirmBtn = document.getElementById('amp-modal-confirm');\n    if(confirmBtn){\n        confirmBtn.addEventListener('click', function(){\n            var wallet = document.getElementById('amp-modal-wallet-input').value.trim();\n            if(!wallet){\n                showFeedback('amp-modal-feedback','Please enter your Solana wallet address.','error');\n                return;\n            }\n            if(!\/^[1-9A-HJ-NP-Za-km-z]{32,44}$\/.test(wallet)){\n                showFeedback('amp-modal-feedback','Invalid wallet address. Must be 32\u201344 base58 characters.','error');\n                return;\n            }\n\n            confirmBtn.disabled    = true;\n            confirmBtn.textContent = '\u23f3 Submitting\u2026';\n            hideFeedback('amp-modal-feedback');\n\n            fetch(cfg.rest_url + 'withdraw', {\n                method: 'POST',\n                headers: { 'Content-Type':'application\/json', 'X-WP-Nonce': cfg.nonce },\n                body: JSON.stringify({ token_mint: activeMint, wallet: wallet })\n            })\n            .then(function(r){ return r.json(); })\n            .then(function(data){\n                confirmBtn.disabled    = false;\n                confirmBtn.textContent = 'Confirm Withdrawal';\n                if(data.success){\n                    showFeedback('amp-modal-feedback', '\u2705 ' + (data.message || 'Request submitted!'), 'success');\n                    if(data.claim_required && data.withdrawal_id){\n                        claimWithdrawal(data.withdrawal_id, confirmBtn, 'amp-modal-feedback', activeMint);\n                    } else {\n                        setTimeout(function(){ closeModal(); location.reload(); }, 2500);\n                    }\n                } else {\n                    showFeedback('amp-modal-feedback', '\u274c ' + (data.message || 'Error. Please try again.'), 'error');\n                }\n            })\n            .catch(function(){\n                confirmBtn.disabled    = false;\n                confirmBtn.textContent = 'Confirm Withdrawal';\n                showFeedback('amp-modal-feedback','\u274c Network error. Please try again.','error');\n            });\n        });\n    }\n\n    async function claimWithdrawal(withdrawalId, button, feedbackId, tokenMint){\n        if(!withdrawalId) return;\n        if(!(window.AMP && window.AMP.wallet && window.AMP.wallet.signAndSendPreparedTransaction)){\n            showFeedback(feedbackId || 'amp-modal-feedback', 'Please wait for the Solana wallet tools to finish loading, then try again.', 'error');\n            return;\n        }\n        var originalLabel = button ? button.textContent : '';\n        if(button){\n            button.disabled = true;\n            button.textContent = 'Preparing claim...';\n        }\n        showFeedback(feedbackId || 'amp-modal-feedback', 'Preparing wallet claim transaction...', 'info');\n        try {\n            var walletAddress = window.AMP.wallet.getAddress ? window.AMP.wallet.getAddress() : '';\n            var mint = tokenMint || (button && button.dataset ? button.dataset.tokenMint : '') || '';\n            var destinationTokenAccount = '';\n            if(walletAddress && mint && window.AMP.wallet.deriveAssociatedTokenAddress){\n                destinationTokenAccount = await window.AMP.wallet.deriveAssociatedTokenAddress(walletAddress, mint);\n            }\n            var response = await fetch(cfg.rest_url + 'withdrawal\/' + encodeURIComponent(withdrawalId) + '\/claim', {\n                method: 'POST',\n                headers: { 'Content-Type':'application\/json', 'X-WP-Nonce': cfg.nonce },\n                body: JSON.stringify({ destination_token_account: destinationTokenAccount })\n            });\n            var data = await response.json();\n            if(!data.transaction){\n                throw new Error(data.message || data.error || 'Claim transaction is not ready yet.');\n            }\n            if(button){ button.textContent = 'Open wallet...'; }\n            showFeedback(feedbackId || 'amp-modal-feedback', 'Approve the claim in your wallet. Your wallet pays network gas; token transfer fees, if any, are taken from the distributed reward.', 'info');\n            var signature = await window.AMP.wallet.signAndSendPreparedTransaction(data.transaction, data.rpc || cfg.rpc);\n            if(!signature) throw new Error('Wallet signature was cancelled.');\n            if(button){ button.textContent = 'Confirming...'; }\n            var doneResponse = await fetch(cfg.rest_url + 'withdrawal\/' + encodeURIComponent(withdrawalId) + '\/claim\/complete', {\n                method: 'POST',\n                headers: { 'Content-Type':'application\/json', 'X-WP-Nonce': cfg.nonce },\n                body: JSON.stringify({ tx_hash: signature })\n            });\n            var done = await doneResponse.json();\n            if(!done.success) throw new Error(done.message || 'Could not record the completed claim.');\n            showFeedback(feedbackId || 'amp-modal-feedback', 'Claim completed. Refreshing your rewards...', 'success');\n            setTimeout(function(){ location.reload(); }, 1800);\n        } catch (err) {\n            if(button){\n                button.disabled = false;\n                button.textContent = originalLabel || 'Claim';\n            }\n            showFeedback(feedbackId || 'amp-modal-feedback', err.message || 'Claim failed. Please try again.', 'error');\n        }\n    }\n\n    document.addEventListener('click', function(e){\n        var btn = e.target.closest && e.target.closest('.amp-claim-withdrawal-btn');\n        if(btn){\n            e.preventDefault();\n            claimWithdrawal(btn.dataset.withdrawalId, btn, 'amp-wallet-feedback', btn.dataset.tokenMint || '');\n        }\n    });\n\n    \/\/ Close modal\n    document.getElementById('amp-modal-close')  ?.addEventListener('click', closeModal);\n    document.getElementById('amp-modal-cancel') ?.addEventListener('click', closeModal);\n    document.getElementById('amp-withdraw-modal')?.addEventListener('click', function(e){ if(e.target===this) closeModal(); });\n\n    \/\/ Wallet buttons\n    function handleConnectWallet(){\n        if(window.AMP && window.AMP.wallet){\n            window.AMP.wallet.connect().then(function(addr){\n                if(addr){ location.reload(); }\n            });\n        } else {\n            var fb = document.getElementById('amp-wallet-feedback');\n            if(fb){ fb.textContent='Please wait, loading wallet\u2026'; fb.className='amp-feedback amp-feedback-info'; fb.style.display='block'; }\n        }\n    }\n\n    document.getElementById('amp-connect-wallet')   ?.addEventListener('click', handleConnectWallet);\n    document.getElementById('amp-change-wallet')    ?.addEventListener('click', handleConnectWallet);\n    document.getElementById('amp-disconnect-wallet')?.addEventListener('click', function(){\n        if(window.AMP && window.AMP.wallet){\n            window.AMP.wallet.disconnect();\n            setTimeout(function(){ location.reload(); }, 500);\n        }\n    });\n\n    \/\/ \u2500\u2500 Real-time rewards refresh \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    \/\/ Keeps \"Pending Rewards\", totals, the daily cap bar, and \"Recent Earnings\"\n    \/\/ accurate without a manual page reload. Refreshes on a timer, when the tab\n    \/\/ regains focus, and instantly when a task is completed in any open tab.\n    var esc = function(s){\n        return String(s == null ? '' : s)\n            .replace(\/&\/g,'&amp;').replace(\/<\/g,'&lt;').replace(\/>\/g,'&gt;')\n            .replace(\/\"\/g,'&quot;').replace(\/'\/g,'&#39;');\n    };\n    var fmt = function(n, dec){\n        return (parseFloat(n)||0).toLocaleString('en-US', {\n            minimumFractionDigits: dec, maximumFractionDigits: dec\n        });\n    };\n\n    function renderAction(card, bal){\n        var ticker = card.getAttribute('data-ticker') || '';\n        var wallet = currentWallet;\n        var minW   = parseFloat(cfg.min_withdraw || 0);\n        var feeType= cfg.fee_type || 'flat';\n        var feeVal = parseFloat(cfg.fee_val || 0);\n        var fee    = feeType === 'percent' ? bal * (feeVal\/100) : feeVal;\n        var net    = Math.max(0, bal - fee);\n        var feeStr = feeType === 'percent' ? (feeVal + '%') : (fmt(feeVal,4) + ' ' + ticker);\n        var box    = card.querySelector('[data-role=\"action\"]');\n        if(!box) return;\n        if(wallet && bal >= minW && minW >= 0 && bal > 0){\n            box.innerHTML =\n                '<div class=\"amp-withdraw-info\">Fee: ' + esc(feeStr) +\n                ' &rarr; Net: <strong>' + fmt(net,4) + '<\/strong><\/div>' +\n                '<button class=\"amp-btn amp-btn-primary amp-mt8 amp-withdraw-btn\" ' +\n                'data-mint=\"' + esc(card.getAttribute('data-mint')) + '\" ' +\n                'data-ticker=\"' + esc(ticker) + '\" ' +\n                'data-balance=\"' + esc(bal) + '\" ' +\n                'data-net=\"' + esc(net.toFixed(9)) + '\">Withdraw ' + esc(ticker) + '<\/button>';\n        } else if(!wallet){\n            box.innerHTML = '<p class=\"amp-hint amp-mt8\">Connect wallet to withdraw<\/p>';\n        } else {\n            box.innerHTML = '<p class=\"amp-hint amp-mt8\">Need ' + fmt(minW,2) + ' ' + esc(ticker) + ' to withdraw<\/p>';\n        }\n    }\n\n    var currentWallet = cfg.saved_wallet || '';\n\n    function applyBalances(data){\n        if(!data) return;\n        currentWallet = data.wallet || currentWallet;\n        var map = data.balance_map || {};\n\n        \/\/ Per-token cards\n        document.querySelectorAll('.amp-balance-card').forEach(function(card){\n            var mint = card.getAttribute('data-mint');\n            var bal  = parseFloat(map[mint] || 0);\n            var amtEl= card.querySelector('[data-role=\"amount\"]');\n            if(amtEl) amtEl.textContent = fmt(bal, 4);\n            renderAction(card, bal);\n        });\n\n        \/\/ Header totals\n        var tp = document.getElementById('amp-total-pending');\n        if(tp && typeof data.total_pending !== 'undefined') tp.textContent = fmt(data.total_pending, 4);\n\n        if(data.daily){\n            var et = document.getElementById('amp-earned-today');\n            if(et) et.textContent = fmt(data.daily.earned, 2);\n            var pctEl  = document.getElementById('amp-cap-pct');\n            var fillEl = document.getElementById('amp-cap-fill');\n            var hintEl = document.getElementById('amp-cap-hint');\n            if(pctEl)  pctEl.textContent  = data.daily.pct + '%';\n            if(fillEl) fillEl.style.width = data.daily.pct + '%';\n            if(hintEl) hintEl.textContent = fmt(data.daily.remaining, 2) + ' tokens remaining today. Resets at midnight.';\n        }\n    }\n\n    function applyHistory(rows){\n        var wrap = document.querySelector('#amp-earnings-card [data-role=\"earnings-content\"]');\n        if(!wrap) return;\n        if(!rows || !rows.length){\n            wrap.innerHTML = '<div class=\"amp-empty-state\"><div class=\"amp-empty-icon\">\ud83c\udfaf<\/div>' +\n                '<p>No earnings yet. Read articles, watch videos, listen to podcasts, leave comments, and share content to earn tokens!<\/p><\/div>';\n            return;\n        }\n        var body = rows.map(function(r){\n            var status = (r.status || 'pending');\n            return '<tr>' +\n                '<td>' + esc(r.task_label || ('Task #' + r.task_id)) + '<\/td>' +\n                '<td class=\"amp-amount-cell\">+' + fmt(r.amount, 4) + '<\/td>' +\n                '<td>' + esc(r.ticker || '') + '<\/td>' +\n                '<td><span class=\"amp-badge amp-badge-' + esc(status) + '\">' +\n                    esc(status.charAt(0).toUpperCase() + status.slice(1)) + '<\/span><\/td>' +\n                '<td class=\"amp-date-cell\">' + esc(r.created_fmt || '') + '<\/td>' +\n            '<\/tr>';\n        }).join('');\n        wrap.innerHTML = '<div class=\"amp-table-wrap\"><table class=\"amp-table\">' +\n            '<thead><tr><th>Task<\/th><th>Amount<\/th><th>Token<\/th><th>Status<\/th><th>Date<\/th><\/tr><\/thead>' +\n            '<tbody data-role=\"earnings-body\">' + body + '<\/tbody><\/table><\/div>';\n    }\n\n    var refreshing = false;\n    function refreshDashboard(){\n        if(refreshing || !cfg.rest_url) return;\n        refreshing = true;\n        var headers = { 'X-WP-Nonce': cfg.nonce };\n        Promise.all([\n            fetch(cfg.rest_url + 'user\/balances', { headers: headers, credentials: 'same-origin' }).then(function(r){ return r.json(); }).catch(function(){ return null; }),\n            fetch(cfg.rest_url + 'user\/history',  { headers: headers, credentials: 'same-origin' }).then(function(r){ return r.json(); }).catch(function(){ return null; })\n        ]).then(function(res){\n            refreshing = false;\n            if(res[0]) applyBalances(res[0]);\n            if(res[1] && res[1].history) applyHistory(res[1].history);\n        }).catch(function(){ refreshing = false; });\n    }\n\n    \/\/ Poll periodically + on focus\/visibility\n    setInterval(refreshDashboard, 15000);\n    window.addEventListener('focus', refreshDashboard);\n    document.addEventListener('visibilitychange', function(){\n        if(document.visibilityState === 'visible') refreshDashboard();\n    });\n\n    \/\/ Instant refresh when a task is completed (this tab or another)\n    window.addEventListener('storage', function(e){\n        if(e.key === 'amp_reward_event') refreshDashboard();\n    });\n    window.addEventListener('amp:reward', refreshDashboard);\n    try {\n        if('BroadcastChannel' in window){\n            var ch = new BroadcastChannel('amp_rewards');\n            ch.onmessage = function(){ refreshDashboard(); };\n        }\n    } catch(e) { \/* ignore *\/ }\n\n    \/\/ Pull fresh numbers shortly after load so the dashboard is always current.\n    setTimeout(refreshDashboard, 1500);\n})();\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-30","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/allseeingeye.xyz\/index.php?rest_route=\/wp\/v2\/pages\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/allseeingeye.xyz\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/allseeingeye.xyz\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/allseeingeye.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/allseeingeye.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=30"}],"version-history":[{"count":0,"href":"https:\/\/allseeingeye.xyz\/index.php?rest_route=\/wp\/v2\/pages\/30\/revisions"}],"wp:attachment":[{"href":"https:\/\/allseeingeye.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}