@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.

@@ -1610,7 +1610,7 @@ var BaseTransactionRequest = class {
1610
1610
  /** List of witnesses */
1611
1611
  witnesses = [];
1612
1612
  /** Base asset ID - should be fetched from the chain */
1613
- baseAssetId = ZeroBytes324;
1613
+ baseAssetId;
1614
1614
  /**
1615
1615
  * Constructor for initializing a base transaction request.
1616
1616
  *
@@ -1625,7 +1625,7 @@ var BaseTransactionRequest = class {
1625
1625
  outputs,
1626
1626
  witnesses,
1627
1627
  baseAssetId
1628
- } = {}) {
1628
+ }) {
1629
1629
  this.gasPrice = bn7(gasPrice);
1630
1630
  this.maturity = maturity ?? 0;
1631
1631
  this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
@@ -1633,7 +1633,7 @@ var BaseTransactionRequest = class {
1633
1633
  this.inputs = inputs ?? [];
1634
1634
  this.outputs = outputs ?? [];
1635
1635
  this.witnesses = witnesses ?? [];
1636
- this.baseAssetId = baseAssetId ?? ZeroBytes324;
1636
+ this.baseAssetId = baseAssetId;
1637
1637
  }
1638
1638
  static getPolicyMeta(req) {
1639
1639
  let policyTypes = 0;
@@ -2232,12 +2232,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2232
2232
  *
2233
2233
  * @param createTransactionRequestLike - The initial values for the instance
2234
2234
  */
2235
- constructor({
2236
- bytecodeWitnessIndex,
2237
- salt,
2238
- storageSlots,
2239
- ...rest
2240
- } = {}) {
2235
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2241
2236
  super(rest);
2242
2237
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2243
2238
  this.salt = hexlify9(salt ?? ZeroBytes326);
@@ -2361,7 +2356,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2361
2356
  *
2362
2357
  * @param scriptTransactionRequestLike - The initial values for the instance.
2363
2358
  */
2364
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2359
+ constructor({ script, scriptData, gasLimit, ...rest }) {
2365
2360
  super(rest);
2366
2361
  this.gasLimit = bn10(gasLimit);
2367
2362
  this.script = arrayify8(script ?? returnZeroScript.bytes);
@@ -4715,8 +4710,9 @@ var Account = class extends AbstractAccount {
4715
4710
  */
4716
4711
  async createTransfer(destination, amount, assetId, txParams = {}) {
4717
4712
  const { minGasPrice } = this.provider.getGasConfig();
4713
+ const baseAssetId = this.provider.getBaseAssetId();
4718
4714
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4719
- const params = { gasPrice: minGasPrice, ...txParams };
4715
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
4720
4716
  const request = new ScriptTransactionRequest(params);
4721
4717
  request.addCoinOutput(Address3.fromAddressOrString(destination), amount, assetIdToTransfer);
4722
4718
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
@@ -4773,8 +4769,9 @@ var Account = class extends AbstractAccount {
4773
4769
  }
4774
4770
  const contractAddress = Address3.fromAddressOrString(contractId);
4775
4771
  const { minGasPrice } = this.provider.getGasConfig();
4772
+ const baseAssetId = this.provider.getBaseAssetId();
4776
4773
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4777
- const params = { gasPrice: minGasPrice, ...txParams };
4774
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
4778
4775
  const { script, scriptData } = await assembleTransferToContractScript({
4779
4776
  hexlifiedContractId: contractAddress.toB256(),
4780
4777
  amountToTransfer: bn17(amount),
@@ -4823,7 +4820,12 @@ var Account = class extends AbstractAccount {
4823
4820
  ...recipientDataArray,
4824
4821
  ...amountDataArray
4825
4822
  ]);
4826
- const params = { script, gasPrice: minGasPrice, ...txParams };
4823
+ const params = {
4824
+ script,
4825
+ gasPrice: minGasPrice,
4826
+ baseAssetId,
4827
+ ...txParams
4828
+ };
4827
4829
  const request = new ScriptTransactionRequest(params);
4828
4830
  const forwardingQuantities = [{ amount: bn17(amount), assetId: baseAssetId }];
4829
4831
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
@@ -7978,7 +7980,9 @@ var seedTestWallet = async (wallet, quantities) => {
7978
7980
  );
7979
7981
  const resources = await genesisWallet.getResourcesToSpend(quantities);
7980
7982
  const { minGasPrice } = genesisWallet.provider.getGasConfig();
7983
+ const baseAssetId = genesisWallet.provider.getBaseAssetId();
7981
7984
  const request = new ScriptTransactionRequest({
7985
+ baseAssetId,
7982
7986
  gasLimit: 1e4,
7983
7987
  gasPrice: minGasPrice
7984
7988
  });