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

@@ -62,14 +62,12 @@ 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");
66
65
  var import_errors16 = require("@fuel-ts/errors");
67
66
  var import_interfaces = require("@fuel-ts/interfaces");
68
67
  var import_math18 = require("@fuel-ts/math");
69
68
  var import_utils28 = require("@fuel-ts/utils");
70
69
 
71
70
  // src/providers/coin-quantity.ts
72
- var import_configs = require("@fuel-ts/address/configs");
73
71
  var import_math = require("@fuel-ts/math");
74
72
  var import_utils = require("@fuel-ts/utils");
75
73
  var coinQuantityfy = (coinQuantityLike) => {
@@ -78,11 +76,11 @@ var coinQuantityfy = (coinQuantityLike) => {
78
76
  let max2;
79
77
  if (Array.isArray(coinQuantityLike)) {
80
78
  amount = coinQuantityLike[0];
81
- assetId = coinQuantityLike[1] ?? import_configs.BaseAssetId;
82
- max2 = coinQuantityLike[2] ?? void 0;
79
+ assetId = coinQuantityLike[1];
80
+ max2 = coinQuantityLike[2];
83
81
  } else {
84
82
  amount = coinQuantityLike.amount;
85
- assetId = coinQuantityLike.assetId ?? import_configs.BaseAssetId;
83
+ assetId = coinQuantityLike.assetId;
86
84
  max2 = coinQuantityLike.max ?? void 0;
87
85
  }
88
86
  const bnAmount = (0, import_math.bn)(amount);
@@ -112,7 +110,7 @@ var import_transactions18 = require("@fuel-ts/transactions");
112
110
  var import_utils23 = require("@fuel-ts/utils");
113
111
  var import_versions = require("@fuel-ts/versions");
114
112
  var import_utils24 = require("@noble/curves/abstract/utils");
115
- var import_ethers2 = require("ethers");
113
+ var import_ethers = require("ethers");
116
114
  var import_graphql_request = require("graphql-request");
117
115
  var import_ramda3 = require("ramda");
118
116
 
@@ -1051,7 +1049,7 @@ var MemoryCache = class {
1051
1049
  };
1052
1050
 
1053
1051
  // src/providers/transaction-request/input.ts
1054
- var import_configs2 = require("@fuel-ts/address/configs");
1052
+ var import_configs = require("@fuel-ts/address/configs");
1055
1053
  var import_errors3 = require("@fuel-ts/errors");
1056
1054
  var import_math2 = require("@fuel-ts/math");
1057
1055
  var import_transactions = require("@fuel-ts/transactions");
@@ -1065,7 +1063,7 @@ var inputify = (value) => {
1065
1063
  return {
1066
1064
  type: import_transactions.InputType.Coin,
1067
1065
  txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
1068
- outputIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.id).slice(32, 33)),
1066
+ outputIndex: (0, import_utils3.arrayify)(value.id)[32],
1069
1067
  owner: (0, import_utils3.hexlify)(value.owner),
1070
1068
  amount: (0, import_math2.bn)(value.amount),
1071
1069
  assetId: (0, import_utils3.hexlify)(value.assetId),
@@ -1085,10 +1083,10 @@ var inputify = (value) => {
1085
1083
  case import_transactions.InputType.Contract: {
1086
1084
  return {
1087
1085
  type: import_transactions.InputType.Contract,
1088
- txID: import_configs2.ZeroBytes32,
1086
+ txID: import_configs.ZeroBytes32,
1089
1087
  outputIndex: 0,
1090
- balanceRoot: import_configs2.ZeroBytes32,
1091
- stateRoot: import_configs2.ZeroBytes32,
1088
+ balanceRoot: import_configs.ZeroBytes32,
1089
+ stateRoot: import_configs.ZeroBytes32,
1092
1090
  txPointer: {
1093
1091
  blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
1094
1092
  txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
@@ -1126,7 +1124,7 @@ var inputify = (value) => {
1126
1124
  };
1127
1125
 
1128
1126
  // src/providers/transaction-request/output.ts
1129
- var import_configs3 = require("@fuel-ts/address/configs");
1127
+ var import_configs2 = require("@fuel-ts/address/configs");
1130
1128
  var import_errors4 = require("@fuel-ts/errors");
1131
1129
  var import_math3 = require("@fuel-ts/math");
1132
1130
  var import_transactions2 = require("@fuel-ts/transactions");
@@ -1146,8 +1144,8 @@ var outputify = (value) => {
1146
1144
  return {
1147
1145
  type: import_transactions2.OutputType.Contract,
1148
1146
  inputIndex: value.inputIndex,
1149
- balanceRoot: import_configs3.ZeroBytes32,
1150
- stateRoot: import_configs3.ZeroBytes32
1147
+ balanceRoot: import_configs2.ZeroBytes32,
1148
+ stateRoot: import_configs2.ZeroBytes32
1151
1149
  };
1152
1150
  }
1153
1151
  case import_transactions2.OutputType.Change: {
@@ -1161,9 +1159,9 @@ var outputify = (value) => {
1161
1159
  case import_transactions2.OutputType.Variable: {
1162
1160
  return {
1163
1161
  type: import_transactions2.OutputType.Variable,
1164
- to: import_configs3.ZeroBytes32,
1162
+ to: import_configs2.ZeroBytes32,
1165
1163
  amount: (0, import_math3.bn)(0),
1166
- assetId: import_configs3.ZeroBytes32
1164
+ assetId: import_configs2.ZeroBytes32
1167
1165
  };
1168
1166
  }
1169
1167
  case import_transactions2.OutputType.ContractCreated: {
@@ -1184,23 +1182,22 @@ var outputify = (value) => {
1184
1182
 
1185
1183
  // src/providers/transaction-request/transaction-request.ts
1186
1184
  var import_address = require("@fuel-ts/address");
1187
- var import_configs7 = require("@fuel-ts/address/configs");
1185
+ var import_configs6 = require("@fuel-ts/address/configs");
1188
1186
  var import_math7 = require("@fuel-ts/math");
1189
1187
  var import_transactions6 = require("@fuel-ts/transactions");
1190
1188
  var import_utils9 = require("@fuel-ts/utils");
1191
- var import_ethers = require("ethers");
1192
1189
 
1193
1190
  // src/providers/resource.ts
1194
1191
  var isCoin = (resource) => "id" in resource;
1195
1192
 
1196
1193
  // src/providers/utils/receipts.ts
1197
- var import_configs4 = require("@fuel-ts/address/configs");
1194
+ var import_configs3 = require("@fuel-ts/address/configs");
1198
1195
  var import_errors5 = require("@fuel-ts/errors");
1199
1196
  var import_math4 = require("@fuel-ts/math");
1200
1197
  var import_transactions3 = require("@fuel-ts/transactions");
1201
- var import_configs5 = require("@fuel-ts/transactions/configs");
1198
+ var import_configs4 = require("@fuel-ts/transactions/configs");
1202
1199
  var import_utils5 = require("@fuel-ts/utils");
1203
- var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1200
+ var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs4.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1204
1201
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions3.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1205
1202
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1206
1203
  (memo, receipt) => {
@@ -1217,7 +1214,7 @@ var getReceiptsWithMissingData = (receipts) => receipts.reduce(
1217
1214
  missingOutputContractIds: []
1218
1215
  }
1219
1216
  );
1220
- var hexOrZero = (hex) => hex || import_configs4.ZeroBytes32;
1217
+ var hexOrZero = (hex) => hex || import_configs3.ZeroBytes32;
1221
1218
  function assembleReceiptByType(receipt) {
1222
1219
  const { receiptType } = receipt;
1223
1220
  switch (receiptType) {
@@ -1522,16 +1519,16 @@ function sleep(time) {
1522
1519
  var import_errors7 = require("@fuel-ts/errors");
1523
1520
  var import_math6 = require("@fuel-ts/math");
1524
1521
  var import_transactions5 = require("@fuel-ts/transactions");
1525
- var import_configs6 = require("@fuel-ts/transactions/configs");
1522
+ var import_configs5 = require("@fuel-ts/transactions/configs");
1526
1523
  var assemblePanicError = (status) => {
1527
1524
  let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1528
1525
  const reason = status.reason;
1529
- if (import_configs6.PANIC_REASONS.includes(status.reason)) {
1526
+ if (import_configs5.PANIC_REASONS.includes(status.reason)) {
1530
1527
  errorMessage = `${errorMessage}
1531
1528
 
1532
1529
  You can read more about this error at:
1533
1530
 
1534
- ${import_configs6.PANIC_DOC_URL}#variant.${status.reason}`;
1531
+ ${import_configs5.PANIC_DOC_URL}#variant.${status.reason}`;
1535
1532
  }
1536
1533
  return { errorMessage, reason };
1537
1534
  };
@@ -1543,28 +1540,28 @@ var assembleRevertError = (receipts, logs) => {
1543
1540
  if (revertReceipt) {
1544
1541
  const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
1545
1542
  switch (reasonHex) {
1546
- case import_configs6.FAILED_REQUIRE_SIGNAL: {
1543
+ case import_configs5.FAILED_REQUIRE_SIGNAL: {
1547
1544
  reason = "require";
1548
1545
  errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1549
1546
  break;
1550
1547
  }
1551
- case import_configs6.FAILED_ASSERT_EQ_SIGNAL: {
1548
+ case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
1552
1549
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1553
1550
  reason = "assert_eq";
1554
1551
  errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1555
1552
  break;
1556
1553
  }
1557
- case import_configs6.FAILED_ASSERT_NE_SIGNAL: {
1554
+ case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
1558
1555
  const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1559
1556
  reason = "assert_ne";
1560
1557
  errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1561
1558
  break;
1562
1559
  }
1563
- case import_configs6.FAILED_ASSERT_SIGNAL:
1560
+ case import_configs5.FAILED_ASSERT_SIGNAL:
1564
1561
  reason = "assert";
1565
1562
  errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1566
1563
  break;
1567
- case import_configs6.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1564
+ case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1568
1565
  reason = "MissingOutputChange";
1569
1566
  errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1570
1567
  break;
@@ -1626,6 +1623,8 @@ var BaseTransactionRequest = class {
1626
1623
  outputs = [];
1627
1624
  /** List of witnesses */
1628
1625
  witnesses = [];
1626
+ /** Base asset ID - should be fetched from the chain */
1627
+ baseAssetId;
1629
1628
  /**
1630
1629
  * Constructor for initializing a base transaction request.
1631
1630
  *
@@ -1638,8 +1637,9 @@ var BaseTransactionRequest = class {
1638
1637
  witnessLimit,
1639
1638
  inputs,
1640
1639
  outputs,
1641
- witnesses
1642
- } = {}) {
1640
+ witnesses,
1641
+ baseAssetId
1642
+ }) {
1643
1643
  this.gasPrice = (0, import_math7.bn)(gasPrice);
1644
1644
  this.maturity = maturity ?? 0;
1645
1645
  this.witnessLimit = witnessLimit ? (0, import_math7.bn)(witnessLimit) : void 0;
@@ -1647,6 +1647,7 @@ var BaseTransactionRequest = class {
1647
1647
  this.inputs = inputs ?? [];
1648
1648
  this.outputs = outputs ?? [];
1649
1649
  this.witnesses = witnesses ?? [];
1650
+ this.baseAssetId = baseAssetId;
1650
1651
  }
1651
1652
  static getPolicyMeta(req) {
1652
1653
  let policyTypes = 0;
@@ -1739,7 +1740,7 @@ var BaseTransactionRequest = class {
1739
1740
  * @returns The index of the created witness.
1740
1741
  */
1741
1742
  addEmptyWitness() {
1742
- this.addWitness((0, import_utils9.concat)([import_configs7.ZeroBytes32, import_configs7.ZeroBytes32]));
1743
+ this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1743
1744
  return this.witnesses.length - 1;
1744
1745
  }
1745
1746
  /**
@@ -1870,11 +1871,9 @@ var BaseTransactionRequest = class {
1870
1871
  *
1871
1872
  * @param message - Message resource.
1872
1873
  * @param predicate - Predicate bytes.
1873
- * @param predicateData - Predicate data bytes.
1874
1874
  */
1875
1875
  addMessageInput(message, predicate) {
1876
1876
  const { recipient, sender, amount } = message;
1877
- const assetId = import_configs7.BaseAssetId;
1878
1877
  let witnessIndex;
1879
1878
  if (predicate) {
1880
1879
  witnessIndex = 0;
@@ -1894,7 +1893,7 @@ var BaseTransactionRequest = class {
1894
1893
  predicate: predicate?.bytes
1895
1894
  };
1896
1895
  this.pushInput(input);
1897
- this.addChangeOutput(recipient, assetId);
1896
+ this.addChangeOutput(recipient, this.baseAssetId);
1898
1897
  }
1899
1898
  /**
1900
1899
  * Adds a single resource to the transaction by adding a coin/message input and a
@@ -1955,12 +1954,12 @@ var BaseTransactionRequest = class {
1955
1954
  * @param amount - Amount of coin.
1956
1955
  * @param assetId - Asset ID of coin.
1957
1956
  */
1958
- addCoinOutput(to, amount, assetId = import_configs7.BaseAssetId) {
1957
+ addCoinOutput(to, amount, assetId) {
1959
1958
  this.pushOutput({
1960
1959
  type: import_transactions6.OutputType.Coin,
1961
1960
  to: (0, import_address.addressify)(to).toB256(),
1962
1961
  amount,
1963
- assetId
1962
+ assetId: assetId ?? this.baseAssetId
1964
1963
  });
1965
1964
  return this;
1966
1965
  }
@@ -1987,7 +1986,7 @@ var BaseTransactionRequest = class {
1987
1986
  * @param to - Address of the owner.
1988
1987
  * @param assetId - Asset ID of coin.
1989
1988
  */
1990
- addChangeOutput(to, assetId = import_configs7.BaseAssetId) {
1989
+ addChangeOutput(to, assetId) {
1991
1990
  const changeOutput = this.getChangeOutputs().find(
1992
1991
  (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
1993
1992
  );
@@ -1995,7 +1994,7 @@ var BaseTransactionRequest = class {
1995
1994
  this.pushOutput({
1996
1995
  type: import_transactions6.OutputType.Change,
1997
1996
  to: (0, import_address.addressify)(to).toB256(),
1998
- assetId
1997
+ assetId: assetId ?? this.baseAssetId
1999
1998
  });
2000
1999
  }
2001
2000
  }
@@ -2046,6 +2045,12 @@ var BaseTransactionRequest = class {
2046
2045
  * @param quantities - CoinQuantity Array.
2047
2046
  */
2048
2047
  fundWithFakeUtxos(quantities, resourcesOwner) {
2048
+ let idCounter = 0;
2049
+ const generateId = () => {
2050
+ const counterString = String(idCounter++);
2051
+ const id = import_configs6.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2052
+ return id;
2053
+ };
2049
2054
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2050
2055
  if ("assetId" in input) {
2051
2056
  return input.assetId === assetId;
@@ -2055,12 +2060,12 @@ var BaseTransactionRequest = class {
2055
2060
  const updateAssetInput = (assetId, quantity) => {
2056
2061
  const assetInput = findAssetInput(assetId);
2057
2062
  if (assetInput && "assetId" in assetInput) {
2058
- assetInput.id = (0, import_utils9.hexlify)((0, import_ethers.randomBytes)(33));
2063
+ assetInput.id = generateId();
2059
2064
  assetInput.amount = quantity;
2060
2065
  } else {
2061
2066
  this.addResources([
2062
2067
  {
2063
- id: (0, import_utils9.hexlify)((0, import_ethers.randomBytes)(33)),
2068
+ id: generateId(),
2064
2069
  amount: quantity,
2065
2070
  assetId,
2066
2071
  owner: resourcesOwner || import_address.Address.fromRandom(),
@@ -2071,7 +2076,7 @@ var BaseTransactionRequest = class {
2071
2076
  ]);
2072
2077
  }
2073
2078
  };
2074
- updateAssetInput(import_configs7.BaseAssetId, (0, import_math7.bn)(1e11));
2079
+ updateAssetInput(this.baseAssetId, (0, import_math7.bn)(1e11));
2075
2080
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2076
2081
  }
2077
2082
  /**
@@ -2121,13 +2126,13 @@ var BaseTransactionRequest = class {
2121
2126
  };
2122
2127
 
2123
2128
  // src/providers/transaction-request/create-transaction-request.ts
2124
- var import_configs9 = require("@fuel-ts/address/configs");
2129
+ var import_configs8 = require("@fuel-ts/address/configs");
2125
2130
  var import_math9 = require("@fuel-ts/math");
2126
2131
  var import_transactions8 = require("@fuel-ts/transactions");
2127
2132
  var import_utils13 = require("@fuel-ts/utils");
2128
2133
 
2129
2134
  // src/providers/transaction-request/hash-transaction.ts
2130
- var import_configs8 = require("@fuel-ts/address/configs");
2135
+ var import_configs7 = require("@fuel-ts/address/configs");
2131
2136
  var import_hasher = require("@fuel-ts/hasher");
2132
2137
  var import_math8 = require("@fuel-ts/math");
2133
2138
  var import_transactions7 = require("@fuel-ts/transactions");
@@ -2136,7 +2141,7 @@ var import_ramda2 = require("ramda");
2136
2141
  function hashTransaction(transactionRequest, chainId) {
2137
2142
  const transaction = transactionRequest.toTransaction();
2138
2143
  if (transaction.type === import_transactions7.TransactionType.Script) {
2139
- transaction.receiptsRoot = import_configs8.ZeroBytes32;
2144
+ transaction.receiptsRoot = import_configs7.ZeroBytes32;
2140
2145
  }
2141
2146
  transaction.inputs = transaction.inputs.map((input) => {
2142
2147
  const inputClone = (0, import_ramda2.clone)(input);
@@ -2158,10 +2163,10 @@ function hashTransaction(transactionRequest, chainId) {
2158
2163
  blockHeight: 0,
2159
2164
  txIndex: 0
2160
2165
  };
2161
- inputClone.txID = import_configs8.ZeroBytes32;
2166
+ inputClone.txID = import_configs7.ZeroBytes32;
2162
2167
  inputClone.outputIndex = 0;
2163
- inputClone.balanceRoot = import_configs8.ZeroBytes32;
2164
- inputClone.stateRoot = import_configs8.ZeroBytes32;
2168
+ inputClone.balanceRoot = import_configs7.ZeroBytes32;
2169
+ inputClone.stateRoot = import_configs7.ZeroBytes32;
2165
2170
  return inputClone;
2166
2171
  }
2167
2172
  default:
@@ -2172,8 +2177,8 @@ function hashTransaction(transactionRequest, chainId) {
2172
2177
  const outputClone = (0, import_ramda2.clone)(output);
2173
2178
  switch (outputClone.type) {
2174
2179
  case import_transactions7.OutputType.Contract: {
2175
- outputClone.balanceRoot = import_configs8.ZeroBytes32;
2176
- outputClone.stateRoot = import_configs8.ZeroBytes32;
2180
+ outputClone.balanceRoot = import_configs7.ZeroBytes32;
2181
+ outputClone.stateRoot = import_configs7.ZeroBytes32;
2177
2182
  return outputClone;
2178
2183
  }
2179
2184
  case import_transactions7.OutputType.Change: {
@@ -2181,9 +2186,9 @@ function hashTransaction(transactionRequest, chainId) {
2181
2186
  return outputClone;
2182
2187
  }
2183
2188
  case import_transactions7.OutputType.Variable: {
2184
- outputClone.to = import_configs8.ZeroBytes32;
2189
+ outputClone.to = import_configs7.ZeroBytes32;
2185
2190
  outputClone.amount = (0, import_math8.bn)(0);
2186
- outputClone.assetId = import_configs8.ZeroBytes32;
2191
+ outputClone.assetId = import_configs7.ZeroBytes32;
2187
2192
  return outputClone;
2188
2193
  }
2189
2194
  default:
@@ -2241,15 +2246,10 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2241
2246
  *
2242
2247
  * @param createTransactionRequestLike - The initial values for the instance
2243
2248
  */
2244
- constructor({
2245
- bytecodeWitnessIndex,
2246
- salt,
2247
- storageSlots,
2248
- ...rest
2249
- } = {}) {
2249
+ constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2250
2250
  super(rest);
2251
2251
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2252
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs9.ZeroBytes32);
2252
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2253
2253
  this.storageSlots = [...storageSlots ?? []];
2254
2254
  }
2255
2255
  /**
@@ -2267,7 +2267,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2267
2267
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2268
2268
  bytecodeWitnessIndex,
2269
2269
  storageSlotsCount: storageSlots.length,
2270
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs9.ZeroBytes32,
2270
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2271
2271
  storageSlots
2272
2272
  };
2273
2273
  }
@@ -2317,7 +2317,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2317
2317
  // src/providers/transaction-request/script-transaction-request.ts
2318
2318
  var import_abi_coder = require("@fuel-ts/abi-coder");
2319
2319
  var import_address2 = require("@fuel-ts/address");
2320
- var import_configs10 = require("@fuel-ts/address/configs");
2320
+ var import_configs9 = require("@fuel-ts/address/configs");
2321
2321
  var import_math10 = require("@fuel-ts/math");
2322
2322
  var import_transactions9 = require("@fuel-ts/transactions");
2323
2323
  var import_utils15 = require("@fuel-ts/utils");
@@ -2370,7 +2370,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2370
2370
  *
2371
2371
  * @param scriptTransactionRequestLike - The initial values for the instance.
2372
2372
  */
2373
- constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2373
+ constructor({ script, scriptData, gasLimit, ...rest }) {
2374
2374
  super(rest);
2375
2375
  this.gasLimit = (0, import_math10.bn)(gasLimit);
2376
2376
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
@@ -2391,7 +2391,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2391
2391
  ...super.getBaseTransaction(),
2392
2392
  scriptLength: script.length,
2393
2393
  scriptDataLength: scriptData.length,
2394
- receiptsRoot: import_configs10.ZeroBytes32,
2394
+ receiptsRoot: import_configs9.ZeroBytes32,
2395
2395
  script: (0, import_utils15.hexlify)(script),
2396
2396
  scriptData: (0, import_utils15.hexlify)(scriptData)
2397
2397
  };
@@ -2623,7 +2623,7 @@ var calculateTransactionFee = (params) => {
2623
2623
  };
2624
2624
 
2625
2625
  // src/providers/transaction-summary/operations.ts
2626
- var import_configs11 = require("@fuel-ts/address/configs");
2626
+ var import_configs10 = require("@fuel-ts/address/configs");
2627
2627
  var import_errors11 = require("@fuel-ts/errors");
2628
2628
  var import_math13 = require("@fuel-ts/math");
2629
2629
  var import_transactions14 = require("@fuel-ts/transactions");
@@ -2921,7 +2921,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
2921
2921
  const { to: toAddress, assetId, amount } = receipt;
2922
2922
  let { from: fromAddress } = receipt;
2923
2923
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
2924
- if (import_configs11.ZeroBytes32 === fromAddress) {
2924
+ if (import_configs10.ZeroBytes32 === fromAddress) {
2925
2925
  const change = changeOutputs.find((output) => output.assetId === assetId);
2926
2926
  fromAddress = change?.to || fromAddress;
2927
2927
  }
@@ -3498,6 +3498,7 @@ var processGqlChain = (chain) => {
3498
3498
  gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3499
3499
  maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3500
3500
  chainId: (0, import_math15.bn)(consensusParameters.chainId),
3501
+ baseAssetId: consensusParameters.baseAssetId,
3501
3502
  gasCosts
3502
3503
  },
3503
3504
  gasCosts,
@@ -3688,7 +3689,7 @@ var _Provider = class {
3688
3689
  name,
3689
3690
  consensusParameters: { chainId }
3690
3691
  } = await this.getChain();
3691
- const network = new import_ethers2.Network(name, chainId.toNumber());
3692
+ const network = new import_ethers.Network(name, chainId.toNumber());
3692
3693
  return Promise.resolve(network);
3693
3694
  }
3694
3695
  /**
@@ -3740,6 +3741,17 @@ var _Provider = class {
3740
3741
  } = this.getChain();
3741
3742
  return chainId.toNumber();
3742
3743
  }
3744
+ /**
3745
+ * Returns the base asset ID
3746
+ *
3747
+ * @returns A promise that resolves to the base asset ID
3748
+ */
3749
+ getBaseAssetId() {
3750
+ const {
3751
+ consensusParameters: { baseAssetId }
3752
+ } = this.getChain();
3753
+ return baseAssetId;
3754
+ }
3743
3755
  /**
3744
3756
  * Submits a transaction to the chain to be executed.
3745
3757
  *
@@ -3890,37 +3902,6 @@ var _Provider = class {
3890
3902
  missingContractIds
3891
3903
  };
3892
3904
  }
3893
- /**
3894
- * Estimates the transaction gas and fee based on the provided transaction request.
3895
- * @param transactionRequest - The transaction request object.
3896
- * @param optimizeGas - Optional. Specifies whether to optimize the gas. Default is false.
3897
- * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
3898
- */
3899
- estimateTxGasAndFee(params) {
3900
- const { transactionRequest } = params;
3901
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3902
- const chainInfo = this.getChain();
3903
- const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
3904
- transactionRequest.gasPrice = gasPrice;
3905
- const minGas = transactionRequest.calculateMinGas(chainInfo);
3906
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3907
- if (transactionRequest.type === import_transactions18.TransactionType.Script) {
3908
- if (transactionRequest.gasLimit.eq(0)) {
3909
- transactionRequest.gasLimit = minGas;
3910
- transactionRequest.gasLimit = maxGasPerTx.sub(
3911
- transactionRequest.calculateMaxGas(chainInfo, minGas)
3912
- );
3913
- }
3914
- }
3915
- const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
3916
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3917
- return {
3918
- minGas,
3919
- minFee,
3920
- maxGas,
3921
- maxFee
3922
- };
3923
- }
3924
3905
  /**
3925
3906
  * Executes a signed transaction without applying the states changes
3926
3907
  * on the chain.
@@ -3968,16 +3949,17 @@ var _Provider = class {
3968
3949
  signatureCallback
3969
3950
  } = {}) {
3970
3951
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3971
- const { minGasPrice } = this.getGasConfig();
3972
- const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3952
+ const chainInfo = this.getChain();
3953
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3954
+ const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3973
3955
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
3974
3956
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3975
3957
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3976
3958
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3977
- if (isScriptTransaction) {
3978
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
3979
- }
3980
3959
  if (estimatePredicates) {
3960
+ if (isScriptTransaction) {
3961
+ txRequestClone.gasLimit = (0, import_math15.bn)(0);
3962
+ }
3981
3963
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3982
3964
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
3983
3965
  }
@@ -3986,34 +3968,36 @@ var _Provider = class {
3986
3968
  if (signatureCallback && isScriptTransaction) {
3987
3969
  await signatureCallback(txRequestClone);
3988
3970
  }
3989
- let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
3990
- transactionRequest: txRequestClone
3991
- });
3971
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
3972
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3992
3973
  let receipts = [];
3993
3974
  let missingContractIds = [];
3994
3975
  let outputVariables = 0;
3995
- let gasUsed = (0, import_math15.bn)(0);
3996
3976
  if (isScriptTransaction && estimateTxDependencies) {
3997
3977
  txRequestClone.gasPrice = (0, import_math15.bn)(0);
3978
+ txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3998
3979
  const result = await this.estimateTxDependencies(txRequestClone);
3999
3980
  receipts = result.receipts;
4000
3981
  outputVariables = result.outputVariables;
4001
3982
  missingContractIds = result.missingContractIds;
4002
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4003
- txRequestClone.gasLimit = gasUsed;
4004
- txRequestClone.gasPrice = setGasPrice;
4005
- ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4006
- transactionRequest: txRequestClone
4007
- }));
4008
3983
  }
3984
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
3985
+ const usedFee = calculatePriceWithFactor(
3986
+ gasUsed,
3987
+ gasPrice,
3988
+ gasPriceFactor
3989
+ ).normalizeZeroToOne();
3990
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
3991
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4009
3992
  return {
4010
3993
  requiredQuantities: allQuantities,
4011
3994
  receipts,
4012
3995
  gasUsed,
4013
3996
  minGasPrice,
4014
- gasPrice: setGasPrice,
3997
+ gasPrice,
4015
3998
  minGas,
4016
3999
  maxGas,
4000
+ usedFee,
4017
4001
  minFee,
4018
4002
  maxFee,
4019
4003
  estimatedInputs: txRequestClone.inputs,
@@ -4638,8 +4622,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4638
4622
  * @param assetId - The asset ID to check the balance for.
4639
4623
  * @returns A promise that resolves to the balance amount.
4640
4624
  */
4641
- async getBalance(assetId = import_configs12.BaseAssetId) {
4642
- const amount = await this.provider.getBalance(this.address, assetId);
4625
+ async getBalance(assetId) {
4626
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
4627
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
4643
4628
  return amount;
4644
4629
  }
4645
4630
  /**
@@ -4677,9 +4662,10 @@ var Account = class extends import_interfaces.AbstractAccount {
4677
4662
  * @returns A promise that resolves when the resources are added to the transaction.
4678
4663
  */
4679
4664
  async fund(request, coinQuantities, fee) {
4665
+ const baseAssetId = this.provider.getBaseAssetId();
4680
4666
  const updatedQuantities = addAmountToAsset({
4681
4667
  amount: (0, import_math18.bn)(fee),
4682
- assetId: import_configs12.BaseAssetId,
4668
+ assetId: baseAssetId,
4683
4669
  coinQuantities
4684
4670
  });
4685
4671
  const quantitiesDict = {};
@@ -4703,8 +4689,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4703
4689
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4704
4690
  cachedUtxos.push(input.id);
4705
4691
  }
4706
- } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs12.BaseAssetId]) {
4707
- quantitiesDict[import_configs12.BaseAssetId].owned = quantitiesDict[import_configs12.BaseAssetId].owned.add(input.amount);
4692
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
4693
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
4708
4694
  cachedMessages.push(input.nonce);
4709
4695
  }
4710
4696
  }
@@ -4736,11 +4722,13 @@ var Account = class extends import_interfaces.AbstractAccount {
4736
4722
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4737
4723
  * @returns A promise that resolves to the prepared transaction request.
4738
4724
  */
4739
- async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4725
+ async createTransfer(destination, amount, assetId, txParams = {}) {
4740
4726
  const { minGasPrice } = this.provider.getGasConfig();
4741
- const params = { gasPrice: minGasPrice, ...txParams };
4727
+ const baseAssetId = this.provider.getBaseAssetId();
4728
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4729
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
4742
4730
  const request = new ScriptTransactionRequest(params);
4743
- request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
4731
+ request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetIdToTransfer);
4744
4732
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
4745
4733
  estimateTxDependencies: true,
4746
4734
  resourcesOwner: this
@@ -4766,14 +4754,15 @@ var Account = class extends import_interfaces.AbstractAccount {
4766
4754
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4767
4755
  * @returns A promise that resolves to the transaction response.
4768
4756
  */
4769
- async transfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4757
+ async transfer(destination, amount, assetId, txParams = {}) {
4770
4758
  if ((0, import_math18.bn)(amount).lte(0)) {
4771
4759
  throw new import_errors16.FuelError(
4772
4760
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
4773
4761
  "Transfer amount must be a positive number."
4774
4762
  );
4775
4763
  }
4776
- const request = await this.createTransfer(destination, amount, assetId, txParams);
4764
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4765
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
4777
4766
  return this.sendTransaction(request, { estimateTxDependencies: false });
4778
4767
  }
4779
4768
  /**
@@ -4785,7 +4774,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4785
4774
  * @param txParams - The optional transaction parameters.
4786
4775
  * @returns A promise that resolves to the transaction response.
4787
4776
  */
4788
- async transferToContract(contractId, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4777
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
4789
4778
  if ((0, import_math18.bn)(amount).lte(0)) {
4790
4779
  throw new import_errors16.FuelError(
4791
4780
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -4794,11 +4783,13 @@ var Account = class extends import_interfaces.AbstractAccount {
4794
4783
  }
4795
4784
  const contractAddress = import_address4.Address.fromAddressOrString(contractId);
4796
4785
  const { minGasPrice } = this.provider.getGasConfig();
4797
- const params = { gasPrice: minGasPrice, ...txParams };
4786
+ const baseAssetId = this.provider.getBaseAssetId();
4787
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
4788
+ const params = { gasPrice: minGasPrice, baseAssetId, ...txParams };
4798
4789
  const { script, scriptData } = await assembleTransferToContractScript({
4799
4790
  hexlifiedContractId: contractAddress.toB256(),
4800
4791
  amountToTransfer: (0, import_math18.bn)(amount),
4801
- assetId
4792
+ assetId: assetIdToTransfer
4802
4793
  });
4803
4794
  const request = new ScriptTransactionRequest({
4804
4795
  ...params,
@@ -4808,7 +4799,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4808
4799
  request.addContractInputAndOutput(contractAddress);
4809
4800
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4810
4801
  request,
4811
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetId) }]
4802
+ [{ amount: (0, import_math18.bn)(amount), assetId: String(assetIdToTransfer) }]
4812
4803
  );
4813
4804
  request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
4814
4805
  this.validateGas({
@@ -4830,6 +4821,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4830
4821
  */
4831
4822
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
4832
4823
  const { minGasPrice } = this.provider.getGasConfig();
4824
+ const baseAssetId = this.provider.getBaseAssetId();
4833
4825
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
4834
4826
  const recipientDataArray = (0, import_utils28.arrayify)(
4835
4827
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -4842,9 +4834,14 @@ var Account = class extends import_interfaces.AbstractAccount {
4842
4834
  ...recipientDataArray,
4843
4835
  ...amountDataArray
4844
4836
  ]);
4845
- const params = { script, gasPrice: minGasPrice, ...txParams };
4837
+ const params = {
4838
+ script,
4839
+ gasPrice: minGasPrice,
4840
+ baseAssetId,
4841
+ ...txParams
4842
+ };
4846
4843
  const request = new ScriptTransactionRequest(params);
4847
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: import_configs12.BaseAssetId }];
4844
+ const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: baseAssetId }];
4848
4845
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
4849
4846
  request,
4850
4847
  forwardingQuantities
@@ -5252,14 +5249,14 @@ var import_errors20 = require("@fuel-ts/errors");
5252
5249
  var import_hasher6 = require("@fuel-ts/hasher");
5253
5250
  var import_math20 = require("@fuel-ts/math");
5254
5251
  var import_utils35 = require("@fuel-ts/utils");
5255
- var import_ethers4 = require("ethers");
5252
+ var import_ethers3 = require("ethers");
5256
5253
 
5257
5254
  // src/mnemonic/mnemonic.ts
5258
5255
  var import_crypto3 = require("@fuel-ts/crypto");
5259
5256
  var import_errors19 = require("@fuel-ts/errors");
5260
5257
  var import_hasher5 = require("@fuel-ts/hasher");
5261
5258
  var import_utils33 = require("@fuel-ts/utils");
5262
- var import_ethers3 = require("ethers");
5259
+ var import_ethers2 = require("ethers");
5263
5260
 
5264
5261
  // src/wordlists/words/english.ts
5265
5262
  var english = [
@@ -7507,7 +7504,7 @@ var Mnemonic = class {
7507
7504
  assertMnemonic(getWords(phrase));
7508
7505
  const phraseBytes = toUtf8Bytes(getPhrase(phrase));
7509
7506
  const salt = toUtf8Bytes(`mnemonic${passphrase}`);
7510
- return (0, import_ethers3.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7507
+ return (0, import_ethers2.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7511
7508
  }
7512
7509
  /**
7513
7510
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -7569,7 +7566,7 @@ var Mnemonic = class {
7569
7566
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7570
7567
  );
7571
7568
  }
7572
- return (0, import_utils33.arrayify)((0, import_ethers3.computeHmac)("sha512", MasterSecret, seedArray));
7569
+ return (0, import_utils33.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7573
7570
  }
7574
7571
  /**
7575
7572
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7594,8 +7591,8 @@ var Mnemonic = class {
7594
7591
  chainCode,
7595
7592
  (0, import_utils33.concat)(["0x00", privateKey])
7596
7593
  ]);
7597
- const checksum = (0, import_ethers3.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
7598
- return (0, import_ethers3.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
7594
+ const checksum = (0, import_ethers2.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
7595
+ return (0, import_ethers2.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
7599
7596
  }
7600
7597
  /**
7601
7598
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -7623,7 +7620,7 @@ var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
7623
7620
  var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
7624
7621
  var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
7625
7622
  function base58check(data) {
7626
- 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)]));
7623
+ 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)]));
7627
7624
  }
7628
7625
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7629
7626
  if (isPublic) {
@@ -7679,7 +7676,7 @@ var HDWallet = class {
7679
7676
  this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
7680
7677
  }
7681
7678
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7682
- this.fingerprint = (0, import_ethers4.dataSlice)((0, import_ethers4.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
7679
+ this.fingerprint = (0, import_ethers3.dataSlice)((0, import_ethers3.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
7683
7680
  this.depth = config.depth || this.depth;
7684
7681
  this.index = config.index || this.index;
7685
7682
  this.chainCode = config.chainCode;
@@ -7711,7 +7708,7 @@ var HDWallet = class {
7711
7708
  data.set((0, import_utils35.arrayify)(this.publicKey));
7712
7709
  }
7713
7710
  data.set((0, import_math20.toBytes)(index, 4), 33);
7714
- const bytes = (0, import_utils35.arrayify)((0, import_ethers4.computeHmac)("sha512", chainCode, data));
7711
+ const bytes = (0, import_utils35.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
7715
7712
  const IL = bytes.slice(0, 32);
7716
7713
  const IR = bytes.slice(32);
7717
7714
  if (privateKey) {
@@ -7782,7 +7779,7 @@ var HDWallet = class {
7782
7779
  });
7783
7780
  }
7784
7781
  static fromExtendedKey(extendedKey) {
7785
- const decoded = (0, import_ethers4.toBeHex)((0, import_ethers4.decodeBase58)(extendedKey));
7782
+ const decoded = (0, import_ethers3.toBeHex)((0, import_ethers3.decodeBase58)(extendedKey));
7786
7783
  const bytes = (0, import_utils35.arrayify)(decoded);
7787
7784
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7788
7785
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -7989,7 +7986,9 @@ var seedTestWallet = async (wallet, quantities) => {
7989
7986
  );
7990
7987
  const resources = await genesisWallet.getResourcesToSpend(quantities);
7991
7988
  const { minGasPrice } = genesisWallet.provider.getGasConfig();
7989
+ const baseAssetId = genesisWallet.provider.getBaseAssetId();
7992
7990
  const request = new ScriptTransactionRequest({
7991
+ baseAssetId,
7993
7992
  gasLimit: 1e4,
7994
7993
  gasPrice: minGasPrice
7995
7994
  });
@@ -8008,7 +8007,7 @@ var generateTestWallet = async (provider, quantities) => {
8008
8007
  };
8009
8008
 
8010
8009
  // src/test-utils/launchNode.ts
8011
- var import_configs13 = require("@fuel-ts/address/configs");
8010
+ var import_configs11 = require("@fuel-ts/address/configs");
8012
8011
  var import_math21 = require("@fuel-ts/math");
8013
8012
  var import_utils36 = require("@fuel-ts/utils");
8014
8013
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
@@ -8108,7 +8107,7 @@ var launchNode = async ({
8108
8107
  {
8109
8108
  owner: signer.address.toHexString(),
8110
8109
  amount: (0, import_math21.toHex)(1e9),
8111
- asset_id: import_configs13.BaseAssetId
8110
+ asset_id: import_utils36.defaultChainConfig?.consensus_parameters?.base_asset_id ?? import_configs11.ZeroBytes32
8112
8111
  }
8113
8112
  ]
8114
8113
  }
@@ -8174,9 +8173,10 @@ var launchNode = async ({
8174
8173
  })
8175
8174
  );
8176
8175
  var generateWallets = async (count, provider) => {
8176
+ const baseAssetId = provider.getBaseAssetId();
8177
8177
  const wallets = [];
8178
8178
  for (let i = 0; i < count; i += 1) {
8179
- const wallet = await generateTestWallet(provider, [[1e3, import_configs13.BaseAssetId]]);
8179
+ const wallet = await generateTestWallet(provider, [[1e3, baseAssetId]]);
8180
8180
  wallets.push(wallet);
8181
8181
  }
8182
8182
  return wallets;