@fuel-ts/account 0.0.0-pr-1699-20240214105147 → 0.0.0-pr-1699-20240214162234
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/account.d.ts +1 -0
- package/dist/account.d.ts.map +1 -1
- package/dist/connectors/fuel.d.ts +9 -4
- package/dist/connectors/fuel.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +0 -4
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/types/index.d.ts +1 -1
- package/dist/connectors/types/index.d.ts.map +1 -1
- package/dist/connectors/types/local-storage.d.ts +11 -0
- package/dist/connectors/types/local-storage.d.ts.map +1 -0
- package/dist/index.global.js +72 -1270
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +74 -302
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -298
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/test-utils.global.js +43 -24
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +43 -24
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +43 -24
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/connectors/default-connector.d.ts +0 -7
- package/dist/connectors/default-connector.d.ts.map +0 -1
- package/dist/connectors/fuel-wallet-connector.d.ts +0 -54
- package/dist/connectors/fuel-wallet-connector.d.ts.map +0 -1
- package/dist/connectors/fuel-wallet-development-connector.d.ts +0 -7
- package/dist/connectors/fuel-wallet-development-connector.d.ts.map +0 -1
- package/dist/connectors/fuelet-wallet-connector.d.ts +0 -8
- package/dist/connectors/fuelet-wallet-connector.d.ts.map +0 -1
- package/dist/connectors/types/fuel-storage.d.ts +0 -11
- package/dist/connectors/types/fuel-storage.d.ts.map +0 -1
package/dist/test-utils.js
CHANGED
@@ -3643,23 +3643,6 @@ var _Provider = class {
|
|
3643
3643
|
if (estimateTxDependencies) {
|
3644
3644
|
await this.estimateTxDependencies(transactionRequest);
|
3645
3645
|
}
|
3646
|
-
const { gasUsed, minGasPrice } = await this.getTransactionCost(transactionRequest, [], {
|
3647
|
-
estimateTxDependencies: false,
|
3648
|
-
estimatePredicates: false
|
3649
|
-
});
|
3650
|
-
if ((0, import_math14.bn)(minGasPrice).gt((0, import_math14.bn)(transactionRequest.gasPrice))) {
|
3651
|
-
throw new import_errors13.FuelError(
|
3652
|
-
import_errors13.ErrorCode.GAS_PRICE_TOO_LOW,
|
3653
|
-
`Gas price '${transactionRequest.gasPrice}' is lower than the required: '${minGasPrice}'.`
|
3654
|
-
);
|
3655
|
-
}
|
3656
|
-
const isScriptTransaction = transactionRequest.type === import_transactions17.TransactionType.Script;
|
3657
|
-
if (isScriptTransaction && (0, import_math14.bn)(gasUsed).gt((0, import_math14.bn)(transactionRequest.gasLimit))) {
|
3658
|
-
throw new import_errors13.FuelError(
|
3659
|
-
import_errors13.ErrorCode.GAS_LIMIT_TOO_LOW,
|
3660
|
-
`Gas limit '${transactionRequest.gasLimit}' is lower than the required: '${gasUsed}'.`
|
3661
|
-
);
|
3662
|
-
}
|
3663
3646
|
const encodedTransaction = (0, import_ethers18.hexlify)(transactionRequest.toTransactionBytes());
|
3664
3647
|
if (awaitExecution) {
|
3665
3648
|
const subscription = this.operations.submitAndAwait({ encodedTransaction });
|
@@ -4529,10 +4512,14 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4529
4512
|
const request = new ScriptTransactionRequest(params);
|
4530
4513
|
request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
|
4531
4514
|
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request);
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4515
|
+
request.gasPrice = (0, import_math17.bn)(txParams.gasPrice ?? minGasPrice);
|
4516
|
+
request.gasLimit = (0, import_math17.bn)(txParams.gasLimit ?? gasUsed);
|
4517
|
+
this.validateGas({
|
4518
|
+
gasUsed,
|
4519
|
+
gasPrice: request.gasPrice,
|
4520
|
+
gasLimit: request.gasLimit,
|
4521
|
+
minGasPrice
|
4522
|
+
});
|
4536
4523
|
await this.fund(request, requiredQuantities, maxFee);
|
4537
4524
|
return request;
|
4538
4525
|
}
|
@@ -4577,7 +4564,13 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4577
4564
|
request,
|
4578
4565
|
[{ amount: (0, import_math17.bn)(amount), assetId: String(assetId) }]
|
4579
4566
|
);
|
4580
|
-
request.gasLimit = (0, import_math17.bn)(params.gasLimit
|
4567
|
+
request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
|
4568
|
+
this.validateGas({
|
4569
|
+
gasUsed,
|
4570
|
+
gasPrice: request.gasPrice,
|
4571
|
+
gasLimit: request.gasLimit,
|
4572
|
+
minGasPrice
|
4573
|
+
});
|
4581
4574
|
await this.fund(request, requiredQuantities, maxFee);
|
4582
4575
|
return this.sendTransaction(request);
|
4583
4576
|
}
|
@@ -4590,6 +4583,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4590
4583
|
* @returns A promise that resolves to the transaction response.
|
4591
4584
|
*/
|
4592
4585
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
4586
|
+
const { minGasPrice } = this.provider.getGasConfig();
|
4593
4587
|
const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
|
4594
4588
|
const recipientDataArray = (0, import_ethers21.getBytesCopy)(
|
4595
4589
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
@@ -4602,14 +4596,20 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4602
4596
|
...recipientDataArray,
|
4603
4597
|
...amountDataArray
|
4604
4598
|
]);
|
4605
|
-
const params = { script, ...txParams };
|
4599
|
+
const params = { script, gasPrice: minGasPrice, ...txParams };
|
4606
4600
|
const request = new ScriptTransactionRequest(params);
|
4607
4601
|
const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: import_configs10.BaseAssetId }];
|
4608
4602
|
const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
|
4609
4603
|
request,
|
4610
4604
|
forwardingQuantities
|
4611
4605
|
);
|
4612
|
-
request.gasLimit =
|
4606
|
+
request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
|
4607
|
+
this.validateGas({
|
4608
|
+
gasUsed,
|
4609
|
+
gasPrice: request.gasPrice,
|
4610
|
+
gasLimit: request.gasLimit,
|
4611
|
+
minGasPrice
|
4612
|
+
});
|
4613
4613
|
await this.fund(request, requiredQuantities, maxFee);
|
4614
4614
|
return this.sendTransaction(request);
|
4615
4615
|
}
|
@@ -4638,6 +4638,25 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4638
4638
|
await this.provider.estimateTxDependencies(transactionRequest);
|
4639
4639
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
4640
4640
|
}
|
4641
|
+
validateGas({
|
4642
|
+
gasUsed,
|
4643
|
+
gasPrice,
|
4644
|
+
gasLimit,
|
4645
|
+
minGasPrice
|
4646
|
+
}) {
|
4647
|
+
if (minGasPrice.gt(gasPrice)) {
|
4648
|
+
throw new import_errors15.FuelError(
|
4649
|
+
import_errors15.ErrorCode.GAS_PRICE_TOO_LOW,
|
4650
|
+
`Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
|
4651
|
+
);
|
4652
|
+
}
|
4653
|
+
if (gasUsed.gt(gasLimit)) {
|
4654
|
+
throw new import_errors15.FuelError(
|
4655
|
+
import_errors15.ErrorCode.GAS_LIMIT_TOO_LOW,
|
4656
|
+
`Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
|
4657
|
+
);
|
4658
|
+
}
|
4659
|
+
}
|
4641
4660
|
};
|
4642
4661
|
|
4643
4662
|
// src/signer/signer.ts
|