@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.js CHANGED
@@ -88,7 +88,7 @@ __export(src_exports, {
88
88
  StorageAbstract: () => StorageAbstract,
89
89
  TransactionResponse: () => TransactionResponse,
90
90
  TransactionStatus: () => TransactionStatus,
91
- TransactionType: () => import_transactions6.TransactionType,
91
+ TransactionType: () => import_transactions7.TransactionType,
92
92
  TransactionTypeName: () => TransactionTypeName,
93
93
  Vault: () => Vault,
94
94
  Wallet: () => Wallet,
@@ -104,7 +104,8 @@ __export(src_exports, {
104
104
  assets: () => assets,
105
105
  buildBlockExplorerUrl: () => buildBlockExplorerUrl,
106
106
  cacheFor: () => cacheFor,
107
- cacheTxInputsFromOwner: () => cacheTxInputsFromOwner,
107
+ cacheRequestInputsResources: () => cacheRequestInputsResources,
108
+ cacheRequestInputsResourcesFromOwner: () => cacheRequestInputsResourcesFromOwner,
108
109
  calculateGasFee: () => calculateGasFee,
109
110
  calculateMetadataGasForTxCreate: () => calculateMetadataGasForTxCreate,
110
111
  calculateMetadataGasForTxScript: () => calculateMetadataGasForTxScript,
@@ -118,6 +119,7 @@ __export(src_exports, {
118
119
  extractTxError: () => extractTxError,
119
120
  fuelAssetsBaseUrl: () => fuelAssetsBaseUrl,
120
121
  gasUsedByInputs: () => gasUsedByInputs,
122
+ getAssetAmountInRequestInputs: () => getAssetAmountInRequestInputs,
121
123
  getAssetEth: () => getAssetEth,
122
124
  getAssetFuel: () => getAssetFuel,
123
125
  getAssetNetwork: () => getAssetNetwork,
@@ -152,6 +154,7 @@ __export(src_exports, {
152
154
  getReceiptsMessageOut: () => getReceiptsMessageOut,
153
155
  getReceiptsTransferOut: () => getReceiptsTransferOut,
154
156
  getReceiptsWithMissingData: () => getReceiptsWithMissingData,
157
+ getRequestInputResourceOwner: () => getRequestInputResourceOwner,
155
158
  getTransactionStatusName: () => getTransactionStatusName,
156
159
  getTransactionSummary: () => getTransactionSummary,
157
160
  getTransactionSummaryFromRequest: () => getTransactionSummaryFromRequest,
@@ -165,6 +168,10 @@ __export(src_exports, {
165
168
  isMessage: () => isMessage,
166
169
  isRawCoin: () => isRawCoin,
167
170
  isRawMessage: () => isRawMessage,
171
+ isRequestInputCoin: () => isRequestInputCoin,
172
+ isRequestInputMessage: () => isRequestInputMessage,
173
+ isRequestInputResource: () => isRequestInputResource,
174
+ isRequestInputResourceFromOwner: () => isRequestInputResourceFromOwner,
168
175
  isType: () => isType,
169
176
  isTypeCreate: () => isTypeCreate,
170
177
  isTypeMint: () => isTypeMint,
@@ -233,8 +240,8 @@ var addAmountToCoinQuantities = (params) => {
233
240
  // src/providers/provider.ts
234
241
  var import_address3 = require("@fuel-ts/address");
235
242
  var import_errors14 = require("@fuel-ts/errors");
236
- var import_math17 = require("@fuel-ts/math");
237
- var import_transactions19 = require("@fuel-ts/transactions");
243
+ var import_math18 = require("@fuel-ts/math");
244
+ var import_transactions20 = require("@fuel-ts/transactions");
238
245
  var import_utils22 = require("@fuel-ts/utils");
239
246
  var import_versions = require("@fuel-ts/versions");
240
247
  var import_utils23 = require("@noble/curves/abstract/utils");
@@ -1451,8 +1458,8 @@ var import_abi_coder2 = require("@fuel-ts/abi-coder");
1451
1458
  var import_address = require("@fuel-ts/address");
1452
1459
  var import_configs6 = require("@fuel-ts/address/configs");
1453
1460
  var import_crypto = require("@fuel-ts/crypto");
1454
- var import_math7 = require("@fuel-ts/math");
1455
- var import_transactions6 = require("@fuel-ts/transactions");
1461
+ var import_math8 = require("@fuel-ts/math");
1462
+ var import_transactions7 = require("@fuel-ts/transactions");
1456
1463
  var import_utils9 = require("@fuel-ts/utils");
1457
1464
 
1458
1465
  // src/providers/resource.ts
@@ -1959,6 +1966,52 @@ var NoWitnessByOwnerError = class extends Error {
1959
1966
  name = "NoWitnessByOwnerError";
1960
1967
  };
1961
1968
 
1969
+ // src/providers/transaction-request/helpers.ts
1970
+ var import_math7 = require("@fuel-ts/math");
1971
+ var import_transactions6 = require("@fuel-ts/transactions");
1972
+ var isRequestInputCoin = (input) => input.type === import_transactions6.InputType.Coin;
1973
+ var isRequestInputMessage = (input) => input.type === import_transactions6.InputType.Message;
1974
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
1975
+ var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
1976
+ var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
1977
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
1978
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
1979
+ return acc.add(input.amount);
1980
+ }
1981
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
1982
+ return acc.add(input.amount);
1983
+ }
1984
+ return acc;
1985
+ }, (0, import_math7.bn)(0));
1986
+ var cacheRequestInputsResources = (inputs) => inputs.filter(isRequestInputResource).reduce(
1987
+ (cache2, input) => {
1988
+ if (isRequestInputCoin(input)) {
1989
+ cache2.utxos.push(input.id);
1990
+ } else {
1991
+ cache2.messages.push(input.nonce);
1992
+ }
1993
+ return cache2;
1994
+ },
1995
+ {
1996
+ utxos: [],
1997
+ messages: []
1998
+ }
1999
+ );
2000
+ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2001
+ (acc, input) => {
2002
+ if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
2003
+ acc.utxos.push(input.id);
2004
+ } else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
2005
+ acc.messages.push(input.nonce);
2006
+ }
2007
+ return acc;
2008
+ },
2009
+ {
2010
+ utxos: [],
2011
+ messages: []
2012
+ }
2013
+ );
2014
+
1962
2015
  // src/providers/transaction-request/witness.ts
1963
2016
  var import_utils8 = require("@fuel-ts/utils");
1964
2017
  var witnessify = (value) => {
@@ -1999,10 +2052,10 @@ var BaseTransactionRequest = class {
1999
2052
  outputs,
2000
2053
  witnesses
2001
2054
  } = {}) {
2002
- this.tip = tip ? (0, import_math7.bn)(tip) : void 0;
2055
+ this.tip = tip ? (0, import_math8.bn)(tip) : void 0;
2003
2056
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
2004
- this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math7.bn)(witnessLimit) : void 0;
2005
- this.maxFee = (0, import_math7.bn)(maxFee);
2057
+ this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math8.bn)(witnessLimit) : void 0;
2058
+ this.maxFee = (0, import_math8.bn)(maxFee);
2006
2059
  this.inputs = inputs ?? [];
2007
2060
  this.outputs = outputs ?? [];
2008
2061
  this.witnesses = witnesses ?? [];
@@ -2011,20 +2064,20 @@ var BaseTransactionRequest = class {
2011
2064
  let policyTypes = 0;
2012
2065
  const policies = [];
2013
2066
  const { tip, witnessLimit, maturity } = req;
2014
- if ((0, import_math7.bn)(tip).gt(0)) {
2015
- policyTypes += import_transactions6.PolicyType.Tip;
2016
- policies.push({ data: (0, import_math7.bn)(tip), type: import_transactions6.PolicyType.Tip });
2067
+ if ((0, import_math8.bn)(tip).gt(0)) {
2068
+ policyTypes += import_transactions7.PolicyType.Tip;
2069
+ policies.push({ data: (0, import_math8.bn)(tip), type: import_transactions7.PolicyType.Tip });
2017
2070
  }
2018
- if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math7.bn)(witnessLimit).gte(0)) {
2019
- policyTypes += import_transactions6.PolicyType.WitnessLimit;
2020
- policies.push({ data: (0, import_math7.bn)(witnessLimit), type: import_transactions6.PolicyType.WitnessLimit });
2071
+ if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math8.bn)(witnessLimit).gte(0)) {
2072
+ policyTypes += import_transactions7.PolicyType.WitnessLimit;
2073
+ policies.push({ data: (0, import_math8.bn)(witnessLimit), type: import_transactions7.PolicyType.WitnessLimit });
2021
2074
  }
2022
2075
  if (maturity && maturity > 0) {
2023
- policyTypes += import_transactions6.PolicyType.Maturity;
2024
- policies.push({ data: maturity, type: import_transactions6.PolicyType.Maturity });
2076
+ policyTypes += import_transactions7.PolicyType.Maturity;
2077
+ policies.push({ data: maturity, type: import_transactions7.PolicyType.Maturity });
2025
2078
  }
2026
- policyTypes += import_transactions6.PolicyType.MaxFee;
2027
- policies.push({ data: req.maxFee, type: import_transactions6.PolicyType.MaxFee });
2079
+ policyTypes += import_transactions7.PolicyType.MaxFee;
2080
+ policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
2028
2081
  return {
2029
2082
  policyTypes,
2030
2083
  policies
@@ -2057,7 +2110,7 @@ var BaseTransactionRequest = class {
2057
2110
  * @returns The transaction bytes.
2058
2111
  */
2059
2112
  toTransactionBytes() {
2060
- return new import_transactions6.TransactionCoder().encode(this.toTransaction());
2113
+ return new import_transactions7.TransactionCoder().encode(this.toTransaction());
2061
2114
  }
2062
2115
  /**
2063
2116
  * @hidden
@@ -2148,7 +2201,7 @@ var BaseTransactionRequest = class {
2148
2201
  */
2149
2202
  getCoinInputs() {
2150
2203
  return this.inputs.filter(
2151
- (input) => input.type === import_transactions6.InputType.Coin
2204
+ (input) => input.type === import_transactions7.InputType.Coin
2152
2205
  );
2153
2206
  }
2154
2207
  /**
@@ -2158,7 +2211,7 @@ var BaseTransactionRequest = class {
2158
2211
  */
2159
2212
  getCoinOutputs() {
2160
2213
  return this.outputs.filter(
2161
- (output) => output.type === import_transactions6.OutputType.Coin
2214
+ (output) => output.type === import_transactions7.OutputType.Coin
2162
2215
  );
2163
2216
  }
2164
2217
  /**
@@ -2168,7 +2221,7 @@ var BaseTransactionRequest = class {
2168
2221
  */
2169
2222
  getChangeOutputs() {
2170
2223
  return this.outputs.filter(
2171
- (output) => output.type === import_transactions6.OutputType.Change
2224
+ (output) => output.type === import_transactions7.OutputType.Change
2172
2225
  );
2173
2226
  }
2174
2227
  /**
@@ -2180,9 +2233,9 @@ var BaseTransactionRequest = class {
2180
2233
  const ownerAddress = (0, import_address.addressify)(owner);
2181
2234
  const found = this.inputs.find((input) => {
2182
2235
  switch (input.type) {
2183
- case import_transactions6.InputType.Coin:
2236
+ case import_transactions7.InputType.Coin:
2184
2237
  return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
2185
- case import_transactions6.InputType.Message:
2238
+ case import_transactions7.InputType.Message:
2186
2239
  return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
2187
2240
  default:
2188
2241
  return false;
@@ -2197,7 +2250,7 @@ var BaseTransactionRequest = class {
2197
2250
  * @param coin - Coin resource.
2198
2251
  */
2199
2252
  addCoinInput(coin) {
2200
- const { assetId, owner, amount } = coin;
2253
+ const { assetId, owner, amount, id, predicate } = coin;
2201
2254
  let witnessIndex;
2202
2255
  if (coin.predicate) {
2203
2256
  witnessIndex = 0;
@@ -2208,13 +2261,14 @@ var BaseTransactionRequest = class {
2208
2261
  }
2209
2262
  }
2210
2263
  const input = {
2211
- ...coin,
2212
- type: import_transactions6.InputType.Coin,
2264
+ id,
2265
+ type: import_transactions7.InputType.Coin,
2213
2266
  owner: owner.toB256(),
2214
2267
  amount,
2215
2268
  assetId,
2216
2269
  txPointer: "0x00000000000000000000000000000000",
2217
- witnessIndex
2270
+ witnessIndex,
2271
+ predicate
2218
2272
  };
2219
2273
  this.pushInput(input);
2220
2274
  this.addChangeOutput(owner, assetId);
@@ -2226,7 +2280,7 @@ var BaseTransactionRequest = class {
2226
2280
  * @param message - Message resource.
2227
2281
  */
2228
2282
  addMessageInput(message) {
2229
- const { recipient, sender, amount, assetId } = message;
2283
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
2230
2284
  let witnessIndex;
2231
2285
  if (message.predicate) {
2232
2286
  witnessIndex = 0;
@@ -2237,12 +2291,13 @@ var BaseTransactionRequest = class {
2237
2291
  }
2238
2292
  }
2239
2293
  const input = {
2240
- ...message,
2241
- type: import_transactions6.InputType.Message,
2294
+ nonce,
2295
+ type: import_transactions7.InputType.Message,
2242
2296
  sender: sender.toB256(),
2243
2297
  recipient: recipient.toB256(),
2244
2298
  amount,
2245
- witnessIndex
2299
+ witnessIndex,
2300
+ predicate
2246
2301
  };
2247
2302
  this.pushInput(input);
2248
2303
  this.addChangeOutput(recipient, assetId);
@@ -2282,7 +2337,7 @@ var BaseTransactionRequest = class {
2282
2337
  */
2283
2338
  addCoinOutput(to, amount, assetId) {
2284
2339
  this.pushOutput({
2285
- type: import_transactions6.OutputType.Coin,
2340
+ type: import_transactions7.OutputType.Coin,
2286
2341
  to: (0, import_address.addressify)(to).toB256(),
2287
2342
  amount,
2288
2343
  assetId
@@ -2298,7 +2353,7 @@ var BaseTransactionRequest = class {
2298
2353
  addCoinOutputs(to, quantities) {
2299
2354
  quantities.map(coinQuantityfy).forEach((quantity) => {
2300
2355
  this.pushOutput({
2301
- type: import_transactions6.OutputType.Coin,
2356
+ type: import_transactions7.OutputType.Coin,
2302
2357
  to: (0, import_address.addressify)(to).toB256(),
2303
2358
  amount: quantity.amount,
2304
2359
  assetId: quantity.assetId
@@ -2318,7 +2373,7 @@ var BaseTransactionRequest = class {
2318
2373
  );
2319
2374
  if (!changeOutput) {
2320
2375
  this.pushOutput({
2321
- type: import_transactions6.OutputType.Change,
2376
+ type: import_transactions7.OutputType.Change,
2322
2377
  to: (0, import_address.addressify)(to).toB256(),
2323
2378
  assetId
2324
2379
  });
@@ -2389,7 +2444,7 @@ var BaseTransactionRequest = class {
2389
2444
  const assetInput = findAssetInput(assetId);
2390
2445
  let usedQuantity = quantity;
2391
2446
  if (assetId === baseAssetId) {
2392
- usedQuantity = (0, import_math7.bn)("1000000000000000000");
2447
+ usedQuantity = (0, import_math8.bn)("1000000000000000000");
2393
2448
  }
2394
2449
  if (assetInput && "assetId" in assetInput) {
2395
2450
  assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
@@ -2401,13 +2456,13 @@ var BaseTransactionRequest = class {
2401
2456
  amount: usedQuantity,
2402
2457
  assetId,
2403
2458
  owner: resourcesOwner || import_address.Address.fromRandom(),
2404
- blockCreated: (0, import_math7.bn)(1),
2405
- txCreatedIdx: (0, import_math7.bn)(1)
2459
+ blockCreated: (0, import_math8.bn)(1),
2460
+ txCreatedIdx: (0, import_math8.bn)(1)
2406
2461
  }
2407
2462
  ]);
2408
2463
  }
2409
2464
  };
2410
- updateAssetInput(baseAssetId, (0, import_math7.bn)(1e11));
2465
+ updateAssetInput(baseAssetId, (0, import_math8.bn)(1e11));
2411
2466
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2412
2467
  }
2413
2468
  /**
@@ -2418,7 +2473,7 @@ var BaseTransactionRequest = class {
2418
2473
  */
2419
2474
  getCoinOutputsQuantities() {
2420
2475
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2421
- amount: (0, import_math7.bn)(amount),
2476
+ amount: (0, import_math8.bn)(amount),
2422
2477
  assetId: assetId.toString()
2423
2478
  }));
2424
2479
  return coinsQuantities;
@@ -2432,22 +2487,33 @@ var BaseTransactionRequest = class {
2432
2487
  toJSON() {
2433
2488
  return normalizeJSON(this);
2434
2489
  }
2490
+ removeWitness(index) {
2491
+ this.witnesses.splice(index, 1);
2492
+ this.adjustWitnessIndexes(index);
2493
+ }
2494
+ adjustWitnessIndexes(removedIndex) {
2495
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
2496
+ if (input.witnessIndex > removedIndex) {
2497
+ input.witnessIndex -= 1;
2498
+ }
2499
+ });
2500
+ }
2435
2501
  updatePredicateGasUsed(inputs) {
2436
2502
  this.inputs.forEach((i) => {
2437
2503
  let correspondingInput;
2438
2504
  switch (i.type) {
2439
- case import_transactions6.InputType.Coin:
2440
- correspondingInput = inputs.find((x) => x.type === import_transactions6.InputType.Coin && x.owner === i.owner);
2505
+ case import_transactions7.InputType.Coin:
2506
+ correspondingInput = inputs.find((x) => x.type === import_transactions7.InputType.Coin && x.owner === i.owner);
2441
2507
  break;
2442
- case import_transactions6.InputType.Message:
2508
+ case import_transactions7.InputType.Message:
2443
2509
  correspondingInput = inputs.find(
2444
- (x) => x.type === import_transactions6.InputType.Message && x.sender === i.sender
2510
+ (x) => x.type === import_transactions7.InputType.Message && x.sender === i.sender
2445
2511
  );
2446
2512
  break;
2447
2513
  default:
2448
2514
  return;
2449
2515
  }
2450
- if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math7.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2516
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math8.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2451
2517
  i.predicate = correspondingInput.predicate;
2452
2518
  i.predicateData = correspondingInput.predicateData;
2453
2519
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2467,38 +2533,38 @@ var BaseTransactionRequest = class {
2467
2533
 
2468
2534
  // src/providers/transaction-request/create-transaction-request.ts
2469
2535
  var import_configs8 = require("@fuel-ts/address/configs");
2470
- var import_math9 = require("@fuel-ts/math");
2471
- var import_transactions8 = require("@fuel-ts/transactions");
2536
+ var import_math10 = require("@fuel-ts/math");
2537
+ var import_transactions9 = require("@fuel-ts/transactions");
2472
2538
  var import_utils13 = require("@fuel-ts/utils");
2473
2539
 
2474
2540
  // src/providers/transaction-request/hash-transaction.ts
2475
2541
  var import_configs7 = require("@fuel-ts/address/configs");
2476
2542
  var import_hasher = require("@fuel-ts/hasher");
2477
- var import_math8 = require("@fuel-ts/math");
2478
- var import_transactions7 = require("@fuel-ts/transactions");
2543
+ var import_math9 = require("@fuel-ts/math");
2544
+ var import_transactions8 = require("@fuel-ts/transactions");
2479
2545
  var import_utils11 = require("@fuel-ts/utils");
2480
2546
  var import_ramda2 = require("ramda");
2481
2547
  function hashTransaction(transactionRequest, chainId) {
2482
2548
  const transaction = transactionRequest.toTransaction();
2483
- if (transaction.type === import_transactions7.TransactionType.Script) {
2549
+ if (transaction.type === import_transactions8.TransactionType.Script) {
2484
2550
  transaction.receiptsRoot = import_configs7.ZeroBytes32;
2485
2551
  }
2486
2552
  transaction.inputs = transaction.inputs.map((input) => {
2487
2553
  const inputClone = (0, import_ramda2.clone)(input);
2488
2554
  switch (inputClone.type) {
2489
- case import_transactions7.InputType.Coin: {
2555
+ case import_transactions8.InputType.Coin: {
2490
2556
  inputClone.txPointer = {
2491
2557
  blockHeight: 0,
2492
2558
  txIndex: 0
2493
2559
  };
2494
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2560
+ inputClone.predicateGasUsed = (0, import_math9.bn)(0);
2495
2561
  return inputClone;
2496
2562
  }
2497
- case import_transactions7.InputType.Message: {
2498
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2563
+ case import_transactions8.InputType.Message: {
2564
+ inputClone.predicateGasUsed = (0, import_math9.bn)(0);
2499
2565
  return inputClone;
2500
2566
  }
2501
- case import_transactions7.InputType.Contract: {
2567
+ case import_transactions8.InputType.Contract: {
2502
2568
  inputClone.txPointer = {
2503
2569
  blockHeight: 0,
2504
2570
  txIndex: 0
@@ -2516,18 +2582,18 @@ function hashTransaction(transactionRequest, chainId) {
2516
2582
  transaction.outputs = transaction.outputs.map((output) => {
2517
2583
  const outputClone = (0, import_ramda2.clone)(output);
2518
2584
  switch (outputClone.type) {
2519
- case import_transactions7.OutputType.Contract: {
2585
+ case import_transactions8.OutputType.Contract: {
2520
2586
  outputClone.balanceRoot = import_configs7.ZeroBytes32;
2521
2587
  outputClone.stateRoot = import_configs7.ZeroBytes32;
2522
2588
  return outputClone;
2523
2589
  }
2524
- case import_transactions7.OutputType.Change: {
2525
- outputClone.amount = (0, import_math8.bn)(0);
2590
+ case import_transactions8.OutputType.Change: {
2591
+ outputClone.amount = (0, import_math9.bn)(0);
2526
2592
  return outputClone;
2527
2593
  }
2528
- case import_transactions7.OutputType.Variable: {
2594
+ case import_transactions8.OutputType.Variable: {
2529
2595
  outputClone.to = import_configs7.ZeroBytes32;
2530
- outputClone.amount = (0, import_math8.bn)(0);
2596
+ outputClone.amount = (0, import_math9.bn)(0);
2531
2597
  outputClone.assetId = import_configs7.ZeroBytes32;
2532
2598
  return outputClone;
2533
2599
  }
@@ -2538,7 +2604,7 @@ function hashTransaction(transactionRequest, chainId) {
2538
2604
  transaction.witnessesCount = 0;
2539
2605
  transaction.witnesses = [];
2540
2606
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2541
- const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions7.TransactionCoder().encode(transaction)]);
2607
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions8.TransactionCoder().encode(transaction)]);
2542
2608
  return (0, import_hasher.sha256)(concatenatedData);
2543
2609
  }
2544
2610
 
@@ -2574,7 +2640,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2574
2640
  return new this(obj);
2575
2641
  }
2576
2642
  /** Type of the transaction */
2577
- type = import_transactions8.TransactionType.Create;
2643
+ type = import_transactions9.TransactionType.Create;
2578
2644
  /** Witness index of contract bytecode to create */
2579
2645
  bytecodeWitnessIndex;
2580
2646
  /** Salt */
@@ -2602,10 +2668,10 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2602
2668
  const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
2603
2669
  const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
2604
2670
  return {
2605
- type: import_transactions8.TransactionType.Create,
2671
+ type: import_transactions9.TransactionType.Create,
2606
2672
  ...baseTransaction,
2607
2673
  bytecodeWitnessIndex,
2608
- storageSlotsCount: (0, import_math9.bn)(storageSlots.length),
2674
+ storageSlotsCount: (0, import_math10.bn)(storageSlots.length),
2609
2675
  salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2610
2676
  storageSlots
2611
2677
  };
@@ -2617,7 +2683,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2617
2683
  */
2618
2684
  getContractCreatedOutputs() {
2619
2685
  return this.outputs.filter(
2620
- (output) => output.type === import_transactions8.OutputType.ContractCreated
2686
+ (output) => output.type === import_transactions9.OutputType.ContractCreated
2621
2687
  );
2622
2688
  }
2623
2689
  /**
@@ -2638,14 +2704,14 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2638
2704
  */
2639
2705
  addContractCreatedOutput(contractId, stateRoot) {
2640
2706
  this.pushOutput({
2641
- type: import_transactions8.OutputType.ContractCreated,
2707
+ type: import_transactions9.OutputType.ContractCreated,
2642
2708
  contractId,
2643
2709
  stateRoot
2644
2710
  });
2645
2711
  }
2646
2712
  metadataGas(gasCosts) {
2647
2713
  return calculateMetadataGasForTxCreate({
2648
- contractBytesSize: (0, import_math9.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2714
+ contractBytesSize: (0, import_math10.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2649
2715
  gasCosts,
2650
2716
  stateRootSize: this.storageSlots.length,
2651
2717
  txBytesSize: this.byteSize()
@@ -2657,8 +2723,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2657
2723
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
2658
2724
  var import_address2 = require("@fuel-ts/address");
2659
2725
  var import_configs9 = require("@fuel-ts/address/configs");
2660
- var import_math10 = require("@fuel-ts/math");
2661
- var import_transactions9 = require("@fuel-ts/transactions");
2726
+ var import_math11 = require("@fuel-ts/math");
2727
+ var import_transactions10 = require("@fuel-ts/transactions");
2662
2728
  var import_utils15 = require("@fuel-ts/utils");
2663
2729
 
2664
2730
  // src/providers/transaction-request/scripts.ts
@@ -2696,7 +2762,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2696
2762
  return new this(obj);
2697
2763
  }
2698
2764
  /** Type of the transaction */
2699
- type = import_transactions9.TransactionType.Script;
2765
+ type = import_transactions10.TransactionType.Script;
2700
2766
  /** Gas limit for transaction */
2701
2767
  gasLimit;
2702
2768
  /** Script to execute */
@@ -2711,7 +2777,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2711
2777
  */
2712
2778
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2713
2779
  super(rest);
2714
- this.gasLimit = (0, import_math10.bn)(gasLimit);
2780
+ this.gasLimit = (0, import_math11.bn)(gasLimit);
2715
2781
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2716
2782
  this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2717
2783
  this.abis = rest.abis;
@@ -2725,11 +2791,11 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2725
2791
  const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2726
2792
  const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2727
2793
  return {
2728
- type: import_transactions9.TransactionType.Script,
2794
+ type: import_transactions10.TransactionType.Script,
2729
2795
  scriptGasLimit: this.gasLimit,
2730
2796
  ...super.getBaseTransaction(),
2731
- scriptLength: (0, import_math10.bn)(script.length),
2732
- scriptDataLength: (0, import_math10.bn)(scriptData.length),
2797
+ scriptLength: (0, import_math11.bn)(script.length),
2798
+ scriptDataLength: (0, import_math11.bn)(scriptData.length),
2733
2799
  receiptsRoot: import_configs9.ZeroBytes32,
2734
2800
  script: (0, import_utils15.hexlify)(script),
2735
2801
  scriptData: (0, import_utils15.hexlify)(scriptData)
@@ -2742,7 +2808,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2742
2808
  */
2743
2809
  getContractInputs() {
2744
2810
  return this.inputs.filter(
2745
- (input) => input.type === import_transactions9.InputType.Contract
2811
+ (input) => input.type === import_transactions10.InputType.Contract
2746
2812
  );
2747
2813
  }
2748
2814
  /**
@@ -2752,7 +2818,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2752
2818
  */
2753
2819
  getContractOutputs() {
2754
2820
  return this.outputs.filter(
2755
- (output) => output.type === import_transactions9.OutputType.Contract
2821
+ (output) => output.type === import_transactions10.OutputType.Contract
2756
2822
  );
2757
2823
  }
2758
2824
  /**
@@ -2762,7 +2828,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2762
2828
  */
2763
2829
  getVariableOutputs() {
2764
2830
  return this.outputs.filter(
2765
- (output) => output.type === import_transactions9.OutputType.Variable
2831
+ (output) => output.type === import_transactions10.OutputType.Variable
2766
2832
  );
2767
2833
  }
2768
2834
  /**
@@ -2785,7 +2851,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2785
2851
  let outputsNumber = numberOfVariables;
2786
2852
  while (outputsNumber) {
2787
2853
  this.pushOutput({
2788
- type: import_transactions9.OutputType.Variable
2854
+ type: import_transactions10.OutputType.Variable
2789
2855
  });
2790
2856
  outputsNumber -= 1;
2791
2857
  }
@@ -2822,12 +2888,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2822
2888
  return this;
2823
2889
  }
2824
2890
  const inputIndex = super.pushInput({
2825
- type: import_transactions9.InputType.Contract,
2891
+ type: import_transactions10.InputType.Contract,
2826
2892
  contractId: contractAddress.toB256(),
2827
2893
  txPointer: "0x00000000000000000000000000000000"
2828
2894
  });
2829
2895
  this.pushOutput({
2830
- type: import_transactions9.OutputType.Contract,
2896
+ type: import_transactions10.OutputType.Contract,
2831
2897
  inputIndex
2832
2898
  });
2833
2899
  return this;
@@ -2864,17 +2930,17 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2864
2930
 
2865
2931
  // src/providers/transaction-request/utils.ts
2866
2932
  var import_errors9 = require("@fuel-ts/errors");
2867
- var import_transactions10 = require("@fuel-ts/transactions");
2933
+ var import_transactions11 = require("@fuel-ts/transactions");
2868
2934
  var transactionRequestify = (obj) => {
2869
2935
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2870
2936
  return obj;
2871
2937
  }
2872
2938
  const { type } = obj;
2873
2939
  switch (obj.type) {
2874
- case import_transactions10.TransactionType.Script: {
2940
+ case import_transactions11.TransactionType.Script: {
2875
2941
  return ScriptTransactionRequest.from(obj);
2876
2942
  }
2877
- case import_transactions10.TransactionType.Create: {
2943
+ case import_transactions11.TransactionType.Create: {
2878
2944
  return CreateTransactionRequest.from(obj);
2879
2945
  }
2880
2946
  default: {
@@ -2882,36 +2948,21 @@ var transactionRequestify = (obj) => {
2882
2948
  }
2883
2949
  }
2884
2950
  };
2885
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2886
- (acc, input) => {
2887
- if (input.type === import_transactions10.InputType.Coin && input.owner === owner.toB256()) {
2888
- acc.utxos.push(input.id);
2889
- }
2890
- if (input.type === import_transactions10.InputType.Message && input.recipient === owner.toB256()) {
2891
- acc.messages.push(input.nonce);
2892
- }
2893
- return acc;
2894
- },
2895
- {
2896
- utxos: [],
2897
- messages: []
2898
- }
2899
- );
2900
2951
 
2901
2952
  // src/providers/transaction-response/transaction-response.ts
2902
2953
  var import_errors13 = require("@fuel-ts/errors");
2903
- var import_math16 = require("@fuel-ts/math");
2904
- var import_transactions18 = require("@fuel-ts/transactions");
2954
+ var import_math17 = require("@fuel-ts/math");
2955
+ var import_transactions19 = require("@fuel-ts/transactions");
2905
2956
  var import_utils20 = require("@fuel-ts/utils");
2906
2957
 
2907
2958
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2908
- var import_math15 = require("@fuel-ts/math");
2909
- var import_transactions16 = require("@fuel-ts/transactions");
2959
+ var import_math16 = require("@fuel-ts/math");
2960
+ var import_transactions17 = require("@fuel-ts/transactions");
2910
2961
  var import_utils18 = require("@fuel-ts/utils");
2911
2962
 
2912
2963
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2913
- var import_math11 = require("@fuel-ts/math");
2914
- var import_transactions11 = require("@fuel-ts/transactions");
2964
+ var import_math12 = require("@fuel-ts/math");
2965
+ var import_transactions12 = require("@fuel-ts/transactions");
2915
2966
  var import_utils16 = require("@fuel-ts/utils");
2916
2967
  var calculateTXFeeForSummary = (params) => {
2917
2968
  const {
@@ -2924,19 +2975,19 @@ var calculateTXFeeForSummary = (params) => {
2924
2975
  if (totalFee) {
2925
2976
  return totalFee;
2926
2977
  }
2927
- const gasPerByte = (0, import_math11.bn)(feeParams.gasPerByte);
2928
- const gasPriceFactor = (0, import_math11.bn)(feeParams.gasPriceFactor);
2978
+ const gasPerByte = (0, import_math12.bn)(feeParams.gasPerByte);
2979
+ const gasPriceFactor = (0, import_math12.bn)(feeParams.gasPriceFactor);
2929
2980
  const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2930
- const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
2981
+ const [transaction] = new import_transactions12.TransactionCoder().decode(transactionBytes, 0);
2931
2982
  const { type, witnesses, inputs, policies } = transaction;
2932
- let metadataGas = (0, import_math11.bn)(0);
2933
- let gasLimit = (0, import_math11.bn)(0);
2934
- if (type !== import_transactions11.TransactionType.Create && type !== import_transactions11.TransactionType.Script) {
2935
- return (0, import_math11.bn)(0);
2983
+ let metadataGas = (0, import_math12.bn)(0);
2984
+ let gasLimit = (0, import_math12.bn)(0);
2985
+ if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
2986
+ return (0, import_math12.bn)(0);
2936
2987
  }
2937
- if (type === import_transactions11.TransactionType.Create) {
2988
+ if (type === import_transactions12.TransactionType.Create) {
2938
2989
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2939
- const contractBytesSize = (0, import_math11.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2990
+ const contractBytesSize = (0, import_math12.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2940
2991
  metadataGas = calculateMetadataGasForTxCreate({
2941
2992
  contractBytesSize,
2942
2993
  gasCosts,
@@ -2955,12 +3006,12 @@ var calculateTXFeeForSummary = (params) => {
2955
3006
  }
2956
3007
  const minGas = getMinGas({
2957
3008
  gasCosts,
2958
- gasPerByte: (0, import_math11.bn)(gasPerByte),
3009
+ gasPerByte: (0, import_math12.bn)(gasPerByte),
2959
3010
  inputs,
2960
3011
  metadataGas,
2961
3012
  txBytesSize: transactionBytes.length
2962
3013
  });
2963
- const witnessLimit = policies.find((policy) => policy.type === import_transactions11.PolicyType.WitnessLimit)?.data;
3014
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
2964
3015
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2965
3016
  const maxGas = getMaxGas({
2966
3017
  gasPerByte,
@@ -2982,12 +3033,12 @@ var calculateTXFeeForSummary = (params) => {
2982
3033
  // src/providers/transaction-summary/operations.ts
2983
3034
  var import_configs10 = require("@fuel-ts/address/configs");
2984
3035
  var import_errors11 = require("@fuel-ts/errors");
2985
- var import_math13 = require("@fuel-ts/math");
2986
- var import_transactions14 = require("@fuel-ts/transactions");
3036
+ var import_math14 = require("@fuel-ts/math");
3037
+ var import_transactions15 = require("@fuel-ts/transactions");
2987
3038
 
2988
3039
  // src/providers/transaction-summary/call.ts
2989
3040
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
2990
- var import_math12 = require("@fuel-ts/math");
3041
+ var import_math13 = require("@fuel-ts/math");
2991
3042
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2992
3043
  const abiInterface = new import_abi_coder4.Interface(abi);
2993
3044
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2996,7 +3047,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2996
3047
  let encodedArgs;
2997
3048
  if (functionFragment.isInputDataPointer) {
2998
3049
  if (rawPayload) {
2999
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
3050
+ const argsOffset = (0, import_math13.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
3000
3051
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
3001
3052
  }
3002
3053
  } else {
@@ -3031,7 +3082,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
3031
3082
 
3032
3083
  // src/providers/transaction-summary/input.ts
3033
3084
  var import_errors10 = require("@fuel-ts/errors");
3034
- var import_transactions12 = require("@fuel-ts/transactions");
3085
+ var import_transactions13 = require("@fuel-ts/transactions");
3035
3086
  function getInputsByTypes(inputs, types) {
3036
3087
  return inputs.filter((i) => types.includes(i.type));
3037
3088
  }
@@ -3039,16 +3090,16 @@ function getInputsByType(inputs, type) {
3039
3090
  return inputs.filter((i) => i.type === type);
3040
3091
  }
3041
3092
  function getInputsCoin(inputs) {
3042
- return getInputsByType(inputs, import_transactions12.InputType.Coin);
3093
+ return getInputsByType(inputs, import_transactions13.InputType.Coin);
3043
3094
  }
3044
3095
  function getInputsMessage(inputs) {
3045
- return getInputsByType(inputs, import_transactions12.InputType.Message);
3096
+ return getInputsByType(inputs, import_transactions13.InputType.Message);
3046
3097
  }
3047
3098
  function getInputsCoinAndMessage(inputs) {
3048
- return getInputsByTypes(inputs, [import_transactions12.InputType.Coin, import_transactions12.InputType.Message]);
3099
+ return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
3049
3100
  }
3050
3101
  function getInputsContract(inputs) {
3051
- return getInputsByType(inputs, import_transactions12.InputType.Contract);
3102
+ return getInputsByType(inputs, import_transactions13.InputType.Contract);
3052
3103
  }
3053
3104
  function getInputFromAssetId(inputs, assetId) {
3054
3105
  const coinInputs = getInputsCoin(inputs);
@@ -3067,7 +3118,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
3067
3118
  if (!contractInput) {
3068
3119
  return void 0;
3069
3120
  }
3070
- if (contractInput.type !== import_transactions12.InputType.Contract) {
3121
+ if (contractInput.type !== import_transactions13.InputType.Contract) {
3071
3122
  throw new import_errors10.FuelError(
3072
3123
  import_errors10.ErrorCode.INVALID_TRANSACTION_INPUT,
3073
3124
  `Contract input should be of type 'contract'.`
@@ -3076,34 +3127,34 @@ function getInputContractFromIndex(inputs, inputIndex) {
3076
3127
  return contractInput;
3077
3128
  }
3078
3129
  function getInputAccountAddress(input) {
3079
- if (input.type === import_transactions12.InputType.Coin) {
3130
+ if (input.type === import_transactions13.InputType.Coin) {
3080
3131
  return input.owner.toString();
3081
3132
  }
3082
- if (input.type === import_transactions12.InputType.Message) {
3133
+ if (input.type === import_transactions13.InputType.Message) {
3083
3134
  return input.recipient.toString();
3084
3135
  }
3085
3136
  return "";
3086
3137
  }
3087
3138
 
3088
3139
  // src/providers/transaction-summary/output.ts
3089
- var import_transactions13 = require("@fuel-ts/transactions");
3140
+ var import_transactions14 = require("@fuel-ts/transactions");
3090
3141
  function getOutputsByType(outputs, type) {
3091
3142
  return outputs.filter((o) => o.type === type);
3092
3143
  }
3093
3144
  function getOutputsContractCreated(outputs) {
3094
- return getOutputsByType(outputs, import_transactions13.OutputType.ContractCreated);
3145
+ return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
3095
3146
  }
3096
3147
  function getOutputsCoin(outputs) {
3097
- return getOutputsByType(outputs, import_transactions13.OutputType.Coin);
3148
+ return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
3098
3149
  }
3099
3150
  function getOutputsChange(outputs) {
3100
- return getOutputsByType(outputs, import_transactions13.OutputType.Change);
3151
+ return getOutputsByType(outputs, import_transactions14.OutputType.Change);
3101
3152
  }
3102
3153
  function getOutputsContract(outputs) {
3103
- return getOutputsByType(outputs, import_transactions13.OutputType.Contract);
3154
+ return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
3104
3155
  }
3105
3156
  function getOutputsVariable(outputs) {
3106
- return getOutputsByType(outputs, import_transactions13.OutputType.Variable);
3157
+ return getOutputsByType(outputs, import_transactions14.OutputType.Variable);
3107
3158
  }
3108
3159
 
3109
3160
  // src/providers/transaction-summary/types.ts
@@ -3152,11 +3203,11 @@ function getReceiptsByType(receipts, type) {
3152
3203
  }
3153
3204
  function getTransactionTypeName(transactionType) {
3154
3205
  switch (transactionType) {
3155
- case import_transactions14.TransactionType.Mint:
3206
+ case import_transactions15.TransactionType.Mint:
3156
3207
  return "Mint" /* Mint */;
3157
- case import_transactions14.TransactionType.Create:
3208
+ case import_transactions15.TransactionType.Create:
3158
3209
  return "Create" /* Create */;
3159
- case import_transactions14.TransactionType.Script:
3210
+ case import_transactions15.TransactionType.Script:
3160
3211
  return "Script" /* Script */;
3161
3212
  default:
3162
3213
  throw new import_errors11.FuelError(
@@ -3188,10 +3239,10 @@ function hasSameAssetId(a) {
3188
3239
  return (b) => a.assetId === b.assetId;
3189
3240
  }
3190
3241
  function getReceiptsCall(receipts) {
3191
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.Call);
3242
+ return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
3192
3243
  }
3193
3244
  function getReceiptsMessageOut(receipts) {
3194
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.MessageOut);
3245
+ return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
3195
3246
  }
3196
3247
  var mergeAssets = (op1, op2) => {
3197
3248
  const assets1 = op1.assetsSent || [];
@@ -3204,7 +3255,7 @@ var mergeAssets = (op1, op2) => {
3204
3255
  if (!matchingAsset) {
3205
3256
  return asset1;
3206
3257
  }
3207
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
3258
+ const mergedAmount = (0, import_math14.bn)(asset1.amount).add(matchingAsset.amount);
3208
3259
  return { ...asset1, amount: mergedAmount };
3209
3260
  });
3210
3261
  return mergedAssets.concat(filteredAssets);
@@ -3230,7 +3281,7 @@ function addOperation(operations, toAdd) {
3230
3281
  return allOperations;
3231
3282
  }
3232
3283
  function getReceiptsTransferOut(receipts) {
3233
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.TransferOut);
3284
+ return getReceiptsByType(receipts, import_transactions15.ReceiptType.TransferOut);
3234
3285
  }
3235
3286
  function getWithdrawFromFuelOperations({
3236
3287
  inputs,
@@ -3390,11 +3441,11 @@ function getTransferOperations({
3390
3441
  });
3391
3442
  const transferReceipts = getReceiptsByType(
3392
3443
  receipts,
3393
- import_transactions14.ReceiptType.Transfer
3444
+ import_transactions15.ReceiptType.Transfer
3394
3445
  );
3395
3446
  const transferOutReceipts = getReceiptsByType(
3396
3447
  receipts,
3397
- import_transactions14.ReceiptType.TransferOut
3448
+ import_transactions15.ReceiptType.TransferOut
3398
3449
  );
3399
3450
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3400
3451
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3479,17 +3530,17 @@ function getOperations({
3479
3530
  }
3480
3531
 
3481
3532
  // src/providers/transaction-summary/receipt.ts
3482
- var import_transactions15 = require("@fuel-ts/transactions");
3533
+ var import_transactions16 = require("@fuel-ts/transactions");
3483
3534
  var processGqlReceipt = (gqlReceipt) => {
3484
3535
  const receipt = assembleReceiptByType(gqlReceipt);
3485
3536
  switch (receipt.type) {
3486
- case import_transactions15.ReceiptType.ReturnData: {
3537
+ case import_transactions16.ReceiptType.ReturnData: {
3487
3538
  return {
3488
3539
  ...receipt,
3489
3540
  data: gqlReceipt.data || "0x"
3490
3541
  };
3491
3542
  }
3492
- case import_transactions15.ReceiptType.LogData: {
3543
+ case import_transactions16.ReceiptType.LogData: {
3493
3544
  return {
3494
3545
  ...receipt,
3495
3546
  data: gqlReceipt.data || "0x"
@@ -3502,7 +3553,7 @@ var processGqlReceipt = (gqlReceipt) => {
3502
3553
  var extractMintedAssetsFromReceipts = (receipts) => {
3503
3554
  const mintedAssets = [];
3504
3555
  receipts.forEach((receipt) => {
3505
- if (receipt.type === import_transactions15.ReceiptType.Mint) {
3556
+ if (receipt.type === import_transactions16.ReceiptType.Mint) {
3506
3557
  mintedAssets.push({
3507
3558
  subId: receipt.subId,
3508
3559
  contractId: receipt.contractId,
@@ -3516,7 +3567,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3516
3567
  var extractBurnedAssetsFromReceipts = (receipts) => {
3517
3568
  const burnedAssets = [];
3518
3569
  receipts.forEach((receipt) => {
3519
- if (receipt.type === import_transactions15.ReceiptType.Burn) {
3570
+ if (receipt.type === import_transactions16.ReceiptType.Burn) {
3520
3571
  burnedAssets.push({
3521
3572
  subId: receipt.subId,
3522
3573
  contractId: receipt.contractId,
@@ -3530,7 +3581,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3530
3581
 
3531
3582
  // src/providers/transaction-summary/status.ts
3532
3583
  var import_errors12 = require("@fuel-ts/errors");
3533
- var import_math14 = require("@fuel-ts/math");
3584
+ var import_math15 = require("@fuel-ts/math");
3534
3585
  var getTransactionStatusName = (gqlStatus) => {
3535
3586
  switch (gqlStatus) {
3536
3587
  case "FailureStatus":
@@ -3564,15 +3615,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3564
3615
  time = gqlTransactionStatus.time;
3565
3616
  blockId = gqlTransactionStatus.block.id;
3566
3617
  isStatusSuccess = true;
3567
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3568
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3618
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3619
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3569
3620
  break;
3570
3621
  case "FailureStatus":
3571
3622
  time = gqlTransactionStatus.time;
3572
3623
  blockId = gqlTransactionStatus.block.id;
3573
3624
  isStatusFailure = true;
3574
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3575
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3625
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3626
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3576
3627
  break;
3577
3628
  case "SubmittedStatus":
3578
3629
  time = gqlTransactionStatus.time;
@@ -3622,7 +3673,7 @@ function assembleTransactionSummary(params) {
3622
3673
  maxInputs
3623
3674
  });
3624
3675
  const typeName = getTransactionTypeName(transaction.type);
3625
- const tip = (0, import_math15.bn)(transaction.policies?.find((policy) => policy.type === import_transactions16.PolicyType.Tip)?.data);
3676
+ const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
3626
3677
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3627
3678
  const fee = calculateTXFeeForSummary({
3628
3679
  totalFee,
@@ -3673,12 +3724,12 @@ function assembleTransactionSummary(params) {
3673
3724
 
3674
3725
  // src/providers/transaction-response/getDecodedLogs.ts
3675
3726
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
3676
- var import_transactions17 = require("@fuel-ts/transactions");
3727
+ var import_transactions18 = require("@fuel-ts/transactions");
3677
3728
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3678
3729
  return receipts.reduce((logs, receipt) => {
3679
- if (receipt.type === import_transactions17.ReceiptType.LogData || receipt.type === import_transactions17.ReceiptType.Log) {
3730
+ if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
3680
3731
  const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
3681
- const data = receipt.type === import_transactions17.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3732
+ const data = receipt.type === import_transactions18.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3682
3733
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3683
3734
  logs.push(decodedLog);
3684
3735
  }
@@ -3693,7 +3744,7 @@ var TransactionResponse = class {
3693
3744
  /** Current provider */
3694
3745
  provider;
3695
3746
  /** Gas used on the transaction */
3696
- gasUsed = (0, import_math16.bn)(0);
3747
+ gasUsed = (0, import_math17.bn)(0);
3697
3748
  /** The graphql Transaction with receipts object. */
3698
3749
  gqlTransaction;
3699
3750
  abis;
@@ -3751,7 +3802,7 @@ var TransactionResponse = class {
3751
3802
  * @returns The decoded transaction.
3752
3803
  */
3753
3804
  decodeTransaction(transactionWithReceipts) {
3754
- return new import_transactions18.TransactionCoder().decode(
3805
+ return new import_transactions19.TransactionCoder().decode(
3755
3806
  (0, import_utils20.arrayify)(transactionWithReceipts.rawPayload),
3756
3807
  0
3757
3808
  )?.[0];
@@ -3927,47 +3978,47 @@ var processGqlChain = (chain) => {
3927
3978
  } = consensusParameters;
3928
3979
  return {
3929
3980
  name,
3930
- baseChainHeight: (0, import_math17.bn)(daHeight),
3981
+ baseChainHeight: (0, import_math18.bn)(daHeight),
3931
3982
  consensusParameters: {
3932
3983
  version,
3933
- chainId: (0, import_math17.bn)(chainId),
3984
+ chainId: (0, import_math18.bn)(chainId),
3934
3985
  baseAssetId,
3935
3986
  feeParameters: {
3936
3987
  version: feeParams.version,
3937
- gasPerByte: (0, import_math17.bn)(feeParams.gasPerByte),
3938
- gasPriceFactor: (0, import_math17.bn)(feeParams.gasPriceFactor)
3988
+ gasPerByte: (0, import_math18.bn)(feeParams.gasPerByte),
3989
+ gasPriceFactor: (0, import_math18.bn)(feeParams.gasPriceFactor)
3939
3990
  },
3940
3991
  contractParameters: {
3941
3992
  version: contractParams.version,
3942
- contractMaxSize: (0, import_math17.bn)(contractParams.contractMaxSize),
3943
- maxStorageSlots: (0, import_math17.bn)(contractParams.maxStorageSlots)
3993
+ contractMaxSize: (0, import_math18.bn)(contractParams.contractMaxSize),
3994
+ maxStorageSlots: (0, import_math18.bn)(contractParams.maxStorageSlots)
3944
3995
  },
3945
3996
  txParameters: {
3946
3997
  version: txParams.version,
3947
- maxInputs: (0, import_math17.bn)(txParams.maxInputs),
3948
- maxOutputs: (0, import_math17.bn)(txParams.maxOutputs),
3949
- maxWitnesses: (0, import_math17.bn)(txParams.maxWitnesses),
3950
- maxGasPerTx: (0, import_math17.bn)(txParams.maxGasPerTx),
3951
- maxSize: (0, import_math17.bn)(txParams.maxSize),
3952
- maxBytecodeSubsections: (0, import_math17.bn)(txParams.maxBytecodeSubsections)
3998
+ maxInputs: (0, import_math18.bn)(txParams.maxInputs),
3999
+ maxOutputs: (0, import_math18.bn)(txParams.maxOutputs),
4000
+ maxWitnesses: (0, import_math18.bn)(txParams.maxWitnesses),
4001
+ maxGasPerTx: (0, import_math18.bn)(txParams.maxGasPerTx),
4002
+ maxSize: (0, import_math18.bn)(txParams.maxSize),
4003
+ maxBytecodeSubsections: (0, import_math18.bn)(txParams.maxBytecodeSubsections)
3953
4004
  },
3954
4005
  predicateParameters: {
3955
4006
  version: predicateParams.version,
3956
- maxPredicateLength: (0, import_math17.bn)(predicateParams.maxPredicateLength),
3957
- maxPredicateDataLength: (0, import_math17.bn)(predicateParams.maxPredicateDataLength),
3958
- maxGasPerPredicate: (0, import_math17.bn)(predicateParams.maxGasPerPredicate),
3959
- maxMessageDataLength: (0, import_math17.bn)(predicateParams.maxMessageDataLength)
4007
+ maxPredicateLength: (0, import_math18.bn)(predicateParams.maxPredicateLength),
4008
+ maxPredicateDataLength: (0, import_math18.bn)(predicateParams.maxPredicateDataLength),
4009
+ maxGasPerPredicate: (0, import_math18.bn)(predicateParams.maxGasPerPredicate),
4010
+ maxMessageDataLength: (0, import_math18.bn)(predicateParams.maxMessageDataLength)
3960
4011
  },
3961
4012
  scriptParameters: {
3962
4013
  version: scriptParams.version,
3963
- maxScriptLength: (0, import_math17.bn)(scriptParams.maxScriptLength),
3964
- maxScriptDataLength: (0, import_math17.bn)(scriptParams.maxScriptDataLength)
4014
+ maxScriptLength: (0, import_math18.bn)(scriptParams.maxScriptLength),
4015
+ maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
3965
4016
  },
3966
4017
  gasCosts
3967
4018
  },
3968
4019
  latestBlock: {
3969
4020
  id: latestBlock.id,
3970
- height: (0, import_math17.bn)(latestBlock.height),
4021
+ height: (0, import_math18.bn)(latestBlock.height),
3971
4022
  time: latestBlock.header.time,
3972
4023
  transactions: latestBlock.transactions.map((i) => ({
3973
4024
  id: i.id
@@ -4163,7 +4214,7 @@ Supported fuel-core version: ${supportedVersion}.`
4163
4214
  */
4164
4215
  async getBlockNumber() {
4165
4216
  const { chain } = await this.operations.getChain();
4166
- return (0, import_math17.bn)(chain.latestBlock.height, 10);
4217
+ return (0, import_math18.bn)(chain.latestBlock.height, 10);
4167
4218
  }
4168
4219
  /**
4169
4220
  * Returns the chain information.
@@ -4173,8 +4224,8 @@ Supported fuel-core version: ${supportedVersion}.`
4173
4224
  async fetchNode() {
4174
4225
  const { nodeInfo } = await this.operations.getNodeInfo();
4175
4226
  const processedNodeInfo = {
4176
- maxDepth: (0, import_math17.bn)(nodeInfo.maxDepth),
4177
- maxTx: (0, import_math17.bn)(nodeInfo.maxTx),
4227
+ maxDepth: (0, import_math18.bn)(nodeInfo.maxDepth),
4228
+ maxTx: (0, import_math18.bn)(nodeInfo.maxTx),
4178
4229
  nodeVersion: nodeInfo.nodeVersion,
4179
4230
  utxoValidation: nodeInfo.utxoValidation,
4180
4231
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4232,7 +4283,7 @@ Supported fuel-core version: ${supportedVersion}.`
4232
4283
  }
4233
4284
  const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4234
4285
  let abis;
4235
- if (transactionRequest.type === import_transactions19.TransactionType.Script) {
4286
+ if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4236
4287
  abis = transactionRequest.abis;
4237
4288
  }
4238
4289
  if (awaitExecution) {
@@ -4291,7 +4342,7 @@ Supported fuel-core version: ${supportedVersion}.`
4291
4342
  async estimatePredicates(transactionRequest) {
4292
4343
  const shouldEstimatePredicates = Boolean(
4293
4344
  transactionRequest.inputs.find(
4294
- (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
4345
+ (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
4295
4346
  )
4296
4347
  );
4297
4348
  if (!shouldEstimatePredicates) {
@@ -4306,7 +4357,7 @@ Supported fuel-core version: ${supportedVersion}.`
4306
4357
  } = response;
4307
4358
  if (inputs) {
4308
4359
  inputs.forEach((input, index) => {
4309
- if ("predicateGasUsed" in input && (0, import_math17.bn)(input.predicateGasUsed).gt(0)) {
4360
+ if ("predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
4310
4361
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4311
4362
  }
4312
4363
  });
@@ -4324,7 +4375,7 @@ Supported fuel-core version: ${supportedVersion}.`
4324
4375
  * @returns A promise.
4325
4376
  */
4326
4377
  async estimateTxDependencies(transactionRequest) {
4327
- if (transactionRequest.type === import_transactions19.TransactionType.Create) {
4378
+ if (transactionRequest.type === import_transactions20.TransactionType.Create) {
4328
4379
  return {
4329
4380
  receipts: [],
4330
4381
  outputVariables: 0,
@@ -4388,7 +4439,7 @@ Supported fuel-core version: ${supportedVersion}.`
4388
4439
  const allRequests = (0, import_ramda3.clone)(transactionRequests);
4389
4440
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4390
4441
  allRequests.forEach((req, index) => {
4391
- if (req.type === import_transactions19.TransactionType.Script) {
4442
+ if (req.type === import_transactions20.TransactionType.Script) {
4392
4443
  serializedTransactionsMap.set(index, (0, import_utils22.hexlify)(req.toTransactionBytes()));
4393
4444
  }
4394
4445
  });
@@ -4414,7 +4465,7 @@ Supported fuel-core version: ${supportedVersion}.`
4414
4465
  );
4415
4466
  const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
4416
4467
  const request = allRequests[requestIdx];
4417
- if (hasMissingOutputs && request?.type === import_transactions19.TransactionType.Script) {
4468
+ if (hasMissingOutputs && request?.type === import_transactions20.TransactionType.Script) {
4418
4469
  result.outputVariables += missingOutputVariables.length;
4419
4470
  request.addVariableOutputs(missingOutputVariables.length);
4420
4471
  missingOutputContractIds.forEach(({ contractId }) => {
@@ -4464,13 +4515,13 @@ Supported fuel-core version: ${supportedVersion}.`
4464
4515
  gasPrice = await this.estimateGasPrice(10);
4465
4516
  }
4466
4517
  const minFee = calculateGasFee({
4467
- gasPrice: (0, import_math17.bn)(gasPrice),
4518
+ gasPrice: (0, import_math18.bn)(gasPrice),
4468
4519
  gas: minGas,
4469
4520
  priceFactor: gasPriceFactor,
4470
4521
  tip: transactionRequest.tip
4471
4522
  }).add(1);
4472
- let gasLimit = (0, import_math17.bn)(0);
4473
- if (transactionRequest.type === import_transactions19.TransactionType.Script) {
4523
+ let gasLimit = (0, import_math18.bn)(0);
4524
+ if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4474
4525
  gasLimit = transactionRequest.gasLimit;
4475
4526
  if (transactionRequest.gasLimit.eq(0)) {
4476
4527
  transactionRequest.gasLimit = minGas;
@@ -4482,7 +4533,7 @@ Supported fuel-core version: ${supportedVersion}.`
4482
4533
  }
4483
4534
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4484
4535
  const maxFee = calculateGasFee({
4485
- gasPrice: (0, import_math17.bn)(gasPrice),
4536
+ gasPrice: (0, import_math18.bn)(gasPrice),
4486
4537
  gas: maxGas,
4487
4538
  priceFactor: gasPriceFactor,
4488
4539
  tip: transactionRequest.tip
@@ -4540,14 +4591,14 @@ Supported fuel-core version: ${supportedVersion}.`
4540
4591
  */
4541
4592
  async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
4542
4593
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4543
- const isScriptTransaction = txRequestClone.type === import_transactions19.TransactionType.Script;
4594
+ const isScriptTransaction = txRequestClone.type === import_transactions20.TransactionType.Script;
4544
4595
  const baseAssetId = this.getBaseAssetId();
4545
4596
  const updateMaxFee = txRequestClone.maxFee.eq(0);
4546
4597
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4547
4598
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4548
4599
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4549
4600
  if (isScriptTransaction) {
4550
- txRequestClone.gasLimit = (0, import_math17.bn)(0);
4601
+ txRequestClone.gasLimit = (0, import_math18.bn)(0);
4551
4602
  }
4552
4603
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4553
4604
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4568,7 +4619,7 @@ Supported fuel-core version: ${supportedVersion}.`
4568
4619
  let dryRunStatus;
4569
4620
  let missingContractIds = [];
4570
4621
  let outputVariables = 0;
4571
- let gasUsed = (0, import_math17.bn)(0);
4622
+ let gasUsed = (0, import_math18.bn)(0);
4572
4623
  txRequestClone.maxFee = maxFee;
4573
4624
  if (isScriptTransaction) {
4574
4625
  txRequestClone.gasLimit = gasLimit;
@@ -4633,10 +4684,10 @@ Supported fuel-core version: ${supportedVersion}.`
4633
4684
  return coins.map((coin) => ({
4634
4685
  id: coin.utxoId,
4635
4686
  assetId: coin.assetId,
4636
- amount: (0, import_math17.bn)(coin.amount),
4687
+ amount: (0, import_math18.bn)(coin.amount),
4637
4688
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4638
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4639
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4689
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4690
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4640
4691
  }));
4641
4692
  }
4642
4693
  /**
@@ -4673,9 +4724,9 @@ Supported fuel-core version: ${supportedVersion}.`
4673
4724
  switch (coin.type) {
4674
4725
  case "MessageCoin":
4675
4726
  return {
4676
- amount: (0, import_math17.bn)(coin.amount),
4727
+ amount: (0, import_math18.bn)(coin.amount),
4677
4728
  assetId: coin.assetId,
4678
- daHeight: (0, import_math17.bn)(coin.daHeight),
4729
+ daHeight: (0, import_math18.bn)(coin.daHeight),
4679
4730
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4680
4731
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4681
4732
  nonce: coin.nonce
@@ -4683,11 +4734,11 @@ Supported fuel-core version: ${supportedVersion}.`
4683
4734
  case "Coin":
4684
4735
  return {
4685
4736
  id: coin.utxoId,
4686
- amount: (0, import_math17.bn)(coin.amount),
4737
+ amount: (0, import_math18.bn)(coin.amount),
4687
4738
  assetId: coin.assetId,
4688
4739
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4689
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4690
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4740
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4741
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4691
4742
  };
4692
4743
  default:
4693
4744
  return null;
@@ -4704,13 +4755,13 @@ Supported fuel-core version: ${supportedVersion}.`
4704
4755
  async getBlock(idOrHeight) {
4705
4756
  let variables;
4706
4757
  if (typeof idOrHeight === "number") {
4707
- variables = { height: (0, import_math17.bn)(idOrHeight).toString(10) };
4758
+ variables = { height: (0, import_math18.bn)(idOrHeight).toString(10) };
4708
4759
  } else if (idOrHeight === "latest") {
4709
4760
  variables = { height: (await this.getBlockNumber()).toString(10) };
4710
4761
  } else if (idOrHeight.length === 66) {
4711
4762
  variables = { blockId: idOrHeight };
4712
4763
  } else {
4713
- variables = { blockId: (0, import_math17.bn)(idOrHeight).toString(10) };
4764
+ variables = { blockId: (0, import_math18.bn)(idOrHeight).toString(10) };
4714
4765
  }
4715
4766
  const { block } = await this.operations.getBlock(variables);
4716
4767
  if (!block) {
@@ -4718,7 +4769,7 @@ Supported fuel-core version: ${supportedVersion}.`
4718
4769
  }
4719
4770
  return {
4720
4771
  id: block.id,
4721
- height: (0, import_math17.bn)(block.height),
4772
+ height: (0, import_math18.bn)(block.height),
4722
4773
  time: block.header.time,
4723
4774
  transactionIds: block.transactions.map((tx) => tx.id)
4724
4775
  };
@@ -4733,7 +4784,7 @@ Supported fuel-core version: ${supportedVersion}.`
4733
4784
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4734
4785
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4735
4786
  id: block.id,
4736
- height: (0, import_math17.bn)(block.height),
4787
+ height: (0, import_math18.bn)(block.height),
4737
4788
  time: block.header.time,
4738
4789
  transactionIds: block.transactions.map((tx) => tx.id)
4739
4790
  }));
@@ -4748,7 +4799,7 @@ Supported fuel-core version: ${supportedVersion}.`
4748
4799
  async getBlockWithTransactions(idOrHeight) {
4749
4800
  let variables;
4750
4801
  if (typeof idOrHeight === "number") {
4751
- variables = { blockHeight: (0, import_math17.bn)(idOrHeight).toString(10) };
4802
+ variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString(10) };
4752
4803
  } else if (idOrHeight === "latest") {
4753
4804
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4754
4805
  } else {
@@ -4760,11 +4811,11 @@ Supported fuel-core version: ${supportedVersion}.`
4760
4811
  }
4761
4812
  return {
4762
4813
  id: block.id,
4763
- height: (0, import_math17.bn)(block.height, 10),
4814
+ height: (0, import_math18.bn)(block.height, 10),
4764
4815
  time: block.header.time,
4765
4816
  transactionIds: block.transactions.map((tx) => tx.id),
4766
4817
  transactions: block.transactions.map(
4767
- (tx) => new import_transactions19.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4818
+ (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4768
4819
  )
4769
4820
  };
4770
4821
  }
@@ -4779,7 +4830,7 @@ Supported fuel-core version: ${supportedVersion}.`
4779
4830
  if (!transaction) {
4780
4831
  return null;
4781
4832
  }
4782
- return new import_transactions19.TransactionCoder().decode(
4833
+ return new import_transactions20.TransactionCoder().decode(
4783
4834
  (0, import_utils22.arrayify)(transaction.rawPayload),
4784
4835
  0
4785
4836
  )?.[0];
@@ -4809,7 +4860,7 @@ Supported fuel-core version: ${supportedVersion}.`
4809
4860
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4810
4861
  asset: (0, import_utils22.hexlify)(assetId)
4811
4862
  });
4812
- return (0, import_math17.bn)(contractBalance.amount, 10);
4863
+ return (0, import_math18.bn)(contractBalance.amount, 10);
4813
4864
  }
4814
4865
  /**
4815
4866
  * Returns the balance for the given owner for the given asset ID.
@@ -4823,7 +4874,7 @@ Supported fuel-core version: ${supportedVersion}.`
4823
4874
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4824
4875
  assetId: (0, import_utils22.hexlify)(assetId)
4825
4876
  });
4826
- return (0, import_math17.bn)(balance.amount, 10);
4877
+ return (0, import_math18.bn)(balance.amount, 10);
4827
4878
  }
4828
4879
  /**
4829
4880
  * Returns balances for the given owner.
@@ -4841,7 +4892,7 @@ Supported fuel-core version: ${supportedVersion}.`
4841
4892
  const balances = result.balances.edges.map((edge) => edge.node);
4842
4893
  return balances.map((balance) => ({
4843
4894
  assetId: balance.assetId,
4844
- amount: (0, import_math17.bn)(balance.amount)
4895
+ amount: (0, import_math18.bn)(balance.amount)
4845
4896
  }));
4846
4897
  }
4847
4898
  /**
@@ -4859,19 +4910,19 @@ Supported fuel-core version: ${supportedVersion}.`
4859
4910
  });
4860
4911
  const messages = result.messages.edges.map((edge) => edge.node);
4861
4912
  return messages.map((message) => ({
4862
- messageId: import_transactions19.InputMessageCoder.getMessageId({
4913
+ messageId: import_transactions20.InputMessageCoder.getMessageId({
4863
4914
  sender: message.sender,
4864
4915
  recipient: message.recipient,
4865
4916
  nonce: message.nonce,
4866
- amount: (0, import_math17.bn)(message.amount),
4917
+ amount: (0, import_math18.bn)(message.amount),
4867
4918
  data: message.data
4868
4919
  }),
4869
4920
  sender: import_address3.Address.fromAddressOrString(message.sender),
4870
4921
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4871
4922
  nonce: message.nonce,
4872
- amount: (0, import_math17.bn)(message.amount),
4873
- data: import_transactions19.InputMessageCoder.decodeData(message.data),
4874
- daHeight: (0, import_math17.bn)(message.daHeight)
4923
+ amount: (0, import_math18.bn)(message.amount),
4924
+ data: import_transactions20.InputMessageCoder.decodeData(message.data),
4925
+ daHeight: (0, import_math18.bn)(message.daHeight)
4875
4926
  }));
4876
4927
  }
4877
4928
  /**
@@ -4924,19 +4975,19 @@ Supported fuel-core version: ${supportedVersion}.`
4924
4975
  } = result.messageProof;
4925
4976
  return {
4926
4977
  messageProof: {
4927
- proofIndex: (0, import_math17.bn)(messageProof.proofIndex),
4978
+ proofIndex: (0, import_math18.bn)(messageProof.proofIndex),
4928
4979
  proofSet: messageProof.proofSet
4929
4980
  },
4930
4981
  blockProof: {
4931
- proofIndex: (0, import_math17.bn)(blockProof.proofIndex),
4982
+ proofIndex: (0, import_math18.bn)(blockProof.proofIndex),
4932
4983
  proofSet: blockProof.proofSet
4933
4984
  },
4934
4985
  messageBlockHeader: {
4935
4986
  id: messageBlockHeader.id,
4936
- daHeight: (0, import_math17.bn)(messageBlockHeader.daHeight),
4987
+ daHeight: (0, import_math18.bn)(messageBlockHeader.daHeight),
4937
4988
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4938
4989
  transactionsRoot: messageBlockHeader.transactionsRoot,
4939
- height: (0, import_math17.bn)(messageBlockHeader.height),
4990
+ height: (0, import_math18.bn)(messageBlockHeader.height),
4940
4991
  prevRoot: messageBlockHeader.prevRoot,
4941
4992
  time: messageBlockHeader.time,
4942
4993
  applicationHash: messageBlockHeader.applicationHash,
@@ -4948,10 +4999,10 @@ Supported fuel-core version: ${supportedVersion}.`
4948
4999
  },
4949
5000
  commitBlockHeader: {
4950
5001
  id: commitBlockHeader.id,
4951
- daHeight: (0, import_math17.bn)(commitBlockHeader.daHeight),
5002
+ daHeight: (0, import_math18.bn)(commitBlockHeader.daHeight),
4952
5003
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4953
5004
  transactionsRoot: commitBlockHeader.transactionsRoot,
4954
- height: (0, import_math17.bn)(commitBlockHeader.height),
5005
+ height: (0, import_math18.bn)(commitBlockHeader.height),
4955
5006
  prevRoot: commitBlockHeader.prevRoot,
4956
5007
  time: commitBlockHeader.time,
4957
5008
  applicationHash: commitBlockHeader.applicationHash,
@@ -4964,19 +5015,19 @@ Supported fuel-core version: ${supportedVersion}.`
4964
5015
  sender: import_address3.Address.fromAddressOrString(sender),
4965
5016
  recipient: import_address3.Address.fromAddressOrString(recipient),
4966
5017
  nonce,
4967
- amount: (0, import_math17.bn)(amount),
5018
+ amount: (0, import_math18.bn)(amount),
4968
5019
  data
4969
5020
  };
4970
5021
  }
4971
5022
  async getLatestGasPrice() {
4972
5023
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4973
- return (0, import_math17.bn)(latestGasPrice.gasPrice);
5024
+ return (0, import_math18.bn)(latestGasPrice.gasPrice);
4974
5025
  }
4975
5026
  async estimateGasPrice(blockHorizon) {
4976
5027
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4977
5028
  blockHorizon: String(blockHorizon)
4978
5029
  });
4979
- return (0, import_math17.bn)(estimateGasPrice.gasPrice);
5030
+ return (0, import_math18.bn)(estimateGasPrice.gasPrice);
4980
5031
  }
4981
5032
  /**
4982
5033
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4997,10 +5048,10 @@ Supported fuel-core version: ${supportedVersion}.`
4997
5048
  */
4998
5049
  async produceBlocks(amount, startTime) {
4999
5050
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
5000
- blocksToProduce: (0, import_math17.bn)(amount).toString(10),
5051
+ blocksToProduce: (0, import_math18.bn)(amount).toString(10),
5001
5052
  startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
5002
5053
  });
5003
- return (0, import_math17.bn)(latestBlockHeight);
5054
+ return (0, import_math18.bn)(latestBlockHeight);
5004
5055
  }
5005
5056
  // eslint-disable-next-line @typescript-eslint/require-await
5006
5057
  async getTransactionResponse(transactionId) {
@@ -5036,7 +5087,7 @@ cacheInputs_fn = function(inputs) {
5036
5087
  return;
5037
5088
  }
5038
5089
  inputs.forEach((input) => {
5039
- if (input.type === import_transactions19.InputType.Coin) {
5090
+ if (input.type === import_transactions20.InputType.Coin) {
5040
5091
  this.cache?.set(input.id);
5041
5092
  }
5042
5093
  });
@@ -5046,8 +5097,8 @@ __publicField(Provider, "nodeInfoCache", {});
5046
5097
 
5047
5098
  // src/providers/transaction-summary/get-transaction-summary.ts
5048
5099
  var import_errors15 = require("@fuel-ts/errors");
5049
- var import_math18 = require("@fuel-ts/math");
5050
- var import_transactions20 = require("@fuel-ts/transactions");
5100
+ var import_math19 = require("@fuel-ts/math");
5101
+ var import_transactions21 = require("@fuel-ts/transactions");
5051
5102
  var import_utils25 = require("@fuel-ts/utils");
5052
5103
  async function getTransactionSummary(params) {
5053
5104
  const { id, provider, abiMap } = params;
@@ -5060,7 +5111,7 @@ async function getTransactionSummary(params) {
5060
5111
  `Transaction not found for given id: ${id}.`
5061
5112
  );
5062
5113
  }
5063
- const [decodedTransaction] = new import_transactions20.TransactionCoder().decode(
5114
+ const [decodedTransaction] = new import_transactions21.TransactionCoder().decode(
5064
5115
  (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5065
5116
  0
5066
5117
  );
@@ -5083,8 +5134,8 @@ async function getTransactionSummary(params) {
5083
5134
  transaction: decodedTransaction,
5084
5135
  transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
5085
5136
  gqlTransactionStatus: gqlTransaction.status,
5086
- gasPerByte: (0, import_math18.bn)(gasPerByte),
5087
- gasPriceFactor: (0, import_math18.bn)(gasPriceFactor),
5137
+ gasPerByte: (0, import_math19.bn)(gasPerByte),
5138
+ gasPriceFactor: (0, import_math19.bn)(gasPriceFactor),
5088
5139
  abiMap,
5089
5140
  maxInputs,
5090
5141
  gasCosts,
@@ -5133,7 +5184,7 @@ async function getTransactionsSummaries(params) {
5133
5184
  const transactions = edges.map((edge) => {
5134
5185
  const { node: gqlTransaction } = edge;
5135
5186
  const { id, rawPayload, status } = gqlTransaction;
5136
- const [decodedTransaction] = new import_transactions20.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
5187
+ const [decodedTransaction] = new import_transactions21.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
5137
5188
  let txReceipts = [];
5138
5189
  if (gqlTransaction?.status && "receipts" in gqlTransaction.status) {
5139
5190
  txReceipts = gqlTransaction.status.receipts;
@@ -5290,22 +5341,6 @@ var rawAssets = [
5290
5341
  ];
5291
5342
  var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5292
5343
 
5293
- // src/providers/transaction-request/helpers.ts
5294
- var import_math19 = require("@fuel-ts/math");
5295
- var import_transactions21 = require("@fuel-ts/transactions");
5296
- var isRequestInputCoin = (input) => input.type === import_transactions21.InputType.Coin;
5297
- var isRequestInputMessage = (input) => input.type === import_transactions21.InputType.Message;
5298
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
5299
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
5300
- if (isRequestInputCoin(input) && input.assetId === assetId) {
5301
- return acc.add(input.amount);
5302
- }
5303
- if (isRequestInputMessage(input) && assetId === baseAsset) {
5304
- return acc.add(input.amount);
5305
- }
5306
- return acc;
5307
- }, (0, import_math19.bn)(0));
5308
-
5309
5344
  // src/utils/formatTransferToContractScriptData.ts
5310
5345
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
5311
5346
  var import_math20 = require("@fuel-ts/math");
@@ -5543,7 +5578,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5543
5578
  while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5544
5579
  const resources = await this.getResourcesToSpend(
5545
5580
  missingQuantities,
5546
- cacheTxInputsFromOwner(request.inputs, this.address)
5581
+ cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5547
5582
  );
5548
5583
  request.addResources(resources);
5549
5584
  request.shiftPredicateData();
@@ -6115,18 +6150,17 @@ var BaseWalletUnlocked = class extends Account {
6115
6150
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6116
6151
 
6117
6152
  // src/hdwallet/hdwallet.ts
6153
+ var import_crypto5 = require("@fuel-ts/crypto");
6118
6154
  var import_errors20 = require("@fuel-ts/errors");
6119
6155
  var import_hasher6 = require("@fuel-ts/hasher");
6120
6156
  var import_math23 = require("@fuel-ts/math");
6121
6157
  var import_utils35 = require("@fuel-ts/utils");
6122
- var import_ethers2 = require("ethers");
6123
6158
 
6124
6159
  // src/mnemonic/mnemonic.ts
6125
6160
  var import_crypto4 = require("@fuel-ts/crypto");
6126
6161
  var import_errors19 = require("@fuel-ts/errors");
6127
6162
  var import_hasher5 = require("@fuel-ts/hasher");
6128
6163
  var import_utils33 = require("@fuel-ts/utils");
6129
- var import_ethers = require("ethers");
6130
6164
 
6131
6165
  // src/wordlists/words/english.ts
6132
6166
  var english = [
@@ -8380,7 +8414,7 @@ var Mnemonic = class {
8380
8414
  assertMnemonic(getWords(phrase));
8381
8415
  const phraseBytes = toUtf8Bytes(getPhrase(phrase));
8382
8416
  const salt = toUtf8Bytes(`mnemonic${passphrase}`);
8383
- return (0, import_ethers.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
8417
+ return (0, import_crypto4.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
8384
8418
  }
8385
8419
  /**
8386
8420
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -8442,7 +8476,7 @@ var Mnemonic = class {
8442
8476
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
8443
8477
  );
8444
8478
  }
8445
- return (0, import_utils33.arrayify)((0, import_ethers.computeHmac)("sha512", MasterSecret, seedArray));
8479
+ return (0, import_utils33.arrayify)((0, import_crypto4.computeHmac)("sha512", MasterSecret, seedArray));
8446
8480
  }
8447
8481
  /**
8448
8482
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8467,8 +8501,8 @@ var Mnemonic = class {
8467
8501
  chainCode,
8468
8502
  (0, import_utils33.concat)(["0x00", privateKey])
8469
8503
  ]);
8470
- const checksum = (0, import_ethers.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8471
- return (0, import_ethers.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8504
+ const checksum = (0, import_utils33.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8505
+ return (0, import_utils33.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8472
8506
  }
8473
8507
  /**
8474
8508
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -8496,7 +8530,7 @@ var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
8496
8530
  var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
8497
8531
  var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
8498
8532
  function base58check(data) {
8499
- return (0, import_ethers2.encodeBase58)((0, import_utils35.concat)([data, (0, import_ethers2.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8533
+ return (0, import_utils35.encodeBase58)((0, import_utils35.concat)([data, (0, import_utils35.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8500
8534
  }
8501
8535
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8502
8536
  if (isPublic) {
@@ -8552,7 +8586,7 @@ var HDWallet = class {
8552
8586
  this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
8553
8587
  }
8554
8588
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
8555
- this.fingerprint = (0, import_ethers2.dataSlice)((0, import_ethers2.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8589
+ this.fingerprint = (0, import_utils35.dataSlice)((0, import_crypto5.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
8556
8590
  this.depth = config.depth || this.depth;
8557
8591
  this.index = config.index || this.index;
8558
8592
  this.chainCode = config.chainCode;
@@ -8584,7 +8618,7 @@ var HDWallet = class {
8584
8618
  data.set((0, import_utils35.arrayify)(this.publicKey));
8585
8619
  }
8586
8620
  data.set((0, import_math23.toBytes)(index, 4), 33);
8587
- const bytes = (0, import_utils35.arrayify)((0, import_ethers2.computeHmac)("sha512", chainCode, data));
8621
+ const bytes = (0, import_utils35.arrayify)((0, import_crypto5.computeHmac)("sha512", chainCode, data));
8588
8622
  const IL = bytes.slice(0, 32);
8589
8623
  const IR = bytes.slice(32);
8590
8624
  if (privateKey) {
@@ -8655,7 +8689,7 @@ var HDWallet = class {
8655
8689
  });
8656
8690
  }
8657
8691
  static fromExtendedKey(extendedKey) {
8658
- const decoded = (0, import_ethers2.toBeHex)((0, import_ethers2.decodeBase58)(extendedKey));
8692
+ const decoded = (0, import_utils35.hexlify)((0, import_math23.toBytes)((0, import_utils35.decodeBase58)(extendedKey)));
8659
8693
  const bytes = (0, import_utils35.arrayify)(decoded);
8660
8694
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8661
8695
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
@@ -8855,7 +8889,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8855
8889
 
8856
8890
  // src/wallet-manager/wallet-manager.ts
8857
8891
  var import_address9 = require("@fuel-ts/address");
8858
- var import_crypto5 = require("@fuel-ts/crypto");
8892
+ var import_crypto6 = require("@fuel-ts/crypto");
8859
8893
  var import_errors23 = require("@fuel-ts/errors");
8860
8894
  var import_events = require("events");
8861
8895
 
@@ -9183,7 +9217,7 @@ var _WalletManager = class extends import_events.EventEmitter {
9183
9217
  await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
9184
9218
  const data = await this.storage.getItem(this.STORAGE_KEY);
9185
9219
  if (data) {
9186
- const state = await (0, import_crypto5.decrypt)(__privateGet(this, _passphrase), JSON.parse(data));
9220
+ const state = await (0, import_crypto6.decrypt)(__privateGet(this, _passphrase), JSON.parse(data));
9187
9221
  __privateSet(this, _vaults, __privateMethod(this, _deserializeVaults, deserializeVaults_fn).call(this, state.vaults));
9188
9222
  }
9189
9223
  }
@@ -9192,7 +9226,7 @@ var _WalletManager = class extends import_events.EventEmitter {
9192
9226
  */
9193
9227
  async saveState() {
9194
9228
  await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
9195
- const encryptedData = await (0, import_crypto5.encrypt)(__privateGet(this, _passphrase), {
9229
+ const encryptedData = await (0, import_crypto6.encrypt)(__privateGet(this, _passphrase), {
9196
9230
  vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
9197
9231
  });
9198
9232
  await this.storage.setItem(this.STORAGE_KEY, JSON.stringify(encryptedData));
@@ -9330,10 +9364,15 @@ var Predicate = class extends Account {
9330
9364
  populateTransactionPredicateData(transactionRequestLike) {
9331
9365
  const request = transactionRequestify(transactionRequestLike);
9332
9366
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
9333
- request.inputs?.forEach((input) => {
9334
- if (input.type === import_transactions22.InputType.Coin && (0, import_utils37.hexlify)(input.owner) === this.address.toB256()) {
9367
+ const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
9368
+ if (placeholderIndex !== -1) {
9369
+ request.removeWitness(placeholderIndex);
9370
+ }
9371
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
9372
+ if (isRequestInputResourceFromOwner(input, this.address)) {
9335
9373
  input.predicate = (0, import_utils37.hexlify)(this.bytes);
9336
9374
  input.predicateData = (0, import_utils37.hexlify)(this.getPredicateData(policies.length));
9375
+ input.witnessIndex = 0;
9337
9376
  }
9338
9377
  });
9339
9378
  return request;
@@ -9456,6 +9495,28 @@ var Predicate = class extends Account {
9456
9495
  }
9457
9496
  return mutatedBytes;
9458
9497
  }
9498
+ /**
9499
+ * Returns the index of the witness placeholder that was added to this predicate.
9500
+ * If no witness placeholder was added, it returns -1.
9501
+ * @param request - The transaction request.
9502
+ * @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
9503
+ */
9504
+ getIndexFromPlaceholderWitness(request) {
9505
+ const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
9506
+ let index = -1;
9507
+ const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
9508
+ if (hasEmptyPredicateInputs) {
9509
+ index = hasEmptyPredicateInputs.witnessIndex;
9510
+ const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
9511
+ if (!allInputsAreEmpty) {
9512
+ const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
9513
+ if (wasFilledInputAddedFirst) {
9514
+ index = -1;
9515
+ }
9516
+ }
9517
+ }
9518
+ return index;
9519
+ }
9459
9520
  };
9460
9521
 
9461
9522
  // src/connectors/fuel.ts
@@ -10179,7 +10240,8 @@ __publicField(Fuel, "defaultConfig", {});
10179
10240
  assets,
10180
10241
  buildBlockExplorerUrl,
10181
10242
  cacheFor,
10182
- cacheTxInputsFromOwner,
10243
+ cacheRequestInputsResources,
10244
+ cacheRequestInputsResourcesFromOwner,
10183
10245
  calculateGasFee,
10184
10246
  calculateMetadataGasForTxCreate,
10185
10247
  calculateMetadataGasForTxScript,
@@ -10193,6 +10255,7 @@ __publicField(Fuel, "defaultConfig", {});
10193
10255
  extractTxError,
10194
10256
  fuelAssetsBaseUrl,
10195
10257
  gasUsedByInputs,
10258
+ getAssetAmountInRequestInputs,
10196
10259
  getAssetEth,
10197
10260
  getAssetFuel,
10198
10261
  getAssetNetwork,
@@ -10227,6 +10290,7 @@ __publicField(Fuel, "defaultConfig", {});
10227
10290
  getReceiptsMessageOut,
10228
10291
  getReceiptsTransferOut,
10229
10292
  getReceiptsWithMissingData,
10293
+ getRequestInputResourceOwner,
10230
10294
  getTransactionStatusName,
10231
10295
  getTransactionSummary,
10232
10296
  getTransactionSummaryFromRequest,
@@ -10240,6 +10304,10 @@ __publicField(Fuel, "defaultConfig", {});
10240
10304
  isMessage,
10241
10305
  isRawCoin,
10242
10306
  isRawMessage,
10307
+ isRequestInputCoin,
10308
+ isRequestInputMessage,
10309
+ isRequestInputResource,
10310
+ isRequestInputResourceFromOwner,
10243
10311
  isType,
10244
10312
  isTypeCreate,
10245
10313
  isTypeMint,