Show extension-owned test account
This commit is contained in:
1 parent
8b55e20a27
commit
e427065cb6
1 file changed
+19
-14
+19
-14
@@ -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});
|
||||
Reference in new issue
Block a user