@fuel-ts/account 0.94.0 → 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.js CHANGED
@@ -10441,9 +10441,11 @@ var _Fuel = class extends FuelConnector {
10441
10441
  _connectors = [];
10442
10442
  _targetObject = null;
10443
10443
  _unsubscribes = [];
10444
- _targetUnsubscribe;
10444
+ _targetUnsubscribe = () => {
10445
+ };
10445
10446
  _pingCache = {};
10446
10447
  _currentConnector;
10448
+ _initializationPromise = null;
10447
10449
  constructor(config = _Fuel.defaultConfig) {
10448
10450
  super();
10449
10451
  this.setMaxListeners(1e3);
@@ -10451,8 +10453,19 @@ var _Fuel = class extends FuelConnector {
10451
10453
  this._targetObject = this.getTargetObject(config.targetObject);
10452
10454
  this._storage = config.storage === void 0 ? this.getStorage() : config.storage;
10453
10455
  this.setupMethods();
10454
- this.setDefaultConnector();
10455
- this._targetUnsubscribe = this.setupConnectorListener();
10456
+ this._initializationPromise = this.initialize();
10457
+ }
10458
+ async initialize() {
10459
+ try {
10460
+ await this.setDefaultConnector();
10461
+ this._targetUnsubscribe = this.setupConnectorListener();
10462
+ } catch (error) {
10463
+ throw new import_errors29.FuelError(import_errors29.ErrorCode.INVALID_PROVIDER, "Error initializing Fuel Connector");
10464
+ }
10465
+ }
10466
+ async init() {
10467
+ await this._initializationPromise;
10468
+ return this;
10456
10469
  }
10457
10470
  /**
10458
10471
  * Return the target object to listen for global events.