@fuel-ts/account 0.100.4 → 0.100.6

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
@@ -113,6 +113,7 @@ __export(src_exports, {
113
113
  deserializeProcessedTxOutput: () => deserializeProcessedTxOutput,
114
114
  deserializeProviderCache: () => deserializeProviderCache,
115
115
  deserializeReceipt: () => deserializeReceipt,
116
+ deserializeTransactionResponseJson: () => deserializeTransactionResponseJson,
116
117
  dispatchFuelConnectorEvent: () => dispatchFuelConnectorEvent,
117
118
  english: () => english,
118
119
  extractBurnedAssetsFromReceipts: () => extractBurnedAssetsFromReceipts,
@@ -213,6 +214,7 @@ __export(src_exports, {
213
214
  serializeChain: () => serializeChain,
214
215
  serializeNodeInfo: () => serializeNodeInfo,
215
216
  serializeProviderCache: () => serializeProviderCache,
217
+ serializeTransactionResponseJson: () => serializeTransactionResponseJson,
216
218
  setAndValidateGasAndFeeForAssembledTx: () => setAndValidateGasAndFeeForAssembledTx,
217
219
  transactionRequestify: () => transactionRequestify,
218
220
  urlJoin: () => urlJoin,
@@ -1629,6 +1631,11 @@ var ChainInfoFragmentDoc = import_graphql_tag.default`
1629
1631
  consensusParameters {
1630
1632
  ...consensusParametersFragment
1631
1633
  }
1634
+ latestBlock {
1635
+ header {
1636
+ consensusParametersVersion
1637
+ }
1638
+ }
1632
1639
  }
1633
1640
  ${ConsensusParametersFragmentDoc}`;
1634
1641
  var ContractBalanceFragmentDoc = import_graphql_tag.default`
@@ -2102,7 +2109,7 @@ ${OutputContractCreatedFragmentDoc}
2102
2109
  ${DryRunFailureAssembleTxFragmentDoc}
2103
2110
  ${DryRunSuccessAssembleTxFragmentDoc}`;
2104
2111
  var DryRunDocument = import_graphql_tag.default`
2105
- mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
2112
+ query dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean, $gasPrice: U64) {
2106
2113
  dryRun(
2107
2114
  txs: $encodedTransactions
2108
2115
  utxoValidation: $utxoValidation
@@ -2719,7 +2726,7 @@ var import_math5 = require("@fuel-ts/math");
2719
2726
  var import_transactions4 = require("@fuel-ts/transactions");
2720
2727
  var import_utils6 = require("@fuel-ts/utils");
2721
2728
  var deserializeChain = /* @__PURE__ */ __name((chain) => {
2722
- const { name, daHeight, consensusParameters } = chain;
2729
+ const { name, daHeight, consensusParameters, latestBlock } = chain;
2723
2730
  const {
2724
2731
  contractParams,
2725
2732
  feeParams,
@@ -2770,11 +2777,12 @@ var deserializeChain = /* @__PURE__ */ __name((chain) => {
2770
2777
  maxScriptDataLength: (0, import_math5.bn)(scriptParams.maxScriptDataLength)
2771
2778
  },
2772
2779
  gasCosts
2773
- }
2780
+ },
2781
+ latestBlock
2774
2782
  };
2775
2783
  }, "deserializeChain");
2776
2784
  var serializeChain = /* @__PURE__ */ __name((chain) => {
2777
- const { name, baseChainHeight, consensusParameters } = chain;
2785
+ const { name, baseChainHeight, consensusParameters, latestBlock } = chain;
2778
2786
  const {
2779
2787
  contractParameters,
2780
2788
  feeParameters,
@@ -2825,7 +2833,8 @@ var serializeChain = /* @__PURE__ */ __name((chain) => {
2825
2833
  maxScriptDataLength: scriptParameters.maxScriptDataLength.toString()
2826
2834
  },
2827
2835
  gasCosts
2828
- }
2836
+ },
2837
+ latestBlock
2829
2838
  };
2830
2839
  }, "serializeChain");
2831
2840
  var deserializeNodeInfo = /* @__PURE__ */ __name((nodeInfo) => {
@@ -3696,8 +3705,6 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3696
3705
  /** List of witnesses */
3697
3706
  witnesses = [];
3698
3707
  /**
3699
- * @hidden
3700
- *
3701
3708
  * The current status of the transaction
3702
3709
  */
3703
3710
  flag = { state: void 0, transactionId: void 0, summary: void 0 };
@@ -3714,7 +3721,8 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3714
3721
  witnessLimit,
3715
3722
  inputs,
3716
3723
  outputs,
3717
- witnesses
3724
+ witnesses,
3725
+ flag
3718
3726
  } = {}) {
3719
3727
  this.tip = tip ? (0, import_math9.bn)(tip) : void 0;
3720
3728
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
@@ -3724,6 +3732,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
3724
3732
  this.inputs = inputs ?? [];
3725
3733
  this.outputs = outputs ?? [];
3726
3734
  this.witnesses = witnesses ?? [];
3735
+ this.flag = flag ?? { state: void 0, transactionId: void 0, summary: void 0 };
3727
3736
  }
3728
3737
  static getPolicyMeta(req) {
3729
3738
  let policyTypes = 0;
@@ -6077,7 +6086,9 @@ function getAllDecodedLogs(opts) {
6077
6086
  const firstCallReceipt = receipts.find(
6078
6087
  (r) => r.type === import_transactions22.ReceiptType.Call && r.id === import_configs12.ZeroBytes32
6079
6088
  );
6080
- mainContract = firstCallReceipt.to;
6089
+ if (firstCallReceipt) {
6090
+ mainContract = firstCallReceipt.to;
6091
+ }
6081
6092
  }
6082
6093
  return receipts.reduce(
6083
6094
  ({ logs, groupedLogs }, receipt) => {
@@ -6134,9 +6145,9 @@ var TransactionResponse = class _TransactionResponse {
6134
6145
  request;
6135
6146
  status;
6136
6147
  abis;
6148
+ preConfirmationStatus;
6137
6149
  waitingForStreamData = false;
6138
6150
  statusResolvers = /* @__PURE__ */ new Map();
6139
- preConfirmationStatus;
6140
6151
  /**
6141
6152
  * Async constructor for `TransactionResponse`. This method can be used to create
6142
6153
  * an instance of `TransactionResponse` and wait for the transaction to be fetched
@@ -7366,7 +7377,9 @@ var Provider = class _Provider {
7366
7377
  }
7367
7378
  const chainInfo = _Provider.chainInfoCache[this.urlWithoutAuth];
7368
7379
  const {
7369
- consensusParameters: { version: previous }
7380
+ latestBlock: {
7381
+ header: { consensusParametersVersion: previous }
7382
+ }
7370
7383
  } = chainInfo;
7371
7384
  const {
7372
7385
  chain: {
@@ -8514,6 +8527,43 @@ var assembleTransactionSummaryFromJson = /* @__PURE__ */ __name(async (opts) =>
8514
8527
  });
8515
8528
  }, "assembleTransactionSummaryFromJson");
8516
8529
 
8530
+ // src/providers/utils/transaction-response-serialization.ts
8531
+ var serializeTransactionResponseJson = /* @__PURE__ */ __name(async (response) => {
8532
+ const { id, status, abis, request: request2, provider, gqlTransaction, preConfirmationStatus } = response;
8533
+ return {
8534
+ id,
8535
+ status,
8536
+ abis,
8537
+ requestJson: request2 ? JSON.stringify(request2.toJSON()) : void 0,
8538
+ providerUrl: provider.url,
8539
+ providerCache: await serializeProviderCache(provider),
8540
+ gqlTransaction,
8541
+ preConfirmationStatus
8542
+ };
8543
+ }, "serializeTransactionResponseJson");
8544
+ var deserializeTransactionResponseJson = /* @__PURE__ */ __name((json) => {
8545
+ const {
8546
+ id,
8547
+ abis,
8548
+ status,
8549
+ providerUrl,
8550
+ requestJson,
8551
+ providerCache,
8552
+ gqlTransaction,
8553
+ preConfirmationStatus
8554
+ } = json;
8555
+ const provider = new Provider(providerUrl, { cache: providerCache });
8556
+ const { chainId } = providerCache.chain.consensusParameters;
8557
+ const response = new TransactionResponse(id, provider, Number(chainId), abis);
8558
+ if (requestJson) {
8559
+ response.request = transactionRequestify(JSON.parse(requestJson));
8560
+ }
8561
+ response.status = status;
8562
+ response.gqlTransaction = gqlTransaction;
8563
+ response.preConfirmationStatus = preConfirmationStatus;
8564
+ return response;
8565
+ }, "deserializeTransactionResponseJson");
8566
+
8517
8567
  // src/types.ts
8518
8568
  var AbstractAccount = class {
8519
8569
  static {
@@ -14109,6 +14159,7 @@ var Fuel = class _Fuel extends FuelConnector {
14109
14159
  deserializeProcessedTxOutput,
14110
14160
  deserializeProviderCache,
14111
14161
  deserializeReceipt,
14162
+ deserializeTransactionResponseJson,
14112
14163
  dispatchFuelConnectorEvent,
14113
14164
  english,
14114
14165
  extractBurnedAssetsFromReceipts,
@@ -14209,6 +14260,7 @@ var Fuel = class _Fuel extends FuelConnector {
14209
14260
  serializeChain,
14210
14261
  serializeNodeInfo,
14211
14262
  serializeProviderCache,
14263
+ serializeTransactionResponseJson,
14212
14264
  setAndValidateGasAndFeeForAssembledTx,
14213
14265
  transactionRequestify,
14214
14266
  urlJoin,