@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
package/dist/index.mjs CHANGED
@@ -73,7 +73,7 @@ var addAmountToCoinQuantities = (params) => {
73
73
  // src/providers/provider.ts
74
74
  import { Address as Address2 } from "@fuel-ts/address";
75
75
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
76
- import { BN, bn as bn17 } from "@fuel-ts/math";
76
+ import { BN, bn as bn18 } from "@fuel-ts/math";
77
77
  import {
78
78
  InputType as InputType7,
79
79
  TransactionType as TransactionType8,
@@ -1296,11 +1296,11 @@ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
1296
1296
  import { Address, addressify } from "@fuel-ts/address";
1297
1297
  import { ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1298
1298
  import { randomBytes } from "@fuel-ts/crypto";
1299
- import { bn as bn7 } from "@fuel-ts/math";
1299
+ import { bn as bn8 } from "@fuel-ts/math";
1300
1300
  import {
1301
1301
  PolicyType,
1302
1302
  TransactionCoder,
1303
- InputType as InputType2,
1303
+ InputType as InputType3,
1304
1304
  OutputType as OutputType2,
1305
1305
  TransactionType
1306
1306
  } from "@fuel-ts/transactions";
@@ -1823,6 +1823,52 @@ var NoWitnessByOwnerError = class extends Error {
1823
1823
  name = "NoWitnessByOwnerError";
1824
1824
  };
1825
1825
 
1826
+ // src/providers/transaction-request/helpers.ts
1827
+ import { bn as bn7 } from "@fuel-ts/math";
1828
+ import { InputType as InputType2 } from "@fuel-ts/transactions";
1829
+ var isRequestInputCoin = (input) => input.type === InputType2.Coin;
1830
+ var isRequestInputMessage = (input) => input.type === InputType2.Message;
1831
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
1832
+ var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
1833
+ var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
1834
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
1835
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
1836
+ return acc.add(input.amount);
1837
+ }
1838
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
1839
+ return acc.add(input.amount);
1840
+ }
1841
+ return acc;
1842
+ }, bn7(0));
1843
+ var cacheRequestInputsResources = (inputs) => inputs.filter(isRequestInputResource).reduce(
1844
+ (cache2, input) => {
1845
+ if (isRequestInputCoin(input)) {
1846
+ cache2.utxos.push(input.id);
1847
+ } else {
1848
+ cache2.messages.push(input.nonce);
1849
+ }
1850
+ return cache2;
1851
+ },
1852
+ {
1853
+ utxos: [],
1854
+ messages: []
1855
+ }
1856
+ );
1857
+ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
1858
+ (acc, input) => {
1859
+ if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
1860
+ acc.utxos.push(input.id);
1861
+ } else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
1862
+ acc.messages.push(input.nonce);
1863
+ }
1864
+ return acc;
1865
+ },
1866
+ {
1867
+ utxos: [],
1868
+ messages: []
1869
+ }
1870
+ );
1871
+
1826
1872
  // src/providers/transaction-request/witness.ts
1827
1873
  import { arrayify as arrayify4, hexlify as hexlify6 } from "@fuel-ts/utils";
