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

@metamask/providers

Package Overview
Dependencies
Maintainers
12
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/providers - npm Package Compare versions

Comparing version 13.0.0 to 13.1.0

dist/EIP6963.d.ts

14

CHANGELOG.md

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

## [13.1.0]
### Added
- Add support for EIP-6963 ([#263](https://github.com/MetaMask/providers/pull/263))
- `initializeProvider()` params object now accepts an optional `providerInfo` property with a value of [EIP6963ProviderInfo object](https://eips.ethereum.org/EIPS/eip-6963#provider-info)
- Add `eip6963AnnounceProvider()` which supports a wallet by announcing a provider through the `eip6963:announceProvider` event and re-announcing the provider whenever an `eip6963:requestProvider` event is received
- Add `eip6963RequestProvider()` which supports a dapp by dispatching an `eip6963:requestProvider` event and invoking a callback for each `eip6963:announceProvider` event received
- Add `EIP6963AnnounceProviderEvent` type
- Add `EIP6963ProviderDetail` type
- Add `EIP6963ProviderInfo` type
- Add `EIP6963RequestProviderEvent` type
## [13.0.0]

@@ -248,3 +259,4 @@ ### Changed

[Unreleased]: https://github.com/MetaMask/providers/compare/v13.0.0...HEAD
[Unreleased]: https://github.com/MetaMask/providers/compare/v13.1.0...HEAD
[13.1.0]: https://github.com/MetaMask/providers/compare/v13.0.0...v13.1.0
[13.0.0]: https://github.com/MetaMask/providers/compare/v12.0.0...v13.0.0

@@ -251,0 +263,0 @@ [12.0.0]: https://github.com/MetaMask/providers/compare/v11.1.2...v12.0.0

4

dist/index.d.ts
import { BaseProvider } from './BaseProvider';
import { announceProvider as eip6963AnnounceProvider, requestProvider as eip6963RequestProvider, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, EIP6963RequestProviderEvent } from './EIP6963';
import { createExternalExtensionProvider } from './extension-provider/createExternalExtensionProvider';

@@ -7,2 +8,3 @@ import { initializeProvider, setGlobalProvider } from './initializeInpageProvider';

import { StreamProvider } from './StreamProvider';
export { BaseProvider, createExternalExtensionProvider, initializeProvider, MetaMaskInpageProviderStreamName, MetaMaskInpageProvider, setGlobalProvider, shimWeb3, StreamProvider, };
export type { EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, EIP6963RequestProviderEvent, };
export { BaseProvider, createExternalExtensionProvider, initializeProvider, MetaMaskInpageProviderStreamName, MetaMaskInpageProvider, setGlobalProvider, shimWeb3, StreamProvider, eip6963AnnounceProvider, eip6963RequestProvider, };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamProvider = exports.shimWeb3 = exports.setGlobalProvider = exports.MetaMaskInpageProvider = exports.MetaMaskInpageProviderStreamName = exports.initializeProvider = exports.createExternalExtensionProvider = exports.BaseProvider = void 0;
exports.eip6963RequestProvider = exports.eip6963AnnounceProvider = exports.StreamProvider = exports.shimWeb3 = exports.setGlobalProvider = exports.MetaMaskInpageProvider = exports.MetaMaskInpageProviderStreamName = exports.initializeProvider = exports.createExternalExtensionProvider = exports.BaseProvider = void 0;
const BaseProvider_1 = require("./BaseProvider");
Object.defineProperty(exports, "BaseProvider", { enumerable: true, get: function () { return BaseProvider_1.BaseProvider; } });
const EIP6963_1 = require("./EIP6963");
Object.defineProperty(exports, "eip6963AnnounceProvider", { enumerable: true, get: function () { return EIP6963_1.announceProvider; } });
Object.defineProperty(exports, "eip6963RequestProvider", { enumerable: true, get: function () { return EIP6963_1.requestProvider; } });
const createExternalExtensionProvider_1 = require("./extension-provider/createExternalExtensionProvider");

@@ -7,0 +10,0 @@ Object.defineProperty(exports, "createExternalExtensionProvider", { enumerable: true, get: function () { return createExternalExtensionProvider_1.createExternalExtensionProvider; } });

/// <reference types="node" />
import { Duplex } from 'stream';
import { EIP6963ProviderInfo } from './EIP6963';
import { MetaMaskInpageProvider, MetaMaskInpageProviderOptions } from './MetaMaskInpageProvider';

@@ -10,2 +11,6 @@ declare type InitializeProviderOptions = {

/**
* The EIP-6963 provider info that should be announced if set.
*/
providerInfo?: EIP6963ProviderInfo;
/**
* Whether the provider should be set as window.ethereum.

@@ -26,2 +31,3 @@ */

* @param options.maxEventListeners - The maximum number of event listeners.
* @param options.providerInfo - The EIP-6963 provider info that should be announced if set.
* @param options.shouldSendMetadata - Whether the provider should send page metadata.

@@ -33,3 +39,3 @@ * @param options.shouldSetOnWindow - Whether the provider should be set as window.ethereum.

*/
export declare function initializeProvider({ connectionStream, jsonRpcStreamName, logger, maxEventListeners, shouldSendMetadata, shouldSetOnWindow, shouldShimWeb3, }: InitializeProviderOptions): MetaMaskInpageProvider;
export declare function initializeProvider({ connectionStream, jsonRpcStreamName, logger, maxEventListeners, providerInfo, shouldSendMetadata, shouldSetOnWindow, shouldShimWeb3, }: InitializeProviderOptions): MetaMaskInpageProvider;
/**

@@ -36,0 +42,0 @@ * Sets the given provider instance as window.ethereum and dispatches the

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setGlobalProvider = exports.initializeProvider = void 0;
const EIP6963_1 = require("./EIP6963");
const MetaMaskInpageProvider_1 = require("./MetaMaskInpageProvider");

@@ -13,2 +14,3 @@ const shimWeb3_1 = require("./shimWeb3");

* @param options.maxEventListeners - The maximum number of event listeners.
* @param options.providerInfo - The EIP-6963 provider info that should be announced if set.
* @param options.shouldSendMetadata - Whether the provider should send page metadata.

@@ -20,3 +22,3 @@ * @param options.shouldSetOnWindow - Whether the provider should be set as window.ethereum.

*/
function initializeProvider({ connectionStream, jsonRpcStreamName, logger = console, maxEventListeners = 100, shouldSendMetadata = true, shouldSetOnWindow = true, shouldShimWeb3 = false, }) {
function initializeProvider({ connectionStream, jsonRpcStreamName, logger = console, maxEventListeners = 100, providerInfo, shouldSendMetadata = true, shouldSetOnWindow = true, shouldShimWeb3 = false, }) {
const provider = new MetaMaskInpageProvider_1.MetaMaskInpageProvider(connectionStream, {

@@ -37,2 +39,8 @@ jsonRpcStreamName,

});
if (providerInfo) {
(0, EIP6963_1.announceProvider)({
info: providerInfo,
provider: proxiedProvider,
});
}
if (shouldSetOnWindow) {

@@ -39,0 +47,0 @@ setGlobalProvider(proxiedProvider);

{
"name": "@metamask/providers",
"version": "13.0.0",
"version": "13.1.0",
"description": "A JavaScript Ethereum provider that connects to the wallet over a stream.",

@@ -63,2 +63,3 @@ "keywords": [

"@types/readable-stream": "^2.3.15",
"@types/uuid": "^9.0.1",
"@types/webextension-polyfill": "^0.10.0",

@@ -65,0 +66,0 @@ "@typescript-eslint/eslint-plugin": "^5.43.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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