Skip to content

Commit

Permalink
feat(provider): remove support for the ZKSYNC_WEB3_API_URL environm…
Browse files Browse the repository at this point in the history
…ent variable

Getting environment variables using `process.env` has been removed because
it's only available in `Node.js` and is not compatible with browsers.

BREAKING CHANGE: Remove support for the `ZKSYNC_WEB3_API_URL` environment
variable from the `Provider.getDefaultProvider()` to make it compatible
with browser integration.
  • Loading branch information
danijelTxFusion committed Mar 18, 2024
1 parent 26d6f63 commit f5b8529
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1794,15 +1794,11 @@ export class Provider extends JsonRpcApiProvider(ethers.JsonRpcProvider) {

/**
* Creates a new `Provider` from provided URL or network name.
* The URL can be configured using `ZKSYNC_WEB3_API_URL` environment variable.
* @param zksyncNetwork The type of zkSync network.
*/
static getDefaultProvider(
zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost
): Provider {
if (process.env.ZKSYNC_WEB3_API_URL) {
return new Provider(process.env.ZKSYNC_WEB3_API_URL);
}
switch (zksyncNetwork) {
case ZkSyncNetwork.Localhost:
return new Provider('http://localhost:3050');
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ esutils@^2.0.2:
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==

ethers@^6.11.1:
ethers@^6.7.1:
version "6.11.1"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.11.1.tgz#96aae00b627c2e35f9b0a4d65c7ab658259ee6af"
integrity sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==
Expand Down

0 comments on commit f5b8529

Please sign in to comment.