@fuel-ts/account 0.0.0-rc-2037-20240501105750 → 0.0.0-rc-2037-20240501152515

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.

@@ -1586,7 +1586,7 @@ function calculateMetadataGasForTxScript({
1586
1586
  }
1587
1587
  var calculateGasFee = (params) => {
1588
1588
  const { gas, gasPrice, priceFactor, tip } = params;
1589
- return gas.mul(gasPrice).div(priceFactor).add(tip);
1589
+ return gas.mul(gasPrice).div(priceFactor).add((0, import_math5.bn)(tip));
1590
1590
  };
1591
1591
 
1592
1592
  // src/providers/utils/json.ts
@@ -1781,10 +1781,10 @@ var BaseTransactionRequest = class {
1781
1781
  outputs,
1782
1782
  witnesses
1783
1783
  } = {}) {
1784
- this.tip = (0, import_math8.bn)(tip);
1785
- this.maturity = maturity ?? 0;
1786
- this.witnessLimit = witnessLimit ? (0, import_math8.bn)(witnessLimit) : void 0;
1787
- this.maxFee = maxFee ? (0, import_math8.bn)(maxFee) : void 0;
1784
+ this.tip = tip ? (0, import_math8.bn)(tip) : void 0;
1785
+ this.maturity = maturity && maturity > 0 ? maturity : void 0;
1786
+ this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math8.bn)(witnessLimit) : void 0;
1787
+ this.maxFee = (0, import_math8.bn)(maxFee);
1788
1788
  this.inputs = inputs ?? [];
1789
1789
  this.outputs = outputs ?? [];
1790
1790
  this.witnesses = witnesses ?? [];
@@ -1792,22 +1792,21 @@ var BaseTransactionRequest = class {
1792
1792
  static getPolicyMeta(req) {
1793
1793
  let policyTypes = 0;
1794
1794
  const policies = [];
1795
- if (req.tip) {
1795
+ const { tip, witnessLimit, maturity } = req;
1796
+ if ((0, import_math8.bn)(tip).gt(0)) {
1796
1797
  policyTypes += import_transactions7.PolicyType.Tip;
1797
- policies.push({ data: req.tip, type: import_transactions7.PolicyType.Tip });
1798
+ policies.push({ data: (0, import_math8.bn)(tip), type: import_transactions7.PolicyType.Tip });
1798
1799
  }
1799
- if (req.witnessLimit) {
1800
+ if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math8.bn)(witnessLimit).gte(0)) {
1800
1801
  policyTypes += import_transactions7.PolicyType.WitnessLimit;
1801
- policies.push({ data: req.witnessLimit, type: import_transactions7.PolicyType.WitnessLimit });
1802
+ policies.push({ data: (0, import_math8.bn)(witnessLimit), type: import_transactions7.PolicyType.WitnessLimit });
1802
1803
  }
1803
- if (req.maturity > 0) {
1804
+ if (maturity && maturity > 0) {
1804
1805
  policyTypes += import_transactions7.PolicyType.Maturity;
1805
- policies.push({ data: req.maturity, type: import_transactions7.PolicyType.Maturity });
1806
- }
1807
- if (req.maxFee) {
1808
- policyTypes += import_transactions7.PolicyType.MaxFee;
1809
- policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
1806
+ policies.push({ data: maturity, type: import_transactions7.PolicyType.Maturity });
1810
1807
  }
1808
+ policyTypes += import_transactions7.PolicyType.MaxFee;
1809
+ policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
1811
1810
  return {
1812
1811
  policyTypes,
1813
1812
  policies