@fuel-ts/account 0.0.0-rc-2034-20240410133013 → 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.

@@ -32486,7 +32486,8 @@ This unreleased fuel-core build may include features and updates not yet support
32486
32486
  fee_params: {
32487
32487
  gas_price_factor: 92,
32488
32488
  gas_per_byte: 4
32489
- }
32489
+ },
32490
+ base_asset_id: "0x0000000000000000000000000000000000000000000000000000000000000000"
32490
32491
  },
32491
32492
  gas_costs: {
32492
32493
  add: 1,
@@ -32710,7 +32711,7 @@ This unreleased fuel-core build may include features and updates not yet support
32710
32711
  var defaultConsensusKey = "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298";
32711
32712
 
32712
32713
  // ../crypto/dist/index.mjs
32713
- var import_crypto9 = __toESM(__require("crypto"), 1);
32714
+ var import_crypto8 = __toESM(__require("crypto"), 1);
32714
32715
 
32715
32716
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
32716
32717
  var version = "6.7.1";
@@ -33782,27 +33783,6 @@ This unreleased fuel-core build may include features and updates not yet support
33782
33783
  };
33783
33784
  Object.freeze(pbkdf22);
33784
33785
 
33785
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/random.js
33786
- var locked5 = false;
33787
- var _randomBytes = function(length) {
33788
- return new Uint8Array((0, import_crypto2.randomBytes)(length));
33789
- };
33790
- var __randomBytes = _randomBytes;
33791
- function randomBytes3(length) {
33792
- return __randomBytes(length);
33793
- }
33794
- randomBytes3._ = _randomBytes;
33795
- randomBytes3.lock = function() {
33796
- locked5 = true;
33797
- };
33798
- randomBytes3.register = function(func) {
33799
- if (locked5) {
33800
- throw new Error("randomBytes is locked");
33801
- }
33802
- __randomBytes = func;
33803
- };
33804
- Object.freeze(randomBytes3);
33805
-
33806
33786
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/address/address.js
33807
33787
  var BN_03 = BigInt(0);
33808
33788
  var BN_36 = BigInt(36);
@@ -34387,8 +34367,8 @@ This unreleased fuel-core build may include features and updates not yet support
34387
34367
  }
34388
34368
 
34389
34369
  // ../crypto/dist/index.mjs
34370
+ var import_crypto9 = __toESM(__require("crypto"), 1);
34390
34371
  var import_crypto10 = __toESM(__require("crypto"), 1);
34391
- var import_crypto11 = __toESM(__require("crypto"), 1);
34392
34372
  var scrypt3 = (params) => {
34393
34373
  const { password, salt, n, p, r, dklen } = params;
34394
34374
  const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
@@ -34397,7 +34377,7 @@ This unreleased fuel-core build may include features and updates not yet support
34397
34377
  var keccak2562 = (data) => keccak_256(data);
34398
34378
  var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
34399
34379
  var randomBytes4 = (length) => {
34400
- const randomValues = Uint8Array.from(import_crypto10.default.randomBytes(length));
34380
+ const randomValues = Uint8Array.from(import_crypto9.default.randomBytes(length));
34401
34381
  return randomValues;
34402
34382
  };
34403
34383
  var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
@@ -34412,7 +34392,7 @@ This unreleased fuel-core build may include features and updates not yet support
34412
34392
  const salt = randomBytes4(32);
34413
34393
  const secret = keyFromPassword(password, salt);
34414
34394
  const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
34415
- const cipher = await import_crypto9.default.createCipheriv(ALGORITHM, secret, iv);
34395
+ const cipher = await import_crypto8.default.createCipheriv(ALGORITHM, secret, iv);
34416
34396
  let cipherData = cipher.update(dataBuffer);
34417
34397
  cipherData = Buffer.concat([cipherData, cipher.final()]);
34418
34398
  return {
@@ -34426,7 +34406,7 @@ This unreleased fuel-core build may include features and updates not yet support
34426
34406
  const salt = bufferFromString(keystore.salt);
34427
34407
  const secret = keyFromPassword(password, salt);
34428
34408
  const encryptedText = bufferFromString(keystore.data);
34429
- const decipher = await import_crypto9.default.createDecipheriv(ALGORITHM, secret, iv);
34409
+ const decipher = await import_crypto8.default.createDecipheriv(ALGORITHM, secret, iv);
34430
34410
  const decrypted = decipher.update(encryptedText);
34431
34411
  const deBuff = Buffer.concat([decrypted, decipher.final()]);
34432
34412
  const decryptedData = Buffer.from(deBuff).toString("utf-8");
@@ -34437,12 +34417,12 @@ This unreleased fuel-core build may include features and updates not yet support
34437
34417
  }
34438
34418
  };
