@fuel-ts/account 0.100.4 → 0.100.5

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
@@ -1629,6 +1629,11 @@ var ChainInfoFragmentDoc = import_graphql_tag.default`
1629
1629
  consensusParameters {
1630
1630
  ...consensusParametersFragment
1631
1631
  }
1632
+ latestBlock {
1633
+ header {
1634
+ consensusParametersVersion
1635
+ }
1636
+ }
1632
1637
  }
1633
1638
  ${ConsensusParametersFragmentDoc}`;
1634
1639
  var ContractBalanceFragmentDoc = import_graphql_tag.default`
@@ -2102,7 +2107,7 @@ ${OutputContractCreatedFragmentDoc}
2102
2107
  ${DryRunFailureAssembleTxFragmentDoc}
2103
2108
  ${DryRunSuccessAssembleTxFragmentDoc}`;
2104
2109
  var DryRunDocument = import_graphql_tag.default`
2105
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
2110
+ query dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
2106
2111
  dryRun(
2107
2112
  txs: $encodedTransactions
2108
2113
  utxoValidation: $utxoValidation
@@ -2719,7 +2724,7 @@ var import_math5 = require("@fuel-ts/math");
2719
2724
  var import_transactions4 = require("@fuel-ts/transactions");
2720
2725
  var import_utils6 = require("@fuel-ts/utils");
2721
2726
  var deserializeChain = /* @__PURE__ */ __name((chain) => {
2722
- const { name, daHeight, consensusParameters } = chain;
2727
+ const { name, daHeight, consensusParameters, latestBlock } = chain;
2723
2728
  const {
2724
2729
  contractParams,
2725
2730
  feeParams,
@@ -2770,11 +2775,12 @@ var deserializeChain = /* @__PURE__ */ __name((chain) => {
2770
2775
  maxScriptDataLength: (0, import_math5.bn)(scriptParams.maxScriptDataLength)
2771
2776
  },
2772
2777
  gasCosts
2773
- }
2778
+ },
2779
+ latestBlock
2774
2780
  };
2775
2781
  }, "deserializeChain");
2776
2782
  var serializeChain = /* @__PURE__ */ __name((chain) => {
2777
- const { name, baseChainHeight, consensusParameters } = chain;
2783
+ const { name, baseChainHeight, consensusParameters, latestBlock } = chain;
2778
2784
  const {
2779
2785
  contractParameters,
2780
2786
  feeParameters,
@@ -2825,7 +2831,8 @@ var serializeChain = /* @__PURE__ */ __name((chain) => {
2825
2831
  maxScriptDataLength: scriptParameters.maxScriptDataLength.toString()
2826
2832
  },
2827
2833
  gasCosts
2828
- }
2834
+ },
2835
+ latestBlock
2829
2836
  };
2830
2837
  }, "serializeChain");
2831
2838
  var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
@@ -3696,8 +3703,6 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3696
3703
  /** List of witnesses */
3697
3704
  witnesses = [];
3698
3705
  /**
3699
- * @hidden
3700
- *
3701
3706
  * The current status of the transaction
3702
3707
  */
3703
3708
  flag = { state: void 0, transactionId: void 0, summary: void 0 };
@@ -3714,7 +3719,8 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3714
3719
  witnessLimit,
3715
3720
  inputs,
3716
3721
  outputs,
3717
- witnesses
3722
+ witnesses,
3723
+ flag
3718
3724
  } = {}) {
3719
3725
  this.tip = tip ? (0, import_math9.bn)(tip) : void 0;
3720
3726
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
@@ -3724,6 +3730,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3724
3730
  this.inputs = inputs ?? [];
3725
3731
  this.outputs = outputs ?? [];
3726
3732
  this.witnesses = witnesses ?? [];
3733
+ this.flag = flag ?? { state: void 0, transactionId: void 0, summary: void 0 };
3727
3734
  }
3728
3735
  static getPolicyMeta(req) {
3729
3736
  let policyTypes = 0;
@@ -6077,7 +6084,9 @@ function getAllDecodedLogs(opts) {
6077
6084
  const firstCallReceipt = receipts.find(
6078
6085
  (r) => r.type === import_transactions22.ReceiptType.Call && r.id === import_configs12.ZeroBytes32
6079
6086
  );
6080
- mainContract = firstCallReceipt.to;
6087
+ if (firstCallReceipt) {
6088
+ mainContract = firstCallReceipt.to;
6089
+ }
6081
6090
  }
6082
6091
  return receipts.reduce(
6083
6092
  ({ logs, groupedLogs }, receipt) => {
@@ -6134,9 +6143,9 @@ var TransactionResponse = class _TransactionResponse {
6134
6143
  request;
6135
6144
  status;
6136
6145
  abis;
6146
+ preConfirmationStatus;
6137
6147
  waitingForStreamData = false;
6138
6148
  statusResolvers = /* @__PURE__ */ new Map();
6139
- preConfirmationStatus;
6140
6149
  /**
6141
6150
  * Async constructor for `TransactionResponse`. This method can be used to create
6142
6151
  * an instance of `TransactionResponse` and wait for the transaction to be fetched
@@ -7366,7 +7375,9 @@ var Provider = class _Provider {
7366
7375
  }
7367
7376
  const chainInfo = _Provider.chainInfoCache[this.urlWithoutAuth];
7368
7377
  const {
7369
- consensusParameters: { version: previous }
7378
+ latestBlock: {
7379
+ header: { consensusParametersVersion: previous }
7380
+ }
7370
7381
  } = chainInfo;
7371
7382
  const {
7372
7383
  chain: {
@@ -8514,6 +8525,30 @@ var assembleTransactionSummaryFromJson = /* @__PURE__ */ __name(async (opts) =>
8514
8525
  });
8515
8526
  }, "assembleTransactionSummaryFromJson");
8516
8527
 
8528
+ // src/providers/utils/transaction-response-serialization.ts
8529
+ var deserializeTransactionResponseJson = /* @__PURE__ */ __name((json) => {
8530
+ const {
8531
+ id,
8532
+ abis,
8533
+ status,
8534
+ providerUrl,
8535
+ requestJson,
8536
+ providerCache,
8537
+ gqlTransaction,
8538
+ preConfirmationStatus
8539
+ } = json;
8540
+ const provider = new Provider(providerUrl, { cache: providerCache });
8541
+ const { chainId } = providerCache.chain.consensusParameters;
8542
+ const response = new TransactionResponse(id, provider, Number(chainId), abis);
8543
+ if (requestJson) {
8544
+ response.request = transactionRequestify(JSON.parse(requestJson));
8545
+ }
8546
+ response.status = status;
8547
+ response.gqlTransaction = gqlTransaction;
8548
+ response.preConfirmationStatus = preConfirmationStatus;
8549
+ return response;
8550
+ }, "deserializeTransactionResponseJson");
8551
+
8517
8552
  // src/types.ts
8518
8553
  var AbstractAccount = class {
8519
8554
  static {
@@ -9210,7 +9245,7 @@ var Account = class extends AbstractAccount {
9210
9245
  transactionRequest,
9211
9246
  params
9212
9247
  );
9213
- return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
9248
+ return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : deserializeTransactionResponseJson(transaction);
9214
9249
  }
9215
9250
  if (estimateTxDependencies) {
9216
9251
  await this.provider.estimateTxDependencies(transactionRequest);