From 42585c0945d437ccf0af9961b782e3b58c72cb7a Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 27 Nov 2024 11:40:30 -0330 Subject: [PATCH 1/2] 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 --- src/MetaMaskInpageProvider.ts | 2 +- src/initializeInpageProvider.ts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/MetaMaskInpageProvider.ts b/src/MetaMaskInpageProvider.ts index 0b16d817..0fd477b2 100644 --- a/src/MetaMaskInpageProvider.ts +++ b/src/MetaMaskInpageProvider.ts @@ -31,7 +31,7 @@ export type MetaMaskInpageProviderOptions = { shouldSendMetadata?: boolean; jsonRpcStreamName?: string | undefined; -} & Partial>; +} & Partial>; type SentWarningsState = { // methods diff --git a/src/initializeInpageProvider.ts b/src/initializeInpageProvider.ts index 20ecb5e5..3fba9600 100644 --- a/src/initializeInpageProvider.ts +++ b/src/initializeInpageProvider.ts @@ -52,9 +52,6 @@ export function initializeProvider({ shouldSetOnWindow = true, shouldShimWeb3 = false, }: InitializeProviderOptions): MetaMaskInpageProvider { - if (!jsonRpcStreamName) { - throw new Error('Required paramater: jsonRpcStreamName'); - } const provider = new MetaMaskInpageProvider(connectionStream, { jsonRpcStreamName, logger, From 630b24862ff774baae5d9143610c6f787cd4157c Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 27 Nov 2024 11:58:48 -0330 Subject: [PATCH 2/2] Update test coverage --- jest.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jest.config.js b/jest.config.js index 8a02db22..b43953d4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -45,10 +45,10 @@ const baseConfig = { // An object that configures minimum threshold enforcement for coverage results coverageThreshold: { global: { - branches: 64.35, + branches: 64.65, functions: 65.65, - lines: 65.21, - statements: 65.32, + lines: 65.51, + statements: 65.61, }, },