@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.js CHANGED
@@ -1775,7 +1775,7 @@ function calculateMetadataGasForTxScript({
1775
1775
  }
1776
1776
  var calculateGasFee = (params) => {
1777
1777
  const { gas, gasPrice, priceFactor, tip } = params;
1778
- return gas.mul(gasPrice).div(priceFactor).add(tip);
1778
+ return gas.mul(gasPrice).div(priceFactor).add((0, import_math5.bn)(tip));
1779
1779
  };
1780
1780
 
1781
1781
  // src/providers/utils/json.ts
@@ -1998,10 +1998,10 @@ var BaseTransactionRequest = class {
1998
1998
  outputs,
1999
1999
  witnesses
2000
2000
  } = {}) {
2001
- this.tip = (0, import_math8.bn)(tip);
2002
- this.maturity = maturity ?? 0;
2003
- this.witnessLimit = witnessLimit ? (0, import_math8.bn)(witnessLimit) : void 0;
2004
- this.maxFee = maxFee ? (0, import_math8.bn)(maxFee) : void 0;
2001
+ this.tip = tip ? (0, import_math8.bn)(tip) : void 0;
2002
+ this.maturity = maturity && maturity > 0 ? maturity : void 0;
2003
+ this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math8.bn)(witnessLimit) : void 0;
2004
+ this.maxFee = (0, import_math8.bn)(maxFee);
2005
2005
  this.inputs = inputs ?? [];
2006
2006
  this.outputs = outputs ?? [];
2007
2007
  this.witnesses = witnesses ?? [];
@@ -2009,22 +2009,21 @@ var BaseTransactionRequest = class {
2009
2009
  static getPolicyMeta(req) {
2010
2010
  let policyTypes = 0;
2011
2011
  const policies = [];
2012
- if (req.tip) {
2012
+ const { tip, witnessLimit, maturity } = req;
2013
+ if ((0, import_math8.bn)(tip).gt(0)) {
2013
2014
  policyTypes += import_transactions7.PolicyType.Tip;
2014
- policies.push({ data: req.tip, type: import_transactions7.PolicyType.Tip });
2015
+ policies.push({ data: (0, import_math8.bn)(tip), type: import_transactions7.PolicyType.Tip });
2015
2016
  }
2016
- if (req.witnessLimit) {
2017
+ if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math8.bn)(witnessLimit).gte(0)) {
2017
2018
  policyTypes += import_transactions7.PolicyType.WitnessLimit;
2018
- policies.push({ data: req.witnessLimit, type: import_transactions7.PolicyType.WitnessLimit });
2019
+ policies.push({ data: (0, import_math8.bn)(witnessLimit), type: import_transactions7.PolicyType.WitnessLimit });
2019
2020
  }
2020
- if (req.maturity > 0) {
2021
+ if (maturity && maturity > 0) {
2021
2022
  policyTypes += import_transactions7.PolicyType.Maturity;
2022
- policies.push({ data: req.maturity, type: import_transactions7.PolicyType.Maturity });
2023
- }
2024
- if (req.maxFee) {
2025
- policyTypes += import_transactions7.PolicyType.MaxFee;
2026
- policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
2023
+ policies.push({ data: maturity, type: import_transactions7.PolicyType.Maturity });
2027
2024
  }
2025
+ policyTypes += import_transactions7.PolicyType.MaxFee;
2026
+ policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
2028
2027
  return {
2029
2028
  policyTypes,
2030
2029
  policies