@fuel-ts/account 0.101.0 → 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.
@@ -8369,14 +8369,23 @@ var Account = class extends AbstractAccount {
8369
8369
  * @param transactionRequestLike - The transaction request to sign.
8370
8370
  * @returns A promise that resolves to the signature of the transaction.
8371
8371
  */
8372
- async signTransaction(transactionRequestLike) {
8372
+ async signTransaction(transactionRequestLike, connectorOptions = {}) {
8373
8373
  if (!this._connector) {
8374
8374
  throw new import_errors23.FuelError(
8375
8375
  import_errors23.ErrorCode.MISSING_CONNECTOR,
8376
8376
  "A connector is required to sign transactions."
8377
8377
  );
8378
8378
  }
8379
- return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
8379
+ const transactionRequest = transactionRequestify(transactionRequestLike);
8380
+ const { transactionRequest: requestToSign, connectorsSendTxParams } = await this.setTransactionStateForConnectors({
8381
+ transactionRequest,
8382
+ connectorOptions
8383
+ });
8384
+ return this._connector.signTransaction(
8385
+ this.address.toString(),
8386
+ requestToSign,
8387
+ connectorsSendTxParams
8388
+ );
8380
8389
  }
8381
8390
  /**
8382
8391
  * Sends a transaction to the network.
@@ -8386,24 +8395,16 @@ var Account = class extends AbstractAccount {
8386
8395
  * @returns A promise that resolves to the transaction response.
8387
8396
  */
8388
8397
  async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
8389
- let transactionRequest = transactionRequestify(transactionRequestLike);
8398
+ const transactionRequest = transactionRequestify(transactionRequestLike);
8390
8399
  if (this._connector) {
8391
- const { onBeforeSend, skipCustomFee = false } = connectorOptions;
8392
- transactionRequest = await this.prepareTransactionForSend(transactionRequest);
8393
- const params = {
8394
- onBeforeSend,
8395
- skipCustomFee,
8396
- provider: {
8397
- url: this.provider.url,
8398
- cache: await serializeProviderCache(this.provider)
8399
- },
8400
- transactionState: transactionRequest.flag.state,
8401
- transactionSummary: await this.prepareTransactionSummary(transactionRequest)
8402
- };
8400
+ const response = await this.setTransactionStateForConnectors({
8401
+ transactionRequest,
8402
+ connectorOptions
8403
+ });
8403
8404
  const transaction = await this._connector.sendTransaction(
8404
8405
  this.address.toString(),
8405
- transactionRequest,
8406
- params
8406
+ response.transactionRequest,
8407
+ response.connectorsSendTxParams
8407
8408
  );
8408
8409
  return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
8409
8410
  }
@@ -8537,6 +8538,23 @@ var Account = class extends AbstractAccount {
8537
8538
  );
8538
8539
  }
8539
8540
  }
8541
+ /** @hidden * */
8542
+ async setTransactionStateForConnectors(params) {
8543
+ const { transactionRequest: requestToPrepare, connectorOptions } = params;
8544
+ const { onBeforeSend, skipCustomFee = false } = connectorOptions;
8545
+ const transactionRequest = await this.prepareTransactionForSend(requestToPrepare);
8546
+ const connectorsSendTxParams = {
8547
+ onBeforeSend,
8548
+ skipCustomFee,
8549
+ provider: {
8550
+ url: this.provider.url,
8551
+ cache: await serializeProviderCache(this.provider)
8552
+ },
8553
+ transactionState: requestToPrepare.flag.state,
8554
+ transactionSummary: await this.prepareTransactionSummary(requestToPrepare)
8555
+ };
8556
+ return { transactionRequest, connectorsSendTxParams };
8557
+ }
8540
8558
  };
8541
8559
 
8542
8560
  // src/wallet/keystore-wallet.ts