Skip to content

Commit

Permalink
Merge pull request #22 from argentlabs/BLO-1765
Browse files Browse the repository at this point in the history
BLO-1765 Starknetkit - avoid popup warning on chrome
  • Loading branch information
bluecco authored Nov 8, 2023
2 parents 50e12ce + 1b55b6e commit a56acdb
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/connectors/webwallet/helpers/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,25 @@ export const trpcProxyClient = ({
false: popupLink({
listenWindow: window,
createPopup: () => {
// parent is the window that opened this window; if not detected then it falls back to the current screen
let popup: Window | null = null
const webwalletBtn = document.createElement("button")
webwalletBtn.style.display = "none"
webwalletBtn.addEventListener("click", () => {
popup = window.open(
`${popupOrigin}${popupLocation}`,
"popup",
popupParams,
)
})
webwalletBtn.click()

const popup = window.open(
`${popupOrigin}${popupLocation}`,
"popup",
popupParams,
)
// make sure popup is defined
;(async () => {
console.log(popup)
while (!popup) {
await new Promise((resolve) => setTimeout(resolve, 100))
}
})()

if (!popup) {
throw new Error("Could not open popup")
Expand Down

0 comments on commit a56acdb

Please sign in to comment.