New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/inpage-provider

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/inpage-provider - npm Package Compare versions

Comparing version 6.2.0 to 6.3.0

index.d.ts

11

CHANGELOG.md

@@ -10,2 +10,13 @@ # Changelog

## [6.3.0] - 2020-09-04
### Added
- Types
### Changed
- `ethereum.networkVersion` and `.chainId` now default to `null` instead of `undefined`
- Improved JSDoc comments and tags
## [6.2.0] - 2020-08-04

@@ -12,0 +23,0 @@

12

package.json
{
"name": "@metamask/inpage-provider",
"version": "6.2.0",
"version": "6.3.0",
"description": "A JavaScript Ethereum provider that connects over a WebExtension port.",
"main": "index.js",
"type": "index.d.ts",
"scripts": {

@@ -10,3 +11,5 @@ "test": "jest",

"lint": "eslint . --ext js,json",
"lint:fix": "eslint . --ext js,json --fix"
"lint:fix": "eslint . --ext js,json --fix",
"prepublishOnly": "yarn require-clean-git && yarn lint && yarn test",
"require-clean-git": "git diff --quiet || (echo 'Please clean the working directory.' && exit 1)"
},

@@ -29,3 +32,4 @@ "author": "MetaMask",

"files": [
"src/"
"src/",
"index.d.ts"
],

@@ -44,3 +48,3 @@ "dependencies": {

"devDependencies": {
"@metamask/eslint-config": "^2.1.1",
"@metamask/eslint-config": "^3.1.0",
"@types/jest": "^26.0.5",

@@ -47,0 +51,0 @@ "eslint": "^6.8.0",

const MetamaskInpageProvider = require('./MetamaskInpageProvider')
/**
* Initializes a MetamaskInpageProvider and (optionally) sets it on window.ethereum.
*
* @param {Object} opts - An options bag.
* @param {Object} opts.connectionStream - A Node.js stream.
* @param {number} opts.maxEventListeners - The maximum number of event listeners.
* @param {boolean} opts.shouldSendMetadata - Whether the provider should send page metadata.
* @param {boolean} opts.shouldSetOnWindow - Whether the provider should be set as window.ethereum
* @returns {MetamaskInpageProvider | Proxy} The initialized provider (whether set or not).
*/
* Initializes a MetamaskInpageProvider and (optionally) assigns it as window.ethereum.
*
* @param {Object} options - An options bag.
* @param {Object} options.connectionStream - A Node.js stream.
* @param {number} options.maxEventListeners - The maximum number of event listeners.
* @param {boolean} options.shouldSendMetadata - Whether the provider should send page metadata.
* @param {boolean} options.shouldSetOnWindow - Whether the provider should be set as window.ethereum
* @returns {MetamaskInpageProvider | Proxy} The initialized provider (whether set or not).
*/
function initProvider ({

@@ -14,0 +14,0 @@ connectionStream,

@@ -39,7 +39,7 @@ const pump = require('pump')

* @param {Object} connectionStream - A Node.js duplex stream
* @param {Object} opts - An options bag
* @param {ConsoleLike} [opts.logger] - The logging API to use. Default: console
* @param {number} [opts.maxEventListeners] - The maximum number of event
* @param {Object} options - An options bag
* @param {ConsoleLike} [options.logger] - The logging API to use. Default: console
* @param {number} [options.maxEventListeners] - The maximum number of event
* listeners. Default: 100
* @param {boolean} [opts.shouldSendMetadata] - Whether the provider should
* @param {boolean} [options.shouldSendMetadata] - Whether the provider should
* send page metadata. Default: true

@@ -107,4 +107,4 @@ */

this.selectedAddress = null
this.networkVersion = undefined
this.chainId = undefined
this.networkVersion = null
this.chainId = null

@@ -156,3 +156,3 @@ // bind functions (to prevent e.g. web3@1.x from making unbound calls)

if ('chainId' in state && state.chainId !== this.chainId) {
this.chainId = state.chainId
this.chainId = state.chainId || null
this.emit('chainChanged', this.chainId)

@@ -164,3 +164,3 @@ this.emit('chainIdChanged', this.chainId) // TODO:deprecation:remove

if ('networkVersion' in state && state.networkVersion !== this.networkVersion) {
this.networkVersion = state.networkVersion
this.networkVersion = state.networkVersion || null
this.emit('networkChanged', this.networkVersion)

@@ -242,2 +242,3 @@ }

// TODO:deprecation:remove
/** @deprecated */
this._web3Ref = undefined

@@ -247,2 +248,3 @@

// if true, MetaMask reloads the page if window.web3 has been accessed
/** @deprecated */
this.autoRefreshOnNetworkChange = true

@@ -273,3 +275,3 @@

/**
* Returns whether the inpage provider is connected to MetaMask.
* Returns whether the provider can process RPC requests.
*/

@@ -281,3 +283,3 @@ isConnected () {

/**
* Submits an RPC request to MetaMask for the given method, with the given params.
* Submits an RPC request for the given method, with the given params.
* Resolves with the result of the method call, or rejects on error.

@@ -328,6 +330,6 @@ *

/**
* Submit a JSON-RPC request object and a callback to make an RPC method call.
* Submits an RPC request per the given JSON-RPC request object.
*
* @param {Object} payload - The RPC request object.
* @param {Function} callback - The callback function.
* @param {Function} cb - The callback function.
*/

@@ -394,3 +396,3 @@ sendAsync (payload, cb) {

* @param {Function} callback - The consumer's callback.
* @param {boolean} isInternal - Whether the request is internal.
* @param {boolean} [isInternal=false] - Whether the request is internal.
*/

@@ -560,5 +562,5 @@ _rpcRequest (payload, callback, isInternal = false) {

/**
* DEPRECATED. To be removed.
* Synchronously determines if this domain is currently enabled, with a potential false negative if called to soon
*
* @deprecated
* @returns {boolean} - returns true if this domain is currently enabled

@@ -571,5 +573,5 @@ */

/**
* DEPRECATED. To be removed.
* Asynchronously determines if this domain is currently enabled
*
* @deprecated
* @returns {Promise<boolean>} - Promise resolving to true if this domain is currently enabled

@@ -604,5 +606,5 @@ */

/**
* DEPRECATED.
* Equivalent to: ethereum.request('eth_requestAccounts')
*
* @deprecated
* @returns {Promise<Array<string>>} - A promise that resolves to an array of addresses.

@@ -630,6 +632,6 @@ */

/**
* DEPRECATED.
* Sends an RPC request to MetaMask.
* Many different return types, which is why this method should not be used.
*
* @deprecated
* @param {(string | Object)} methodOrPayload - The method name, or the RPC request object.

@@ -670,4 +672,5 @@ * @param {Array<any> | Function} [callbackOrArgs] - If given a method name, the method's parameters.

/**
* DEPRECATED.
* Internal backwards compatibility method, used in send.
*
* @deprecated
*/

@@ -674,0 +677,0 @@ _sendSync (payload) {

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