torusresearch / torus-embed

Embeds the Torus Wallet directly in your application via torus-embed. Exposes a Web3 Provider.
https://demo-eth.tor.us
MIT License
85 stars 52 forks source link

ReferenceError: fetch is not defined #492

Closed ThomasRalee closed 2 years ago

ThomasRalee commented 2 years ago

Describe the bug Vitest is reporting an error where fetch is not defined here with jsdom. Can we please import fetch at the top of the file?

Expected behavior No reference error on compilation

Additional context

ReferenceError: fetch is not defined
    at fetchAndTrace (node_modules/@toruslabs/http-helpers/dist/httpHelpers.cjs.js:154:3)
    at get (node_modules/@toruslabs/http-helpers/dist/httpHelpers.cjs.js:193:26)
    at getTorusUrl (node_modules/@toruslabs/torus-embed/dist/torus.cjs.js:740:86)
    at preLoadIframe (node_modules/@toruslabs/torus-embed/dist/torus.cjs.js:1779:15)
    at node_modules/@toruslabs/torus-embed/dist/torus.cjs.js:1797:3
    at Object.<anonymous> (node_modules/@toruslabs/torus-embed/dist/torus.cjs.js:2788:12)