remove: unused extension

This commit is contained in:
Andrei O 2022-10-18 18:04:44 +03:00
parent 1eef70e2f5
commit eec1d0f355
No known key found for this signature in database
GPG Key ID: B961E5B68389457E
4 changed files with 20 additions and 5 deletions

View File

@ -39,7 +39,7 @@ window.addEventListener("message", (event) => {
if((event?.data?.data?.method ?? 'x') in allowedMethods) { if((event?.data?.data?.method ?? 'x') in allowedMethods) {
chrome.runtime.sendMessage(event.data.data, (res) => { chrome.runtime.sendMessage(event.data.data, (res) => {
const data = { type: "CLWALLET_PAGE", data: res, resId: event.data.resId, website: window?.location?.href ?? '' }; const data = { type: "CLWALLET_PAGE", data: res, resId: event.data.resId, website: window?.location?.href ?? '' };
// console.log('data back', data) console.log('data back', data)
window.postMessage(data, "*"); window.postMessage(data, "*");
}) })
} }

View File

@ -45,7 +45,7 @@ return new Promise((resolve, reject) => {
if (ping) { if (ping) {
data.type = 'CLWALLET_PING' data.type = 'CLWALLET_PING'
} }
// console.log('data in', data) console.log('data in', data)
window.postMessage(data, "*"); window.postMessage(data, "*");
}) })
} }

View File

@ -23,7 +23,6 @@
"minimum_chrome_version": "93", "minimum_chrome_version": "93",
"permissions": [ "permissions": [
"scripting",
"tabs", "tabs",
"notifications", "notifications",
"storage", "storage",

View File

@ -201,17 +201,33 @@ chrome.runtime.onMessage.addListener((message: RequestArguments, sender, sendRes
} }
case 'eth_requestAccounts': case 'eth_requestAccounts':
case 'eth_accounts': { case 'eth_accounts': {
try {
// give only the selected address for better privacy // give only the selected address for better privacy
const account = await getSelectedAccount() const account = await getSelectedAccount()
const address = account?.address ? [account?.address] : [] const address = account?.address ? [account?.address] : []
sendResponse(address) sendResponse(address)
break } catch {
sendResponse({
error: true,
code: rpcError.USER_REJECTED,
message: 'No network or user selected'
})
}
break
} }
case 'eth_chainId': { case 'eth_chainId': {
try {
const network = await getSelectedNetwork() const network = await getSelectedNetwork()
const chainId = network?.chainId ?? 0 const chainId = network?.chainId ?? 0
sendResponse(`0x${chainId.toString(16)}`) sendResponse(`0x${chainId.toString(16)}`)
break } catch {
sendResponse({
error: true,
code: rpcError.USER_REJECTED,
message: 'No network or user selected'
})
}
break
} }
case 'eth_sendTransaction': { case 'eth_sendTransaction': {
try { try {