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

@@ -62,12 +62,14 @@ var import_utils31 = require("@fuel-ts/utils");
62
62
 
63
63
  // src/account.ts
64
64
  var import_address4 = require("@fuel-ts/address");
65
+ var import_configs12 = require("@fuel-ts/address/configs");
65
66
  var import_errors16 = require("@fuel-ts/errors");
66
67
  var import_interfaces = require("@fuel-ts/interfaces");
67
68
  var import_math18 = require("@fuel-ts/math");
68
69
  var import_utils28 = require("@fuel-ts/utils");
69
70
 
70
71
  // src/providers/coin-quantity.ts
72
+ var import_configs = require("@fuel-ts/address/configs");
71
73
  var import_math = require("@fuel-ts/math");
72
74
  var import_utils = require("@fuel-ts/utils");
73
75
  var coinQuantityfy = (coinQuantityLike) => {
@@ -76,11 +78,11 @@ var coinQuantityfy = (coinQuantityLike) => {
76
78
  let max2;
77
79
  if (Array.isArray(coinQuantityLike)) {
78
80
  amount = coinQuantityLike[0];
79
- assetId = coinQuantityLike[1];
80
- max2 = coinQuantityLike[2];
81
+ assetId = coinQuantityLike[1] ?? import_configs.BaseAssetId;
82
+ max2 = coinQuantityLike[2] ?? void 0;
81
83
  } else {
82
84
  amount = coinQuantityLike.amount;
83
- assetId = coinQuantityLike.assetId;
85
+ assetId = coinQuantityLike.assetId ?? import_configs.BaseAssetId;
84
86
  max2 = coinQuantityLike.max ?? void 0;
85
87
  }
86
88
  const bnAmount = (0, import_math.bn)(amount);
@@ -1059,7 +1061,7 @@ var MemoryCache = class {
1059
1061
 
1060
1062
  // src/providers/transaction-request/input.ts
1061
1063
  var import_abi_coder = require("@fuel-ts/abi-coder");
1062
- var import_configs = require("@fuel-ts/address/configs");
1064
+ var import_configs2 = require("@fuel-ts/address/configs");
1063
1065
  var import_errors3 = require("@fuel-ts/errors");
1064
1066
  var import_math2 = require("@fuel-ts/math");
1065
1067
  var import_transactions = require("@fuel-ts/transactions");
@@ -1093,10 +1095,10 @@ var inputify = (value) => {
1093
1095
  case import_transactions.InputType.Contract: {
1094
1096
  return {
1095
1097
  type: import_transactions.InputType.Contract,
1096
- txID: import_configs.ZeroBytes32,
1098
+ txID: import_configs2.ZeroBytes32,
1097
1099
  outputIndex: 0,
1098
- balanceRoot: import_configs.ZeroBytes32,
1099
- stateRoot: import_configs.ZeroBytes32,
1100
+ balanceRoot: import_configs2.ZeroBytes32,
1101
+ stateRoot: import_configs2.ZeroBytes32,
1100
1102
  txPointer: {
1101
1103
  blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1102
1104
  txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
@@ -1134,7 +1136,7 @@ var inputify = (value) => {
1134
1136
  };
1135
1137
 
1136
1138
  // src/providers/transaction-request/output.ts
1137
- var import_configs2 = require("@fuel-ts/address/configs");
1139
+ var import_configs3 = require("@fuel-ts/address/configs");
1138
1140
  var import_errors4 = require("@fuel-ts/errors");
1139
1141
  var import_math3 = require("@fuel-ts/math");
1140
1142
  var import_transactions2 = require("@fuel-ts/transactions");
@@ -1154,8 +1156,8 @@ var outputify = (value) => {
1154
1156
  return {
1155
1157
  type: import_transactions2.OutputType.Contract,
1156
1158
  inputIndex: value.inputIndex,
1157
- balanceRoot: import_configs2.ZeroBytes32,
1158
- stateRoot: import_configs2.ZeroBytes32
1159
+ balanceRoot: import_configs3.ZeroBytes32,
1160
+ stateRoot: import_configs3.ZeroBytes32
1159
1161
  };
1160
1162
  }
1161
1163
  case import_transactions2.OutputType.Change: {
@@ -1169,9 +1171,9 @@ var outputify = (value) => {
1169
1171
  case import_transactions2.OutputType.Variable: {
1170
1172
  return {
1171
1173
  type: import_transactions2.OutputType.Variable,
1172
- to: import_configs2.ZeroBytes32,
1174
+ to: import_configs3.ZeroBytes32,
1173
1175
  amount: (0, import_math3.bn)(0),
1174
- assetId: import_configs2.ZeroBytes32
1176
+ assetId: import_configs3.ZeroBytes32
1175
1177
  };
1176
1178
  }
1177
1179
  case import_transactions2.OutputType.ContractCreated: {
@@ -1193,7 +1195,7 @@ var outputify = (value) => {
1193
1195
  // src/providers/transaction-request/transaction-request.ts
1194
1196
  var import_abi_coder2 = require("@fuel-ts/abi-coder");
1195
1197
  var import_address = require("@fuel-ts/address");
1196
- var import_configs6 = require("@fuel-ts/address/configs");
1198
+ var import_configs7 = require("@fuel-ts/address/configs");
1197
1199
  var import_crypto = require("@fuel-ts/crypto");
1198
1200
  var import_math7 = require("@fuel-ts/math");
1199
1201
  var import_transactions6 = require("@fuel-ts/transactions");
@@ -1203,13 +1205,13 @@ var import_utils9 = require("@fuel-ts/utils");
1203
1205
  var isCoin = (resource) => "id" in resource;
1204
1206
 
1205
1207
  // src/providers/utils/receipts.ts
1206
- var import_configs3 = require("@fuel-ts/address/configs");
1208
+ var import_configs4 = require("@fuel-ts/address/configs");
1207
1209
  var import_errors5 = require("@fuel-ts/errors");
1208
1210
  var import_math4 = require("@fuel-ts/math");
1209
1211
  var import_transactions3 = require("@fuel-ts/transactions");
1210
- var import_configs4 = require("@fuel-ts/transactions/configs");
1212
+ var import_configs5 = require("@fuel-ts/transactions/configs");
1211
1213
  var import_utils5 = require("@fuel-ts/utils");
1212
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1214
+ var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1213
1215
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions3.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1214
1216
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1215
1217
  (memo, receipt) => {
@@ -1226,7 +1228,7 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1226
1228
  missingOutputContractIds: []
1227
1229
  }
1228
1230
  );
1229
- var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
1231
+ var hexOrZero = (hex) => hex || import_configs4.ZeroBytes32;
1230
1232
  function assembleReceiptByType(receipt) {
1231
1233
  const { receiptType } = receipt;
1232
1234
  switch (receiptType) {
@@ -1531,16 +1533,16 @@ function sleep(time) {
1531
1533
  var import_errors7 = require("@fuel-ts/errors");
1532
1534
  var import_math6 = require("@fuel-ts/math");
1533
1535
  var import_transactions5 = require("@fuel-ts/transactions");
1534
- var import_configs5 = require("@fuel-ts/transactions/configs");
1536
+ var import_configs6 = require("@fuel-ts/transactions/configs");
1535
1537
  var assemblePanicError = (status) => {
1536
1538
  let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1537
1539
  const reason = status.reason;
1538
- if (import_configs5.PANIC_REASONS.includes(status.reason)) {
1540
+ if (import_configs6.PANIC_REASONS.includes(status.reason)) {
1539
1541
  errorMessage = `${errorMessage}
1540
1542
 
1541
1543
  You can read more about this error at:
1542
1544
 
1543
- ${import_configs5.PANIC_DOC_URL}#variant.${status.reason}`;
1545
+ ${import_configs6.PANIC_DOC_URL}#variant.${status.reason}`;
1544
1546
  }
1545
1547
  return { errorMessage, reason };
1546
1548
  };
@@ -1552,28 +1554,28 @@ var assembleRevertError = (receipts, logs) => {
1552
1554
  if (revertReceipt) {
1553
1555
  const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
1554
1556
  switch (reasonHex) {
1555
- case import_configs5.FAILED_REQUIRE_SIGNAL: {
1557
+ case import_configs6.FAILED_REQUIRE_SIGNAL: {
1556
1558
  reason = "require";
1557
1559
  errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1558
1560
  break;
1559
1561
  }
1560
- case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
1562
+ case import_configs6.FAILED_ASSERT_EQ_SIGNAL: {
1561
1563
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1562
1564
  reason = "assert_eq";
1563
1565
  errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1564
1566
  break;
1565
1567
  }
1566
- case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
1568
+ case import_configs6.FAILED_ASSERT_NE_SIGNAL: {
1567
1569
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1568
1570
  reason = "assert_ne";
1569
1571
  errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1570
1572
  break;
1571
1573
  }
1572
- case import_configs5.FAILED_ASSERT_SIGNAL:
1574
+ case import_configs6.FAILED_ASSERT_SIGNAL:
1573
1575
  reason = "assert";
1574
1576
  errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1575
1577
  break;
1576
- case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1578
+ case import_configs6.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1577
1579
  reason = "MissingOutputChange";
1578
1580
  errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1579
1581
  break;
@@ -1748,7 +1750,7 @@ var BaseTransactionRequest = class {
1748
1750
  * @returns The index of the created witness.
1749
1751
  */
1750
1752
  addEmptyWitness() {
1751
- this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1753
+ this.addWitness((0, import_utils9.concat)([import_configs7.ZeroBytes32, import_configs7.ZeroBytes32]));
1752
1754
  return this.witnesses.length - 1;
1753
1755
  }
1754
1756
  /**
@@ -1875,13 +1877,15 @@ var BaseTransactionRequest = class {
1875
1877
  }
1876
1878
  /**
1877
1879
  * Adds a single message input to the transaction and a change output for the
1878
- * asset against the message
1880
+ * baseAssetId, if one it was not added yet.
1879
1881
  *
1880
1882
  * @param message - Message resource.
1881
1883
  * @param predicate - Predicate bytes.
1884
+ * @param predicateData - Predicate data bytes.
1882
1885
  */
1883
1886
  addMessageInput(message, predicate) {
1884
- const { recipient, sender, amount, assetId } = message;
1887
+ const { recipient, sender, amount } = message;
1888
+ const assetId = import_configs7.BaseAssetId;
1885
1889
  let witnessIndex;
1886
1890
  if (predicate) {
1887
1891
  witnessIndex = 0;
@@ -1962,7 +1966,7 @@ var BaseTransactionRequest = class {
1962
1966
  * @param amount - Amount of coin.
1963
1967
  * @param assetId - Asset ID of coin.
1964
1968
  */
1965
- addCoinOutput(to, amount, assetId) {
1969
+ addCoinOutput(to, amount, assetId = import_configs7.BaseAssetId) {
1966
1970
  this.pushOutput({
1967
1971
  type: import_transactions6.OutputType.Coin,
1968
1972
  to: (0, import_address.addressify)(to).toB256(),
@@ -1994,7 +1998,7 @@ var BaseTransactionRequest = class {
1994
1998
  * @param to - Address of the owner.
1995
1999
  * @param assetId - Asset ID of coin.
1996
2000
  */
1997
- addChangeOutput(to, assetId) {
2001
+ addChangeOutput(to, assetId = import_configs7.BaseAssetId) {
1998
2002
  const changeOutput = this.getChangeOutputs().find(
1999
2003
  (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
2000
2004
  );
@@ -2051,9 +2055,8 @@ var BaseTransactionRequest = class {
2051
2055
  * quantities array.
2052
2056
  *
2053
2057
  * @param quantities - CoinQuantity Array.
2054
- * @param baseAssetId - The base asset to fund the transaction.
2055
2058
  */
2056
- fundWithFakeUtxos(quantities, baseAssetId, resourcesOwner) {
2059
+ fundWithFakeUtxos(quantities, resourcesOwner) {
2057
2060
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2058
2061
  if ("assetId" in input) {
2059
2062
  return input.assetId === assetId;
@@ -2079,7 +2082,7 @@ var BaseTransactionRequest = class {
2079
2082
  ]);
2080
2083
  }
2081
2084
  };
2082
- updateAssetInput(baseAssetId, (0, import_math7.bn)(1e11));
2085
+ updateAssetInput(import_configs7.BaseAssetId, (0, import_math7.bn)(1e11));
2083
2086
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2084
2087
  }
2085
2088
  /**
@@ -2129,13 +2132,13 @@ var BaseTransactionRequest = class {
2129
2132
  };
2130
2133
 
2131
2134
  // src/providers/transaction-request/create-transaction-request.ts
2132
- var import_configs8 = require("@fuel-ts/address/configs");
2135
+ var import_configs9 = require("@fuel-ts/address/configs");
2133
2136
  var import_math9 = require("@fuel-ts/math");
2134
2137
  var import_transactions8 = require("@fuel-ts/transactions");
2135
2138
  var import_utils13 = require("@fuel-ts/utils");
2136
2139
 
2137
2140
  // src/providers/transaction-request/hash-transaction.ts
2138
- var import_configs7 = require("@fuel-ts/address/configs");
2141
+ var import_configs8 = require("@fuel-ts/address/configs");
2139
2142
  var import_hasher = require("@fuel-ts/hasher");
2140
2143
  var import_math8 = require("@fuel-ts/math");
2141
2144
  var import_transactions7 = require("@fuel-ts/transactions");
@@ -2144,7 +2147,7 @@ var import_ramda2 = require("ramda");
2144
2147
  function hashTransaction(transactionRequest, chainId) {
2145
2148
  const transaction = transactionRequest.toTransaction();
2146
2149
  if (transaction.type === import_transactions7.TransactionType.Script) {
2147
- transaction.receiptsRoot = import_configs7.ZeroBytes32;
2150
+ transaction.receiptsRoot = import_configs8.ZeroBytes32;
2148
2151
  }
2149
2152
  transaction.inputs = transaction.inputs.map((input) => {
2150
2153
  const inputClone = (0, import_ramda2.clone)(input);
@@ -2166,10 +2169,10 @@ function hashTransaction(transactionRequest, chainId) {
2166
2169
  blockHeight: 0,
2167
2170
  txIndex: 0
2168
2171
  };
2169
- inputClone.txID = import_configs7.ZeroBytes32;
2172
+ inputClone.txID = import_configs8.ZeroBytes32;
2170
2173
  inputClone.outputIndex = 0;
2171
- inputClone.balanceRoot = import_configs7.ZeroBytes32;
2172
- inputClone.stateRoot = import_configs7.ZeroBytes32;
2174
+ inputClone.balanceRoot = import_configs8.ZeroBytes32;
2175
+ inputClone.stateRoot = import_configs8.ZeroBytes32;
2173
2176
  return inputClone;
2174
2177
  }
2175
2178
  default:
@@ -2180,8 +2183,8 @@ function hashTransaction(transactionRequest, chainId) {
2180
2183
  const outputClone = (0, import_ramda2.clone)(output);
2181
2184
  switch (outputClone.type) {
2182
2185
  case import_transactions7.OutputType.Contract: {
2183
- outputClone.balanceRoot = import_configs7.ZeroBytes32;
2184
- outputClone.stateRoot = import_configs7.ZeroBytes32;
2186
+ outputClone.balanceRoot = import_configs8.ZeroBytes32;
2187
+ outputClone.stateRoot = import_configs8.ZeroBytes32;
2185
2188
  return outputClone;
2186
2189
  }
2187
2190
  case import_transactions7.OutputType.Change: {
@@ -2189,9 +2192,9 @@ function hashTransaction(transactionRequest, chainId) {
2189
2192
  return outputClone;
2190
2193
  }
2191
2194
  case import_transactions7.OutputType.Variable: {
2192
- outputClone.to = import_configs7.ZeroBytes32;
2195
+ outputClone.to = import_configs8.ZeroBytes32;
2193
2196
  outputClone.amount = (0, import_math8.bn)(0);
2194
- outputClone.assetId = import_configs7.ZeroBytes32;
2197
+ outputClone.assetId = import_configs8.ZeroBytes32;
2195
2198
  return outputClone;
2196
2199
  }
2197
2200
  default:
@@ -2249,10 +2252,15 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2249
2252
  *
2250
2253
  * @param createTransactionRequestLike - The initial values for the instance
2251
2254
  */
2252
- constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2255
+ constructor({
2256
+ bytecodeWitnessIndex,
2257
+ salt,
2258
+ storageSlots,
2259
+ ...rest
2260
+ } = {}) {
2253
2261
  super(rest);
2254
2262
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2255
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2263
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs9.ZeroBytes32);
2256
2264
  this.storageSlots = [...storageSlots ?? []];
2257
2265
  }
2258
2266
  /**
@@ -2270,7 +2278,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2270
2278
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2271
2279
  bytecodeWitnessIndex,
2272
2280
  storageSlotsCount: storageSlots.length,
2273
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2281
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs9.ZeroBytes32,
2274
2282
  storageSlots
2275
2283
  };
2276
2284
  }
@@ -2320,7 +2328,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2320
2328
  // src/providers/transaction-request/script-transaction-request.ts
2321
2329
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
2322
2330
  var import_address2 = require("@fuel-ts/address");
2323
- var import_configs9 = require("@fuel-ts/address/configs");
2331
+ var import_configs10 = require("@fuel-ts/address/configs");
2324
2332
  var import_math10 = require("@fuel-ts/math");
2325
2333
  var import_transactions9 = require("@fuel-ts/transactions");
2326
2334
  var import_utils15 = require("@fuel-ts/utils");
@@ -2394,7 +2402,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2394
2402
  ...super.getBaseTransaction(),
2395
2403
  scriptLength: script.length,
2396
2404
  scriptDataLength: scriptData.length,
2397
- receiptsRoot: import_configs9.ZeroBytes32,
2405
+ receiptsRoot: import_configs10.ZeroBytes32,
2398
2406
  script: (0, import_utils15.hexlify)(script),
2399
2407
  scriptData: (0, import_utils15.hexlify)(scriptData)
2400
2408
  };
@@ -2626,7 +2634,7 @@ var calculateTransactionFee = (params) => {
2626
2634
  };
2627
2635
 
2628
2636
  // src/providers/transaction-summary/operations.ts
2629
- var import_configs10 = require("@fuel-ts/address/configs");
2637
+ var import_configs11 = require("@fuel-ts/address/configs");
2630
2638
  var import_errors11 = require("@fuel-ts/errors");
2631
2639
  var import_math13 = require("@fuel-ts/math");
2632
2640
  var import_transactions14 = require("@fuel-ts/transactions");
@@ -2924,7 +2932,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
2924
2932
  const { to: toAddress, assetId, amount } = receipt;
2925
2933
  let { from: fromAddress } = receipt;
2926
2934
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
2927
- if (import_configs10.ZeroBytes32 === fromAddress) {
2935
+ if (import_configs11.ZeroBytes32 === fromAddress) {
2928
2936
  const change = changeOutputs.find((output) => output.assetId === assetId);
2929
2937
  fromAddress = change?.to || fromAddress;
2930
2938
  }
@@ -3463,7 +3471,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
3463
3471
  }
3464
3472
 
3465
3473
  // src/providers/utils/merge-quantities.ts
3466
- var mergeQuantities = (...coinQuantities) => {
3474
+ var mergeQuantities = (arr1, arr2) => {
3467
3475
  const resultMap = {};
3468
3476
  function addToMap({ amount, assetId }) {
3469
3477
  if (resultMap[assetId]) {
@@ -3472,7 +3480,8 @@ var mergeQuantities = (...coinQuantities) => {
3472
3480
  resultMap[assetId] = amount;
3473
3481
  }
3474
3482
  }
3475
- coinQuantities.forEach((arr) => arr.forEach(addToMap));
3483
+ arr1.forEach(addToMap);
3484
+ arr2.forEach(addToMap);
3476
3485
  return Object.entries(resultMap).map(([assetId, amount]) => ({ assetId, amount }));
3477
3486
  };
3478
3487
 
@@ -3500,7 +3509,6 @@ var processGqlChain = (chain) => {
3500
3509
  gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3501
3510
  maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3502
3511
  chainId: (0, import_math15.bn)(consensusParameters.chainId),
3503
- baseAssetId: consensusParameters.baseAssetId,
3504
3512
  gasCosts
3505
3513
  },
3506
3514
  gasCosts,
@@ -3743,17 +3751,6 @@ var _Provider = class {
3743
3751
  } = this.getChain();
3744
3752
  return chainId.toNumber();
3745
3753
  }
3746
- /**
3747
- * Returns the base asset ID
3748
- *
3749
- * @returns A promise that resolves to the base asset ID
3750
- */
3751
- getBaseAssetId() {
3752
- const {
3753
- consensusParameters: { baseAssetId }
3754
- } = this.getChain();
3755
- return baseAssetId;
3756
- }
3757
3754
  /**
3758
3755
  * Submits a transaction to the chain to be executed.
3759
3756
  *
@@ -3984,10 +3981,9 @@ var _Provider = class {
3984
3981
  const { minGasPrice } = this.getGasConfig();
3985
3982
  const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3986
3983
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
3987
- const baseAssetId = this.getBaseAssetId();
3988
3984
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3989
3985
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3990
- txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
3986
+ txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3991
3987
  if (isScriptTransaction) {
3992
3988
  txRequestClone.gasLimit = (0, import_math15.bn)(0);
3993
3989
  }
@@ -4652,9 +4648,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4652
4648
  * @param assetId - The asset ID to check the balance for.
4653
4649
  * @returns A promise that resolves to the balance amount.
4654
4650
  */
4655
- async getBalance(assetId) {
4656
- const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
4657
- const amount = await this.provider.getBalance(this.address, assetIdToFetch);
4651
+ async getBalance(assetId = import_configs12.BaseAssetId) {
4652
+ const amount = await this.provider.getBalance(this.address, assetId);
4658
4653
  return amount;
4659
4654
  }
4660
4655
  /**
@@ -4692,10 +4687,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4692
4687
  * @returns A promise that resolves when the resources are added to the transaction.
4693
4688
  */
4694
4689
  async fund(request, coinQuantities, fee) {
4695
- const baseAssetId = this.provider.getBaseAssetId();
4696
4690
  const updatedQuantities = addAmountToAsset({
4697
4691
  amount: (0, import_math18.bn)(fee),
4698
- assetId: baseAssetId,
4692
+ assetId: import_configs12.BaseAssetId,
4699
4693
  coinQuantities
4700
4694
  });
4701
4695
  const quantitiesDict = {};
@@ -4719,8 +4713,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4719
4713
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4720
4714
  cachedUtxos.push(input.id);
4721
4715
  }
4722
- } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
4723
- quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
4716
+ } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs12.BaseAssetId]) {
4717
+ quantitiesDict[import_configs12.BaseAssetId].owned = quantitiesDict[import_configs12.BaseAssetId].owned.add(input.amount);
4724
4718
  cachedMessages.push(input.nonce);
4725
4719
  }
4726
4720
  }
@@ -4752,12 +4746,11 @@ var Account = class extends import_interfaces.AbstractAccount {
4752
4746
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4753
4747
  * @returns A promise that resolves to the prepared transaction request.
4754
4748
  */
4755
- async createTransfer(destination, amount, assetId, txParams = {}) {
4749
+ async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4756
4750
  const { minGasPrice } = this.provider.getGasConfig();
4757
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4758
4751
  const params = { gasPrice: minGasPrice, ...txParams };
4759
4752
  const request = new ScriptTransactionRequest(params);
4760
- request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetIdToTransfer);
4753
+ request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
4761
4754
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
4762
4755
  estimateTxDependencies: true,
4763
4756
  resourcesOwner: this
@@ -4783,15 +4776,14 @@ var Account = class extends import_interfaces.AbstractAccount {
4783
4776
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4784
4777
  * @returns A promise that resolves to the transaction response.
4785
4778
  */
4786
- async transfer(destination, amount, assetId, txParams = {}) {
4779
+ async transfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4787
4780
  if ((0, import_math18.bn)(amount).lte(0)) {
4788
4781
  throw new import_errors16.FuelError(
4789
4782
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
4790
4783
  "Transfer amount must be a positive number."
4791
4784
  );
4792
4785
  }
4793
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4794
- const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
4786
+ const request = await this.createTransfer(destination, amount, assetId, txParams);
4795
4787
  return this.sendTransaction(request, { estimateTxDependencies: false });
4796
4788
  }
4797
4789
  /**
@@ -4803,7 +4795,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4803
4795
  * @param txParams - The optional transaction parameters.
4804
4796
  * @returns A promise that resolves to the transaction response.
4805
4797
  */
4806
- async transferToContract(contractId, amount, assetId, txParams = {}) {
4798
+ async transferToContract(contractId, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4807
4799
  if ((0, import_math18.bn)(amount).lte(0)) {
4808
4800
  throw new import_errors16.FuelError(
4809
4801
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -4812,12 +4804,11 @@ var Account = class extends import_interfaces.AbstractAccount {
4812
4804
  }
4813
4805
  const contractAddress = import_address4.Address.fromAddressOrString(contractId);
4814
4806
  const { minGasPrice } = this.provider.getGasConfig();
4815
- const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4816
4807
  const params = { gasPrice: minGasPrice, ...txParams };
4817
4808
  const { script, scriptData } = await assembleTransferToContractScript({
4818
4809
  hexlifiedContractId: contractAddress.toB256(),
4819
4810
  amountToTransfer: (0, import_math18.bn)(amount),
4820
- assetId: assetIdToTransfer
4811
+ assetId
4821
4812
  });
4822
4813
  const request = new ScriptTransactionRequest({
4823
4814
  ...params,
@@ -4827,7 +4818,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4827
4818
  request.addContractInputAndOutput(contractAddress);
4828
4819
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4829
4820
  request,
4830
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetIdToTransfer) }]
4821
+ [{ amount: (0, import_math18.bn)(amount), assetId: String(assetId) }]
4831
4822
  );
4832
4823
  request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
4833
4824
  this.validateGas({
@@ -4849,7 +4840,6 @@ var Account = class extends import_interfaces.AbstractAccount {
4849
4840
  */
4850
4841
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
4851
4842
  const { minGasPrice } = this.provider.getGasConfig();
4852
- const baseAssetId = this.provider.getBaseAssetId();
4853
4843
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
4854
4844
  const recipientDataArray = (0, import_utils28.arrayify)(
4855
4845
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -4862,13 +4852,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4862
4852
  ...recipientDataArray,
4863
4853
  ...amountDataArray
4864
4854
  ]);
4865
- const params = {
4866
- script,
4867
- gasPrice: minGasPrice,
4868
- ...txParams
4869
- };
4855
+ const params = { script, gasPrice: minGasPrice, ...txParams };
4870
4856
  const request = new ScriptTransactionRequest(params);
4871
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: baseAssetId }];
4857
+ const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: import_configs12.BaseAssetId }];
4872
4858
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
4873
4859
  request,
4874
4860
  forwardingQuantities
@@ -8032,7 +8018,7 @@ var generateTestWallet = async (provider, quantities) => {
8032
8018
  };
8033
8019
 
8034
8020
  // src/test-utils/launchNode.ts
8035
- var import_configs11 = require("@fuel-ts/address/configs");
8021
+ var import_configs13 = require("@fuel-ts/address/configs");
8036
8022
  var import_math21 = require("@fuel-ts/math");
8037
8023
  var import_utils36 = require("@fuel-ts/utils");
8038
8024
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
@@ -8078,6 +8064,7 @@ var launchNode = async ({
8078
8064
  ip,
8079
8065
  port,
8080
8066
  args = [],
8067
+ fuelCorePath = void 0,
8081
8068
  useSystemFuelCore = false,
8082
8069
  loggingEnabled = true,
8083
8070
  debugEnabled = false,
@@ -8098,7 +8085,7 @@ var launchNode = async ({
8098
8085
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
8099
8086
  const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
8100
8087
  const graphQLStartSubstring = "Binding GraphQL provider to";
8101
- const binPath = (0, import_cli_utils.findBinPath)("fuels-core", __dirname);
8088
+ const binPath = fuelCorePath ?? (0, import_cli_utils.findBinPath)("fuels-core", __dirname);
8102
8089
  const command = useSystemFuelCore ? "fuel-core" : binPath;
8103
8090
  const ipToUse = ip || "0.0.0.0";
8104
8091
  const portToUse = port || (await (0, import_portfinder.getPortPromise)({
@@ -8132,7 +8119,7 @@ var launchNode = async ({
8132
8119
  {
8133
8120
  owner: signer.address.toHexString(),
8134
8121
  amount: (0, import_math21.toHex)(1e9),
8135
- asset_id: import_utils36.defaultChainConfig?.consensus_parameters?.base_asset_id ?? import_configs11.ZeroBytes32
8122
+ asset_id: import_configs13.BaseAssetId
8136
8123
  }
8137
8124
  ]
8138
8125
  }
@@ -8198,10 +8185,9 @@ var launchNode = async ({
8198
8185
  })
8199
8186
  );
8200
8187
  var generateWallets = async (count, provider) => {
8201
- const baseAssetId = provider.getBaseAssetId();
8202
8188
  const wallets = [];
8203
8189
  for (let i = 0; i < count; i += 1) {
8204
- const wallet = await generateTestWallet(provider, [[1e3, baseAssetId]]);
8190
+ const wallet = await generateTestWallet(provider, [[1e3, import_configs13.BaseAssetId]]);
8205
8191
  wallets.push(wallet);
8206
8192
  }
8207
8193
  return wallets;