diff --git a/extension/app.js b/extension/app.js index 67c058a..e0dc855 100644 --- a/extension/app.js +++ b/extension/app.js @@ -1,18 +1,23 @@ 'use strict'; const descriptions = { - Nostr: 'Identities, events, and relays.', - Wallet: 'BTC accounts, balances, and transaction review.', - Inscribe: 'Content and inscription transaction preparation.', - Chain: 'Chain inspection and isolated test-network experiments.' + Wallet: 'Address, signing requests, and transaction approval.', + Inscribe: 'Approve commit/reveal inscription transactions prepared by a page.', + Nostr: 'Identities, events, and relays come after the wallet boundary is proven.', + Chain: 'Full chain inspection lives on the Super Testnet page.' }; const buttons = document.querySelectorAll('[data-feature]'); -for (const button of buttons) { - button.addEventListener('click', () => { - const feature = button.dataset.feature; - document.querySelector('#feature').textContent = feature; - document.querySelector('#description').textContent = descriptions[feature]; - for (const candidate of buttons) { - candidate.setAttribute('aria-pressed', String(candidate === button)); - } - }); -} +for (const button of buttons) button.addEventListener('click', () => { + const feature=button.dataset.feature; + document.querySelector('#feature').textContent=feature; + document.querySelector('#description').textContent=descriptions[feature]; + for(const candidate of buttons) candidate.setAttribute('aria-pressed',String(candidate===button)); +}); +const port=chrome.runtime.connect({name:'inscriboor-provider'}); +port.onMessage.addListener(message=>{ + if(message.id!=='popup-account') return; + const account=message.result?.[0]; + if(!account){document.querySelector('#wallet-state').textContent=message.error||'Wallet unavailable';return;} + document.querySelector('#wallet-state').textContent='Ready to sign'; + document.querySelector('#wallet-address').textContent=account.address; +}); +port.postMessage({id:'popup-account',method:'bitcoin_getAccounts',params:{},origin:location.origin});