@fuel-ts/account 0.94.1 → 0.94.2

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/dist/index.mjs CHANGED
@@ -10292,9 +10292,11 @@ var _Fuel = class extends FuelConnector {
10292
10292
  _connectors = [];
10293
10293
  _targetObject = null;
10294
10294
  _unsubscribes = [];
10295
- _targetUnsubscribe;
10295
+ _targetUnsubscribe = () => {
10296
+ };
10296
10297
  _pingCache = {};
10297
10298
  _currentConnector;
10299
+ _initializationPromise = null;
10298
10300
  constructor(config = _Fuel.defaultConfig) {
10299
10301
  super();
10300
10302
  this.setMaxListeners(1e3);
@@ -10302,8 +10304,19 @@ var _Fuel = class extends FuelConnector {
10302
10304
  this._targetObject = this.getTargetObject(config.targetObject);
10303
10305
  this._storage = config.storage === void 0 ? this.getStorage() : config.storage;
10304
10306
  this.setupMethods();
10305
- this.setDefaultConnector();
10306
- this._targetUnsubscribe = this.setupConnectorListener();
10307
+ this._initializationPromise = this.initialize();
10308
+ }
10309
+ async initialize() {
10310
+ try {
10311
+ await this.setDefaultConnector();
10312
+ this._targetUnsubscribe = this.setupConnectorListener();
10313
+ } catch (error) {
10314
+ throw new FuelError28(ErrorCode25.INVALID_PROVIDER, "Error initializing Fuel Connector");
10315
+ }
10316
+ }
10317
+ async init() {
10318
+ await this._initializationPromise;
10319
+ return this;
10307
10320
  }
10308
10321
  /**
10309
10322
  * Return the target object to listen for global events.