Skip to content

Commit 42585c0

Browse files
committed
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
1 parent 82d2779 commit 42585c0

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

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)