@fuel-ts/account 0.0.0-rc-2037-20240501105750 → 0.0.0-rc-2037-20240501112942
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/index.global.js +14 -15
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -19
- package/dist/index.mjs.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +3 -3
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts +1 -1
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/test-utils.global.js +14 -15
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +14 -15
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +18 -19
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.mjs
CHANGED
@@ -32,7 +32,7 @@ import { Address as Address3 } from "@fuel-ts/address";
|
|
32
32
|
import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
|
33
33
|
import { AbstractAccount } from "@fuel-ts/interfaces";
|
34
34
|
import { bn as bn19 } from "@fuel-ts/math";
|
35
|
-
import { arrayify as arrayify14, isDefined } from "@fuel-ts/utils";
|
35
|
+
import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
|
36
36
|
import { clone as clone4 } from "ramda";
|
37
37
|
|
38
38
|
// src/providers/coin-quantity.ts
|
@@ -1253,7 +1253,7 @@ import {
|
|
1253
1253
|
OutputType as OutputType2,
|
1254
1254
|
TransactionType
|
1255
1255
|
} from "@fuel-ts/transactions";
|
1256
|
-
import { concat, hexlify as hexlify7 } from "@fuel-ts/utils";
|
1256
|
+
import { concat, hexlify as hexlify7, isDefined } from "@fuel-ts/utils";
|
1257
1257
|
|
1258
1258
|
// src/providers/resource.ts
|
1259
1259
|
var isRawCoin = (resource) => "utxoId" in resource;
|
@@ -1628,7 +1628,7 @@ function calculateMetadataGasForTxScript({
|
|
1628
1628
|
}
|
1629
1629
|
var calculateGasFee = (params) => {
|
1630
1630
|
const { gas, gasPrice, priceFactor, tip } = params;
|
1631
|
-
return gas.mul(gasPrice).div(priceFactor).add(tip);
|
1631
|
+
return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
|
1632
1632
|
};
|
1633
1633
|
|
1634
1634
|
// src/providers/utils/json.ts
|
@@ -1859,10 +1859,10 @@ var BaseTransactionRequest = class {
|
|
1859
1859
|
outputs,
|
1860
1860
|
witnesses
|
1861
1861
|
} = {}) {
|
1862
|
-
this.tip = bn8(tip);
|
1863
|
-
this.maturity = maturity
|
1864
|
-
this.witnessLimit = witnessLimit ? bn8(witnessLimit) : void 0;
|
1865
|
-
this.maxFee =
|
1862
|
+
this.tip = tip ? bn8(tip) : void 0;
|
1863
|
+
this.maturity = maturity && maturity > 0 ? maturity : void 0;
|
1864
|
+
this.witnessLimit = isDefined(witnessLimit) ? bn8(witnessLimit) : void 0;
|
1865
|
+
this.maxFee = bn8(maxFee);
|
1866
1866
|
this.inputs = inputs ?? [];
|
1867
1867
|
this.outputs = outputs ?? [];
|
1868
1868
|
this.witnesses = witnesses ?? [];
|
@@ -1870,22 +1870,21 @@ var BaseTransactionRequest = class {
|
|
1870
1870
|
static getPolicyMeta(req) {
|
1871
1871
|
let policyTypes = 0;
|
1872
1872
|
const policies = [];
|
1873
|
-
|
1873
|
+
const { tip, witnessLimit, maturity } = req;
|
1874
|
+
if (bn8(tip).gt(0)) {
|
1874
1875
|
policyTypes += PolicyType.Tip;
|
1875
|
-
policies.push({ data:
|
1876
|
+
policies.push({ data: bn8(tip), type: PolicyType.Tip });
|
1876
1877
|
}
|
1877
|
-
if (
|
1878
|
+
if (isDefined(witnessLimit) && bn8(witnessLimit).gte(0)) {
|
1878
1879
|
policyTypes += PolicyType.WitnessLimit;
|
1879
|
-
policies.push({ data:
|
1880
|
+
policies.push({ data: bn8(witnessLimit), type: PolicyType.WitnessLimit });
|
1880
1881
|
}
|
1881
|
-
if (
|
1882
|
+
if (maturity && maturity > 0) {
|
1882
1883
|
policyTypes += PolicyType.Maturity;
|
1883
|
-
policies.push({ data:
|
1884
|
-
}
|
1885
|
-
if (req.maxFee) {
|
1886
|
-
policyTypes += PolicyType.MaxFee;
|
1887
|
-
policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
|
1884
|
+
policies.push({ data: maturity, type: PolicyType.Maturity });
|
1888
1885
|
}
|
1886
|
+
policyTypes += PolicyType.MaxFee;
|
1887
|
+
policies.push({ data: req.maxFee, type: PolicyType.MaxFee });
|
1889
1888
|
return {
|
1890
1889
|
policyTypes,
|
1891
1890
|
policies
|
@@ -5541,13 +5540,13 @@ var Account = class extends AbstractAccount {
|
|
5541
5540
|
gasUsed,
|
5542
5541
|
maxFee
|
5543
5542
|
}) {
|
5544
|
-
if (
|
5543
|
+
if (isDefined2(setGasLimit) && gasUsed.gt(setGasLimit)) {
|
5545
5544
|
throw new FuelError15(
|
5546
5545
|
ErrorCode15.GAS_LIMIT_TOO_LOW,
|
5547
5546
|
`Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
|
5548
5547
|
);
|
5549
5548
|
}
|
5550
|
-
if (
|
5549
|
+
if (isDefined2(setMaxFee) && maxFee.gt(setMaxFee)) {
|
5551
5550
|
throw new FuelError15(
|
5552
5551
|
ErrorCode15.MAX_FEE_TOO_LOW,
|
5553
5552
|
`Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
|