@fuel-ts/account 0.0.0-rc-2034-20240410133013 → 0.0.0-rc-1976-20240410141707

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 = import_configs6.ZeroBytes32;
1825
1824
  /**
1826
1825
  * Constructor for initializing a base transaction request.
1827
1826
  *
@@ -1834,7 +1833,8 @@ var BaseTransactionRequest = class {
1834
1833
  witnessLimit,
1835
1834
  inputs,
1836
1835
  outputs,
1837
- witnesses
1836
+ witnesses,
1837
+ baseAssetId
1838
1838
  } = {}) {
1839
1839
  this.gasPrice = (0, import_math7.bn)(gasPrice);
1840
1840
  this.maturity = maturity ?? 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 ?? import_configs6.ZeroBytes32;
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:
@@ -2445,7 +2450,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2445
2450
  } = {}) {
2446
2451
  super(rest);
2447
2452
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2448
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs9.ZeroBytes32);
2453
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2449
2454
  this.storageSlots = [...storageSlots ?? []];
2450
2455
  }
2451
2456
  /**
@@ -2463,7 +2468,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2463
2468
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2464
2469
  bytecodeWitnessIndex,
2465
2470
  storageSlotsCount: storageSlots.length,
2466
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs9.ZeroBytes32,
2471
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2467
2472
  storageSlots
2468
2473
  };
2469
2474
  }
@@ -2513,7 +2518,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2513
2518
  // src/providers/transaction-request/script-transaction-request.ts
2514
2519
  var import_abi_coder = require("@fuel-ts/abi-coder");
2515
2520
  var import_address2 = require("@fuel-ts/address");
2516
- var import_configs10 = require("@fuel-ts/address/configs");
2521
+ var import_configs9 = require("@fuel-ts/address/configs");
2517
2522
  var import_math10 = require("@fuel-ts/math");
2518
2523
  var import_transactions9 = require("@fuel-ts/transactions");
2519
2524
  var import_utils15 = require("@fuel-ts/utils");
@@ -2587,7 +2592,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2587
2592
  ...super.getBaseTransaction(),
2588
2593
  scriptLength: script.length,
2589
2594
  scriptDataLength: scriptData.length,
2590
- receiptsRoot: import_configs10.ZeroBytes32,
2595
+ receiptsRoot: import_configs9.ZeroBytes32,
2591
2596
  script: (0, import_utils15.hexlify)(script),
2592
2597
  scriptData: (0, import_utils15.hexlify)(scriptData)
2593
2598
  };
@@ -2819,7 +2824,7 @@ var calculateTransactionFee = (params) => {
2819
2824
  };
2820
2825
 
2821
2826
  // src/providers/transaction-summary/operations.ts
2822
- var import_configs11 = require("@fuel-ts/address/configs");
2827
+ var import_configs10 = require("@fuel-ts/address/configs");
2823
2828
  var import_errors11 = require("@fuel-ts/errors");
2824
2829
  var import_math13 = require("@fuel-ts/math");
2825
2830
  var import_transactions14 = require("@fuel-ts/transactions");
@@ -3164,7 +3169,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3164
3169
  const { to: toAddress, assetId, amount } = receipt;
3165
3170
  let { from: fromAddress } = receipt;
3166
3171
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3167
- if (import_configs11.ZeroBytes32 === fromAddress) {
3172
+ if (import_configs10.ZeroBytes32 === fromAddress) {
3168
3173
  const change = changeOutputs.find((output) => output.assetId === assetId);
3169
3174
  fromAddress = change?.to || fromAddress;
3170
3175
  }
@@ -3741,6 +3746,7 @@ var processGqlChain = (chain) => {
3741
3746
  gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3742
3747
  maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3743
3748
  chainId: (0, import_math15.bn)(consensusParameters.chainId),
3749
+ baseAssetId: consensusParameters.baseAssetId,
3744
3750
  gasCosts
3745
3751
  },
3746
3752
  gasCosts,
@@ -3931,7 +3937,7 @@ var _Provider = class {
3931
3937
  name,
3932
3938
  consensusParameters: { chainId }
3933
3939
  } = await this.getChain();
3934
- const network = new import_ethers2.Network(name, chainId.toNumber());
3940
+ const network = new import_ethers.Network(name, chainId.toNumber());
3935
3941
  return Promise.resolve(network);
3936
3942
  }
3937
3943
  /**
@@ -3983,6 +3989,17 @@ var _Provider = class {
3983
3989
  } = this.getChain();
3984
3990
  return chainId.toNumber();
3985
3991
  }
3992
+ /**
3993
+ * Returns the base asset ID
3994
+ *
3995
+ * @returns A promise that resolves to the base asset ID
3996
+ */
3997
+ getBaseAssetId() {
3998
+ const {
3999
+ consensusParameters: { baseAssetId }
4000
+ } = this.getChain();
4001
+ return baseAssetId;
4002
+ }
3986
4003
  /**
3987
4004
  * Submits a transaction to the chain to be executed.
3988
4005
  *
@@ -4133,37 +4150,6 @@ var _Provider = class {
4133
4150
  missingContractIds
4134
4151
  };
4135
4152
  }
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
4153
  /**
4168
4154
  * Executes a signed transaction without applying the states changes
4169
4155
  * on the chain.
@@ -4211,16 +4197,17 @@ var _Provider = class {
4211
4197
  signatureCallback
4212
4198
  } = {}) {
4213
4199
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4214
- const { minGasPrice } = this.getGasConfig();
4215
- const setGasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4200
+ const chainInfo = this.getChain();
4201
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4202
+ const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4216
4203
  const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
4217
4204
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4218
4205
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4219
4206
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4220
- if (isScriptTransaction) {
4221
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
4222
- }
4223
4207
  if (estimatePredicates) {
4208
+ if (isScriptTransaction) {
4209
+ txRequestClone.gasLimit = (0, import_math15.bn)(0);
4210
+ }
4224
4211
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4225
4212
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
4226
4213
  }
@@ -4229,34 +4216,36 @@ var _Provider = class {
4229
4216
  if (signatureCallback && isScriptTransaction) {
4230
4217
  await signatureCallback(txRequestClone);
4231
4218
  }
4232
- let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4233
- transactionRequest: txRequestClone
4234
- });
4219
+ const minGas = txRequestClone.calculateMinGas(chainInfo);
4220
+ const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
4235
4221
  let receipts = [];
4236
4222
  let missingContractIds = [];
4237
4223
  let outputVariables = 0;
4238
- let gasUsed = (0, import_math15.bn)(0);
4239
4224
  if (isScriptTransaction && estimateTxDependencies) {
4240
4225
  txRequestClone.gasPrice = (0, import_math15.bn)(0);
4226
+ txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4241
4227
  const result = await this.estimateTxDependencies(txRequestClone);
4242
4228
  receipts = result.receipts;
4243
4229
  outputVariables = result.outputVariables;
4244
4230
  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
4231
  }
4232
+ const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
4233
+ const usedFee = calculatePriceWithFactor(
4234
+ gasUsed,
4235
+ gasPrice,
4236
+ gasPriceFactor
4237
+ ).normalizeZeroToOne();
4238
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4239
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4252
4240
  return {
4253
4241
  requiredQuantities: allQuantities,
4254
4242
  receipts,
4255
4243
  gasUsed,
4256
4244
  minGasPrice,
4257
- gasPrice: setGasPrice,
4245
+ gasPrice,
4258
4246
  minGas,
4259
4247
  maxGas,
4248
+ usedFee,
4260
4249
  minFee,
4261
4250
  maxFee,
4262
4251
  estimatedInputs: txRequestClone.inputs,
@@ -5047,8 +5036,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5047
5036
  * @param assetId - The asset ID to check the balance for.
5048
5037
  * @returns A promise that resolves to the balance amount.
5049
5038
  */
