@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.js
CHANGED
@@ -6336,6 +6336,11 @@ var TransactionResponse = class _TransactionResponse {
|
|
6336
6336
|
if (statusChange.type === "PreconfirmationSuccessStatus" || statusChange.type === "PreconfirmationFailureStatus") {
|
6337
6337
|
this.preConfirmationStatus = statusChange;
|
6338
6338
|
this.resolveStatus("preConfirmation");
|
6339
|
+
const pendingConfirmationResolvers = this.statusResolvers.get("confirmation");
|
6340
|
+
if (!pendingConfirmationResolvers) {
|
6341
|
+
this.waitingForStreamData = false;
|
6342
|
+
break;
|
6343
|
+
}
|
6339
6344
|
}
|
6340
6345
|
if (statusChange.type === "SuccessStatus" || statusChange.type === "FailureStatus") {
|
6341
6346
|
this.resolveStatus("confirmation");
|
@@ -7481,7 +7486,7 @@ var Provider = class _Provider {
|
|
7481
7486
|
* @returns A promise that resolves to the transaction cost object.
|
7482
7487
|
*
|
7483
7488
|
* @deprecated Use provider.assembleTx instead
|
7484
|
-
* Check the migration guide https://docs.fuel.network/
|
7489
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
7485
7490
|
*/
|
7486
7491
|
async getTransactionCost(transactionRequestLike, { signatureCallback, gasPrice: gasPriceParam } = {}) {
|
7487
7492
|
const txRequestClone = (0, import_ramda8.clone)(transactionRequestify(transactionRequestLike));
|
@@ -7625,7 +7630,7 @@ var Provider = class _Provider {
|
|
7625
7630
|
requiredBalances,
|
7626
7631
|
estimatePredicates,
|
7627
7632
|
excludeInput,
|
7628
|
-
reserveGas: reserveGas ? reserveGas.toString(10) : void 0
|
7633
|
+
reserveGas: reserveGas ? (0, import_math19.bn)(reserveGas).toString(10) : void 0
|
7629
7634
|
});
|
7630
7635
|
if (status.type === "DryRunFailureStatus") {
|
7631
7636
|
const parsedReceipts = status.receipts.map(deserializeReceipt);
|
@@ -7637,8 +7642,8 @@ var Provider = class _Provider {
|
|
7637
7642
|
if (gqlTransaction.policies?.maxFee) {
|
7638
7643
|
request2.maxFee = (0, import_math19.bn)(gqlTransaction.policies.maxFee);
|
7639
7644
|
}
|
7640
|
-
if (
|
7641
|
-
request2.gasLimit = (0, import_math19.bn)(gqlTransaction.scriptGasLimit);
|
7645
|
+
if (request2.type === import_transactions25.TransactionType.Script) {
|
7646
|
+
request2.gasLimit = (0, import_math19.bn)(gqlTransaction.scriptGasLimit).add((0, import_math19.bn)(reserveGas));
|
7642
7647
|
}
|
7643
7648
|
const rawReceipts = status.receipts;
|
7644
7649
|
const chainId = await this.getChainId();
|
@@ -8740,7 +8745,7 @@ var Account = class extends AbstractAccount {
|
|
8740
8745
|
* @returns A promise that resolves to the funded transaction request.
|
8741
8746
|
*
|
8742
8747
|
* @deprecated Use provider.assembleTx instead
|
8743
|
-
* Check the migration guide https://docs.fuel.network/
|
8748
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
8744
8749
|
*/
|
8745
8750
|
async fund(request2, params) {
|
8746
8751
|
const {
|
@@ -9159,7 +9164,7 @@ var Account = class extends AbstractAccount {
|
|
9159
9164
|
* @returns A promise that resolves to the transaction cost object.
|
9160
9165
|
*
|
9161
9166
|
* @deprecated Use provider.assembleTx instead
|
9162
|
-
* Check the migration guide https://docs.fuel.network/
|
9167
|
+
* Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.
|
9163
9168
|
*/
|
9164
9169
|
async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [], gasPrice } = {}) {
|
9165
9170
|
const txRequestClone = (0, import_ramda9.clone)(transactionRequestify(transactionRequestLike));
|
@@ -9224,14 +9229,23 @@ var Account = class extends AbstractAccount {
|
|
9224
9229
|
* @param transactionRequestLike - The transaction request to sign.
|
9225
9230
|
* @returns A promise that resolves to the signature of the transaction.
|
9226
9231
|
*/
|
9227
|
-
async signTransaction(transactionRequestLike) {
|
9232
|
+
async signTransaction(transactionRequestLike, connectorOptions = {}) {
|
9228
9233
|
if (!this._connector) {
|
9229
9234
|
throw new import_errors22.FuelError(
|
9230
9235
|
import_errors22.ErrorCode.MISSING_CONNECTOR,
|
9231
9236
|
"A connector is required to sign transactions."
|
9232
9237
|
);
|
9233
9238
|
}
|
9234
|
-
|
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
|
+
);
|
9235
9249
|
}
|
9236
9250
|
/**
|
9237
9251
|
* Sends a transaction to the network.
|
@@ -9241,24 +9255,16 @@ var Account = class extends AbstractAccount {
|
|
9241
9255
|
* @returns A promise that resolves to the transaction response.
|
9242
9256
|
*/
|
9243
9257
|
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, ...connectorOptions } = {}) {
|
9244
|
-
|
9258
|
+
const transactionRequest = transactionRequestify(transactionRequestLike);
|
9245
9259
|
if (this._connector) {
|
9246
|
-
const
|
9247
|
-
|
9248
|
-
|
9249
|
-
|
9250
|
-
skipCustomFee,
|
9251
|
-
provider: {
|
9252
|
-
url: this.provider.url,
|
9253
|
-
cache: await serializeProviderCache(this.provider)
|
9254
|
-
},
|
9255
|
-
transactionState: transactionRequest.flag.state,
|
9256
|
-
transactionSummary: await this.prepareTransactionSummary(transactionRequest)
|
9257
|
-
};
|
9260
|
+
const response = await this.setTransactionStateForConnectors({
|
9261
|
+
transactionRequest,
|
9262
|
+
connectorOptions
|
9263
|
+
});
|
9258
9264
|
const transaction = await this._connector.sendTransaction(
|
9259
9265
|
this.address.toString(),
|
9260
|
-
transactionRequest,
|
9261
|
-
|
9266
|
+
response.transactionRequest,
|
9267
|
+
response.connectorsSendTxParams
|
9262
9268
|
);
|
9263
9269
|
return typeof transaction === "string" ? this.provider.getTransactionResponse(transaction) : transaction;
|
9264
9270
|
}
|
@@ -9392,6 +9398,23 @@ var Account = class extends AbstractAccount {
|
|
9392
9398
|
);
|
9393
9399
|
}
|
9394
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
|
+
}
|
9395
9418
|
};
|
9396
9419
|
|
9397
9420
|
// src/wallet/base-wallet-unlocked.ts
|
@@ -13230,6 +13253,14 @@ var Predicate = class _Predicate extends Account {
|
|
13230
13253
|
configurableConstants: overrides.configurableConstants ?? this.configurableConstants
|
13231
13254
|
});
|
13232
13255
|
}
|
13256
|
+
/**
|
13257
|
+
* Sets the predicate data.
|
13258
|
+
*
|
13259
|
+
* @param data - The data to be set for the predicate.
|
13260
|
+
*/
|
13261
|
+
setData(data) {
|
13262
|
+
this.predicateData = data;
|
13263
|
+
}
|
13233
13264
|
/**
|
13234
13265
|
* Processes the predicate data and returns the altered bytecode and interface.
|
13235
13266
|
*
|
@@ -13389,6 +13420,7 @@ var FuelConnectorMethods = /* @__PURE__ */ ((FuelConnectorMethods2) => {
|
|
13389
13420
|
FuelConnectorMethods2["isConnected"] = "isConnected";
|
13390
13421
|
FuelConnectorMethods2["accounts"] = "accounts";
|
13391
13422
|
FuelConnectorMethods2["currentAccount"] = "currentAccount";
|
13423
|
+
FuelConnectorMethods2["signTransaction"] = "signTransaction";
|
13392
13424
|
FuelConnectorMethods2["signMessage"] = "signMessage";
|
13393
13425
|
FuelConnectorMethods2["sendTransaction"] = "sendTransaction";
|
13394
13426
|
FuelConnectorMethods2["assets"] = "assets";
|
@@ -13530,7 +13562,7 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
13530
13562
|
*
|
13531
13563
|
* @returns Transaction signature
|
13532
13564
|
*/
|
13533
|
-
async signTransaction(_address, _transaction) {
|
13565
|
+
async signTransaction(_address, _transaction, _params) {
|
13534
13566
|
throw new import_errors33.FuelError(import_errors33.FuelError.CODES.NOT_IMPLEMENTED, "Method not implemented.");
|
13535
13567
|
}
|
13536
13568
|
/**
|