@fuel-ts/account 0.0.0-pr-2143-20240510170046 → 0.0.0-pr-2143-20240513112950

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.

Files changed (31) hide show
  1. package/dist/hdwallet/hdwallet.d.ts.map +1 -1
  2. package/dist/index.global.js +1373 -1574
  3. package/dist/index.global.js.map +1 -1
  4. package/dist/index.js +337 -269
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +237 -176
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/mnemonic/mnemonic.d.ts.map +1 -1
  9. package/dist/predicate/predicate.d.ts +9 -2
  10. package/dist/predicate/predicate.d.ts.map +1 -1
  11. package/dist/providers/provider.d.ts +1 -1
  12. package/dist/providers/provider.d.ts.map +1 -1
  13. package/dist/providers/transaction-request/helpers.d.ts +4 -0
  14. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  15. package/dist/providers/transaction-request/index.d.ts +1 -0
  16. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  17. package/dist/providers/transaction-request/transaction-request.d.ts +2 -0
  18. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  19. package/dist/providers/transaction-request/utils.d.ts +0 -4
  20. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  21. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  22. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  23. package/dist/test-utils.global.js +1326 -1568
  24. package/dist/test-utils.global.js.map +1 -1
  25. package/dist/test-utils.js +282 -269
  26. package/dist/test-utils.js.map +1 -1
  27. package/dist/test-utils.mjs +192 -179
  28. package/dist/test-utils.mjs.map +1 -1
  29. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  30. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  31. package/package.json +15 -16
@@ -68,7 +68,7 @@ var addAmountToCoinQuantities = (params) => {
68
68
  // src/providers/provider.ts
69
69
  import { Address as Address2 } from "@fuel-ts/address";
70
70
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
71
- import { BN, bn as bn17 } from "@fuel-ts/math";
71
+ import { BN, bn as bn18 } from "@fuel-ts/math";
72
72
  import {
73
73
  InputType as InputType7,
74
74
  TransactionType as TransactionType8,
@@ -1291,11 +1291,11 @@ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
1291
1291
  import { Address, addressify } from "@fuel-ts/address";
1292
1292
  import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1293
1293
  import { randomBytes } from "@fuel-ts/crypto";
1294
- import { bn as bn7 } from "@fuel-ts/math";
1294
+ import { bn as bn8 } from "@fuel-ts/math";
1295
1295
  import {
1296
1296
  PolicyType,
1297
1297
  TransactionCoder,
1298
- InputType as InputType2,
1298
+ InputType as InputType3,
1299
1299
  OutputType as OutputType2,
1300
1300
  TransactionType
1301
1301
  } from "@fuel-ts/transactions";
@@ -1744,6 +1744,36 @@ var NoWitnessAtIndexError = class extends Error {
1744
1744
  name = "NoWitnessAtIndexError";
1745
1745
  };
1746
1746
 
1747
+ // src/providers/transaction-request/helpers.ts
1748
+ import { bn as bn7 } from "@fuel-ts/math";
1749
+ import { InputType as InputType2 } from "@fuel-ts/transactions";
1750
+ var isRequestInputCoin = (input) => input.type === InputType2.Coin;
1751
+ var isRequestInputMessage = (input) => input.type === InputType2.Message;
1752
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
1753
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
1754
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
1755
+ return acc.add(input.amount);
1756
+ }
1757
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
1758
+ return acc.add(input.amount);
1759
+ }
1760
+ return acc;
1761
+ }, bn7(0));
1762
+ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
1763
+ (acc, input) => {
1764
+ if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
1765
+ acc.utxos.push(input.id);
1766
+ } else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
1767
+ acc.messages.push(input.nonce);
1768
+ }
1769
+ return acc;
1770
+ },
1771
+ {
1772
+ utxos: [],
1773
+ messages: []
1774
+ }
1775
+ );
1776
+
1747
1777
  // src/providers/transaction-request/witness.ts
1748
1778
  import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
