@fuel-ts/account 0.0.0-rc-1976-20240410141707 → 0.0.0-rc-1976-20240410142521

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.mjs CHANGED
@@ -1689,7 +1689,7 @@ var BaseTransactionRequest = class {
1689
1689
  /** List of witnesses */
1690
1690
  witnesses = [];
1691
1691
  /** Base asset ID - should be fetched from the chain */
1692
- baseAssetId = ZeroBytes324;
1692
+ baseAssetId;
1693
1693
  /**
1694
1694
  * Constructor for initializing a base transaction request.
1695
1695
  *
@@ -1704,7 +1704,7 @@ var BaseTransactionRequest = class {
1704
1704
  outputs,
1705
1705
  witnesses,
1706
1706
  baseAssetId
1707
- } = {}) {
1707
+ }) {
1708
1708
  this.gasPrice = bn7(gasPrice);
1709
1709
  this.maturity = maturity ?? 0;
1710
1710
  this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
@@ -1712,7 +1712,7 @@ var BaseTransactionRequest = class {
1712
1712
  this.inputs = inputs ?? [];
1713
1713
  this.outputs = outputs ?? [];
1714
1714
  this.witnesses = witnesses ?? [];
1715
- this.baseAssetId = baseAssetId ?? ZeroBytes324;
1715
+ this.baseAssetId = baseAssetId;
1716
1716
  }
1717
1717
  static getPolicyMeta(req) {
1718
1718
  let policyTypes = 0;
@@ -2311,12 +2311,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2311
2311
  *
2312
2312
  * @param createTransactionRequestLike - The initial values for the instance
2313
2313
  */
2314
- constructor({
2315
- bytecodeWitnessIndex,
2316
- salt,
2317
- storageSlots,
2318
- ...rest
2319
- } = {}) {
2314
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2320
2315
  super(rest);
2321
2316
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2322
2317
  this.salt = hexlify9(salt ?? ZeroBytes326);
@@ -2440,7 +2435,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2440
2435
  *
2441
2436
  * @param scriptTransactionRequestLike - The initial values for the instance.
2442
2437
  */
2443
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2438
+ constructor({ script, scriptData, gasLimit, ...rest }) {
2444
2439
  super(rest);
2445
2440
  this.gasLimit = bn10(gasLimit);
2446
2441
  this.script = arrayify8(script ?? returnZeroScript.bytes);
@@ -5007,8 +5002,9 @@ var Account = class extends AbstractAccount {
5007
5002
  */
5008
5003
  async createTransfer(destination, amount, assetId, txParams = {}) {
5009
5004
  const { minGasPrice } = this.provider.getGasConfig();
5005
+ const baseAssetId = this.provider.getBaseAssetId();
5010
5006
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5011
- const params = { gasPrice: minGasPrice, ...txParams };
5007
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5012
5008
  const request = new ScriptTransactionRequest(params);
5013
5009
  request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetIdToTransfer);
5014
5010
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
@@ -5065,8 +5061,9 @@ var Account = class extends AbstractAccount {
5065
5061
  }
5066
5062
  const contractAddress = Address3.fromAddressOrString(contractId);
5067
5063
  const { minGasPrice } = this.provider.getGasConfig();
5064
+ const baseAssetId = this.provider.getBaseAssetId();
5068
5065
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5069
- const params = { gasPrice: minGasPrice, ...txParams };
5066
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5070
5067
  const { script, scriptData } = await assembleTransferToContractScript({
5071
5068
  hexlifiedContractId: contractAddress.toB256(),
5072
5069
  amountToTransfer: bn17(amount),
@@ -5115,7 +5112,12 @@ var Account = class extends AbstractAccount {
5115
5112
  ...recipientDataArray,
5116
5113
  ...amountDataArray
5117
5114
  ]);
5118
- const params = { script, gasPrice: minGasPrice, ...txParams };
5115
+ const params = {
5116
+ script,
5117
+ gasPrice: minGasPrice,
5118
+ baseAssetId,
5119
+ ...txParams
5120
+ };
5119
5121
  const request = new ScriptTransactionRequest(params);
5120
5122
  const forwardingQuantities = [{ amount: bn17(amount), assetId: baseAssetId }];
5121
5123
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(