I am trying to write an extension that can interact with the contract. Upon interaction with the contract, i want to use the script to click confirm the transaction on Metamask.
metamask pop up requiring confirmation
I am unable to inject a script and i have tried for days.
chrome.tabs.onActivated.addListener((activeInfo) => {
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (tab.title == "MetaMask Notification" && tab.status == "complete") {
console.log(tab.url);
let regex = new RegExp('chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/notification\.html#confirm-transaction/[0-9]+/token-method');
if (regex.test(tab.url)) {
console.log('yes we got the correct url');
// chrome.tabs.executeScript(tabId, {
// file: "metamask.js"
// }, () => chrome.runtime.lastError);
chrome.tabs.executeScript(null, {
code: "console.log('wow im in');"
})
}
}
});
so far my error i receive is
Unchecked runtime.lastError: Cannot access a chrome-extension:// URL of different extension
I am unable to run / execute the script because the url schema doesnt start with https / http. the url is starting with chrome-extension://
Any help is very much appreciated!