-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: upgrade chrome extension v2 manifest to v3 #51
Conversation
adding a ledger account demo add_ledger.mov |
6325bda updated the e2e test to include testing I'll organize the test suite better in future PRs e2e.mov |
`cross-fetch` injects code related to `XMLHttpRequest` which breaks the build as service workers have no concept of this
`chrome.extension.getURL` is deprecated in v3
this code is loaded into the background script, which is now a serviceworker. A SW cannot contain references to `window` or `document` so I've temporarily removed these references.
6325bda
to
24460f0
Compare
using a ledger nano s to send SPL tokens ledger.mp4tx: |
const postMessageToIframe = (message: any) => { | ||
(self as any).clients | ||
.matchAll({ | ||
frameType: "top-level", | ||
includeUncontrolled: true, | ||
type: "window", | ||
visibilityState: "visible", | ||
}) | ||
.then((clients: any) => { | ||
clients.forEach((client: any) => { | ||
client.postMessage(message); | ||
}); | ||
}); | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having issues with chrome.runtime.sendMessage
, I know there's an Io
class too though. I just used this for now because (a) it worked, (b) it's very close to what would be used on mobile. Happy to use something different though
ok I think this is finally ready to merge @armaniferrante I noticed that sometimes I get a Blockhash issue but I think that might be unrelated to these code changes and I'll look to address it in a separate PR |
let handleMessage: (event: MessageEvent) => void; | ||
|
||
navigator.serviceWorker.ready.then((_registration) => { | ||
handleMessage = ({ data }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we need to check the origin here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do this later.
replaces #36
TODO:
SolanaLedgerKeyring
so that ledger still worksmain
into this branch and ensure everything works ok. Haven't done this yet as I want to double check other tabs are working as expected before they get disabled