1828
1874
  var witnessify = (value) => {
@@ -1863,10 +1909,10 @@ var BaseTransactionRequest = class {
1863
1909
  outputs,
1864
1910
  witnesses
1865
1911
  } = {}) {
1866
- this.tip = tip ? bn7(tip) : void 0;
1912
+ this.tip = tip ? bn8(tip) : void 0;
1867
1913
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
1868
- this.witnessLimit = isDefined(witnessLimit) ? bn7(witnessLimit) : void 0;
1869
- this.maxFee = bn7(maxFee);
1914
+ this.witnessLimit = isDefined(witnessLimit) ? bn8(witnessLimit) : void 0;
1915
+ this.maxFee = bn8(maxFee);
1870
1916
  this.inputs = inputs ?? [];
1871
1917
  this.outputs = outputs ?? [];
1872
1918
  this.witnesses = witnesses ?? [];
@@ -1875,13 +1921,13 @@ var BaseTransactionRequest = class {
1875
1921
  let policyTypes = 0;
1876
1922
  const policies = [];
1877
1923
  const { tip, witnessLimit, maturity } = req;
1878
- if (bn7(tip).gt(0)) {
1924
+ if (bn8(tip).gt(0)) {
1879
1925
  policyTypes += PolicyType.Tip;
1880
- policies.push({ data: bn7(tip), type: PolicyType.Tip });
1926
+ policies.push({ data: bn8(tip), type: PolicyType.Tip });
1881
1927
  }
1882
- if (isDefined(witnessLimit) && bn7(witnessLimit).gte(0)) {
1928
+ if (isDefined(witnessLimit) && bn8(witnessLimit).gte(0)) {
1883
1929
  policyTypes += PolicyType.WitnessLimit;
1884
- policies.push({ data: bn7(witnessLimit), type: PolicyType.WitnessLimit });
1930
+ policies.push({ data: bn8(witnessLimit), type: PolicyType.WitnessLimit });
1885
1931
  }
1886
1932
  if (maturity && maturity > 0) {
1887
1933
  policyTypes += PolicyType.Maturity;
@@ -2012,7 +2058,7 @@ var BaseTransactionRequest = class {
2012
2058
  */
2013
2059
  getCoinInputs() {
2014
2060
  return this.inputs.filter(
2015
- (input) => input.type === InputType2.Coin
2061
+ (input) => input.type === InputType3.Coin
2016
2062
  );
2017
2063
  }
2018
2064
  /**
@@ -2044,9 +2090,9 @@ var BaseTransactionRequest = class {
2044
2090
  const ownerAddress = addressify(owner);
2045
2091
  const found = this.inputs.find((input) => {
2046
2092
  switch (input.type) {
2047
- case InputType2.Coin:
2093
+ case InputType3.Coin:
2048
2094
  return hexlify7(input.owner) === ownerAddress.toB256();
2049
- case InputType2.Message:
2095
+ case InputType3.Message:
2050
2096
  return hexlify7(input.recipient) === ownerAddress.toB256();
2051
2097
  default:
2052
2098
  return false;
@@ -2061,7 +2107,7 @@ var BaseTransactionRequest = class {
2061
2107
  * @param coin - Coin resource.
2062
2108
  */
2063
2109
  addCoinInput(coin) {
2064
- const { assetId, owner, amount } = coin;
2110
+ const { assetId, owner, amount, id, predicate } = coin;
2065
2111
  let witnessIndex;
2066
2112
  if (coin.predicate) {
2067
2113
  witnessIndex = 0;
@@ -2072,13 +2118,14 @@ var BaseTransactionRequest = class {
2072
2118
  }
2073
2119
  }
2074
2120
  const input = {
2075
- ...coin,
2076
- type: InputType2.Coin,
2121
+ id,
2122
+ type: InputType3.Coin,
2077
2123
  owner: owner.toB256(),
2078
2124
  amount,
2079
2125
  assetId,
2080
2126
  txPointer: "0x00000000000000000000000000000000",
2081
- witnessIndex
2127
+ witnessIndex,
2128
+ predicate
2082
2129
  };
2083
2130
  this.pushInput(input);
2084
2131
  this.addChangeOutput(owner, assetId);
@@ -2090,7 +2137,7 @@ var BaseTransactionRequest = class {
2090
2137
  * @param message - Message resource.
2091
2138
  */
2092
2139
  addMessageInput(message) {
2093
- const { recipient, sender, amount, assetId } = message;
2140
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
2094
2141
  let witnessIndex;
2095
2142
  if (message.predicate) {
2096
2143
  witnessIndex = 0;
@@ -2101,12 +2148,13 @@ var BaseTransactionRequest = class {
2101
2148
  }
2102
2149
  }
2103
2150
  const input = {
2104
- ...message,
2105
- type: InputType2.Message,
2151
+ nonce,
2152
+ type: InputType3.Message,
2106
2153
  sender: sender.toB256(),
2107
2154
  recipient: recipient.toB256(),
2108
2155
  amount,
2109
- witnessIndex
2156
+ witnessIndex,
2157
+ predicate
2110
2158
  };
2111
2159
  this.pushInput(input);
2112
2160
  this.addChangeOutput(recipient, assetId);
@@ -2253,7 +2301,7 @@ var BaseTransactionRequest = class {
2253
2301
  const assetInput = findAssetInput(assetId);
2254
2302
  let usedQuantity = quantity;
2255
2303
  if (assetId === baseAssetId) {
2256
- usedQuantity = bn7("1000000000000000000");
2304
+ usedQuantity = bn8("1000000000000000000");
2257
2305
  }
2258
2306
  if (assetInput && "assetId" in assetInput) {
2259
2307
  assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
@@ -2265,13 +2313,13 @@ var BaseTransactionRequest = class {
2265
2313
  amount: usedQuantity,
2266
2314
  assetId,
2267
2315
  owner: resourcesOwner || Address.fromRandom(),
2268
- blockCreated: bn7(1),
2269
- txCreatedIdx: bn7(1)
2316
+ blockCreated: bn8(1),
2317
+ txCreatedIdx: bn8(1)
2270
2318
  }
2271
2319
  ]);
2272
2320
  }
2273
2321
  };
2274
- updateAssetInput(baseAssetId, bn7(1e11));
2322
+ updateAssetInput(baseAssetId, bn8(1e11));
2275
2323
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2276
2324
  }
2277
2325
  /**
@@ -2282,7 +2330,7 @@ var BaseTransactionRequest = class {
2282
2330
  */
2283
2331
  getCoinOutputsQuantities() {
2284
2332
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2285
- amount: bn7(amount),
2333
+ amount: bn8(amount),
2286
2334
  assetId: assetId.toString()
2287
2335
  }));
2288
2336
  return coinsQuantities;
@@ -2296,22 +2344,33 @@ var BaseTransactionRequest = class {
2296
2344
  toJSON() {
2297
2345
  return normalizeJSON(this);
2298
2346
  }
2347
+ removeWitness(index) {
2348
+ this.witnesses.splice(index, 1);
2349
+ this.adjustWitnessIndexes(index);
2350
+ }
2351
+ adjustWitnessIndexes(removedIndex) {
2352
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
2353
+ if (input.witnessIndex > removedIndex) {
2354
+ input.witnessIndex -= 1;
2355
+ }
2356
+ });
2357
+ }
2299
2358
  updatePredicateGasUsed(inputs) {
2300
2359
  this.inputs.forEach((i) => {
2301
2360
  let correspondingInput;
2302
2361
  switch (i.type) {
2303
- case InputType2.Coin:
2304
- correspondingInput = inputs.find((x) => x.type === InputType2.Coin && x.owner === i.owner);
2362
+ case InputType3.Coin:
2363
+ correspondingInput = inputs.find((x) => x.type === InputType3.Coin && x.owner === i.owner);
2305
2364
  break;
2306
- case InputType2.Message:
2365
+ case InputType3.Message:
2307
2366
  correspondingInput = inputs.find(
2308
- (x) => x.type === InputType2.Message && x.sender === i.sender
2367
+ (x) => x.type === InputType3.Message && x.sender === i.sender
2309
2368
  );
2310
2369
  break;
2311
2370
  default:
2312
2371
  return;
2313
2372
  }
2314
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2373
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn8(correspondingInput.predicateGasUsed).gt(0)) {
2315
2374
  i.predicate = correspondingInput.predicate;
2316
2375
  i.predicateData = correspondingInput.predicateData;
2317
2376
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2331,15 +2390,15 @@ var BaseTransactionRequest = class {
2331
2390
 
2332
2391
  // src/providers/transaction-request/create-transaction-request.ts
2333
2392
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2334
- import { bn as bn9 } from "@fuel-ts/math";
2393
+ import { bn as bn10 } from "@fuel-ts/math";
2335
2394
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2336
2395
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2337
2396
 
2338
2397
  // src/providers/transaction-request/hash-transaction.ts
2339
2398
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2340
2399
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2341
- import { bn as bn8 } from "@fuel-ts/math";
2342
- import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2400
+ import { bn as bn9 } from "@fuel-ts/math";
2401
+ import { TransactionType as TransactionType2, InputType as InputType4, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2343
2402
  import { concat as concat2 } from "@fuel-ts/utils";
2344
2403
  import { clone as clone2 } from "ramda";
2345
2404
  function hashTransaction(transactionRequest, chainId) {
@@ -2350,19 +2409,19 @@ function hashTransaction(transactionRequest, chainId) {
2350
2409
  transaction.inputs = transaction.inputs.map((input) => {
2351
2410
  const inputClone = clone2(input);
2352
2411
  switch (inputClone.type) {
2353
- case InputType3.Coin: {
2412
+ case InputType4.Coin: {
2354
2413
  inputClone.txPointer = {
2355
2414
  blockHeight: 0,
2356
2415
  txIndex: 0
2357
2416
  };
2358
- inputClone.predicateGasUsed = bn8(0);
2417
+ inputClone.predicateGasUsed = bn9(0);
2359
2418
  return inputClone;
2360
2419
  }
2361
- case InputType3.Message: {
2362
- inputClone.predicateGasUsed = bn8(0);
2420
+ case InputType4.Message: {
2421
+ inputClone.predicateGasUsed = bn9(0);
2363
2422
  return inputClone;
2364
2423
  }
2365
- case InputType3.Contract: {
2424
+ case InputType4.Contract: {
2366
2425
  inputClone.txPointer = {
2367
2426
  blockHeight: 0,
2368
2427
  txIndex: 0
@@ -2386,12 +2445,12 @@ function hashTransaction(transactionRequest, chainId) {
2386
2445
  return outputClone;
2387
2446
  }
2388
2447
  case OutputType3.Change: {
2389
- outputClone.amount = bn8(0);
2448
+ outputClone.amount = bn9(0);
2390
2449
  return outputClone;
2391
2450
  }
2392
2451
  case OutputType3.Variable: {
2393
2452
  outputClone.to = ZeroBytes325;
2394
- outputClone.amount = bn8(0);
2453
+ outputClone.amount = bn9(0);
2395
2454
  outputClone.assetId = ZeroBytes325;
2396
2455
  return outputClone;
2397
2456
  }
@@ -2469,7 +2528,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2469
2528
  type: TransactionType3.Create,
2470
2529
  ...baseTransaction,
2471
2530
  bytecodeWitnessIndex,
2472
- storageSlotsCount: bn9(storageSlots.length),
2531
+ storageSlotsCount: bn10(storageSlots.length),
2473
2532
  salt: this.salt ? hexlify9(this.salt) : ZeroBytes326,
2474
2533
  storageSlots
2475
2534
  };
@@ -2509,7 +2568,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2509
2568
  }
2510
2569
  metadataGas(gasCosts) {
2511
2570
  return calculateMetadataGasForTxCreate({
2512
- contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2571
+ contractBytesSize: bn10(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2513
2572
  gasCosts,
2514
2573
  stateRootSize: this.storageSlots.length,
2515
2574
  txBytesSize: this.byteSize()
@@ -2521,8 +2580,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2521
2580
  import { Interface } from "@fuel-ts/abi-coder";
2522
2581
  import { addressify as addressify2 } from "@fuel-ts/address";
2523
2582
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2524
- import { bn as bn10 } from "@fuel-ts/math";
2525
- import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2583
+ import { bn as bn11 } from "@fuel-ts/math";
2584
+ import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2526
2585
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2527
2586
 
2528
2587
  // src/providers/transaction-request/scripts.ts
@@ -2575,7 +2634,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2575
2634
  */
2576
2635
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2577
2636
  super(rest);
2578
- this.gasLimit = bn10(gasLimit);
2637
+ this.gasLimit = bn11(gasLimit);
2579
2638
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2580
2639
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2581
2640
  this.abis = rest.abis;
@@ -2592,8 +2651,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2592
2651
  type: TransactionType4.Script,
2593
2652
  scriptGasLimit: this.gasLimit,
2594
2653
  ...super.getBaseTransaction(),
2595
- scriptLength: bn10(script.length),
2596
- scriptDataLength: bn10(scriptData.length),
2654
+ scriptLength: bn11(script.length),
2655
+ scriptDataLength: bn11(scriptData.length),
2597
2656
  receiptsRoot: ZeroBytes327,
2598
2657
  script: hexlify10(script),
2599
2658
  scriptData: hexlify10(scriptData)
@@ -2606,7 +2665,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2606
2665
  */
2607
2666
  getContractInputs() {
2608
2667
  return this.inputs.filter(
2609
- (input) => input.type === InputType4.Contract
2668
+ (input) => input.type === InputType5.Contract
2610
2669
  );
2611
2670
  }
2612
2671
  /**
@@ -2686,7 +2745,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2686
2745
  return this;
2687
2746
  }
2688
2747
  const inputIndex = super.pushInput({
2689
- type: InputType4.Contract,
2748
+ type: InputType5.Contract,
2690
2749
  contractId: contractAddress.toB256(),
2691
2750
  txPointer: "0x00000000000000000000000000000000"
2692
2751
  });
@@ -2728,7 +2787,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2728
2787
 
2729
2788
  // src/providers/transaction-request/utils.ts
2730
2789
  import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2731
- import { TransactionType as TransactionType5, InputType as InputType5 } from "@fuel-ts/transactions";
2790
+ import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2732
2791
  var transactionRequestify = (obj) => {
2733
2792
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2734
2793
  return obj;
@@ -2746,35 +2805,20 @@ var transactionRequestify = (obj) => {
2746
2805
  }
2747
2806
  }
2748
2807
  };
2749
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2750
- (acc, input) => {
2751
- if (input.type === InputType5.Coin && input.owner === owner.toB256()) {
2752
- acc.utxos.push(input.id);
2753
- }
2754
- if (input.type === InputType5.Message && input.recipient === owner.toB256()) {
2755
- acc.messages.push(input.nonce);
2756
- }
2757
- return acc;
2758
- },
2759
- {
2760
- utxos: [],
2761
- messages: []
2762
- }
2763
- );
2764
2808
 
2765
2809
  // src/providers/transaction-response/transaction-response.ts
2766
2810
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2767
- import { bn as bn16 } from "@fuel-ts/math";
2811
+ import { bn as bn17 } from "@fuel-ts/math";
2768
2812
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2769
2813
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2770
2814
 
2771
2815
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2772
- import { bn as bn15 } from "@fuel-ts/math";
2816
+ import { bn as bn16 } from "@fuel-ts/math";
2773
2817
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2774
2818
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2775
2819
 
2776
2820
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2777
- import { bn as bn11 } from "@fuel-ts/math";
2821
+ import { bn as bn12 } from "@fuel-ts/math";
2778
2822
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2779
2823
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2780
2824
  var calculateTXFeeForSummary = (params) => {
@@ -2788,19 +2832,19 @@ var calculateTXFeeForSummary = (params) => {
2788
2832
  if (totalFee) {
2789
2833
  return totalFee;
2790
2834
  }
2791
- const gasPerByte = bn11(feeParams.gasPerByte);
2792
- const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2835
+ const gasPerByte = bn12(feeParams.gasPerByte);
2836
+ const gasPriceFactor = bn12(feeParams.gasPriceFactor);
2793
2837
  const transactionBytes = arrayify9(rawPayload);
2794
2838
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2795
2839
  const { type, witnesses, inputs, policies } = transaction;
2796
- let metadataGas = bn11(0);
2797
- let gasLimit = bn11(0);
2840
+ let metadataGas = bn12(0);
2841
+ let gasLimit = bn12(0);
2798
2842
  if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
2799
- return bn11(0);
2843
+ return bn12(0);
2800
2844
  }
2801
2845
  if (type === TransactionType6.Create) {
2802
2846
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2803
- const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2847
+ const contractBytesSize = bn12(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2804
2848
  metadataGas = calculateMetadataGasForTxCreate({
2805
2849
  contractBytesSize,
2806
2850
  gasCosts,
@@ -2819,7 +2863,7 @@ var calculateTXFeeForSummary = (params) => {
2819
2863
  }
2820
2864
  const minGas = getMinGas({
2821
2865
  gasCosts,
2822
- gasPerByte: bn11(gasPerByte),
2866
+ gasPerByte: bn12(gasPerByte),
2823
2867
  inputs,
2824
2868
  metadataGas,
2825
2869
  txBytesSize: transactionBytes.length
@@ -2846,12 +2890,12 @@ var calculateTXFeeForSummary = (params) => {
2846
2890
  // src/providers/transaction-summary/operations.ts
2847
2891
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2848
2892
  import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2849
- import { bn as bn13 } from "@fuel-ts/math";
2893
+ import { bn as bn14 } from "@fuel-ts/math";
2850
2894
  import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2851
2895
 
2852
2896
  // src/providers/transaction-summary/call.ts
2853
2897
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2854
- import { bn as bn12 } from "@fuel-ts/math";
2898
+ import { bn as bn13 } from "@fuel-ts/math";
2855
2899
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2856
2900
  const abiInterface = new Interface2(abi);
2857
2901
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2860,7 +2904,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2860
2904
  let encodedArgs;
2861
2905
  if (functionFragment.isInputDataPointer) {
2862
2906
  if (rawPayload) {
2863
- const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2907
+ const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2864
2908
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2865
2909
  }
2866
2910
  } else {
@@ -3068,7 +3112,7 @@ var mergeAssets = (op1, op2) => {
3068
3112
  if (!matchingAsset) {
3069
3113
  return asset1;
3070
3114
  }
3071
- const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
3115
+ const mergedAmount = bn14(asset1.amount).add(matchingAsset.amount);
3072
3116
  return { ...asset1, amount: mergedAmount };
3073
3117
  });
3074
3118
  return mergedAssets.concat(filteredAssets);
@@ -3394,7 +3438,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3394
3438
 
3395
3439
  // src/providers/transaction-summary/status.ts
3396
3440
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3397
- import { bn as bn14 } from "@fuel-ts/math";
3441
+ import { bn as bn15 } from "@fuel-ts/math";
3398
3442
  var getTransactionStatusName = (gqlStatus) => {
3399
3443
  switch (gqlStatus) {
3400
3444
  case "FailureStatus":
@@ -3428,15 +3472,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3428
3472
  time = gqlTransactionStatus.time;
3429
3473
  blockId = gqlTransactionStatus.block.id;
3430
3474
  isStatusSuccess = true;
3431
- totalFee = bn14(gqlTransactionStatus.totalFee);
3432
- totalGas = bn14(gqlTransactionStatus.totalGas);
3475
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3476
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3433
3477
  break;
3434
3478
  case "FailureStatus":
3435
3479
  time = gqlTransactionStatus.time;
3436
3480
  blockId = gqlTransactionStatus.block.id;
3437
3481
  isStatusFailure = true;
3438
- totalFee = bn14(gqlTransactionStatus.totalFee);
3439
- totalGas = bn14(gqlTransactionStatus.totalGas);
3482
+ totalFee = bn15(gqlTransactionStatus.totalFee);
3483
+ totalGas = bn15(gqlTransactionStatus.totalGas);
3440
3484
  break;
3441
3485
  case "SubmittedStatus":
3442
3486
  time = gqlTransactionStatus.time;
@@ -3486,7 +3530,7 @@ function assembleTransactionSummary(params) {
3486
3530
  maxInputs
3487
3531
  });
3488
3532
  const typeName = getTransactionTypeName(transaction.type);
3489
- const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3533
+ const tip = bn16(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3490
3534
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3491
3535
  const fee = calculateTXFeeForSummary({
3492
3536
  totalFee,
@@ -3557,7 +3601,7 @@ var TransactionResponse = class {
3557
3601
  /** Current provider */
3558
3602
  provider;
3559
3603
  /** Gas used on the transaction */
3560
- gasUsed = bn16(0);
3604
+ gasUsed = bn17(0);
3561
3605
  /** The graphql Transaction with receipts object. */
3562
3606
  gqlTransaction;
3563
3607
  abis;
@@ -3791,47 +3835,47 @@ var processGqlChain = (chain) => {
3791
3835
  } = consensusParameters;
3792
3836
  return {
3793
3837
  name,
3794
- baseChainHeight: bn17(daHeight),
3838
+ baseChainHeight: bn18(daHeight),
3795
3839
  consensusParameters: {
3796
3840
  version,
3797
- chainId: bn17(chainId),
3841
+ chainId: bn18(chainId),
3798
3842
  baseAssetId,
3799
3843
  feeParameters: {
3800
3844
  version: feeParams.version,
3801
- gasPerByte: bn17(feeParams.gasPerByte),
3802
- gasPriceFactor: bn17(feeParams.gasPriceFactor)
3845
+ gasPerByte: bn18(feeParams.gasPerByte),
3846
+ gasPriceFactor: bn18(feeParams.gasPriceFactor)
3803
3847
  },
3804
3848
  contractParameters: {
3805
3849
  version: contractParams.version,
3806
- contractMaxSize: bn17(contractParams.contractMaxSize),
3807
- maxStorageSlots: bn17(contractParams.maxStorageSlots)
3850
+ contractMaxSize: bn18(contractParams.contractMaxSize),
3851
+ maxStorageSlots: bn18(contractParams.maxStorageSlots)
3808
3852
  },
3809
3853
  txParameters: {
3810
3854
  version: txParams.version,
3811
- maxInputs: bn17(txParams.maxInputs),
3812
- maxOutputs: bn17(txParams.maxOutputs),
3813
- maxWitnesses: bn17(txParams.maxWitnesses),
3814
- maxGasPerTx: bn17(txParams.maxGasPerTx),
3815
- maxSize: bn17(txParams.maxSize),
3816
- maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
3855
+ maxInputs: bn18(txParams.maxInputs),
3856
+ maxOutputs: bn18(txParams.maxOutputs),
3857
+ maxWitnesses: bn18(txParams.maxWitnesses),
3858
+ maxGasPerTx: bn18(txParams.maxGasPerTx),
3859
+ maxSize: bn18(txParams.maxSize),
3860
+ maxBytecodeSubsections: bn18(txParams.maxBytecodeSubsections)
3817
3861
  },
3818
3862
  predicateParameters: {
3819
3863
  version: predicateParams.version,
3820
- maxPredicateLength: bn17(predicateParams.maxPredicateLength),
3821
- maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
3822
- maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
3823
- maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
3864
+ maxPredicateLength: bn18(predicateParams.maxPredicateLength),
3865
+ maxPredicateDataLength: bn18(predicateParams.maxPredicateDataLength),
3866
+ maxGasPerPredicate: bn18(predicateParams.maxGasPerPredicate),
3867
+ maxMessageDataLength: bn18(predicateParams.maxMessageDataLength)
3824
3868
  },
3825
3869
  scriptParameters: {
3826
3870
  version: scriptParams.version,
3827
- maxScriptLength: bn17(scriptParams.maxScriptLength),
3828
- maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
3871
+ maxScriptLength: bn18(scriptParams.maxScriptLength),
3872
+ maxScriptDataLength: bn18(scriptParams.maxScriptDataLength)
3829
3873
  },
3830
3874
  gasCosts
3831
3875
  },
3832
3876
  latestBlock: {
3833
3877
  id: latestBlock.id,
3834
- height: bn17(latestBlock.height),
3878
+ height: bn18(latestBlock.height),
3835
3879
  time: latestBlock.header.time,
3836
3880
  transactions: latestBlock.transactions.map((i) => ({
3837
3881
  id: i.id
@@ -4027,7 +4071,7 @@ Supported fuel-core version: ${supportedVersion}.`
4027
4071
  */
4028
4072
  async getBlockNumber() {
4029
4073
  const { chain } = await this.operations.getChain();
4030
- return bn17(chain.latestBlock.height, 10);
4074
+ return bn18(chain.latestBlock.height, 10);
4031
4075
  }
4032
4076
  /**
4033
4077
  * Returns the chain information.
@@ -4037,8 +4081,8 @@ Supported fuel-core version: ${supportedVersion}.`
4037
4081
  async fetchNode() {
4038
4082
  const { nodeInfo } = await this.operations.getNodeInfo();
4039
4083
  const processedNodeInfo = {
4040
- maxDepth: bn17(nodeInfo.maxDepth),
4041
- maxTx: bn17(nodeInfo.maxTx),
4084
+ maxDepth: bn18(nodeInfo.maxDepth),
4085
+ maxTx: bn18(nodeInfo.maxTx),
4042
4086
  nodeVersion: nodeInfo.nodeVersion,
4043
4087
  utxoValidation: nodeInfo.utxoValidation,
4044
4088
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4170,7 +4214,7 @@ Supported fuel-core version: ${supportedVersion}.`
4170
4214
  } = response;
4171
4215
  if (inputs) {
4172
4216
  inputs.forEach((input, index) => {
4173
- if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
4217
+ if ("predicateGasUsed" in input && bn18(input.predicateGasUsed).gt(0)) {
4174
4218
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4175
4219
  }
4176
4220
  });
@@ -4328,12 +4372,12 @@ Supported fuel-core version: ${supportedVersion}.`
4328
4372
  gasPrice = await this.estimateGasPrice(10);
4329
4373
  }
4330
4374
  const minFee = calculateGasFee({
4331
- gasPrice: bn17(gasPrice),
4375
+ gasPrice: bn18(gasPrice),
4332
4376
  gas: minGas,
4333
4377
  priceFactor: gasPriceFactor,
4334
4378
  tip: transactionRequest.tip
4335
4379
  }).add(1);
4336
- let gasLimit = bn17(0);
4380
+ let gasLimit = bn18(0);
4337
4381
  if (transactionRequest.type === TransactionType8.Script) {
4338
4382
  gasLimit = transactionRequest.gasLimit;
4339
4383
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4346,7 +4390,7 @@ Supported fuel-core version: ${supportedVersion}.`
4346
4390
  }
4347
4391
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4348
4392
  const maxFee = calculateGasFee({
4349
- gasPrice: bn17(gasPrice),
4393
+ gasPrice: bn18(gasPrice),
4350
4394
  gas: maxGas,
4351
4395
  priceFactor: gasPriceFactor,
4352
4396
  tip: transactionRequest.tip
@@ -4411,7 +4455,7 @@ Supported fuel-core version: ${supportedVersion}.`
4411
4455
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4412
4456
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4413
4457
  if (isScriptTransaction) {
4414
- txRequestClone.gasLimit = bn17(0);
4458
+ txRequestClone.gasLimit = bn18(0);
4415
4459
  }
4416
4460
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4417
4461
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4432,7 +4476,7 @@ Supported fuel-core version: ${supportedVersion}.`
4432
4476
  let dryRunStatus;
4433
4477
  let missingContractIds = [];
4434
4478
  let outputVariables = 0;
4435
- let gasUsed = bn17(0);
4479
+ let gasUsed = bn18(0);
4436
4480
  txRequestClone.maxFee = maxFee;
4437
4481
  if (isScriptTransaction) {
4438
4482
  txRequestClone.gasLimit = gasLimit;
@@ -4497,10 +4541,10 @@ Supported fuel-core version: ${supportedVersion}.`
4497
4541
  return coins.map((coin) => ({
4498
4542
  id: coin.utxoId,
4499
4543
  assetId: coin.assetId,
4500
- amount: bn17(coin.amount),
4544
+ amount: bn18(coin.amount),
4501
4545
  owner: Address2.fromAddressOrString(coin.owner),
4502
- blockCreated: bn17(coin.blockCreated),
4503
- txCreatedIdx: bn17(coin.txCreatedIdx)
4546
+ blockCreated: bn18(coin.blockCreated),
4547
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4504
4548
  }));
4505
4549
  }
4506
4550
  /**
@@ -4537,9 +4581,9 @@ Supported fuel-core version: ${supportedVersion}.`
4537
4581
  switch (coin.type) {
4538
4582
  case "MessageCoin":
4539
4583
  return {
4540
- amount: bn17(coin.amount),
4584
+ amount: bn18(coin.amount),
4541
4585
  assetId: coin.assetId,
4542
- daHeight: bn17(coin.daHeight),
4586
+ daHeight: bn18(coin.daHeight),
4543
4587
  sender: Address2.fromAddressOrString(coin.sender),
4544
4588
  recipient: Address2.fromAddressOrString(coin.recipient),
4545
4589
  nonce: coin.nonce
@@ -4547,11 +4591,11 @@ Supported fuel-core version: ${supportedVersion}.`
4547
4591
  case "Coin":
4548
4592
  return {
4549
4593
  id: coin.utxoId,
4550
- amount: bn17(coin.amount),
4594
+ amount: bn18(coin.amount),
4551
4595
  assetId: coin.assetId,
4552
4596
  owner: Address2.fromAddressOrString(coin.owner),
4553
- blockCreated: bn17(coin.blockCreated),
4554
- txCreatedIdx: bn17(coin.txCreatedIdx)
4597
+ blockCreated: bn18(coin.blockCreated),
4598
+ txCreatedIdx: bn18(coin.txCreatedIdx)
4555
4599
  };
4556
4600
  default:
4557
4601
  return null;
@@ -4568,13 +4612,13 @@ Supported fuel-core version: ${supportedVersion}.`
4568
4612
  async getBlock(idOrHeight) {
4569
4613
  let variables;
4570
4614
  if (typeof idOrHeight === "number") {
4571
- variables = { height: bn17(idOrHeight).toString(10) };
4615
+ variables = { height: bn18(idOrHeight).toString(10) };
4572
4616
  } else if (idOrHeight === "latest") {
4573
4617
  variables = { height: (await this.getBlockNumber()).toString(10) };
4574
4618
  } else if (idOrHeight.length === 66) {
4575
4619
  variables = { blockId: idOrHeight };
4576
4620
  } else {
4577
- variables = { blockId: bn17(idOrHeight).toString(10) };
4621
+ variables = { blockId: bn18(idOrHeight).toString(10) };
4578
4622
  }
4579
4623
  const { block } = await this.operations.getBlock(variables);
4580
4624
  if (!block) {
@@ -4582,7 +4626,7 @@ Supported fuel-core version: ${supportedVersion}.`
4582
4626
  }
4583
4627
  return {
4584
4628
  id: block.id,
4585
- height: bn17(block.height),
4629
+ height: bn18(block.height),
4586
4630
  time: block.header.time,
4587
4631
  transactionIds: block.transactions.map((tx) => tx.id)
4588
4632
  };
@@ -4597,7 +4641,7 @@ Supported fuel-core version: ${supportedVersion}.`
4597
4641
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4598
4642
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4599
4643
  id: block.id,
4600
- height: bn17(block.height),
4644
+ height: bn18(block.height),
4601
4645
  time: block.header.time,
4602
4646
  transactionIds: block.transactions.map((tx) => tx.id)
4603
4647
  }));
@@ -4612,7 +4656,7 @@ Supported fuel-core version: ${supportedVersion}.`
4612
4656
  async getBlockWithTransactions(idOrHeight) {
4613
4657
  let variables;
4614
4658
  if (typeof idOrHeight === "number") {
4615
- variables = { blockHeight: bn17(idOrHeight).toString(10) };
4659
+ variables = { blockHeight: bn18(idOrHeight).toString(10) };
4616
4660
  } else if (idOrHeight === "latest") {
4617
4661
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4618
4662
  } else {
@@ -4624,7 +4668,7 @@ Supported fuel-core version: ${supportedVersion}.`
4624
4668
  }
4625
4669
  return {
4626
4670
  id: block.id,
4627
- height: bn17(block.height, 10),
4671
+ height: bn18(block.height, 10),
4628
4672
  time: block.header.time,
4629
4673
  transactionIds: block.transactions.map((tx) => tx.id),
4630
4674
  transactions: block.transactions.map(
@@ -4673,7 +4717,7 @@ Supported fuel-core version: ${supportedVersion}.`
4673
4717
  contract: Address2.fromAddressOrString(contractId).toB256(),
4674
4718
  asset: hexlify12(assetId)
4675
4719
  });
4676
- return bn17(contractBalance.amount, 10);
4720
+ return bn18(contractBalance.amount, 10);
4677
4721
  }
4678
4722
  /**
4679
4723
  * Returns the balance for the given owner for the given asset ID.
@@ -4687,7 +4731,7 @@ Supported fuel-core version: ${supportedVersion}.`
4687
4731
  owner: Address2.fromAddressOrString(owner).toB256(),
4688
4732
  assetId: hexlify12(assetId)
4689
4733
  });
4690
- return bn17(balance.amount, 10);
4734
+ return bn18(balance.amount, 10);
4691
4735
  }
4692
4736
  /**
4693
4737
  * Returns balances for the given owner.
@@ -4705,7 +4749,7 @@ Supported fuel-core version: ${supportedVersion}.`
4705
4749
  const balances = result.balances.edges.map((edge) => edge.node);
4706
4750
  return balances.map((balance) => ({
4707
4751
  assetId: balance.assetId,
4708
- amount: bn17(balance.amount)
4752
+ amount: bn18(balance.amount)
4709
4753
  }));
4710
4754
  }
4711
4755
  /**
@@ -4727,15 +4771,15 @@ Supported fuel-core version: ${supportedVersion}.`
4727
4771
  sender: message.sender,
4728
4772
  recipient: message.recipient,
4729
4773
  nonce: message.nonce,
4730
- amount: bn17(message.amount),
4774
+ amount: bn18(message.amount),
4731
4775
  data: message.data
4732
4776
  }),
4733
4777
  sender: Address2.fromAddressOrString(message.sender),
4734
4778
  recipient: Address2.fromAddressOrString(message.recipient),
4735
4779
  nonce: message.nonce,
4736
- amount: bn17(message.amount),
4780
+ amount: bn18(message.amount),
4737
4781
  data: InputMessageCoder.decodeData(message.data),
4738
- daHeight: bn17(message.daHeight)
4782
+ daHeight: bn18(message.daHeight)
4739
4783
  }));
4740
4784
  }
4741
4785
  /**
@@ -4788,19 +4832,19 @@ Supported fuel-core version: ${supportedVersion}.`
4788
4832
  } = result.messageProof;
4789
4833
  return {
4790
4834
  messageProof: {
4791
- proofIndex: bn17(messageProof.proofIndex),
4835
+ proofIndex: bn18(messageProof.proofIndex),
4792
4836
  proofSet: messageProof.proofSet
4793
4837
  },
4794
4838
  blockProof: {
4795
- proofIndex: bn17(blockProof.proofIndex),
4839
+ proofIndex: bn18(blockProof.proofIndex),
4796
4840
  proofSet: blockProof.proofSet
4797
4841
  },
4798
4842
  messageBlockHeader: {
4799
4843
  id: messageBlockHeader.id,
4800
- daHeight: bn17(messageBlockHeader.daHeight),
4844
+ daHeight: bn18(messageBlockHeader.daHeight),
4801
4845
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4802
4846
  transactionsRoot: messageBlockHeader.transactionsRoot,
4803
- height: bn17(messageBlockHeader.height),
4847
+ height: bn18(messageBlockHeader.height),
4804
4848
  prevRoot: messageBlockHeader.prevRoot,
4805
4849
  time: messageBlockHeader.time,
4806
4850
  applicationHash: messageBlockHeader.applicationHash,
@@ -4812,10 +4856,10 @@ Supported fuel-core version: ${supportedVersion}.`
4812
4856
  },
4813
4857
  commitBlockHeader: {
4814
4858
  id: commitBlockHeader.id,
4815
- daHeight: bn17(commitBlockHeader.daHeight),
4859
+ daHeight: bn18(commitBlockHeader.daHeight),
4816
4860
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4817
4861
  transactionsRoot: commitBlockHeader.transactionsRoot,
4818
- height: bn17(commitBlockHeader.height),
4862
+ height: bn18(commitBlockHeader.height),
4819
4863
  prevRoot: commitBlockHeader.prevRoot,
4820
4864
  time: commitBlockHeader.time,
4821
4865
  applicationHash: commitBlockHeader.applicationHash,
@@ -4828,19 +4872,19 @@ Supported fuel-core version: ${supportedVersion}.`
4828
4872
  sender: Address2.fromAddressOrString(sender),
4829
4873
  recipient: Address2.fromAddressOrString(recipient),
4830
4874
  nonce,
4831
- amount: bn17(amount),
4875
+ amount: bn18(amount),
4832
4876
  data
4833
4877
  };
4834
4878
  }
4835
4879
  async getLatestGasPrice() {
4836
4880
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4837
- return bn17(latestGasPrice.gasPrice);
4881
+ return bn18(latestGasPrice.gasPrice);
4838
4882
  }
4839
4883
  async estimateGasPrice(blockHorizon) {
4840
4884
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4841
4885
  blockHorizon: String(blockHorizon)
4842
4886
  });
4843
- return bn17(estimateGasPrice.gasPrice);
4887
+ return bn18(estimateGasPrice.gasPrice);
4844
4888
  }
4845
4889
  /**
4846
4890
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4861,10 +4905,10 @@ Supported fuel-core version: ${supportedVersion}.`
4861
4905
  */
4862
4906
  async produceBlocks(amount, startTime) {
4863
4907
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4864
- blocksToProduce: bn17(amount).toString(10),
4908
+ blocksToProduce: bn18(amount).toString(10),
4865
4909
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4866
4910
  });
4867
- return bn17(latestBlockHeight);
4911
+ return bn18(latestBlockHeight);
4868
4912
  }
4869
4913
  // eslint-disable-next-line @typescript-eslint/require-await
4870
4914
  async getTransactionResponse(transactionId) {
@@ -4910,7 +4954,7 @@ __publicField(Provider, "nodeInfoCache", {});
4910
4954
 
4911
4955
  // src/providers/transaction-summary/get-transaction-summary.ts
4912
4956
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4913
- import { bn as bn18 } from "@fuel-ts/math";
4957
+ import { bn as bn19 } from "@fuel-ts/math";
4914
4958
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4915
4959
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4916
4960
  async function getTransactionSummary(params) {
@@ -4947,8 +4991,8 @@ async function getTransactionSummary(params) {
4947
4991
  transaction: decodedTransaction,
4948
4992
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4949
4993
  gqlTransactionStatus: gqlTransaction.status,
4950
- gasPerByte: bn18(gasPerByte),
4951
- gasPriceFactor: bn18(gasPriceFactor),
4994
+ gasPerByte: bn19(gasPerByte),
4995
+ gasPriceFactor: bn19(gasPriceFactor),
4952
4996
  abiMap,
4953
4997
  maxInputs,
4954
4998
  gasCosts,
@@ -5154,22 +5198,6 @@ var rawAssets = [
5154
5198
  ];
5155
5199
  var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5156
5200
 
5157
- // src/providers/transaction-request/helpers.ts
5158
- import { bn as bn19 } from "@fuel-ts/math";
5159
- import { InputType as InputType8 } from "@fuel-ts/transactions";
5160
- var isRequestInputCoin = (input) => input.type === InputType8.Coin;
5161
- var isRequestInputMessage = (input) => input.type === InputType8.Message;
5162
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
5163
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
5164
- if (isRequestInputCoin(input) && input.assetId === assetId) {
5165
- return acc.add(input.amount);
5166
- }
5167
- if (isRequestInputMessage(input) && assetId === baseAsset) {
5168
- return acc.add(input.amount);
5169
- }
5170
- return acc;
5171
- }, bn19(0));
5172
-
5173
5201
  // src/utils/formatTransferToContractScriptData.ts
5174
5202
  import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
5175
5203
  import { BN as BN2 } from "@fuel-ts/math";
@@ -5407,7 +5435,7 @@ var Account = class extends AbstractAccount {
5407
5435
  while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5408
5436
  const resources = await this.getResourcesToSpend(
5409
5437
  missingQuantities,
5410
- cacheTxInputsFromOwner(request.inputs, this.address)
5438
+ cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5411
5439
  );
5412
5440
  request.addResources(resources);
5413
5441
  request.shiftPredicateData();
@@ -5987,18 +6015,17 @@ var BaseWalletUnlocked = class extends Account {
5987
6015
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5988
6016
 
5989
6017
  // src/hdwallet/hdwallet.ts
6018
+ import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
5990
6019
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5991
6020
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5992
6021
  import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5993
- import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5994
- import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
6022
+ import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
5995
6023
 
5996
6024
  // src/mnemonic/mnemonic.ts
5997
- import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
6025
+ import { randomBytes as randomBytes4, pbkdf2, computeHmac } from "@fuel-ts/crypto";
5998
6026
  import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5999
6027
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
6000
- import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
6001
- import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
6028
+ import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4, dataSlice, encodeBase58 } from "@fuel-ts/utils";
6002
6029
 
6003
6030
  // src/wordlists/words/english.ts
6004
6031
  var english = [
@@ -8527,7 +8554,7 @@ var HDWallet = class {
8527
8554
  });
8528
8555
  }
8529
8556
  static fromExtendedKey(extendedKey) {
8530
- const decoded = toBeHex(decodeBase58(extendedKey));
8557
+ const decoded = hexlify17(toBytes2(decodeBase58(extendedKey)));
8531
8558
  const bytes = arrayify18(decoded);
8532
8559
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8533
8560
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -9149,7 +9176,7 @@ import {
9149
9176
  } from "@fuel-ts/abi-coder";
9150
9177
  import { Address as Address9 } from "@fuel-ts/address";
9151
9178
  import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
9152
- import { ByteArrayCoder, InputType as InputType9 } from "@fuel-ts/transactions";
9179
+ import { ByteArrayCoder } from "@fuel-ts/transactions";
9153
9180
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
9154
9181
 
9155
9182
  // src/predicate/utils/getPredicateRoot.ts
@@ -9208,10 +9235,15 @@ var Predicate = class extends Account {
9208
9235
  populateTransactionPredicateData(transactionRequestLike) {
9209
9236
  const request = transactionRequestify(transactionRequestLike);
9210
9237
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9211
- request.inputs?.forEach((input) => {
9212
- if (input.type === InputType9.Coin && hexlify19(input.owner) === this.address.toB256()) {
9238
+ const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
9239
+ if (placeholderIndex !== -1) {
9240
+ request.removeWitness(placeholderIndex);
9241
+ }
9242
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
9243
+ if (isRequestInputResourceFromOwner(input, this.address)) {
9213
9244
  input.predicate = hexlify19(this.bytes);
9214
9245
  input.predicateData = hexlify19(this.getPredicateData(policies.length));
9246
+ input.witnessIndex = 0;
9215
9247
  }
9216
9248
  });
9217
9249
  return request;
@@ -9334,6 +9366,28 @@ var Predicate = class extends Account {
9334
9366
  }
9335
9367
  return mutatedBytes;
9336
9368
  }
9369
+ /**
9370
+ * Returns the index of the witness placeholder that was added to this predicate.
9371
+ * If no witness placeholder was added, it returns -1.
9372
+ * @param request - The transaction request.
9373
+ * @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
9374
+ */
9375
+ getIndexFromPlaceholderWitness(request) {
9376
+ const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
9377
+ let index = -1;
9378
+ const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
9379
+ if (hasEmptyPredicateInputs) {
9380
+ index = hasEmptyPredicateInputs.witnessIndex;
9381
+ const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
9382
+ if (!allInputsAreEmpty) {
9383
+ const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
9384
+ if (wasFilledInputAddedFirst) {
9385
+ index = -1;
9386
+ }
9387
+ }
9388
+ }
9389
+ return index;
9390
+ }
9337
9391
  };
9338
9392
 
9339
9393
  // src/connectors/fuel.ts
@@ -10056,7 +10110,8 @@ export {
10056
10110
  assets,
10057
10111
  buildBlockExplorerUrl,
10058
10112
  cacheFor,
10059
- cacheTxInputsFromOwner,
10113
+ cacheRequestInputsResources,
10114
+ cacheRequestInputsResourcesFromOwner,
10060
10115
  calculateGasFee,
10061
10116
  calculateMetadataGasForTxCreate,
10062
10117
  calculateMetadataGasForTxScript,
@@ -10070,6 +10125,7 @@ export {
10070
10125
  extractTxError,
10071
10126
  fuelAssetsBaseUrl,
10072
10127
  gasUsedByInputs,
10128
+ getAssetAmountInRequestInputs,
10073
10129
  getAssetEth,
10074
10130
  getAssetFuel,
10075
10131
  getAssetNetwork,
@@ -10104,6 +10160,7 @@ export {
10104
10160
  getReceiptsMessageOut,
10105
10161
  getReceiptsTransferOut,
10106
10162
  getReceiptsWithMissingData,
10163
+ getRequestInputResourceOwner,
10107
10164
  getTransactionStatusName,
10108
10165
  getTransactionSummary,
10109
10166
  getTransactionSummaryFromRequest,
@@ -10117,6 +10174,10 @@ export {
10117
10174
  isMessage,
10118
10175
  isRawCoin,
10119
10176
  isRawMessage,
10177
+ isRequestInputCoin,
10178
+ isRequestInputMessage,
10179
+ isRequestInputResource,
10180
+ isRequestInputResourceFromOwner,
10120
10181
  isType,
10121
10182
  isTypeCreate,
10122
10183
  isTypeMint,