@fuel-ts/account 0.94.4 → 0.94.6

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.
Files changed (66) hide show
  1. package/dist/configs.d.ts +6 -0
  2. package/dist/configs.d.ts.map +1 -1
  3. package/dist/configs.global.js.map +1 -1
  4. package/dist/configs.js.map +1 -1
  5. package/dist/configs.mjs.map +1 -1
  6. package/dist/connectors/fuel-connector.d.ts +3 -4
  7. package/dist/connectors/fuel-connector.d.ts.map +1 -1
  8. package/dist/connectors/types/data-type.d.ts +7 -0
  9. package/dist/connectors/types/data-type.d.ts.map +1 -1
  10. package/dist/connectors/types/local-storage.d.ts +0 -1
  11. package/dist/connectors/types/local-storage.d.ts.map +1 -1
  12. package/dist/index.global.js +1659 -1135
  13. package/dist/index.global.js.map +1 -1
  14. package/dist/index.js +1329 -416
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +1271 -367
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/providers/__generated__/operations.d.ts +169 -0
  19. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  20. package/dist/providers/assets/assets.d.ts +1 -1
  21. package/dist/providers/assets/assets.d.ts.map +1 -1
  22. package/dist/providers/assets/utils/network.d.ts.map +1 -1
  23. package/dist/providers/assets/utils/resolveIconPaths.d.ts +1 -1
  24. package/dist/providers/chains.d.ts +2 -0
  25. package/dist/providers/chains.d.ts.map +1 -1
  26. package/dist/providers/fuel-graphql-subscriber.d.ts +0 -2
  27. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  28. package/dist/providers/message.d.ts.map +1 -1
  29. package/dist/providers/provider.d.ts +17 -4
  30. package/dist/providers/provider.d.ts.map +1 -1
  31. package/dist/providers/resource.d.ts.map +1 -1
  32. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  33. package/dist/providers/transaction-request/index.d.ts +2 -0
  34. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  35. package/dist/providers/transaction-request/transaction-request.d.ts +2 -2
  36. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  37. package/dist/providers/transaction-request/types.d.ts +8 -2
  38. package/dist/providers/transaction-request/types.d.ts.map +1 -1
  39. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts +87 -0
  40. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts.map +1 -0
  41. package/dist/providers/transaction-request/upload-transaction-request.d.ts +82 -0
  42. package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -0
  43. package/dist/providers/transaction-request/utils.d.ts +6 -0
  44. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  45. package/dist/providers/transaction-response/transaction-response.d.ts +3 -1
  46. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  47. package/dist/providers/transaction-summary/input.d.ts.map +1 -1
  48. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  49. package/dist/providers/transaction-summary/output.d.ts.map +1 -1
  50. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
  51. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  52. package/dist/providers/utils/gas.d.ts +16 -0
  53. package/dist/providers/utils/gas.d.ts.map +1 -1
  54. package/dist/providers/utils/receipts.d.ts.map +1 -1
  55. package/dist/test-utils/launchNode.d.ts.map +1 -1
  56. package/dist/test-utils/resources.d.ts.map +1 -1
  57. package/dist/test-utils/transactionRequest.d.ts.map +1 -1
  58. package/dist/test-utils.global.js +1653 -1131
  59. package/dist/test-utils.global.js.map +1 -1
  60. package/dist/test-utils.js +1238 -341
  61. package/dist/test-utils.js.map +1 -1
  62. package/dist/test-utils.mjs +1195 -300
  63. package/dist/test-utils.mjs.map +1 -1
  64. package/dist/wallet-manager/wallet-manager.d.ts +0 -1
  65. package/dist/wallet-manager/wallet-manager.d.ts.map +1 -1
  66. package/package.json +18 -17
