@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.
@@ -1103,6 +1103,11 @@ var ChainInfoFragmentDoc = import_graphql_tag.default`
1103
1103
  consensusParameters {
1104
1104
  ...consensusParametersFragment
1105
1105
  }
1106
+ latestBlock {
1107
+ header {
1108
+ consensusParametersVersion
1109
+ }
1110
+ }
1106
1111
  }
1107
1112
  ${ConsensusParametersFragmentDoc}`;
1108
1113
  var ContractBalanceFragmentDoc = import_graphql_tag.default`
@@ -1576,7 +1581,7 @@ ${OutputContractCreatedFragmentDoc}
1576
1581
  ${DryRunFailureAssembleTxFragmentDoc}
1577
1582
  ${DryRunSuccessAssembleTxFragmentDoc}`;
1578
1583
  var DryRunDocument = import_graphql_tag.default`
1579
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
1584
+ query dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
1580
1585
  dryRun(
1581
1586
  txs: $encodedTransactions
1582
1587
  utxoValidation: $utxoValidation
@@ -2190,7 +2195,7 @@ var import_math6 = require("@fuel-ts/math");
2190
2195
  var import_transactions4 = require("@fuel-ts/transactions");
2191
2196
  var import_utils7 = require("@fuel-ts/utils");
2192
2197
  var deserializeChain = /* @__PURE__ */ __name((chain) => {
2193
- const { name, daHeight, consensusParameters } = chain;
2198
+ const { name, daHeight, consensusParameters, latestBlock } = chain;
2194
2199
  const {
2195
2200
  contractParams,
2196
2201
  feeParams,
@@ -2241,11 +2246,12 @@ var deserializeChain = /* @__PURE__ */ __name((chain) => {
2241
2246
  maxScriptDataLength: (0, import_math6.bn)(scriptParams.maxScriptDataLength)
2242
2247
  },
2243
2248
  gasCosts
2244
- }
2249
+ },
2250
+ latestBlock
2245
2251
  };
2246
2252
  }, "deserializeChain");
2247
2253
  var serializeChain = /* @__PURE__ */ __name((chain) => {
2248
- const { name, baseChainHeight, consensusParameters } = chain;
2254
+ const { name, baseChainHeight, consensusParameters, latestBlock } = chain;
2249
2255
  const {
2250
2256
  contractParameters,
2251
2257
  feeParameters,
@@ -2296,7 +2302,8 @@ var serializeChain = /* @__PURE__ */ __name((chain) => {
2296
2302
  maxScriptDataLength: scriptParameters.maxScriptDataLength.toString()
2297
2303
  },
2298
2304
  gasCosts
2299
- }
2305
+ },
2306
+ latestBlock
2300
2307
  };
2301
2308
  }, "serializeChain");
2302
2309
  var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
@@ -3075,8 +3082,6 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3075
3082
  /** List of witnesses */
3076
3083
  witnesses = [];
3077
3084
  /**
3078
- * @hidden
3079
- *
3080
3085
  * The current status of the transaction
3081
3086
  */
3082
3087
  flag = { state: void 0, transactionId: void 0, summary: void 0 };
@@ -3093,7 +3098,8 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3093
3098
  witnessLimit,
3094
3099
  inputs,
3095
3100
  outputs,
3096
- witnesses
3101
+ witnesses,
3102
+ flag
3097
3103
  } = {}) {
3098
3104
  this.tip = tip ? (0, import_math10.bn)(tip) : void 0;
3099
3105
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
@@ -3103,6 +3109,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3103
3109
  this.inputs = inputs ?? [];
3104
3110
  this.outputs = outputs ?? [];
3105
3111
  this.witnesses = witnesses ?? [];
3112
+ this.flag = flag ?? { state: void 0, transactionId: void 0, summary: void 0 };
3106
3113
  }
3107
3114
  static getPolicyMeta(req) {
3108
3115
  let policyTypes = 0;
@@ -5394,7 +5401,9 @@ function getAllDecodedLogs(opts) {
5394
5401
  const firstCallReceipt = receipts.find(
5395
5402
  (r) => r.type === import_transactions22.ReceiptType.Call && r.id === import_configs12.ZeroBytes32
5396
5403
  );
5397
- mainContract = firstCallReceipt.to;
5404
+ if (firstCallReceipt) {
5405
+ mainContract = firstCallReceipt.to;
5406
+ }
5398
5407
  }
5399
5408
  return receipts.reduce(
5400
5409
  ({ logs, groupedLogs }, receipt) => {
@@ -5451,9 +5460,9 @@ var TransactionResponse = class _TransactionResponse {
5451
5460
  request;
5452
5461
  status;
5453
5462
  abis;
5463
+ preConfirmationStatus;
5454
5464
  waitingForStreamData = false;
5455
5465
  statusResolvers = /* @__PURE__ */ new Map();
5456
- preConfirmationStatus;
5457
5466
  /**
5458
5467
  * Async constructor for `TransactionResponse`. This method can be used to create
5459
5468
  * an instance of `TransactionResponse` and wait for the transaction to be fetched
@@ -6660,7 +6669,9 @@ var Provider = class _Provider {
6660
6669
  }
6661
6670
  const chainInfo = _Provider.chainInfoCache[this.urlWithoutAuth];
6662
6671
  const {
6663
- consensusParameters: { version: previous }
6672
+ latestBlock: {
6673
+ header: { consensusParametersVersion: previous }
6674
+ }
6664
6675
  } = chainInfo;
6665
6676
  const {
6666
6677
  chain: {
@@ -7693,6 +7704,30 @@ var import_transactions28 = require("@fuel-ts/transactions");
7693
7704
  var import_utils38 = require("@fuel-ts/utils");
7694
7705
  var import_ramda9 = require("ramda");
7695
7706
 
7707
+ // src/providers/utils/transaction-response-serialization.ts
7708
+ var deserializeTransactionResponseJson = /* @__PURE__ */ __name((json) => {
7709
+ const {
7710
+ id,
7711
+ abis,
7712
+ status,
7713
+ providerUrl,
7714
+ requestJson,
7715
+ providerCache,
7716
+ gqlTransaction,
7717
+ preConfirmationStatus
7718
+ } = json;
7719
+ const provider = new Provider(providerUrl, { cache: providerCache });
7720
+ const { chainId } = providerCache.chain.consensusParameters;
7721
+ const response = new TransactionResponse(id, provider, Number(chainId), abis);
7722
+ if (requestJson) {
7723
+ response.request = transactionRequestify(JSON.parse(requestJson));
7724
+ }
7725
+ response.status = status;
7726
+ response.gqlTransaction = gqlTransaction;
7727
+ response.preConfirmationStatus = preConfirmationStatus;
7728
+ return response;
7729
+ }, "deserializeTransactionResponseJson");
7730
+
7696
7731
  // src/types.ts
7697
7732
  var AbstractAccount = class {
7698
7733
  static {
@@ -8389,7 +8424,7 @@ var Account = class extends AbstractAccount {
8389
8424
  transactionRequest,
8390
8425
  params
8391
8426
  );
8392
- return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
8427
+ return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : deserializeTransactionResponseJson(transaction);
8393
8428
  }
8394
8429
  if (estimateTxDependencies) {
8395
8430
  await this.provider.estimateTxDependencies(transactionRequest);