Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web3-react/url

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3-react/url - npm Package Compare versions

Comparing version 8.0.6-beta.0 to 8.0.7-beta.0

dist/cjs/index.js

3

dist/index.d.ts

@@ -9,2 +9,3 @@ import type { Eip1193Bridge } from '@ethersproject/experimental';

provider: Eip1193Bridge | undefined;
private eagerConnection?;
private url;

@@ -16,3 +17,3 @@ /**

constructor(actions: Actions, url: url, connectEagerly?: boolean);
private initialize;
private isomorphicInitialize;
/** {@inheritdoc Connector.activate} */

@@ -19,0 +20,0 @@ activate(): Promise<void>;

@@ -16,24 +16,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

*/
constructor(actions, url, connectEagerly = true) {
constructor(actions, url, connectEagerly = false) {
super(actions);
if (connectEagerly && typeof window === 'undefined') {
throw new Error('connectEagerly = true is invalid for SSR, instead use the activate method in a useEffect');
}
this.url = url;
if (connectEagerly) {
void this.initialize();
}
if (connectEagerly)
void this.activate();
}
initialize() {
isomorphicInitialize() {
return __awaiter(this, void 0, void 0, function* () {
this.actions.startActivation();
// create the provider if necessary
if (!this.provider) {
// instantiate new provider
const [JsonRpcProvider, Eip1193Bridge] = yield Promise.all([
import('@ethersproject/providers').then(({ JsonRpcProvider }) => JsonRpcProvider),
import('@ethersproject/experimental').then(({ Eip1193Bridge }) => Eip1193Bridge),
]);
if (this.eagerConnection)
return this.eagerConnection;
yield (this.eagerConnection = Promise.all([
import('@ethersproject/providers').then(({ JsonRpcProvider }) => JsonRpcProvider),
import('@ethersproject/experimental').then(({ Eip1193Bridge }) => Eip1193Bridge),
]).then(([JsonRpcProvider, Eip1193Bridge]) => {
const provider = new JsonRpcProvider(this.url);
this.provider = new Eip1193Bridge(provider.getSigner(), provider);
}
return this.provider
.request({ method: 'eth_chainId' })
}));
});
}
/** {@inheritdoc Connector.activate} */
activate() {
return __awaiter(this, void 0, void 0, function* () {
this.actions.startActivation();
yield this.isomorphicInitialize();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return this.provider.request({ method: 'eth_chainId' })
.then((chainId) => {

@@ -47,8 +54,2 @@ this.actions.update({ chainId, accounts: [] });

}
/** {@inheritdoc Connector.activate} */
activate() {
return __awaiter(this, void 0, void 0, function* () {
return this.initialize();
});
}
}

@@ -12,3 +12,3 @@ {

},
"version": "8.0.6-beta.0",
"version": "8.0.7-beta.0",
"type": "module",

@@ -28,3 +28,3 @@ "files": [

"prebuild": "rm -rf dist",
"build": "tsc && tsc --project tsconfig.cjs.json && find ./dist/cjs/ -depth -name \"*.js\" -exec sh -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;",
"build": "tsc && tsc --project tsconfig.cjs.json",
"start": "tsc --watch"

@@ -35,8 +35,8 @@ },

"@ethersproject/providers": "^5.5.1",
"@web3-react/types": "^8.0.4-beta.0"
"@web3-react/types": "^8.0.5-beta.0"
},
"devDependencies": {
"@web3-react/store": "^8.0.6-beta.0"
"@web3-react/store": "^8.0.7-beta.0"
},
"gitHead": "aba55673f396cf8163e7265b9a5bc4c118f2a353"
"gitHead": "5f4424eea3bd54b7a7c1c0e113f024de953b5f4c"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc