@fuel-ts/account 0.100.5 → 0.101.0

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,
@@ -6334,6 +6336,11 @@ var TransactionResponse = class _TransactionResponse {
6334
6336
  if (statusChange.type === "PreconfirmationSuccessStatus" || statusChange.type === "PreconfirmationFailureStatus") {
6335
6337
  this.preConfirmationStatus = statusChange;
6336
6338
  this.resolveStatus("preConfirmation");
6339
+ const pendingConfirmationResolvers = this.statusResolvers.get("confirmation");
6340
+ if (!pendingConfirmationResolvers) {
6341
+ this.waitingForStreamData = false;
6342
+ break;
6343
+ }
6337
6344
  }
6338
6345
  if (statusChange.type === "SuccessStatus" || statusChange.type === "FailureStatus") {
6339
6346
  this.resolveStatus("confirmation");
@@ -7479,7 +7486,7 @@ var Provider = class _Provider {
7479
7486
  * @returns A promise that resolves to the transaction cost object.
7480
7487
  *
7481
7488
  * @deprecated Use provider.assembleTx instead
7482
- * Check the migration guide https://docs.fuel.network/guide/assembling-transactions/migration-guide.html for more information.
7489
+ * Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
7483
7490
  */
7484
7491
  async getTransactionCost(transactionRequestLike, { signatureCallback, gasPrice: gasPriceParam } = {}) {
7485
7492
  const txRequestClone = (0, import_ramda8.clone)(transactionRequestify(transactionRequestLike));
@@ -7623,7 +7630,7 @@ var Provider = class _Provider {
7623
7630
  requiredBalances,
7624
7631
  estimatePredicates,
7625
7632
  excludeInput,
7626
- reserveGas: reserveGas ? reserveGas.toString(10) : void 0
7633
+ reserveGas: reserveGas ? (0, import_math19.bn)(reserveGas).toString(10) : void 0
7627
7634
  });
7628
7635
  if (status.type === "DryRunFailureStatus") {
7629
7636
  const parsedReceipts = status.receipts.map(deserializeReceipt);
@@ -7635,8 +7642,8 @@ var Provider = class _Provider {
7635
7642
  if (gqlTransaction.policies?.maxFee) {
7636
7643
  request2.maxFee = (0, import_math19.bn)(gqlTransaction.policies.maxFee);
7637
7644
  }
7638
- if (gqlTransaction.scriptGasLimit) {
7639
- request2.gasLimit = (0, import_math19.bn)(gqlTransaction.scriptGasLimit);
7645
+ if (request2.type === import_transactions25.TransactionType.Script) {
7646
+ request2.gasLimit = (0, import_math19.bn)(gqlTransaction.scriptGasLimit).add((0, import_math19.bn)(reserveGas));
7640
7647
  }
7641
7648
  const rawReceipts = status.receipts;
7642
7649
  const chainId = await this.getChainId();
@@ -8526,6 +8533,19 @@ var assembleTransactionSummaryFromJson = /* @__PURE__ */ __name(async (opts) =>
8526
8533
  }, "assembleTransactionSummaryFromJson");
8527
8534
 
8528
8535
  // src/providers/utils/transaction-response-serialization.ts
8536
+ var serializeTransactionResponseJson = /* @__PURE__ */ __name(async (response) => {
8537
+ const { id, status, abis, request: request2, provider, gqlTransaction, preConfirmationStatus } = response;
8538
+ return {
8539
+ id,
8540
+ status,
8541
+ abis,
8542
+ requestJson: request2 ? JSON.stringify(request2.toJSON()) : void 0,
8543
+ providerUrl: provider.url,
8544
+ providerCache: await serializeProviderCache(provider),
8545
+ gqlTransaction,
8546
+ preConfirmationStatus
8547
+ };
8548
+ }, "serializeTransactionResponseJson");
8529
8549
  var deserializeTransactionResponseJson = /* @__PURE__ */ __name((json) => {
8530
8550
  const {
8531
8551
  id,
@@ -8725,7 +8745,7 @@ var Account = class extends AbstractAccount {
8725
8745
  * @returns A promise that resolves to the funded transaction request.
8726
8746
  *
8727
8747
  * @deprecated Use provider.assembleTx instead
8728
- * Check the migration guide https://docs.fuel.network/guide/assembling-transactions/migration-guide.html for more information.
8748
+ * Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
8729
8749
  */
8730
8750
  async fund(request2, params) {
8731
8751
  const {
@@ -9144,7 +9164,7 @@ var Account = class extends AbstractAccount {
9144
9164
  * @returns A promise that resolves to the transaction cost object.
9145
9165
  *
9146
9166
  * @deprecated Use provider.assembleTx instead
9147
- * Check the migration guide https://docs.fuel.network/guide/assembling-transactions/migration-guide.html for more information.
9167
+ * Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
9148
9168
  */
9149
9169
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [], gasPrice } = {}) {
9150
9170
  const txRequestClone = (0, import_ramda9.clone)(transactionRequestify(transactionRequestLike));
@@ -9245,7 +9265,7 @@ var Account = class extends AbstractAccount {
9245
9265
  transactionRequest,
9246
9266
  params
9247
9267
  );
9248
- return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : deserializeTransactionResponseJson(transaction);
9268
+ return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
9249
9269
  }
9250
9270
  if (estimateTxDependencies) {
9251
9271
  await this.provider.estimateTxDependencies(transactionRequest);
@@ -13215,6 +13235,14 @@ var Predicate = class _Predicate extends Account {
13215
13235
  configurableConstants: overrides.configurableConstants ?? this.configurableConstants
13216
13236
  });
13217
13237
  }
13238
+ /**
13239
+ * Sets the predicate data.
13240
+ *
13241
+ * @param data - The data to be set for the predicate.
13242
+ */
13243
+ setData(data) {
13244
+ this.predicateData = data;
13245
+ }
13218
13246
  /**
13219
13247
  * Processes the predicate data and returns the altered bytecode and interface.
13220
13248
  *
@@ -14144,6 +14172,7 @@ var Fuel = class _Fuel extends FuelConnector {
14144
14172
  deserializeProcessedTxOutput,
14145
14173
  deserializeProviderCache,
14146
14174
  deserializeReceipt,
14175
+ deserializeTransactionResponseJson,
14147
14176
  dispatchFuelConnectorEvent,
14148
14177
  english,
14149
14178
  extractBurnedAssetsFromReceipts,
@@ -14244,6 +14273,7 @@ var Fuel = class _Fuel extends FuelConnector {
14244
14273
  serializeChain,
14245
14274
  serializeNodeInfo,
14246
14275
  serializeProviderCache,
14276
+ serializeTransactionResponseJson,
14247
14277
  setAndValidateGasAndFeeForAssembledTx,
14248
14278
  transactionRequestify,
14249
14279
  urlJoin,