@fuel-ts/account 0.94.1 → 0.94.3

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
@@ -4656,7 +4656,6 @@ Supported fuel-core version: ${supportedVersion}.`
4656
4656
  * @param sendTransactionParams - The provider send transaction parameters (optional).
4657
4657
  * @returns A promise that resolves to the transaction response object.
4658
4658
  */
4659
- // #region Provider-sendTransaction
4660
4659
  async sendTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4661
4660
  const transactionRequest = transactionRequestify(transactionRequestLike);
4662
4661
  if (estimateTxDependencies) {
@@ -5198,10 +5197,18 @@ Supported fuel-core version: ${supportedVersion}.`
5198
5197
  if (!transaction) {
5199
5198
  return null;
5200
5199
  }
5201
- return new import_transactions20.TransactionCoder().decode(
5202
- (0, import_utils24.arrayify)(transaction.rawPayload),
5203
- 0
5204
- )?.[0];
5200
+ try {
5201
+ return new import_transactions20.TransactionCoder().decode(
5202
+ (0, import_utils24.arrayify)(transaction.rawPayload),
5203
+ 0
5204
+ )?.[0];
5205
+ } catch (error) {
5206
+ if (error instanceof import_errors15.FuelError && error.code === import_errors15.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5207
+ console.warn("Unsupported transaction type encountered");
5208
+ return null;
5209
+ }
5210
+ throw error;
5211
+ }
5205
5212
  }
5206
5213
  /**
5207
5214
  * Retrieves transactions based on the provided pagination arguments.
@@ -5213,9 +5220,17 @@ Supported fuel-core version: ${supportedVersion}.`
5213
5220
  transactions: { edges, pageInfo }
5214
5221
  } = await this.operations.getTransactions(paginationArgs);
5215
5222
  const coder = new import_transactions20.TransactionCoder();
5216
- const transactions = edges.map(
5217
- ({ node: { rawPayload } }) => coder.decode((0, import_utils24.arrayify)(rawPayload), 0)[0]
5218
- );
5223
+ const transactions = edges.map(({ node: { rawPayload } }) => {
5224
+ try {
5225
+ return coder.decode((0, import_utils24.arrayify)(rawPayload), 0)[0];
5226
+ } catch (error) {
5227
+ if (error instanceof import_errors15.FuelError && error.code === import_errors15.ErrorCode.UNSUPPORTED_TRANSACTION_TYPE) {
5228
+ console.warn("Unsupported transaction type encountered");
5229
+ return null;
5230
+ }
5231
+ throw error;
5232
+ }
5233
+ }).filter((tx) => tx !== null);
5219
5234
  return { transactions, pageInfo };
5220
5235
  }
5221
5236
  /**
@@ -10441,9 +10456,11 @@ var _Fuel = class extends FuelConnector {
10441
10456
  _connectors = [];
10442
10457
  _targetObject = null;
10443
10458
  _unsubscribes = [];
10444
- _targetUnsubscribe;
10459
+ _targetUnsubscribe = () => {
10460
+ };
10445
10461
  _pingCache = {};
10446
10462
  _currentConnector;
10463
+ _initializationPromise = null;
10447
10464
  constructor(config = _Fuel.defaultConfig) {
10448
10465
  super();
10449
10466
  this.setMaxListeners(1e3);
@@ -10451,8 +10468,19 @@ var _Fuel = class extends FuelConnector {
10451
10468
  this._targetObject = this.getTargetObject(config.targetObject);
10452
10469
  this._storage = config.storage === void 0 ? this.getStorage() : config.storage;
10453
10470
  this.setupMethods();
10454
- this.setDefaultConnector();
10455
- this._targetUnsubscribe = this.setupConnectorListener();
10471
+ this._initializationPromise = this.initialize();
10472
+ }
10473
+ async initialize() {
10474
+ try {
10475
+ await this.setDefaultConnector();
10476
+ this._targetUnsubscribe = this.setupConnectorListener();
10477
+ } catch (error) {
10478
+ throw new import_errors29.FuelError(import_errors29.ErrorCode.INVALID_PROVIDER, "Error initializing Fuel Connector");
10479
+ }
10480
+ }
10481
+ async init() {
10482
+ await this._initializationPromise;
10483
+ return this;
10456
10484
  }
10457
10485
  /**
10458
10486
  * Return the target object to listen for global events.