@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.
- package/dist/account.d.ts +5 -3
- 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 +57 -25
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +56 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -24
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +15 -3
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +2 -2
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/test-utils.global.js +47 -24
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +46 -23
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +46 -23
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +14 -14
package/dist/test-utils.js
CHANGED
@@ -5651,6 +5651,11 @@ var TransactionResponse = class _TransactionResponse {
|
|
5651
5651
|
if (statusChange.type === "PreconfirmationSuccessStatus" || statusChange.type === "PreconfirmationFailureStatus") {
|
5652
5652
|
this.preConfirmationStatus = statusChange;
|
5653
5653
|
this.resolveStatus("preConfirmation");
|
5654
|
+
const pendingConfirmationResolvers = this.statusResolvers.get("confirmation");
|
5655
|
+
if (!pendingConfirmationResolvers) {
|
5656
|
+
this.waitingForStreamData = false;
|
5657
|
+
break;
|
5658
|
+
}
|
5654
5659
|
}
|
5655
5660
|
if (statusChange.type === "SuccessStatus" || statusChange.type === "FailureStatus") {
|
5656
5661
|
this.resolveStatus("confirmation");
|
@@ -6773,7 +6778,7 @@ var Provider = class _Provider {
|
|
6773
6778
|
* @returns A promise that resolves to the transaction cost object.
|
6774
6779
|
*
|
6775
6780
|
* @deprecated Use provider.assembleTx instead
|
6776
|
-
* Check the migration guide https://docs.fuel.network/
|
6781
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
6777
6782
|
*/
|
6778
6783
|
async getTransactionCost(transactionRequestLike, { signatureCallback, gasPrice: gasPriceParam } = {}) {
|
6779
6784
|
const txRequestClone = (0, import_ramda8.clone)(transactionRequestify(transactionRequestLike));
|
@@ -6917,7 +6922,7 @@ var Provider = class _Provider {
|
|
6917
6922
|
requiredBalances,
|
6918
6923
|
estimatePredicates,
|
6919
6924
|
excludeInput,
|
6920
|
-
reserveGas: reserveGas ? reserveGas.toString(10) : void 0
|
6925
|
+
reserveGas: reserveGas ? (0, import_math20.bn)(reserveGas).toString(10) : void 0
|
6921
6926
|
});
|
6922
6927
|
if (status.type === "DryRunFailureStatus") {
|
6923
6928
|
const parsedReceipts = status.receipts.map(deserializeReceipt);
|
@@ -6929,8 +6934,8 @@ var Provider = class _Provider {
|
|
6929
6934
|
if (gqlTransaction.policies?.maxFee) {
|
6930
6935
|
request.maxFee = (0, import_math20.bn)(gqlTransaction.policies.maxFee);
|
6931
6936
|
}
|
6932
|
-
if (
|
6933
|
-
request.gasLimit = (0, import_math20.bn)(gqlTransaction.scriptGasLimit);
|
6937
|
+
if (request.type === import_transactions25.TransactionType.Script) {
|
6938
|
+
request.gasLimit = (0, import_math20.bn)(gqlTransaction.scriptGasLimit).add((0, import_math20.bn)(reserveGas));
|
6934
6939
|
}
|
6935
6940
|
const rawReceipts = status.receipts;
|
6936
6941
|
const chainId = await this.getChainId();
|
@@ -7880,7 +7885,7 @@ var Account = class extends AbstractAccount {
|
|
7880
7885
|
* @returns A promise that resolves to the funded transaction request.
|
7881
7886
|
*
|
7882
7887
|
* @deprecated Use provider.assembleTx instead
|
7883
|
-
* Check the migration guide https://docs.fuel.network/
|
7888
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
7884
7889
|
*/
|
7885
7890
|
async fund(request, params) {
|
7886
7891
|
const {
|
@@ -8299,7 +8304,7 @@ var Account = class extends AbstractAccount {
|
|
8299
8304
|
* @returns A promise that resolves to the transaction cost object.
|
8300
8305
|
*
|
8301
8306
|
* @deprecated Use provider.assembleTx instead
|
8302
|
-
* Check the migration guide https://docs.fuel.network/
|
8307
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
8303
8308
|
*/
|
8304
8309
|
async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [], gasPrice } = {}) {
|
8305
8310
|
const txRequestClone = (0, import_ramda9.clone)(transactionRequestify(transactionRequestLike));
|
@@ -8364,14 +8369,23 @@ var Account = class extends AbstractAccount {
|
|
8364
8369
|
* @param transactionRequestLike - The transaction request to sign.
|
8365
8370
|
* @returns A promise that resolves to the signature of the transaction.
|
8366
8371
|
*/
|
8367
|
-
async signTransaction(transactionRequestLike) {
|
8372
|
+
async signTransaction(transactionRequestLike, connectorOptions = {}) {
|
8368
8373
|
if (!this._connector) {
|
8369
8374
|
throw new import_errors23.FuelError(
|
8370
8375
|
import_errors23.ErrorCode.MISSING_CONNECTOR,
|
8371
8376
|
"A connector is required to sign transactions."
|
8372
8377
|
);
|
8373
8378
|
}
|
8374
|
-
|
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
|
+
);
|
8375
8389
|
}
|
8376
8390
|
/**
|
8377
8391
|
* Sends a transaction to the network.
|
@@ -8381,24 +8395,16 @@ var Account = class extends AbstractAccount {
|
|
8381
8395
|
* @returns A promise that resolves to the transaction response.
|
8382
8396
|
*/
|
8383
8397
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
|
8384
|
-
|
8398
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
8385
8399
|
if (this._connector) {
|
8386
|
-
const
|
8387
|
-
|
8388
|
-
|
8389
|
-
|
8390
|
-
skipCustomFee,
|
8391
|
-
provider: {
|
8392
|
-
url: this.provider.url,
|
8393
|
-
cache: await serializeProviderCache(this.provider)
|
8394
|
-
},
|
8395
|
-
transactionState: transactionRequest.flag.state,
|
8396
|
-
transactionSummary: await this.prepareTransactionSummary(transactionRequest)
|
8397
|
-
};
|
8400
|
+
const response = await this.setTransactionStateForConnectors({
|
8401
|
+
transactionRequest,
|
8402
|
+
connectorOptions
|
8403
|
+
});
|
8398
8404
|
const transaction = await this._connector.sendTransaction(
|
8399
8405
|
this.address.toString(),
|
8400
|
-
transactionRequest,
|
8401
|
-
|
8406
|
+
response.transactionRequest,
|
8407
|
+
response.connectorsSendTxParams
|
8402
8408
|
);
|
8403
8409
|
return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
|
8404
8410
|
}
|
@@ -8532,6 +8538,23 @@ var Account = class extends AbstractAccount {
|
|
8532
8538
|
);
|
8533
8539
|
}
|
8534
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
|
+
}
|
8535
8558
|
};
|
8536
8559
|
|
8537
8560
|
// src/wallet/keystore-wallet.ts
|