@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/account.d.ts +3 -1
- package/dist/account.d.ts.map +1 -1
- package/dist/connectors/fuel-connector.d.ts +3 -3
- package/dist/connectors/fuel-connector.d.ts.map +1 -1
- package/dist/connectors/types/connector-types.d.ts +1 -0
- package/dist/connectors/types/connector-types.d.ts.map +1 -1
- package/dist/index.global.js +38 -19
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +37 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -18
- package/dist/index.mjs.map +1 -1
- package/dist/test-utils.global.js +36 -18
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +35 -17
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +35 -17
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
@@ -9229,14 +9229,23 @@ var Account = class extends AbstractAccount {
|
|
9229
9229
|
* @param transactionRequestLike - The transaction request to sign.
|
9230
9230
|
* @returns A promise that resolves to the signature of the transaction.
|
9231
9231
|
*/
|
9232
|
-
async signTransaction(transactionRequestLike) {
|
9232
|
+
async signTransaction(transactionRequestLike, connectorOptions = {}) {
|
9233
9233
|
if (!this._connector) {
|
9234
9234
|
throw new import_errors22.FuelError(
|
9235
9235
|
import_errors22.ErrorCode.MISSING_CONNECTOR,
|
9236
9236
|
"A connector is required to sign transactions."
|
9237
9237
|
);
|
9238
9238
|
}
|
9239
|
-
|
9239
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9240
|
+
const { transactionRequest: requestToSign, connectorsSendTxParams } = await this.setTransactionStateForConnectors({
|
9241
|
+
transactionRequest,
|
9242
|
+
connectorOptions
|
9243
|
+
});
|
9244
|
+
return this._connector.signTransaction(
|
9245
|
+
this.address.toString(),
|
9246
|
+
requestToSign,
|
9247
|
+
connectorsSendTxParams
|
9248
|
+
);
|
9240
9249
|
}
|
9241
9250
|
/**
|
9242
9251
|
* Sends a transaction to the network.
|
@@ -9246,24 +9255,16 @@ var Account = class extends AbstractAccount {
|
|
9246
9255
|
* @returns A promise that resolves to the transaction response.
|
9247
9256
|
*/
|
9248
9257
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
|
9249
|
-
|
9258
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9250
9259
|
if (this._connector) {
|
9251
|
-
const
|
9252
|
-
|
9253
|
-
|
9254
|
-
|
9255
|
-
skipCustomFee,
|
9256
|
-
provider: {
|
9257
|
-
url: this.provider.url,
|
9258
|
-
cache: await serializeProviderCache(this.provider)
|
9259
|
-
},
|
9260
|
-
transactionState: transactionRequest.flag.state,
|
9261
|
-
transactionSummary: await this.prepareTransactionSummary(transactionRequest)
|
9262
|
-
};
|
9260
|
+
const response = await this.setTransactionStateForConnectors({
|
9261
|
+
transactionRequest,
|
9262
|
+
connectorOptions
|
9263
|
+
});
|
9263
9264
|
const transaction = await this._connector.sendTransaction(
|
9264
9265
|
this.address.toString(),
|
9265
|
-
transactionRequest,
|
9266
|
-
|
9266
|
+
response.transactionRequest,
|
9267
|
+
response.connectorsSendTxParams
|
9267
9268
|
);
|
9268
9269
|
return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
|
9269
9270
|
}
|
@@ -9397,6 +9398,23 @@ var Account = class extends AbstractAccount {
|
|
9397
9398
|
);
|
9398
9399
|
}
|
9399
9400
|
}
|
9401
|
+
/** @hidden * */
|
9402
|
+
async setTransactionStateForConnectors(params) {
|
9403
|
+
const { transactionRequest: requestToPrepare, connectorOptions } = params;
|
9404
|
+
const { onBeforeSend, skipCustomFee = false } = connectorOptions;
|
9405
|
+
const transactionRequest = await this.prepareTransactionForSend(requestToPrepare);
|
9406
|
+
const connectorsSendTxParams = {
|
9407
|
+
onBeforeSend,
|
9408
|
+
skipCustomFee,
|
9409
|
+
provider: {
|
9410
|
+
url: this.provider.url,
|
9411
|
+
cache: await serializeProviderCache(this.provider)
|
9412
|
+
},
|
9413
|
+
transactionState: requestToPrepare.flag.state,
|
9414
|
+
transactionSummary: await this.prepareTransactionSummary(requestToPrepare)
|
9415
|
+
};
|
9416
|
+
return { transactionRequest, connectorsSendTxParams };
|
9417
|
+
}
|
9400
9418
|
};
|
9401
9419
|
|
9402
9420
|
// src/wallet/base-wallet-unlocked.ts
|
@@ -13402,6 +13420,7 @@ var FuelConnectorMethods = /* @__PURE__ */ ((FuelConnectorMethods2) => {
|
|
13402
13420
|
FuelConnectorMethods2["isConnected"] = "isConnected";
|
13403
13421
|
FuelConnectorMethods2["accounts"] = "accounts";
|
13404
13422
|
FuelConnectorMethods2["currentAccount"] = "currentAccount";
|
13423
|
+
FuelConnectorMethods2["signTransaction"] = "signTransaction";
|
13405
13424
|
FuelConnectorMethods2["signMessage"] = "signMessage";
|
13406
13425
|
FuelConnectorMethods2["sendTransaction"] = "sendTransaction";
|
13407
13426
|
FuelConnectorMethods2["assets"] = "assets";
|
@@ -13543,7 +13562,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
13543
13562
|
*
|
13544
13563
|
* @returns Transaction signature
|
13545
13564
|
*/
|
13546
|
-
async signTransaction(_address, _transaction) {
|
13565
|
+
async signTransaction(_address, _transaction, _params) {
|
13547
13566
|
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
13548
13567
|
}
|
13549
13568
|
/**
|