Skip to content

Commit b8e6186

Browse files
authored
fix: Allow optional jsonRpcStreamName for inpage provider (#390)
* fix: Allow optional `jsonRpcStreamName` for inpage provider The `MetaMaskInpageProvider` type was mistakenly typed to require the `jsonRpcStreamName` as a constructor parameter, despite the author clearly intending this to be optional. This type error was fixed. This type error motivated a different bug, which is that validation for `jsonRpcStreamName` was added to `initializeInapgeProvider` in #381, constituting an undocumented breaking change (currently blocking us from updating this package in `metamask-extension`). This validation has been removed now that it's no longer needed. Fixes #389 * Update test coverage
1 parent 82d2779 commit b8e6186

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ const baseConfig = {
4545
// An object that configures minimum threshold enforcement for coverage results
4646
coverageThreshold: {
4747
global: {
48-
branches: 64.35,
48+
branches: 64.65,
4949
functions: 65.65,
50-
lines: 65.21,
51-
statements: 65.32,
50+
lines: 65.51,
51+
statements: 65.61,
5252
},
5353
},
5454

src/MetaMaskInpageProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type MetaMaskInpageProviderOptions = {
3131
shouldSendMetadata?: boolean;
3232

3333
jsonRpcStreamName?: string | undefined;
34-
} & Partial<Omit<StreamProviderOptions, 'rpcMiddleware'>>;
34+
} & Partial<Omit<StreamProviderOptions, 'rpcMiddleware' | 'jsonRpcStreamName'>>;
3535

3636
type SentWarningsState = {
3737
// methods

src/initializeInpageProvider.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ export function initializeProvider({
5252
shouldSetOnWindow = true,
5353
shouldShimWeb3 = false,
5454
}: InitializeProviderOptions): MetaMaskInpageProvider {
55-
if (!jsonRpcStreamName) {
56-
throw new Error('Required paramater: jsonRpcStreamName');
57-
}
5855
const provider = new MetaMaskInpageProvider(connectionStream, {
5956
jsonRpcStreamName,
6057
logger,

0 commit comments

Comments
 (0)