@dynamic-labs-wallet/browser-wallet-client 0.0.119 → 0.0.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -5,6 +5,17 @@ var uuid = require('uuid');
5
5
  var messageTransport = require('@dynamic-labs/message-transport');
6
6
  var logger$1 = require('@dynamic-labs/logger');
7
7
 
8
+ function _extends() {
9
+ _extends = Object.assign || function assign(target) {
10
+ for(var i = 1; i < arguments.length; i++){
11
+ var source = arguments[i];
12
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
13
+ }
14
+ return target;
15
+ };
16
+ return _extends.apply(this, arguments);
17
+ }
18
+
8
19
  class iframeMessageHandler {
9
20
  async getWallets(request) {
10
21
  return this.requestChannel.request('getWallets', request);
@@ -207,19 +218,62 @@ class IframeManager {
207
218
  }
208
219
  createIframeLoadPromise() {
209
220
  return new Promise((resolve, reject)=>{
210
- this.logger.info('Loading iframe for waas wallet client...', this.getIframeContext());
211
- const iframe = document.createElement('iframe');
212
- let messageListener = null;
213
- const iframeTimeoutId = this.setupIframeTimeout(messageListener, reject);
214
- messageListener = this.createMessageListener(iframe, iframeTimeoutId, resolve);
215
- window.addEventListener('message', messageListener);
216
- this.configureIframe(iframe);
217
- this.setIframeSource(iframe);
218
- this.logger.debug('Creating iframe with src:', iframe.src);
219
- document.body.appendChild(iframe);
220
- this.setupIframeEventHandlers(iframe, messageListener, iframeTimeoutId, reject);
221
+ const attemptLoad = ()=>{
222
+ IframeManager.iframeLoadAttempts++;
223
+ this.logger.info(`Loading iframe for waas wallet client... (attempt ${IframeManager.iframeLoadAttempts}/${IframeManager.maxRetryAttempts + 1})`, this.getIframeContext());
224
+ const iframe = document.createElement('iframe');
225
+ let messageListener = null;
226
+ const context = _extends({}, this.getIframeContext(), {
227
+ attempt: IframeManager.iframeLoadAttempts
228
+ });
229
+ // Set up timeout that will trigger iframe error, a retry will be triggered on this iframe error
230
+ const iframeTimeoutId = setTimeout(()=>{
231
+ if (iframe.onerror) {
232
+ iframe.onerror('Iframe load timeout');
233
+ }
234
+ }, IframeManager.iframeLoadTimeout);
235
+ messageListener = this.createMessageListener(iframe, iframeTimeoutId, resolve);
236
+ window.addEventListener('message', messageListener);
237
+ this.configureIframe(iframe);
238
+ this.setIframeSource(iframe);
239
+ this.logger.debug('Creating iframe with src:', iframe.src);
240
+ document.body.appendChild(iframe);
241
+ this.setupIframeEventHandlersWithRetry(iframe, messageListener, iframeTimeoutId, reject, attemptLoad, context);
242
+ };
243
+ // Start the first attempt
244
+ attemptLoad();
221
245
  });
222
246
  }
247
+ setupIframeEventHandlersWithRetry(iframe, messageListener, iframeTimeoutId, reject, attemptLoad, context) {
248
+ iframe.onload = ()=>{
249
+ this.logger.debug('Iframe onload fired, waiting for ready message...');
250
+ };
251
+ iframe.onerror = (error)=>{
252
+ if (messageListener) {
253
+ window.removeEventListener('message', messageListener);
254
+ }
255
+ clearTimeout(iframeTimeoutId);
256
+ // Check if we should retry
257
+ if (IframeManager.iframeLoadAttempts <= IframeManager.maxRetryAttempts) {
258
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error occurred.';
259
+ this.logger.warn(`(loadIframe) Iframe failed to load on attempt ${IframeManager.iframeLoadAttempts}, retrying... context: ${JSON.stringify(context)}, error: ${errorMsg}`);
260
+ // Clean up current attempt
261
+ if (iframe.parentNode) {
262
+ iframe.parentNode.removeChild(iframe);
263
+ }
264
+ // Retry after a short delay
265
+ setTimeout(()=>{
266
+ attemptLoad();
267
+ }, 1000); // 1 second delay between retries
268
+ } else {
269
+ // Max retries reached, give up
270
+ this.logger.error('Iframe failed to load after all retry attempts: ', error);
271
+ this.resetSharedIframe();
272
+ IframeManager.iframeLoadAttempts = 0;
273
+ reject(new Error(`Failed to load iframe after all retry attempts... context: ${JSON.stringify(context)}`));
274
+ }
275
+ };
276
+ }
223
277
  getIframeContext() {
224
278
  var _this_sdkVersion;
225
279
  return {
@@ -231,18 +285,6 @@ class IframeManager {
231
285
  iframeLoadTimeout: IframeManager.iframeLoadTimeout
232
286
  };
233
287
  }
234
- setupIframeTimeout(messageListener, reject) {
235
- return setTimeout(()=>{
236
- if (messageListener) {
237
- window.removeEventListener('message', messageListener);
238
- }
239
- this.resetSharedIframe();
240
- const context = this.getIframeContext();
241
- const errorMessage = `(loadIframe) Iframe load timeout due to no handshake message from iframe, this could be network issues, incorrect iframe domain, or CORS errors that prevents iframe from being loaded or sending handshake message, context: ${JSON.stringify(context)}`;
242
- this.logger.error(errorMessage);
243
- reject(new Error(errorMessage));
244
- }, IframeManager.iframeLoadTimeout);
245
- }
246
288
  createMessageListener(iframe, iframeTimeoutId, resolve) {
247
289
  const messageListener = (event)=>{
248
290
  if (event.source === iframe.contentWindow && event.data === `iframe-ready-${this.instanceId}`) {
@@ -251,6 +293,7 @@ class IframeManager {
251
293
  IframeManager.sharedIframe = iframe;
252
294
  this.iframe = iframe;
253
295
  IframeManager.iframeInstanceCount++;
296
+ IframeManager.iframeLoadAttempts = 0; // Reset retry counter on success
254
297
  resolve();
255
298
  this.logger.info('Iframe loaded successfully...', this.getIframeContext());
256
299
  }
@@ -282,20 +325,6 @@ class IframeManager {
282
325
  });
283
326
  iframe.src = `${this.iframeDomain}/waas-v1/${this.environmentId}?${params.toString()}`;
284
327
  }
285
- setupIframeEventHandlers(iframe, messageListener, iframeTimeoutId, reject) {
286
- iframe.onload = ()=>{
287
- this.logger.debug('Iframe onload fired, waiting for ready message...');
288
- };
289
- iframe.onerror = (error)=>{
290
- if (messageListener) {
291
- window.removeEventListener('message', messageListener);
292
- }
293
- clearTimeout(iframeTimeoutId);
294
- this.logger.error('Iframe failed to load due to errors: ', error);
295
- this.resetSharedIframe();
296
- reject(new Error('Failed to load iframe...'));
297
- };
298
- }
299
328
  /**
300
329
  * Load an iframe for a specific container
301
330
  * @param {HTMLElement} container - The container to which the iframe will be attached
@@ -446,6 +475,8 @@ class IframeManager {
446
475
  }
447
476
  IframeManager.iframeLoadPromise = null;
448
477
  IframeManager.iframeLoadTimeout = 10000;
478
+ IframeManager.iframeLoadAttempts = 0;
479
+ IframeManager.maxRetryAttempts = 1;
449
480
  IframeManager.sharedIframe = null;
450
481
  IframeManager.iframeInstanceCount = 0;
451
482
 
@@ -733,19 +764,19 @@ class DynamicWalletClient extends IframeManager {
733
764
  }
734
765
 
735
766
  Object.defineProperty(exports, "MPC_RELAY_PREPROD_API_URL", {
736
- enumerable: true,
737
- get: function () { return core.MPC_RELAY_PREPROD_API_URL; }
767
+ enumerable: true,
768
+ get: function () { return core.MPC_RELAY_PREPROD_API_URL; }
738
769
  });
739
770
  Object.defineProperty(exports, "MPC_RELAY_PROD_API_URL", {
740
- enumerable: true,
741
- get: function () { return core.MPC_RELAY_PROD_API_URL; }
771
+ enumerable: true,
772
+ get: function () { return core.MPC_RELAY_PROD_API_URL; }
742
773
  });
743
774
  Object.defineProperty(exports, "ThresholdSignatureScheme", {
744
- enumerable: true,
745
- get: function () { return core.ThresholdSignatureScheme; }
775
+ enumerable: true,
776
+ get: function () { return core.ThresholdSignatureScheme; }
746
777
  });
747
778
  Object.defineProperty(exports, "WalletOperation", {
748
- enumerable: true,
749
- get: function () { return core.WalletOperation; }
779
+ enumerable: true,
780
+ get: function () { return core.WalletOperation; }
750
781
  });
751
782
  exports.DynamicWalletClient = DynamicWalletClient;
package/index.esm.js CHANGED
@@ -4,6 +4,17 @@ import { v4 } from 'uuid';
4
4
  import { createRequestChannel, parseMessageTransportData, applyDefaultMessageOrigin, createMessageTransport } from '@dynamic-labs/message-transport';
5
5
  import { Logger } from '@dynamic-labs/logger';
6
6
 
7
+ function _extends() {
8
+ _extends = Object.assign || function assign(target) {
9
+ for(var i = 1; i < arguments.length; i++){
10
+ var source = arguments[i];
11
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
12
+ }
13
+ return target;
14
+ };
15
+ return _extends.apply(this, arguments);
16
+ }
17
+
7
18
  class iframeMessageHandler {
8
19
  async getWallets(request) {
9
20
  return this.requestChannel.request('getWallets', request);
@@ -206,19 +217,62 @@ class IframeManager {
206
217
  }
207
218
  createIframeLoadPromise() {
208
219
  return new Promise((resolve, reject)=>{
209
- this.logger.info('Loading iframe for waas wallet client...', this.getIframeContext());
210
- const iframe = document.createElement('iframe');
211
- let messageListener = null;
212
- const iframeTimeoutId = this.setupIframeTimeout(messageListener, reject);
213
- messageListener = this.createMessageListener(iframe, iframeTimeoutId, resolve);
214
- window.addEventListener('message', messageListener);
215
- this.configureIframe(iframe);
216
- this.setIframeSource(iframe);
217
- this.logger.debug('Creating iframe with src:', iframe.src);
218
- document.body.appendChild(iframe);
219
- this.setupIframeEventHandlers(iframe, messageListener, iframeTimeoutId, reject);
220
+ const attemptLoad = ()=>{
221
+ IframeManager.iframeLoadAttempts++;
222
+ this.logger.info(`Loading iframe for waas wallet client... (attempt ${IframeManager.iframeLoadAttempts}/${IframeManager.maxRetryAttempts + 1})`, this.getIframeContext());
223
+ const iframe = document.createElement('iframe');
224
+ let messageListener = null;
225
+ const context = _extends({}, this.getIframeContext(), {
226
+ attempt: IframeManager.iframeLoadAttempts
227
+ });
228
+ // Set up timeout that will trigger iframe error, a retry will be triggered on this iframe error
229
+ const iframeTimeoutId = setTimeout(()=>{
230
+ if (iframe.onerror) {
231
+ iframe.onerror('Iframe load timeout');
232
+ }
233
+ }, IframeManager.iframeLoadTimeout);
234
+ messageListener = this.createMessageListener(iframe, iframeTimeoutId, resolve);
235
+ window.addEventListener('message', messageListener);
236
+ this.configureIframe(iframe);
237
+ this.setIframeSource(iframe);
238
+ this.logger.debug('Creating iframe with src:', iframe.src);
239
+ document.body.appendChild(iframe);
240
+ this.setupIframeEventHandlersWithRetry(iframe, messageListener, iframeTimeoutId, reject, attemptLoad, context);
241
+ };
242
+ // Start the first attempt
243
+ attemptLoad();
220
244
  });
221
245
  }
246
+ setupIframeEventHandlersWithRetry(iframe, messageListener, iframeTimeoutId, reject, attemptLoad, context) {
247
+ iframe.onload = ()=>{
248
+ this.logger.debug('Iframe onload fired, waiting for ready message...');
249
+ };
250
+ iframe.onerror = (error)=>{
251
+ if (messageListener) {
252
+ window.removeEventListener('message', messageListener);
253
+ }
254
+ clearTimeout(iframeTimeoutId);
255
+ // Check if we should retry
256
+ if (IframeManager.iframeLoadAttempts <= IframeManager.maxRetryAttempts) {
257
+ const errorMsg = error instanceof Error ? error.message : 'Unknown error occurred.';
258
+ this.logger.warn(`(loadIframe) Iframe failed to load on attempt ${IframeManager.iframeLoadAttempts}, retrying... context: ${JSON.stringify(context)}, error: ${errorMsg}`);
259
+ // Clean up current attempt
260
+ if (iframe.parentNode) {
261
+ iframe.parentNode.removeChild(iframe);
262
+ }
263
+ // Retry after a short delay
264
+ setTimeout(()=>{
265
+ attemptLoad();
266
+ }, 1000); // 1 second delay between retries
267
+ } else {
268
+ // Max retries reached, give up
269
+ this.logger.error('Iframe failed to load after all retry attempts: ', error);
270
+ this.resetSharedIframe();
271
+ IframeManager.iframeLoadAttempts = 0;
272
+ reject(new Error(`Failed to load iframe after all retry attempts... context: ${JSON.stringify(context)}`));
273
+ }
274
+ };
275
+ }
222
276
  getIframeContext() {
223
277
  var _this_sdkVersion;
224
278
  return {
@@ -230,18 +284,6 @@ class IframeManager {
230
284
  iframeLoadTimeout: IframeManager.iframeLoadTimeout
231
285
  };
232
286
  }
233
- setupIframeTimeout(messageListener, reject) {
234
- return setTimeout(()=>{
235
- if (messageListener) {
236
- window.removeEventListener('message', messageListener);
237
- }
238
- this.resetSharedIframe();
239
- const context = this.getIframeContext();
240
- const errorMessage = `(loadIframe) Iframe load timeout due to no handshake message from iframe, this could be network issues, incorrect iframe domain, or CORS errors that prevents iframe from being loaded or sending handshake message, context: ${JSON.stringify(context)}`;
241
- this.logger.error(errorMessage);
242
- reject(new Error(errorMessage));
243
- }, IframeManager.iframeLoadTimeout);
244
- }
245
287
  createMessageListener(iframe, iframeTimeoutId, resolve) {
246
288
  const messageListener = (event)=>{
247
289
  if (event.source === iframe.contentWindow && event.data === `iframe-ready-${this.instanceId}`) {
@@ -250,6 +292,7 @@ class IframeManager {
250
292
  IframeManager.sharedIframe = iframe;
251
293
  this.iframe = iframe;
252
294
  IframeManager.iframeInstanceCount++;
295
+ IframeManager.iframeLoadAttempts = 0; // Reset retry counter on success
253
296
  resolve();
254
297
  this.logger.info('Iframe loaded successfully...', this.getIframeContext());
255
298
  }
@@ -281,20 +324,6 @@ class IframeManager {
281
324
  });
282
325
  iframe.src = `${this.iframeDomain}/waas-v1/${this.environmentId}?${params.toString()}`;
283
326
  }
284
- setupIframeEventHandlers(iframe, messageListener, iframeTimeoutId, reject) {
285
- iframe.onload = ()=>{
286
- this.logger.debug('Iframe onload fired, waiting for ready message...');
287
- };
288
- iframe.onerror = (error)=>{
289
- if (messageListener) {
290
- window.removeEventListener('message', messageListener);
291
- }
292
- clearTimeout(iframeTimeoutId);
293
- this.logger.error('Iframe failed to load due to errors: ', error);
294
- this.resetSharedIframe();
295
- reject(new Error('Failed to load iframe...'));
296
- };
297
- }
298
327
  /**
299
328
  * Load an iframe for a specific container
300
329
  * @param {HTMLElement} container - The container to which the iframe will be attached
@@ -445,6 +474,8 @@ class IframeManager {
445
474
  }
446
475
  IframeManager.iframeLoadPromise = null;
447
476
  IframeManager.iframeLoadTimeout = 10000;
477
+ IframeManager.iframeLoadAttempts = 0;
478
+ IframeManager.maxRetryAttempts = 1;
448
479
  IframeManager.sharedIframe = null;
449
480
  IframeManager.iframeInstanceCount = 0;
450
481
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/browser-wallet-client",
3
- "version": "0.0.119",
3
+ "version": "0.0.121",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/core": "0.0.119",
7
+ "@dynamic-labs-wallet/core": "0.0.121",
8
8
  "@dynamic-labs/logger": "^4.9.9",
9
9
  "@dynamic-labs/message-transport": "^4.9.9",
10
10
  "uuid": "11.1.0"
@@ -15,7 +15,7 @@ export declare class DynamicWalletClient extends IframeManager {
15
15
  getWallet({ accountAddress, walletOperation, signedSessionId, authToken, }: {
16
16
  accountAddress: string;
17
17
  walletOperation?: WalletOperation;
18
- signedSessionId?: string;
18
+ signedSessionId: string;
19
19
  authToken?: string;
20
20
  }): Promise<GetWalletResponse>;
21
21
  createWalletAccount({ thresholdSignatureScheme, password, signedSessionId, authToken, }: Omit<CreateWalletAccountRequest, 'chainName'>): Promise<CreateWalletAccountResponse>;
@@ -41,7 +41,7 @@ export declare class DynamicWalletClient extends IframeManager {
41
41
  accountAddress: string;
42
42
  displayContainer: HTMLElement;
43
43
  password?: string;
44
- signedSessionId?: string;
44
+ signedSessionId: string;
45
45
  authToken?: string;
46
46
  }): Promise<void>;
47
47
  refreshWalletAccountShares({ accountAddress, password, signedSessionId, authToken, }: Omit<RefreshWalletAccountSharesRequest, 'chainName'>): Promise<void>;
@@ -50,7 +50,7 @@ export declare class DynamicWalletClient extends IframeManager {
50
50
  accountAddress: string;
51
51
  displayContainer: HTMLElement;
52
52
  password?: string;
53
- signedSessionId?: string;
53
+ signedSessionId: string;
54
54
  authToken?: string;
55
55
  }): Promise<void>;
56
56
  verifyPassword({ accountAddress, password, walletOperation, signedSessionId, authToken, }: Omit<VerifyPasswordRequest, 'chainName'>): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EACnC,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,+BAA+B,EAC/B,iCAAiC,EACjC,mCAAmC,EACnC,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE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,SAAS,GACV,EAAE,IAAI,CAAC,4BAA4B,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAelE;;OAEG;IACG,uBAAuB,CAAC,EAC5B,SAAS,EACT,cAAc,GACf,EAAE;QACD,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,+BAA+B,CAAC;CAoB7C"}
@@ -15,6 +15,8 @@ export declare class IframeManager {
15
15
  protected iframe: HTMLIFrameElement | null;
16
16
  private readonly debug;
17
17
  static iframeLoadTimeout: number;
18
+ private static iframeLoadAttempts;
19
+ private static readonly maxRetryAttempts;
18
20
  private static sharedIframe;
19
21
  private static iframeInstanceCount;
20
22
  sdkVersion: string | undefined;
@@ -53,12 +55,11 @@ export declare class IframeManager {
53
55
  private loadIframe;
54
56
  private assignExistingIframe;
55
57
  private createIframeLoadPromise;
58
+ private setupIframeEventHandlersWithRetry;
56
59
  private getIframeContext;
57
- private setupIframeTimeout;
58
60
  private createMessageListener;
59
61
  private configureIframe;
60
62
  private setIframeSource;
61
- private setupIframeEventHandlers;
62
63
  /**
63
64
  * Load an iframe for a specific container
64
65
  * @param {HTMLElement} container - The container to which the iframe will be attached
@@ -1 +1 @@
1
- {"version":3,"file":"IframeManager.d.ts","sourceRoot":"","sources":["../../../src/client/iframeManager/IframeManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAI3E,qBAAa,aAAa;IACxB,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,MAAM,wCAAU;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IACnC,aAAa,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,S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