34439
34419
  async function encryptJsonWalletData(data, key, iv) {
34440
- const cipher = await import_crypto11.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34420
+ const cipher = await import_crypto10.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34441
34421
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
34442
34422
  return new Uint8Array(encrypted);
34443
34423
  }
34444
34424
  async function decryptJsonWalletData(data, key, iv) {
34445
- const decipher = import_crypto11.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34425
+ const decipher = import_crypto10.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34446
34426
  const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
34447
34427
  return new Uint8Array(decrypted);
34448
34428
  }
@@ -34776,10 +34756,6 @@ This unreleased fuel-core build may include features and updates not yet support
34776
34756
  }
34777
34757
  };
34778
34758
 
34779
- // ../address/dist/configs.mjs
34780
- var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
34781
- var BaseAssetId = ZeroBytes32;
34782
-
34783
34759
  // ../math/dist/index.mjs
34784
34760
  var import_bn = __toESM(require_bn(), 1);
34785
34761
  var DEFAULT_PRECISION = 9;
@@ -35010,11 +34986,11 @@ This unreleased fuel-core build may include features and updates not yet support
35010
34986
  let max2;
35011
34987
  if (Array.isArray(coinQuantityLike)) {
35012
34988
  amount = coinQuantityLike[0];
35013
- assetId = coinQuantityLike[1] ?? BaseAssetId;
35014
- max2 = coinQuantityLike[2] ?? void 0;
34989
+ assetId = coinQuantityLike[1];
34990
+ max2 = coinQuantityLike[2];
35015
34991
  } else {
35016
34992
  amount = coinQuantityLike.amount;
35017
- assetId = coinQuantityLike.assetId ?? BaseAssetId;
34993
+ assetId = coinQuantityLike.assetId;
35018
34994
  max2 = coinQuantityLike.max ?? void 0;
35019
34995
  }
35020
34996
  const bnAmount = bn(amount);
