Skip to content
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

[v3] Pera needs global shim #191

Closed
PhearZero opened this issue Jun 21, 2024 · 2 comments
Closed

[v3] Pera needs global shim #191

PhearZero opened this issue Jun 21, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation v3

Comments

@PhearZero
Copy link
Contributor

PhearZero commented Jun 21, 2024

Overview

v3 with pera fails to connect with message

ReferenceError: global is not defined

Resolution

Add shim to index.html but it may be better to update the pera library

<head>
  <script>
        // Suggest that Pera to use globalThis instead of global | window
        globalThis.global = globalThis
  </script>
</head>

Details

  • @txnlab/use-wallet-react 3.0.0-rc.2
  • Vite React-TS project
@drichar drichar added v3 documentation Improvements or additions to documentation labels Jun 22, 2024
@drichar
Copy link
Collaborator

drichar commented Jun 22, 2024

Yeah this is a bug report I get often in the use-wallet channel on NFD's Discord. There's an open issue for it on Pera Connect: perawallet/connect#101

The Vite example apps for v3 all include the index.html shim: https://github.com/TxnLab/use-wallet/blob/v3/examples/react-ts/index.html#L12

It would be nice to have this resolved in Pera Connect v2, if possible. I don't think it qualifies as a use-wallet issue per se, other than drawing more attention to it in the documentation.

@PhearZero
Copy link
Contributor Author

PhearZero commented Jun 22, 2024

Fixed! Going to issue a PR to pera, could be useful while we migrate to v2. I'll take a dive into v2 if we still have issues there

npm install awesome-algorand/walletconnect-socket-transport --save

Edit: Hopefully it lands: perawallet/connect#164

@drichar drichar closed this as completed Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation v3
Projects
None yet
Development

No branches or pull requests

2 participants