@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.mjs CHANGED
@@ -1408,6 +1408,11 @@ var ChainInfoFragmentDoc = gql`
1408
1408
  consensusParameters {
1409
1409
  ...consensusParametersFragment
1410
1410
  }
1411
+ latestBlock {
1412
+ header {
1413
+ consensusParametersVersion
1414
+ }
1415
+ }
1411
1416
  }
1412
1417
  ${ConsensusParametersFragmentDoc}`;
1413
1418
  var ContractBalanceFragmentDoc = gql`
@@ -1881,7 +1886,7 @@ ${OutputContractCreatedFragmentDoc}
1881
1886
  ${DryRunFailureAssembleTxFragmentDoc}
1882
1887
  ${DryRunSuccessAssembleTxFragmentDoc}`;
1883
1888
  var DryRunDocument = gql`
1884
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
1889
+ query dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
1885
1890
  dryRun(
1886
1891
  txs: $encodedTransactions
1887
1892
  utxoValidation: $utxoValidation
@@ -2510,7 +2515,7 @@ import {
2510
2515
  } from "@fuel-ts/transactions";
2511
2516
  import { hexlify as hexlify5, arrayify as arrayify2, assertUnreachable } from "@fuel-ts/utils";
2512
2517
  var deserializeChain = /* @__PURE__ */ __name((chain) => {
2513
- const { name, daHeight, consensusParameters } = chain;
2518
+ const { name, daHeight, consensusParameters, latestBlock } = chain;
2514
2519
  const {
2515
2520
  contractParams,
2516
2521
  feeParams,
@@ -2561,11 +2566,12 @@ var deserializeChain = /* @__PURE__ */ __name((chain) => {
2561
2566
  maxScriptDataLength: bn5(scriptParams.maxScriptDataLength)
2562
2567
  },
2563
2568
  gasCosts
2564
- }
2569
+ },
2570
+ latestBlock
2565
2571
  };
2566
2572
  }, "deserializeChain");
2567
2573
  var serializeChain = /* @__PURE__ */ __name((chain) => {
2568
- const { name, baseChainHeight, consensusParameters } = chain;
2574
+ const { name, baseChainHeight, consensusParameters, latestBlock } = chain;
2569
2575
  const {
2570
2576
  contractParameters,
2571
2577
  feeParameters,
@@ -2616,7 +2622,8 @@ var serializeChain = /* @__PURE__ */ __name((chain) => {
2616
2622
  maxScriptDataLength: scriptParameters.maxScriptDataLength.toString()
2617
2623
  },
2618
2624
  gasCosts
2619
- }
2625
+ },
2626
+ latestBlock
2620
2627
  };
2621
2628
  }, "serializeChain");
2622
2629
  var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
@@ -3495,8 +3502,6 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3495
3502
  /** List of witnesses */
3496
3503
  witnesses = [];
3497
3504
  /**
3498
- * @hidden
3499
- *
3500
3505
  * The current status of the transaction
3501
3506
  */
3502
3507
  flag = { state: void 0, transactionId: void 0, summary: void 0 };
@@ -3513,7 +3518,8 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3513
3518
  witnessLimit,
3514
3519
  inputs,
3515
3520
  outputs,
3516
- witnesses
3521
+ witnesses,
3522
+ flag
3517
3523
  } = {}) {
3518
3524
  this.tip = tip ? bn9(tip) : void 0;
3519
3525
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
@@ -3523,6 +3529,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3523
3529
  this.inputs = inputs ?? [];
3524
3530
  this.outputs = outputs ?? [];
3525
3531
  this.witnesses = witnesses ?? [];
3532
+ this.flag = flag ?? { state: void 0, transactionId: void 0, summary: void 0 };
3526
3533
  }
3527
3534
  static getPolicyMeta(req) {
3528
3535
  let policyTypes = 0;
@@ -5879,7 +5886,9 @@ function getAllDecodedLogs(opts) {
5879
5886
  const firstCallReceipt = receipts.find(
5880
5887
  (r) => r.type === ReceiptType7.Call && r.id === ZeroBytes3210
5881
5888
  );
5882
- mainContract = firstCallReceipt.to;
5889
+ if (firstCallReceipt) {
5890
+ mainContract = firstCallReceipt.to;
5891
+ }
5883
5892
  }
5884
5893
  return receipts.reduce(
5885
5894
  ({ logs, groupedLogs }, receipt) => {
@@ -5936,9 +5945,9 @@ var TransactionResponse = class _TransactionResponse {
5936
5945
  request;
5937
5946
  status;
5938
5947
  abis;
5948
+ preConfirmationStatus;
5939
5949
  waitingForStreamData = false;
5940
5950
  statusResolvers = /* @__PURE__ */ new Map();
5941
- preConfirmationStatus;
5942
5951
  /**
5943
5952
  * Async constructor for `TransactionResponse`. This method can be used to create
5944
5953
  * an instance of `TransactionResponse` and wait for the transaction to be fetched
@@ -7168,7 +7177,9 @@ var Provider = class _Provider {
7168
7177
  }
7169
7178
  const chainInfo = _Provider.chainInfoCache[this.urlWithoutAuth];
7170
7179
  const {
7171
- consensusParameters: { version: previous }
7180
+ latestBlock: {
7181
+ header: { consensusParametersVersion: previous }
7182
+ }
7172
7183
  } = chainInfo;
7173
7184
  const {
7174
7185
  chain: {
@@ -8316,6 +8327,30 @@ var assembleTransactionSummaryFromJson = /* @__PURE__ */ __name(async (opts) =>
8316
8327
  });
8317
8328
  }, "assembleTransactionSummaryFromJson");
8318
8329
 
8330
+ // src/providers/utils/transaction-response-serialization.ts
8331
+ var deserializeTransactionResponseJson = /* @__PURE__ */ __name((json) => {
8332
+ const {
8333
+ id,
8334
+ abis,
8335
+ status,
8336
+ providerUrl,
8337
+ requestJson,
8338
+ providerCache,
8339
+ gqlTransaction,
8340
+ preConfirmationStatus
8341
+ } = json;
8342
+ const provider = new Provider(providerUrl, { cache: providerCache });
8343
+ const { chainId } = providerCache.chain.consensusParameters;
8344
+ const response = new TransactionResponse(id, provider, Number(chainId), abis);
8345
+ if (requestJson) {
8346
+ response.request = transactionRequestify(JSON.parse(requestJson));
8347
+ }
8348
+ response.status = status;
8349
+ response.gqlTransaction = gqlTransaction;
8350
+ response.preConfirmationStatus = preConfirmationStatus;
8351
+ return response;
8352
+ }, "deserializeTransactionResponseJson");
8353
+
8319
8354
  // src/types.ts
8320
8355
  var AbstractAccount = class {
8321
8356
  static {
@@ -9012,7 +9047,7 @@ var Account = class extends AbstractAccount {
9012
9047
  transactionRequest,
9013
9048
  params
9014
9049
  );
9015
- return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
9050
+ return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : deserializeTransactionResponseJson(transaction);
9016
9051
  }
9017
9052
  if (estimateTxDependencies) {
9018
9053
  await this.provider.estimateTxDependencies(transactionRequest);