1749
1779
  var witnessify = (value) => {
@@ -1784,10 +1814,10 @@ var BaseTransactionRequest = class {
1784
1814
  outputs,
1785
1815
  witnesses
1786
1816
  } = {}) {
1787
- this.tip = tip ? bn7(tip) : void 0;
1817
+ this.tip = tip ? bn8(tip) : void 0;
1788
1818
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
1789
- this.witnessLimit = isDefined(witnessLimit) ? bn7(witnessLimit) : void 0;
1790
- this.maxFee = bn7(maxFee);
1819
+ this.witnessLimit = isDefined(witnessLimit) ? bn8(witnessLimit) : void 0;
1820
+ this.maxFee = bn8(maxFee);
1791
1821
  this.inputs = inputs ?? [];
1792
1822
  this.outputs = outputs ?? [];
1793
1823
  this.witnesses = witnesses ?? [];
@@ -1796,13 +1826,13 @@ var BaseTransactionRequest = class {
1796
1826
  let policyTypes = 0;
1797
1827
  const policies = [];
1798
1828
  const { tip, witnessLimit, maturity } = req;
1799
- if (bn7(tip).gt(0)) {
1829
+ if (bn8(tip).gt(0)) {
1800
1830
  policyTypes += PolicyType.Tip;
1801
- policies.push({ data: bn7(tip), type: PolicyType.Tip });
1831
+ policies.push({ data: bn8(tip), type: PolicyType.Tip });
1802
1832
  }
1803
- if (isDefined(witnessLimit) && bn7(witnessLimit).gte(0)) {
1833
+ if (isDefined(witnessLimit) && bn8(witnessLimit).gte(0)) {
1804
1834
  policyTypes += PolicyType.WitnessLimit;
1805
- policies.push({ data: bn7(witnessLimit), type: PolicyType.WitnessLimit });
1835
+ policies.push({ data: bn8(witnessLimit), type: PolicyType.WitnessLimit });
1806
1836
  }
1807
1837
  if (maturity && maturity > 0) {
1808
1838
  policyTypes += PolicyType.Maturity;
@@ -1933,7 +1963,7 @@ var BaseTransactionRequest = class {
1933
1963
  */
1934
1964
  getCoinInputs() {
1935
1965
  return this.inputs.filter(
1936
- (input) => input.type === InputType2.Coin
1966
+ (input) => input.type === InputType3.Coin
1937
1967
  );
1938
1968
  }
1939
1969
  /**
@@ -1965,9 +1995,9 @@ var BaseTransactionRequest = class {
1965
1995
  const ownerAddress = addressify(owner);
1966
1996
  const found = this.inputs.find((input) => {
1967
1997
  switch (input.type) {
1968
- case InputType2.Coin:
1998
+ case InputType3.Coin:
1969
1999
  return hexlify7(input.owner) === ownerAddress.toB256();
1970
- case InputType2.Message:
2000
+ case InputType3.Message:
1971
2001
  return hexlify7(input.recipient) === ownerAddress.toB256();
1972
2002
  default:
1973
2003
  return false;
@@ -1982,7 +2012,7 @@ var BaseTransactionRequest = class {
1982
2012
  * @param coin - Coin resource.
1983
2013
  */
1984
2014
  addCoinInput(coin) {
1985
- const { assetId, owner, amount } = coin;
2015
+ const { assetId, owner, amount, id, predicate } = coin;
1986
2016
  let witnessIndex;
1987
2017
  if (coin.predicate) {
1988
2018
  witnessIndex = 0;
@@ -1993,13 +2023,14 @@ var BaseTransactionRequest = class {
1993
2023
  }
1994
2024
  }
1995
2025
  const input = {
1996
- ...coin,
1997
- type: InputType2.Coin,
2026
+ id,
2027
+ type: InputType3.Coin,
1998
2028
  owner: owner.toB256(),
1999
2029
  amount,
2000
2030
  assetId,
2001
2031
  txPointer: "0x00000000000000000000000000000000",
2002
- witnessIndex
2032
+ witnessIndex,
2033
+ predicate
2003
2034
  };
2004
2035
  this.pushInput(input);
2005
2036
  this.addChangeOutput(owner, assetId);
@@ -2011,7 +2042,7 @@ var BaseTransactionRequest = class {
2011
2042
  * @param message - Message resource.
2012
2043
  */
2013
2044
  addMessageInput(message) {
2014
- const { recipient, sender, amount, assetId } = message;
2045
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
2015
2046
  let witnessIndex;
2016
2047
  if (message.predicate) {
2017
2048
  witnessIndex = 0;
@@ -2022,12 +2053,13 @@ var BaseTransactionRequest = class {
2022
2053
  }
2023
2054
  }
2024
2055
  const input = {
2025
- ...message,
2026
- type: InputType2.Message,
2056
+ nonce,
2057
+ type: InputType3.Message,
2027
2058
  sender: sender.toB256(),
2028
2059
  recipient: recipient.toB256(),
2029
2060
  amount,
2030
- witnessIndex
2061
+ witnessIndex,
2062
+ predicate
2031
2063
  };
2032
2064
  this.pushInput(input);
2033
2065
  this.addChangeOutput(recipient, assetId);
@@ -2174,7 +2206,7 @@ var BaseTransactionRequest = class {
2174
2206
  const assetInput = findAssetInput(assetId);
2175
2207
  let usedQuantity = quantity;
2176
2208
  if (assetId === baseAssetId) {
2177
- usedQuantity = bn7("1000000000000000000");
2209
+ usedQuantity = bn8("1000000000000000000");
2178
2210
  }
2179
2211
  if (assetInput && "assetId" in assetInput) {
2180
2212
  assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
@@ -2186,13 +2218,13 @@ var BaseTransactionRequest = class {
2186
2218
  amount: usedQuantity,
2187
2219
  assetId,
2188
2220
  owner: resourcesOwner || Address.fromRandom(),
2189
- blockCreated: bn7(1),
2190
- txCreatedIdx: bn7(1)
2221
+ blockCreated: bn8(1),
2222
+ txCreatedIdx: bn8(1)
2191
2223
  }
2192
2224
  ]);
2193
2225
  }
2194
2226
  };
2195
- updateAssetInput(baseAssetId, bn7(1e11));
2227
+ updateAssetInput(baseAssetId, bn8(1e11));
2196
2228
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2197
2229
  }
2198
2230
  /**
@@ -2203,7 +2235,7 @@ var BaseTransactionRequest = class {
2203
2235
  */
2204
2236
  getCoinOutputsQuantities() {
2205
2237
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2206
- amount: bn7(amount),
2238
+ amount: bn8(amount),
2207
2239
  assetId: assetId.toString()
2208
2240
  }));
2209
2241
  return coinsQuantities;
@@ -2217,22 +2249,33 @@ var BaseTransactionRequest = class {
2217
2249
  toJSON() {
2218
2250
  return normalizeJSON(this);
2219
2251
  }
2252
+ removeWitness(index) {
2253
+ this.witnesses.splice(index, 1);
2254
+ this.adjustWitnessIndexes(index);
2255
+ }
2256
+ adjustWitnessIndexes(removedIndex) {
2257
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
2258
+ if (input.witnessIndex > removedIndex) {
2259
+ input.witnessIndex -= 1;
2260
+ }
2261
+ });
2262
+ }
2220
2263
  updatePredicateGasUsed(inputs) {
2221
2264
  this.inputs.forEach((i) => {
2222
2265
  let correspondingInput;
2223
2266
  switch (i.type) {
2224
- case InputType2.Coin:
2225
- correspondingInput = inputs.find((x) => x.type === InputType2.Coin && x.owner === i.owner);
2267
+ case InputType3.Coin:
2268
+ correspondingInput = inputs.find((x) => x.type === InputType3.Coin && x.owner === i.owner);
2226
2269
  break;
2227
- case InputType2.Message:
2270
+ case InputType3.Message:
2228
2271
  correspondingInput = inputs.find(
2229
- (x) => x.type === InputType2.Message && x.sender === i.sender
2272
+ (x) => x.type === InputType3.Message && x.sender === i.sender
2230
2273
  );
2231
2274
  break;
2232
2275
  default:
2233
2276
  return;
2234
2277
  }
2235
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2278
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn8(correspondingInput.predicateGasUsed).gt(0)) {
2236
2279
  i.predicate = correspondingInput.predicate;
2237
2280
  i.predicateData = correspondingInput.predicateData;
2238
2281
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2252,15 +2295,15 @@ var BaseTransactionRequest = class {
2252
2295
 
2253
2296
  // src/providers/transaction-request/create-transaction-request.ts
2254
2297
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2255
- import { bn as bn9 } from "@fuel-ts/math";
2298
+ import { bn as bn10 } from "@fuel-ts/math";
2256
2299
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2257
2300
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2258
2301
 
2259
2302
  // src/providers/transaction-request/hash-transaction.ts
2260
2303
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2261
2304
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2262
- import { bn as bn8 } from "@fuel-ts/math";
2263
- import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2305
+ import { bn as bn9 } from "@fuel-ts/math";
2306
+ import { TransactionType as TransactionType2, InputType as InputType4, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2264
2307
  import { concat as concat2 } from "@fuel-ts/utils";
2265
2308
  import { clone as clone2 } from "ramda";
2266
2309
  function hashTransaction(transactionRequest, chainId) {
@@ -2271,19 +2314,19 @@ function hashTransaction(transactionRequest, chainId) {
2271
2314
  transaction.inputs = transaction.inputs.map((input) => {
2272
2315
  const inputClone = clone2(input);
2273
2316
  switch (inputClone.type) {
2274
- case InputType3.Coin: {
2317
+ case InputType4.Coin: {
2275
2318
  inputClone.txPointer = {
2276
2319
  blockHeight: 0,
2277
2320
  txIndex: 0
2278
2321
  };
2279
- inputClone.predicateGasUsed = bn8(0);
2322
+ inputClone.predicateGasUsed = bn9(0);
2280
2323
  return inputClone;
2281
2324
  }
2282
- case InputType3.Message: {
2283
- inputClone.predicateGasUsed = bn8(0);
2325
+ case InputType4.Message: {
2326
+ inputClone.predicateGasUsed = bn9(0);
2284
2327
  return inputClone;
2285
2328
  }
2286
- case InputType3.Contract: {
2329
+ case InputType4.Contract: {
2287
2330
  inputClone.txPointer = {
2288
2331
  blockHeight: 0,
2289
2332
  txIndex: 0
@@ -2307,12 +2350,12 @@ function hashTransaction(transactionRequest, chainId) {
2307
2350
  return outputClone;
2308
2351
  }
2309
2352
  case OutputType3.Change: {
2310
- outputClone.amount = bn8(0);
2353
+ outputClone.amount = bn9(0);
2311
2354
  return outputClone;
2312
2355
  }
2313
2356
  case OutputType3.Variable: {
2314
2357
  outputClone.to = ZeroBytes325;
2315
- outputClone.amount = bn8(0);
2358
+ outputClone.amount = bn9(0);
2316
2359
  outputClone.assetId = ZeroBytes325;
2317
2360
  return outputClone;
2318
2361
  }
@@ -2390,7 +2433,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2390
2433
  type: TransactionType3.Create,
2391
2434
  ...baseTransaction,
2392
2435
  bytecodeWitnessIndex,
2393
- storageSlotsCount: bn9(storageSlots.length),
2436
+ storageSlotsCount: bn10(storageSlots.length),
2394
2437
  salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
2395
2438
  storageSlots
2396
2439
  };
@@ -2430,7 +2473,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2430
2473
  }
2431
2474
  metadataGas(gasCosts) {
2432
2475
  return calculateMetadataGasForTxCreate({
2433
- contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2476
+ contractBytesSize: bn10(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2434
2477
  gasCosts,
2435
2478
  stateRootSize: this.storageSlots.length,
2436
2479
  txBytesSize: this.byteSize()
@@ -2442,8 +2485,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2442
2485
  import { Interface } from "@fuel-ts/abi-coder";
2443
2486
  import { addressify as addressify2 } from "@fuel-ts/address";
2444
2487
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2445
- import { bn as bn10 } from "@fuel-ts/math";
2446
- import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2488
+ import { bn as bn11 } from "@fuel-ts/math";
2489
+ import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2447
2490
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2448
2491
 
2449
2492
  // src/providers/transaction-request/scripts.ts
@@ -2496,7 +2539,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2496
2539
  */
2497
2540
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2498
2541
  super(rest);
2499
- this.gasLimit = bn10(gasLimit);
2542
+ this.gasLimit = bn11(gasLimit);
2500
2543
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2501
2544
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2502
2545
  this.abis = rest.abis;
@@ -2513,8 +2556,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2513
2556
  type: TransactionType4.Script,
2514
2557
  scriptGasLimit: this.gasLimit,
2515
2558
  ...super.getBaseTransaction(),
2516
- scriptLength: bn10(script.length),
2517
- scriptDataLength: bn10(scriptData.length),
2559
+ scriptLength: bn11(script.length),
2560
+ scriptDataLength: bn11(scriptData.length),
2518
2561
  receiptsRoot: ZeroBytes327,
2519
2562
  script: hexlify10(script),
2520
2563
  scriptData: hexlify10(scriptData)
@@ -2527,7 +2570,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2527
2570
  */
2528
2571
  getContractInputs() {
2529
2572
  return this.inputs.filter(
2530
- (input) => input.type === InputType4.Contract
2573
+ (input) => input.type === InputType5.Contract
2531
2574
  );
2532
2575
  }
2533
2576
  /**
@@ -2607,7 +2650,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2607
2650
  return this;
2608
2651
  }
2609
2652
  const inputIndex = super.pushInput({
2610
- type: InputType4.Contract,
2653
+ type: InputType5.Contract,
2611
2654
  contractId: contractAddress.toB256(),
2612
2655
  txPointer: "0x00000000000000000000000000000000"
2613
2656
  });
@@ -2649,7 +2692,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2649
2692
 
2650
2693
  // src/providers/transaction-request/utils.ts
2651
2694
  import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2652
- import { TransactionType as TransactionType5, InputType as InputType5 } from "@fuel-ts/transactions";
2695
+ import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2653
2696
  var transactionRequestify = (obj) => {
2654
2697
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2655
2698
  return obj;
@@ -2667,35 +2710,20 @@ var transactionRequestify = (obj) => {
2667
2710
  }
2668
2711
  }
2669
2712
  };
2670
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2671
- (acc, input) => {
2672
- if (input.type === InputType5.Coin && input.owner === owner.toB256()) {
2673
- acc.utxos.push(input.id);
2674
- }
2675
- if (input.type === InputType5.Message && input.recipient === owner.toB256()) {
2676
- acc.messages.push(input.nonce);
2677
- }
2678
- return acc;
2679
- },
2680
- {
2681
- utxos: [],
2682
- messages: []
2683
- }
2684
- );
2685
2713
 
2686
2714
  // src/providers/transaction-response/transaction-response.ts
2687
2715
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2688
- import { bn as bn16 } from "@fuel-ts/math";
2716
+ import { bn as bn17 } from "@fuel-ts/math";
2689
2717
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2690
2718
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2691
2719
 
2692
2720
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2693
- import { bn as bn15 } from "@fuel-ts/math";
2721
+ import { bn as bn16 } from "@fuel-ts/math";
2694
2722
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2695
2723
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2696
2724
 
2697
2725
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2698
- import { bn as bn11 } from "@fuel-ts/math";
2726
+ import { bn as bn12 } from "@fuel-ts/math";
2699
2727
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2700
2728
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2701
2729
  var calculateTXFeeForSummary = (params) => {
@@ -2709,19 +2737,19 @@ var calculateTXFeeForSummary = (params) => {
2709
2737
  if (totalFee) {
2710
2738
  return totalFee;
2711
2739
  }
2712
- const gasPerByte = bn11(feeParams.gasPerByte);
2713
- const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2740
+ const gasPerByte = bn12(feeParams.gasPerByte);
2741
+ const gasPriceFactor = bn12(feeParams.gasPriceFactor);
2714
2742
  const transactionBytes = arrayify9(rawPayload);
2715
2743
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2716
2744
  const { type, witnesses, inputs, policies } = transaction;
2717
- let metadataGas = bn11(0);
2718
- let gasLimit = bn11(0);
2745
+ let metadataGas = bn12(0);
2746
+ let gasLimit = bn12(0);
2719
2747
  if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
2720
- return bn11(0);
2748
+ return bn12(0);
2721
2749
  }
2722
2750
  if (type === TransactionType6.Create) {
2723
2751
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2724
- const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2752
+ const contractBytesSize = bn12(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2725
2753
  metadataGas = calculateMetadataGasForTxCreate({
2726
2754
  contractBytesSize,
2727
2755
  gasCosts,
@@ -2740,7 +2768,7 @@ var calculateTXFeeForSummary = (params) => {
2740
2768
  }
2741
2769
  const minGas = getMinGas({
2742
2770
  gasCosts,
2743
- gasPerByte: bn11(gasPerByte),
2771
+ gasPerByte: bn12(gasPerByte),
2744
2772
  inputs,
2745
2773
  metadataGas,
2746
2774
  txBytesSize: transactionBytes.length
@@ -2767,12 +2795,12 @@ var calculateTXFeeForSummary = (params) => {
2767
2795
  // src/providers/transaction-summary/operations.ts
2768
2796
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2769
2797
  import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2770
- import { bn as bn13 } from "@fuel-ts/math";
2798
+ import { bn as bn14 } from "@fuel-ts/math";
2771
2799
  import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2772
2800
 
2773
2801
  // src/providers/transaction-summary/call.ts
2774
2802
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2775
- import { bn as bn12 } from "@fuel-ts/math";
2803
+ import { bn as bn13 } from "@fuel-ts/math";
2776
2804
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2777
2805
  const abiInterface = new Interface2(abi);
2778
2806
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2781,7 +2809,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2781
2809
  let encodedArgs;
2782
2810
  if (functionFragment.isInputDataPointer) {
2783
2811
  if (rawPayload) {
2784
- const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2812
+ const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2785
2813
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2786
2814
  }
2787
2815
  } else {
@@ -2943,7 +2971,7 @@ var mergeAssets = (op1, op2) => {
2943
2971
  if (!matchingAsset) {
2944
2972
  return asset1;
2945
2973
  }
2946
- const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
2974
+ const mergedAmount = bn14(asset1.amount).add(matchingAsset.amount);
2947
2975
  return { ...asset1, amount: mergedAmount };
2948
2976
  });
2949
2977
  return mergedAssets.concat(filteredAssets);
@@ -3266,7 +3294,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3266
3294
 
3267
3295
  // src/providers/transaction-summary/status.ts
3268
3296
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3269
- import { bn as bn14 } from "@fuel-ts/math";
3297
+ import { bn as bn15 } from "@fuel-ts/math";
3270
3298
  var getTransactionStatusName = (gqlStatus) => {
3271
3299
  switch (gqlStatus) {
3272
3300
  case "FailureStatus":
@@ -3300,15 +3328,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3300
3328
  time = gqlTransactionStatus.time;
3301
3329
  blockId = gqlTransactionStatus.block.id;
3302
3330
  isStatusSuccess = true;
3303
- totalFee = bn14(gqlTransactionStatus.totalFee);
3304
- totalGas = bn14(gqlTransactionStatus.totalGas);
3331
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3332
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3305
3333
  break;
3306
3334
  case "FailureStatus":
3307
3335
  time = gqlTransactionStatus.time;
3308
3336
  blockId = gqlTransactionStatus.block.id;
3309
3337
  isStatusFailure = true;
3310
- totalFee = bn14(gqlTransactionStatus.totalFee);
3311
- totalGas = bn14(gqlTransactionStatus.totalGas);
3338
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3339
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3312
3340
  break;
3313
3341
  case "SubmittedStatus":
3314
3342
  time = gqlTransactionStatus.time;
@@ -3358,7 +3386,7 @@ function assembleTransactionSummary(params) {
3358
3386
  maxInputs
3359
3387
  });
3360
3388
  const typeName = getTransactionTypeName(transaction.type);
3361
- const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3389
+ const tip = bn16(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3362
3390
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3363
3391
  const fee = calculateTXFeeForSummary({
3364
3392
  totalFee,
@@ -3429,7 +3457,7 @@ var TransactionResponse = class {
3429
3457
  /** Current provider */
3430
3458
  provider;
3431
3459
  /** Gas used on the transaction */
3432
- gasUsed = bn16(0);
3460
+ gasUsed = bn17(0);
3433
3461
  /** The graphql Transaction with receipts object. */
3434
3462
  gqlTransaction;
3435
3463
  abis;
@@ -3663,47 +3691,47 @@ var processGqlChain = (chain) => {
3663
3691
  } = consensusParameters;
3664
3692
  return {
3665
3693
  name,
3666
- baseChainHeight: bn17(daHeight),
3694
+ baseChainHeight: bn18(daHeight),
3667
3695
  consensusParameters: {
3668
3696
  version,
3669
- chainId: bn17(chainId),
3697
+ chainId: bn18(chainId),
3670
3698
  baseAssetId,
3671
3699
  feeParameters: {
3672
3700
  version: feeParams.version,
3673
- gasPerByte: bn17(feeParams.gasPerByte),
3674
- gasPriceFactor: bn17(feeParams.gasPriceFactor)
3701
+ gasPerByte: bn18(feeParams.gasPerByte),
3702
+ gasPriceFactor: bn18(feeParams.gasPriceFactor)
3675
3703
  },
3676
3704
  contractParameters: {
3677
3705
  version: contractParams.version,
3678
- contractMaxSize: bn17(contractParams.contractMaxSize),
3679
- maxStorageSlots: bn17(contractParams.maxStorageSlots)
3706
+ contractMaxSize: bn18(contractParams.contractMaxSize),
3707
+ maxStorageSlots: bn18(contractParams.maxStorageSlots)
3680
3708
  },
3681
3709
  txParameters: {
3682
3710
  version: txParams.version,
3683
- maxInputs: bn17(txParams.maxInputs),
3684
- maxOutputs: bn17(txParams.maxOutputs),
3685
- maxWitnesses: bn17(txParams.maxWitnesses),
3686
- maxGasPerTx: bn17(txParams.maxGasPerTx),
3687
- maxSize: bn17(txParams.maxSize),
3688
- maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
3711
+ maxInputs: bn18(txParams.maxInputs),
3712
+ maxOutputs: bn18(txParams.maxOutputs),
3713
+ maxWitnesses: bn18(txParams.maxWitnesses),
3714
+ maxGasPerTx: bn18(txParams.maxGasPerTx),
3715
+ maxSize: bn18(txParams.maxSize),
3716
+ maxBytecodeSubsections: bn18(txParams.maxBytecodeSubsections)
3689
3717
  },
3690
3718
  predicateParameters: {
3691
3719
  version: predicateParams.version,
3692
- maxPredicateLength: bn17(predicateParams.maxPredicateLength),
3693
- maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
3694
- maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
3695
- maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
3720
+ maxPredicateLength: bn18(predicateParams.maxPredicateLength),
3721
+ maxPredicateDataLength: bn18(predicateParams.maxPredicateDataLength),
3722
+ maxGasPerPredicate: bn18(predicateParams.maxGasPerPredicate),
3723
+ maxMessageDataLength: bn18(predicateParams.maxMessageDataLength)
3696
3724
  },
3697
3725
  scriptParameters: {
3698
3726
  version: scriptParams.version,
3699
- maxScriptLength: bn17(scriptParams.maxScriptLength),
3700
- maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
3727
+ maxScriptLength: bn18(scriptParams.maxScriptLength),
3728
+ maxScriptDataLength: bn18(scriptParams.maxScriptDataLength)
3701
3729
  },
3702
3730
  gasCosts
3703
3731
  },
3704
3732
  latestBlock: {
3705
3733
  id: latestBlock.id,
3706
- height: bn17(latestBlock.height),
3734
+ height: bn18(latestBlock.height),
3707
3735
  time: latestBlock.header.time,
3708
3736
  transactions: latestBlock.transactions.map((i) => ({
3709
3737
  id: i.id
@@ -3899,7 +3927,7 @@ Supported fuel-core version: ${supportedVersion}.`
3899
3927
  */
3900
3928
  async getBlockNumber() {
3901
3929
  const { chain } = await this.operations.getChain();
3902
- return bn17(chain.latestBlock.height, 10);
3930
+ return bn18(chain.latestBlock.height, 10);
3903
3931
  }
3904
3932
  /**
3905
3933
  * Returns the chain information.
@@ -3909,8 +3937,8 @@ Supported fuel-core version: ${supportedVersion}.`
3909
3937
  async fetchNode() {
3910
3938
  const { nodeInfo } = await this.operations.getNodeInfo();
3911
3939
  const processedNodeInfo = {
3912
- maxDepth: bn17(nodeInfo.maxDepth),
3913
- maxTx: bn17(nodeInfo.maxTx),
3940
+ maxDepth: bn18(nodeInfo.maxDepth),
3941
+ maxTx: bn18(nodeInfo.maxTx),
3914
3942
  nodeVersion: nodeInfo.nodeVersion,
3915
3943
  utxoValidation: nodeInfo.utxoValidation,
3916
3944
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4042,7 +4070,7 @@ Supported fuel-core version: ${supportedVersion}.`
4042
4070
  } = response;
4043
4071
  if (inputs) {
4044
4072
  inputs.forEach((input, index) => {
4045
- if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
4073
+ if ("predicateGasUsed" in input && bn18(input.predicateGasUsed).gt(0)) {
4046
4074
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4047
4075
  }
4048
4076
  });
@@ -4200,12 +4228,12 @@ Supported fuel-core version: ${supportedVersion}.`
4200
4228
  gasPrice = await this.estimateGasPrice(10);
4201
4229
  }
4202
4230
  const minFee = calculateGasFee({
4203
- gasPrice: bn17(gasPrice),
4231
+ gasPrice: bn18(gasPrice),
4204
4232
  gas: minGas,
4205
4233
  priceFactor: gasPriceFactor,
4206
4234
  tip: transactionRequest.tip
4207
4235
  }).add(1);
4208
- let gasLimit = bn17(0);
4236
+ let gasLimit = bn18(0);
4209
4237
  if (transactionRequest.type === TransactionType8.Script) {
4210
4238
  gasLimit = transactionRequest.gasLimit;
4211
4239
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4218,7 +4246,7 @@ Supported fuel-core version: ${supportedVersion}.`
4218
4246
  }
4219
4247
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4220
4248
  const maxFee = calculateGasFee({
4221
- gasPrice: bn17(gasPrice),
4249
+ gasPrice: bn18(gasPrice),
4222
4250
  gas: maxGas,
4223
4251
  priceFactor: gasPriceFactor,
4224
4252
  tip: transactionRequest.tip
@@ -4283,7 +4311,7 @@ Supported fuel-core version: ${supportedVersion}.`
4283
4311
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4284
4312
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4285
4313
  if (isScriptTransaction) {
4286
- txRequestClone.gasLimit = bn17(0);
4314
+ txRequestClone.gasLimit = bn18(0);
4287
4315
  }
4288
4316
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4289
4317
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4304,7 +4332,7 @@ Supported fuel-core version: ${supportedVersion}.`
4304
4332
  let dryRunStatus;
4305
4333
  let missingContractIds = [];
4306
4334
  let outputVariables = 0;
4307
- let gasUsed = bn17(0);
4335
+ let gasUsed = bn18(0);
4308
4336
  txRequestClone.maxFee = maxFee;
4309
4337
  if (isScriptTransaction) {
4310
4338
  txRequestClone.gasLimit = gasLimit;
@@ -4369,10 +4397,10 @@ Supported fuel-core version: ${supportedVersion}.`
4369
4397
  return coins.map((coin) => ({
4370
4398
  id: coin.utxoId,
4371
4399
  assetId: coin.assetId,
4372
- amount: bn17(coin.amount),
4400
+ amount: bn18(coin.amount),
4373
4401
  owner: Address2.fromAddressOrString(coin.owner),
4374
- blockCreated: bn17(coin.blockCreated),
4375
- txCreatedIdx: bn17(coin.txCreatedIdx)
4402
+ blockCreated: bn18(coin.blockCreated),
4403
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4376
4404
  }));
4377
4405
  }
4378
4406
  /**
@@ -4409,9 +4437,9 @@ Supported fuel-core version: ${supportedVersion}.`
4409
4437
  switch (coin.type) {
4410
4438
  case "MessageCoin":
4411
4439
  return {
4412
- amount: bn17(coin.amount),
4440
+ amount: bn18(coin.amount),
4413
4441
  assetId: coin.assetId,
4414
- daHeight: bn17(coin.daHeight),
4442
+ daHeight: bn18(coin.daHeight),
4415
4443
  sender: Address2.fromAddressOrString(coin.sender),
4416
4444
  recipient: Address2.fromAddressOrString(coin.recipient),
4417
4445
  nonce: coin.nonce
@@ -4419,11 +4447,11 @@ Supported fuel-core version: ${supportedVersion}.`
4419
4447
  case "Coin":
4420
4448
  return {
4421
4449
  id: coin.utxoId,
4422
- amount: bn17(coin.amount),
4450
+ amount: bn18(coin.amount),
4423
4451
  assetId: coin.assetId,
4424
4452
  owner: Address2.fromAddressOrString(coin.owner),
4425
- blockCreated: bn17(coin.blockCreated),
4426
- txCreatedIdx: bn17(coin.txCreatedIdx)
4453
+ blockCreated: bn18(coin.blockCreated),
4454
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4427
4455
  };
4428
4456
  default:
4429
4457
  return null;
@@ -4440,13 +4468,13 @@ Supported fuel-core version: ${supportedVersion}.`
4440
4468
  async getBlock(idOrHeight) {
4441
4469
  let variables;
4442
4470
  if (typeof idOrHeight === "number") {
4443
- variables = { height: bn17(idOrHeight).toString(10) };
4471
+ variables = { height: bn18(idOrHeight).toString(10) };
4444
4472
  } else if (idOrHeight === "latest") {
4445
4473
  variables = { height: (await this.getBlockNumber()).toString(10) };
4446
4474
  } else if (idOrHeight.length === 66) {
4447
4475
  variables = { blockId: idOrHeight };
4448
4476
  } else {
4449
- variables = { blockId: bn17(idOrHeight).toString(10) };
4477
+ variables = { blockId: bn18(idOrHeight).toString(10) };
4450
4478
  }
4451
4479
  const { block } = await this.operations.getBlock(variables);
4452
4480
  if (!block) {
@@ -4454,7 +4482,7 @@ Supported fuel-core version: ${supportedVersion}.`
4454
4482
  }
4455
4483
  return {
4456
4484
  id: block.id,
4457
- height: bn17(block.height),
4485
+ height: bn18(block.height),
4458
4486
  time: block.header.time,
4459
4487
  transactionIds: block.transactions.map((tx) => tx.id)
4460
4488
  };
@@ -4469,7 +4497,7 @@ Supported fuel-core version: ${supportedVersion}.`
4469
4497
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4470
4498
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4471
4499
  id: block.id,
4472
- height: bn17(block.height),
4500
+ height: bn18(block.height),
4473
4501
  time: block.header.time,
4474
4502
  transactionIds: block.transactions.map((tx) => tx.id)
4475
4503
  }));
@@ -4484,7 +4512,7 @@ Supported fuel-core version: ${supportedVersion}.`
4484
4512
  async getBlockWithTransactions(idOrHeight) {
4485
4513
  let variables;
4486
4514
  if (typeof idOrHeight === "number") {
4487
- variables = { blockHeight: bn17(idOrHeight).toString(10) };
4515
+ variables = { blockHeight: bn18(idOrHeight).toString(10) };
4488
4516
  } else if (idOrHeight === "latest") {
4489
4517
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4490
4518
  } else {
@@ -4496,7 +4524,7 @@ Supported fuel-core version: ${supportedVersion}.`
4496
4524
  }
4497
4525
  return {
4498
4526
  id: block.id,
4499
- height: bn17(block.height, 10),
4527
+ height: bn18(block.height, 10),
4500
4528
  time: block.header.time,
4501
4529
  transactionIds: block.transactions.map((tx) => tx.id),
4502
4530
  transactions: block.transactions.map(
@@ -4545,7 +4573,7 @@ Supported fuel-core version: ${supportedVersion}.`
4545
4573
  contract: Address2.fromAddressOrString(contractId).toB256(),
4546
4574
  asset: hexlify12(assetId)
4547
4575
  });
4548
- return bn17(contractBalance.amount, 10);
4576
+ return bn18(contractBalance.amount, 10);
4549
4577
  }
4550
4578
  /**
4551
4579
  * Returns the balance for the given owner for the given asset ID.
@@ -4559,7 +4587,7 @@ Supported fuel-core version: ${supportedVersion}.`
4559
4587
  owner: Address2.fromAddressOrString(owner).toB256(),
4560
4588
  assetId: hexlify12(assetId)
4561
4589
  });
4562
- return bn17(balance.amount, 10);
4590
+ return bn18(balance.amount, 10);
4563
4591
  }
4564
4592
  /**
4565
4593
  * Returns balances for the given owner.
@@ -4577,7 +4605,7 @@ Supported fuel-core version: ${supportedVersion}.`
4577
4605
  const balances = result.balances.edges.map((edge) => edge.node);
4578
4606
  return balances.map((balance) => ({
4579
4607
  assetId: balance.assetId,
4580
- amount: bn17(balance.amount)
4608
+ amount: bn18(balance.amount)
4581
4609
  }));
4582
4610
  }
4583
4611
  /**
@@ -4599,15 +4627,15 @@ Supported fuel-core version: ${supportedVersion}.`
4599
4627
  sender: message.sender,
4600
4628
  recipient: message.recipient,
4601
4629
  nonce: message.nonce,
4602
- amount: bn17(message.amount),
4630
+ amount: bn18(message.amount),
4603
4631
  data: message.data
4604
4632
  }),
4605
4633
  sender: Address2.fromAddressOrString(message.sender),
4606
4634
  recipient: Address2.fromAddressOrString(message.recipient),
4607
4635
  nonce: message.nonce,
4608
- amount: bn17(message.amount),
4636
+ amount: bn18(message.amount),
4609
4637
  data: InputMessageCoder.decodeData(message.data),
4610
- daHeight: bn17(message.daHeight)
4638
+ daHeight: bn18(message.daHeight)
4611
4639
  }));
4612
4640
  }
4613
4641
  /**
@@ -4660,19 +4688,19 @@ Supported fuel-core version: ${supportedVersion}.`
4660
4688
  } = result.messageProof;
4661
4689
  return {
4662
4690
  messageProof: {
4663
- proofIndex: bn17(messageProof.proofIndex),
4691
+ proofIndex: bn18(messageProof.proofIndex),
4664
4692
  proofSet: messageProof.proofSet
4665
4693
  },
4666
4694
  blockProof: {
4667
- proofIndex: bn17(blockProof.proofIndex),
4695
+ proofIndex: bn18(blockProof.proofIndex),
4668
4696
  proofSet: blockProof.proofSet
4669
4697
  },
4670
4698
  messageBlockHeader: {
4671
4699
  id: messageBlockHeader.id,
4672
- daHeight: bn17(messageBlockHeader.daHeight),
4700
+ daHeight: bn18(messageBlockHeader.daHeight),
4673
4701
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4674
4702
  transactionsRoot: messageBlockHeader.transactionsRoot,
4675
- height: bn17(messageBlockHeader.height),
4703
+ height: bn18(messageBlockHeader.height),
4676
4704
  prevRoot: messageBlockHeader.prevRoot,
4677
4705
  time: messageBlockHeader.time,
4678
4706
  applicationHash: messageBlockHeader.applicationHash,
@@ -4684,10 +4712,10 @@ Supported fuel-core version: ${supportedVersion}.`
4684
4712
  },
4685
4713
  commitBlockHeader: {
4686
4714
  id: commitBlockHeader.id,
4687
- daHeight: bn17(commitBlockHeader.daHeight),
4715
+ daHeight: bn18(commitBlockHeader.daHeight),
4688
4716
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4689
4717
  transactionsRoot: commitBlockHeader.transactionsRoot,
4690
- height: bn17(commitBlockHeader.height),
4718
+ height: bn18(commitBlockHeader.height),
4691
4719
  prevRoot: commitBlockHeader.prevRoot,
4692
4720
  time: commitBlockHeader.time,
4693
4721
  applicationHash: commitBlockHeader.applicationHash,
@@ -4700,19 +4728,19 @@ Supported fuel-core version: ${supportedVersion}.`
4700
4728
  sender: Address2.fromAddressOrString(sender),
4701
4729
  recipient: Address2.fromAddressOrString(recipient),
4702
4730
  nonce,
4703
- amount: bn17(amount),
4731
+ amount: bn18(amount),
4704
4732
  data
4705
4733
  };
4706
4734
  }
4707
4735
  async getLatestGasPrice() {
4708
4736
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4709
- return bn17(latestGasPrice.gasPrice);
4737
+ return bn18(latestGasPrice.gasPrice);
4710
4738
  }
4711
4739
  async estimateGasPrice(blockHorizon) {
4712
4740
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4713
4741
  blockHorizon: String(blockHorizon)
4714
4742
  });
4715
- return bn17(estimateGasPrice.gasPrice);
4743
+ return bn18(estimateGasPrice.gasPrice);
4716
4744
  }
4717
4745
  /**
4718
4746
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4733,10 +4761,10 @@ Supported fuel-core version: ${supportedVersion}.`
4733
4761
  */
4734
4762
  async produceBlocks(amount, startTime) {
4735
4763
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4736
- blocksToProduce: bn17(amount).toString(10),
4764
+ blocksToProduce: bn18(amount).toString(10),
4737
4765
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4738
4766
  });
4739
- return bn17(latestBlockHeight);
4767
+ return bn18(latestBlockHeight);
4740
4768
  }
4741
4769
  // eslint-disable-next-line @typescript-eslint/require-await
4742
4770
  async getTransactionResponse(transactionId) {
@@ -4782,7 +4810,7 @@ __publicField(Provider, "nodeInfoCache", {});
4782
4810
 
4783
4811
  // src/providers/transaction-summary/get-transaction-summary.ts
4784
4812
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4785
- import { bn as bn18 } from "@fuel-ts/math";
4813
+ import { bn as bn19 } from "@fuel-ts/math";
4786
4814
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4787
4815
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4788
4816
 
@@ -4857,22 +4885,6 @@ var rawAssets = [
4857
4885
  ];
4858
4886
  var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
4859
4887
 
4860
- // src/providers/transaction-request/helpers.ts
4861
- import { bn as bn19 } from "@fuel-ts/math";
4862
- import { InputType as InputType8 } from "@fuel-ts/transactions";
4863
- var isRequestInputCoin = (input) => input.type === InputType8.Coin;
4864
- var isRequestInputMessage = (input) => input.type === InputType8.Message;
4865
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
4866
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
4867
- if (isRequestInputCoin(input) && input.assetId === assetId) {
4868
- return acc.add(input.amount);
4869
- }
4870
- if (isRequestInputMessage(input) && assetId === baseAsset) {
4871
- return acc.add(input.amount);
4872
- }
4873
- return acc;
4874
- }, bn19(0));
4875
-
4876
4888
  // src/utils/formatTransferToContractScriptData.ts
4877
4889
  import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
4878
4890
  import { BN as BN2 } from "@fuel-ts/math";
@@ -5110,7 +5122,7 @@ var Account = class extends AbstractAccount {
5110
5122
  while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5111
5123
  const resources = await this.getResourcesToSpend(
5112
5124
  missingQuantities,
5113
- cacheTxInputsFromOwner(request.inputs, this.address)
5125
+ cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5114
5126
  );
5115
5127
  request.addResources(resources);
5116
5128
  request.shiftPredicateData();
@@ -5686,18 +5698,17 @@ var BaseWalletUnlocked = class extends Account {
5686
5698
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5687
5699
 
5688
5700
  // src/hdwallet/hdwallet.ts
5701
+ import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
5689
5702
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5690
5703
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5691
5704
  import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5692
- import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5693
- import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5705
+ import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
5694
5706
 
5695
5707
  // src/mnemonic/mnemonic.ts
5696
- import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
5708
+ import { randomBytes as randomBytes4, pbkdf2, computeHmac } from "@fuel-ts/crypto";
5697
5709
  import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5698
5710
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5699
- import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5700
- import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
5711
+ import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4, dataSlice, encodeBase58 } from "@fuel-ts/utils";
5701
5712
 
5702
5713
  // src/wordlists/words/english.ts
5703
5714
  var english = [
@@ -8220,7 +8231,7 @@ var HDWallet = class {
8220
8231
  });
8221
8232
  }
8222
8233
  static fromExtendedKey(extendedKey) {
8223
- const decoded = toBeHex(decodeBase58(extendedKey));
8234
+ const decoded = hexlify17(toBytes2(decodeBase58(extendedKey)));
8224
8235
  const bytes = arrayify18(decoded);
8225
8236
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8226
8237
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -8420,16 +8431,18 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8420
8431
 
8421
8432
  // src/test-utils/seedTestWallet.ts
8422
8433
  import { randomBytes as randomBytes5 } from "@fuel-ts/crypto";
8423
- var seedTestWallet = async (wallet, quantities) => {
8424
- const genesisWallet = new WalletUnlocked(
8425
- process.env.GENESIS_SECRET || randomBytes5(32),
8426
- wallet.provider
8427
- );
8434
+ var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
8435
+ const accountsToBeFunded = Array.isArray(wallet) ? wallet : [wallet];
8436
+ const [{ provider }] = accountsToBeFunded;
8437
+ const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET || randomBytes5(32), provider);
8428
8438
  const request = new ScriptTransactionRequest();
8429
- quantities.forEach((quantity) => {
8430
- const { amount, assetId } = coinQuantityfy(quantity);
8431
- request.addCoinOutput(wallet.address, amount, assetId);
8432
- });
8439
+ quantities.map(coinQuantityfy).forEach(
8440
+ ({ amount, assetId }) => accountsToBeFunded.forEach(({ address }) => {
8441
+ for (let i = 0; i < utxosAmount; i++) {
8442
+ request.addCoinOutput(address, amount.div(utxosAmount), assetId);
8443
+ }
8444
+ })
8445
+ );
8433
8446
  const txCost = await genesisWallet.provider.getTransactionCost(request);
8434
8447
  request.gasLimit = txCost.gasUsed;
8435
8448
  request.maxFee = txCost.maxFee;