@@ -376,15 +376,15 @@ var addAmountToCoinQuantities = (params) => {
376
376
 
377
377
  // src/providers/provider.ts
378
378
  import { Address as Address3 } from "@fuel-ts/address";
379
- import { ErrorCode as ErrorCode14, FuelError as FuelError16 } from "@fuel-ts/errors";
379
+ import { ErrorCode as ErrorCode14, FuelError as FuelError17 } from "@fuel-ts/errors";
380
380
  import { BN as BN2, bn as bn17 } from "@fuel-ts/math";
381
- import { InputType as InputType7, InputMessageCoder, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
382
- import { arrayify as arrayify12, hexlify as hexlify14, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
381
+ import { InputType as InputType7, InputMessageCoder as InputMessageCoder2, TransactionCoder as TransactionCoder5 } from "@fuel-ts/transactions";
382
+ import { arrayify as arrayify13, hexlify as hexlify17, DateTime as DateTime2, isDefined as isDefined2 } from "@fuel-ts/utils";
383
383
  import { checkFuelCoreVersionCompatibility } from "@fuel-ts/versions";
384
384
  import { equalBytes } from "@noble/curves/abstract/utils";
385
385
  import { GraphQLClient } from "graphql-request";
386
386
  import gql2 from "graphql-tag";
387
- import { clone as clone6 } from "ramda";
387
+ import { clone as clone8 } from "ramda";
388
388
 
389
389
  // src/providers/__generated__/operations.ts
390
390
  import gql from "graphql-tag";
@@ -1332,6 +1332,13 @@ var SubmitAndAwaitDocument = gql`
1332
1332
  }
1333
1333
  }
1334
1334
  ${TransactionStatusSubscriptionFragmentDoc}`;
1335
+ var SubmitAndAwaitStatusDocument = gql`
1336
+ subscription submitAndAwaitStatus($encodedTransaction: HexString!) {
1337
+ submitAndAwaitStatus(tx: $encodedTransaction) {
1338
+ ...transactionStatusSubscriptionFragment
1339
+ }
1340
+ }
1341
+ ${TransactionStatusSubscriptionFragmentDoc}`;
1335
1342
  var StatusChangeDocument = gql`
1336
1343
  subscription statusChange($transactionId: TransactionId!) {
1337
1344
  statusChange(id: $transactionId) {
@@ -1428,6 +1435,9 @@ function getSdk(requester) {
1428
1435
  submitAndAwait(variables, options) {
1429
1436
  return requester(SubmitAndAwaitDocument, variables, options);
1430
1437
  },
1438
+ submitAndAwaitStatus(variables, options) {
1439
+ return requester(SubmitAndAwaitStatusDocument, variables, options);
1440
+ },
1431
1441
  statusChange(variables, options) {
1432
1442
  return requester(StatusChangeDocument, variables, options);
1433
1443
  }
@@ -1454,7 +1464,9 @@ var _FuelGraphqlSubscriber = class {
1454
1464
  Accept: "text/event-stream"
1455
1465
  }
1456
1466
  });
1457
- return new _FuelGraphqlSubscriber(response.body.getReader());
1467
+ const [errorReader, resultReader] = response.body.tee().map((stream) => stream.getReader());
1468
+ await new _FuelGraphqlSubscriber(errorReader).next();
1469
+ return new _FuelGraphqlSubscriber(resultReader);
1458
1470
  }
1459
1471
  events = [];
1460
1472
  parsingLeftover = "";
@@ -1497,10 +1509,8 @@ var _FuelGraphqlSubscriber = class {
1497
1509
  /**
1498
1510
  * Gets called when `break` is called in a `for-await-of` loop.
1499
1511
  */
1500
- async return() {
1501
- await this.stream.cancel();
1502
- this.stream.releaseLock();
1503
- return { done: true, value: void 0 };
1512
+ return() {
1513
+ return Promise.resolve({ done: true, value: void 0 });
1504
1514
  }
1505
1515
  [Symbol.asyncIterator]() {
1506
1516
  return this;
@@ -1717,7 +1727,7 @@ import {
1717
1727
  OutputType as OutputType2,
1718
1728
  TransactionType
1719
1729
  } from "@fuel-ts/transactions";
1720
- import { concat as concat2, hexlify as hexlify9, isDefined } from "@fuel-ts/utils";
1730
+ import { concat as concat2, hexlify as hexlify10, isDefined } from "@fuel-ts/utils";
1721
1731
 
1722
1732
  // src/providers/message.ts
1723
1733
  var isMessageCoin = (message) => !("data" in message);
@@ -1729,14 +1739,9 @@ var isCoin = (resource) => "id" in resource;
1729
1739
  import { ZeroBytes32 as ZeroBytes323 } from "@fuel-ts/address/configs";
1730
1740
  import { ErrorCode as ErrorCode5, FuelError as FuelError6 } from "@fuel-ts/errors";
1731
1741
  import { bn as bn4 } from "@fuel-ts/math";
1732
- import {
1733
- ReceiptBurnCoder,
1734
- ReceiptMessageOutCoder,
1735
- ReceiptMintCoder,
1736
- ReceiptType
1737
- } from "@fuel-ts/transactions";
1742
+ import { getMintedAssetId, InputMessageCoder, ReceiptType } from "@fuel-ts/transactions";
1738
1743
  import { FAILED_TRANSFER_TO_ADDRESS_SIGNAL } from "@fuel-ts/transactions/configs";
1739
- import { arrayify as arrayify3 } from "@fuel-ts/utils";
1744
+ import { arrayify as arrayify3, hexlify as hexlify7 } from "@fuel-ts/utils";
1740
1745
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
1741
1746
  var doesReceiptHaveMissingContractId = (receipt) => receipt.type === ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
1742
1747
  var getReceiptsWithMissingData = (receipts) => receipts.reduce(
@@ -1882,12 +1887,12 @@ function assembleReceiptByType(receipt) {
1882
1887
  const amount = bn4(receipt.amount);
1883
1888
  const data = receipt.data ? arrayify3(receipt.data) : Uint8Array.from([]);
1884
1889
  const digest = hexOrZero(receipt.digest);
1885
- const messageId = ReceiptMessageOutCoder.getMessageId({
1890
+ const messageId = InputMessageCoder.getMessageId({
1886
1891
  sender,
1887
1892
  recipient,
1888
1893
  nonce,
1889
1894
  amount,
1890
- data
1895
+ data: hexlify7(data)
1891
1896
  });
1892
1897
  const receiptMessageOut = {
1893
1898
  type: ReceiptType.MessageOut,
@@ -1904,7 +1909,7 @@ function assembleReceiptByType(receipt) {
1904
1909
  case "MINT" /* Mint */: {
1905
1910
  const contractId = hexOrZero(receipt.id || receipt.contractId);
1906
1911
  const subId = hexOrZero(receipt.subId);
1907
- const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
1912
+ const assetId = getMintedAssetId(contractId, subId);
1908
1913
  const mintReceipt = {
1909
1914
  type: ReceiptType.Mint,
1910
1915
  subId,
@@ -1919,7 +1924,7 @@ function assembleReceiptByType(receipt) {
1919
1924
  case "BURN" /* Burn */: {
1920
1925
  const contractId = hexOrZero(receipt.id || receipt.contractId);
1921
1926
  const subId = hexOrZero(receipt.subId);
1922
- const assetId = ReceiptBurnCoder.getAssetId(contractId, subId);
1927
+ const assetId = getMintedAssetId(contractId, subId);
1923
1928
  const burnReceipt = {
1924
1929
  type: ReceiptType.Burn,
1925
1930
  subId,
@@ -2039,19 +2044,52 @@ function calculateMetadataGasForTxBlob({
2039
2044
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
2040
2045
  return txId.add(blobLen);
2041
2046
  }
2047
+ function calculateMetadataGasForTxUpgrade({
2048
+ gasCosts,
2049
+ txBytesSize,
2050
+ consensusSize
2051
+ }) {
2052
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2053
+ if (consensusSize) {
2054
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
2055
+ txId.add(consensusLen);
2056
+ }
2057
+ return txId;
2058
+ }
2059
+ function calculateMetadataGasForTxUpload({
2060
+ gasCosts,
2061
+ txBytesSize,
2062
+ subsectionSize,
2063
+ subsectionsSize
2064
+ }) {
2065
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
2066
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
2067
+ txId.add(subsectionLen);
2068
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
2069
+ txId.add(subsectionsLen);
2070
+ return txId;
2071
+ }
2072
+ function calculateMinGasForTxUpload({
2073
+ gasCosts,
2074
+ baseMinGas,
2075
+ subsectionSize
2076
+ }) {
2077
+ const additionalStoragePerByte = bn5(gasCosts.newStoragePerByte).mul(subsectionSize);
2078
+ return bn5(baseMinGas).add(additionalStoragePerByte);
2079
+ }
2042
2080
  var calculateGasFee = (params) => {
2043
2081
  const { gas, gasPrice, priceFactor, tip } = params;
2044
2082
  return gas.mul(gasPrice).div(priceFactor).add(bn5(tip));
2045
2083
  };
2046
2084
 
2047
2085
  // src/providers/utils/json.ts
2048
- import { hexlify as hexlify7 } from "@fuel-ts/utils";
2086
+ import { hexlify as hexlify8 } from "@fuel-ts/utils";
2049
2087
  import { clone } from "ramda";
2050
2088
  function normalize(object) {
2051
2089
  Object.keys(object).forEach((key) => {
2052
2090
  switch (object[key]?.constructor.name) {
2053
2091
  case "Uint8Array":
2054
- object[key] = hexlify7(object[key]);
2092
+ object[key] = hexlify8(object[key]);
2055
2093
  break;
2056
2094
  case "Array":
2057
2095
  object[key] = normalize(object[key]);
@@ -2215,11 +2253,11 @@ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
2215
2253
  );
2216
2254
 
2217
2255
  // src/providers/transaction-request/witness.ts
2218
- import { arrayify as arrayify5, hexlify as hexlify8 } from "@fuel-ts/utils";
2256
+ import { arrayify as arrayify5, hexlify as hexlify9 } from "@fuel-ts/utils";
2219
2257
  var witnessify = (value) => {
2220
2258
  const data = arrayify5(value);
2221
2259
  return {
2222
- data: hexlify8(data),
2260
+ data: hexlify9(data),
2223
2261
  dataLength: data.length
2224
2262
  };
2225
2263
  };
@@ -2436,9 +2474,9 @@ var BaseTransactionRequest = class {
2436
2474
  const found = this.inputs.find((input) => {
2437
2475
  switch (input.type) {
2438
2476
  case InputType3.Coin:
2439
- return hexlify9(input.owner) === ownerAddress.toB256();
2477
+ return hexlify10(input.owner) === ownerAddress.toB256();
2440
2478
  case InputType3.Message:
2441
- return hexlify9(input.recipient) === ownerAddress.toB256();
2479
+ return hexlify10(input.recipient) === ownerAddress.toB256();
2442
2480
  default:
2443
2481
  return false;
2444
2482
  }
@@ -2576,7 +2614,7 @@ var BaseTransactionRequest = class {
2576
2614
  */
2577
2615
  addChangeOutput(to, assetId) {
2578
2616
  const changeOutput = this.getChangeOutputs().find(
2579
- (output) => hexlify9(output.assetId) === assetId
2617
+ (output) => hexlify10(output.assetId) === assetId
2580
2618
  );
2581
2619
  if (!changeOutput) {
2582
2620
  this.pushOutput({
@@ -2656,12 +2694,12 @@ var BaseTransactionRequest = class {
2656
2694
  usedQuantity = bn8("1000000000000000000");
2657
2695
  }
2658
2696
  if (assetInput && "assetId" in assetInput) {
2659
- assetInput.id = hexlify9(randomBytes3(UTXO_ID_LEN2));
2697
+ assetInput.id = hexlify10(randomBytes3(UTXO_ID_LEN2));
2660
2698
  assetInput.amount = usedQuantity;
2661
2699
  } else {
2662
2700
  this.addResources([
2663
2701
  {
2664
- id: hexlify9(randomBytes3(UTXO_ID_LEN2)),
2702
+ id: hexlify10(randomBytes3(UTXO_ID_LEN2)),
2665
2703
  amount: usedQuantity,
2666
2704
  assetId,
2667
2705
  owner: resourcesOwner || Address2.fromRandom(),
@@ -2864,11 +2902,11 @@ var BlobTransactionRequest = class extends BaseTransactionRequest {
2864
2902
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2865
2903
  import { bn as bn10 } from "@fuel-ts/math";
2866
2904
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2867
- import { arrayify as arrayify7, hexlify as hexlify11 } from "@fuel-ts/utils";
2905
+ import { arrayify as arrayify7, hexlify as hexlify12 } from "@fuel-ts/utils";
2868
2906
  import { clone as clone4 } from "ramda";
2869
2907
 
2870
2908
  // src/providers/transaction-request/storage-slot.ts
2871
- import { arrayify as arrayify6, hexlify as hexlify10 } from "@fuel-ts/utils";
2909
+ import { arrayify as arrayify6, hexlify as hexlify11 } from "@fuel-ts/utils";
2872
2910
  var getStorageValue = (value) => {
2873
2911
  const v = new Uint8Array(32);
2874
2912
  v.set(arrayify6(value));
@@ -2885,8 +2923,8 @@ var storageSlotify = (storageSlot) => {
2885
2923
  value = storageSlot.value;
2886
2924
  }
2887
2925
  return {
2888
- key: hexlify10(key),
2889
- value: hexlify10(getStorageValue(value))
2926
+ key: hexlify11(key),
2927
+ value: hexlify11(getStorageValue(value))
2890
2928
  };
2891
2929
  };
2892
2930
 
@@ -2911,7 +2949,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2911
2949
  constructor({ bytecodeWitnessIndex, salt, storageSlots, ...rest }) {
2912
2950
  super(rest);
2913
2951
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2914
- this.salt = hexlify11(salt ?? ZeroBytes326);
2952
+ this.salt = hexlify12(salt ?? ZeroBytes326);
2915
2953
  this.storageSlots = [...storageSlots ?? []];
2916
2954
  }
2917
2955
  /**
@@ -2928,7 +2966,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2928
2966
  ...baseTransaction,
2929
2967
  bytecodeWitnessIndex,
2930
2968
  storageSlotsCount: bn10(storageSlots.length),
2931
- salt: this.salt ? hexlify11(this.salt) : ZeroBytes326,
2969
+ salt: this.salt ? hexlify12(this.salt) : ZeroBytes326,
2932
2970
  storageSlots
2933
2971
  };
2934
2972
  }
@@ -2981,7 +3019,7 @@ import { addressify as addressify2 } from "@fuel-ts/address";
2981
3019
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2982
3020
  import { bn as bn11 } from "@fuel-ts/math";
2983
3021
  import { InputType as InputType5, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2984
- import { arrayify as arrayify9, hexlify as hexlify12 } from "@fuel-ts/utils";
3022
+ import { arrayify as arrayify9, hexlify as hexlify13 } from "@fuel-ts/utils";
2985
3023
  import { clone as clone5 } from "ramda";
2986
3024
 
2987
3025
  // src/providers/transaction-request/scripts.ts
@@ -3051,8 +3089,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3051
3089
  scriptLength: bn11(script.length),
3052
3090
  scriptDataLength: bn11(scriptData.length),
3053
3091
  receiptsRoot: ZeroBytes327,
3054
- script: hexlify12(script),
3055
- scriptData: hexlify12(scriptData)
3092
+ script: hexlify13(script),
3093
+ scriptData: hexlify13(scriptData)
3056
3094
  };
3057
3095
  }
3058
3096
  /**
@@ -3189,50 +3227,316 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
3189
3227
  }
3190
3228
  };
3191
3229
 
3230
+ // src/providers/transaction-request/upgrade-transaction-request.ts
3231
+ import { FuelError as FuelError10 } from "@fuel-ts/errors";
3232
+ import { hash as hash2 } from "@fuel-ts/hasher";
3233
+ import {
3234
+ TransactionType as TransactionType5,
3235
+ UpgradePurposeTypeEnum
3236
+ } from "@fuel-ts/transactions";
3237
+ import { hexlify as hexlify14 } from "@fuel-ts/utils";
3238
+ import { clone as clone6 } from "ramda";
3239
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
3240
+ static from(obj) {
3241
+ if (obj instanceof UpgradeTransactionRequest) {
3242
+ return obj;
3243
+ }
3244
+ return new this(clone6(obj));
3245
+ }
3246
+ /** The type of transaction */
3247
+ type = TransactionType5.Upgrade;
3248
+ /** The upgrade purpose */
3249
+ upgradePurpose;
3250
+ /** Witness index of consensus */
3251
+ bytecodeWitnessIndex;
3252
+ /**
3253
+ * Creates an instance `UpgradeTransactionRequest`.
3254
+ *
3255
+ * @param upgradeTransactionRequestLike - The initial values for the instance
3256
+ */
3257
+ constructor({
3258
+ upgradePurpose,
3259
+ bytecodeWitnessIndex,
3260
+ ...rest
3261
+ } = {}) {
3262
+ super(rest);
3263
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
3264
+ this.upgradePurpose = upgradePurpose ?? {
3265
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3266
+ checksum: "0x"
3267
+ };
3268
+ }
3269
+ /**
3270
+ * Adds a consensus parameters upgrade purpose.
3271
+ *
3272
+ * @param consensus - The consensus bytecode.
3273
+ *
3274
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3275
+ */
3276
+ addConsensusParametersUpgradePurpose(consensus) {
3277
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
3278
+ this.upgradePurpose = {
3279
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3280
+ checksum: hash2(consensus)
3281
+ };
3282
+ return this;
3283
+ }
3284
+ /**
3285
+ * Adds a state transition upgrade purpose.
3286
+ *
3287
+ * @param bytecodeRoot - The Merkle root of the state transition.
3288
+ *
3289
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3290
+ */
3291
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
3292
+ this.upgradePurpose = {
3293
+ type: UpgradePurposeTypeEnum.StateTransition,
3294
+ data: hexlify14(bytecodeRoot)
3295
+ };
3296
+ return this;
3297
+ }
3298
+ /**
3299
+ * Adds an upgrade purpose.
3300
+ *
3301
+ * @param type - The upgrade purpose type.
3302
+ * @param data - The bytecode or merkle root of upgrade purpose
3303
+ *
3304
+ * @returns - The current instance of `UpgradeTransactionRequest`.
3305
+ */
3306
+ addUpgradePurpose(type, data) {
3307
+ if (type === UpgradePurposeTypeEnum.ConsensusParameters) {
3308
+ this.addConsensusParametersUpgradePurpose(data);
3309
+ }
3310
+ if (type === UpgradePurposeTypeEnum.StateTransition) {
3311
+ this.addStateTransitionUpgradePurpose(data);
3312
+ }
3313
+ return this;
3314
+ }
3315
+ /**
3316
+ * Converts the transaction request to a `TransactionUpgrade`.
3317
+ *
3318
+ * @returns The transaction create object.
3319
+ */
3320
+ toTransaction() {
3321
+ let upgradePurpose;
3322
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
3323
+ upgradePurpose = {
3324
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
3325
+ data: {
3326
+ witnessIndex: this.bytecodeWitnessIndex,
3327
+ checksum: this.upgradePurpose.checksum
3328
+ }
3329
+ };
3330
+ } else if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
3331
+ upgradePurpose = {
3332
+ type: UpgradePurposeTypeEnum.StateTransition,
3333
+ data: {
3334
+ bytecodeRoot: hexlify14(this.upgradePurpose.data)
3335
+ }
3336
+ };
3337
+ } else {
3338
+ throw new FuelError10(FuelError10.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3339
+ }
3340
+ return {
3341
+ type: TransactionType5.Upgrade,
3342
+ ...super.getBaseTransaction(),
3343
+ upgradePurpose
3344
+ };
3345
+ }
3346
+ /**
3347
+ * Gets the Transaction ID by hashing the transaction
3348
+ *
3349
+ * @param chainId - The chain ID.
3350
+ *
3351
+ * @returns - A hash of the transaction, which is the transaction ID.
3352
+ */
3353
+ getTransactionId(chainId) {
3354
+ return hashTransaction(this, chainId);
3355
+ }
3356
+ /**
3357
+ * Calculates the metadata gas cost for an upgrade transaction.
3358
+ *
3359
+ * @param gasCosts - gas costs passed from the chain.
3360
+ *
3361
+ * @returns metadata gas cost for the upgrade transaction.
3362
+ */
3363
+ metadataGas(gasCosts) {
3364
+ const txBytesSize = this.byteSize();
3365
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
3366
+ const witnessIndex = this.bytecodeWitnessIndex;
3367
+ const consensusSize = this.witnesses[witnessIndex].length;
3368
+ return calculateMetadataGasForTxUpgrade({
3369
+ gasCosts,
3370
+ txBytesSize,
3371
+ consensusSize
3372
+ });
3373
+ }
3374
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
3375
+ return calculateMetadataGasForTxUpgrade({
3376
+ gasCosts,
3377
+ txBytesSize
3378
+ });
3379
+ }
3380
+ throw new FuelError10(FuelError10.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
3381
+ }
3382
+ };
3383
+
3384
+ // src/providers/transaction-request/upload-transaction-request.ts
3385
+ import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
3386
+ import { TransactionType as TransactionType6 } from "@fuel-ts/transactions";
3387
+ import { arrayify as arrayify10, hexlify as hexlify15 } from "@fuel-ts/utils";
3388
+ import { clone as clone7 } from "ramda";
3389
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
3390
+ static from(obj) {
3391
+ if (obj instanceof UploadTransactionRequest) {
3392
+ return obj;
3393
+ }
3394
+ return new this(clone7(obj));
3395
+ }
3396
+ /** Type of the transaction */
3397
+ type = TransactionType6.Upload;
3398
+ /** The witness index of the subsection of the bytecode. */
3399
+ witnessIndex;
3400
+ /** The subsection data. */
3401
+ subsection;
3402
+ /**
3403
+ * Creates an instance `UploadTransactionRequest`.
3404
+ *
3405
+ * @param uploadTransactionRequestLike - The initial values for the instance
3406
+ */
3407
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
3408
+ super(rest);
3409
+ this.witnessIndex = witnessIndex ?? 0;
3410
+ this.subsection = subsection ?? {
3411
+ proofSet: [],
3412
+ root: ZeroBytes328,
3413
+ subsectionIndex: 0,
3414
+ subsectionsNumber: 0
3415
+ };
3416
+ }
3417
+ /**
3418
+ * Adds the subsection.
3419
+ *
3420
+ * @param subsection - The subsection data.
3421
+ */
3422
+ addSubsection(subsection) {
3423
+ const { subsection: subsectionBytecode, ...rest } = subsection;
3424
+ this.subsection = rest;
3425
+ this.witnessIndex = this.addWitness(subsectionBytecode);
3426
+ }
3427
+ /**
3428
+ * Gets the Transaction Request by hashing the transaction.
3429
+ *
3430
+ * @param chainId - The chain ID.
3431
+ *
3432
+ * @returns - A hash of the transaction, which is the transaction ID.
3433
+ */
3434
+ getTransactionId(chainId) {
3435
+ return hashTransaction(this, chainId);
3436
+ }
3437
+ /**
3438
+ * Converts the transaction request to a `TransactionUpload`.
3439
+ *
3440
+ * @returns The transaction create object.
3441
+ */
3442
+ toTransaction() {
3443
+ const baseTransaction = this.getBaseTransaction();
3444
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
3445
+ return {
3446
+ type: TransactionType6.Upload,
3447
+ ...baseTransaction,
3448
+ subsectionIndex,
3449
+ subsectionsNumber,
3450
+ root: hexlify15(root),
3451
+ proofSet: proofSet.map(hexlify15),
3452
+ witnessIndex: this.witnessIndex,
3453
+ proofSetCount: proofSet.length
3454
+ };
3455
+ }
3456
+ /**
3457
+ * Calculates the metadata gas cost for an upload transaction.
3458
+ *
3459
+ * @param gasCosts - gas costs passed from the chain.
3460
+ *
3461
+ * @returns metadata gas cost for the upload transaction.
3462
+ */
3463
+ metadataGas(gasCosts) {
3464
+ return calculateMetadataGasForTxUpload({
3465
+ gasCosts,
3466
+ txBytesSize: this.byteSize(),
3467
+ subsectionSize: arrayify10(this.witnesses[this.witnessIndex]).length,
3468
+ subsectionsSize: this.subsection.subsectionsNumber
3469
+ });
3470
+ }
3471
+ /**
3472
+ * Calculates the minimum gas for an upload transaction.
3473
+ *
3474
+ * @param chainInfo - The chain information.
3475
+ *
3476
+ * @returns the minimum gas for the upload transaction
3477
+ */
3478
+ calculateMinGas(chainInfo) {
3479
+ const minGas = super.calculateMinGas(chainInfo);
3480
+ const { gasCosts } = chainInfo.consensusParameters;
3481
+ const bytecode = this.witnesses[this.witnessIndex] ?? ZeroBytes328;
3482
+ return calculateMinGasForTxUpload({
3483
+ gasCosts,
3484
+ baseMinGas: minGas.toNumber(),
3485
+ subsectionSize: arrayify10(bytecode).length
3486
+ });
3487
+ }
3488
+ };
3489
+
3192
3490
  // src/providers/transaction-request/utils.ts
3193
- import { ErrorCode as ErrorCode8, FuelError as FuelError10 } from "@fuel-ts/errors";
3194
- import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
3491
+ import { ErrorCode as ErrorCode8, FuelError as FuelError11 } from "@fuel-ts/errors";
3492
+ import { TransactionType as TransactionType7 } from "@fuel-ts/transactions";
3195
3493
  var transactionRequestify = (obj) => {
3196
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
3494
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
3197
3495
  return obj;
3198
3496
  }
3199
3497
  const { type } = obj;
3200
3498
  switch (obj.type) {
3201
- case TransactionType5.Script: {
3499
+ case TransactionType7.Script: {
3202
3500
  return ScriptTransactionRequest.from(obj);
3203
3501
  }
3204
- case TransactionType5.Create: {
3502
+ case TransactionType7.Create: {
3205
3503
  return CreateTransactionRequest.from(obj);
3206
3504
  }
3207
- case TransactionType5.Blob: {
3505
+ case TransactionType7.Blob: {
3208
3506
  return BlobTransactionRequest.from(obj);
3209
3507
  }
3508
+ case TransactionType7.Upgrade: {
3509
+ return UpgradeTransactionRequest.from(obj);
3510
+ }
3511
+ case TransactionType7.Upload: {
3512
+ return UploadTransactionRequest.from(obj);
3513
+ }
3210
3514
  default: {
3211
- throw new FuelError10(
3515
+ throw new FuelError11(
3212
3516
  ErrorCode8.UNSUPPORTED_TRANSACTION_TYPE,
3213
3517
  `Unsupported transaction type: ${type}.`
3214
3518
  );
3215
3519
  }
3216
3520
  }
3217
3521
  };
3218
- var isTransactionTypeScript = (request) => request.type === TransactionType5.Script;
3219
- var isTransactionTypeCreate = (request) => request.type === TransactionType5.Create;
3522
+ var isTransactionTypeScript = (request) => request.type === TransactionType7.Script;
3523
+ var isTransactionTypeCreate = (request) => request.type === TransactionType7.Create;
3220
3524
 
3221
3525
  // src/providers/transaction-response/transaction-response.ts
3222
- import { ErrorCode as ErrorCode12, FuelError as FuelError14 } from "@fuel-ts/errors";
3526
+ import { ErrorCode as ErrorCode12, FuelError as FuelError15 } from "@fuel-ts/errors";
3223
3527
  import { bn as bn16 } from "@fuel-ts/math";
3224
3528
  import { OutputType as OutputType7, TransactionCoder as TransactionCoder4, TxPointerCoder } from "@fuel-ts/transactions";
3225
- import { arrayify as arrayify11, assertUnreachable } from "@fuel-ts/utils";
3529
+ import { arrayify as arrayify12, assertUnreachable } from "@fuel-ts/utils";
3226
3530
 
3227
3531
  // src/providers/transaction-summary/assemble-transaction-summary.ts
3228
3532
  import { bn as bn15 } from "@fuel-ts/math";
3229
3533
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
3230
- import { DateTime, hexlify as hexlify13 } from "@fuel-ts/utils";
3534
+ import { DateTime, hexlify as hexlify16 } from "@fuel-ts/utils";
3231
3535
 
3232
3536
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
3233
3537
  import { bn as bn12 } from "@fuel-ts/math";
3234
- import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
3235
- import { arrayify as arrayify10 } from "@fuel-ts/utils";
3538
+ import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType8 } from "@fuel-ts/transactions";
3539
+ import { arrayify as arrayify11 } from "@fuel-ts/utils";
3236
3540
  var calculateTXFeeForSummary = (params) => {
3237
3541
  const {
3238
3542
  gasPrice,
@@ -3246,17 +3550,17 @@ var calculateTXFeeForSummary = (params) => {
3246
3550
  }
3247
3551
  const gasPerByte = bn12(feeParams.gasPerByte);
3248
3552
  const gasPriceFactor = bn12(feeParams.gasPriceFactor);
3249
- const transactionBytes = arrayify10(rawPayload);
3553
+ const transactionBytes = arrayify11(rawPayload);
3250
3554
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
3251
3555
  const { type, witnesses, inputs, policies } = transaction;
3252
3556
  let metadataGas = bn12(0);
3253
3557
  let gasLimit = bn12(0);
3254
- if (type !== TransactionType6.Create && type !== TransactionType6.Script) {
3558
+ if (type !== TransactionType8.Create && type !== TransactionType8.Script) {
3255
3559
  return bn12(0);
3256
3560
  }
3257
- if (type === TransactionType6.Create) {
3561
+ if (type === TransactionType8.Create) {
3258
3562
  const { bytecodeWitnessIndex, storageSlots } = transaction;
3259
- const contractBytesSize = bn12(arrayify10(witnesses[bytecodeWitnessIndex].data).length);
3563
+ const contractBytesSize = bn12(arrayify11(witnesses[bytecodeWitnessIndex].data).length);
3260
3564
  metadataGas = calculateMetadataGasForTxCreate({
3261
3565
  contractBytesSize,
3262
3566
  gasCosts,
@@ -3300,10 +3604,10 @@ var calculateTXFeeForSummary = (params) => {
3300
3604
  };
3301
3605
 
3302
3606
  // src/providers/transaction-summary/operations.ts
3303
- import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
3304
- import { ErrorCode as ErrorCode10, FuelError as FuelError12 } from "@fuel-ts/errors";
3607
+ import { ZeroBytes32 as ZeroBytes329 } from "@fuel-ts/address/configs";
3608
+ import { ErrorCode as ErrorCode10, FuelError as FuelError13 } from "@fuel-ts/errors";
3305
3609
  import { bn as bn13 } from "@fuel-ts/math";
3306
- import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
3610
+ import { ReceiptType as ReceiptType4, TransactionType as TransactionType9 } from "@fuel-ts/transactions";
3307
3611
 
3308
3612
  // src/providers/transaction-summary/call.ts
3309
3613
  import { Interface as Interface2 } from "@fuel-ts/abi-coder";
@@ -3339,7 +3643,7 @@ var getFunctionCall = ({ abi, receipt }) => {
3339
3643
  };
3340
3644
 
3341
3645
  // src/providers/transaction-summary/input.ts
3342
- import { ErrorCode as ErrorCode9, FuelError as FuelError11 } from "@fuel-ts/errors";
3646
+ import { ErrorCode as ErrorCode9, FuelError as FuelError12 } from "@fuel-ts/errors";
3343
3647
  import { BN } from "@fuel-ts/math";
3344
3648
  import { InputType as InputType6 } from "@fuel-ts/transactions";
3345
3649
  function getInputsByTypes(inputs, types) {
@@ -3408,7 +3712,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
3408
3712
  return void 0;
3409
3713
  }
3410
3714
  if (contractInput.type !== InputType6.Contract) {
3411
- throw new FuelError11(
3715
+ throw new FuelError12(
3412
3716
  ErrorCode9.INVALID_TRANSACTION_INPUT,
3413
3717
  `Contract input should be of type 'contract'.`
3414
3718
  );
@@ -3449,16 +3753,20 @@ function getReceiptsByType(receipts, type) {
3449
3753
  }
3450
3754
  function getTransactionTypeName(transactionType) {
3451
3755
  switch (transactionType) {
3452
- case TransactionType7.Mint:
3756
+ case TransactionType9.Mint:
3453
3757
  return "Mint" /* Mint */;
3454
- case TransactionType7.Create:
3758
+ case TransactionType9.Create:
3455
3759
  return "Create" /* Create */;
3456
- case TransactionType7.Script:
3760
+ case TransactionType9.Script:
3457
3761
  return "Script" /* Script */;
3458
- case TransactionType7.Blob:
3762
+ case TransactionType9.Blob:
3459
3763
  return "Blob" /* Blob */;
3764
+ case TransactionType9.Upgrade:
3765
+ return "Upgrade" /* Upgrade */;
3766
+ case TransactionType9.Upload:
3767
+ return "Upload" /* Upload */;
3460
3768
  default:
3461
- throw new FuelError12(
3769
+ throw new FuelError13(
3462
3770
  ErrorCode10.UNSUPPORTED_TRANSACTION_TYPE,
3463
3771
  `Unsupported transaction type: ${transactionType}.`
3464
3772
  );
@@ -3598,7 +3906,7 @@ function getAssetsSent(receipt) {
3598
3906
  ];
3599
3907
  }
3600
3908
  function processCallReceipt(receipt, contractInput, inputs, abiMap, rawPayload, maxInputs, baseAssetId) {
3601
- const assetId = receipt.assetId === ZeroBytes328 ? baseAssetId : receipt.assetId;
3909
+ const assetId = receipt.assetId === ZeroBytes329 ? baseAssetId : receipt.assetId;
3602
3910
  const input = getInputFromAssetId(inputs, assetId, assetId === baseAssetId);
3603
3911
  if (!input) {
3604
3912
  return [];
@@ -3654,7 +3962,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3654
3962
  const { to: toAddress, assetId, amount } = receipt;
3655
3963
  let { from: fromAddress } = receipt;
3656
3964
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3657
- if (ZeroBytes328 === fromAddress) {
3965
+ if (ZeroBytes329 === fromAddress) {
3658
3966
  const change = changeOutputs.find((output) => output.assetId === assetId);
3659
3967
  fromAddress = change?.to || fromAddress;
3660
3968
  }
@@ -3857,7 +4165,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3857
4165
  };
3858
4166
 
3859
4167
  // src/providers/transaction-summary/status.ts
3860
- import { ErrorCode as ErrorCode11, FuelError as FuelError13 } from "@fuel-ts/errors";
4168
+ import { ErrorCode as ErrorCode11, FuelError as FuelError14 } from "@fuel-ts/errors";
3861
4169
  import { bn as bn14 } from "@fuel-ts/math";
3862
4170
  var getTransactionStatusName = (gqlStatus) => {
3863
4171
  switch (gqlStatus) {
@@ -3870,7 +4178,7 @@ var getTransactionStatusName = (gqlStatus) => {
3870
4178
  case "SqueezedOutStatus":
3871
4179
  return "squeezedout" /* squeezedout */;
3872
4180
  default:
3873
- throw new FuelError13(
4181
+ throw new FuelError14(
3874
4182
  ErrorCode11.INVALID_TRANSACTION_STATUS,
3875
4183
  `Invalid transaction status: ${gqlStatus}.`
3876
4184
  );
@@ -3940,7 +4248,7 @@ function assembleTransactionSummary(params) {
3940
4248
  baseAssetId
3941
4249
  } = params;
3942
4250
  const gasUsed = getGasUsedFromReceipts(receipts);
3943
- const rawPayload = hexlify13(transactionBytes);
4251
+ const rawPayload = hexlify16(transactionBytes);
3944
4252
  const operations = getOperations({
3945
4253
  transactionType: transaction.type,
3946
4254
  inputs: transaction.inputs || [],
@@ -4049,29 +4357,30 @@ function mapGqlOutputsToTxOutputs(outputs) {
4049
4357
  });
4050
4358
  }
4051
4359
  var TransactionResponse = class {
4052
- /** Transaction ID */
4053
- id;
4054
- /** Current provider */
4055
- provider;
4056
- /** Gas used on the transaction */
4057
- gasUsed = bn16(0);
4058
- /** The graphql Transaction with receipts object. */
4059
- gqlTransaction;
4060
- request;
4061
- status;
4062
- abis;
4063
4360
  /**
4064
4361
  * Constructor for `TransactionResponse`.
4065
4362
  *
4066
4363
  * @param tx - The transaction ID or TransactionRequest.
4067
4364
  * @param provider - The provider.
4068
4365
  */
4069
- constructor(tx, provider, abis) {
4366
+ constructor(tx, provider, abis, submitTxSubscription) {
4367
+ this.submitTxSubscription = submitTxSubscription;
4070
4368
  this.id = typeof tx === "string" ? tx : tx.getTransactionId(provider.getChainId());
4071
4369
  this.provider = provider;
4072
4370
  this.abis = abis;
4073
4371
  this.request = typeof tx === "string" ? void 0 : tx;
4074
4372
  }
4373
+ /** Transaction ID */
4374
+ id;
4375
+ /** Current provider */
4376
+ provider;
4377
+ /** Gas used on the transaction */
4378
+ gasUsed = bn16(0);
4379
+ /** The graphql Transaction with receipts object. */
4380
+ gqlTransaction;
4381
+ request;
4382
+ status;
4383
+ abis;
4075
4384
  /**
4076
4385
  * Async constructor for `TransactionResponse`. This method can be used to create
4077
4386
  * an instance of `TransactionResponse` and wait for the transaction to be fetched
@@ -4120,7 +4429,7 @@ var TransactionResponse = class {
4120
4429
  const gqlTransaction = this.gqlTransaction ?? await this.fetch();
4121
4430
  return {
4122
4431
  tx: this.decodeTransaction(gqlTransaction),
4123
- bytes: arrayify11(gqlTransaction.rawPayload)
4432
+ bytes: arrayify12(gqlTransaction.rawPayload)
4124
4433
  };
4125
4434
  }
4126
4435
  getReceipts() {
@@ -4165,7 +4474,7 @@ var TransactionResponse = class {
4165
4474
  */
4166
4475
  decodeTransaction(transactionWithReceipts) {
4167
4476
  return new TransactionCoder4().decode(
4168
- arrayify11(transactionWithReceipts.rawPayload),
4477
+ arrayify12(transactionWithReceipts.rawPayload),
4169
4478
  0
4170
4479
  )?.[0];
4171
4480
  }
@@ -4204,14 +4513,15 @@ var TransactionResponse = class {
4204
4513
  if (status && status !== "SubmittedStatus") {
4205
4514
  return;
4206
4515
  }
4207
- const subscription = await this.provider.operations.statusChange({
4516
+ const subscription = this.submitTxSubscription ?? await this.provider.operations.statusChange({
4208
4517
  transactionId: this.id
4209
4518
  });
4210
- for await (const { statusChange } of subscription) {
4519
+ for await (const sub of subscription) {
4520
+ const statusChange = "statusChange" in sub ? sub.statusChange : sub.submitAndAwaitStatus;
4211
4521
  this.status = statusChange;
4212
4522
  if (statusChange.type === "SqueezedOutStatus") {
4213
4523
  this.unsetResourceCache();
4214
- throw new FuelError14(
4524
+ throw new FuelError15(
4215
4525
  ErrorCode12.TRANSACTION_SQUEEZED_OUT,
4216
4526
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
4217
4527
  );
@@ -4320,18 +4630,18 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
4320
4630
  }
4321
4631
 
4322
4632
  // src/providers/utils/handle-gql-error-message.ts
4323
- import { ErrorCode as ErrorCode13, FuelError as FuelError15 } from "@fuel-ts/errors";
4633
+ import { ErrorCode as ErrorCode13, FuelError as FuelError16 } from "@fuel-ts/errors";
4324
4634
  var handleGqlErrorMessage = (errorMessage, rawError) => {
4325
4635
  switch (errorMessage) {
4326
4636
  case "not enough coins to fit the target" /* NOT_ENOUGH_COINS */:
4327
- throw new FuelError15(
4637
+ throw new FuelError16(
4328
4638
  ErrorCode13.NOT_ENOUGH_FUNDS,
4329
4639
  `The account(s) sending the transaction don't have enough funds to cover the transaction.`,
4330
4640
  {},
4331
4641
  rawError
4332
4642
  );
4333
4643
  default:
4334
- throw new FuelError15(ErrorCode13.INVALID_REQUEST, errorMessage);
4644
+ throw new FuelError16(ErrorCode13.INVALID_REQUEST, errorMessage);
4335
4645
  }
4336
4646
  };
