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

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
@@ -1820,7 +1820,7 @@ var BaseTransactionRequest = class {
1820
1820
  /** List of witnesses */
1821
1821
  witnesses = [];
1822
1822
  /** Base asset ID - should be fetched from the chain */
1823
- baseAssetId = import_configs6.ZeroBytes32;
1823
+ baseAssetId;
1824
1824
  /**
1825
1825
  * Constructor for initializing a base transaction request.
1826
1826
  *
@@ -1835,7 +1835,7 @@ var BaseTransactionRequest = class {
1835
1835
  outputs,
1836
1836
  witnesses,
1837
1837
  baseAssetId
1838
- } = {}) {
1838
+ }) {
1839
1839
  this.gasPrice = (0, import_math7.bn)(gasPrice);
1840
1840
  this.maturity = maturity ?? 0;
1841
1841
  this.witnessLimit = witnessLimit ? (0, import_math7.bn)(witnessLimit) : void 0;
@@ -1843,7 +1843,7 @@ var BaseTransactionRequest = class {
1843
1843
  this.inputs = inputs ?? [];
1844
1844
  this.outputs = outputs ?? [];
1845
1845
  this.witnesses = witnesses ?? [];
1846
- this.baseAssetId = baseAssetId ?? import_configs6.ZeroBytes32;
1846
+ this.baseAssetId = baseAssetId;
1847
1847
  }
1848
1848
  static getPolicyMeta(req) {
1849
1849
  let policyTypes = 0;
@@ -2442,12 +2442,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2442
2442
  *
2443
2443
  * @param createTransactionRequestLike - The initial values for the instance
2444
2444
  */
2445
- constructor({
2446
- bytecodeWitnessIndex,
2447
- salt,
2448
- storageSlots,
2449
- ...rest
2450
- } = {}) {
2445
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2451
2446
  super(rest);
2452
2447
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2453
2448
  this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
@@ -2571,7 +2566,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2571
2566
  *
2572
2567
  * @param scriptTransactionRequestLike - The initial values for the instance.
2573
2568
  */
2574
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2569
+ constructor({ script, scriptData, gasLimit, ...rest }) {
2575
2570
  super(rest);
2576
2571
  this.gasLimit = (0, import_math10.bn)(gasLimit);
2577
2572
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
@@ -5138,8 +5133,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5138
5133
  */
5139
5134
  async createTransfer(destination, amount, assetId, txParams = {}) {
5140
5135
  const { minGasPrice } = this.provider.getGasConfig();
5136
+ const baseAssetId = this.provider.getBaseAssetId();
5141
5137
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5142
- const params = { gasPrice: minGasPrice, ...txParams };
5138
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5143
5139
  const request = new ScriptTransactionRequest(params);
5144
5140
  request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetIdToTransfer);
5145
5141
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
@@ -5196,8 +5192,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5196
5192
  }
5197
5193
  const contractAddress = import_address4.Address.fromAddressOrString(contractId);
5198
5194
  const { minGasPrice } = this.provider.getGasConfig();
5195
+ const baseAssetId = this.provider.getBaseAssetId();
5199
5196
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5200
- const params = { gasPrice: minGasPrice, ...txParams };
5197
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5201
5198
  const { script, scriptData } = await assembleTransferToContractScript({
5202
5199
  hexlifiedContractId: contractAddress.toB256(),
5203
5200
  amountToTransfer: (0, import_math18.bn)(amount),
@@ -5246,7 +5243,12 @@ var Account = class extends import_interfaces.AbstractAccount {
5246
5243
  ...recipientDataArray,
5247
5244
  ...amountDataArray
5248
5245
  ]);
5249
- const params = { script, gasPrice: minGasPrice, ...txParams };
5246
+ const params = {
5247
+ script,
5248
+ gasPrice: minGasPrice,
5249
+ baseAssetId,
5250
+ ...txParams
5251
+ };
5250
5252
  const request = new ScriptTransactionRequest(params);
5251
5253
  const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: baseAssetId }];
5252
5254
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(