5050
- async getBalance(assetId = import_configs12.BaseAssetId) {
5051
- const amount = await this.provider.getBalance(this.address, assetId);
5039
+ async getBalance(assetId) {
5040
+ const assetIdToFetch = assetId ?? this.provider.getBaseAssetId();
5041
+ const amount = await this.provider.getBalance(this.address, assetIdToFetch);
5052
5042
  return amount;
5053
5043
  }
5054
5044
  /**
@@ -5086,9 +5076,10 @@ var Account = class extends import_interfaces.AbstractAccount {
5086
5076
  * @returns A promise that resolves when the resources are added to the transaction.
5087
5077
  */
5088
5078
  async fund(request, coinQuantities, fee) {
5079
+ const baseAssetId = this.provider.getBaseAssetId();
5089
5080
  const updatedQuantities = addAmountToAsset({
5090
5081
  amount: (0, import_math18.bn)(fee),
5091
- assetId: import_configs12.BaseAssetId,
5082
+ assetId: baseAssetId,
5092
5083
  coinQuantities
5093
5084
  });
5094
5085
  const quantitiesDict = {};
@@ -5112,8 +5103,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5112
5103
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
5113
5104
  cachedUtxos.push(input.id);
5114
5105
  }
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);
5106
+ } else if (input.recipient === owner && input.amount && quantitiesDict[baseAssetId]) {
5107
+ quantitiesDict[baseAssetId].owned = quantitiesDict[baseAssetId].owned.add(input.amount);
5117
5108
  cachedMessages.push(input.nonce);
5118
5109
  }
