@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.mjs CHANGED
@@ -4498,7 +4498,6 @@ Supported fuel-core version: ${supportedVersion}.`
4498
4498
  * @param sendTransactionParams - The provider send transaction parameters (optional).
4499
4499
  * @returns A promise that resolves to the transaction response object.
4500
4500
  */
4501
- // #region Provider-sendTransaction
4502
4501
  async sendTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
4503
4502
  const transactionRequest = transactionRequestify(transactionRequestLike);
4504
4503
  if (estimateTxDependencies) {
@@ -5040,10 +5039,18 @@ Supported fuel-core version: ${supportedVersion}.`
5040
5039
  if (!transaction) {
5041
5040
  return null;
5042
5041
  }
5043
- return new TransactionCoder5().decode(
5044
- arrayify11(transaction.rawPayload),
5045
- 0
5046
- )?.[0];
5042
+ try {
5043
+ return new TransactionCoder5().decode(
5044
+ arrayify11(transaction.rawPayload),
5045
+ 0
5046
+ )?.[0];
5047
+ } catch (error) {
5048
+ if (error instanceof FuelError14 && error.code === ErrorCode13.UNSUPPORTED_TRANSACTION_TYPE) {
5049
+ console.warn("Unsupported transaction type encountered");
5050
+ return null;
5051
+ }
5052
+ throw error;
5053
+ }
5047
5054
  }
5048
5055
  /**
5049
5056
  * Retrieves transactions based on the provided pagination arguments.
@@ -5055,9 +5062,17 @@ Supported fuel-core version: ${supportedVersion}.`
5055
5062
  transactions: { edges, pageInfo }
5056
5063
  } = await this.operations.getTransactions(paginationArgs);
5057
5064
  const coder = new TransactionCoder5();
5058
- const transactions = edges.map(
5059
- ({ node: { rawPayload } }) => coder.decode(arrayify11(rawPayload), 0)[0]
5060
- );
5065
+ const transactions = edges.map(({ node: { rawPayload } }) => {
5066
+ try {
5067
+ return coder.decode(arrayify11(rawPayload), 0)[0];
5068
+ } catch (error) {
5069
+ if (error instanceof FuelError14 && error.code === ErrorCode13.UNSUPPORTED_TRANSACTION_TYPE) {
5070
+ console.warn("Unsupported transaction type encountered");
5071
+ return null;
5072
+ }
5073
+ throw error;
5074
+ }
5075
+ }).filter((tx) => tx !== null);
5061
5076
  return { transactions, pageInfo };
5062
5077
  }
5063
5078
  /**
@@ -10292,9 +10307,11 @@ var _Fuel = class extends FuelConnector {
10292
10307
  _connectors = [];
10293
10308
  _targetObject = null;
10294
10309
  _unsubscribes = [];
10295
- _targetUnsubscribe;
10310
+ _targetUnsubscribe = () => {
10311
+ };
10296
10312
  _pingCache = {};
10297
10313
  _currentConnector;
10314
+ _initializationPromise = null;
10298
10315
  constructor(config = _Fuel.defaultConfig) {
10299
10316
  super();
10300
10317
  this.setMaxListeners(1e3);
@@ -10302,8 +10319,19 @@ var _Fuel = class extends FuelConnector {
10302
10319
  this._targetObject = this.getTargetObject(config.targetObject);
10303
10320
  this._storage = config.storage === void 0 ? this.getStorage() : config.storage;
10304
10321
  this.setupMethods();
10305
- this.setDefaultConnector();
10306
- this._targetUnsubscribe = this.setupConnectorListener();
10322
+ this._initializationPromise = this.initialize();
10323
+ }
10324
+ async initialize() {
10325
+ try {
10326
+ await this.setDefaultConnector();
10327
+ this._targetUnsubscribe = this.setupConnectorListener();
10328
+ } catch (error) {
10329
+ throw new FuelError28(ErrorCode25.INVALID_PROVIDER, "Error initializing Fuel Connector");
10330
+ }
10331
+ }
10332
+ async init() {
10333
+ await this._initializationPromise;
10334
+ return this;
10307
10335
  }
10308
10336
  /**
10309
10337
  * Return the target object to listen for global events.