@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/test-utils.mjs
CHANGED
@@ -8354,14 +8354,23 @@ var Account = class extends AbstractAccount {
|
|
8354
8354
|
* @param transactionRequestLike - The transaction request to sign.
|
8355
8355
|
* @returns A promise that resolves to the signature of the transaction.
|
8356
8356
|
*/
|
8357
|
-
async signTransaction(transactionRequestLike) {
|
8357
|
+
async signTransaction(transactionRequestLike, connectorOptions = {}) {
|
8358
8358
|
if (!this._connector) {
|
8359
8359
|
throw new FuelError22(
|
8360
8360
|
ErrorCode19.MISSING_CONNECTOR,
|
8361
8361
|
"A connector is required to sign transactions."
|
8362
8362
|
);
|
8363
8363
|
}
|
8364
|
-
|
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
|
+
);
|
8365
8374
|
}
|
8366
8375
|
/**
|
8367
8376
|
* Sends a transaction to the network.
|
@@ -8371,24 +8380,16 @@ var Account = class extends AbstractAccount {
|
|
8371
8380
|
* @returns A promise that resolves to the transaction response.
|
8372
8381
|
*/
|
8373
8382
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
|
8374
|
-
|
8383
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
8375
8384
|
if (this._connector) {
|
8376
|
-
const
|
8377
|
-
|
8378
|
-
|
8379
|
-
|
8380
|
-
skipCustomFee,
|
8381
|
-
provider: {
|
8382
|
-
url: this.provider.url,
|
8383
|
-
cache: await serializeProviderCache(this.provider)
|
8384
|
-
},
|
8385
|
-
transactionState: transactionRequest.flag.state,
|
8386
|
-
transactionSummary: await this.prepareTransactionSummary(transactionRequest)
|
8387
|
-
};
|
8385
|
+
const response = await this.setTransactionStateForConnectors({
|
8386
|
+
transactionRequest,
|
8387
|
+
connectorOptions
|
8388
|
+
});
|
8388
8389
|
const transaction = await this._connector.sendTransaction(
|
8389
8390
|
this.address.toString(),
|
8390
|
-
transactionRequest,
|
8391
|
-
|
8391
|
+
response.transactionRequest,
|
8392
|
+
response.connectorsSendTxParams
|
8392
8393
|
);
|
8393
8394
|
return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
|
8394
8395
|
}
|
@@ -8522,6 +8523,23 @@ var Account = class extends AbstractAccount {
|
|
8522
8523
|
);
|
8523
8524
|
}
|
8524
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
|
+
}
|
8525
8543
|
};
|
8526
8544
|
|
8527
8545
|
// src/wallet/keystore-wallet.ts
|