Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

TypeError: r.URL is not a constructor #2539

Closed
Thankgod20 opened this issue Mar 6, 2022 · 3 comments
Closed

TypeError: r.URL is not a constructor #2539

Thankgod20 opened this issue Mar 6, 2022 · 3 comments

Comments

@Thankgod20
Copy link

I am using ganache cdn and when i call the fork option i get these errors

Uncaught TypeError: r.URL is not a constructor at Object.normalize (ganache:2) at fill (ganache:2) at ganache:2 at Array.forEach (<anonymous>) at OptionsConfig.normalize (ganache:2) at new EthereumProvider (ganache:2) at new Connector (ganache:2) at GetConnector (ganache:2) at Object.initialize (ganache:2) at Object.provider (ganache:2)

here is the javascript code

`

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web/ganache.min.js"></script>
<script>
    
    const options = {"fork":"https://bsc.getblock.io/mainnet/?api_key=<MY-API-KEY"}; 
    const provider = Ganache.provider(options);
</script>

`
Any ideas on how to resolve these issue

@linzof
Copy link

linzof commented Mar 6, 2022

This line should be the cause

const options = {"fork":"https://bsc.getblock.io/mainnet/?api_key=<MY-API-KEY"};

I am not sure how the rest of environment is set up.

Since you are in js, you should use a template literal for concatenating strings and variables.

Template literals (Template strings)

@davidmurdoch
Copy link
Member

davidmurdoch commented Mar 7, 2022

Forking is not yet supported in the browser.

@lsqproduction
Copy link

@Thankgod20 Thank you for letting us know. Closing this as a duplicate of #1245

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants