@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.
package/dist/index.mjs CHANGED
@@ -9029,14 +9029,23 @@ var Account = class extends AbstractAccount {
9029
9029
  * @param transactionRequestLike - The transaction request to sign.
9030
9030
  * @returns A promise that resolves to the signature of the transaction.
9031
9031
  */
9032
- async signTransaction(transactionRequestLike) {
9032
+ async signTransaction(transactionRequestLike, connectorOptions = {}) {
9033
9033
  if (!this._connector) {
9034
9034
  throw new FuelError21(
9035
9035
  ErrorCode19.MISSING_CONNECTOR,
9036
9036
  "A connector is required to sign transactions."
9037
9037
  );
9038
9038
  }
9039
- return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
9039
+ const transactionRequest = transactionRequestify(transactionRequestLike);
9040
+ const { transactionRequest: requestToSign, connectorsSendTxParams } = await this.setTransactionStateForConnectors({
9041
+ transactionRequest,
9042
+ connectorOptions
9043
+ });
9044
+ return this._connector.signTransaction(
9045
+ this.address.toString(),
9046
+ requestToSign,
9047
+ connectorsSendTxParams
9048
+ );
9040
9049
  }
9041
9050
  /**
9042
9051
  * Sends a transaction to the network.
@@ -9046,24 +9055,16 @@ var Account = class extends AbstractAccount {
9046
9055
  * @returns A promise that resolves to the transaction response.
9047
9056
  */
9048
9057
  async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
9049
- let transactionRequest = transactionRequestify(transactionRequestLike);
9058
+ const transactionRequest = transactionRequestify(transactionRequestLike);
9050
9059
  if (this._connector) {
9051
- const { onBeforeSend, skipCustomFee = false } = connectorOptions;
9052
- transactionRequest = await this.prepareTransactionForSend(transactionRequest);
9053
- const params = {
9054
- onBeforeSend,
9055
- skipCustomFee,
9056
- provider: {
9057
- url: this.provider.url,
9058
- cache: await serializeProviderCache(this.provider)
9059
- },
9060
- transactionState: transactionRequest.flag.state,
9061
- transactionSummary: await this.prepareTransactionSummary(transactionRequest)
9062
- };
9060
+ const response = await this.setTransactionStateForConnectors({
9061
+ transactionRequest,
9062
+ connectorOptions
9063
+ });
9063
9064
  const transaction = await this._connector.sendTransaction(
9064
9065
  this.address.toString(),
9065
- transactionRequest,
9066
- params
9066
+ response.transactionRequest,
9067
+ response.connectorsSendTxParams
9067
9068
  );
9068
9069
  return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
9069
9070
  }
@@ -9197,6 +9198,23 @@ var Account = class extends AbstractAccount {
9197
9198
  );
9198
9199
  }
9199
9200
  }
9201
+ /** @hidden * */
9202
+ async setTransactionStateForConnectors(params) {
9203
+ const { transactionRequest: requestToPrepare, connectorOptions } = params;
9204
+ const { onBeforeSend, skipCustomFee = false } = connectorOptions;
9205
+ const transactionRequest = await this.prepareTransactionForSend(requestToPrepare);
9206
+ const connectorsSendTxParams = {
9207
+ onBeforeSend,
9208
+ skipCustomFee,
9209
+ provider: {
9210
+ url: this.provider.url,
9211
+ cache: await serializeProviderCache(this.provider)
9212
+ },
9213
+ transactionState: requestToPrepare.flag.state,
9214
+ transactionSummary: await this.prepareTransactionSummary(requestToPrepare)
9215
+ };
9216
+ return { transactionRequest, connectorsSendTxParams };
9217
+ }
9200
9218
  };
9201
9219
 
9202
9220
  // src/wallet/base-wallet-unlocked.ts
@@ -13211,6 +13229,7 @@ var FuelConnectorMethods = /* @__PURE__ */ ((FuelConnectorMethods2) => {
13211
13229
  FuelConnectorMethods2["isConnected"] = "isConnected";
13212
13230
  FuelConnectorMethods2["accounts"] = "accounts";
13213
13231
  FuelConnectorMethods2["currentAccount"] = "currentAccount";
13232
+ FuelConnectorMethods2["signTransaction"] = "signTransaction";
13214
13233
  FuelConnectorMethods2["signMessage"] = "signMessage";
13215
13234
  FuelConnectorMethods2["sendTransaction"] = "sendTransaction";
13216
13235
  FuelConnectorMethods2["assets"] = "assets";
@@ -13352,7 +13371,7 @@ var FuelConnector = class extends EventEmitter2 {
13352
13371
  *
13353
13372
  * @returns Transaction signature
13354
13373
  */
13355
- async signTransaction(_address, _transaction) {
13374
+ async signTransaction(_address, _transaction, _params) {
13356
13375
  throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
13357
13376
  }
13358
13377
  /**