@fuel-ts/account 0.100.6 → 0.101.1

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.
@@ -5636,6 +5636,11 @@ var TransactionResponse = class _TransactionResponse {
5636
5636
  if (statusChange.type === "PreconfirmationSuccessStatus" || statusChange.type === "PreconfirmationFailureStatus") {
5637
5637
  this.preConfirmationStatus = statusChange;
5638
5638
  this.resolveStatus("preConfirmation");
5639
+ const pendingConfirmationResolvers = this.statusResolvers.get("confirmation");
5640
+ if (!pendingConfirmationResolvers) {
5641
+ this.waitingForStreamData = false;
5642
+ break;
5643
+ }
5639
5644
  }
5640
5645
  if (statusChange.type === "SuccessStatus" || statusChange.type === "FailureStatus") {
5641
5646
  this.resolveStatus("confirmation");
@@ -6758,7 +6763,7 @@ var Provider = class _Provider {
6758
6763
  * @returns A promise that resolves to the transaction cost object.
6759
6764
  *
6760
6765
  * @deprecated Use provider.assembleTx instead
6761
- * Check the migration guide https://docs.fuel.network/guide/assembling-transactions/migration-guide.html for more information.
6766
+ * Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
6762
6767
  */
6763
6768
  async getTransactionCost(transactionRequestLike, { signatureCallback, gasPrice: gasPriceParam } = {}) {
6764
6769
  const txRequestClone = clone8(transactionRequestify(transactionRequestLike));
@@ -6902,7 +6907,7 @@ var Provider = class _Provider {
6902
6907
  requiredBalances,
6903
6908
  estimatePredicates,
6904
6909
  excludeInput,
6905
- reserveGas: reserveGas ? reserveGas.toString(10) : void 0
6910
+ reserveGas: reserveGas ? bn18(reserveGas).toString(10) : void 0
6906
6911
  });
6907
6912
  if (status.type === "DryRunFailureStatus") {
6908
6913
  const parsedReceipts = status.receipts.map(deserializeReceipt);
@@ -6914,8 +6919,8 @@ var Provider = class _Provider {
6914
6919
  if (gqlTransaction.policies?.maxFee) {
6915
6920
  request.maxFee = bn18(gqlTransaction.policies.maxFee);
6916
6921
  }
6917
- if (gqlTransaction.scriptGasLimit) {
6918
- request.gasLimit = bn18(gqlTransaction.scriptGasLimit);
6922
+ if (request.type === TransactionType11.Script) {
6923
+ request.gasLimit = bn18(gqlTransaction.scriptGasLimit).add(bn18(reserveGas));
6919
6924
  }
6920
6925
  const rawReceipts = status.receipts;
6921
6926
  const chainId = await this.getChainId();
@@ -7865,7 +7870,7 @@ var Account = class extends AbstractAccount {
7865
7870
  * @returns A promise that resolves to the funded transaction request.
7866
7871
  *
7867
7872
  * @deprecated Use provider.assembleTx instead
7868
- * Check the migration guide https://docs.fuel.network/guide/assembling-transactions/migration-guide.html for more information.
7873
+ * Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
7869
7874
  */
7870
7875
  async fund(request, params) {
7871
7876
  const {
@@ -8284,7 +8289,7 @@ var Account = class extends AbstractAccount {
8284
8289
  * @returns A promise that resolves to the transaction cost object.
8285
8290
  *
8286
8291
  * @deprecated Use provider.assembleTx instead
8287
- * Check the migration guide https://docs.fuel.network/guide/assembling-transactions/migration-guide.html for more information.
8292
+ * Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
8288
8293
  */
8289
8294
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [], gasPrice } = {}) {
8290
8295
  const txRequestClone = clone9(transactionRequestify(transactionRequestLike));
@@ -8349,14 +8354,23 @@ var Account = class extends AbstractAccount {
8349
8354
  * @param transactionRequestLike - The transaction request to sign.
8350
8355
  * @returns A promise that resolves to the signature of the transaction.
8351
8356
  */
8352
- async signTransaction(transactionRequestLike) {
8357
+ async signTransaction(transactionRequestLike, connectorOptions = {}) {
8353
8358
  if (!this._connector) {
8354
8359
  throw new FuelError22(
8355
8360
  ErrorCode19.MISSING_CONNECTOR,
8356
8361
  "A connector is required to sign transactions."
8357
8362
  );
8358
8363
  }
8359
- return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
8364
+ const transactionRequest = transactionRequestify(transactionRequestLike);
8365
+ const { transactionRequest: requestToSign, connectorsSendTxParams } = await this.setTransactionStateForConnectors({
8366
+ transactionRequest,
8367
+ connectorOptions
8368
+ });
8369
+ return this._connector.signTransaction(
8370
+ this.address.toString(),
8371
+ requestToSign,
8372
+ connectorsSendTxParams
8373
+ );
8360
8374
  }
8361
8375
  /**
8362
8376
  * Sends a transaction to the network.
@@ -8366,24 +8380,16 @@ var Account = class extends AbstractAccount {
8366
8380
  * @returns A promise that resolves to the transaction response.
8367
8381
  */
8368
8382
  async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
8369
- let transactionRequest = transactionRequestify(transactionRequestLike);
8383
+ const transactionRequest = transactionRequestify(transactionRequestLike);
8370
8384
  if (this._connector) {
8371
- const { onBeforeSend, skipCustomFee = false } = connectorOptions;
8372
- transactionRequest = await this.prepareTransactionForSend(transactionRequest);
8373
- const params = {
8374
- onBeforeSend,
8375
- skipCustomFee,
8376
- provider: {
8377
- url: this.provider.url,
8378
- cache: await serializeProviderCache(this.provider)
8379
- },
8380
- transactionState: transactionRequest.flag.state,
8381
- transactionSummary: await this.prepareTransactionSummary(transactionRequest)
8382
- };
8385
+ const response = await this.setTransactionStateForConnectors({
8386
+ transactionRequest,
8387
+ connectorOptions
8388
+ });
8383
8389
  const transaction = await this._connector.sendTransaction(
8384
8390
  this.address.toString(),
8385
- transactionRequest,
8386
- params
8391
+ response.transactionRequest,
8392
+ response.connectorsSendTxParams
8387
8393
  );
8388
8394
  return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
8389
8395
  }
@@ -8517,6 +8523,23 @@ var Account = class extends AbstractAccount {
8517
8523
  );
8518
8524
  }
8519
8525
  }
8526
+ /** @hidden * */
8527
+ async setTransactionStateForConnectors(params) {
8528
+ const { transactionRequest: requestToPrepare, connectorOptions } = params;
8529
+ const { onBeforeSend, skipCustomFee = false } = connectorOptions;
8530
+ const transactionRequest = await this.prepareTransactionForSend(requestToPrepare);
8531
+ const connectorsSendTxParams = {
8532
+ onBeforeSend,
8533
+ skipCustomFee,
8534
+ provider: {
8535
+ url: this.provider.url,
8536
+ cache: await serializeProviderCache(this.provider)
8537
+ },
8538
+ transactionState: requestToPrepare.flag.state,
8539
+ transactionSummary: await this.prepareTransactionSummary(requestToPrepare)
8540
+ };
8541
+ return { transactionRequest, connectorsSendTxParams };
8542
+ }
8520
8543
  };
8521
8544
 
8522
8545
  // src/wallet/keystore-wallet.ts