@@ -42340,6 +42316,9 @@ ${MessageCoinFragmentFragmentDoc}`;
42340
42316
  }
42341
42317
  };
42342
42318
 
42319
+ // ../address/dist/configs.mjs
42320
+ var ZeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
42321
+
42343
42322
  // src/providers/transaction-request/input.ts
42344
42323
  var inputify = (value) => {
42345
42324
  const { type: type3 } = value;
@@ -42350,7 +42329,7 @@ ${MessageCoinFragmentFragmentDoc}`;
42350
42329
  return {
42351
42330
  type: InputType.Coin,
42352
42331
  txID: hexlify(arrayify(value.id).slice(0, 32)),
42353
- outputIndex: toNumber2(arrayify(value.id).slice(32, 33)),
42332
+ outputIndex: arrayify(value.id)[32],
42354
42333
  owner: hexlify(value.owner),
42355
42334
  amount: bn(value.amount),
42356
42335
  assetId: hexlify(value.assetId),
@@ -42940,6 +42919,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42940
42919
  outputs = [];
42941
42920
  /** List of witnesses */
42942
42921
  witnesses = [];
42922
+ /** Base asset ID - should be fetched from the chain */
42923
+ baseAssetId;
42943
42924
  /**
42944
42925
  * Constructor for initializing a base transaction request.
42945
42926
  *
@@ -42952,8 +42933,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42952
42933
  witnessLimit,
42953
42934
  inputs,
42954
42935
  outputs,
42955
- witnesses
42956
- } = {}) {
42936
+ witnesses,
42937
+ baseAssetId
42938
+ }) {
42957
42939
  this.gasPrice = bn(gasPrice);
42958
42940
  this.maturity = maturity ?? 0;
42959
42941
  this.witnessLimit = witnessLimit ? bn(witnessLimit) : void 0;
@@ -42961,6 +42943,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42961
42943
  this.inputs = inputs ?? [];
42962
42944
  this.outputs = outputs ?? [];
42963
42945
  this.witnesses = witnesses ?? [];
42946
+ this.baseAssetId = baseAssetId;
42964
42947
  }
42965
42948
  static getPolicyMeta(req) {
42966
42949
  let policyTypes = 0;
@@ -43184,11 +43167,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43184
43167
  *
43185
43168
  * @param message - Message resource.
43186
43169
  * @param predicate - Predicate bytes.
43187
- * @param predicateData - Predicate data bytes.
43188
43170
  */
43189
43171
  addMessageInput(message, predicate) {
43190
43172
  const { recipient, sender, amount } = message;
43191
- const assetId = BaseAssetId;
43192
43173
  let witnessIndex;
43193
43174
  if (predicate) {
43194
43175
  witnessIndex = 0;
@@ -43208,7 +43189,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43208
43189
  predicate: predicate?.bytes
43209
43190
  };
43210
43191
  this.pushInput(input);
43211
- this.addChangeOutput(recipient, assetId);
43192
+ this.addChangeOutput(recipient, this.baseAssetId);
43212
43193
  }
43213
43194
  /**
43214
43195
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -43269,12 +43250,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43269
43250
  * @param amount - Amount of coin.
43270
43251
  * @param assetId - Asset ID of coin.
43271
43252
  */
43272
- addCoinOutput(to, amount, assetId = BaseAssetId) {
43253
+ addCoinOutput(to, amount, assetId) {
43273
43254
  this.pushOutput({
43274
43255
  type: OutputType.Coin,
43275
43256
  to: addressify(to).toB256(),
43276
43257
  amount,
43277
- assetId
43258
+ assetId: assetId ?? this.baseAssetId
43278
43259
  });
43279
43260
  return this;
43280
43261
  }
@@ -43301,7 +43282,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43301
43282
  * @param to - Address of the owner.
43302
43283
  * @param assetId - Asset ID of coin.
43303
43284
  */
43304
- addChangeOutput(to, assetId = BaseAssetId) {
43285
+ addChangeOutput(to, assetId) {
43305
43286
  const changeOutput = this.getChangeOutputs().find(
43306
43287
  (output3) => hexlify(output3.assetId) === assetId
43307
43288
  );
@@ -43309,7 +43290,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43309
43290
  this.pushOutput({
43310
43291
  type: OutputType.Change,
43311
43292
  to: addressify(to).toB256(),
43312
- assetId
43293
+ assetId: assetId ?? this.baseAssetId
43313
43294
  });
43314
43295
  }
43315
43296
  }
@@ -43360,6 +43341,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43360
43341
  * @param quantities - CoinQuantity Array.
43361
43342
  */
43362
43343
  fundWithFakeUtxos(quantities, resourcesOwner) {
43344
+ let idCounter = 0;
43345
+ const generateId = () => {
43346
+ const counterString = String(idCounter++);
43347
+ const id = ZeroBytes32.slice(0, -counterString.length).concat(counterString);
43348
+ return id;
43349
+ };
43363
43350
  const findAssetInput = (assetId) => this.inputs.find((input) => {
43364
43351
  if ("assetId" in input) {
43365
43352
  return input.assetId === assetId;
@@ -43369,12 +43356,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43369
43356
  const updateAssetInput = (assetId, quantity) => {
43370
43357
  const assetInput = findAssetInput(assetId);
43371
43358
  if (assetInput && "assetId" in assetInput) {
43372
- assetInput.id = hexlify(randomBytes3(33));
43359
+ assetInput.id = generateId();
43373
43360
  assetInput.amount = quantity;
43374
43361
  } else {
43375
43362
  this.addResources([
43376
43363
  {
43377
- id: hexlify(randomBytes3(33)),
43364
+ id: generateId(),
43378
43365
  amount: quantity,
43379
43366
  assetId,
43380
43367
  owner: resourcesOwner || Address.fromRandom(),
@@ -43385,7 +43372,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43385
43372
  ]);
43386
43373
  }
43387
43374
  };
43388
- updateAssetInput(BaseAssetId, bn(1e11));
43375
+ updateAssetInput(this.baseAssetId, bn(1e11));
43389
43376
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
43390
43377
  }
43391
43378
  /**
@@ -43542,12 +43529,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43542
43529
  *
43543
43530
  * @param createTransactionRequestLike - The initial values for the instance
43544
43531
  */
43545
- constructor({
43546
- bytecodeWitnessIndex,
43547
- salt,
43548
- storageSlots,
43549
- ...rest
43550
- } = {}) {
43532
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
43551
43533
  super(rest);
43552
43534
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
43553
43535
  this.salt = hexlify(salt ?? ZeroBytes32);
@@ -43662,7 +43644,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43662
43644
  *
43663
43645
  * @param scriptTransactionRequestLike - The initial values for the instance.
43664
43646
  */
43665
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
43647
+ constructor({ script, scriptData, gasLimit, ...rest }) {
43666
43648
  super(rest);
43667
43649
  this.gasLimit = bn(gasLimit);
43668
43650
  this.script = arrayify(script ?? returnZeroScript.bytes);
@@ -44761,6 +44743,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
44761
44743
  gasPerByte: bn(feeParams.gasPerByte),
44762
44744
  maxMessageDataLength: bn(predicateParams.maxMessageDataLength),
44763
44745
  chainId: bn(consensusParameters.chainId),
44746
+ baseAssetId: consensusParameters.baseAssetId,
44764
44747
  gasCosts
44765
44748
  },
44766
44749
  gasCosts,
@@ -45003,6 +44986,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45003
44986
  } = this.getChain();
45004
44987
  return chainId.toNumber();
45005
44988
  }
44989
+ /**
44990
+ * Returns the base asset ID
44991
+ *
44992
+ * @returns A promise that resolves to the base asset ID
44993
+ */
44994
+ getBaseAssetId() {
44995
+ const {
44996
+ consensusParameters: { baseAssetId }
44997
+ } = this.getChain();
44998
+ return baseAssetId;
44999
+ }
45006
45000
  /**
45007
45001
  * Submits a transaction to the chain to be executed.
45008
45002
  *
@@ -45153,37 +45147,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45153
45147
  missingContractIds
45154
45148
  };
45155
45149
  }
45156
- /**
45157
- * Estimates the transaction gas and fee based on the provided transaction request.
45158
- * @param transactionRequest - The transaction request object.
45159
- * @param optimizeGas - Optional. Specifies whether to optimize the gas. Default is false.
45160
- * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
45161
- */
45162
- estimateTxGasAndFee(params) {
45163
- const { transactionRequest } = params;
45164
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
45165
- const chainInfo = this.getChain();
45166
- const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
45167
- transactionRequest.gasPrice = gasPrice;
45168
- const minGas = transactionRequest.calculateMinGas(chainInfo);
45169
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
45170
- if (transactionRequest.type === TransactionType.Script) {
45171
- if (transactionRequest.gasLimit.eq(0)) {
45172
- transactionRequest.gasLimit = minGas;
45173
- transactionRequest.gasLimit = maxGasPerTx.sub(
45174
- transactionRequest.calculateMaxGas(chainInfo, minGas)
45175
- );
45176
- }
45177
- }
45178
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
45179
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
45180
- return {
45181
- minGas,
45182
- minFee,
45183
- maxGas,
45184
- maxFee
45185
- };
45186
- }
45187
45150
  /**
45188
45151
  * Executes a signed transaction without applying the states changes
45189
45152
  * on the chain.
@@ -45231,16 +45194,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45231
45194
  signatureCallback
45232
45195
  } = {}) {
45233
45196
  const txRequestClone = clone_default(transactionRequestify(transactionRequestLike));
45234
- const { minGasPrice } = this.getGasConfig();
45235
- const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
45197
+ const chainInfo = this.getChain();
45198
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
45199
+ const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
45236
45200
  const isScriptTransaction = txRequestClone.type === TransactionType.Script;
45237
45201
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
45238
45202
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
45239
45203
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
45240
- if (isScriptTransaction) {
45241
- txRequestClone.gasLimit = bn(0);
45242
- }
45243
45204
  if (estimatePredicates) {
45205
+ if (isScriptTransaction) {
45206
+ txRequestClone.gasLimit = bn(0);
45207
+ }
45244
45208
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
45245
45209
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
45246
45210
  }
@@ -45249,34 +45213,36 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45249
45213
  if (signatureCallback && isScriptTransaction) {
45250
45214
  await signatureCallback(txRequestClone);
45251
45215
  }
45252
- let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
45253
- transactionRequest: txRequestClone
45254
- });
45216
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
45217
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
45255
45218
  let receipts = [];
45256
45219
  let missingContractIds = [];
45257
45220
  let outputVariables = 0;
45258
- let gasUsed = bn(0);
45259
45221
  if (isScriptTransaction && estimateTxDependencies) {
45260
45222
  txRequestClone.gasPrice = bn(0);
45223
+ txRequestClone.gasLimit = bn(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
45261
45224
  const result = await this.estimateTxDependencies(txRequestClone);
45262
45225
  receipts = result.receipts;
45263
45226
  outputVariables = result.outputVariables;
45264
45227
  missingContractIds = result.missingContractIds;
45265
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
45266
- txRequestClone.gasLimit = gasUsed;
45267
- txRequestClone.gasPrice = setGasPrice;
45268
- ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
45269
- transactionRequest: txRequestClone
45270
- }));
45271
45228
  }
45229
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
45230
+ const usedFee = calculatePriceWithFactor(
45231
+ gasUsed,
45232
+ gasPrice,
45233
+ gasPriceFactor
45234
+ ).normalizeZeroToOne();
45235
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
45236
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
45272
45237
  return {
45273
45238
  requiredQuantities: allQuantities,
45274
45239
  receipts,
45275
45240
  gasUsed,
45276
45241
  minGasPrice,
45277
- gasPrice: setGasPrice,
45242
+ gasPrice,
45278
45243
  minGas,
45279
45244
  maxGas,
45245
+ usedFee,
45280
45246
  minFee,
45281
45247
  maxFee,
45282
45248
  estimatedInputs: txRequestClone.inputs,
@@ -45892,8 +45858,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45892
45858
  * @param assetId - The asset ID to check the balance for.
45893
45859
  * @returns A promise that resolves to the balance amount.
45894
45860
  */
45895
- async getBalance(assetId = BaseAssetId) {
45896
- const amount = await this.provider.getBalance(this.address, assetId);
45861
+ async getBalance(assetId) {
45862
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
45863
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
45897
45864
  return amount;
45898
45865
  }
45899
45866
  /**
@@ -45931,9 +45898,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45931
45898
  * @returns A promise that resolves when the resources are added to the transaction.
45932
45899
  */
45933
45900
  async fund(request, coinQuantities, fee) {
45901
+ const baseAssetId = this.provider.getBaseAssetId();
45934
45902
  const updatedQuantities = addAmountToAsset({
45935
45903
  amount: bn(fee),
45936
- assetId: BaseAssetId,
45904
+ assetId: baseAssetId,
45937
45905
  coinQuantities
45938
45906
  });
45939
45907
  const quantitiesDict = {};
@@ -45957,8 +45925,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45957
45925
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
45958
45926
  cachedUtxos.push(input.id);
45959
45927
  }
45960
- } else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) {
45961
- quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount);
45928
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
45929
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
45962
45930
  cachedMessages.push(input.nonce);
45963
45931
  }
45964
45932
  }
@@ -45990,11 +45958,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
45990
45958
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
45991
45959
  * @returns A promise that resolves to the prepared transaction request.
45992
45960
  */
45993
- async createTransfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
45961
+ async createTransfer(destination, amount, assetId, txParams = {}) {
45994
45962
  const { minGasPrice } = this.provider.getGasConfig();
45995
- const params = { gasPrice: minGasPrice, ...txParams };
45963
+ const baseAssetId = this.provider.getBaseAssetId();
45964
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
45965
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
45996
45966
  const request = new ScriptTransactionRequest(params);
45997
- request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetId);
45967
+ request.addCoinOutput(Address.fromAddressOrString(destination), amount, assetIdToTransfer);
45998
45968
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
45999
45969
  estimateTxDependencies: true,
46000
45970
  resourcesOwner: this
@@ -46020,14 +45990,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46020
45990
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
46021
45991
  * @returns A promise that resolves to the transaction response.
46022
45992
  */
46023
- async transfer(destination, amount, assetId = BaseAssetId, txParams = {}) {
45993
+ async transfer(destination, amount, assetId, txParams = {}) {
46024
45994
  if (bn(amount).lte(0)) {
46025
45995
  throw new FuelError(
46026
45996
  ErrorCode.INVALID_TRANSFER_AMOUNT,
46027
45997
  "Transfer amount must be a positive number."
46028
45998
  );
46029
45999
  }
46030
- const request = await this.createTransfer(destination, amount, assetId, txParams);
46000
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
46001
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
46031
46002
  return this.sendTransaction(request, { estimateTxDependencies: false });
46032
46003
  }
46033
46004
  /**
@@ -46039,7 +46010,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46039
46010
  * @param txParams - The optional transaction parameters.
46040
46011
  * @returns A promise that resolves to the transaction response.
46041
46012
  */
46042
- async transferToContract(contractId, amount, assetId = BaseAssetId, txParams = {}) {
46013
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
46043
46014
  if (bn(amount).lte(0)) {
46044
46015
  throw new FuelError(
46045
46016
  ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -46048,11 +46019,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46048
46019
  }
46049
46020
  const contractAddress = Address.fromAddressOrString(contractId);
46050
46021
  const { minGasPrice } = this.provider.getGasConfig();
46051
- const params = { gasPrice: minGasPrice, ...txParams };
46022
+ const baseAssetId = this.provider.getBaseAssetId();
46023
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
46024
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
46052
46025
  const { script, scriptData } = await assembleTransferToContractScript({
46053
46026
  hexlifiedContractId: contractAddress.toB256(),
46054
46027
  amountToTransfer: bn(amount),
46055
- assetId
46028
+ assetId: assetIdToTransfer
46056
46029
  });
46057
46030
  const request = new ScriptTransactionRequest({
46058
46031
  ...params,
@@ -46062,7 +46035,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46062
46035
  request.addContractInputAndOutput(contractAddress);
46063
46036
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
46064
46037
  request,
46065
- [{ amount: bn(amount), assetId: String(assetId) }]
46038
+ [{ amount: bn(amount), assetId: String(assetIdToTransfer) }]
46066
46039
  );
46067
46040
  request.gasLimit = bn(params.gasLimit ?? gasUsed);
46068
46041
  this.validateGas({
@@ -46084,6 +46057,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46084
46057
  */
46085
46058
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
46086
46059
  const { minGasPrice } = this.provider.getGasConfig();
46060
+ const baseAssetId = this.provider.getBaseAssetId();
46087
46061
  const recipientAddress = Address.fromAddressOrString(recipient);
46088
46062
  const recipientDataArray = arrayify(
46089
46063
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -46096,9 +46070,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
46096
46070
  ...recipientDataArray,
46097
46071
  ...amountDataArray
46098
46072
  ]);
46099
- const params = { script, gasPrice: minGasPrice, ...txParams };
46073
+ const params = {
46074
+ script,
46075
+ gasPrice: minGasPrice,
46076
+ baseAssetId,
46077
+ ...txParams
46078
+ };
46100
46079
  const request = new ScriptTransactionRequest(params);
46101
- const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }];
46080
+ const forwardingQuantities = [{ amount: bn(amount), assetId: baseAssetId }];
46102
46081
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
46103
46082
  request,
46104
46083
  forwardingQuantities
@@ -47562,12 +47541,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47562
47541
  };
47563
47542
 
47564
47543
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
47565
- var import_crypto16 = __toESM(__require("crypto"));
47544
+ var import_crypto15 = __toESM(__require("crypto"));
47566
47545
  var rnds8Pool = new Uint8Array(256);
47567
47546
  var poolPtr = rnds8Pool.length;
47568
47547
  function rng() {
47569
47548
  if (poolPtr > rnds8Pool.length - 16) {
47570
- import_crypto16.default.randomFillSync(rnds8Pool);
47549
+ import_crypto15.default.randomFillSync(rnds8Pool);
47571
47550
  poolPtr = 0;
47572
47551
  }
47573
47552
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
@@ -47583,9 +47562,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47583
47562
  }
47584
47563
 
47585
47564
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
47586
- var import_crypto17 = __toESM(__require("crypto"));
47565
+ var import_crypto16 = __toESM(__require("crypto"));
47587
47566
  var native_default = {
47588
- randomUUID: import_crypto17.default.randomUUID
47567
+ randomUUID: import_crypto16.default.randomUUID
47589
47568
  };
47590
47569
 
47591
47570
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
@@ -50530,7 +50509,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50530
50509
  );
50531
50510
  const resources = await genesisWallet.getResourcesToSpend(quantities);
50532
50511
  const { minGasPrice } = genesisWallet.provider.getGasConfig();
50512
+ const baseAssetId = genesisWallet.provider.getBaseAssetId();
50533
50513
  const request = new ScriptTransactionRequest({
50514
+ baseAssetId,
50534
50515
  gasLimit: 1e4,
50535
50516
  gasPrice: minGasPrice
50536
50517
  });
@@ -50565,7 +50546,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50565
50546
 
50566
50547
  // src/test-utils/launchNode.ts
50567
50548
  var import_child_process = __require("child_process");
50568
- var import_crypto21 = __require("crypto");
50549
+ var import_crypto20 = __require("crypto");
50569
50550
  var import_fs2 = __require("fs");
50570
50551
  var import_os = __toESM(__require("os"));
50571
50552
  var import_path8 = __toESM(__require("path"));
@@ -50637,7 +50618,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50637
50618
  })).toString();
