@@ -28,7 +28,6 @@ export class MWPTransport implements ExtendedTransport {
2828 private __pendingRequests = new Map < string , PendingRequests > ( ) ;
2929 private notificationCallbacks = new Set < ( data : unknown ) => void > ( ) ;
3030 private currentSessionRequest : SessionRequest | undefined ;
31- private connectionPromise ?: Promise < void > ;
3231
3332 get pendingRequests ( ) {
3433 return this . __pendingRequests ;
@@ -139,7 +138,7 @@ export class MWPTransport implements ExtendedTransport {
139138 } catch { }
140139
141140 let timeout : NodeJS . Timeout ;
142- this . connectionPromise ?? = new Promise < void > ( ( resolve , reject ) => {
141+ const connectionPromise = new Promise < void > ( ( resolve , reject ) => {
143142 let connection : Promise < void > ;
144143 if ( session ) {
145144 connection = new Promise < void > ( ( resumeResolve , resumeReject ) => {
@@ -175,14 +174,15 @@ export class MWPTransport implements ExtendedTransport {
175174 dappClient . connect ( { mode : 'trusted' , initialPayload : request } ) . catch ( rejectConnection ) ;
176175 } ) ;
177176 }
177+
178178 timeout = setTimeout ( ( ) => {
179179 reject ( new TransportTimeoutError ( ) ) ;
180180 } , this . options . connectionTimeout ) ;
181+
181182 connection . then ( resolve ) . catch ( reject ) ;
182183 } ) ;
183184
184- return this . connectionPromise . finally ( ( ) => {
185- this . connectionPromise = undefined ;
185+ return connectionPromise . finally ( ( ) => {
186186 if ( timeout ) {
187187 clearTimeout ( timeout ) ;
188188 }
0 commit comments