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

package/dist/index.js CHANGED
@@ -184,14 +184,12 @@ 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");
188
187
  var import_errors16 = require("@fuel-ts/errors");
189
188
  var import_interfaces = require("@fuel-ts/interfaces");
190
189
  var import_math18 = require("@fuel-ts/math");
191
190
  var import_utils28 = require("@fuel-ts/utils");
192
191
 
193
192
  // src/providers/coin-quantity.ts
194
- var import_configs = require("@fuel-ts/address/configs");
195
193
  var import_math = require("@fuel-ts/math");
196
194
  var import_utils = require("@fuel-ts/utils");
197
195
  var coinQuantityfy = (coinQuantityLike) => {
@@ -200,11 +198,11 @@ var coinQuantityfy = (coinQuantityLike) => {
200
198
  let max2;
201
199
  if (Array.isArray(coinQuantityLike)) {
202
200
  amount = coinQuantityLike[0];
203
- assetId = coinQuantityLike[1] ?? import_configs.BaseAssetId;
204
- max2 = coinQuantityLike[2] ?? void 0;
201
+ assetId = coinQuantityLike[1];
202
+ max2 = coinQuantityLike[2];
205
203
  } else {
206
204
  amount = coinQuantityLike.amount;
207
- assetId = coinQuantityLike.assetId ?? import_configs.BaseAssetId;
205
+ assetId = coinQuantityLike.assetId;
208
206
  max2 = coinQuantityLike.max ?? void 0;
209
207
  }
210
208
  const bnAmount = (0, import_math.bn)(amount);
@@ -234,7 +232,7 @@ var import_transactions18 = require("@fuel-ts/transactions");
234
232
  var import_utils23 = require("@fuel-ts/utils");
235
233
  var import_versions = require("@fuel-ts/versions");
236
234
  var import_utils24 = require("@noble/curves/abstract/utils");
237
- var import_ethers2 = require("ethers");
235
+ var import_ethers = require("ethers");
238
236
  var import_graphql_request = require("graphql-request");
239
237
  var import_ramda3 = require("ramda");
240
238
 
@@ -1173,7 +1171,7 @@ var MemoryCache = class {
1173
1171
  };
1174
1172
 
1175
1173
  // src/providers/transaction-request/input.ts
1176
- var import_configs2 = require("@fuel-ts/address/configs");
1174
+ var import_configs = require("@fuel-ts/address/configs");
1177
1175
  var import_errors3 = require("@fuel-ts/errors");
1178
1176
  var import_math2 = require("@fuel-ts/math");
1179
1177
  var import_transactions = require("@fuel-ts/transactions");
@@ -1187,7 +1185,7 @@ var inputify = (value) => {
1187
1185
  return {
1188
1186
  type: import_transactions.InputType.Coin,
1189
1187
  txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
1190
- outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(32, 33)),
1188
+ outputIndex: (0, import_utils3.arrayify)(value.id)[32],
1191
1189
  owner: (0, import_utils3.hexlify)(value.owner),
1192
1190
  amount: (0, import_math2.bn)(value.amount),
1193
1191
  assetId: (0, import_utils3.hexlify)(value.assetId),
@@ -1207,10 +1205,10 @@ var inputify = (value) => {
1207
1205
  case import_transactions.InputType.Contract: {
1208
1206
  return {
1209
1207
  type: import_transactions.InputType.Contract,
1210
- txID: import_configs2.ZeroBytes32,
1208
+ txID: import_configs.ZeroBytes32,
1211
1209
  outputIndex: 0,
1212
- balanceRoot: import_configs2.ZeroBytes32,
1213
- stateRoot: import_configs2.ZeroBytes32,
1210
+ balanceRoot: import_configs.ZeroBytes32,
1211
+ stateRoot: import_configs.ZeroBytes32,
1214
1212
  txPointer: {
1215
1213
  blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1216
1214
  txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
@@ -1248,7 +1246,7 @@ var inputify = (value) => {
1248
1246
  };
1249
1247
 
1250
1248
  // src/providers/transaction-request/output.ts
1251
- var import_configs3 = require("@fuel-ts/address/configs");
1249
+ var import_configs2 = require("@fuel-ts/address/configs");
1252
1250
  var import_errors4 = require("@fuel-ts/errors");
1253
1251
  var import_math3 = require("@fuel-ts/math");
1254
1252
  var import_transactions2 = require("@fuel-ts/transactions");
@@ -1268,8 +1266,8 @@ var outputify = (value) => {
1268
1266
  return {
1269
1267
  type: import_transactions2.OutputType.Contract,
1270
1268
  inputIndex: value.inputIndex,
1271
- balanceRoot: import_configs3.ZeroBytes32,
1272
- stateRoot: import_configs3.ZeroBytes32
1269
+ balanceRoot: import_configs2.ZeroBytes32,
1270
+ stateRoot: import_configs2.ZeroBytes32
1273
1271
  };
1274
1272
  }
1275
1273
  case import_transactions2.OutputType.Change: {
@@ -1283,9 +1281,9 @@ var outputify = (value) => {
1283
1281
  case import_transactions2.OutputType.Variable: {
1284
1282
  return {
1285
1283
  type: import_transactions2.OutputType.Variable,
1286
- to: import_configs3.ZeroBytes32,
1284
+ to: import_configs2.ZeroBytes32,
1287
1285
  amount: (0, import_math3.bn)(0),
1288
- assetId: import_configs3.ZeroBytes32
1286
+ assetId: import_configs2.ZeroBytes32
1289
1287
  };
1290
1288
  }
1291
1289
  case import_transactions2.OutputType.ContractCreated: {
@@ -1306,11 +1304,10 @@ var outputify = (value) => {
1306
1304
 
1307
1305
  // src/providers/transaction-request/transaction-request.ts
1308
1306
  var import_address = require("@fuel-ts/address");
1309
- var import_configs7 = require("@fuel-ts/address/configs");
1307
+ var import_configs6 = require("@fuel-ts/address/configs");
1310
1308
  var import_math7 = require("@fuel-ts/math");
1311
1309
  var import_transactions6 = require("@fuel-ts/transactions");
1312
1310
  var import_utils9 = require("@fuel-ts/utils");
1313
- var import_ethers = require("ethers");
1314
1311
 
1315
1312
  // src/providers/resource.ts
1316
1313
  var isRawCoin = (resource) => "utxoId" in resource;
@@ -1319,13 +1316,13 @@ var isCoin = (resource) => "id" in resource;
1319
1316
  var isMessage = (resource) => "recipient" in resource;
1320
1317
 
1321
1318
  // src/providers/utils/receipts.ts
1322
- var import_configs4 = require("@fuel-ts/address/configs");
1319
+ var import_configs3 = require("@fuel-ts/address/configs");
1323
1320
  var import_errors5 = require("@fuel-ts/errors");
1324
1321
  var import_math4 = require("@fuel-ts/math");
1325
1322
  var import_transactions3 = require("@fuel-ts/transactions");
1326
- var import_configs5 = require("@fuel-ts/transactions/configs");
1323
+ var import_configs4 = require("@fuel-ts/transactions/configs");
1327
1324
  var import_utils5 = require("@fuel-ts/utils");
1328
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1325
+ var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1329
1326
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions3.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1330
1327
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1331
1328
  (memo, receipt) => {
@@ -1342,7 +1339,7 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1342
1339
  missingOutputContractIds: []
1343
1340
  }
1344
1341
  );
1345
- var hexOrZero = (hex) => hex || import_configs4.ZeroBytes32;
1342
+ var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
1346
1343
  function assembleReceiptByType(receipt) {
1347
1344
  const { receiptType } = receipt;
1348
1345
  switch (receiptType) {
@@ -1706,16 +1703,16 @@ function sleep(time) {
1706
1703
  var import_errors7 = require("@fuel-ts/errors");
1707
1704
  var import_math6 = require("@fuel-ts/math");
1708
1705
  var import_transactions5 = require("@fuel-ts/transactions");
1709
- var import_configs6 = require("@fuel-ts/transactions/configs");
1706
+ var import_configs5 = require("@fuel-ts/transactions/configs");
1710
1707
  var assemblePanicError = (status) => {
1711
1708
  let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1712
1709
  const reason = status.reason;
1713
- if (import_configs6.PANIC_REASONS.includes(status.reason)) {
1710
+ if (import_configs5.PANIC_REASONS.includes(status.reason)) {
1714
1711
  errorMessage = `${errorMessage}
1715
1712
 
1716
1713
  You can read more about this error at:
1717
1714
 
1718
- ${import_configs6.PANIC_DOC_URL}#variant.${status.reason}`;
1715
+ ${import_configs5.PANIC_DOC_URL}#variant.${status.reason}`;
1719
1716
  }
1720
1717
  return { errorMessage, reason };
1721
1718
  };
@@ -1727,28 +1724,28 @@ var assembleRevertError = (receipts, logs) => {
1727
1724
  if (revertReceipt) {
1728
1725
  const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
1729
1726
  switch (reasonHex) {
1730
- case import_configs6.FAILED_REQUIRE_SIGNAL: {
1727
+ case import_configs5.FAILED_REQUIRE_SIGNAL: {
1731
1728
  reason = "require";
1732
1729
  errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1733
1730
  break;
1734
1731
  }
1735
- case import_configs6.FAILED_ASSERT_EQ_SIGNAL: {
1732
+ case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
1736
1733
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1737
1734
  reason = "assert_eq";
1738
1735
  errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1739
1736
  break;
1740
1737
  }
1741
- case import_configs6.FAILED_ASSERT_NE_SIGNAL: {
1738
+ case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
1742
1739
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1743
1740
  reason = "assert_ne";
1744
1741
  errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1745
1742
  break;
1746
1743
  }
1747
- case import_configs6.FAILED_ASSERT_SIGNAL:
1744
+ case import_configs5.FAILED_ASSERT_SIGNAL:
1748
1745
  reason = "assert";
1749
1746
  errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1750
1747
  break;
1751
- case import_configs6.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1748
+ case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1752
1749
  reason = "MissingOutputChange";
1753
1750
  errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1754
1751
  break;
@@ -1822,6 +1819,8 @@ var BaseTransactionRequest = class {
1822
1819
  outputs = [];
1823
1820
  /** List of witnesses */
1824
1821
  witnesses = [];
1822
+ /** Base asset ID - should be fetched from the chain */
1823
+ baseAssetId;
1825
1824
  /**
1826
1825
  * Constructor for initializing a base transaction request.
1827
1826
  *
@@ -1834,8 +1833,9 @@ var BaseTransactionRequest = class {
1834
1833
  witnessLimit,
1835
1834
  inputs,
1836
1835
  outputs,
1837
- witnesses
1838
- } = {}) {
1836
+ witnesses,
1837
+ baseAssetId
1838
+ }) {
1839
1839
  this.gasPrice = (0, import_math7.bn)(gasPrice);
1840
1840
  this.maturity = maturity ?? 0;
1841
1841
  this.witnessLimit = witnessLimit ? (0, import_math7.bn)(witnessLimit) : void 0;
@@ -1843,6 +1843,7 @@ var BaseTransactionRequest = class {
1843
1843
  this.inputs = inputs ?? [];
1844
1844
  this.outputs = outputs ?? [];
1845
1845
  this.witnesses = witnesses ?? [];
1846
+ this.baseAssetId = baseAssetId;
1846
1847
  }
1847
1848
  static getPolicyMeta(req) {
1848
1849
  let policyTypes = 0;
@@ -1935,7 +1936,7 @@ var BaseTransactionRequest = class {
1935
1936
  * @returns The index of the created witness.
1936
1937
  */
1937
1938
  addEmptyWitness() {
1938
- this.addWitness((0, import_utils9.concat)([import_configs7.ZeroBytes32, import_configs7.ZeroBytes32]));
1939
+ this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1939
1940
  return this.witnesses.length - 1;
1940
1941
  }
1941
1942
  /**
@@ -2066,11 +2067,9 @@ var BaseTransactionRequest = class {
2066
2067
  *
2067
2068
  * @param message - Message resource.
2068
2069
  * @param predicate - Predicate bytes.
2069
- * @param predicateData - Predicate data bytes.
2070
2070
  */
2071
2071
  addMessageInput(message, predicate) {
2072
2072
  const { recipient, sender, amount } = message;
2073
- const assetId = import_configs7.BaseAssetId;
2074
2073
  let witnessIndex;
2075
2074
  if (predicate) {
2076
2075
  witnessIndex = 0;
@@ -2090,7 +2089,7 @@ var BaseTransactionRequest = class {
2090
2089
  predicate: predicate?.bytes
2091
2090
  };
2092
2091
  this.pushInput(input);
2093
- this.addChangeOutput(recipient, assetId);
2092
+ this.addChangeOutput(recipient, this.baseAssetId);
2094
2093
  }
2095
2094
  /**
2096
2095
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -2151,12 +2150,12 @@ var BaseTransactionRequest = class {
2151
2150
  * @param amount - Amount of coin.
2152
2151
  * @param assetId - Asset ID of coin.
2153
2152
  */
2154
- addCoinOutput(to, amount, assetId = import_configs7.BaseAssetId) {
2153
+ addCoinOutput(to, amount, assetId) {
2155
2154
  this.pushOutput({
2156
2155
  type: import_transactions6.OutputType.Coin,
2157
2156
  to: (0, import_address.addressify)(to).toB256(),
2158
2157
  amount,
2159
- assetId
2158
+ assetId: assetId ?? this.baseAssetId
2160
2159
  });
2161
2160
  return this;
2162
2161
  }
@@ -2183,7 +2182,7 @@ var BaseTransactionRequest = class {
2183
2182
  * @param to - Address of the owner.
2184
2183
  * @param assetId - Asset ID of coin.
2185
2184
  */
2186
- addChangeOutput(to, assetId = import_configs7.BaseAssetId) {
2185
+ addChangeOutput(to, assetId) {
2187
2186
  const changeOutput = this.getChangeOutputs().find(
2188
2187
  (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
2189
2188
  );
@@ -2191,7 +2190,7 @@ var BaseTransactionRequest = class {
2191
2190
  this.pushOutput({
2192
2191
  type: import_transactions6.OutputType.Change,
2193
2192
  to: (0, import_address.addressify)(to).toB256(),
2194
- assetId
2193
+ assetId: assetId ?? this.baseAssetId
2195
2194
  });
2196
2195
  }
2197
2196
  }
@@ -2242,6 +2241,12 @@ var BaseTransactionRequest = class {
2242
2241
  * @param quantities - CoinQuantity Array.
2243
2242
  */
2244
2243
  fundWithFakeUtxos(quantities, resourcesOwner) {
2244
+ let idCounter = 0;
2245
+ const generateId = () => {
2246
+ const counterString = String(idCounter++);
2247
+ const id = import_configs6.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2248
+ return id;
2249
+ };
2245
2250
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2246
2251
  if ("assetId" in input) {
2247
2252
  return input.assetId === assetId;
@@ -2251,12 +2256,12 @@ var BaseTransactionRequest = class {
2251
2256
  const updateAssetInput = (assetId, quantity) => {
2252
2257
  const assetInput = findAssetInput(assetId);
2253
2258
  if (assetInput && "assetId" in assetInput) {
2254
- assetInput.id = (0, import_utils9.hexlify)((0, import_ethers.randomBytes)(33));
2259
+ assetInput.id = generateId();
2255
2260
  assetInput.amount = quantity;
2256
2261
  } else {
2257
2262
  this.addResources([
2258
2263
  {
2259
- id: (0, import_utils9.hexlify)((0, import_ethers.randomBytes)(33)),
2264
+ id: generateId(),
2260
2265
  amount: quantity,
2261
2266
  assetId,
2262
2267
  owner: resourcesOwner || import_address.Address.fromRandom(),
@@ -2267,7 +2272,7 @@ var BaseTransactionRequest = class {
2267
2272
  ]);
2268
2273
  }
2269
2274
  };
2270
- updateAssetInput(import_configs7.BaseAssetId, (0, import_math7.bn)(1e11));
2275
+ updateAssetInput(this.baseAssetId, (0, import_math7.bn)(1e11));
2271
2276
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2272
2277
  }
2273
2278
  /**
@@ -2317,13 +2322,13 @@ var BaseTransactionRequest = class {
2317
2322
  };
2318
2323
 
2319
2324
  // src/providers/transaction-request/create-transaction-request.ts
2320
- var import_configs9 = require("@fuel-ts/address/configs");
2325
+ var import_configs8 = require("@fuel-ts/address/configs");
2321
2326
  var import_math9 = require("@fuel-ts/math");
2322
2327
  var import_transactions8 = require("@fuel-ts/transactions");
2323
2328
  var import_utils13 = require("@fuel-ts/utils");
2324
2329
 
2325
2330
  // src/providers/transaction-request/hash-transaction.ts
2326
- var import_configs8 = require("@fuel-ts/address/configs");
2331
+ var import_configs7 = require("@fuel-ts/address/configs");
2327
2332
  var import_hasher = require("@fuel-ts/hasher");
2328
2333
  var import_math8 = require("@fuel-ts/math");
2329
2334
  var import_transactions7 = require("@fuel-ts/transactions");
@@ -2332,7 +2337,7 @@ var import_ramda2 = require("ramda");
2332
2337
  function hashTransaction(transactionRequest, chainId) {
2333
2338
  const transaction = transactionRequest.toTransaction();
2334
2339
  if (transaction.type === import_transactions7.TransactionType.Script) {
2335
- transaction.receiptsRoot = import_configs8.ZeroBytes32;
2340
+ transaction.receiptsRoot = import_configs7.ZeroBytes32;
2336
2341
  }
2337
2342
  transaction.inputs = transaction.inputs.map((input) => {
2338
2343
  const inputClone = (0, import_ramda2.clone)(input);
@@ -2354,10 +2359,10 @@ function hashTransaction(transactionRequest, chainId) {
2354
2359
  blockHeight: 0,
2355
2360
  txIndex: 0
2356
2361
  };
2357
- inputClone.txID = import_configs8.ZeroBytes32;
2362
+ inputClone.txID = import_configs7.ZeroBytes32;
2358
2363
  inputClone.outputIndex = 0;
2359
- inputClone.balanceRoot = import_configs8.ZeroBytes32;
2360
- inputClone.stateRoot = import_configs8.ZeroBytes32;
2364
+ inputClone.balanceRoot = import_configs7.ZeroBytes32;
2365
+ inputClone.stateRoot = import_configs7.ZeroBytes32;
2361
2366
  return inputClone;
2362
2367
  }
2363
2368
  default:
@@ -2368,8 +2373,8 @@ function hashTransaction(transactionRequest, chainId) {
2368
2373
  const outputClone = (0, import_ramda2.clone)(output);
2369
2374
  switch (outputClone.type) {
2370
2375
  case import_transactions7.OutputType.Contract: {
2371
- outputClone.balanceRoot = import_configs8.ZeroBytes32;
2372
- outputClone.stateRoot = import_configs8.ZeroBytes32;
2376
+ outputClone.balanceRoot = import_configs7.ZeroBytes32;
2377
+ outputClone.stateRoot = import_configs7.ZeroBytes32;
2373
2378
  return outputClone;
2374
2379
  }
2375
2380
  case import_transactions7.OutputType.Change: {
@@ -2377,9 +2382,9 @@ function hashTransaction(transactionRequest, chainId) {
2377
2382
  return outputClone;
2378
2383
  }
2379
2384
  case import_transactions7.OutputType.Variable: {
2380
- outputClone.to = import_configs8.ZeroBytes32;
2385
+ outputClone.to = import_configs7.ZeroBytes32;
2381
2386
  outputClone.amount = (0, import_math8.bn)(0);
2382
- outputClone.assetId = import_configs8.ZeroBytes32;
2387
+ outputClone.assetId = import_configs7.ZeroBytes32;
2383
2388
  return outputClone;
2384
2389
  }
2385
2390
  default:
@@ -2437,15 +2442,10 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2437
2442
  *
2438
2443
  * @param createTransactionRequestLike - The initial values for the instance
2439
2444
  */
2440
- constructor({
2441
- bytecodeWitnessIndex,
2442
- salt,
2443
- storageSlots,
2444
- ...rest
2445
- } = {}) {
2445
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2446
2446
  super(rest);
2447
2447
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2448
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs9.ZeroBytes32);
2448
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2449
2449
  this.storageSlots = [...storageSlots ?? []];
2450
2450
  }
2451
2451
  /**
@@ -2463,7 +2463,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2463
2463
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2464
2464
  bytecodeWitnessIndex,
2465
2465
  storageSlotsCount: storageSlots.length,
2466
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs9.ZeroBytes32,
2466
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2467
2467
  storageSlots
2468
2468
  };
2469
2469
  }
@@ -2513,7 +2513,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2513
2513
  // src/providers/transaction-request/script-transaction-request.ts
2514
2514
  var import_abi_coder = require("@fuel-ts/abi-coder");
2515
2515
  var import_address2 = require("@fuel-ts/address");
2516
- var import_configs10 = require("@fuel-ts/address/configs");
2516
+ var import_configs9 = require("@fuel-ts/address/configs");
2517
2517
  var import_math10 = require("@fuel-ts/math");
2518
2518
  var import_transactions9 = require("@fuel-ts/transactions");
2519
2519
  var import_utils15 = require("@fuel-ts/utils");
@@ -2566,7 +2566,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2566
2566
  *
2567
2567
  * @param scriptTransactionRequestLike - The initial values for the instance.
2568
2568
  */
2569
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2569
+ constructor({ script, scriptData, gasLimit, ...rest }) {
2570
2570
  super(rest);
2571
2571
  this.gasLimit = (0, import_math10.bn)(gasLimit);
2572
2572
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
@@ -2587,7 +2587,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2587
2587
  ...super.getBaseTransaction(),
2588
2588
  scriptLength: script.length,
2589
2589
  scriptDataLength: scriptData.length,
2590
- receiptsRoot: import_configs10.ZeroBytes32,
2590
+ receiptsRoot: import_configs9.ZeroBytes32,
2591
2591
  script: (0, import_utils15.hexlify)(script),
2592
2592
  scriptData: (0, import_utils15.hexlify)(scriptData)
2593
2593
  };
@@ -2819,7 +2819,7 @@ var calculateTransactionFee = (params) => {
2819
2819
  };
2820
2820
 
2821
2821
  // src/providers/transaction-summary/operations.ts
2822
- var import_configs11 = require("@fuel-ts/address/configs");
2822
+ var import_configs10 = require("@fuel-ts/address/configs");
2823
2823
  var import_errors11 = require("@fuel-ts/errors");
2824
2824
  var import_math13 = require("@fuel-ts/math");
2825
2825
  var import_transactions14 = require("@fuel-ts/transactions");
@@ -3164,7 +3164,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3164
3164
  const { to: toAddress, assetId, amount } = receipt;
3165
3165
  let { from: fromAddress } = receipt;
3166
3166
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3167
- if (import_configs11.ZeroBytes32 === fromAddress) {
3167
+ if (import_configs10.ZeroBytes32 === fromAddress) {
3168
3168
  const change = changeOutputs.find((output) => output.assetId === assetId);
3169
3169
  fromAddress = change?.to || fromAddress;
3170
3170
  }
@@ -3741,6 +3741,7 @@ var processGqlChain = (chain) => {
3741
3741
  gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3742
3742
  maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3743
3743
  chainId: (0, import_math15.bn)(consensusParameters.chainId),
3744
+ baseAssetId: consensusParameters.baseAssetId,
3744
3745
  gasCosts
3745
3746
  },
3746
3747
  gasCosts,
@@ -3931,7 +3932,7 @@ var _Provider = class {
3931
3932
  name,
3932
3933
  consensusParameters: { chainId }
3933
3934
  } = await this.getChain();
3934
- const network = new import_ethers2.Network(name, chainId.toNumber());
3935
+ const network = new import_ethers.Network(name, chainId.toNumber());
3935
3936
  return Promise.resolve(network);
3936
3937
  }
3937
3938
  /**
@@ -3983,6 +3984,17 @@ var _Provider = class {
3983
3984
  } = this.getChain();
3984
3985
  return chainId.toNumber();
3985
3986
  }
3987
+ /**
3988
+ * Returns the base asset ID
3989
+ *
3990
+ * @returns A promise that resolves to the base asset ID
3991
+ */
3992
+ getBaseAssetId() {
3993
+ const {
3994
+ consensusParameters: { baseAssetId }
3995
+ } = this.getChain();
3996
+ return baseAssetId;
3997
+ }
3986
3998
  /**
3987
3999
  * Submits a transaction to the chain to be executed.
3988
4000
  *
@@ -4133,37 +4145,6 @@ var _Provider = class {
4133
4145
  missingContractIds
4134
4146
  };
4135
4147
  }
4136
- /**
4137
- * Estimates the transaction gas and fee based on the provided transaction request.
4138
- * @param transactionRequest - The transaction request object.
4139
- * @param optimizeGas - Optional. Specifies whether to optimize the gas. Default is false.
4140
- * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
4141
- */
4142
- estimateTxGasAndFee(params) {
4143
- const { transactionRequest } = params;
4144
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4145
- const chainInfo = this.getChain();
4146
- const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
4147
- transactionRequest.gasPrice = gasPrice;
4148
- const minGas = transactionRequest.calculateMinGas(chainInfo);
4149
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4150
- if (transactionRequest.type === import_transactions18.TransactionType.Script) {
4151
- if (transactionRequest.gasLimit.eq(0)) {
4152
- transactionRequest.gasLimit = minGas;
4153
- transactionRequest.gasLimit = maxGasPerTx.sub(
4154
- transactionRequest.calculateMaxGas(chainInfo, minGas)
4155
- );
4156
- }
4157
- }
4158
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4159
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4160
- return {
4161
- minGas,
4162
- minFee,
4163
- maxGas,
4164
- maxFee
4165
- };
4166
- }
4167
4148
  /**
4168
4149
  * Executes a signed transaction without applying the states changes
4169
4150
  * on the chain.
@@ -4211,16 +4192,17 @@ var _Provider = class {
4211
4192
  signatureCallback
4212
4193
  } = {}) {
4213
4194
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4214
- const { minGasPrice } = this.getGasConfig();
4215
- const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4195
+ const chainInfo = this.getChain();
4196
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4197
+ const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4216
4198
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
4217
4199
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4218
4200
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4219
4201
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4220
- if (isScriptTransaction) {
4221
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
4222
- }
4223
4202
  if (estimatePredicates) {
4203
+ if (isScriptTransaction) {
4204
+ txRequestClone.gasLimit = (0, import_math15.bn)(0);
4205
+ }
4224
4206
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4225
4207
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
4226
4208
  }
@@ -4229,34 +4211,36 @@ var _Provider = class {
4229
4211
  if (signatureCallback && isScriptTransaction) {
4230
4212
  await signatureCallback(txRequestClone);
4231
4213
  }
4232
- let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4233
- transactionRequest: txRequestClone
4234
- });
4214
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
4215
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
4235
4216
  let receipts = [];
4236
4217
  let missingContractIds = [];
4237
4218
  let outputVariables = 0;
4238
- let gasUsed = (0, import_math15.bn)(0);
4239
4219
  if (isScriptTransaction && estimateTxDependencies) {
4240
4220
  txRequestClone.gasPrice = (0, import_math15.bn)(0);
4221
+ txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4241
4222
  const result = await this.estimateTxDependencies(txRequestClone);
4242
4223
  receipts = result.receipts;
4243
4224
  outputVariables = result.outputVariables;
4244
4225
  missingContractIds = result.missingContractIds;
4245
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4246
- txRequestClone.gasLimit = gasUsed;
4247
- txRequestClone.gasPrice = setGasPrice;
4248
- ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4249
- transactionRequest: txRequestClone
4250
- }));
4251
4226
  }
4227
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
4228
+ const usedFee = calculatePriceWithFactor(
4229
+ gasUsed,
4230
+ gasPrice,
4231
+ gasPriceFactor
4232
+ ).normalizeZeroToOne();
4233
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4234
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4252
4235
  return {
4253
4236
  requiredQuantities: allQuantities,
4254
4237
  receipts,
4255
4238
  gasUsed,
4256
4239
  minGasPrice,
4257
- gasPrice: setGasPrice,
4240
+ gasPrice,
4258
4241
  minGas,
4259
4242
  maxGas,
4243
+ usedFee,
4260
4244
  minFee,
4261
4245
  maxFee,
4262
4246
  estimatedInputs: txRequestClone.inputs,
@@ -5047,8 +5031,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5047
5031
  * @param assetId - The asset ID to check the balance for.
5048
5032
  * @returns A promise that resolves to the balance amount.
5049
5033
  */
5050
- async getBalance(assetId = import_configs12.BaseAssetId) {
5051
- const amount = await this.provider.getBalance(this.address, assetId);
5034
+ async getBalance(assetId) {
5035
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
5036
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
5052
5037
  return amount;
5053
5038
  }
5054
5039
  /**
@@ -5086,9 +5071,10 @@ var Account = class extends import_interfaces.AbstractAccount {
5086
5071
  * @returns A promise that resolves when the resources are added to the transaction.
5087
5072
  */
5088
5073
  async fund(request, coinQuantities, fee) {
5074
+ const baseAssetId = this.provider.getBaseAssetId();
5089
5075
  const updatedQuantities = addAmountToAsset({
5090
5076
  amount: (0, import_math18.bn)(fee),
5091
- assetId: import_configs12.BaseAssetId,
5077
+ assetId: baseAssetId,
5092
5078
  coinQuantities
5093
5079
  });
5094
5080
  const quantitiesDict = {};
@@ -5112,8 +5098,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5112
5098
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
5113
5099
  cachedUtxos.push(input.id);
5114
5100
  }
5115
- } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs12.BaseAssetId]) {
5116
- quantitiesDict[import_configs12.BaseAssetId].owned = quantitiesDict[import_configs12.BaseAssetId].owned.add(input.amount);
5101
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
5102
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
5117
5103
  cachedMessages.push(input.nonce);
5118
5104
  }
5119
5105
  }
@@ -5145,11 +5131,13 @@ var Account = class extends import_interfaces.AbstractAccount {
5145
5131
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5146
5132
  * @returns A promise that resolves to the prepared transaction request.
5147
5133
  */
5148
- async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5134
+ async createTransfer(destination, amount, assetId, txParams = {}) {
5149
5135
  const { minGasPrice } = this.provider.getGasConfig();
5150
- const params = { gasPrice: minGasPrice, ...txParams };
5136
+ const baseAssetId = this.provider.getBaseAssetId();
5137
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5138
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5151
5139
  const request = new ScriptTransactionRequest(params);
5152
- request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
5140
+ request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetIdToTransfer);
5153
5141
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
5154
5142
  estimateTxDependencies: true,
5155
5143
  resourcesOwner: this
@@ -5175,14 +5163,15 @@ var Account = class extends import_interfaces.AbstractAccount {
5175
5163
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5176
5164
  * @returns A promise that resolves to the transaction response.
5177
5165
  */
5178
- async transfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5166
+ async transfer(destination, amount, assetId, txParams = {}) {
5179
5167
  if ((0, import_math18.bn)(amount).lte(0)) {
5180
5168
  throw new import_errors16.FuelError(
5181
5169
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5182
5170
  "Transfer amount must be a positive number."
5183
5171
  );
5184
5172
  }
5185
- const request = await this.createTransfer(destination, amount, assetId, txParams);
5173
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5174
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
5186
5175
  return this.sendTransaction(request, { estimateTxDependencies: false });
5187
5176
  }
5188
5177
  /**
@@ -5194,7 +5183,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5194
5183
  * @param txParams - The optional transaction parameters.
5195
5184
  * @returns A promise that resolves to the transaction response.
5196
5185
  */
5197
- async transferToContract(contractId, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5186
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
5198
5187
  if ((0, import_math18.bn)(amount).lte(0)) {
5199
5188
  throw new import_errors16.FuelError(
5200
5189
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -5203,11 +5192,13 @@ var Account = class extends import_interfaces.AbstractAccount {
5203
5192
  }
5204
5193
  const contractAddress = import_address4.Address.fromAddressOrString(contractId);
5205
5194
  const { minGasPrice } = this.provider.getGasConfig();
5206
- const params = { gasPrice: minGasPrice, ...txParams };
5195
+ const baseAssetId = this.provider.getBaseAssetId();
5196
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5197
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
5207
5198
  const { script, scriptData } = await assembleTransferToContractScript({
5208
5199
  hexlifiedContractId: contractAddress.toB256(),
5209
5200
  amountToTransfer: (0, import_math18.bn)(amount),
5210
- assetId
5201
+ assetId: assetIdToTransfer
5211
5202
  });
5212
5203
  const request = new ScriptTransactionRequest({
5213
5204
  ...params,
@@ -5217,7 +5208,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5217
5208
  request.addContractInputAndOutput(contractAddress);
5218
5209
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5219
5210
  request,
5220
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetId) }]
5211
+ [{ amount: (0, import_math18.bn)(amount), assetId: String(assetIdToTransfer) }]
5221
5212
  );
5222
5213
  request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
5223
5214
  this.validateGas({
@@ -5239,6 +5230,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5239
5230
  */
5240
5231
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5241
5232
  const { minGasPrice } = this.provider.getGasConfig();
5233
+ const baseAssetId = this.provider.getBaseAssetId();
5242
5234
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5243
5235
  const recipientDataArray = (0, import_utils28.arrayify)(
5244
5236
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -5251,9 +5243,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5251
5243
  ...recipientDataArray,
5252
5244
  ...amountDataArray
5253
5245
  ]);
5254
- const params = { script, gasPrice: minGasPrice, ...txParams };
5246
+ const params = {
5247
+ script,
5248
+ gasPrice: minGasPrice,
5249
+ baseAssetId,
5250
+ ...txParams
5251
+ };
5255
5252
  const request = new ScriptTransactionRequest(params);
5256
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: import_configs12.BaseAssetId }];
5253
+ const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: baseAssetId }];
5257
5254
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5258
5255
  request,
5259
5256
  forwardingQuantities
@@ -5665,14 +5662,14 @@ var import_errors20 = require("@fuel-ts/errors");
5665
5662
  var import_hasher6 = require("@fuel-ts/hasher");
5666
5663
  var import_math20 = require("@fuel-ts/math");
5667
5664
  var import_utils35 = require("@fuel-ts/utils");
5668
- var import_ethers4 = require("ethers");
5665
+ var import_ethers3 = require("ethers");
5669
5666
 
5670
5667
  // src/mnemonic/mnemonic.ts
5671
5668
  var import_crypto3 = require("@fuel-ts/crypto");
5672
5669
  var import_errors19 = require("@fuel-ts/errors");
5673
5670
  var import_hasher5 = require("@fuel-ts/hasher");
5674
5671
  var import_utils33 = require("@fuel-ts/utils");
5675
- var import_ethers3 = require("ethers");
5672
+ var import_ethers2 = require("ethers");
5676
5673
 
5677
5674
  // src/wordlists/words/english.ts
5678
5675
  var english = [
@@ -7926,7 +7923,7 @@ var Mnemonic = class {
7926
7923
  assertMnemonic(getWords(phrase));
7927
7924
  const phraseBytes = toUtf8Bytes(getPhrase(phrase));
7928
7925
  const salt = toUtf8Bytes(`mnemonic${passphrase}`);
7929
- return (0, import_ethers3.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7926
+ return (0, import_ethers2.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7930
7927
  }
7931
7928
  /**
7932
7929
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -7988,7 +7985,7 @@ var Mnemonic = class {
7988
7985
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7989
7986
  );
7990
7987
  }
7991
- return (0, import_utils33.arrayify)((0, import_ethers3.computeHmac)("sha512", MasterSecret, seedArray));
7988
+ return (0, import_utils33.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7992
7989
  }
7993
7990
  /**
7994
7991
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8013,8 +8010,8 @@ var Mnemonic = class {
8013
8010
  chainCode,
8014
8011
  (0, import_utils33.concat)(["0x00", privateKey])
8015
8012
  ]);
8016
- const checksum = (0, import_ethers3.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8017
- return (0, import_ethers3.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8013
+ const checksum = (0, import_ethers2.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8014
+ return (0, import_ethers2.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8018
8015
  }
8019
8016
  /**
8020
8017
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -8042,7 +8039,7 @@ var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
8042
8039
  var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
8043
8040
  var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
8044
8041
  function base58check(data) {
8045
- return (0, import_ethers4.encodeBase58)((0, import_utils35.concat)([data, (0, import_ethers4.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8042
+ return (0, import_ethers3.encodeBase58)((0, import_utils35.concat)([data, (0, import_ethers3.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8046
8043
  }
8047
8044
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8048
8045
  if (isPublic) {
@@ -8098,7 +8095,7 @@ var HDWallet = class {
8098
8095
  this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
8099
8096
  }
8100
8097
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
8101
- this.fingerprint = (0, import_ethers4.dataSlice)((0, import_ethers4.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8098
+ this.fingerprint = (0, import_ethers3.dataSlice)((0, import_ethers3.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8102
8099
  this.depth = config.depth || this.depth;
8103
8100
  this.index = config.index || this.index;
8104
8101
  this.chainCode = config.chainCode;
@@ -8130,7 +8127,7 @@ var HDWallet = class {
8130
8127
  data.set((0, import_utils35.arrayify)(this.publicKey));
8131
8128
  }
8132
8129
  data.set((0, import_math20.toBytes)(index, 4), 33);
8133
- const bytes = (0, import_utils35.arrayify)((0, import_ethers4.computeHmac)("sha512", chainCode, data));
8130
+ const bytes = (0, import_utils35.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
8134
8131
  const IL = bytes.slice(0, 32);
8135
8132
  const IR = bytes.slice(32);
8136
8133
  if (privateKey) {
@@ -8201,7 +8198,7 @@ var HDWallet = class {
8201
8198
  });
8202
8199
  }
8203
8200
  static fromExtendedKey(extendedKey) {
8204
- const decoded = (0, import_ethers4.toBeHex)((0, import_ethers4.decodeBase58)(extendedKey));
8201
+ const decoded = (0, import_ethers3.toBeHex)((0, import_ethers3.decodeBase58)(extendedKey));
8205
8202
  const bytes = (0, import_utils35.arrayify)(decoded);
8206
8203
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8207
8204
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -8816,7 +8813,6 @@ var StorageAbstract = class {
8816
8813
  // src/predicate/predicate.ts
8817
8814
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
8818
8815
  var import_address10 = require("@fuel-ts/address");
8819
- var import_configs13 = require("@fuel-ts/address/configs");
8820
8816
  var import_errors25 = require("@fuel-ts/errors");
8821
8817
  var import_transactions20 = require("@fuel-ts/transactions");
8822
8818
  var import_utils37 = require("@fuel-ts/utils");
@@ -8894,8 +8890,9 @@ var Predicate = class extends Account {
8894
8890
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8895
8891
  * @returns A promise that resolves to the prepared transaction request.
8896
8892
  */
8897
- async createTransfer(destination, amount, assetId = import_configs13.BaseAssetId, txParams = {}) {
8898
- const request = await super.createTransfer(destination, amount, assetId, txParams);
8893
+ async createTransfer(destination, amount, assetId, txParams = {}) {
8894
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
8895
+ const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
8899
8896
  return this.populateTransactionPredicateData(request);
8900
8897
  }
8901
8898
  /**