@fuel-ts/account 0.0.0-rc-1976-20240424151753 → 0.0.0-rc-2143-20240424152333

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
@@ -184,12 +184,14 @@ module.exports = __toCommonJS(src_exports);
184
184
 
185
185
  // src/account.ts
186
186
  var import_address4 = require("@fuel-ts/address");
187
+ var import_configs12 = require("@fuel-ts/address/configs");
187
188
  var import_errors16 = require("@fuel-ts/errors");
188
189
  var import_interfaces = require("@fuel-ts/interfaces");
189
190
  var import_math18 = require("@fuel-ts/math");
190
191
  var import_utils28 = require("@fuel-ts/utils");
191
192
 
192
193
  // src/providers/coin-quantity.ts
194
+ var import_configs = require("@fuel-ts/address/configs");
193
195
  var import_math = require("@fuel-ts/math");
194
196
  var import_utils = require("@fuel-ts/utils");
195
197
  var coinQuantityfy = (coinQuantityLike) => {
@@ -198,11 +200,11 @@ var coinQuantityfy = (coinQuantityLike) => {
198
200
  let max2;
199
201
  if (Array.isArray(coinQuantityLike)) {
200
202
  amount = coinQuantityLike[0];
201
- assetId = coinQuantityLike[1];
202
- max2 = coinQuantityLike[2];
203
+ assetId = coinQuantityLike[1] ?? import_configs.BaseAssetId;
204
+ max2 = coinQuantityLike[2] ?? void 0;
203
205
  } else {
204
206
  amount = coinQuantityLike.amount;
205
- assetId = coinQuantityLike.assetId;
207
+ assetId = coinQuantityLike.assetId ?? import_configs.BaseAssetId;
206
208
  max2 = coinQuantityLike.max ?? void 0;
207
209
  }
208
210
  const bnAmount = (0, import_math.bn)(amount);
@@ -1181,7 +1183,7 @@ var MemoryCache = class {
1181
1183
 
1182
1184
  // src/providers/transaction-request/input.ts
1183
1185
  var import_abi_coder = require("@fuel-ts/abi-coder");
1184
- var import_configs = require("@fuel-ts/address/configs");
1186
+ var import_configs2 = require("@fuel-ts/address/configs");
1185
1187
  var import_errors3 = require("@fuel-ts/errors");
1186
1188
  var import_math2 = require("@fuel-ts/math");
1187
1189
  var import_transactions = require("@fuel-ts/transactions");
@@ -1215,10 +1217,10 @@ var inputify = (value) => {
1215
1217
  case import_transactions.InputType.Contract: {
1216
1218
  return {
1217
1219
  type: import_transactions.InputType.Contract,
1218
- txID: import_configs.ZeroBytes32,
1220
+ txID: import_configs2.ZeroBytes32,
1219
1221
  outputIndex: 0,
1220
- balanceRoot: import_configs.ZeroBytes32,
1221
- stateRoot: import_configs.ZeroBytes32,
1222
+ balanceRoot: import_configs2.ZeroBytes32,
1223
+ stateRoot: import_configs2.ZeroBytes32,
1222
1224
  txPointer: {
1223
1225
  blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1224
1226
  txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
@@ -1256,7 +1258,7 @@ var inputify = (value) => {
1256
1258
  };
1257
1259
 
1258
1260
  // src/providers/transaction-request/output.ts
1259
- var import_configs2 = require("@fuel-ts/address/configs");
1261
+ var import_configs3 = require("@fuel-ts/address/configs");
1260
1262
  var import_errors4 = require("@fuel-ts/errors");
1261
1263
  var import_math3 = require("@fuel-ts/math");
1262
1264
  var import_transactions2 = require("@fuel-ts/transactions");
@@ -1276,8 +1278,8 @@ var outputify = (value) => {
1276
1278
  return {
1277
1279
  type: import_transactions2.OutputType.Contract,
1278
1280
  inputIndex: value.inputIndex,
1279
- balanceRoot: import_configs2.ZeroBytes32,
1280
- stateRoot: import_configs2.ZeroBytes32
1281
+ balanceRoot: import_configs3.ZeroBytes32,
1282
+ stateRoot: import_configs3.ZeroBytes32
1281
1283
  };
1282
1284
  }
1283
1285
  case import_transactions2.OutputType.Change: {
@@ -1291,9 +1293,9 @@ var outputify = (value) => {
1291
1293
  case import_transactions2.OutputType.Variable: {
1292
1294
  return {
1293
1295
  type: import_transactions2.OutputType.Variable,
1294
- to: import_configs2.ZeroBytes32,
1296
+ to: import_configs3.ZeroBytes32,
1295
1297
  amount: (0, import_math3.bn)(0),
1296
- assetId: import_configs2.ZeroBytes32
1298
+ assetId: import_configs3.ZeroBytes32
1297
1299
  };
1298
1300
  }
1299
1301
  case import_transactions2.OutputType.ContractCreated: {
@@ -1315,7 +1317,7 @@ var outputify = (value) => {
1315
1317
  // src/providers/transaction-request/transaction-request.ts
1316
1318
  var import_abi_coder2 = require("@fuel-ts/abi-coder");
1317
1319
  var import_address = require("@fuel-ts/address");
1318
- var import_configs6 = require("@fuel-ts/address/configs");
1320
+ var import_configs7 = require("@fuel-ts/address/configs");
1319
1321
  var import_crypto = require("@fuel-ts/crypto");
1320
1322
  var import_math7 = require("@fuel-ts/math");
1321
1323
  var import_transactions6 = require("@fuel-ts/transactions");
@@ -1328,13 +1330,13 @@ var isCoin = (resource) => "id" in resource;
1328
1330
  var isMessage = (resource) => "recipient" in resource;
1329
1331
 
1330
1332
  // src/providers/utils/receipts.ts
1331
- var import_configs3 = require("@fuel-ts/address/configs");
1333
+ var import_configs4 = require("@fuel-ts/address/configs");
1332
1334
  var import_errors5 = require("@fuel-ts/errors");
1333
1335
  var import_math4 = require("@fuel-ts/math");
1334
1336
  var import_transactions3 = require("@fuel-ts/transactions");
1335
- var import_configs4 = require("@fuel-ts/transactions/configs");
1337
+ var import_configs5 = require("@fuel-ts/transactions/configs");
1336
1338
  var import_utils5 = require("@fuel-ts/utils");
1337
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1339
+ var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1338
1340
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions3.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1339
1341
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1340
1342
  (memo, receipt) => {
@@ -1351,7 +1353,7 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1351
1353
  missingOutputContractIds: []
1352
1354
  }
1353
1355
  );
1354
- var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
1356
+ var hexOrZero = (hex) => hex || import_configs4.ZeroBytes32;
1355
1357
  function assembleReceiptByType(receipt) {
1356
1358
  const { receiptType } = receipt;
1357
1359
  switch (receiptType) {
@@ -1715,16 +1717,16 @@ function sleep(time) {
1715
1717
  var import_errors7 = require("@fuel-ts/errors");
1716
1718
  var import_math6 = require("@fuel-ts/math");
1717
1719
  var import_transactions5 = require("@fuel-ts/transactions");
1718
- var import_configs5 = require("@fuel-ts/transactions/configs");
1720
+ var import_configs6 = require("@fuel-ts/transactions/configs");
1719
1721
  var assemblePanicError = (status) => {
1720
1722
  let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1721
1723
  const reason = status.reason;
1722
- if (import_configs5.PANIC_REASONS.includes(status.reason)) {
1724
+ if (import_configs6.PANIC_REASONS.includes(status.reason)) {
1723
1725
  errorMessage = `${errorMessage}
1724
1726
 
1725
1727
  You can read more about this error at:
1726
1728
 
1727
- ${import_configs5.PANIC_DOC_URL}#variant.${status.reason}`;
1729
+ ${import_configs6.PANIC_DOC_URL}#variant.${status.reason}`;
1728
1730
  }
1729
1731
  return { errorMessage, reason };
1730
1732
  };
@@ -1736,28 +1738,28 @@ var assembleRevertError = (receipts, logs) => {
1736
1738
  if (revertReceipt) {
1737
1739
  const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
1738
1740
  switch (reasonHex) {
1739
- case import_configs5.FAILED_REQUIRE_SIGNAL: {
1741
+ case import_configs6.FAILED_REQUIRE_SIGNAL: {
1740
1742
  reason = "require";
1741
1743
  errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1742
1744
  break;
1743
1745
  }
1744
- case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
1746
+ case import_configs6.FAILED_ASSERT_EQ_SIGNAL: {
1745
1747
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1746
1748
  reason = "assert_eq";
1747
1749
  errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1748
1750
  break;
1749
1751
  }
1750
- case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
1752
+ case import_configs6.FAILED_ASSERT_NE_SIGNAL: {
1751
1753
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1752
1754
  reason = "assert_ne";
1753
1755
  errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1754
1756
  break;
1755
1757
  }
1756
- case import_configs5.FAILED_ASSERT_SIGNAL:
1758
+ case import_configs6.FAILED_ASSERT_SIGNAL:
1757
1759
  reason = "assert";
1758
1760
  errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1759
1761
  break;
1760
- case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1762
+ case import_configs6.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1761
1763
  reason = "MissingOutputChange";
1762
1764
  errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1763
1765
  break;
@@ -1944,7 +1946,7 @@ var BaseTransactionRequest = class {
1944
1946
  * @returns The index of the created witness.
1945
1947
  */
1946
1948
  addEmptyWitness() {
1947
- this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1949
+ this.addWitness((0, import_utils9.concat)([import_configs7.ZeroBytes32, import_configs7.ZeroBytes32]));
1948
1950
  return this.witnesses.length - 1;
1949
1951
  }
1950
1952
  /**
@@ -2071,13 +2073,15 @@ var BaseTransactionRequest = class {
2071
2073
  }
2072
2074
  /**
2073
2075
  * Adds a single message input to the transaction and a change output for the
2074
- * asset against the message
2076
+ * baseAssetId, if one it was not added yet.
2075
2077
  *
2076
2078
  * @param message - Message resource.
2077
2079
  * @param predicate - Predicate bytes.
2080
+ * @param predicateData - Predicate data bytes.
2078
2081
  */
2079
2082
  addMessageInput(message, predicate) {
2080
- const { recipient, sender, amount, assetId } = message;
2083
+ const { recipient, sender, amount } = message;
2084
+ const assetId = import_configs7.BaseAssetId;
2081
2085
  let witnessIndex;
2082
2086
  if (predicate) {
2083
2087
  witnessIndex = 0;
@@ -2158,7 +2162,7 @@ var BaseTransactionRequest = class {
2158
2162
  * @param amount - Amount of coin.
2159
2163
  * @param assetId - Asset ID of coin.
2160
2164
  */
2161
- addCoinOutput(to, amount, assetId) {
2165
+ addCoinOutput(to, amount, assetId = import_configs7.BaseAssetId) {
2162
2166
  this.pushOutput({
2163
2167
  type: import_transactions6.OutputType.Coin,
2164
2168
  to: (0, import_address.addressify)(to).toB256(),
@@ -2190,7 +2194,7 @@ var BaseTransactionRequest = class {
2190
2194
  * @param to - Address of the owner.
2191
2195
  * @param assetId - Asset ID of coin.
2192
2196
  */
2193
- addChangeOutput(to, assetId) {
2197
+ addChangeOutput(to, assetId = import_configs7.BaseAssetId) {
2194
2198
  const changeOutput = this.getChangeOutputs().find(
2195
2199
  (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
2196
2200
  );
@@ -2247,9 +2251,8 @@ var BaseTransactionRequest = class {
2247
2251
  * quantities array.
2248
2252
  *
2249
2253
  * @param quantities - CoinQuantity Array.
2250
- * @param baseAssetId - The base asset to fund the transaction.
2251
2254
  */
2252
- fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
2255
+ fundWithFakeUtxos(quantities, resourcesOwner) {
2253
2256
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2254
2257
  if ("assetId" in input) {
2255
2258
  return input.assetId === assetId;
@@ -2275,7 +2278,7 @@ var BaseTransactionRequest = class {
2275
2278
  ]);
2276
2279
  }
2277
2280
  };
2278
- updateAssetInput(baseAssetId, (0, import_math7.bn)(1e11));
2281
+ updateAssetInput(import_configs7.BaseAssetId, (0, import_math7.bn)(1e11));
2279
2282
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2280
2283
  }
2281
2284
  /**
@@ -2325,13 +2328,13 @@ var BaseTransactionRequest = class {
2325
2328
  };
2326
2329
 
2327
2330
  // src/providers/transaction-request/create-transaction-request.ts
2328
- var import_configs8 = require("@fuel-ts/address/configs");
2331
+ var import_configs9 = require("@fuel-ts/address/configs");
2329
2332
  var import_math9 = require("@fuel-ts/math");
2330
2333
  var import_transactions8 = require("@fuel-ts/transactions");
2331
2334
  var import_utils13 = require("@fuel-ts/utils");
2332
2335
 
2333
2336
  // src/providers/transaction-request/hash-transaction.ts
2334
- var import_configs7 = require("@fuel-ts/address/configs");
2337
+ var import_configs8 = require("@fuel-ts/address/configs");
2335
2338
  var import_hasher = require("@fuel-ts/hasher");
2336
2339
  var import_math8 = require("@fuel-ts/math");
2337
2340
  var import_transactions7 = require("@fuel-ts/transactions");
@@ -2340,7 +2343,7 @@ var import_ramda2 = require("ramda");
2340
2343
  function hashTransaction(transactionRequest, chainId) {
2341
2344
  const transaction = transactionRequest.toTransaction();
2342
2345
  if (transaction.type === import_transactions7.TransactionType.Script) {
2343
- transaction.receiptsRoot = import_configs7.ZeroBytes32;
2346
+ transaction.receiptsRoot = import_configs8.ZeroBytes32;
2344
2347
  }
2345
2348
  transaction.inputs = transaction.inputs.map((input) => {
2346
2349
  const inputClone = (0, import_ramda2.clone)(input);
@@ -2362,10 +2365,10 @@ function hashTransaction(transactionRequest, chainId) {
2362
2365
  blockHeight: 0,
2363
2366
  txIndex: 0
2364
2367
  };
2365
- inputClone.txID = import_configs7.ZeroBytes32;
2368
+ inputClone.txID = import_configs8.ZeroBytes32;
2366
2369
  inputClone.outputIndex = 0;
2367
- inputClone.balanceRoot = import_configs7.ZeroBytes32;
2368
- inputClone.stateRoot = import_configs7.ZeroBytes32;
2370
+ inputClone.balanceRoot = import_configs8.ZeroBytes32;
2371
+ inputClone.stateRoot = import_configs8.ZeroBytes32;
2369
2372
  return inputClone;
2370
2373
  }
2371
2374
  default:
@@ -2376,8 +2379,8 @@ function hashTransaction(transactionRequest, chainId) {
2376
2379
  const outputClone = (0, import_ramda2.clone)(output);
2377
2380
  switch (outputClone.type) {
2378
2381
  case import_transactions7.OutputType.Contract: {
2379
- outputClone.balanceRoot = import_configs7.ZeroBytes32;
2380
- outputClone.stateRoot = import_configs7.ZeroBytes32;
2382
+ outputClone.balanceRoot = import_configs8.ZeroBytes32;
2383
+ outputClone.stateRoot = import_configs8.ZeroBytes32;
2381
2384
  return outputClone;
2382
2385
  }
2383
2386
  case import_transactions7.OutputType.Change: {
@@ -2385,9 +2388,9 @@ function hashTransaction(transactionRequest, chainId) {
2385
2388
  return outputClone;
2386
2389
  }
2387
2390
  case import_transactions7.OutputType.Variable: {
2388
- outputClone.to = import_configs7.ZeroBytes32;
2391
+ outputClone.to = import_configs8.ZeroBytes32;
2389
2392
  outputClone.amount = (0, import_math8.bn)(0);
2390
- outputClone.assetId = import_configs7.ZeroBytes32;
2393
+ outputClone.assetId = import_configs8.ZeroBytes32;
2391
2394
  return outputClone;
2392
2395
  }
2393
2396
  default:
@@ -2445,10 +2448,15 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2445
2448
  *
2446
2449
  * @param createTransactionRequestLike - The initial values for the instance
2447
2450
  */
2448
- constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2451
+ constructor({
2452
+ bytecodeWitnessIndex,
2453
+ salt,
2454
+ storageSlots,
2455
+ ...rest
2456
+ } = {}) {
2449
2457
  super(rest);
2450
2458
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2451
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2459
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs9.ZeroBytes32);
2452
2460
  this.storageSlots = [...storageSlots ?? []];
2453
2461
  }
2454
2462
  /**
@@ -2466,7 +2474,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2466
2474
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2467
2475
  bytecodeWitnessIndex,
2468
2476
  storageSlotsCount: storageSlots.length,
2469
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2477
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs9.ZeroBytes32,
2470
2478
  storageSlots
2471
2479
  };
2472
2480
  }
@@ -2516,7 +2524,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2516
2524
  // src/providers/transaction-request/script-transaction-request.ts
2517
2525
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
2518
2526
  var import_address2 = require("@fuel-ts/address");
2519
- var import_configs9 = require("@fuel-ts/address/configs");
2527
+ var import_configs10 = require("@fuel-ts/address/configs");
2520
2528
  var import_math10 = require("@fuel-ts/math");
2521
2529
  var import_transactions9 = require("@fuel-ts/transactions");
2522
2530
  var import_utils15 = require("@fuel-ts/utils");
@@ -2590,7 +2598,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2590
2598
  ...super.getBaseTransaction(),
2591
2599
  scriptLength: script.length,
2592
2600
  scriptDataLength: scriptData.length,
2593
- receiptsRoot: import_configs9.ZeroBytes32,
2601
+ receiptsRoot: import_configs10.ZeroBytes32,
2594
2602
  script: (0, import_utils15.hexlify)(script),
2595
2603
  scriptData: (0, import_utils15.hexlify)(scriptData)
2596
2604
  };
@@ -2822,7 +2830,7 @@ var calculateTransactionFee = (params) => {
2822
2830
  };
2823
2831
 
2824
2832
  // src/providers/transaction-summary/operations.ts
2825
- var import_configs10 = require("@fuel-ts/address/configs");
2833
+ var import_configs11 = require("@fuel-ts/address/configs");
2826
2834
  var import_errors11 = require("@fuel-ts/errors");
2827
2835
  var import_math13 = require("@fuel-ts/math");
2828
2836
  var import_transactions14 = require("@fuel-ts/transactions");
@@ -3167,7 +3175,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3167
3175
  const { to: toAddress, assetId, amount } = receipt;
3168
3176
  let { from: fromAddress } = receipt;
3169
3177
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3170
- if (import_configs10.ZeroBytes32 === fromAddress) {
3178
+ if (import_configs11.ZeroBytes32 === fromAddress) {
3171
3179
  const change = changeOutputs.find((output) => output.assetId === assetId);
3172
3180
  fromAddress = change?.to || fromAddress;
3173
3181
  }
@@ -3706,7 +3714,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
3706
3714
  }
3707
3715
 
3708
3716
  // src/providers/utils/merge-quantities.ts
3709
- var mergeQuantities = (...coinQuantities) => {
3717
+ var mergeQuantities = (arr1, arr2) => {
3710
3718
  const resultMap = {};
3711
3719
  function addToMap({ amount, assetId }) {
3712
3720
  if (resultMap[assetId]) {
@@ -3715,7 +3723,8 @@ var mergeQuantities = (...coinQuantities) => {
3715
3723
  resultMap[assetId] = amount;
3716
3724
  }
3717
3725
  }
3718
- coinQuantities.forEach((arr) => arr.forEach(addToMap));
3726
+ arr1.forEach(addToMap);
3727
+ arr2.forEach(addToMap);
3719
3728
  return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
3720
3729
  };
3721
3730
 
@@ -3743,7 +3752,6 @@ var processGqlChain = (chain) => {
3743
3752
  gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3744
3753
  maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3745
3754
  chainId: (0, import_math15.bn)(consensusParameters.chainId),
3746
- baseAssetId: consensusParameters.baseAssetId,
3747
3755
  gasCosts
3748
3756
  },
3749
3757
  gasCosts,
@@ -3986,17 +3994,6 @@ var _Provider = class {
3986
3994
  } = this.getChain();
3987
3995
  return chainId.toNumber();
3988
3996
  }
3989
- /**
3990
- * Returns the base asset ID
3991
- *
3992
- * @returns A promise that resolves to the base asset ID
3993
- */
3994
- getBaseAssetId() {
3995
- const {
3996
- consensusParameters: { baseAssetId }
3997
- } = this.getChain();
3998
- return baseAssetId;
3999
- }
4000
3997
  /**
4001
3998
  * Submits a transaction to the chain to be executed.
4002
3999
  *
@@ -4227,10 +4224,9 @@ var _Provider = class {
4227
4224
  const { minGasPrice } = this.getGasConfig();
4228
4225
  const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4229
4226
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
4230
- const baseAssetId = this.getBaseAssetId();
4231
4227
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4232
4228
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4233
- txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4229
+ txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4234
4230
  if (isScriptTransaction) {
4235
4231
  txRequestClone.gasLimit = (0, import_math15.bn)(0);
4236
4232
  }
@@ -5061,9 +5057,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5061
5057
  * @param assetId - The asset ID to check the balance for.
5062
5058
  * @returns A promise that resolves to the balance amount.
5063
5059
  */
5064
- async getBalance(assetId) {
5065
- const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
5066
- const amount = await this.provider.getBalance(this.address, assetIdToFetch);
5060
+ async getBalance(assetId = import_configs12.BaseAssetId) {
5061
+ const amount = await this.provider.getBalance(this.address, assetId);
5067
5062
  return amount;
5068
5063
  }
5069
5064
  /**
@@ -5101,10 +5096,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5101
5096
  * @returns A promise that resolves when the resources are added to the transaction.
5102
5097
  */
5103
5098
  async fund(request, coinQuantities, fee) {
5104
- const baseAssetId = this.provider.getBaseAssetId();
5105
5099
  const updatedQuantities = addAmountToAsset({
5106
5100
  amount: (0, import_math18.bn)(fee),
5107
- assetId: baseAssetId,
5101
+ assetId: import_configs12.BaseAssetId,
5108
5102
  coinQuantities
5109
5103
  });
5110
5104
  const quantitiesDict = {};
@@ -5128,8 +5122,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5128
5122
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
5129
5123
  cachedUtxos.push(input.id);
5130
5124
  }
5131
- } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
5132
- quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
5125
+ } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs12.BaseAssetId]) {
5126
+ quantitiesDict[import_configs12.BaseAssetId].owned = quantitiesDict[import_configs12.BaseAssetId].owned.add(input.amount);
5133
5127
  cachedMessages.push(input.nonce);
5134
5128
  }
5135
5129
  }
@@ -5161,12 +5155,11 @@ var Account = class extends import_interfaces.AbstractAccount {
5161
5155
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5162
5156
  * @returns A promise that resolves to the prepared transaction request.
5163
5157
  */
5164
- async createTransfer(destination, amount, assetId, txParams = {}) {
5158
+ async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5165
5159
  const { minGasPrice } = this.provider.getGasConfig();
5166
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5167
5160
  const params = { gasPrice: minGasPrice, ...txParams };
5168
5161
  const request = new ScriptTransactionRequest(params);
5169
- request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetIdToTransfer);
5162
+ request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
5170
5163
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
5171
5164
  estimateTxDependencies: true,
5172
5165
  resourcesOwner: this
@@ -5192,15 +5185,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5192
5185
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5193
5186
  * @returns A promise that resolves to the transaction response.
5194
5187
  */
5195
- async transfer(destination, amount, assetId, txParams = {}) {
5188
+ async transfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5196
5189
  if ((0, import_math18.bn)(amount).lte(0)) {
5197
5190
  throw new import_errors16.FuelError(
5198
5191
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5199
5192
  "Transfer amount must be a positive number."
5200
5193
  );
5201
5194
  }
5202
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5203
- const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
5195
+ const request = await this.createTransfer(destination, amount, assetId, txParams);
5204
5196
  return this.sendTransaction(request, { estimateTxDependencies: false });
5205
5197
  }
5206
5198
  /**
@@ -5212,7 +5204,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5212
5204
  * @param txParams - The optional transaction parameters.
5213
5205
  * @returns A promise that resolves to the transaction response.
5214
5206
  */
5215
- async transferToContract(contractId, amount, assetId, txParams = {}) {
5207
+ async transferToContract(contractId, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5216
5208
  if ((0, import_math18.bn)(amount).lte(0)) {
5217
5209
  throw new import_errors16.FuelError(
5218
5210
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -5221,12 +5213,11 @@ var Account = class extends import_interfaces.AbstractAccount {
5221
5213
  }
5222
5214
  const contractAddress = import_address4.Address.fromAddressOrString(contractId);
5223
5215
  const { minGasPrice } = this.provider.getGasConfig();
5224
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5225
5216
  const params = { gasPrice: minGasPrice, ...txParams };
5226
5217
  const { script, scriptData } = await assembleTransferToContractScript({
5227
5218
  hexlifiedContractId: contractAddress.toB256(),
5228
5219
  amountToTransfer: (0, import_math18.bn)(amount),
5229
- assetId: assetIdToTransfer
5220
+ assetId
5230
5221
  });
5231
5222
  const request = new ScriptTransactionRequest({
5232
5223
  ...params,
@@ -5236,7 +5227,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5236
5227
  request.addContractInputAndOutput(contractAddress);
5237
5228
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5238
5229
  request,
5239
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetIdToTransfer) }]
5230
+ [{ amount: (0, import_math18.bn)(amount), assetId: String(assetId) }]
5240
5231
  );
5241
5232
  request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
5242
5233
  this.validateGas({
@@ -5258,7 +5249,6 @@ var Account = class extends import_interfaces.AbstractAccount {
5258
5249
  */
5259
5250
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5260
5251
  const { minGasPrice } = this.provider.getGasConfig();
5261
- const baseAssetId = this.provider.getBaseAssetId();
5262
5252
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5263
5253
  const recipientDataArray = (0, import_utils28.arrayify)(
5264
5254
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -5271,13 +5261,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5271
5261
  ...recipientDataArray,
5272
5262
  ...amountDataArray
5273
5263
  ]);
5274
- const params = {
5275
- script,
5276
- gasPrice: minGasPrice,
5277
- ...txParams
5278
- };
5264
+ const params = { script, gasPrice: minGasPrice, ...txParams };
5279
5265
  const request = new ScriptTransactionRequest(params);
5280
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: baseAssetId }];
5266
+ const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: import_configs12.BaseAssetId }];
5281
5267
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5282
5268
  request,
5283
5269
  forwardingQuantities
@@ -8840,6 +8826,7 @@ var StorageAbstract = class {
8840
8826
  // src/predicate/predicate.ts
8841
8827
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
8842
8828
  var import_address10 = require("@fuel-ts/address");
8829
+ var import_configs13 = require("@fuel-ts/address/configs");
8843
8830
  var import_errors25 = require("@fuel-ts/errors");
8844
8831
  var import_transactions20 = require("@fuel-ts/transactions");
8845
8832
  var import_utils37 = require("@fuel-ts/utils");
@@ -8917,9 +8904,8 @@ var Predicate = class extends Account {
8917
8904
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8918
8905
  * @returns A promise that resolves to the prepared transaction request.
8919
8906
  */
8920
- async createTransfer(destination, amount, assetId, txParams = {}) {
8921
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
8922
- const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
8907
+ async createTransfer(destination, amount, assetId = import_configs13.BaseAssetId, txParams = {}) {
8908
+ const request = await super.createTransfer(destination, amount, assetId, txParams);
8923
8909
  return this.populateTransactionPredicateData(request);
8924
8910
  }
8925
8911
  /**