50638
50619
  let chainConfigPathToUse;
50639
50620
  const prefix = basePath || import_os.default.tmpdir();
50640
- const suffix = basePath ? "" : (0, import_crypto21.randomUUID)();
50621
+ const suffix = basePath ? "" : (0, import_crypto20.randomUUID)();
50641
50622
  const tempDirPath = import_path8.default.join(prefix, ".fuels", suffix);
50642
50623
  if (chainConfigPath) {
50643
50624
  chainConfigPathToUse = chainConfigPath;
@@ -50660,7 +50641,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50660
50641
  {
50661
50642
  owner: signer.address.toHexString(),
50662
50643
  amount: toHex(1e9),
50663
- asset_id: BaseAssetId
50644
+ asset_id: defaultChainConfig?.consensus_parameters?.base_asset_id ?? ZeroBytes32
50664
50645
  }
50665
50646
  ]
50666
50647
  }
@@ -50726,9 +50707,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
50726
50707
  })
50727
50708
  );
50728
50709
  var generateWallets = async (count, provider) => {
50710
+ const baseAssetId = provider.getBaseAssetId();
50729
50711
  const wallets = [];
50730
50712
  for (let i = 0; i < count; i += 1) {
50731
- const wallet = await generateTestWallet(provider, [[1e3, BaseAssetId]]);
50713
+ const wallet = await generateTestWallet(provider, [[1e3, baseAssetId]]);
50732
50714
  wallets.push(wallet);
50733
50715
  }
50734
50716
  return wallets;