@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/index.mjs
CHANGED
@@ -6136,6 +6136,11 @@ var TransactionResponse = class _TransactionResponse {
|
|
6136
6136
|
if (statusChange.type === "PreconfirmationSuccessStatus" || statusChange.type === "PreconfirmationFailureStatus") {
|
6137
6137
|
this.preConfirmationStatus = statusChange;
|
6138
6138
|
this.resolveStatus("preConfirmation");
|
6139
|
+
const pendingConfirmationResolvers = this.statusResolvers.get("confirmation");
|
6140
|
+
if (!pendingConfirmationResolvers) {
|
6141
|
+
this.waitingForStreamData = false;
|
6142
|
+
break;
|
6143
|
+
}
|
6139
6144
|
}
|
6140
6145
|
if (statusChange.type === "SuccessStatus" || statusChange.type === "FailureStatus") {
|
6141
6146
|
this.resolveStatus("confirmation");
|
@@ -7281,7 +7286,7 @@ var Provider = class _Provider {
|
|
7281
7286
|
* @returns A promise that resolves to the transaction cost object.
|
7282
7287
|
*
|
7283
7288
|
* @deprecated Use provider.assembleTx instead
|
7284
|
-
* Check the migration guide https://docs.fuel.network/
|
7289
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
7285
7290
|
*/
|
7286
7291
|
async getTransactionCost(transactionRequestLike, { signatureCallback, gasPrice: gasPriceParam } = {}) {
|
7287
7292
|
const txRequestClone = clone8(transactionRequestify(transactionRequestLike));
|
@@ -7425,7 +7430,7 @@ var Provider = class _Provider {
|
|
7425
7430
|
requiredBalances,
|
7426
7431
|
estimatePredicates,
|
7427
7432
|
excludeInput,
|
7428
|
-
reserveGas: reserveGas ? reserveGas.toString(10) : void 0
|
7433
|
+
reserveGas: reserveGas ? bn18(reserveGas).toString(10) : void 0
|
7429
7434
|
});
|
7430
7435
|
if (status.type === "DryRunFailureStatus") {
|
7431
7436
|
const parsedReceipts = status.receipts.map(deserializeReceipt);
|
@@ -7437,8 +7442,8 @@ var Provider = class _Provider {
|
|
7437
7442
|
if (gqlTransaction.policies?.maxFee) {
|
7438
7443
|
request2.maxFee = bn18(gqlTransaction.policies.maxFee);
|
7439
7444
|
}
|
7440
|
-
if (
|
7441
|
-
request2.gasLimit = bn18(gqlTransaction.scriptGasLimit);
|
7445
|
+
if (request2.type === TransactionType11.Script) {
|
7446
|
+
request2.gasLimit = bn18(gqlTransaction.scriptGasLimit).add(bn18(reserveGas));
|
7442
7447
|
}
|
7443
7448
|
const rawReceipts = status.receipts;
|
7444
7449
|
const chainId = await this.getChainId();
|
@@ -8540,7 +8545,7 @@ var Account = class extends AbstractAccount {
|
|
8540
8545
|
* @returns A promise that resolves to the funded transaction request.
|
8541
8546
|
*
|
8542
8547
|
* @deprecated Use provider.assembleTx instead
|
8543
|
-
* Check the migration guide https://docs.fuel.network/
|
8548
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
8544
8549
|
*/
|
8545
8550
|
async fund(request2, params) {
|
8546
8551
|
const {
|
@@ -8959,7 +8964,7 @@ var Account = class extends AbstractAccount {
|
|
8959
8964
|
* @returns A promise that resolves to the transaction cost object.
|
8960
8965
|
*
|
8961
8966
|
* @deprecated Use provider.assembleTx instead
|
8962
|
-
* Check the migration guide https://docs.fuel.network/
|
8967
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
8963
8968
|
*/
|
8964
8969
|
async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [], gasPrice } = {}) {
|
8965
8970
|
const txRequestClone = clone9(transactionRequestify(transactionRequestLike));
|
@@ -9024,14 +9029,23 @@ var Account = class extends AbstractAccount {
|
|
9024
9029
|
* @param transactionRequestLike - The transaction request to sign.
|
9025
9030
|
* @returns A promise that resolves to the signature of the transaction.
|
9026
9031
|
*/
|
9027
|
-
async signTransaction(transactionRequestLike) {
|
9032
|
+
async signTransaction(transactionRequestLike, connectorOptions = {}) {
|
9028
9033
|
if (!this._connector) {
|
9029
9034
|
throw new FuelError21(
|
9030
9035
|
ErrorCode19.MISSING_CONNECTOR,
|
9031
9036
|
"A connector is required to sign transactions."
|
9032
9037
|
);
|
9033
9038
|
}
|
9034
|
-
|
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
|
+
);
|
9035
9049
|
}
|
9036
9050
|
/**
|
9037
9051
|
* Sends a transaction to the network.
|
@@ -9041,24 +9055,16 @@ var Account = class extends AbstractAccount {
|
|
9041
9055
|
* @returns A promise that resolves to the transaction response.
|
9042
9056
|
*/
|
9043
9057
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
|
9044
|
-
|
9058
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9045
9059
|
if (this._connector) {
|
9046
|
-
const
|
9047
|
-
|
9048
|
-
|
9049
|
-
|
9050
|
-
skipCustomFee,
|
9051
|
-
provider: {
|
9052
|
-
url: this.provider.url,
|
9053
|
-
cache: await serializeProviderCache(this.provider)
|
9054
|
-
},
|
9055
|
-
transactionState: transactionRequest.flag.state,
|
9056
|
-
transactionSummary: await this.prepareTransactionSummary(transactionRequest)
|
9057
|
-
};
|
9060
|
+
const response = await this.setTransactionStateForConnectors({
|
9061
|
+
transactionRequest,
|
9062
|
+
connectorOptions
|
9063
|
+
});
|
9058
9064
|
const transaction = await this._connector.sendTransaction(
|
9059
9065
|
this.address.toString(),
|
9060
|
-
transactionRequest,
|
9061
|
-
|
9066
|
+
response.transactionRequest,
|
9067
|
+
response.connectorsSendTxParams
|
9062
9068
|
);
|
9063
9069
|
return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
|
9064
9070
|
}
|
@@ -9192,6 +9198,23 @@ var Account = class extends AbstractAccount {
|
|
9192
9198
|
);
|
9193
9199
|
}
|
9194
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
|
+
}
|
9195
9218
|
};
|
9196
9219
|
|
9197
9220
|
// src/wallet/base-wallet-unlocked.ts
|
@@ -13039,6 +13062,14 @@ var Predicate = class _Predicate extends Account {
|
|
13039
13062
|
configurableConstants: overrides.configurableConstants ?? this.configurableConstants
|
13040
13063
|
});
|
13041
13064
|
}
|
13065
|
+
/**
|
13066
|
+
* Sets the predicate data.
|
13067
|
+
*
|
13068
|
+
* @param data - The data to be set for the predicate.
|
13069
|
+
*/
|
13070
|
+
setData(data) {
|
13071
|
+
this.predicateData = data;
|
13072
|
+
}
|
13042
13073
|
/**
|
13043
13074
|
* Processes the predicate data and returns the altered bytecode and interface.
|
13044
13075
|
*
|
@@ -13198,6 +13229,7 @@ var FuelConnectorMethods = /* @__PURE__ */ ((FuelConnectorMethods2) => {
|
|
13198
13229
|
FuelConnectorMethods2["isConnected"] = "isConnected";
|
13199
13230
|
FuelConnectorMethods2["accounts"] = "accounts";
|
13200
13231
|
FuelConnectorMethods2["currentAccount"] = "currentAccount";
|
13232
|
+
FuelConnectorMethods2["signTransaction"] = "signTransaction";
|
13201
13233
|
FuelConnectorMethods2["signMessage"] = "signMessage";
|
13202
13234
|
FuelConnectorMethods2["sendTransaction"] = "sendTransaction";
|
13203
13235
|
FuelConnectorMethods2["assets"] = "assets";
|
@@ -13339,7 +13371,7 @@ var FuelConnector = class extends EventEmitter2 {
|
|
13339
13371
|
*
|
13340
13372
|
* @returns Transaction signature
|
13341
13373
|
*/
|
13342
|
-
async signTransaction(_address, _transaction) {
|
13374
|
+
async signTransaction(_address, _transaction, _params) {
|
13343
13375
|
throw new FuelError32(FuelError32.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
13344
13376
|
}
|
13345
13377
|
/**
|