4337
4647
 
@@ -4413,21 +4723,31 @@ var _Provider = class {
4413
4723
  * @hidden
4414
4724
  */
4415
4725
  constructor(url, options = {}) {
4416
- this.url = url;
4417
4726
  /**
4418
4727
  * @hidden
4419
4728
  */
4420
4729
  __privateAdd(this, _cacheInputs);
4421
4730
  __publicField(this, "operations");
4422
4731
  __publicField(this, "cache");
4732
+ /** @hidden */
4733
+ __publicField(this, "url");
4734
+ /** @hidden */
4735
+ __publicField(this, "urlWithoutAuth");
4423
4736
  __publicField(this, "options", {
4424
4737
  timeout: void 0,
4425
4738
  resourceCacheTTL: void 0,
4426
4739
  fetch: void 0,
4427
- retryOptions: void 0
4740
+ retryOptions: void 0,
4741
+ headers: void 0
4428
4742
  });
4743
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4744
+ this.url = rawUrl;
4745
+ this.urlWithoutAuth = urlWithoutAuth;
4429
4746
  this.options = { ...this.options, ...options };
4430
4747
  this.url = url;
4748
+ if (headers) {
4749
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4750
+ }
4431
4751
  this.operations = this.createOperations();
4432
4752
  const { resourceCacheTTL } = this.options;
4433
4753
  if (isDefined2(resourceCacheTTL)) {
@@ -4449,12 +4769,16 @@ var _Provider = class {
4449
4769
  * @hidden
4450
4770
  */
4451
4771
  static getFetchFn(options) {
4452
- const { retryOptions, timeout } = options;
4772
+ const { retryOptions, timeout, headers } = options;
4453
4773
  return autoRetryFetch(async (...args) => {
4454
4774
  const url = args[0];
4455
4775
  const request = args[1];
4456
4776
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
4457
- let fullRequest = { ...request, signal };
4777
+ let fullRequest = {
4778
+ ...request,
4779
+ signal,
4780
+ headers: { ...request?.headers, ...headers }
4781
+ };
4458
4782
  if (options.requestMiddleware) {
4459
4783
  fullRequest = await options.requestMiddleware(fullRequest);
4460
4784
  }
@@ -4462,15 +4786,23 @@ var _Provider = class {
4462
4786
  }, retryOptions);
4463
4787
  }
4464
4788
  static extractBasicAuth(url) {
4465
- const parsedUrl = new URL(url);
4789
+ let parsedUrl;
4790
+ try {
4791
+ parsedUrl = new URL(url);
4792
+ } catch (error) {
4793
+ throw new FuelError17(FuelError17.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
4794
+ }
4466
4795
  const username = parsedUrl.username;
4467
4796
  const password = parsedUrl.password;
4468
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4797
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
4469
4798
  if (!(username && password)) {
4470
- return { url, auth: void 0 };
4799
+ return { url, urlWithoutAuth: url, headers: void 0 };
4471
4800
  }
4472
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
4473
- return { url: urlNoBasicAuth, auth };
4801
+ return {
4802
+ url,
4803
+ urlWithoutAuth,
4804
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
4805
+ };
4474
4806
  }
4475
4807
  /**
4476
4808
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -4481,17 +4813,7 @@ var _Provider = class {
4481
4813
  * @returns A promise that resolves to a Provider instance.
4482
4814
  */
4483
4815
  static async create(url, options = {}) {
4484
- const { url: urlToUse, auth } = this.extractBasicAuth(url);
4485
- const provider = new _Provider(urlToUse, {
4486
- ...options,
4487
- requestMiddleware: async (request) => {
4488
- if (auth) {
4489
- request.headers ??= {};
4490
- request.headers.Authorization = auth;
4491
- }
4492
- return options.requestMiddleware?.(request) ?? request;
4493
- }
4494
- });
4816
+ const provider = new _Provider(url, options);
4495
4817
  await provider.fetchChainAndNodeInfo();
4496
4818
  return provider;
4497
4819
  }
@@ -4501,9 +4823,9 @@ var _Provider = class {
4501
4823
  * @returns the chain information configuration.
4502
4824
  */
4503
4825
  getChain() {
4504
- const chain = _Provider.chainInfoCache[this.url];
4826
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
4505
4827
  if (!chain) {
4506
- throw new FuelError16(
4828
+ throw new FuelError17(
4507
4829
  ErrorCode14.CHAIN_INFO_CACHE_EMPTY,
4508
4830
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4509
4831
  );
@@ -4516,9 +4838,9 @@ var _Provider = class {
4516
4838
  * @returns the node information configuration.
4517
4839
  */
4518
4840
  getNode() {
4519
- const node = _Provider.nodeInfoCache[this.url];
4841
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
4520
4842
  if (!node) {
4521
- throw new FuelError16(
4843
+ throw new FuelError17(
4522
4844
  ErrorCode14.NODE_INFO_CACHE_EMPTY,
4523
4845
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
4524
4846
  );
@@ -4550,8 +4872,11 @@ var _Provider = class {
4550
4872
  * @param options - Additional options for the provider.
4551
4873
  */
4552
4874
  async connect(url, options) {
4553
- this.url = url;
4875
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
4876
+ this.url = rawUrl;
4877
+ this.urlWithoutAuth = urlWithoutAuth;
4554
4878
  this.options = options ?? this.options;
4879
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
4555
4880
  this.operations = this.createOperations();
4556
4881
  await this.fetchChainAndNodeInfo();
4557
4882
  }
@@ -4591,7 +4916,7 @@ Supported fuel-core version: ${supportedVersion}.`
4591
4916
  */
4592
4917
  createOperations() {
4593
4918
  const fetchFn = _Provider.getFetchFn(this.options);
4594
- const gqlClient = new GraphQLClient(this.url, {
4919
+ const gqlClient = new GraphQLClient(this.urlWithoutAuth, {
4595
4920
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
4596
4921
  responseMiddleware: (response) => {
4597
4922
  if ("response" in response) {
@@ -4609,7 +4934,7 @@ Supported fuel-core version: ${supportedVersion}.`
4609
4934
  const isSubscription = opDefinition?.operation === "subscription";
4610
4935
  if (isSubscription) {
4611
4936
  return FuelGraphqlSubscriber.create({
4612
- url: this.url,
4937
+ url: this.urlWithoutAuth,
4613
4938
  query,
4614
4939
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
4615
4940
  variables: vars
@@ -4672,7 +4997,7 @@ Supported fuel-core version: ${supportedVersion}.`
4672
4997
  utxoValidation: nodeInfo.utxoValidation,
4673
4998
  vmBacktrace: nodeInfo.vmBacktrace
4674
4999
  };
4675
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
5000
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
4676
5001
  return processedNodeInfo;
4677
5002
  }
4678
5003
  /**
@@ -4683,7 +5008,7 @@ Supported fuel-core version: ${supportedVersion}.`
4683
5008
  async fetchChain() {
4684
5009
  const { chain } = await this.operations.getChain();
4685
5010
  const processedChain = processGqlChain(chain);
4686
- _Provider.chainInfoCache[this.url] = processedChain;
5011
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
4687
5012
  return processedChain;
4688
5013
  }
4689
5014
  /**
@@ -4711,13 +5036,13 @@ Supported fuel-core version: ${supportedVersion}.`
4711
5036
  validateTransaction(tx, consensusParameters) {
4712
5037
  const { maxOutputs, maxInputs } = consensusParameters.txParameters;
4713
5038
  if (bn17(tx.inputs.length).gt(maxInputs)) {
4714
- throw new FuelError16(
5039
+ throw new FuelError17(
4715
5040
  ErrorCode14.MAX_INPUTS_EXCEEDED,
4716
5041
  "The transaction exceeds the maximum allowed number of inputs."
4717
5042
  );
4718
5043
  }
4719
5044
  if (bn17(tx.outputs.length).gt(maxOutputs)) {
4720
- throw new FuelError16(
5045
+ throw new FuelError17(
4721
5046
  ErrorCode14.MAX_OUTPUTS_EXCEEDED,
4722
5047
  "The transaction exceeds the maximum allowed number of outputs."
4723
5048
  );
@@ -4740,16 +5065,14 @@ Supported fuel-core version: ${supportedVersion}.`
4740
5065
  }
4741
5066
  const { consensusParameters } = this.getChain();
4742
5067
  this.validateTransaction(transactionRequest, consensusParameters);
4743
- const encodedTransaction = hexlify14(transactionRequest.toTransactionBytes());
5068
+ const encodedTransaction = hexlify17(transactionRequest.toTransactionBytes());
4744
5069
  let abis;
4745
5070
  if (isTransactionTypeScript(transactionRequest)) {
4746
5071
  abis = transactionRequest.abis;
4747
5072
  }
4748
- const {
4749
- submit: { id: transactionId }
4750
- } = await this.operations.submit({ encodedTransaction });
4751
- __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionId);
4752
- return new TransactionResponse(transactionRequest, this, abis);
5073
+ const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
5074
+ __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(this.getChainId()));
5075
+ return new TransactionResponse(transactionRequest, this, abis, subscription);
4753
5076
  }
4754
5077
  /**
4755
5078
  * Executes a transaction without actually submitting it to the chain.
@@ -4766,7 +5089,7 @@ Supported fuel-core version: ${supportedVersion}.`
4766
5089
  if (estimateTxDependencies) {
4767
5090
  return this.estimateTxDependencies(transactionRequest);
4768
5091
  }
4769
- const encodedTransaction = hexlify14(transactionRequest.toTransactionBytes());
5092
+ const encodedTransaction = hexlify17(transactionRequest.toTransactionBytes());
4770
5093
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4771
5094
  encodedTransactions: encodedTransaction,
4772
5095
  utxoValidation: utxoValidation || false
@@ -4786,13 +5109,13 @@ Supported fuel-core version: ${supportedVersion}.`
4786
5109
  async estimatePredicates(transactionRequest) {
4787
5110
  const shouldEstimatePredicates = Boolean(
4788
5111
  transactionRequest.inputs.find(
4789
- (input) => "predicate" in input && input.predicate && !equalBytes(arrayify12(input.predicate), arrayify12("0x")) && new BN2(input.predicateGasUsed).isZero()
5112
+ (input) => "predicate" in input && input.predicate && !equalBytes(arrayify13(input.predicate), arrayify13("0x")) && new BN2(input.predicateGasUsed).isZero()
4790
5113
  )
4791
5114
  );
4792
5115
  if (!shouldEstimatePredicates) {
4793
5116
  return transactionRequest;
4794
5117
  }
4795
- const encodedTransaction = hexlify14(transactionRequest.toTransactionBytes());
5118
+ const encodedTransaction = hexlify17(transactionRequest.toTransactionBytes());
4796
5119
  const response = await this.operations.estimatePredicates({
4797
5120
  encodedTransaction
4798
5121
  });
@@ -4833,7 +5156,7 @@ Supported fuel-core version: ${supportedVersion}.`
4833
5156
  const {
4834
5157
  dryRun: [{ receipts: rawReceipts, status }]
4835
5158
  } = await this.operations.dryRun({
4836
- encodedTransactions: [hexlify14(transactionRequest.toTransactionBytes())],
5159
+ encodedTransactions: [hexlify17(transactionRequest.toTransactionBytes())],
4837
5160
  utxoValidation: false
4838
5161
  });
4839
5162
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4879,11 +5202,11 @@ Supported fuel-core version: ${supportedVersion}.`
4879
5202
  missingContractIds: [],
4880
5203
  dryRunStatus: void 0
4881
5204
  }));
4882
- const allRequests = clone6(transactionRequests);
5205
+ const allRequests = clone8(transactionRequests);
4883
5206
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4884
5207
  allRequests.forEach((req, index) => {
4885
5208
  if (isTransactionTypeScript(req)) {
4886
- serializedTransactionsMap.set(index, hexlify14(req.toTransactionBytes()));
5209
+ serializedTransactionsMap.set(index, hexlify17(req.toTransactionBytes()));
4887
5210
  }
4888
5211
  });
4889
5212
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4919,7 +5242,7 @@ Supported fuel-core version: ${supportedVersion}.`
4919
5242
  transactionRequest: request
4920
5243
  });
4921
5244
  request.maxFee = maxFee;
4922
- serializedTransactionsMap.set(requestIdx, hexlify14(request.toTransactionBytes()));
5245
+ serializedTransactionsMap.set(requestIdx, hexlify17(request.toTransactionBytes()));
4923
5246
  nextRoundTransactions.push(requestIdx);
4924
5247
  }
4925
5248
  }
@@ -4940,7 +5263,7 @@ Supported fuel-core version: ${supportedVersion}.`
4940
5263
  if (estimateTxDependencies) {
4941
5264
  return this.estimateMultipleTxDependencies(transactionRequests);
4942
5265
  }
4943
- const encodedTransactions = transactionRequests.map((tx) => hexlify14(tx.toTransactionBytes()));
5266
+ const encodedTransactions = transactionRequests.map((tx) => hexlify17(tx.toTransactionBytes()));
4944
5267
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4945
5268
  encodedTransactions,
4946
5269
  utxoValidation: utxoValidation || false
@@ -5014,7 +5337,7 @@ Supported fuel-core version: ${supportedVersion}.`
5014
5337
  if (estimateTxDependencies) {
5015
5338
  return this.estimateTxDependencies(transactionRequest);
5016
5339
  }
5017
- const encodedTransactions = [hexlify14(transactionRequest.toTransactionBytes())];
5340
+ const encodedTransactions = [hexlify17(transactionRequest.toTransactionBytes())];
5018
5341
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
5019
5342
  encodedTransactions,
5020
5343
  utxoValidation: true
@@ -5039,13 +5362,13 @@ Supported fuel-core version: ${supportedVersion}.`
5039
5362
  * @returns A promise that resolves to the transaction cost object.
5040
5363
  */
5041
5364
  async getTransactionCost(transactionRequestLike, { signatureCallback } = {}) {
5042
- const txRequestClone = clone6(transactionRequestify(transactionRequestLike));
5365
+ const txRequestClone = clone8(transactionRequestify(transactionRequestLike));
5043
5366
  const updateMaxFee = txRequestClone.maxFee.eq(0);
5044
5367
  const isScriptTransaction = isTransactionTypeScript(txRequestClone);
5045
5368
  if (isScriptTransaction) {
5046
5369
  txRequestClone.gasLimit = bn17(0);
5047
5370
  }
5048
- const signedRequest = clone6(txRequestClone);
5371
+ const signedRequest = clone8(txRequestClone);
5049
5372
  let addedSignatures = 0;
5050
5373
  if (signatureCallback && isTransactionTypeScript(signedRequest)) {
5051
5374
  const lengthBefore = signedRequest.witnesses.length;
@@ -5113,7 +5436,7 @@ Supported fuel-core version: ${supportedVersion}.`
5113
5436
  paginationLimit: RESOURCES_PAGE_SIZE_LIMIT,
5114
5437
  inputArgs: paginationArgs
5115
5438
  }),
5116
- filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify14(assetId) }
5439
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && hexlify17(assetId) }
5117
5440
  });
5118
5441
  const coins = edges.map(({ node }) => ({
5119
5442
  id: node.utxoId,
@@ -5139,8 +5462,8 @@ Supported fuel-core version: ${supportedVersion}.`
5139
5462
  async getResourcesToSpend(owner, quantities, excludedIds) {
5140
5463
  const ownerAddress = Address3.fromAddressOrString(owner);
5141
5464
  const excludeInput = {
5142
- messages: excludedIds?.messages?.map((nonce) => hexlify14(nonce)) || [],
5143
- utxos: excludedIds?.utxos?.map((id) => hexlify14(id)) || []
5465
+ messages: excludedIds?.messages?.map((nonce) => hexlify17(nonce)) || [],
5466
+ utxos: excludedIds?.utxos?.map((id) => hexlify17(id)) || []
5144
5467
  };
5145
5468
  if (this.cache) {
5146
5469
  const cached = this.cache.getActiveData();
@@ -5150,7 +5473,7 @@ Supported fuel-core version: ${supportedVersion}.`
5150
5473
  const coinsQuery = {
5151
5474
  owner: ownerAddress.toB256(),
5152
5475
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
5153
- assetId: hexlify14(assetId),
5476
+ assetId: hexlify17(assetId),
5154
5477
  amount: amount.toString(10),
5155
5478
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
5156
5479
  })),
@@ -5305,7 +5628,7 @@ Supported fuel-core version: ${supportedVersion}.`
5305
5628
  },
5306
5629
  transactionIds: block.transactions.map((tx) => tx.id),
5307
5630
  transactions: block.transactions.map(
5308
- (tx) => new TransactionCoder5().decode(arrayify12(tx.rawPayload), 0)?.[0]
5631
+ (tx) => new TransactionCoder5().decode(arrayify13(tx.rawPayload), 0)?.[0]
5309
5632
  )
5310
5633
  };
5311
5634
  }
@@ -5322,11 +5645,11 @@ Supported fuel-core version: ${supportedVersion}.`
5322
5645
  }
5323
5646
  try {
5324
5647
  return new TransactionCoder5().decode(
5325
- arrayify12(transaction.rawPayload),
5648
+ arrayify13(transaction.rawPayload),
5326
5649
  0
5327
5650
  )?.[0];
5328
5651
  } catch (error) {
5329
- if (error instanceof FuelError16 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5652
+ if (error instanceof FuelError17 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5330
5653
  console.warn("Unsupported transaction type encountered");
5331
5654
  return null;
5332
5655
  }
@@ -5345,9 +5668,9 @@ Supported fuel-core version: ${supportedVersion}.`
5345
5668
  const coder = new TransactionCoder5();
5346
5669
  const transactions = edges.map(({ node: { rawPayload } }) => {
5347
5670
  try {
5348
- return coder.decode(arrayify12(rawPayload), 0)[0];
5671
+ return coder.decode(arrayify13(rawPayload), 0)[0];
5349
5672
  } catch (error) {
5350
- if (error instanceof FuelError16 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5673
+ if (error instanceof FuelError17 && error.code === ErrorCode14.UNSUPPORTED_TRANSACTION_TYPE) {
5351
5674
  console.warn("Unsupported transaction type encountered");
5352
5675
  return null;
5353
5676
  }
@@ -5379,7 +5702,7 @@ Supported fuel-core version: ${supportedVersion}.`
5379
5702
  async getContractBalance(contractId, assetId) {
5380
5703
  const { contractBalance } = await this.operations.getContractBalance({
5381
5704
  contract: Address3.fromAddressOrString(contractId).toB256(),
5382
- asset: hexlify14(assetId)
5705
+ asset: hexlify17(assetId)
5383
5706
  });
5384
5707
  return bn17(contractBalance.amount, 10);
5385
5708
  }
@@ -5393,7 +5716,7 @@ Supported fuel-core version: ${supportedVersion}.`
5393
5716
  async getBalance(owner, assetId) {
5394
5717
  const { balance } = await this.operations.getBalance({
5395
5718
  owner: Address3.fromAddressOrString(owner).toB256(),
5396
- assetId: hexlify14(assetId)
5719
+ assetId: hexlify17(assetId)
5397
5720
  });
5398
5721
  return bn17(balance.amount, 10);
5399
5722
  }
@@ -5439,7 +5762,7 @@ Supported fuel-core version: ${supportedVersion}.`
5439
5762
  owner: Address3.fromAddressOrString(address).toB256()
5440
5763
  });
5441
5764
  const messages = edges.map(({ node }) => ({
5442
- messageId: InputMessageCoder.getMessageId({
5765
+ messageId: InputMessageCoder2.getMessageId({
5443
5766
  sender: node.sender,
5444
5767
  recipient: node.recipient,
5445
5768
  nonce: node.nonce,
@@ -5450,7 +5773,7 @@ Supported fuel-core version: ${supportedVersion}.`
5450
5773
  recipient: Address3.fromAddressOrString(node.recipient),
5451
5774
  nonce: node.nonce,
5452
5775
  amount: bn17(node.amount),
5453
- data: InputMessageCoder.decodeData(node.data),
5776
+ data: InputMessageCoder2.decodeData(node.data),
5454
5777
  daHeight: bn17(node.daHeight)
5455
5778
  }));
5456
5779
  return {
@@ -5473,7 +5796,7 @@ Supported fuel-core version: ${supportedVersion}.`
5473
5796
  nonce
5474
5797
  };
5475
5798
  if (commitBlockId && commitBlockHeight) {
5476
- throw new FuelError16(
5799
+ throw new FuelError17(
5477
5800
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5478
5801
  "commitBlockId and commitBlockHeight cannot be used together"
5479
5802
  );
@@ -5619,7 +5942,7 @@ Supported fuel-core version: ${supportedVersion}.`
5619
5942
  return null;
5620
5943
  }
5621
5944
  const message = {
5622
- messageId: InputMessageCoder.getMessageId({
5945
+ messageId: InputMessageCoder2.getMessageId({
5623
5946
  sender: rawMessage.sender,
5624
5947
  recipient: rawMessage.recipient,
5625
5948
  nonce: rawMessage.nonce,
@@ -5630,7 +5953,7 @@ Supported fuel-core version: ${supportedVersion}.`
5630
5953
  recipient: Address3.fromAddressOrString(rawMessage.recipient),
5631
5954
  nonce: rawMessage.nonce,
5632
5955
  amount: bn17(rawMessage.amount),
5633
- data: InputMessageCoder.decodeData(rawMessage.data),
5956
+ data: InputMessageCoder2.decodeData(rawMessage.data),
5634
5957
  daHeight: bn17(rawMessage.daHeight)
5635
5958
  };
5636
5959
  return message;
@@ -5657,25 +5980,25 @@ Supported fuel-core version: ${supportedVersion}.`
5657
5980
  const { paginationLimit, inputArgs = {} } = params;
5658
5981
  const { first, last, after, before } = inputArgs;
5659
5982
  if (after && before) {
5660
- throw new FuelError16(
5983
+ throw new FuelError17(
5661
5984
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5662
5985
  'Pagination arguments "after" and "before" cannot be used together'
5663
5986
  );
5664
5987
  }
5665
5988
  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {
5666
- throw new FuelError16(
5989
+ throw new FuelError17(
5667
5990
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5668
5991
  `Pagination limit for this query cannot exceed ${paginationLimit} items`
5669
5992
  );
5670
5993
  }
5671
5994
  if (first && before) {
5672
- throw new FuelError16(
5995
+ throw new FuelError17(
5673
5996
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5674
5997
  'The use of pagination argument "first" with "before" is not supported'
5675
5998
  );
5676
5999
  }
5677
6000
  if (last && after) {
5678
- throw new FuelError16(
6001
+ throw new FuelError17(
5679
6002
  ErrorCode14.INVALID_INPUT_PARAMETERS,
5680
6003
  'The use of pagination argument "last" with "after" is not supported'
5681
6004
  );
@@ -5730,20 +6053,22 @@ __publicField(Provider, "chainInfoCache", {});
5730
6053
  __publicField(Provider, "nodeInfoCache", {});
5731
6054
 
5732
6055
  // src/providers/transaction-summary/get-transaction-summary.ts
5733
- import { ErrorCode as ErrorCode15, FuelError as FuelError17 } from "@fuel-ts/errors";
6056
+ import { ErrorCode as ErrorCode15, FuelError as FuelError18 } from "@fuel-ts/errors";
5734
6057
  import { bn as bn18 } from "@fuel-ts/math";
5735
6058
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
5736
- import { arrayify as arrayify13 } from "@fuel-ts/utils";
6059
+ import { arrayify as arrayify14 } from "@fuel-ts/utils";
5737
6060
 
5738
6061
  // src/providers/chains.ts
5739
6062
  var CHAIN_IDS = {
5740
6063
  eth: {
6064
+ mainnet: 1,
5741
6065
  sepolia: 11155111,
5742
6066
  foundry: 31337
5743
6067
  },
5744
6068
  fuel: {
5745
6069
  devnet: 0,
5746
- testnet: 0
6070
+ testnet: 0,
6071
+ mainnet: 9889
5747
6072
  }
5748
6073
  };
5749
6074
 
@@ -5789,6 +6114,11 @@ var rawAssets = [
5789
6114
  chainId: CHAIN_IDS.eth.foundry,
5790
6115
  decimals: 18
5791
6116
  },
6117
+ {
6118
+ type: "ethereum",
6119
+ chainId: CHAIN_IDS.eth.mainnet,
6120
+ decimals: 18
6121
+ },
5792
6122
  {
5793
6123
  type: "fuel",
5794
6124
  chainId: CHAIN_IDS.fuel.devnet,
@@ -5800,54 +6130,619 @@ var rawAssets = [
5800
6130
  chainId: CHAIN_IDS.fuel.testnet,
5801
6131
  decimals: 9,
5802
6132
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
6133
+ },
6134
+ {
6135
+ type: "fuel",
6136
+ chainId: CHAIN_IDS.fuel.mainnet,
6137
+ decimals: 9,
6138
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
5803
6139
  }
5804
6140
  ]
5805
- }
5806
- ];
5807
- var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
5808
-
5809
- // src/test-utils/test-asset-id.ts
5810
- import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
5811
- import { hexlify as hexlify15 } from "@fuel-ts/utils";
5812
- var _TestAssetId = class {
5813
- constructor(value) {
5814
- this.value = value;
5815
- }
5816
- static random(count = 1) {
5817
- const assetIds = [];
5818
- for (let i = 0; i < count; i++) {
5819
- assetIds.push(new _TestAssetId(hexlify15(randomBytes4(32))));
5820
- }
5821
- return assetIds;
5822
- }
5823
- };
5824
- var TestAssetId = _TestAssetId;
5825
- __publicField(TestAssetId, "A", new _TestAssetId(
5826
- "0x0101010101010101010101010101010101010101010101010101010101010101"
5827
- ));
5828
- __publicField(TestAssetId, "B", new _TestAssetId(
5829
- "0x0202020202020202020202020202020202020202020202020202020202020202"
5830
- ));
5831
-
5832
- // src/test-utils/wallet-config.ts
5833
- import { randomBytes as randomBytes8 } from "@fuel-ts/crypto";
5834
- import { FuelError as FuelError23 } from "@fuel-ts/errors";
5835
- import { defaultSnapshotConfigs as defaultSnapshotConfigs2, hexlify as hexlify21 } from "@fuel-ts/utils";
5836
-
5837
- // src/wallet/base-wallet-unlocked.ts
5838
- import { hashMessage } from "@fuel-ts/hasher";
5839
- import { hexlify as hexlify18 } from "@fuel-ts/utils";
5840
-
5841
- // src/account.ts
5842
- import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
5843
- import { Address as Address4 } from "@fuel-ts/address";
5844
- import { randomBytes as randomBytes5 } from "@fuel-ts/crypto";
5845
- import { ErrorCode as ErrorCode16, FuelError as FuelError18 } from "@fuel-ts/errors";
5846
- import { AbstractAccount } from "@fuel-ts/interfaces";
5847
- import { bn as bn19 } from "@fuel-ts/math";
5848
- import { InputType as InputType8 } from "@fuel-ts/transactions";
5849
- import { arrayify as arrayify15, hexlify as hexlify16, isDefined as isDefined3 } from "@fuel-ts/utils";
5850
- import { clone as clone7 } from "ramda";
6141
+ },
6142
+ {
6143
+ name: "WETH",
6144
+ symbol: "WETH",
6145
+ icon: "weth.svg",
6146
+ networks: [
6147
+ {
6148
+ type: "ethereum",
6149
+ chainId: CHAIN_IDS.eth.mainnet,
6150
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
6151
+ decimals: 18
6152
+ },
6153
+ {
6154
+ type: "fuel",
6155
+ chainId: CHAIN_IDS.fuel.mainnet,
6156
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6157
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
6158
+ decimals: 18
6159
+ }
6160
+ ]
6161
+ },
6162
+ {
6163
+ name: "weETH",
6164
+ symbol: "weETH",
6165
+ icon: "weETH.webp",
6166
+ networks: [
6167
+ {
6168
+ type: "ethereum",
6169
+ chainId: CHAIN_IDS.eth.mainnet,
6170
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
6171
+ decimals: 18
6172
+ },
6173
+ {
6174
+ type: "fuel",
6175
+ chainId: CHAIN_IDS.fuel.mainnet,
6176
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6177
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
6178
+ decimals: 18
6179
+ }
6180
+ ]
6181
+ },
6182
+ {
6183
+ name: "rsETH",
6184
+ symbol: "rsETH",
6185
+ icon: "rsETH.webp",
6186
+ networks: [
6187
+ {
6188
+ type: "ethereum",
6189
+ chainId: CHAIN_IDS.eth.mainnet,
6190
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
6191
+ decimals: 18
6192
+ },
6193
+ {
6194
+ type: "fuel",
6195
+ chainId: CHAIN_IDS.fuel.mainnet,
6196
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6197
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
6198
+ decimals: 18
6199
+ }
6200
+ ]
6201
+ },
6202
+ {
6203
+ name: "rETH",
6204
+ symbol: "rETH",
6205
+ icon: "reth.svg",
6206
+ networks: [
6207
+ {
6208
+ type: "ethereum",
6209
+ chainId: CHAIN_IDS.eth.mainnet,
6210
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
6211
+ decimals: 18
6212
+ },
6213
+ {
6214
+ type: "fuel",
6215
+ chainId: CHAIN_IDS.fuel.mainnet,
6216
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6217
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
6218
+ decimals: 18
6219
+ }
6220
+ ]
6221
+ },
6222
+ {
6223
+ name: "wbETH",
6224
+ symbol: "wbETH",
6225
+ icon: "wbeth.png",
6226
+ networks: [
6227
+ {
6228
+ type: "ethereum",
6229
+ chainId: CHAIN_IDS.eth.mainnet,
6230
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
6231
+ decimals: 18
6232
+ },
6233
+ {
6234
+ type: "fuel",
6235
+ chainId: CHAIN_IDS.fuel.mainnet,
6236
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6237
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
6238
+ decimals: 18
6239
+ }
6240
+ ]
6241
+ },
6242
+ {
6243
+ name: "rstETH",
6244
+ symbol: "rstETH",
6245
+ icon: "rstETH.webp",
6246
+ networks: [
6247
+ {
6248
+ type: "ethereum",
6249
+ chainId: CHAIN_IDS.eth.mainnet,
6250
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
6251
+ decimals: 18
6252
+ },
6253
+ {
6254
+ type: "fuel",
6255
+ chainId: CHAIN_IDS.fuel.mainnet,
6256
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6257
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
6258
+ decimals: 18
6259
+ }
6260
+ ]
6261
+ },
6262
+ {
6263
+ name: "amphrETH",
6264
+ symbol: "amphrETH",
6265
+ icon: "amphrETH.png",
6266
+ networks: [
6267
+ {
6268
+ type: "ethereum",
6269
+ chainId: CHAIN_IDS.eth.mainnet,
6270
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
6271
+ decimals: 18
6272
+ },
6273
+ {
6274
+ type: "fuel",
6275
+ chainId: CHAIN_IDS.fuel.mainnet,
6276
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6277
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
6278
+ decimals: 18
6279
+ }
6280
+ ]
6281
+ },
6282
+ {
6283
+ name: "Manta mBTC",
6284
+ symbol: "Manta mBTC",
6285
+ icon: "manta-mbtc.svg",
6286
+ networks: [
6287
+ {
6288
+ type: "ethereum",
6289
+ chainId: CHAIN_IDS.eth.mainnet,
6290
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
6291
+ decimals: 18
6292
+ },
6293
+ {
6294
+ type: "fuel",
6295
+ chainId: CHAIN_IDS.fuel.mainnet,
6296
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6297
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
6298
+ decimals: 18
6299
+ }
6300
+ ]
6301
+ },
6302
+ {
6303
+ name: "Manta mETH",
6304
+ symbol: "Manta mETH",
6305
+ icon: "manta-meth.svg",
6306
+ networks: [
6307
+ {
6308
+ type: "ethereum",
6309
+ chainId: CHAIN_IDS.eth.mainnet,
6310
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
6311
+ decimals: 18
6312
+ },
6313
+ {
6314
+ type: "fuel",
6315
+ chainId: CHAIN_IDS.fuel.mainnet,
6316
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6317
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
6318
+ decimals: 18
6319
+ }
6320
+ ]
6321
+ },
6322
+ {
6323
+ name: "Manta mUSD",
6324
+ symbol: "Manta mUSD",
6325
+ icon: "manta-musd.svg",
6326
+ networks: [
6327
+ {
6328
+ type: "ethereum",
6329
+ chainId: CHAIN_IDS.eth.mainnet,
6330
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
6331
+ decimals: 18
6332
+ },
6333
+ {
6334
+ type: "fuel",
6335
+ chainId: CHAIN_IDS.fuel.mainnet,
6336
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6337
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
6338
+ decimals: 18
6339
+ }
6340
+ ]
6341
+ },
6342
+ {
6343
+ name: "pumpBTC",
6344
+ symbol: "pumpBTC",
6345
+ icon: "pumpbtc.webp",
6346
+ networks: [
6347
+ {
6348
+ type: "ethereum",
6349
+ chainId: CHAIN_IDS.eth.mainnet,
6350
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
6351
+ decimals: 8
6352
+ },
6353
+ {
6354
+ type: "fuel",
6355
+ chainId: CHAIN_IDS.fuel.mainnet,
6356
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6357
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
6358
+ decimals: 8
6359
+ }
6360
+ ]
6361
+ },
6362
+ {
6363
+ name: "FBTC",
6364
+ symbol: "FBTC",
6365
+ icon: "fbtc.svg",
6366
+ networks: [
6367
+ {
6368
+ type: "ethereum",
6369
+ chainId: CHAIN_IDS.eth.mainnet,
6370
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
6371
+ decimals: 8
6372
+ },
6373
+ {
6374
+ type: "fuel",
6375
+ chainId: CHAIN_IDS.fuel.mainnet,
6376
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6377
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
6378
+ decimals: 8
6379
+ }
6380
+ ]
6381
+ },
6382
+ {
6383
+ name: "SolvBTC",
6384
+ symbol: "SolvBTC",
6385
+ icon: "solvBTC.webp",
6386
+ networks: [
6387
+ {
6388
+ type: "ethereum",
6389
+ chainId: CHAIN_IDS.eth.mainnet,
6390
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
6391
+ decimals: 18
6392
+ },
6393
+ {
6394
+ type: "fuel",
6395
+ chainId: CHAIN_IDS.fuel.mainnet,
6396
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6397
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
6398
+ decimals: 18
6399
+ }
6400
+ ]
6401
+ },
6402
+ {
6403
+ name: "SolvBTC.BBN",
6404
+ symbol: "SolvBTC.BBN",
6405
+ icon: "SolvBTC.BBN.png",
6406
+ networks: [
6407
+ {
6408
+ type: "ethereum",
6409
+ chainId: CHAIN_IDS.eth.mainnet,
6410
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
6411
+ decimals: 18
6412
+ },
6413
+ {
6414
+ type: "fuel",
6415
+ chainId: CHAIN_IDS.fuel.mainnet,
6416
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6417
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
6418
+ decimals: 18
6419
+ }
6420
+ ]
6421
+ },
6422
+ {
6423
+ name: "Mantle mETH",
6424
+ symbol: "Mantle mETH",
6425
+ icon: "mantle-meth.svg",
6426
+ networks: [
6427
+ {
6428
+ type: "ethereum",
6429
+ chainId: CHAIN_IDS.eth.mainnet,
6430
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
6431
+ decimals: 18
6432
+ },
6433
+ {
6434
+ type: "fuel",
6435
+ chainId: CHAIN_IDS.fuel.mainnet,
6436
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6437
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
6438
+ decimals: 18
6439
+ }
6440
+ ]
6441
+ },
6442
+ {
6443
+ name: "sDAI",
6444
+ symbol: "sDAI",
6445
+ icon: "sdai.svg",
6446
+ networks: [
6447
+ {
6448
+ type: "ethereum",
6449
+ chainId: CHAIN_IDS.eth.mainnet,
6450
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
6451
+ decimals: 18
6452
+ },
6453
+ {
6454
+ type: "fuel",
6455
+ chainId: CHAIN_IDS.fuel.mainnet,
6456
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6457
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
6458
+ decimals: 18
6459
+ }
6460
+ ]
6461
+ },
6462
+ {
6463
+ name: "USDT",
6464
+ symbol: "USDT",
6465
+ icon: "usdt.svg",
6466
+ networks: [
6467
+ {
6468
+ type: "ethereum",
6469
+ chainId: CHAIN_IDS.eth.mainnet,
6470
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
6471
+ decimals: 6
6472
+ },
6473
+ {
6474
+ type: "fuel",
6475
+ chainId: CHAIN_IDS.fuel.mainnet,
6476
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6477
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
6478
+ decimals: 6
6479
+ }
6480
+ ]
6481
+ },
6482
+ {
6483
+ name: "USDC",
6484
+ symbol: "USDC",
6485
+ icon: "usdc.svg",
6486
+ networks: [
6487
+ {
6488
+ type: "ethereum",
6489
+ chainId: CHAIN_IDS.eth.mainnet,
6490
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
6491
+ decimals: 6
6492
+ },
6493
+ {
6494
+ type: "fuel",
6495
+ chainId: CHAIN_IDS.fuel.mainnet,
6496
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6497
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
6498
+ decimals: 6
6499
+ }
6500
+ ]
6501
+ },
6502
+ {
6503
+ name: "USDe",
6504
+ symbol: "USDe",
6505
+ icon: "USDe.svg",
6506
+ networks: [
6507
+ {
6508
+ type: "ethereum",
6509
+ chainId: CHAIN_IDS.eth.mainnet,
6510
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
6511
+ decimals: 18
6512
+ },
6513
+ {
6514
+ type: "ethereum",
6515
+ chainId: CHAIN_IDS.eth.sepolia,
6516
+ address: "0xc6387efad0f184a90b34f397c3d6fd63135ef790",
6517
+ decimals: 18
6518
+ },
6519
+ {
6520
+ type: "fuel",
6521
+ chainId: CHAIN_IDS.fuel.mainnet,
6522
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6523
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
6524
+ decimals: 18
6525
+ },
6526
+ {
6527
+ type: "fuel",
6528
+ chainId: CHAIN_IDS.fuel.testnet,
6529
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6530
+ assetId: "0xf5c6d72d0f2c782fa47d8e228c198a08654e9fc66ca60ad85902b1d09046a7ab",
6531
+ decimals: 18
6532
+ }
6533
+ ]
6534
+ },
6535
+ {
6536
+ name: "sUSDe",
6537
+ symbol: "sUSDe",
6538
+ icon: "sUSDe.webp",
6539
+ networks: [
6540
+ {
6541
+ type: "ethereum",
6542
+ chainId: CHAIN_IDS.eth.mainnet,
6543
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
6544
+ decimals: 18
6545
+ },
6546
+ {
6547
+ type: "ethereum",
6548
+ chainId: CHAIN_IDS.eth.sepolia,
6549
+ address: "0xb8f4f4eafc1d2a3c0a4d519bbf1114c311cc9b1b",
6550
+ decimals: 18
6551
+ },
6552
+ {
6553
+ type: "fuel",
6554
+ chainId: CHAIN_IDS.fuel.mainnet,
6555
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6556
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
6557
+ decimals: 18
6558
+ },
6559
+ {
6560
+ type: "fuel",
6561
+ chainId: CHAIN_IDS.fuel.testnet,
6562
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6563
+ assetId: "0xa86e37d385c08beddbb02c8260f9ec535d484c8ea908fc19d4e6dc8d5141fb2e",
6564
+ decimals: 18
6565
+ }
6566
+ ]
6567
+ },
6568
+ {
6569
+ name: "rsUSDe",
6570
+ symbol: "rsUSDe",
6571
+ icon: "rsUSDe.svg",
6572
+ networks: [
6573
+ {
6574
+ type: "ethereum",
6575
+ chainId: CHAIN_IDS.eth.mainnet,
6576
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
6577
+ decimals: 18
6578
+ },
6579
+ {
6580
+ type: "fuel",
6581
+ chainId: CHAIN_IDS.fuel.mainnet,
6582
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6583
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
6584
+ decimals: 18
6585
+ }
6586
+ ]
6587
+ },
6588
+ {
6589
+ name: "wstETH",
6590
+ symbol: "wstETH",
6591
+ icon: "wsteth.svg",
6592
+ networks: [
6593
+ {
6594
+ type: "ethereum",
6595
+ chainId: CHAIN_IDS.eth.mainnet,
6596
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
6597
+ decimals: 18
6598
+ },
6599
+ {
6600
+ type: "ethereum",
6601
+ chainId: CHAIN_IDS.eth.sepolia,
6602
+ address: "0xB82381A3fBD3FaFA77B3a7bE693342618240067b",
6603
+ decimals: 18
6604
+ },
6605
+ {
6606
+ type: "fuel",
6607
+ chainId: CHAIN_IDS.fuel.mainnet,
6608
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6609
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
6610
+ decimals: 18
6611
+ },
6612
+ {
6613
+ type: "fuel",
6614
+ chainId: CHAIN_IDS.fuel.testnet,
6615
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
6616
+ assetId: "0x4c467e3fd4f32179e1aad3b92ebbdaa6ff6aeda5b8da5f8e64e96405eb52a7f5",
6617
+ decimals: 18
6618
+ }
6619
+ ]
6620
+ },
6621
+ {
6622
+ name: "ezETH",
6623
+ symbol: "ezETH",
6624
+ icon: "ezeth.webp",
6625
+ networks: [
6626
+ {
6627
+ type: "ethereum",
6628
+ chainId: CHAIN_IDS.eth.mainnet,
6629
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
6630
+ decimals: 18
6631
+ },
6632
+ {
6633
+ type: "fuel",
6634
+ chainId: CHAIN_IDS.fuel.mainnet,
6635
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6636
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
6637
+ decimals: 18
6638
+ }
6639
+ ]
6640
+ },
6641
+ {
6642
+ name: "pzETH",
6643
+ symbol: "pzETH",
6644
+ icon: "pzETH.webp",
6645
+ networks: [
6646
+ {
6647
+ type: "ethereum",
6648
+ chainId: CHAIN_IDS.eth.mainnet,
6649
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
6650
+ decimals: 18
6651
+ },
6652
+ {
6653
+ type: "fuel",
6654
+ chainId: CHAIN_IDS.fuel.mainnet,
6655
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6656
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
6657
+ decimals: 18
6658
+ }
6659
+ ]
6660
+ },
6661
+ {
6662
+ name: "Re7LRT",
6663
+ symbol: "Re7LRT",
6664
+ icon: "Re7LRT.png",
6665
+ networks: [
6666
+ {
6667
+ type: "ethereum",
6668
+ chainId: CHAIN_IDS.eth.mainnet,
6669
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
6670
+ decimals: 18
6671
+ },
6672
+ {
6673
+ type: "fuel",
6674
+ chainId: CHAIN_IDS.fuel.mainnet,
6675
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6676
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
6677
+ decimals: 18
6678
+ }
6679
+ ]
6680
+ },
6681
+ {
6682
+ name: "steakLRT",
6683
+ symbol: "steakLRT",
6684
+ icon: "steakLRT.png",
6685
+ networks: [
6686
+ {
6687
+ type: "ethereum",
6688
+ chainId: CHAIN_IDS.eth.mainnet,
6689
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
6690
+ decimals: 18
6691
+ },
6692
+ {
6693
+ type: "fuel",
6694
+ chainId: CHAIN_IDS.fuel.mainnet,
6695
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
6696
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
6697
+ decimals: 18
6698
+ }
6699
+ ]
6700
+ }
6701
+ ];
6702
+ var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
6703
+
6704
+ // src/test-utils/test-asset-id.ts
6705
+ import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
6706
+ import { hexlify as hexlify18 } from "@fuel-ts/utils";
6707
+ var _TestAssetId = class {
6708
+ constructor(value) {
6709
+ this.value = value;
6710
+ }
6711
+ static random(count = 1) {
6712
+ const assetIds = [];
6713
+ for (let i = 0; i < count; i++) {
6714
+ assetIds.push(new _TestAssetId(hexlify18(randomBytes4(32))));
6715
+ }
6716
+ return assetIds;
6717
+ }
6718
+ };
6719
+ var TestAssetId = _TestAssetId;
6720
+ __publicField(TestAssetId, "A", new _TestAssetId(
6721
+ "0x0101010101010101010101010101010101010101010101010101010101010101"
6722
+ ));
6723
+ __publicField(TestAssetId, "B", new _TestAssetId(
6724
+ "0x0202020202020202020202020202020202020202020202020202020202020202"
6725
+ ));
6726
+
6727
+ // src/test-utils/wallet-config.ts
6728
+ import { randomBytes as randomBytes8 } from "@fuel-ts/crypto";
6729
+ import { FuelError as FuelError24 } from "@fuel-ts/errors";
6730
+ import { defaultSnapshotConfigs as defaultSnapshotConfigs2, hexlify as hexlify24 } from "@fuel-ts/utils";
6731
+
6732
+ // src/wallet/base-wallet-unlocked.ts
6733
+ import { hashMessage } from "@fuel-ts/hasher";
6734
+ import { hexlify as hexlify21 } from "@fuel-ts/utils";
6735
+
6736
+ // src/account.ts
6737
+ import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
6738
+ import { Address as Address4 } from "@fuel-ts/address";
6739
+ import { randomBytes as randomBytes5 } from "@fuel-ts/crypto";
6740
+ import { ErrorCode as ErrorCode16, FuelError as FuelError19 } from "@fuel-ts/errors";
6741
+ import { AbstractAccount } from "@fuel-ts/interfaces";
6742
+ import { bn as bn19 } from "@fuel-ts/math";
6743
+ import { InputType as InputType8 } from "@fuel-ts/transactions";
6744
+ import { arrayify as arrayify16, hexlify as hexlify19, isDefined as isDefined3 } from "@fuel-ts/utils";
6745
+ import { clone as clone9 } from "ramda";
5851
6746
 
5852
6747
  // src/providers/utils/merge-quantities.ts
5853
6748
  var mergeQuantities = (...coinQuantities) => {
@@ -5866,16 +6761,16 @@ var mergeQuantities = (...coinQuantities) => {
5866
6761
  // src/utils/formatTransferToContractScriptData.ts
5867
6762
  import { BigNumberCoder as BigNumberCoder2 } from "@fuel-ts/abi-coder";
5868
6763
  import { BN as BN3 } from "@fuel-ts/math";
5869
- import { arrayify as arrayify14 } from "@fuel-ts/utils";
6764
+ import { arrayify as arrayify15 } from "@fuel-ts/utils";
5870
6765
  import * as asm from "@fuels/vm-asm";
5871
6766
  var formatTransferToContractScriptData = (params) => {
5872
6767
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
5873
6768
  const numberCoder = new BigNumberCoder2("u64");
5874
6769
  const encoded = numberCoder.encode(new BN3(amountToTransfer).toNumber());
5875
6770
  const scriptData = Uint8Array.from([
5876
- ...arrayify14(hexlifiedContractId),
6771
+ ...arrayify15(hexlifiedContractId),
5877
6772
  ...encoded,
5878
- ...arrayify14(assetId)
6773
+ ...arrayify15(assetId)
5879
6774
  ]);
5880
6775
  return scriptData;
5881
6776
  };
@@ -5936,7 +6831,7 @@ var Account = class extends AbstractAccount {
5936
6831
  */
5937
6832
  get provider() {
5938
6833
  if (!this._provider) {
5939
- throw new FuelError18(ErrorCode16.MISSING_PROVIDER, "Provider not set");
6834
+ throw new FuelError19(ErrorCode16.MISSING_PROVIDER, "Provider not set");
5940
6835
  }
5941
6836
  return this._provider;
5942
6837
  }
@@ -6054,7 +6949,7 @@ var Account = class extends AbstractAccount {
6054
6949
  );
6055
6950
  request.addResources(resources);
6056
6951
  request.updatePredicateGasUsed(estimatedPredicates);
6057
- const requestToReestimate2 = clone7(request);
6952
+ const requestToReestimate2 = clone9(request);
6058
6953
  if (addedSignatures) {
6059
6954
  Array.from({ length: addedSignatures }).forEach(
6060
6955
  () => requestToReestimate2.addEmptyWitness()
@@ -6087,13 +6982,13 @@ var Account = class extends AbstractAccount {
6087
6982
  fundingAttempts += 1;
6088
6983
  }
6089
6984
  if (needsToBeFunded) {
6090
- throw new FuelError18(
6985
+ throw new FuelError19(
6091
6986
  ErrorCode16.NOT_ENOUGH_FUNDS,
6092
6987
  `The account ${this.address} does not have enough base asset funds to cover the transaction execution.`
6093
6988
  );
6094
6989
  }
6095
6990
  request.updatePredicateGasUsed(estimatedPredicates);
6096
- const requestToReestimate = clone7(request);
6991
+ const requestToReestimate = clone9(request);
6097
6992
  if (addedSignatures) {
6098
6993
  Array.from({ length: addedSignatures }).forEach(() => requestToReestimate.addEmptyWitness());
6099
6994
  }
@@ -6193,7 +7088,7 @@ var Account = class extends AbstractAccount {
6193
7088
  */
6194
7089
  async transferToContract(contractId, amount, assetId, txParams = {}) {
6195
7090
  if (bn19(amount).lte(0)) {
6196
- throw new FuelError18(
7091
+ throw new FuelError19(
6197
7092
  ErrorCode16.INVALID_TRANSFER_AMOUNT,
6198
7093
  "Transfer amount must be a positive number."
6199
7094
  );
@@ -6233,14 +7128,14 @@ var Account = class extends AbstractAccount {
6233
7128
  */
6234
7129
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
6235
7130
  const recipientAddress = Address4.fromAddressOrString(recipient);
6236
- const recipientDataArray = arrayify15(
7131
+ const recipientDataArray = arrayify16(
6237
7132
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
6238
7133
  );
6239
- const amountDataArray = arrayify15(
7134
+ const amountDataArray = arrayify16(
6240
7135
  "0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
6241
7136
  );
6242
7137
  const script = new Uint8Array([
6243
- ...arrayify15(withdrawScript.bytes),
7138
+ ...arrayify16(withdrawScript.bytes),
6244
7139
  ...recipientDataArray,
6245
7140
  ...amountDataArray
6246
7141
  ]);
@@ -6269,7 +7164,7 @@ var Account = class extends AbstractAccount {
6269
7164
  * @returns A promise that resolves to the transaction cost object.
6270
7165
  */
6271
7166
  async getTransactionCost(transactionRequestLike, { signatureCallback, quantities = [] } = {}) {
6272
- const txRequestClone = clone7(transactionRequestify(transactionRequestLike));
7167
+ const txRequestClone = clone9(transactionRequestify(transactionRequestLike));
6273
7168
  const baseAssetId = this.provider.getBaseAssetId();
6274
7169
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
6275
7170
  const requiredQuantities = mergeQuantities(coinOutputsQuantities, quantities);
@@ -6320,7 +7215,7 @@ var Account = class extends AbstractAccount {
6320
7215
  */
6321
7216
  async signMessage(message) {
6322
7217
  if (!this._connector) {
6323
- throw new FuelError18(ErrorCode16.MISSING_CONNECTOR, "A connector is required to sign messages.");
7218
+ throw new FuelError19(ErrorCode16.MISSING_CONNECTOR, "A connector is required to sign messages.");
6324
7219
  }
6325
7220
  return this._connector.signMessage(this.address.toString(), message);
6326
7221
  }
@@ -6332,7 +7227,7 @@ var Account = class extends AbstractAccount {
6332
7227
  */
6333
7228
  async signTransaction(transactionRequestLike) {
6334
7229
  if (!this._connector) {
6335
- throw new FuelError18(
7230
+ throw new FuelError19(
6336
7231
  ErrorCode16.MISSING_CONNECTOR,
6337
7232
  "A connector is required to sign transactions."
6338
7233
  );
@@ -6382,7 +7277,7 @@ var Account = class extends AbstractAccount {
6382
7277
  */
6383
7278
  generateFakeResources(coins) {
6384
7279
  return coins.map((coin) => ({
6385
- id: hexlify16(randomBytes5(UTXO_ID_LEN3)),
7280
+ id: hexlify19(randomBytes5(UTXO_ID_LEN3)),
6386
7281
  owner: this.address,
6387
7282
  blockCreated: bn19(1),
6388
7283
  txCreatedIdx: bn19(1),
@@ -6392,7 +7287,7 @@ var Account = class extends AbstractAccount {
6392
7287
  /** @hidden * */
6393
7288
  validateTransferAmount(amount) {
6394
7289
  if (bn19(amount).lte(0)) {
6395
- throw new FuelError18(
7290
+ throw new FuelError19(
6396
7291
  ErrorCode16.INVALID_TRANSFER_AMOUNT,
6397
7292
  "Transfer amount must be a positive number."
6398
7293
  );
@@ -6422,7 +7317,7 @@ var Account = class extends AbstractAccount {
6422
7317
  if (!isDefined3(setGasLimit)) {
6423
7318
  request.gasLimit = gasUsed;
6424
7319
  } else if (gasUsed.gt(setGasLimit)) {
6425
- throw new FuelError18(
7320
+ throw new FuelError19(
6426
7321
  ErrorCode16.GAS_LIMIT_TOO_LOW,
6427
7322
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
6428
7323
  );
@@ -6430,7 +7325,7 @@ var Account = class extends AbstractAccount {
6430
7325
  if (!isDefined3(setMaxFee)) {
6431
7326
  request.maxFee = maxFee;
6432
7327
  } else if (maxFee.gt(setMaxFee)) {
6433
- throw new FuelError18(
7328
+ throw new FuelError19(
6434
7329
  ErrorCode16.MAX_FEE_TOO_LOW,
6435
7330
  `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`
6436
7331
  );
@@ -6451,8 +7346,8 @@ import {
6451
7346
  encryptJsonWalletData,
6452
7347
  randomUUID as randomUUID2
6453
7348
  } from "@fuel-ts/crypto";
6454
- import { ErrorCode as ErrorCode17, FuelError as FuelError19 } from "@fuel-ts/errors";
6455
- import { hexlify as hexlify17 } from "@fuel-ts/utils";
7349
+ import { ErrorCode as ErrorCode17, FuelError as FuelError20 } from "@fuel-ts/errors";
7350
+ import { hexlify as hexlify20 } from "@fuel-ts/utils";
6456
7351
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
6457
7352
  var DEFAULT_KDF_PARAMS_R = 8;
6458
7353
  var DEFAULT_KDF_PARAMS_P = 1;
@@ -6528,13 +7423,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
6528
7423
  const macHashUint8Array = keccak256(data);
6529
7424
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
6530
7425
  if (mac !== macHash) {
6531
- throw new FuelError19(
7426
+ throw new FuelError20(
6532
7427
  ErrorCode17.INVALID_PASSWORD,
6533
7428
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
6534
7429
  );
6535
7430
  }
6536
7431
  const buffer = await decryptJsonWalletData(ciphertextBuffer, key, ivBuffer);
6537
- const privateKey = hexlify17(buffer);
7432
+ const privateKey = hexlify20(buffer);
6538
7433
  return privateKey;
6539
7434
  }
6540
7435
 
@@ -6579,7 +7474,7 @@ var BaseWalletUnlocked = class extends Account {
6579
7474
  */
6580
7475
  async signMessage(message) {
6581
7476
  const signedMessage = await this.signer().sign(hashMessage(message));
6582
- return hexlify18(signedMessage);
7477
+ return hexlify21(signedMessage);
6583
7478
  }
6584
7479
  /**
6585
7480
  * Signs a transaction with the wallet's private key.
@@ -6592,7 +7487,7 @@ var BaseWalletUnlocked = class extends Account {
6592
7487
  const chainId = this.provider.getChainId();
6593
7488
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
6594
7489
  const signature = await this.signer().sign(hashedTransaction);
6595
- return hexlify18(signature);
7490
+ return hexlify21(signature);
6596
7491
  }
6597
7492
  /**
6598
7493
  * Populates a transaction with the witnesses signature.
@@ -6659,16 +7554,16 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
6659
7554
 
6660
7555
  // src/hdwallet/hdwallet.ts
6661
7556
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
6662
- import { ErrorCode as ErrorCode20, FuelError as FuelError22 } from "@fuel-ts/errors";
7557
+ import { ErrorCode as ErrorCode20, FuelError as FuelError23 } from "@fuel-ts/errors";
6663
7558
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
6664
7559
  import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
6665
- import { arrayify as arrayify18, hexlify as hexlify20, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
7560
+ import { arrayify as arrayify19, hexlify as hexlify23, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
6666
7561
 
6667
7562
  // src/mnemonic/mnemonic.ts
6668
7563
  import { randomBytes as randomBytes7, pbkdf2, computeHmac } from "@fuel-ts/crypto";
6669
- import { ErrorCode as ErrorCode19, FuelError as FuelError21 } from "@fuel-ts/errors";
7564
+ import { ErrorCode as ErrorCode19, FuelError as FuelError22 } from "@fuel-ts/errors";
6670
7565
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
6671
- import { arrayify as arrayify17, hexlify as hexlify19, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
7566
+ import { arrayify as arrayify18, hexlify as hexlify22, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
6672
7567
 
6673
7568
  // src/wordlists/words/english.ts
6674
7569
  var english = [
@@ -8723,9 +9618,9 @@ var english = [
8723
9618
  ];
8724
9619
 
8725
9620
  // src/mnemonic/utils.ts
8726
- import { ErrorCode as ErrorCode18, FuelError as FuelError20 } from "@fuel-ts/errors";
9621
+ import { ErrorCode as ErrorCode18, FuelError as FuelError21 } from "@fuel-ts/errors";
8727
9622
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
8728
- import { arrayify as arrayify16 } from "@fuel-ts/utils";
9623
+ import { arrayify as arrayify17 } from "@fuel-ts/utils";
8729
9624
  function getLowerMask(bits) {
8730
9625
  return (1 << bits) - 1;
8731
9626
  }
@@ -8760,19 +9655,19 @@ function entropyToMnemonicIndices(entropy) {
8760
9655
  }
8761
9656
  }
8762
9657
  const checksumBits = entropy.length / 4;
8763
- const checksum = arrayify16(sha2562(entropy))[0] & getUpperMask(checksumBits);
9658
+ const checksum = arrayify17(sha2562(entropy))[0] & getUpperMask(checksumBits);
8764
9659
  indices[indices.length - 1] <<= checksumBits;
8765
9660
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
8766
9661
  return indices;
8767
9662
  }
8768
9663
  function mnemonicWordsToEntropy(words, wordlist) {
8769
9664
  const size = Math.ceil(11 * words.length / 8);
8770
- const entropy = arrayify16(new Uint8Array(size));
9665
+ const entropy = arrayify17(new Uint8Array(size));
8771
9666
  let offset = 0;
8772
9667
  for (let i = 0; i < words.length; i += 1) {
8773
9668
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
8774
9669
  if (index === -1) {
8775
- throw new FuelError20(
9670
+ throw new FuelError21(
8776
9671
  ErrorCode18.INVALID_MNEMONIC,
8777
9672
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
8778
9673
  );
@@ -8787,9 +9682,9 @@ function mnemonicWordsToEntropy(words, wordlist) {
8787
9682
  const entropyBits = 32 * words.length / 3;
8788
9683
  const checksumBits = words.length / 3;
8789
9684
  const checksumMask = getUpperMask(checksumBits);
8790
- const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
9685
+ const checksum = arrayify17(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
8791
9686
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
8792
- throw new FuelError20(
9687
+ throw new FuelError21(
8793
9688
  ErrorCode18.INVALID_CHECKSUM,
8794
9689
  "Checksum validation failed for the provided mnemonic."
8795
9690
  );
@@ -8804,7 +9699,7 @@ var TestnetPRV = "0x04358394";
8804
9699
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
8805
9700
  function assertWordList(wordlist) {
8806
9701
  if (wordlist.length !== 2048) {
8807
- throw new FuelError21(
9702
+ throw new FuelError22(
8808
9703
  ErrorCode19.INVALID_WORD_LIST,
8809
9704
  `Expected word list length of 2048, but got ${wordlist.length}.`
8810
9705
  );
@@ -8812,7 +9707,7 @@ function assertWordList(wordlist) {
8812
9707
  }
8813
9708
  function assertEntropy(entropy) {
8814
9709
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
8815
- throw new FuelError21(
9710
+ throw new FuelError22(
8816
9711
  ErrorCode19.INVALID_ENTROPY,
8817
9712
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
8818
9713
  );
@@ -8823,7 +9718,7 @@ function assertMnemonic(words) {
8823
9718
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
8824
9719
  ", "
8825
9720
  )}] words, but got ${words.length}.`;
8826
- throw new FuelError21(ErrorCode19.INVALID_MNEMONIC, errorMsg);
9721
+ throw new FuelError22(ErrorCode19.INVALID_MNEMONIC, errorMsg);
8827
9722
  }
8828
9723
  }
8829
9724
  var Mnemonic = class {
@@ -8862,7 +9757,7 @@ var Mnemonic = class {
8862
9757
  static mnemonicToEntropy(phrase, wordlist = english) {
8863
9758
  const words = getWords(phrase);
8864
9759
  assertMnemonic(words);
8865
- return hexlify19(mnemonicWordsToEntropy(words, wordlist));
9760
+ return hexlify22(mnemonicWordsToEntropy(words, wordlist));
8866
9761
  }
8867
9762
  /**
8868
9763
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -8870,7 +9765,7 @@ var Mnemonic = class {
8870
9765
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8871
9766
  */
8872
9767
  static entropyToMnemonic(entropy, wordlist = english) {
8873
- const entropyBytes = arrayify17(entropy);
9768
+ const entropyBytes = arrayify18(entropy);
8874
9769
  assertWordList(wordlist);
8875
9770
  assertEntropy(entropyBytes);
8876
9771
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -8939,14 +9834,14 @@ var Mnemonic = class {
8939
9834
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8940
9835
  */
8941
9836
  static masterKeysFromSeed(seed) {
8942
- const seedArray = arrayify17(seed);
9837
+ const seedArray = arrayify18(seed);
8943
9838
  if (seedArray.length < 16 || seedArray.length > 64) {
8944
- throw new FuelError21(
9839
+ throw new FuelError22(
8945
9840
  ErrorCode19.INVALID_SEED,
8946
9841
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
8947
9842
  );
8948
9843
  }
8949
- return arrayify17(computeHmac("sha512", MasterSecret, seedArray));
9844
+ return arrayify18(computeHmac("sha512", MasterSecret, seedArray));
8950
9845
  }
8951
9846
  /**
8952
9847
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8957,7 +9852,7 @@ var Mnemonic = class {
8957
9852
  */
8958
9853
  static seedToExtendedKey(seed, testnet = false) {
8959
9854
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
8960
- const prefix = arrayify17(testnet ? TestnetPRV : MainnetPRV);
9855
+ const prefix = arrayify18(testnet ? TestnetPRV : MainnetPRV);
8961
9856
  const depth = "0x00";
8962
9857
  const fingerprint = "0x00000000";
8963
9858
  const index = "0x00000000";
@@ -8987,7 +9882,7 @@ var Mnemonic = class {
8987
9882
  * @returns A randomly generated mnemonic
8988
9883
  */
8989
9884
  static generate(size = 32, extraEntropy = "") {
8990
- const entropy = extraEntropy ? sha2563(concat4([randomBytes7(size), arrayify17(extraEntropy)])) : randomBytes7(size);
9885
+ const entropy = extraEntropy ? sha2563(concat4([randomBytes7(size), arrayify18(extraEntropy)])) : randomBytes7(size);
8991
9886
  return Mnemonic.entropyToMnemonic(entropy);
8992
9887
  }
8993
9888
  };
@@ -8995,10 +9890,10 @@ var mnemonic_default = Mnemonic;
8995
9890
 
8996
9891
  // src/hdwallet/hdwallet.ts
8997
9892
  var HARDENED_INDEX = 2147483648;
8998
- var MainnetPRV2 = hexlify20("0x0488ade4");
8999
- var MainnetPUB = hexlify20("0x0488b21e");
9000
- var TestnetPRV2 = hexlify20("0x04358394");
9001
- var TestnetPUB = hexlify20("0x043587cf");
9893
+ var MainnetPRV2 = hexlify23("0x0488ade4");
9894
+ var MainnetPUB = hexlify23("0x0488b21e");
9895
+ var TestnetPRV2 = hexlify23("0x04358394");
9896
+ var TestnetPUB = hexlify23("0x043587cf");
9002
9897
  function base58check(data) {
9003
9898
  return encodeBase582(concat5([data, dataSlice2(sha2564(sha2564(data)), 0, 4)]));
9004
9899
  }
@@ -9009,17 +9904,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
9009
9904
  return testnet ? TestnetPRV2 : MainnetPRV2;
9010
9905
  }
9011
9906
  function isPublicExtendedKey(extendedKey) {
9012
- return [MainnetPUB, TestnetPUB].includes(hexlify20(extendedKey.slice(0, 4)));
9907
+ return [MainnetPUB, TestnetPUB].includes(hexlify23(extendedKey.slice(0, 4)));
9013
9908
  }
9014
9909
  function isValidExtendedKey(extendedKey) {
9015
9910
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
9016
- hexlify20(extendedKey.slice(0, 4))
9911
+ hexlify23(extendedKey.slice(0, 4))
9017
9912
  );
9018
9913
  }
9019
9914
  function parsePath(path2, depth = 0) {
9020
9915
  const components = path2.split("/");
9021
9916
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
9022
- throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, `invalid path - ${path2}`);
9917
+ throw new FuelError23(ErrorCode20.HD_WALLET_ERROR, `invalid path - ${path2}`);
9023
9918
  }
9024
9919
  if (components[0] === "m") {
9025
9920
  components.shift();
@@ -9031,8 +9926,8 @@ function parsePath(path2, depth = 0) {
9031
9926
  var HDWallet = class {
9032
9927
  depth = 0;
9033
9928
  index = 0;
9034
- fingerprint = hexlify20("0x00000000");
9035
- parentFingerprint = hexlify20("0x00000000");
9929
+ fingerprint = hexlify23("0x00000000");
9930
+ parentFingerprint = hexlify23("0x00000000");
9036
9931
  privateKey;
9037
9932
  publicKey;
9038
9933
  chainCode;
@@ -9044,16 +9939,16 @@ var HDWallet = class {
9044
9939
  constructor(config) {
9045
9940
  if (config.privateKey) {
9046
9941
  const signer = new Signer(config.privateKey);
9047
- this.publicKey = hexlify20(signer.compressedPublicKey);
9048
- this.privateKey = hexlify20(config.privateKey);
9942
+ this.publicKey = hexlify23(signer.compressedPublicKey);
9943
+ this.privateKey = hexlify23(config.privateKey);
9049
9944
  } else {
9050
9945
  if (!config.publicKey) {
9051
- throw new FuelError22(
9946
+ throw new FuelError23(
9052
9947
  ErrorCode20.HD_WALLET_ERROR,
9053
9948
  "Both public and private Key cannot be missing. At least one should be provided."
9054
9949
  );
9055
9950
  }
9056
- this.publicKey = hexlify20(config.publicKey);
9951
+ this.publicKey = hexlify23(config.publicKey);
9057
9952
  }
9058
9953
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
9059
9954
  this.fingerprint = dataSlice2(ripemd160(sha2564(this.publicKey)), 0, 4);
@@ -9072,23 +9967,23 @@ var HDWallet = class {
9072
9967
  * @returns A new instance of HDWallet on the derived index
9073
9968
  */
9074
9969
  deriveIndex(index) {
9075
- const privateKey = this.privateKey && arrayify18(this.privateKey);
9076
- const publicKey = arrayify18(this.publicKey);
9077
- const chainCode = arrayify18(this.chainCode);
9970
+ const privateKey = this.privateKey && arrayify19(this.privateKey);
9971
+ const publicKey = arrayify19(this.publicKey);
9972
+ const chainCode = arrayify19(this.chainCode);
9078
9973
  const data = new Uint8Array(37);
9079
9974
  if (index & HARDENED_INDEX) {
9080
9975
  if (!privateKey) {
9081
- throw new FuelError22(
9976
+ throw new FuelError23(
9082
9977
  ErrorCode20.HD_WALLET_ERROR,
9083
9978
  "Cannot derive a hardened index without a private Key."
9084
9979
  );
9085
9980
  }
9086
9981
  data.set(privateKey, 1);
9087
9982
  } else {
9088
- data.set(arrayify18(this.publicKey));
9983
+ data.set(arrayify19(this.publicKey));
9089
9984
  }
9090
9985
  data.set(toBytes2(index, 4), 33);
9091
- const bytes = arrayify18(computeHmac2("sha512", chainCode, data));
9986
+ const bytes = arrayify19(computeHmac2("sha512", chainCode, data));
9092
9987
  const IL = bytes.slice(0, 32);
9093
9988
  const IR = bytes.slice(32);
9094
9989
  if (privateKey) {
@@ -9102,7 +9997,7 @@ var HDWallet = class {
9102
9997
  parentFingerprint: this.fingerprint
9103
9998
  });
9104
9999
  }
9105
- const signer = new Signer(hexlify20(IL));
10000
+ const signer = new Signer(hexlify23(IL));
9106
10001
  const Ki = signer.addPoint(publicKey);
9107
10002
  return new HDWallet({
9108
10003
  publicKey: Ki,
@@ -9131,18 +10026,18 @@ var HDWallet = class {
9131
10026
  */
9132
10027
  toExtendedKey(isPublic = false, testnet = false) {
9133
10028
  if (this.depth >= 256) {
9134
- throw new FuelError22(
10029
+ throw new FuelError23(
9135
10030
  ErrorCode20.HD_WALLET_ERROR,
9136
10031
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
9137
10032
  );
9138
10033
  }
9139
10034
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
9140
- const depth = hexlify20(Uint8Array.from([this.depth]));
10035
+ const depth = hexlify23(Uint8Array.from([this.depth]));
9141
10036
  const parentFingerprint = this.parentFingerprint;
9142
10037
  const index = toHex(this.index, 4);
9143
10038
  const chainCode = this.chainCode;
9144
10039
  const key = this.privateKey != null && !isPublic ? concat5(["0x00", this.privateKey]) : this.publicKey;
9145
- const extendedKey = arrayify18(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
10040
+ const extendedKey = arrayify19(concat5([prefix, depth, parentFingerprint, index, chainCode, key]));
9146
10041
  return base58check(extendedKey);
9147
10042
  }
9148
10043
  /**
@@ -9154,34 +10049,34 @@ var HDWallet = class {
9154
10049
  static fromSeed(seed) {
9155
10050
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
9156
10051
  return new HDWallet({
9157
- chainCode: arrayify18(masterKey.slice(32)),
9158
- privateKey: arrayify18(masterKey.slice(0, 32))
10052
+ chainCode: arrayify19(masterKey.slice(32)),
10053
+ privateKey: arrayify19(masterKey.slice(0, 32))
9159
10054
  });
9160
10055
  }
9161
10056
  static fromExtendedKey(extendedKey) {
9162
- const decoded = hexlify20(toBytes2(decodeBase58(extendedKey)));
9163
- const bytes = arrayify18(decoded);
10057
+ const decoded = hexlify23(toBytes2(decodeBase58(extendedKey)));
10058
+ const bytes = arrayify19(decoded);
9164
10059
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
9165
10060
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
9166
- throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
10061
+ throw new FuelError23(ErrorCode20.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
9167
10062
  }
9168
10063
  if (!validChecksum) {
9169
- throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
10064
+ throw new FuelError23(ErrorCode20.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
9170
10065
  }
9171
10066
  const depth = bytes[4];
9172
- const parentFingerprint = hexlify20(bytes.slice(5, 9));
9173
- const index = parseInt(hexlify20(bytes.slice(9, 13)).substring(2), 16);
9174
- const chainCode = hexlify20(bytes.slice(13, 45));
10067
+ const parentFingerprint = hexlify23(bytes.slice(5, 9));
10068
+ const index = parseInt(hexlify23(bytes.slice(9, 13)).substring(2), 16);
10069
+ const chainCode = hexlify23(bytes.slice(13, 45));
9175
10070
  const key = bytes.slice(45, 78);
9176
10071
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
9177
- throw new FuelError22(
10072
+ throw new FuelError23(
9178
10073
  ErrorCode20.HD_WALLET_ERROR,
9179
10074
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
9180
10075
  );
9181
10076
  }
9182
10077
  if (isPublicExtendedKey(bytes)) {
9183
10078
  if (key[0] !== 3) {
9184
- throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Invalid public extended key.");
10079
+ throw new FuelError23(ErrorCode20.HD_WALLET_ERROR, "Invalid public extended key.");
9185
10080
  }
9186
10081
  return new HDWallet({
9187
10082
  publicKey: key,
@@ -9192,7 +10087,7 @@ var HDWallet = class {
9192
10087
  });
9193
10088
  }
9194
10089
  if (key[0] !== 0) {
9195
- throw new FuelError22(ErrorCode20.HD_WALLET_ERROR, "Invalid private extended key.");
10090
+ throw new FuelError23(ErrorCode20.HD_WALLET_ERROR, "Invalid private extended key.");
9196
10091
  }
9197
10092
  return new HDWallet({
9198
10093
  privateKey: key.slice(1),
@@ -9422,7 +10317,7 @@ var WalletsConfig = class {
9422
10317
  tx_pointer_block_height: 0,
9423
10318
  tx_pointer_tx_idx: 0,
9424
10319
  output_index: 0,
9425
- tx_id: hexlify21(randomBytes8(32))
10320
+ tx_id: hexlify24(randomBytes8(32))
9426
10321
  });
9427
10322
  }
9428
10323
  });
@@ -9436,26 +10331,26 @@ var WalletsConfig = class {
9436
10331
  amountPerCoin
9437
10332
  }) {
9438
10333
  if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
9439
- throw new FuelError23(
9440
- FuelError23.CODES.INVALID_INPUT_PARAMETERS,
10334
+ throw new FuelError24(
10335
+ FuelError24.CODES.INVALID_INPUT_PARAMETERS,
9441
10336
  "Number of wallets must be greater than zero."
9442
10337
  );
9443
10338
  }
9444
10339
  if (Array.isArray(assets2) && assets2.length === 0 || typeof assets2 === "number" && assets2 <= 0) {
9445
- throw new FuelError23(
9446
- FuelError23.CODES.INVALID_INPUT_PARAMETERS,
10340
+ throw new FuelError24(
10341
+ FuelError24.CODES.INVALID_INPUT_PARAMETERS,
9447
10342
  "Number of assets per wallet must be greater than zero."
9448
10343
  );
9449
10344
  }
9450
10345
  if (coinsPerAsset <= 0) {
9451
- throw new FuelError23(
9452
- FuelError23.CODES.INVALID_INPUT_PARAMETERS,
10346
+ throw new FuelError24(
10347
+ FuelError24.CODES.INVALID_INPUT_PARAMETERS,
9453
10348
  "Number of coins per asset must be greater than zero."
9454
10349
  );
9455
10350
  }
9456
10351
  if (amountPerCoin < 0) {
9457
- throw new FuelError23(
9458
- FuelError23.CODES.INVALID_INPUT_PARAMETERS,
10352
+ throw new FuelError24(
10353
+ FuelError24.CODES.INVALID_INPUT_PARAMETERS,
9459
10354
  "Amount per coin must be greater than or equal to zero."
9460
10355
  );
9461
10356
  }
@@ -9529,7 +10424,7 @@ async function setupTestProviderAndWallets({
9529
10424
  import { Address as Address6 } from "@fuel-ts/address";
9530
10425
  import { randomBytes as randomBytes9 } from "@fuel-ts/crypto";
9531
10426
  import { bn as bn21 } from "@fuel-ts/math";
9532
- import { hexlify as hexlify22 } from "@fuel-ts/utils";
10427
+ import { hexlify as hexlify25 } from "@fuel-ts/utils";
9533
10428
  var TestMessage = class {
9534
10429
  sender;
9535
10430
  recipient;
@@ -9546,7 +10441,7 @@ var TestMessage = class {
9546
10441
  constructor({
9547
10442
  sender = Address6.fromRandom(),
9548
10443
  recipient = Address6.fromRandom(),
9549
- nonce = hexlify22(randomBytes9(32)),
10444
+ nonce = hexlify25(randomBytes9(32)),
9550
10445
  amount = 1e6,
9551
10446
  data = "",
9552
10447
  // Will default to empty data in order to be a spendable message