5119
5110
  }
@@ -5145,11 +5136,12 @@ var Account = class extends import_interfaces.AbstractAccount {
5145
5136
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5146
5137
  * @returns A promise that resolves to the prepared transaction request.
5147
5138
  */
5148
- async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5139
+ async createTransfer(destination, amount, assetId, txParams = {}) {
5149
5140
  const { minGasPrice } = this.provider.getGasConfig();
5141
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5150
5142
  const params = { gasPrice: minGasPrice, ...txParams };
5151
5143
  const request = new ScriptTransactionRequest(params);
5152
- request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
5144
+ request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetIdToTransfer);
5153
5145
  const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
5154
5146
  estimateTxDependencies: true,
5155
5147
  resourcesOwner: this
@@ -5175,14 +5167,15 @@ var Account = class extends import_interfaces.AbstractAccount {
5175
5167
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5176
5168
  * @returns A promise that resolves to the transaction response.
5177
5169
  */
5178
- async transfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5170
+ async transfer(destination, amount, assetId, txParams = {}) {
5179
5171
  if ((0, import_math18.bn)(amount).lte(0)) {
5180
5172
  throw new import_errors16.FuelError(
5181
5173
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5182
5174
  "Transfer amount must be a positive number."
5183
5175
  );
5184
5176
  }
5185
- const request = await this.createTransfer(destination, amount, assetId, txParams);
5177
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5178
+ const request = await this.createTransfer(destination, amount, assetIdToTransfer, txParams);
5186
5179
  return this.sendTransaction(request, { estimateTxDependencies: false });
5187
5180
  }
5188
5181
  /**
@@ -5194,7 +5187,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5194
5187
  * @param txParams - The optional transaction parameters.
5195
5188
  * @returns A promise that resolves to the transaction response.
5196
5189
  */
5197
- async transferToContract(contractId, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5190
+ async transferToContract(contractId, amount, assetId, txParams = {}) {
5198
5191
  if ((0, import_math18.bn)(amount).lte(0)) {
5199
5192
  throw new import_errors16.FuelError(
5200
5193
  import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
@@ -5203,11 +5196,12 @@ var Account = class extends import_interfaces.AbstractAccount {
5203
5196
  }
5204
5197
  const contractAddress = import_address4.Address.fromAddressOrString(contractId);
5205
5198
  const { minGasPrice } = this.provider.getGasConfig();
5199
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5206
5200
  const params = { gasPrice: minGasPrice, ...txParams };
5207
5201
  const { script, scriptData } = await assembleTransferToContractScript({
5208
5202
  hexlifiedContractId: contractAddress.toB256(),
5209
5203
  amountToTransfer: (0, import_math18.bn)(amount),
5210
- assetId
5204
+ assetId: assetIdToTransfer
5211
5205
  });
5212
5206
  const request = new ScriptTransactionRequest({
5213
5207
  ...params,
@@ -5217,7 +5211,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5217
5211
  request.addContractInputAndOutput(contractAddress);
5218
5212
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5219
5213
  request,
5220
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetId) }]
5214
+ [{ amount: (0, import_math18.bn)(amount), assetId: String(assetIdToTransfer) }]
5221
5215
  );
5222
5216
  request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
5223
5217
  this.validateGas({
@@ -5239,6 +5233,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5239
5233
  */
5240
5234
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5241
5235
  const { minGasPrice } = this.provider.getGasConfig();
5236
+ const baseAssetId = this.provider.getBaseAssetId();
5242
5237
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5243
5238
  const recipientDataArray = (0, import_utils28.arrayify)(
5244
5239
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
@@ -5253,7 +5248,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5253
5248
  ]);
5254
5249
  const params = { script, gasPrice: minGasPrice, ...txParams };
5255
5250
  const request = new ScriptTransactionRequest(params);
5256
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: import_configs12.BaseAssetId }];
5251
+ const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: baseAssetId }];
5257
5252
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5258
5253
  request,
5259
5254
  forwardingQuantities
@@ -5665,14 +5660,14 @@ var import_errors20 = require("@fuel-ts/errors");
5665
5660
  var import_hasher6 = require("@fuel-ts/hasher");
5666
5661
  var import_math20 = require("@fuel-ts/math");
5667
5662
  var import_utils35 = require("@fuel-ts/utils");
5668
- var import_ethers4 = require("ethers");
5663
+ var import_ethers3 = require("ethers");
5669
5664
 
5670
5665
  // src/mnemonic/mnemonic.ts
5671
5666
  var import_crypto3 = require("@fuel-ts/crypto");
5672
5667
  var import_errors19 = require("@fuel-ts/errors");
5673
5668
  var import_hasher5 = require("@fuel-ts/hasher");
5674
5669
  var import_utils33 = require("@fuel-ts/utils");
5675
- var import_ethers3 = require("ethers");
5670
+ var import_ethers2 = require("ethers");
5676
5671
 
5677
5672
  // src/wordlists/words/english.ts
5678
5673
  var english = [
@@ -7926,7 +7921,7 @@ var Mnemonic = class {
7926
7921
  assertMnemonic(getWords(phrase));
7927
7922
  const phraseBytes = toUtf8Bytes(getPhrase(phrase));
7928
7923
  const salt = toUtf8Bytes(`mnemonic${passphrase}`);
7929
- return (0, import_ethers3.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7924
+ return (0, import_ethers2.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
7930
7925
  }
7931
7926
  /**
7932
7927
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -7988,7 +7983,7 @@ var Mnemonic = class {
7988
7983
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7989
7984
  );
7990
7985
  }
7991
- return (0, import_utils33.arrayify)((0, import_ethers3.computeHmac)("sha512", MasterSecret, seedArray));
7986
+ return (0, import_utils33.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7992
7987
  }
7993
7988
  /**
7994
7989
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8013,8 +8008,8 @@ var Mnemonic = class {
8013
8008
  chainCode,
8014
8009
  (0, import_utils33.concat)(["0x00", privateKey])
8015
8010
  ]);
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]));
8011
+ const checksum = (0, import_ethers2.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8012
+ return (0, import_ethers2.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8018
8013
  }
8019
8014
  /**
8020
8015
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -8042,7 +8037,7 @@ var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
8042
8037
  var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
8043
8038
  var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
8044
8039
  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)]));
8040
+ 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
8041
  }
8047
8042
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8048
8043
  if (isPublic) {
@@ -8098,7 +8093,7 @@ var HDWallet = class {
8098
8093
  this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
8099
8094
  }
8100
8095
  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);
8096
+ this.fingerprint = (0, import_ethers3.dataSlice)((0, import_ethers3.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8102
8097
  this.depth = config.depth || this.depth;
8103
8098
  this.index = config.index || this.index;
8104
8099
  this.chainCode = config.chainCode;
@@ -8130,7 +8125,7 @@ var HDWallet = class {
8130
8125
  data.set((0, import_utils35.arrayify)(this.publicKey));
8131
8126
  }
8132
8127
  data.set((0, import_math20.toBytes)(index, 4), 33);
8133
- const bytes = (0, import_utils35.arrayify)((0, import_ethers4.computeHmac)("sha512", chainCode, data));
8128
+ const bytes = (0, import_utils35.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
8134
8129
  const IL = bytes.slice(0, 32);
8135
8130
  const IR = bytes.slice(32);
8136
8131
  if (privateKey) {
@@ -8201,7 +8196,7 @@ var HDWallet = class {
8201
8196
  });
8202
8197
  }
8203
8198
  static fromExtendedKey(extendedKey) {
8204
- const decoded = (0, import_ethers4.toBeHex)((0, import_ethers4.decodeBase58)(extendedKey));
8199
+ const decoded = (0, import_ethers3.toBeHex)((0, import_ethers3.decodeBase58)(extendedKey));
8205
8200
  const bytes = (0, import_utils35.arrayify)(decoded);
8206
8201
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8207
8202
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -8816,7 +8811,6 @@ var StorageAbstract = class {
8816
8811
  // src/predicate/predicate.ts
8817
8812
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
8818
8813
  var import_address10 = require("@fuel-ts/address");
8819
- var import_configs13 = require("@fuel-ts/address/configs");
8820
8814
  var import_errors25 = require("@fuel-ts/errors");
8821
8815
  var import_transactions20 = require("@fuel-ts/transactions");
8822
8816
  var import_utils37 = require("@fuel-ts/utils");
@@ -8894,8 +8888,9 @@ var Predicate = class extends Account {
8894
8888
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8895
8889
  * @returns A promise that resolves to the prepared transaction request.
8896
8890
  */
8897
- async createTransfer(destination, amount, assetId = import_configs13.BaseAssetId, txParams = {}) {
8898
- const request = await super.createTransfer(destination, amount, assetId, txParams);
8891
+ async createTransfer(destination, amount, assetId, txParams = {}) {
8892
+ const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
8893
+ const request = await super.createTransfer(destination, amount, assetIdToTransfer, txParams);
8899
8894
  return this.populateTransactionPredicateData(request);
8900
8895
  }
8901
8896
  /**