diff --git a/packages/connect-multichain/CHANGELOG.md b/packages/connect-multichain/CHANGELOG.md index d51f024a..c2c3df24 100644 --- a/packages/connect-multichain/CHANGELOG.md +++ b/packages/connect-multichain/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- `ConnectMultichain` now waits 10 seconds (rather than 2 minutes) when attempting to resume a pending connection on initial instantiation via `createMultichainClient()` ([#175](https://github.com/MetaMask/connect-monorepo/pull/175)) - Fix `beforeunload` event listener not being properly removed on disconnect due to `.bind()` creating different function references, causing a listener leak on each connect/disconnect cycle ([#170](https://github.com/MetaMask/connect-monorepo/pull/170)) - Rename `StoreAdapterWeb.DB_NAME` from `mmsdk` to `mmconnect` to prevent IndexedDB collisions when the legacy MetaMask SDK and MM Connect run in the same browser context ([#177](https://github.com/MetaMask/connect-monorepo/pull/177)) - Clean up stale MWP session from KVStore on connection rejection so subsequent QR code connection attempts are not blocked ([#180](https://github.com/MetaMask/connect-monorepo/pull/180)) diff --git a/packages/connect-multichain/src/multichain/transports/mwp/index.ts b/packages/connect-multichain/src/multichain/transports/mwp/index.ts index 198827a5..611a2e30 100644 --- a/packages/connect-multichain/src/multichain/transports/mwp/index.ts +++ b/packages/connect-multichain/src/multichain/transports/mwp/index.ts @@ -419,6 +419,8 @@ export class MWPTransport implements ExtendedTransport { logger('active session found', session); } + const storedSessionRequestBeforeConnectionAttempt = await this.getStoredSessionRequest(); + let timeout: NodeJS.Timeout; let initialConnectionMessageHandler: | ((message: unknown) => Promise) @@ -518,9 +520,15 @@ export class MWPTransport implements ExtendedTransport { ); } - timeout = setTimeout(() => { - reject(new TransportTimeoutError()); - }, this.options.connectionTimeout); + + timeout = setTimeout( + () => { + reject(new TransportTimeoutError()); + }, + storedSessionRequestBeforeConnectionAttempt + ? this.options.resumeTimeout + : this.options.connectionTimeout, + ); connection.then(resolve).catch(reject); });