@fuel-ts/account 0.100.0 → 0.100.1

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.
@@ -17289,7 +17289,7 @@
17289
17289
  return {
17290
17290
  FUEL_CORE: "0.41.9",
17291
17291
  FORC: "0.67.0",
17292
- FUELS: "0.100.0"
17292
+ FUELS: "0.100.1"
17293
17293
  };
17294
17294
  }
17295
17295
  function parseVersion(version) {
@@ -25773,6 +25773,24 @@ spurious results.`);
25773
25773
  gql["default"] = gql;
25774
25774
  var lib_default2 = gql;
25775
25775
 
25776
+ // src/connectors/utils/promises.ts
25777
+ function deferPromise() {
25778
+ const defer = {};
25779
+ defer.promise = new Promise((resolve, reject) => {
25780
+ defer.reject = reject;
25781
+ defer.resolve = resolve;
25782
+ });
25783
+ return defer;
25784
+ }
25785
+ async function withTimeout(promise, timeout = 1050) {
25786
+ const timeoutPromise = new Promise((resolve, reject) => {
25787
+ setTimeout(() => {
25788
+ reject(new FuelError(FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
25789
+ }, timeout);
25790
+ });
25791
+ return Promise.race([timeoutPromise, promise]);
25792
+ }
25793
+
25776
25794
  // src/providers/__generated__/operations.ts
25777
25795
  var SubmittedStatusFragmentDoc = lib_default2`
25778
25796
  fragment SubmittedStatusFragment on SubmittedStatus {
@@ -30030,12 +30048,23 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
30030
30048
 
30031
30049
  // src/providers/transaction-response/getDecodedLogs.ts
30032
30050
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
30051
+ let mainContract = "";
30052
+ if (mainAbi.programType === "contract") {
30053
+ const firstCallReceipt = receipts.find(
30054
+ (r) => r.type === ReceiptType.Call && r.id === ZeroBytes32
30055
+ );
30056
+ mainContract = firstCallReceipt.to;
30057
+ }
30033
30058
  return receipts.reduce((logs, receipt) => {
30034
30059
  if (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log) {
30035
- const interfaceToUse = new Interface(externalAbis[receipt.id] || mainAbi);
30036
- const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
30037
- const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
30038
- logs.push(decodedLog);
30060
+ const isLogFromMainAbi = receipt.id === ZeroBytes32 || mainContract === receipt.id;
30061
+ const isDecodable = isLogFromMainAbi || externalAbis[receipt.id];
30062
+ if (isDecodable) {
30063
+ const interfaceToUse = isLogFromMainAbi ? new Interface(mainAbi) : new Interface(externalAbis[receipt.id]);
30064
+ const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.ra) : receipt.data;
30065
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.rb.toString());
30066
+ logs.push(decodedLog);
30067
+ }
30039
30068
  }
30040
30069
  return logs;
30041
30070
  }, []);
@@ -30471,6 +30500,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
30471
30500
  }
30472
30501
  /** @hidden */
30473
30502
  static clearChainAndNodeCaches() {
30503
+ _Provider.inflightFetchChainAndNodeInfoRequests = {};
30474
30504
  _Provider.nodeInfoCache = {};
30475
30505
  _Provider.chainInfoCache = {};
30476
30506
  }
@@ -30588,13 +30618,24 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
30588
30618
  throw new Error(`Jumps to the catch block and re-fetch`);
30589
30619
  }
30590
30620
  } catch (_err) {
30621
+ const inflightRequest = _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
30622
+ if (inflightRequest) {
30623
+ const now2 = await inflightRequest;
30624
+ this.consensusParametersTimestamp = now2;
30625
+ return this.fetchChainAndNodeInfo();
30626
+ }
30627
+ const { promise, resolve } = deferPromise();
30628
+ _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth] = promise;
30591
30629
  const data = await this.operations.getChainAndNodeInfo();
30592
30630
  nodeInfo = deserializeNodeInfo(data.nodeInfo);
30593
- _Provider.setIncompatibleNodeVersionMessage(nodeInfo);
30594
30631
  chain = deserializeChain(data.chain);
30632
+ _Provider.setIncompatibleNodeVersionMessage(nodeInfo);
30595
30633
  _Provider.chainInfoCache[this.urlWithoutAuth] = chain;
30596
30634
  _Provider.nodeInfoCache[this.urlWithoutAuth] = nodeInfo;
30597
- this.consensusParametersTimestamp = Date.now();
30635
+ const now = Date.now();
30636
+ this.consensusParametersTimestamp = now;
30637
+ resolve(now);
30638
+ delete _Provider.inflightFetchChainAndNodeInfoRequests[this.urlWithoutAuth];
30598
30639
  }
30599
30640
  return {
30600
30641
  chain,
@@ -31938,6 +31979,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
31938
31979
  this.cache.set(transactionId, inputs);
31939
31980
  };
31940
31981
  /** @hidden */
31982
+ __publicField(Provider, "inflightFetchChainAndNodeInfoRequests", {});
31983
+ /** @hidden */
31941
31984
  __publicField(Provider, "chainInfoCache", {});
31942
31985
  /** @hidden */
31943
31986
  __publicField(Provider, "nodeInfoCache", {});
@@ -38731,24 +38774,6 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
38731
38774
  );
38732
38775
  }
38733
38776
 
38734
- // src/connectors/utils/promises.ts
38735
- function deferPromise() {
38736
- const defer = {};
38737
- defer.promise = new Promise((resolve, reject) => {
38738
- defer.reject = reject;
38739
- defer.resolve = resolve;
38740
- });
38741
- return defer;
38742
- }
38743
- async function withTimeout(promise, timeout = 1050) {
38744
- const timeoutPromise = new Promise((resolve, reject) => {
38745
- setTimeout(() => {
38746
- reject(new FuelError(FuelError.CODES.TIMEOUT_EXCEEDED, "Promise timed out"));
38747
- }, timeout);
38748
- });
38749
- return Promise.race([timeoutPromise, promise]);
38750
- }
38751
-
38752
38777
  // src/connectors/fuel.ts
38753
38778
  var HAS_CONNECTOR_TIMEOUT = 2e3;
38754
38779
  var PING_CACHE_TIME = 5e3;